@lcap/nasl 2.20.0-beta.3 → 2.20.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/out/automate/engine/index.d.ts +1 -1
  2. package/out/automate/engine/index.js +2 -3
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/uniqueName.d.ts +1 -1
  5. package/out/automate/engine/uniqueName.js +2 -2
  6. package/out/automate/engine/uniqueName.js.map +1 -1
  7. package/out/automate/engine/utils.js +4 -1
  8. package/out/automate/engine/utils.js.map +1 -1
  9. package/out/automate/template/myProcess.d.ts +1 -1
  10. package/out/automate/template/myProcess.js +2 -2
  11. package/out/automate/template/myProcess.js.map +1 -1
  12. package/out/bak/translator.js +14 -22
  13. package/out/bak/translator.js.map +1 -1
  14. package/out/common/BaseNode.js +4 -1
  15. package/out/common/BaseNode.js.map +1 -1
  16. package/out/common/Command.d.ts +1 -0
  17. package/out/common/Command.js +5 -1
  18. package/out/common/Command.js.map +1 -1
  19. package/out/concepts/App__.d.ts +4 -0
  20. package/out/concepts/App__.js +30 -6
  21. package/out/concepts/App__.js.map +1 -1
  22. package/out/concepts/Assignee__.js +4 -3
  23. package/out/concepts/Assignee__.js.map +1 -1
  24. package/out/concepts/BatchAssignment__.js +3 -3
  25. package/out/concepts/BatchAssignment__.js.map +1 -1
  26. package/out/concepts/BindAttribute__.d.ts +7 -0
  27. package/out/concepts/BindAttribute__.js +270 -39
  28. package/out/concepts/BindAttribute__.js.map +1 -1
  29. package/out/concepts/BindDirective__.d.ts +7 -0
  30. package/out/concepts/BindDirective__.js +215 -17
  31. package/out/concepts/BindDirective__.js.map +1 -1
  32. package/out/concepts/BindStyle__.d.ts +7 -0
  33. package/out/concepts/BindStyle__.js +194 -4
  34. package/out/concepts/BindStyle__.js.map +1 -1
  35. package/out/concepts/CallFunction__.js +22 -8
  36. package/out/concepts/CallFunction__.js.map +1 -1
  37. package/out/concepts/CallInterface__.js +3 -2
  38. package/out/concepts/CallInterface__.js.map +1 -1
  39. package/out/concepts/CallLogic__.d.ts +3 -0
  40. package/out/concepts/CallLogic__.js +78 -89
  41. package/out/concepts/CallLogic__.js.map +1 -1
  42. package/out/concepts/CallQueryComponent__.js +20 -3
  43. package/out/concepts/CallQueryComponent__.js.map +1 -1
  44. package/out/concepts/ConfigGroup__.d.ts +1 -0
  45. package/out/concepts/ConfigGroup__.js +13 -0
  46. package/out/concepts/ConfigGroup__.js.map +1 -1
  47. package/out/concepts/ConfigProperty__.d.ts +19 -0
  48. package/out/concepts/ConfigProperty__.js +61 -0
  49. package/out/concepts/ConfigProperty__.js.map +1 -1
  50. package/out/concepts/Configuration__.d.ts +1 -0
  51. package/out/concepts/Configuration__.js +13 -0
  52. package/out/concepts/Configuration__.js.map +1 -1
  53. package/out/concepts/DataSource__.js.map +1 -1
  54. package/out/concepts/Destination__.d.ts +1 -0
  55. package/out/concepts/Destination__.js +61 -7
  56. package/out/concepts/Destination__.js.map +1 -1
  57. package/out/concepts/EntityProperty__.js +9 -1
  58. package/out/concepts/EntityProperty__.js.map +1 -1
  59. package/out/concepts/EnumItem__.d.ts +5 -5
  60. package/out/concepts/EnumItem__.js +6 -6
  61. package/out/concepts/Enum__.d.ts +20 -19
  62. package/out/concepts/Enum__.js +28 -1
  63. package/out/concepts/Enum__.js.map +1 -1
  64. package/out/concepts/ExternalDestination__.d.ts +1 -0
  65. package/out/concepts/ExternalDestination__.js +21 -3
  66. package/out/concepts/ExternalDestination__.js.map +1 -1
  67. package/out/concepts/ForEachStatement__.js +2 -0
  68. package/out/concepts/ForEachStatement__.js.map +1 -1
  69. package/out/concepts/Frontend__.d.ts +2 -1
  70. package/out/concepts/Frontend__.js.map +1 -1
  71. package/out/concepts/Identifier__.js +16 -5
  72. package/out/concepts/Identifier__.js.map +1 -1
  73. package/out/concepts/InterfaceParam__.js +9 -1
  74. package/out/concepts/InterfaceParam__.js.map +1 -1
  75. package/out/concepts/JSBlock__.js +5 -1
  76. package/out/concepts/JSBlock__.js.map +1 -1
  77. package/out/concepts/Logic__.d.ts +79 -79
  78. package/out/concepts/Logic__.js +16 -3
  79. package/out/concepts/Logic__.js.map +1 -1
  80. package/out/concepts/Match__.d.ts +0 -3
  81. package/out/concepts/Match__.js +11 -66
  82. package/out/concepts/Match__.js.map +1 -1
  83. package/out/concepts/MemberExpression__.js +9 -0
  84. package/out/concepts/MemberExpression__.js.map +1 -1
  85. package/out/concepts/Module__.d.ts +16 -0
  86. package/out/concepts/Module__.js +43 -0
  87. package/out/concepts/Module__.js.map +1 -1
  88. package/out/concepts/NewComposite__.d.ts +2 -4
  89. package/out/concepts/NewComposite__.js +91 -126
  90. package/out/concepts/NewComposite__.js.map +1 -1
  91. package/out/concepts/NewList__.d.ts +1 -0
  92. package/out/concepts/NewList__.js +22 -2
  93. package/out/concepts/NewList__.js.map +1 -1
  94. package/out/concepts/NewMap__.d.ts +1 -0
  95. package/out/concepts/NewMap__.js +43 -11
  96. package/out/concepts/NewMap__.js.map +1 -1
  97. package/out/concepts/OqlQueryComponent__.js +40 -12
  98. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  99. package/out/concepts/Param__.js +10 -2
  100. package/out/concepts/Param__.js.map +1 -1
  101. package/out/concepts/ProcessElement__.js +2 -1
  102. package/out/concepts/ProcessElement__.js.map +1 -1
  103. package/out/concepts/ProcessOutcome__.js +1 -1
  104. package/out/concepts/ProcessOutcome__.js.map +1 -1
  105. package/out/concepts/ProcessOutcomes__.js +1 -1
  106. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  107. package/out/concepts/Process__.js +1 -0
  108. package/out/concepts/Process__.js.map +1 -1
  109. package/out/concepts/Return__.js +10 -2
  110. package/out/concepts/Return__.js.map +1 -1
  111. package/out/concepts/StringInterpolation__.js +14 -2
  112. package/out/concepts/StringInterpolation__.js.map +1 -1
  113. package/out/concepts/StringLiteral__.js +6 -6
  114. package/out/concepts/StringLiteral__.js.map +1 -1
  115. package/out/concepts/StructureProperty__.js +9 -1
  116. package/out/concepts/StructureProperty__.js.map +1 -1
  117. package/out/concepts/TypeAnnotation__.d.ts +6 -3
  118. package/out/concepts/TypeAnnotation__.js +67 -13
  119. package/out/concepts/TypeAnnotation__.js.map +1 -1
  120. package/out/concepts/ValidationRule__.d.ts +1 -0
  121. package/out/concepts/ValidationRule__.js +53 -0
  122. package/out/concepts/ValidationRule__.js.map +1 -1
  123. package/out/concepts/Variable__.js +9 -1
  124. package/out/concepts/Variable__.js.map +1 -1
  125. package/out/concepts/ViewElement__.js +17 -1
  126. package/out/concepts/ViewElement__.js.map +1 -1
  127. package/out/concepts/View__.d.ts +1 -3
  128. package/out/concepts/View__.js +22 -11
  129. package/out/concepts/View__.js.map +1 -1
  130. package/out/concepts/basics/stdlib/nasl.collection.js +6 -1
  131. package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
  132. package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
  133. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
  134. package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
  135. package/out/concepts/basics/stdlib/nasl.core.js +34 -0
  136. package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.util.js +4 -2
  138. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  139. package/out/concepts/basics/types/index.d.ts +1 -0
  140. package/out/concepts/basics/types/index.js +3 -1
  141. package/out/concepts/basics/types/index.js.map +1 -1
  142. package/out/concepts/index__.d.ts +0 -1
  143. package/out/concepts/index__.js +0 -1
  144. package/out/concepts/index__.js.map +1 -1
  145. package/out/enums/KEYWORDS.js +8 -0
  146. package/out/enums/KEYWORDS.js.map +1 -1
  147. package/out/generator/genBundleFiles.js +24 -5
  148. package/out/generator/genBundleFiles.js.map +1 -1
  149. package/out/generator/genReleaseBody.d.ts +2 -3
  150. package/out/generator/genReleaseBody.js +97 -23
  151. package/out/generator/genReleaseBody.js.map +1 -1
  152. package/out/generator/permission.d.ts +2 -10
  153. package/out/generator/permission.js +26 -13
  154. package/out/generator/permission.js.map +1 -1
  155. package/out/server/entity2LogicNamespace.js +2 -20
  156. package/out/server/entity2LogicNamespace.js.map +1 -1
  157. package/out/server/extendBaseNode.js +16 -5
  158. package/out/server/extendBaseNode.js.map +1 -1
  159. package/out/server/formatTsUtils.d.ts +2 -1
  160. package/out/server/formatTsUtils.js +40 -10
  161. package/out/server/formatTsUtils.js.map +1 -1
  162. package/out/server/getLogics.d.ts +2 -2
  163. package/out/server/getLogics.js +3 -3
  164. package/out/server/getLogics.js.map +1 -1
  165. package/out/server/getMemberIdentifier.d.ts +1 -0
  166. package/out/server/getMemberIdentifier.js +27 -1
  167. package/out/server/getMemberIdentifier.js.map +1 -1
  168. package/out/server/index.js +1 -0
  169. package/out/server/index.js.map +1 -1
  170. package/out/server/naslServer.d.ts +7 -1
  171. package/out/server/naslServer.js +519 -46
  172. package/out/server/naslServer.js.map +1 -1
  173. package/out/server/translator.js +109 -33
  174. package/out/server/translator.js.map +1 -1
  175. package/out/service/storage/init.js +21 -1
  176. package/out/service/storage/init.js.map +1 -1
  177. package/out/templator/genCreateBlock.js +1 -3
  178. package/out/templator/genCreateBlock.js.map +1 -1
  179. package/out/templator/genCurdEditMultipleKeyBlock.js +1 -3
  180. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  181. package/out/templator/genCurdMultipleKeyBlock.js +2 -4
  182. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  183. package/out/templator/genGetBlock.js +1 -1
  184. package/out/templator/genGetBlock.js.map +1 -1
  185. package/out/templator/genGridViewBlock.js +2 -2
  186. package/out/templator/genGridViewBlock.js.map +1 -1
  187. package/out/templator/genListViewBlock.js +7 -1
  188. package/out/templator/genListViewBlock.js.map +1 -1
  189. package/out/templator/genSelectBlock.js +1 -1
  190. package/out/templator/genSelectBlock.js.map +1 -1
  191. package/out/templator/genTableBlock.js +2 -2
  192. package/out/templator/genTableBlock.js.map +1 -1
  193. package/out/templator/genUpdateBlock.js +2 -3
  194. package/out/templator/genUpdateBlock.js.map +1 -1
  195. package/out/utils/traverse.js +8 -2
  196. package/out/utils/traverse.js.map +1 -1
  197. package/package.json +2 -2
  198. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  199. package/sandbox/stdlib/dist/nasl.util.js +0 -0
  200. package/sandbox/stdlib/nasl.collection.ts +1 -0
  201. package/sandbox/stdlib/nasl.core.ts +34 -0
  202. package/sandbox/stdlib/nasl.oql.ts +71 -15
  203. package/sandbox/stdlib/nasl.util.ts +9 -3
  204. package/src/automate/engine/dist/index.dev.js +517 -0
  205. package/src/automate/engine/index.js +2 -3
  206. package/src/automate/engine/uniqueName.js +2 -2
  207. package/src/automate/engine/utils.js +4 -2
  208. package/src/automate/template/myProcess.js +2 -2
  209. package/src/bak/translator.js +16 -25
  210. package/src/common/BaseNode.ts +3 -1
  211. package/src/common/Command.ts +4 -0
  212. package/src/common/dist/BaseNode.js +1101 -0
  213. package/src/concepts/App__.ts +36 -7
  214. package/src/concepts/Assignee__.ts +4 -3
  215. package/src/concepts/BatchAssignment__.ts +3 -3
  216. package/src/concepts/BindAttribute__.ts +299 -38
  217. package/src/concepts/BindDirective__.ts +204 -31
  218. package/src/concepts/BindStyle__.ts +187 -24
  219. package/src/concepts/CallFunction__.ts +55 -10
  220. package/src/concepts/CallInterface__.ts +3 -2
  221. package/src/concepts/CallLogic__.ts +110 -90
  222. package/src/concepts/CallQueryComponent__.ts +18 -3
  223. package/src/concepts/ConfigGroup__.ts +17 -4
  224. package/src/concepts/ConfigProperty__.ts +70 -4
  225. package/src/concepts/Configuration__.ts +14 -5
  226. package/src/concepts/DataSource__.ts +4 -1
  227. package/src/concepts/Destination__.ts +61 -7
  228. package/src/concepts/EntityProperty__.ts +7 -1
  229. package/src/concepts/EnumItem__.ts +6 -6
  230. package/src/concepts/Enum__.ts +22 -19
  231. package/src/concepts/ExternalDestination__.ts +28 -8
  232. package/src/concepts/ForEachStatement__.ts +2 -0
  233. package/src/concepts/Frontend__.ts +2 -1
  234. package/src/concepts/Identifier__.ts +16 -5
  235. package/src/concepts/InterfaceParam__.ts +7 -1
  236. package/src/concepts/JSBlock__.ts +3 -2
  237. package/src/concepts/Logic__.ts +95 -83
  238. package/src/concepts/Match__.ts +31 -67
  239. package/src/concepts/MemberExpression__.ts +6 -0
  240. package/src/concepts/Module__.ts +57 -0
  241. package/src/concepts/NewComposite__.ts +95 -140
  242. package/src/concepts/NewList__.ts +23 -2
  243. package/src/concepts/NewMap__.ts +48 -24
  244. package/src/concepts/OqlQueryComponent__.ts +40 -20
  245. package/src/concepts/Param__.ts +178 -176
  246. package/src/concepts/ProcessElement__.ts +2 -1
  247. package/src/concepts/ProcessOutcome__.ts +1 -1
  248. package/src/concepts/ProcessOutcomes__.ts +1 -1
  249. package/src/concepts/Process__.ts +1 -0
  250. package/src/concepts/Return__.ts +8 -2
  251. package/src/concepts/StringInterpolation__.ts +19 -7
  252. package/src/concepts/StringLiteral__.ts +7 -6
  253. package/src/concepts/StructureProperty__.ts +7 -1
  254. package/src/concepts/TypeAnnotation__.ts +101 -14
  255. package/src/concepts/ValidationRule__.ts +58 -9
  256. package/src/concepts/Variable__.ts +11 -1
  257. package/src/concepts/ViewElement__.ts +39 -2
  258. package/src/concepts/View__.ts +26 -14
  259. package/src/concepts/basics/stdlib/dist/nasl.util.js +1602 -0
  260. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +24 -0
  261. package/src/concepts/basics/stdlib/nasl.collection.ts +6 -1
  262. package/src/concepts/basics/stdlib/nasl.configuration.ts +3 -0
  263. package/src/concepts/basics/stdlib/nasl.core.ts +33 -2
  264. package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
  265. package/src/concepts/basics/types/index.ts +1 -0
  266. package/src/concepts/dist/BindAttribute__.js +795 -0
  267. package/src/concepts/dist/BindEvent__.js +732 -0
  268. package/src/concepts/dist/CallFunction__.js +527 -0
  269. package/src/concepts/dist/CallLogic__.js +932 -0
  270. package/src/concepts/dist/Destination__.js +708 -0
  271. package/src/concepts/dist/ExternalDestination__.js +298 -0
  272. package/src/concepts/dist/Identifier__.js +311 -0
  273. package/src/concepts/dist/StringInterpolation__.js +231 -0
  274. package/src/concepts/dist/TypeAnnotation__.js +834 -0
  275. package/src/concepts/dist/ViewElement__.js +1692 -0
  276. package/src/concepts/dist/View__.js +1601 -0
  277. package/src/concepts/index__.ts +0 -1
  278. package/src/enums/KEYWORDS.ts +8 -0
  279. package/src/generator/dist/genBundleFiles.js +261 -0
  280. package/src/generator/dist/genMetaData.js +245 -0
  281. package/src/generator/dist/permission.js +405 -0
  282. package/src/generator/genBundleFiles.ts +24 -5
  283. package/src/generator/genReleaseBody.ts +75 -30
  284. package/src/generator/permission.ts +30 -14
  285. package/src/server/entity2LogicNamespace.ts +2 -20
  286. package/src/server/extendBaseNode.ts +15 -5
  287. package/src/server/formatTsUtils.ts +41 -10
  288. package/src/server/getLogics.ts +4 -4
  289. package/src/server/getMemberIdentifier.ts +27 -1
  290. package/src/server/index.ts +2 -0
  291. package/src/server/naslServer.ts +520 -48
  292. package/src/server/translator.ts +96 -34
  293. package/src/service/storage/dist/init.js +579 -0
  294. package/src/service/storage/init.ts +22 -2
  295. package/src/templator/dist/genEditTableBlock.js +204 -0
  296. package/src/templator/dist/genGridViewBlock.js +265 -0
  297. package/src/templator/dist/genListViewBlock.js +84 -0
  298. package/src/templator/dist/genTableBlock.js +209 -0
  299. package/src/templator/dist/utils.js +527 -0
  300. package/src/templator/genCreateBlock.ts +1 -3
  301. package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -3
  302. package/src/templator/genCurdMultipleKeyBlock.ts +2 -4
  303. package/src/templator/genGetBlock.ts +1 -1
  304. package/src/templator/genGridViewBlock.ts +3 -4
  305. package/src/templator/genListViewBlock.ts +9 -3
  306. package/src/templator/genSelectBlock.ts +1 -1
  307. package/src/templator/genTableBlock.ts +3 -3
  308. package/src/templator/genUpdateBlock.ts +2 -3
  309. package/src/utils/traverse.ts +10 -2
  310. package/ts-worker/lib/tsserver.js +10 -2
  311. package/ts-worker/package.json +1 -0
  312. package/ts-worker/webpack.config.js +11 -2
  313. package/out/concepts/ConstructArgument__.d.ts +0 -40
  314. package/out/concepts/ConstructArgument__.js +0 -108
  315. package/out/concepts/ConstructArgument__.js.map +0 -1
  316. package/out/concepts/Construct__.d.ts +0 -189
  317. package/out/concepts/Construct__.js +0 -340
  318. package/out/concepts/Construct__.js.map +0 -1
  319. package/out/templator/sql-parser/index.d.ts +0 -1
  320. package/out/templator/sql-parser/index.js +0 -228
  321. package/out/templator/sql-parser/index.js.map +0 -1
  322. package/out/templator/sql-parser/parser.js +0 -26664
  323. package/out/templator/sql-parser/parser.js.map +0 -1
@@ -82,7 +82,7 @@ export class Logic extends BaseNode {
82
82
  * 编译器信息
83
83
  */
84
84
  @property()
85
- compilerInfoMap: { java?: { packageName: string; className: string } } = undefined;
85
+ compilerInfoMap: { java?: { packageName: string, className: string } } = undefined;
86
86
 
87
87
  /**
88
88
  * 类型参数列表
@@ -254,24 +254,24 @@ export class Logic extends BaseNode {
254
254
  }
255
255
 
256
256
  /**
257
- * 插入类型参数
258
- * @internal
259
- * @param name 类型参数名称,如果不填会自动生成一个唯一名称
260
- */
257
+ * 插入类型参数
258
+ * @internal
259
+ * @param name 类型参数名称,如果不填会自动生成一个唯一名称
260
+ */
261
261
  _insertTypeParamAt(name: string, index: number): TypeParam;
262
262
 
263
263
  /**
264
- * 插入类型参数
265
- * @internal
266
- * @param typeParamOptions 类型参数参数
267
- */
264
+ * 插入类型参数
265
+ * @internal
266
+ * @param typeParamOptions 类型参数参数
267
+ */
268
268
  _insertTypeParamAt(typeParamOptions: Partial<TypeParam>, index: number): TypeParam;
269
269
 
270
270
  /**
271
- * 插入类型参数
272
- * @internal
273
- * @param typeParam 已有的类型参数实例
274
- */
271
+ * 插入类型参数
272
+ * @internal
273
+ * @param typeParam 已有的类型参数实例
274
+ */
275
275
  _insertTypeParamAt(typeParam: TypeParam, index: number): TypeParam;
276
276
 
277
277
  _insertTypeParamAt(options: string | Partial<TypeParam> | TypeParam, index: number) {
@@ -391,24 +391,24 @@ export class Logic extends BaseNode {
391
391
  }
392
392
 
393
393
  /**
394
- * 插入输入参数
395
- * @internal
396
- * @param name 输入参数名称,如果不填会自动生成一个唯一名称
397
- */
394
+ * 插入输入参数
395
+ * @internal
396
+ * @param name 输入参数名称,如果不填会自动生成一个唯一名称
397
+ */
398
398
  _insertParamAt(name: string, index: number): Param;
399
399
 
400
400
  /**
401
- * 插入输入参数
402
- * @internal
403
- * @param paramOptions 输入参数参数
404
- */
401
+ * 插入输入参数
402
+ * @internal
403
+ * @param paramOptions 输入参数参数
404
+ */
405
405
  _insertParamAt(paramOptions: Partial<Param>, index: number): Param;
406
406
 
407
407
  /**
408
- * 插入输入参数
409
- * @internal
410
- * @param param 已有的输入参数实例
411
- */
408
+ * 插入输入参数
409
+ * @internal
410
+ * @param param 已有的输入参数实例
411
+ */
412
412
  _insertParamAt(param: Param, index: number): Param;
413
413
 
414
414
  _insertParamAt(options: string | Partial<Param> | Param, index: number) {
@@ -528,24 +528,24 @@ export class Logic extends BaseNode {
528
528
  }
529
529
 
530
530
  /**
531
- * 插入输出参数
532
- * @internal
533
- * @param name 输出参数名称,如果不填会自动生成一个唯一名称
534
- */
531
+ * 插入输出参数
532
+ * @internal
533
+ * @param name 输出参数名称,如果不填会自动生成一个唯一名称
534
+ */
535
535
  _insertReturnAt(name: string, index: number): Return;
536
536
 
537
537
  /**
538
- * 插入输出参数
539
- * @internal
540
- * @param retOptions 输出参数参数
541
- */
538
+ * 插入输出参数
539
+ * @internal
540
+ * @param retOptions 输出参数参数
541
+ */
542
542
  _insertReturnAt(retOptions: Partial<Return>, index: number): Return;
543
543
 
544
544
  /**
545
- * 插入输出参数
546
- * @internal
547
- * @param ret 已有的输出参数实例
548
- */
545
+ * 插入输出参数
546
+ * @internal
547
+ * @param ret 已有的输出参数实例
548
+ */
549
549
  _insertReturnAt(ret: Return, index: number): Return;
550
550
 
551
551
  _insertReturnAt(options: string | Partial<Return> | Return, index: number) {
@@ -665,24 +665,24 @@ export class Logic extends BaseNode {
665
665
  }
666
666
 
667
667
  /**
668
- * 插入变量
669
- * @internal
670
- * @param name 变量名称,如果不填会自动生成一个唯一名称
671
- */
668
+ * 插入变量
669
+ * @internal
670
+ * @param name 变量名称,如果不填会自动生成一个唯一名称
671
+ */
672
672
  _insertVariableAt(name: string, index: number): Variable;
673
673
 
674
674
  /**
675
- * 插入变量
676
- * @internal
677
- * @param variableOptions 变量参数
678
- */
675
+ * 插入变量
676
+ * @internal
677
+ * @param variableOptions 变量参数
678
+ */
679
679
  _insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
680
680
 
681
681
  /**
682
- * 插入变量
683
- * @internal
684
- * @param variable 已有的变量实例
685
- */
682
+ * 插入变量
683
+ * @internal
684
+ * @param variable 已有的变量实例
685
+ */
686
686
  _insertVariableAt(variable: Variable, index: number): Variable;
687
687
 
688
688
  _insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
@@ -798,17 +798,17 @@ export class Logic extends BaseNode {
798
798
  }
799
799
 
800
800
  /**
801
- * 插入逻辑项
802
- * @internal
803
- * @param logicItemOptions 逻辑项参数
804
- */
801
+ * 插入逻辑项
802
+ * @internal
803
+ * @param logicItemOptions 逻辑项参数
804
+ */
805
805
  _insertItemInBodyAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
806
806
 
807
807
  /**
808
- * 插入逻辑项
809
- * @internal
810
- * @param logicItem 已有的逻辑项实例
811
- */
808
+ * 插入逻辑项
809
+ * @internal
810
+ * @param logicItem 已有的逻辑项实例
811
+ */
812
812
  _insertItemInBodyAt(logicItem: LogicItem, index: number): LogicItem;
813
813
 
814
814
  _insertItemInBodyAt(options: Partial<LogicItem> | LogicItem, index: number) {
@@ -894,17 +894,17 @@ export class Logic extends BaseNode {
894
894
  }
895
895
 
896
896
  /**
897
- * 插入逻辑项
898
- * @internal
899
- * @param logicItemOptions 逻辑项参数
900
- */
897
+ * 插入逻辑项
898
+ * @internal
899
+ * @param logicItemOptions 逻辑项参数
900
+ */
901
901
  _insertItemInPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
902
902
 
903
903
  /**
904
- * 插入逻辑项
905
- * @internal
906
- * @param logicItem 已有的逻辑项实例
907
- */
904
+ * 插入逻辑项
905
+ * @internal
906
+ * @param logicItem 已有的逻辑项实例
907
+ */
908
908
  _insertItemInPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
909
909
 
910
910
  _insertItemInPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
@@ -990,9 +990,9 @@ export class Logic extends BaseNode {
990
990
  }
991
991
 
992
992
  /**
993
- * 删除事务
994
- * @param name 事务名称
995
- */
993
+ * 删除事务
994
+ * @param name 事务名称
995
+ */
996
996
  removeTransactional(name: string): void;
997
997
 
998
998
  /**
@@ -1038,9 +1038,9 @@ export class Logic extends BaseNode {
1038
1038
  }
1039
1039
 
1040
1040
  /**
1041
- * 删除类型参数
1042
- * @param name 类型参数名称
1043
- */
1041
+ * 删除类型参数
1042
+ * @param name 类型参数名称
1043
+ */
1044
1044
  removeTypeParam(name: string): void;
1045
1045
 
1046
1046
  /**
@@ -1086,9 +1086,9 @@ export class Logic extends BaseNode {
1086
1086
  }
1087
1087
 
1088
1088
  /**
1089
- * 删除输入参数
1090
- * @param name 输入参数名称
1091
- */
1089
+ * 删除输入参数
1090
+ * @param name 输入参数名称
1091
+ */
1092
1092
  removeParam(name: string): void;
1093
1093
 
1094
1094
  /**
@@ -1134,9 +1134,9 @@ export class Logic extends BaseNode {
1134
1134
  }
1135
1135
 
1136
1136
  /**
1137
- * 删除输出参数
1138
- * @param name 输出参数名称
1139
- */
1137
+ * 删除输出参数
1138
+ * @param name 输出参数名称
1139
+ */
1140
1140
  removeReturn(name: string): void;
1141
1141
 
1142
1142
  /**
@@ -1182,9 +1182,9 @@ export class Logic extends BaseNode {
1182
1182
  }
1183
1183
 
1184
1184
  /**
1185
- * 删除变量
1186
- * @param name 变量名称
1187
- */
1185
+ * 删除变量
1186
+ * @param name 变量名称
1187
+ */
1188
1188
  removeVariable(name: string): void;
1189
1189
 
1190
1190
  /**
@@ -1360,6 +1360,8 @@ export class Logic extends BaseNode {
1360
1360
  }
1361
1361
 
1362
1362
  toJSContent(code: string, state?: TranslatorState): string {
1363
+ // 兼容前端事件逻辑参数中的 current event,deleteBy updateBy 需要对 current、event 进行预处理
1364
+ code += `var __currentArg;var __eventArg;try {__currentArg = current;__eventArg = event;} catch(e) {}`;
1363
1365
  // params
1364
1366
  if (Array.isArray(this.params)) {
1365
1367
  this.params.forEach((param) => {
@@ -1609,12 +1611,17 @@ export class Logic extends BaseNode {
1609
1611
  const needGetSourceMapOqlList: Promise<any>[] = [];
1610
1612
  this.traverseChildren((el) => {
1611
1613
  if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
1612
- const jsCode = el.toJS();
1613
- const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && jsCode.includes(`${variable.name} = `));
1614
+ let jsCode = '';
1615
+ try {
1616
+ jsCode = el.toJS();
1617
+ } catch (error) {
1618
+
1619
+ }
1620
+ const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && jsCode.startsWith(`${variable.name} = `));
1614
1621
  if (advanceVar && !advanceMap.get(advanceVar)) {
1615
1622
  advanceMap.set(advanceVar, el);
1616
1623
  }
1617
- const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && jsCode.includes(`${ret.name} = `));
1624
+ const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && jsCode.startsWith(`${ret.name} = `));
1618
1625
  if (advanceRn && !advanceMap.get(advanceRn)) {
1619
1626
  advanceMap.set(advanceRn, el);
1620
1627
  }
@@ -1699,6 +1706,10 @@ export class Logic extends BaseNode {
1699
1706
  const rightNode: any = assignment.right;
1700
1707
  code += ' = ';
1701
1708
  code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
1709
+ } else if (assignment.right.concept === 'NewComposite' && (assignment.right as any).typeAnnotation?.typeKind === 'anonymousStructure') {
1710
+ const rightNode: any = assignment.right;
1711
+ code += ' = ';
1712
+ code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
1702
1713
  } else {
1703
1714
  const rightNode: any = assignment.right;
1704
1715
  // 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
@@ -1748,6 +1759,7 @@ export class Logic extends BaseNode {
1748
1759
  }
1749
1760
 
1750
1761
  getRightCode(code: string, assignment: Assignment | BatchAssignment, rightNode: any): string {
1762
+ code = code.replaceAll('\n', ' ');
1751
1763
  if (assignment instanceof Assignment && !assignment.right)
1752
1764
  return code;
1753
1765
 
@@ -49,6 +49,8 @@ export class Match extends LogicItem {
49
49
  @property('MatchCase')
50
50
  cases: Array<MatchCase> = [];
51
51
 
52
+
53
+
52
54
  /**
53
55
  * @param source 需要合并的部分参数
54
56
  */
@@ -62,6 +64,13 @@ export class Match extends LogicItem {
62
64
  return super.from(source, parentNode, parentKey) as Match;
63
65
  }
64
66
 
67
+
68
+
69
+
70
+
71
+
72
+
73
+
65
74
  /**
66
75
  * 插入匹配分支
67
76
  * @internal
@@ -94,6 +103,8 @@ export class Match extends LogicItem {
94
103
  return matchCase;
95
104
  }
96
105
 
106
+
107
+
97
108
  /**
98
109
  * 插入匹配分支
99
110
  * @param matchCaseOptions 匹配分支参数
@@ -116,6 +127,8 @@ export class Match extends LogicItem {
116
127
  return node;
117
128
  }
118
129
 
130
+
131
+
119
132
  /**
120
133
  * 添加匹配分支
121
134
  * @internal
@@ -135,6 +148,8 @@ export class Match extends LogicItem {
135
148
  return this._insertMatchCaseAt(options as any, index);
136
149
  }
137
150
 
151
+
152
+
138
153
  /**
139
154
  * 添加匹配分支
140
155
  * @param matchCaseOptions 匹配分支参数
@@ -158,6 +173,9 @@ export class Match extends LogicItem {
158
173
  return node;
159
174
  }
160
175
 
176
+
177
+
178
+
161
179
  /**
162
180
  * 删除逻辑项
163
181
  * @param name 逻辑项名称
@@ -183,6 +201,8 @@ export class Match extends LogicItem {
183
201
  return expression.delete();
184
202
  }
185
203
 
204
+
205
+
186
206
  /**
187
207
  * 删除匹配分支
188
208
  * @param matchCase 已有的匹配分支实例
@@ -190,7 +210,7 @@ export class Match extends LogicItem {
190
210
  removeMatchCaseInCases(matchCase: MatchCase): void;
191
211
 
192
212
  removeMatchCaseInCases(options: MatchCase) {
193
- const matchCase: MatchCase = options;
213
+ let matchCase: MatchCase = options;
194
214
  return matchCase.delete();
195
215
  }
196
216
 
@@ -407,51 +427,6 @@ export class Match extends LogicItem {
407
427
  return false;
408
428
  }
409
429
 
410
- // 获取在页面中的名字
411
- get inViewName() {
412
- const nameList: string[] = [];
413
- let node: BaseNode = this;
414
- while (node) {
415
- if (node === this) {
416
- nameList.unshift('viewMatchExpression');
417
- } else {
418
- nameList.unshift(node.name);
419
- }
420
- if (node.concept === 'ViewElement') {
421
- node = null;
422
- } else {
423
- nameList.unshift(node.parentKey);
424
- node = node.parentNode;
425
- }
426
- }
427
- return nameList.join('_').replace(/-/g, '_');
428
- }
429
-
430
- getViewMatchExpressionBuilder() {
431
- return `gen${this.inViewName}`;
432
- }
433
-
434
- getInViewMethod(state?: TranslatorState) {
435
- const viewElement = this?.getAncestor('ViewElement');
436
- const argsList = [];
437
- let parent = viewElement?.parentNode;
438
- let index = 0;
439
- while (parent && parent.concept !== 'View') {
440
- if ((parent as ViewElement).slotScope) {
441
- argsList.unshift(index === 0 ? 'current' : 'current' + index);
442
- index++;
443
- }
444
- parent = parent.parentNode;
445
- }
446
-
447
- let code = '';
448
- code += `${this.getViewMatchExpressionBuilder()} (${argsList.join(', ')}) {\n`;
449
- code += `return ${this.toJS()}`;
450
- code += `;\n`;
451
- code += '}';
452
- return code;
453
- }
454
-
455
430
  onChange($event?: EventPayload): void {
456
431
  const { action, object, eventList } = $event || {};
457
432
  // expression修改时,通知tsserver,让tsserver重新生成ts文件,为了后续能获取expression的类型
@@ -467,18 +442,14 @@ export class Match extends LogicItem {
467
442
  if (state?.finalCode === false) {
468
443
  return this.toUI();
469
444
  } else {
470
- const viewElement = this?.getAncestor('ViewElement');
471
- const argsList = [];
472
- let parent = viewElement?.parentNode;
473
- let index = 0;
474
- while (parent && parent.concept !== 'View') {
475
- if ((parent as ViewElement).slotScope) {
476
- argsList.unshift(index === 0 ? 'current' : 'current' + index);
477
- index++;
478
- }
479
- parent = parent.parentNode;
480
- }
481
- return `${this.getViewMatchExpressionBuilder()}(${argsList.join(', ')})`;
445
+ // let code = 'await (async () => {\n';
446
+ // if (this.expression && Array.isArray(this.cases)) {
447
+ // this.cases.forEach((item, index) => {
448
+ // code += item?.toJS?.(this.expression, index, this.cases.length);
449
+ // });
450
+ // }
451
+ // code += `})()`;
452
+ // return code;
482
453
  }
483
454
  }
484
455
 
@@ -498,20 +469,13 @@ export class Match extends LogicItem {
498
469
  }
499
470
 
500
471
  toJS(state?: TranslatorState): string {
501
- let code = '';
502
- // 祖先逻辑
503
- const ancestorLogic = this.getAncestor('Logic');
504
- if (ancestorLogic) {
505
- code += 'await (async () => {\n';
506
- } else {
507
- code += '(() => {\n';
508
- }
472
+ let code = 'await (async () => {\n';
509
473
  if (this.expression && Array.isArray(this.cases)) {
510
474
  this.cases.forEach((item, index) => {
511
475
  code += item?.toJS?.(this.expression, index, this.cases.length);
512
476
  });
513
477
  }
514
- code += '})()';
478
+ code += `})()`;
515
479
  return code;
516
480
  }
517
481
 
@@ -151,6 +151,8 @@ export class MemberExpression extends LogicItem {
151
151
  // 如果是枚举取值
152
152
  if (this.object?.concept === 'Identifier' && (this.object as Identifier)?.isEnum() && this.property?.concept === 'Identifier') {
153
153
  return `"${this.property?.name}"`;
154
+ } else if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') && this.property?.name === 'length') {
155
+ return `Object.keys(${this.object?.toJS()}).length`;
154
156
  }
155
157
  const object = String(this.object?.toVue(options)); // undefined 也让正常展示
156
158
  const property = String(this.property?.toVue(options));
@@ -169,6 +171,8 @@ export class MemberExpression extends LogicItem {
169
171
  // 如果是枚举取值
170
172
  if (this.object?.concept === 'Identifier' && (this.object as Identifier)?.isEnum() && this.property?.concept === 'Identifier') {
171
173
  return `${this.object?.name}.${this.property?.name}`;
174
+ } else if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') && this.property?.name === 'length') {
175
+ return `Object.keys(${this.object?.toJS()}).length`;
172
176
  }
173
177
  const object: string = this.object?.toUI();
174
178
  const property = this.property?.toUI();
@@ -180,6 +184,8 @@ export class MemberExpression extends LogicItem {
180
184
  // 如果是枚举取值
181
185
  if (this.object?.concept === 'Identifier' && (this.object as Identifier)?.isEnum() && this.property?.concept === 'Identifier') {
182
186
  return `"${this.property?.name}"`;
187
+ } else if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') && this.property?.name === 'length') {
188
+ return `Object.keys(${this.object?.toJS()}).length`;
183
189
  }
184
190
  const object: string = this.object?.toJS();
185
191
  const property = this.property?.toJS();
@@ -25,6 +25,7 @@ import View from './View__';
25
25
  import Variable from './Variable__';
26
26
  import Process from './Process__';
27
27
  import ViewComponent from './ViewComponent__';
28
+ import Configuration from './Configuration__';
28
29
  import App from './App__';
29
30
 
30
31
  /**
@@ -134,6 +135,12 @@ export class Module extends BaseNode {
134
135
  @property('ViewComponent')
135
136
  viewComponents: Array<ViewComponent> = [];
136
137
 
138
+ /**
139
+ * 配置管理
140
+ */
141
+ @property('Configuration')
142
+ configuration: Configuration = undefined;
143
+
137
144
  /**
138
145
  * 祖先 App
139
146
  */
@@ -1895,6 +1902,56 @@ export class Module extends BaseNode {
1895
1902
  return params;
1896
1903
  }
1897
1904
 
1905
+
1906
+
1907
+ /**
1908
+ * 删除配置管理
1909
+ * @param name 配置管理名称
1910
+ */
1911
+ removeConfiguration(name: string): void;
1912
+
1913
+ /**
1914
+ * 删除配置管理
1915
+ * @param configuration 已有的配置管理实例
1916
+ */
1917
+ removeConfiguration(configuration: Configuration): void;
1918
+
1919
+ removeConfiguration(options: string | Configuration) {
1920
+ let configuration: Configuration;
1921
+ if (typeof options === 'string') {
1922
+ configuration = this.configuration;
1923
+ if (!configuration) {
1924
+ throw new Error('找不到配置管理 ' + options);
1925
+ }
1926
+ } else {
1927
+ configuration = options;
1928
+ }
1929
+ return configuration.delete();
1930
+ }
1931
+
1932
+ __removeConfiguration(configuration: Configuration) {
1933
+ const parentKey = configuration.parentKey;
1934
+ const params: Params = {
1935
+ parentNode: this,
1936
+ parentKey,
1937
+ index: -1,
1938
+ object: null,
1939
+ oldObject: configuration,
1940
+ };
1941
+ if (parentKey) {
1942
+ params.parentKey = parentKey;
1943
+ if (Array.isArray((this as any)[parentKey])) {
1944
+ const index = (this as any)[parentKey].indexOf(configuration);
1945
+ ~index && (this as any)[parentKey].splice(index, 1);
1946
+ params.index = index;
1947
+ } else if ((this as any)[parentKey] === configuration) {
1948
+ params.index = 0;
1949
+ (this as any)[parentKey] = undefined;
1950
+ }
1951
+ }
1952
+ return params;
1953
+ }
1954
+
1898
1955
  //================================================================================
1899
1956
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1900
1957
  // 自动生成的代码已结束。下面可以手动编写。