@lcap/nasl 1.0.0-alpha.13 → 1.0.0-alpha.16

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 (324) hide show
  1. package/out/automate/engine/index.d.ts +1 -1
  2. package/out/automate/engine/index.js +73 -25
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/utils.js +7 -6
  5. package/out/automate/engine/utils.js.map +1 -1
  6. package/out/common/BaseNode.d.ts +5 -4
  7. package/out/common/BaseNode.js +48 -41
  8. package/out/common/BaseNode.js.map +1 -1
  9. package/out/concepts/App__.d.ts +18 -1
  10. package/out/concepts/App__.js +64 -24
  11. package/out/concepts/App__.js.map +1 -1
  12. package/out/concepts/Argument__.js +2 -2
  13. package/out/concepts/Argument__.js.map +1 -1
  14. package/out/concepts/Assignee__.d.ts +190 -0
  15. package/out/concepts/Assignee__.js +264 -0
  16. package/out/concepts/Assignee__.js.map +1 -0
  17. package/out/concepts/BinaryExpression__.js +6 -6
  18. package/out/concepts/BinaryExpression__.js.map +1 -1
  19. package/out/concepts/BindAttribute__.d.ts +19 -0
  20. package/out/concepts/BindAttribute__.js +36 -2
  21. package/out/concepts/BindAttribute__.js.map +1 -1
  22. package/out/concepts/BindDirective__.js +21 -1
  23. package/out/concepts/BindDirective__.js.map +1 -1
  24. package/out/concepts/BindEvent__.d.ts +1 -0
  25. package/out/concepts/BindEvent__.js +38 -14
  26. package/out/concepts/BindEvent__.js.map +1 -1
  27. package/out/concepts/CallFunction__.js +20 -7
  28. package/out/concepts/CallFunction__.js.map +1 -1
  29. package/out/concepts/CallInterface__.d.ts +11 -8
  30. package/out/concepts/CallInterface__.js +160 -23
  31. package/out/concepts/CallInterface__.js.map +1 -1
  32. package/out/concepts/CallLogic__.d.ts +1 -0
  33. package/out/concepts/CallLogic__.js +17 -7
  34. package/out/concepts/CallLogic__.js.map +1 -1
  35. package/out/concepts/CallQueryComponent__.d.ts +5 -1
  36. package/out/concepts/CallQueryComponent__.js +15 -11
  37. package/out/concepts/CallQueryComponent__.js.map +1 -1
  38. package/out/concepts/Comment__.js +6 -2
  39. package/out/concepts/Comment__.js.map +1 -1
  40. package/out/concepts/ConfigGroup__.js +1 -1
  41. package/out/concepts/ConfigGroup__.js.map +1 -1
  42. package/out/concepts/ConfigProperty__.js +1 -1
  43. package/out/concepts/ConfigProperty__.js.map +1 -1
  44. package/out/concepts/Configuration__.js +1 -1
  45. package/out/concepts/Configuration__.js.map +1 -1
  46. package/out/concepts/Destination__.d.ts +11 -0
  47. package/out/concepts/Destination__.js +59 -19
  48. package/out/concepts/Destination__.js.map +1 -1
  49. package/out/concepts/End__.js +10 -2
  50. package/out/concepts/End__.js.map +1 -1
  51. package/out/concepts/EntityProperty__.d.ts +7 -0
  52. package/out/concepts/EntityProperty__.js +60 -3
  53. package/out/concepts/EntityProperty__.js.map +1 -1
  54. package/out/concepts/Entity__.d.ts +4 -1
  55. package/out/concepts/Entity__.js +29 -12
  56. package/out/concepts/Entity__.js.map +1 -1
  57. package/out/concepts/Enum__.d.ts +4 -0
  58. package/out/concepts/Enum__.js +9 -6
  59. package/out/concepts/Enum__.js.map +1 -1
  60. package/out/concepts/Event__.js +1 -1
  61. package/out/concepts/Event__.js.map +1 -1
  62. package/out/concepts/ForEachStatement__.js +8 -12
  63. package/out/concepts/ForEachStatement__.js.map +1 -1
  64. package/out/concepts/Function__.js +5 -5
  65. package/out/concepts/Function__.js.map +1 -1
  66. package/out/concepts/Identifier__.js +26 -24
  67. package/out/concepts/Identifier__.js.map +1 -1
  68. package/out/concepts/IfStatement__.js +2 -2
  69. package/out/concepts/IfStatement__.js.map +1 -1
  70. package/out/concepts/InterfaceParam__.d.ts +2 -0
  71. package/out/concepts/InterfaceParam__.js +41 -21
  72. package/out/concepts/InterfaceParam__.js.map +1 -1
  73. package/out/concepts/Interface__.d.ts +3 -0
  74. package/out/concepts/Interface__.js +105 -9
  75. package/out/concepts/Interface__.js.map +1 -1
  76. package/out/concepts/LogicItem__.d.ts +2 -1
  77. package/out/concepts/LogicItem__.js +14 -0
  78. package/out/concepts/LogicItem__.js.map +1 -1
  79. package/out/concepts/Logic__.d.ts +3 -0
  80. package/out/concepts/Logic__.js +57 -16
  81. package/out/concepts/Logic__.js.map +1 -1
  82. package/out/concepts/MemberExpression__.js +13 -6
  83. package/out/concepts/MemberExpression__.js.map +1 -1
  84. package/out/concepts/Module__.d.ts +6 -0
  85. package/out/concepts/Module__.js +18 -8
  86. package/out/concepts/Module__.js.map +1 -1
  87. package/out/concepts/Namespace__.d.ts +4 -0
  88. package/out/concepts/Namespace__.js +23 -12
  89. package/out/concepts/Namespace__.js.map +1 -1
  90. package/out/concepts/Param__.d.ts +2 -1
  91. package/out/concepts/Param__.js +35 -22
  92. package/out/concepts/Param__.js.map +1 -1
  93. package/out/concepts/ProcessComponent__.js +2 -2
  94. package/out/concepts/ProcessComponent__.js.map +1 -1
  95. package/out/concepts/ProcessElement__.js +20 -18
  96. package/out/concepts/ProcessElement__.js.map +1 -1
  97. package/out/concepts/ProcessOutcome__.js +1 -1
  98. package/out/concepts/ProcessOutcome__.js.map +1 -1
  99. package/out/concepts/Process__.d.ts +6 -1
  100. package/out/concepts/Process__.js +18 -14
  101. package/out/concepts/Process__.js.map +1 -1
  102. package/out/concepts/QueryAggregateExpression__.js +1 -1
  103. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  104. package/out/concepts/QueryFromExpression__.js +1 -1
  105. package/out/concepts/QueryFromExpression__.js.map +1 -1
  106. package/out/concepts/QueryJoinExpression__.js +2 -2
  107. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  108. package/out/concepts/QuerySelectExpression__.js +1 -1
  109. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  110. package/out/concepts/Return__.d.ts +1 -0
  111. package/out/concepts/Return__.js +38 -25
  112. package/out/concepts/Return__.js.map +1 -1
  113. package/out/concepts/SqlQueryComponent__.js +1 -1
  114. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  115. package/out/concepts/StringLiteral__.d.ts +1 -1
  116. package/out/concepts/StringLiteral__.js +2 -2
  117. package/out/concepts/StringLiteral__.js.map +1 -1
  118. package/out/concepts/StructureProperty__.d.ts +5 -4
  119. package/out/concepts/StructureProperty__.js +54 -31
  120. package/out/concepts/StructureProperty__.js.map +1 -1
  121. package/out/concepts/Structure__.d.ts +1 -0
  122. package/out/concepts/Structure__.js +18 -5
  123. package/out/concepts/Structure__.js.map +1 -1
  124. package/out/concepts/SwitchCase__.js +3 -3
  125. package/out/concepts/SwitchCase__.js.map +1 -1
  126. package/out/concepts/SwitchStatement__.js +1 -1
  127. package/out/concepts/SwitchStatement__.js.map +1 -1
  128. package/out/concepts/TypeAnnotation__.d.ts +3 -5
  129. package/out/concepts/TypeAnnotation__.js +36 -14
  130. package/out/concepts/TypeAnnotation__.js.map +1 -1
  131. package/out/concepts/UnaryExpression__.js +4 -2
  132. package/out/concepts/UnaryExpression__.js.map +1 -1
  133. package/out/concepts/ValidationRule__.d.ts +1 -0
  134. package/out/concepts/ValidationRule__.js +27 -1
  135. package/out/concepts/ValidationRule__.js.map +1 -1
  136. package/out/concepts/Variable__.d.ts +1 -0
  137. package/out/concepts/Variable__.js +38 -25
  138. package/out/concepts/Variable__.js.map +1 -1
  139. package/out/concepts/ViewComponent__.js +5 -5
  140. package/out/concepts/ViewComponent__.js.map +1 -1
  141. package/out/concepts/ViewElement__.d.ts +7 -1
  142. package/out/concepts/ViewElement__.js +154 -117
  143. package/out/concepts/ViewElement__.js.map +1 -1
  144. package/out/concepts/View__.d.ts +4 -0
  145. package/out/concepts/View__.js +38 -25
  146. package/out/concepts/View__.js.map +1 -1
  147. package/out/concepts/WhileStatement__.js +1 -1
  148. package/out/concepts/WhileStatement__.js.map +1 -1
  149. package/out/concepts/basics/stdlib/index.js +3 -1
  150. package/out/concepts/basics/stdlib/index.js.map +1 -1
  151. package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
  152. package/out/concepts/basics/stdlib/nasl.auth.js +30 -0
  153. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
  154. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
  155. package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
  156. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
  157. package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
  158. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  159. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
  160. package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
  161. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
  162. package/out/concepts/basics/stdlib/nasl.util.js +49 -41
  163. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  164. package/out/concepts/basics/stdlib/nasl.validation.js +26 -20
  165. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  166. package/out/concepts/basics/types/coreTypeList.js +11 -11
  167. package/out/concepts/basics/types/coreTypeList.js.map +1 -1
  168. package/out/concepts/index__.d.ts +1 -0
  169. package/out/concepts/index__.js +1 -0
  170. package/out/concepts/index__.js.map +1 -1
  171. package/out/enums/KEYWORDS.js +1 -1
  172. package/out/enums/KEYWORDS.js.map +1 -1
  173. package/out/generator/genBundleFiles.d.ts +1 -0
  174. package/out/generator/genBundleFiles.js +122 -93
  175. package/out/generator/genBundleFiles.js.map +1 -1
  176. package/out/manager/diagnostic.d.ts +1 -1
  177. package/out/server/createUiTs.d.ts +1 -0
  178. package/out/server/createUiTs.js +19 -2
  179. package/out/server/createUiTs.js.map +1 -1
  180. package/out/server/entity2LogicNamespace.js +24 -9
  181. package/out/server/entity2LogicNamespace.js.map +1 -1
  182. package/out/server/getExtensionModules.js +2 -0
  183. package/out/server/getExtensionModules.js.map +1 -1
  184. package/out/server/getLogics.js +40 -56
  185. package/out/server/getLogics.js.map +1 -1
  186. package/out/server/getMemberIdentifier.d.ts +4 -0
  187. package/out/server/getMemberIdentifier.js +90 -48
  188. package/out/server/getMemberIdentifier.js.map +1 -1
  189. package/out/server/getProcesses.d.ts +2 -2
  190. package/out/server/getProcesses.js +34 -11
  191. package/out/server/getProcesses.js.map +1 -1
  192. package/out/server/index.js +4 -0
  193. package/out/server/index.js.map +1 -1
  194. package/out/server/naslServer.d.ts +11 -30
  195. package/out/server/naslServer.js +410 -199
  196. package/out/server/naslServer.js.map +1 -1
  197. package/out/server/process2LogicNamespace.d.ts +10 -0
  198. package/out/server/process2LogicNamespace.js +16 -0
  199. package/out/server/process2LogicNamespace.js.map +1 -1
  200. package/out/server/translator.d.ts +22 -3
  201. package/out/server/translator.js +336 -130
  202. package/out/server/translator.js.map +1 -1
  203. package/out/service/storage/init.js +29 -15
  204. package/out/service/storage/init.js.map +1 -1
  205. package/out/templator/genCreateBlock.js +5 -5
  206. package/out/templator/genCreateBlock.js.map +1 -1
  207. package/out/templator/genCurdEditMultipleKeyBlock.js +9 -13
  208. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  209. package/out/templator/genCurdMultipleKeyBlock.js +7 -7
  210. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  211. package/out/templator/genEditTableBlock.js +2 -2
  212. package/out/templator/genEditTableBlock.js.map +1 -1
  213. package/out/templator/genGetBlock.js +4 -2
  214. package/out/templator/genGetBlock.js.map +1 -1
  215. package/out/templator/genGridViewBlock.d.ts +1 -1
  216. package/out/templator/genGridViewBlock.js +3 -3
  217. package/out/templator/genGridViewBlock.js.map +1 -1
  218. package/out/templator/genQueryComponent.d.ts +2 -0
  219. package/out/templator/genQueryComponent.js +1 -0
  220. package/out/templator/genQueryComponent.js.map +1 -1
  221. package/out/templator/genTableBlock.d.ts +1 -1
  222. package/out/templator/genTableBlock.js +3 -3
  223. package/out/templator/genTableBlock.js.map +1 -1
  224. package/out/templator/genUpdateBlock.js +7 -7
  225. package/out/templator/genUpdateBlock.js.map +1 -1
  226. package/out/templator/utils.d.ts +3 -1
  227. package/out/templator/utils.js +2 -1
  228. package/out/templator/utils.js.map +1 -1
  229. package/out/utils/index.d.ts +6 -0
  230. package/out/utils/index.js +20 -1
  231. package/out/utils/index.js.map +1 -1
  232. package/package.json +2 -1
  233. package/src/automate/engine/index.js +73 -25
  234. package/src/automate/engine/utils.js +7 -6
  235. package/src/common/BaseNode.ts +51 -42
  236. package/src/concepts/App__.ts +104 -26
  237. package/src/concepts/Argument__.ts +3 -2
  238. package/src/concepts/Assignee__.ts +437 -0
  239. package/src/concepts/BinaryExpression__.ts +7 -6
  240. package/src/concepts/BindAttribute__.ts +51 -2
  241. package/src/concepts/BindDirective__.ts +20 -1
  242. package/src/concepts/BindEvent__.ts +39 -16
  243. package/src/concepts/CallFunction__.ts +21 -8
  244. package/src/concepts/CallInterface__.ts +161 -42
  245. package/src/concepts/CallLogic__.ts +21 -9
  246. package/src/concepts/CallQueryComponent__.ts +15 -13
  247. package/src/concepts/Comment__.ts +6 -2
  248. package/src/concepts/ConfigGroup__.ts +1 -1
  249. package/src/concepts/ConfigProperty__.ts +1 -1
  250. package/src/concepts/Configuration__.ts +1 -1
  251. package/src/concepts/Destination__.ts +57 -19
  252. package/src/concepts/End__.ts +9 -11
  253. package/src/concepts/EntityProperty__.ts +56 -3
  254. package/src/concepts/Entity__.ts +33 -20
  255. package/src/concepts/Enum__.ts +8 -7
  256. package/src/concepts/Event__.ts +1 -1
  257. package/src/concepts/ForEachStatement__.ts +8 -13
  258. package/src/concepts/Function__.ts +5 -5
  259. package/src/concepts/Identifier__.ts +31 -26
  260. package/src/concepts/IfStatement__.ts +2 -2
  261. package/src/concepts/InterfaceParam__.ts +39 -20
  262. package/src/concepts/Interface__.ts +103 -9
  263. package/src/concepts/LogicItem__.ts +16 -1
  264. package/src/concepts/Logic__.ts +60 -18
  265. package/src/concepts/MemberExpression__.ts +18 -6
  266. package/src/concepts/Module__.ts +19 -8
  267. package/src/concepts/Namespace__.ts +24 -12
  268. package/src/concepts/Param__.ts +34 -23
  269. package/src/concepts/ProcessComponent__.ts +2 -2
  270. package/src/concepts/ProcessElement__.ts +51 -50
  271. package/src/concepts/ProcessOutcome__.ts +1 -1
  272. package/src/concepts/Process__.ts +32 -28
  273. package/src/concepts/QueryAggregateExpression__.ts +1 -1
  274. package/src/concepts/QueryFromExpression__.ts +1 -1
  275. package/src/concepts/QueryJoinExpression__.ts +2 -2
  276. package/src/concepts/QuerySelectExpression__.ts +1 -1
  277. package/src/concepts/Return__.ts +35 -25
  278. package/src/concepts/SqlQueryComponent__.ts +1 -1
  279. package/src/concepts/StringLiteral__.ts +2 -2
  280. package/src/concepts/StructureProperty__.ts +49 -29
  281. package/src/concepts/Structure__.ts +17 -5
  282. package/src/concepts/SwitchCase__.ts +3 -3
  283. package/src/concepts/SwitchStatement__.ts +1 -1
  284. package/src/concepts/TypeAnnotation__.ts +34 -12
  285. package/src/concepts/UnaryExpression__.ts +4 -2
  286. package/src/concepts/ValidationRule__.ts +24 -1
  287. package/src/concepts/Variable__.ts +35 -24
  288. package/src/concepts/ViewComponent__.ts +5 -5
  289. package/src/concepts/ViewElement__.ts +168 -113
  290. package/src/concepts/View__.ts +44 -25
  291. package/src/concepts/WhileStatement__.ts +1 -1
  292. package/src/concepts/basics/stdlib/index.ts +3 -1
  293. package/src/concepts/basics/stdlib/nasl.auth.ts +26 -0
  294. package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
  295. package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
  296. package/src/concepts/basics/stdlib/nasl.util.ts +49 -41
  297. package/src/concepts/basics/stdlib/nasl.validation.ts +17 -11
  298. package/src/concepts/basics/types/coreTypeList.ts +11 -11
  299. package/src/concepts/index__.ts +1 -0
  300. package/src/enums/KEYWORDS.ts +1 -1
  301. package/src/generator/genBundleFiles.ts +131 -112
  302. package/src/manager/diagnostic.ts +1 -1
  303. package/src/server/createUiTs.ts +22 -4
  304. package/src/server/entity2LogicNamespace.ts +25 -9
  305. package/src/server/getExtensionModules.ts +2 -0
  306. package/src/server/getLogics.ts +42 -58
  307. package/src/server/getMemberIdentifier.ts +88 -46
  308. package/src/server/getProcesses.ts +32 -9
  309. package/src/server/index.ts +12 -1
  310. package/src/server/naslServer.ts +422 -215
  311. package/src/server/process2LogicNamespace.ts +17 -1
  312. package/src/server/translator.ts +392 -134
  313. package/src/service/storage/init.ts +27 -16
  314. package/src/templator/genCreateBlock.ts +5 -5
  315. package/src/templator/genCurdEditMultipleKeyBlock.ts +25 -26
  316. package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
  317. package/src/templator/genEditTableBlock.ts +2 -2
  318. package/src/templator/genGetBlock.ts +5 -7
  319. package/src/templator/genGridViewBlock.ts +4 -7
  320. package/src/templator/genQueryComponent.ts +1 -0
  321. package/src/templator/genTableBlock.ts +4 -7
  322. package/src/templator/genUpdateBlock.ts +7 -8
  323. package/src/templator/utils.ts +2 -1
  324. package/src/utils/index.ts +19 -0
@@ -272,7 +272,7 @@ export class View extends BaseNode {
272
272
  name: options,
273
273
  }, this, 'elements');
274
274
  } else if (options instanceof ViewElement) {
275
- options.delete(); // 同一实例不支持多处存在
275
+ options.ensureDelete(); // 同一实例不支持多处存在
276
276
  viewElement = options;
277
277
  Object.assign(viewElement, relationOptions);
278
278
  } else {
@@ -414,7 +414,7 @@ export class View extends BaseNode {
414
414
  name: options,
415
415
  }, this, 'params');
416
416
  } else if (options instanceof Param) {
417
- options.delete(); // 同一实例不支持多处存在
417
+ options.ensureDelete(); // 同一实例不支持多处存在
418
418
  param = options;
419
419
  Object.assign(param, relationOptions);
420
420
  } else {
@@ -556,7 +556,7 @@ export class View extends BaseNode {
556
556
  name: options,
557
557
  }, this, 'variables');
558
558
  } else if (options instanceof Variable) {
559
- options.delete(); // 同一实例不支持多处存在
559
+ options.ensureDelete(); // 同一实例不支持多处存在
560
560
  variable = options;
561
561
  Object.assign(variable, relationOptions);
562
562
  } else {
@@ -698,7 +698,7 @@ export class View extends BaseNode {
698
698
  name: options,
699
699
  }, this, 'logics');
700
700
  } else if (options instanceof Logic) {
701
- options.delete(); // 同一实例不支持多处存在
701
+ options.ensureDelete(); // 同一实例不支持多处存在
702
702
  logic = options;
703
703
  Object.assign(logic, relationOptions);
704
704
  } else {
@@ -840,7 +840,7 @@ export class View extends BaseNode {
840
840
  name: options,
841
841
  }, this, 'bindEvents');
842
842
  } else if (options instanceof BindEvent) {
843
- options.delete(); // 同一实例不支持多处存在
843
+ options.ensureDelete(); // 同一实例不支持多处存在
844
844
  bindEvent = options;
845
845
  Object.assign(bindEvent, relationOptions);
846
846
  } else {
@@ -984,7 +984,7 @@ export class View extends BaseNode {
984
984
  name: options,
985
985
  }, this, 'children');
986
986
  } else if (options instanceof View) {
987
- options.delete(); // 同一实例不支持多处存在
987
+ options.ensureDelete(); // 同一实例不支持多处存在
988
988
  view = options;
989
989
  Object.assign(view, relationOptions);
990
990
  } else {
@@ -1391,7 +1391,7 @@ export class View extends BaseNode {
1391
1391
  get parentAuth() {
1392
1392
  const _nameSpace = this.getTsNamespace();
1393
1393
  const mainViewName = _nameSpace.split('.')[2];
1394
- return this.app.views.find((item) => item.name === mainViewName)?.auth;
1394
+ return mainViewName ? this.app.views.find((item) => item.name === mainViewName)?.auth : this.auth;
1395
1395
  }
1396
1396
  /**
1397
1397
  * 设置页面权限
@@ -1480,15 +1480,6 @@ export class View extends BaseNode {
1480
1480
  }
1481
1481
  }
1482
1482
  }
1483
- // 全局结构体
1484
- if (Array.isArray(definition.structures)) {
1485
- definition.structures.forEach((structureOption: any) => {
1486
- const structure = Structure.from({
1487
- ...structureOption,
1488
- }, this.rootNode, 'structures');
1489
- (this.rootNode as App).addStructure(structure);
1490
- });
1491
- }
1492
1483
 
1493
1484
  // 全局逻辑
1494
1485
  if (Array.isArray(definition.logics)) {
@@ -1500,6 +1491,16 @@ export class View extends BaseNode {
1500
1491
  });
1501
1492
  }
1502
1493
 
1494
+ // 全局结构体
1495
+ if (Array.isArray(definition.structures)) {
1496
+ definition.structures.forEach((structureOption: any) => {
1497
+ const structure = Structure.from({
1498
+ ...structureOption,
1499
+ }, this.rootNode, 'structures');
1500
+ (this.rootNode as App).addStructure(structure);
1501
+ });
1502
+ }
1503
+
1503
1504
  // 页面入参
1504
1505
  if (Array.isArray(definition.viewParams)) {
1505
1506
  definition.viewParams.forEach((paramsOption: any) => {
@@ -1663,12 +1664,12 @@ export class View extends BaseNode {
1663
1664
  tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
1664
1665
  return tsName;
1665
1666
  }
1666
- // console.log(this.tsName)
1667
+
1667
1668
  let code = `export namespace ${this.tsName} {\n`;
1668
1669
  // 角色
1669
- if (this.auth && Array.isArray(this.bindRoles) && this.bindRoles.length) {
1670
+ if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
1670
1671
  code += indent(state.tabSize + 1);
1671
- code += 'export let bindRoles = [\n';
1672
+ code += 'export let __bindRoles = [\n';
1672
1673
  this.bindRoles.forEach((role) => {
1673
1674
  code += indent(state.tabSize + 1);
1674
1675
  code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
@@ -1706,15 +1707,13 @@ export class View extends BaseNode {
1706
1707
  // 逻辑
1707
1708
  if (Array.isArray(this.logics) && this.logics.length) {
1708
1709
  code += indent(state.tabSize + 1);
1709
- code += `export namespace logics {\n`;
1710
1710
  this.logics.forEach((logic) => {
1711
1711
  code += logic.toEmbeddedTS(shiftState(state, code, {
1712
1712
  tabSize: state.tabSize + 2,
1713
- }));
1713
+ }), 'noExport');
1714
1714
  code += '\n';
1715
1715
  });
1716
1716
  code += indent(state.tabSize + 1);
1717
- code += '}\n';
1718
1717
  }
1719
1718
  // 事件
1720
1719
  if (Array.isArray(this.bindEvents)) {
@@ -1746,13 +1745,14 @@ export class View extends BaseNode {
1746
1745
  code += '\n' + indent(state.tabSize + 1) + '}\n';
1747
1746
 
1748
1747
  if (Array.isArray(this.params)) {
1749
- code += indent(state.tabSize + 1) + `export function $destination(`;
1748
+ code += indent(state.tabSize + 1) + `export function $destination(options: {`;
1750
1749
  this.params.forEach((param, index) => {
1751
- code += `${param.toEmbeddedTS(shiftState(state, code, { inline: true }), true)}`;
1750
+ code += param.name + '?: ';
1751
+ code += param.typeAnnotation.toEmbeddedTS(shiftState(state, code));
1752
1752
  if (index !== this.params.length - 1)
1753
1753
  code += ', ';
1754
1754
  });
1755
- code += '){}\n';
1755
+ code += '}){}\n';
1756
1756
  }
1757
1757
  code += indent(state.tabSize) + '}\n';
1758
1758
  return code;
@@ -1810,6 +1810,25 @@ export class View extends BaseNode {
1810
1810
  return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
1811
1811
  }
1812
1812
 
1813
+ findViewByName(name: string): View {
1814
+ return utils.traverse((current) => {
1815
+ if (current.node.name === name)
1816
+ return current.node;
1817
+ }, { node: this });
1818
+ }
1819
+
1820
+ findElementByName(name: string): ViewElement {
1821
+ return this.elements[0]?.findElementByName(name);
1822
+ }
1823
+
1824
+ findElementByTag(tag: string): ViewElement {
1825
+ return this.elements[0]?.findElementByName(tag);
1826
+ }
1827
+
1828
+ findElementByAttr(name: string, value: string): ViewElement {
1829
+ return this.elements[0]?.findElementByAttr(name, value);
1830
+ }
1831
+
1813
1832
  _setAsIndexView(isIndex: boolean) {
1814
1833
  let views: View[] = [];
1815
1834
  if (this.parentNode.concept !== 'View') {
@@ -89,7 +89,7 @@ export class WhileStatement extends LogicItem {
89
89
  const relationOptions = { parentNode: this, parentKey: 'body' };
90
90
  let logicItem: LogicItem;
91
91
  if (options instanceof LogicItem) {
92
- options.delete(); // 同一实例不支持多处存在
92
+ options.ensureDelete(); // 同一实例不支持多处存在
93
93
  logicItem = options;
94
94
  Object.assign(logicItem, relationOptions);
95
95
  } else {
@@ -10,11 +10,13 @@ import naslUtil from './nasl.util';
10
10
  import naslProcess from './nasl.process';
11
11
  import naslValidation from './nasl.validation';
12
12
  import naslBrowser from './nasl.browser';
13
+ import naslAuth from './nasl.auth';
14
+ import naslConfiguration from './nasl.configuration';
13
15
 
14
16
  export { reference2TypeAnnotationList } from './reference2TypeAnnotationList';
15
17
  export const stdlibNamespace = new Namespace({
16
18
  name: 'nasl',
17
19
  path: 'nasl',
18
- children: [naslCore, naslCollection, naslInterface, naslUi, naslUtil, naslProcess, naslValidation, naslBrowser],
20
+ children: [naslCore, naslCollection, naslInterface, naslUi, naslUtil, naslProcess, naslValidation, naslBrowser, naslAuth, naslConfiguration],
19
21
  });
20
22
  export default stdlibNamespace;
@@ -0,0 +1,26 @@
1
+ import Namespace from '../../Namespace__';
2
+ import Param from '../../Param__';
3
+ import Return from '../../Return__';
4
+ import Logic from '../../Logic__';
5
+ import TypeAnnotation from '../../TypeAnnotation__';
6
+
7
+ export default new Namespace({
8
+ name: 'auth',
9
+ logics: [
10
+ new Logic({
11
+ name: 'hasAuth',
12
+ params: [
13
+ new Param({
14
+ name: 'authPath',
15
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
16
+ }),
17
+ ],
18
+ returns: [],
19
+ }),
20
+ new Logic({
21
+ name: 'logout',
22
+ params: [],
23
+ returns: [],
24
+ }),
25
+ ],
26
+ });
@@ -9,22 +9,13 @@ export default new Namespace({
9
9
  logics: [
10
10
  new Logic({
11
11
  name: 'requestFullscreen',
12
- params: [
13
- ],
12
+ params: [],
13
+ body: [],
14
14
  }),
15
15
  new Logic({
16
16
  name: 'exitFullscreen',
17
- }),
18
- new Logic({
19
- name: 'hasAuth',
20
- params: [
21
- new Param({
22
- name: 'authPath',
23
- typeAnnotation: TypeAnnotation.createPrimitive('String'),
24
- }),
25
- ],
26
- returns: [
27
- ],
17
+ params: [],
18
+ body: [],
28
19
  }),
29
20
  new Logic({
30
21
  name: 'getDistance',
@@ -32,40 +23,15 @@ export default new Namespace({
32
23
  new Param({
33
24
  name: 'Point1',
34
25
  typeAnnotation: TypeAnnotation.createPrimitive('String'),
26
+ required: true,
35
27
  }),
36
28
  new Param({
37
29
  name: 'Point2',
38
30
  typeAnnotation: TypeAnnotation.createPrimitive('String'),
31
+ required: true,
39
32
  }),
40
33
  ],
41
- returns: [
42
- ],
43
- }),
44
- new Logic({
45
- name: 'logOut',
46
- params: [
47
- new Param({
48
- name: 'Point1',
49
- typeAnnotation: TypeAnnotation.createPrimitive('String'),
50
- }),
51
- new Param({
52
- name: 'Point2',
53
- typeAnnotation: TypeAnnotation.createPrimitive('String'),
54
- }),
55
- ],
56
- returns: [
57
- ],
58
- }),
59
- new Logic({
60
- name: 'getConfiguration',
61
- params: [
62
- new Param({
63
- name: 'name',
64
- typeAnnotation: TypeAnnotation.createPrimitive('String'),
65
- }),
66
- ],
67
- returns: [
68
- ],
34
+ body: [],
69
35
  }),
70
36
  ],
71
37
  });
@@ -0,0 +1,21 @@
1
+ import Namespace from '../../Namespace__';
2
+ import Param from '../../Param__';
3
+ import Return from '../../Return__';
4
+ import Logic from '../../Logic__';
5
+ import TypeAnnotation from '../../TypeAnnotation__';
6
+
7
+ export default new Namespace({
8
+ name: 'configuration',
9
+ logics: [
10
+ new Logic({
11
+ name: 'getConfig',
12
+ params: [
13
+ new Param({
14
+ name: 'name',
15
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
16
+ }),
17
+ ],
18
+ returns: [],
19
+ }),
20
+ ],
21
+ });
@@ -88,11 +88,6 @@ export default new Namespace({
88
88
  new Function({
89
89
  name: 'IndexOf',
90
90
  description: '搜索字符串位置',
91
- typeParams: [
92
- new TypeParam({
93
- name: 'T',
94
- }),
95
- ],
96
91
  params: [
97
92
  new Param({
98
93
  name: 'str',
@@ -126,11 +121,6 @@ export default new Namespace({
126
121
  new Function({
127
122
  name: 'LastIndexOf',
128
123
  description: '从末尾搜索字符串位置',
129
- typeParams: [
130
- new TypeParam({
131
- name: 'T',
132
- }),
133
- ],
134
124
  params: [
135
125
  new Param({
136
126
  name: 'str',
@@ -159,11 +149,6 @@ export default new Namespace({
159
149
  new Function({
160
150
  name: 'Replace',
161
151
  description: '字符串替换',
162
- typeParams: [
163
- new TypeParam({
164
- name: 'T',
165
- }),
166
- ],
167
152
  params: [
168
153
  new Param({
169
154
  name: 'str',
@@ -187,11 +172,6 @@ export default new Namespace({
187
172
  new Function({
188
173
  name: 'SubString',
189
174
  description: '字符串截取',
190
- typeParams: [
191
- new TypeParam({
192
- name: 'T',
193
- }),
194
- ],
195
175
  params: [
196
176
  new Param({
197
177
  name: 'str',
@@ -356,7 +336,6 @@ export default new Namespace({
356
336
  new Function({
357
337
  name: 'Get',
358
338
  description: '获得集合指定索引的项',
359
- typeParams: [new TypeParam({ name: 'T' })],
360
339
  params: [
361
340
  new Param({
362
341
  name: 'list',
@@ -378,7 +357,6 @@ export default new Namespace({
378
357
  new Function({
379
358
  name: 'Set',
380
359
  description: '为集合指定索引赋值(覆盖原索引项)',
381
- typeParams: [new TypeParam({ name: 'T' })],
382
360
  params: [
383
361
  new Param({
384
362
  name: 'list',
@@ -404,7 +382,6 @@ export default new Namespace({
404
382
  new Function({
405
383
  name: 'Contains',
406
384
  description: '返回集合是否包含某一项',
407
- typeParams: [new TypeParam({ name: 'T' })],
408
385
  params: [
409
386
  new Param({
410
387
  name: 'list',
@@ -426,7 +403,6 @@ export default new Namespace({
426
403
  new Function({
427
404
  name: 'Add',
428
405
  description: '为集合末尾添加项,并返回集合长度',
429
- typeParams: [new TypeParam({ name: 'T' })],
430
406
  params: [
431
407
  new Param({
432
408
  name: 'list',
@@ -443,7 +419,6 @@ export default new Namespace({
443
419
  new Function({
444
420
  name: 'Insert',
445
421
  description: '为集合指定索引插入项(原索引项依次后推)',
446
- typeParams: [new TypeParam({ name: 'T' })],
447
422
  params: [
448
423
  new Param({
449
424
  name: 'list',
@@ -464,7 +439,6 @@ export default new Namespace({
464
439
  new Function({
465
440
  name: 'Remove',
466
441
  description: '删除集合的项',
467
- typeParams: [new TypeParam({ name: 'T' })],
468
442
  params: [
469
443
  new Param({
470
444
  name: 'list',
@@ -481,7 +455,6 @@ export default new Namespace({
481
455
  new Function({
482
456
  name: 'RemoveAt',
483
457
  description: '删除集合位于某个索引的项',
484
- typeParams: [new TypeParam({ name: 'T' })],
485
458
  params: [
486
459
  new Param({
487
460
  name: 'list',
@@ -493,14 +466,16 @@ export default new Namespace({
493
466
  name: 'index',
494
467
  typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
495
468
  }),
496
- new Param({
497
- name: 'item',
469
+ ],
470
+ returns: [
471
+ new Return({
498
472
  typeAnnotation: TypeAnnotation.createTypeParam('T'),
499
473
  }),
500
474
  ],
501
475
  }),
502
476
  new Function({
503
477
  name: 'CurrDate',
478
+ description: '返回当前日期',
504
479
  params: [],
505
480
  returns: [
506
481
  new Return({
@@ -510,7 +485,7 @@ export default new Namespace({
510
485
  }),
511
486
  new Function({
512
487
  name: 'CurrTime',
513
- description: '返回当前日期',
488
+ description: '返回当前时间',
514
489
  params: [],
515
490
  returns: [
516
491
  new Return({
@@ -588,7 +563,10 @@ export default new Namespace({
588
563
  typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
589
564
  defaultValue: 'false',
590
565
  defaultExpression: new BooleanLiteral({ value: 'false' }),
591
- options: [{ value: 'true' }, { value: 'false' }],
566
+ options: [
567
+ { text: 'true', value: 'true' },
568
+ { text: 'false', value: 'false' },
569
+ ],
592
570
  }),
593
571
  ],
594
572
  returns: [
@@ -691,7 +669,6 @@ export default new Namespace({
691
669
  new Function({
692
670
  name: 'Clone',
693
671
  description: '复制一个所选参数的实例',
694
- typeParams: [new TypeParam({ name: 'T' })],
695
672
  params: [
696
673
  new Param({
697
674
  name: 'struct',
@@ -707,7 +684,6 @@ export default new Namespace({
707
684
  new Function({
708
685
  name: 'Clear',
709
686
  description: '清除对象数据',
710
- typeParams: [new TypeParam({ name: 'T' })],
711
687
  params: [
712
688
  new Param({
713
689
  name: 'struct',
@@ -746,13 +722,45 @@ export default new Namespace({
746
722
  new Param({
747
723
  name: 'name',
748
724
  typeAnnotation: TypeAnnotation.createPrimitive('String'),
749
- }),
750
- ],
751
- returns: [
752
- new Return({
753
- typeAnnotation: TypeAnnotation.createPrimitive('String'),
754
- }),
755
- ],
756
- }),
725
+ useComponent: { type: 's-config-select' },
726
+ }),
727
+ ],
728
+ returns: [
729
+ new Return({
730
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
731
+ }),
732
+ ],
733
+ }),
734
+ // new Function({
735
+ // name: 'CreatePageOf',
736
+ // description: '将List<T>集合转换为分页集合PageOf<T>',
737
+ // params: [
738
+ // new Param({
739
+ // name: 'list',
740
+ // typeAnnotation: TypeAnnotation.createGeneric('List', {
741
+ // typeArguments: [TypeAnnotation.createTypeParam('T')],
742
+ // }),
743
+ // }),
744
+ // new Param({
745
+ // name: 'page',
746
+ // typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
747
+ // }),
748
+ // new Param({
749
+ // name: 'size',
750
+ // typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
751
+ // }),
752
+ // new Param({
753
+ // name: 'total',
754
+ // typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
755
+ // }),
756
+ // ],
757
+ // returns: [
758
+ // new Return({
759
+ // typeAnnotation: TypeAnnotation.createPrimitive('PageOf', {
760
+ // typeArguments: [TypeAnnotation.createTypeParam('T')],
761
+ // }),
762
+ // }),
763
+ // ],
764
+ // }),
757
765
  ],
758
766
  });
@@ -205,7 +205,7 @@ export default new Namespace({
205
205
  new Param({
206
206
  name: 'arr',
207
207
  typeAnnotation: TypeAnnotation.createGeneric('List', {
208
- typeArguments: [TypeAnnotation.createTypeParam('T')],
208
+ typeArguments: [TypeAnnotation.createPrimitive('Any')],
209
209
  }),
210
210
  }),
211
211
  ],
@@ -221,7 +221,7 @@ export default new Namespace({
221
221
  new Param({
222
222
  name: 'arr',
223
223
  typeAnnotation: TypeAnnotation.createGeneric('List', {
224
- typeArguments: [TypeAnnotation.createTypeParam('T')],
224
+ typeArguments: [TypeAnnotation.createPrimitive('Any')],
225
225
  }),
226
226
  }),
227
227
  ],
@@ -237,7 +237,7 @@ export default new Namespace({
237
237
  new Param({
238
238
  name: 'arr',
239
239
  typeAnnotation: TypeAnnotation.createGeneric('List', {
240
- typeArguments: [TypeAnnotation.createTypeParam('T')],
240
+ typeArguments: [TypeAnnotation.createPrimitive('Any')],
241
241
  }),
242
242
  }),
243
243
  ],
@@ -253,7 +253,7 @@ export default new Namespace({
253
253
  new Param({
254
254
  name: 'arr',
255
255
  typeAnnotation: TypeAnnotation.createGeneric('List', {
256
- typeArguments: [TypeAnnotation.createTypeParam('T')],
256
+ typeArguments: [TypeAnnotation.createPrimitive('Any')],
257
257
  }),
258
258
  }),
259
259
  ],
@@ -263,14 +263,13 @@ export default new Namespace({
263
263
  }),
264
264
  ],
265
265
  }),
266
- /*
267
266
  new Function({
268
267
  name: 'unique',
269
268
  params: [
270
269
  new Param({
271
270
  name: 'arr',
272
271
  typeAnnotation: TypeAnnotation.createGeneric('List', {
273
- typeArguments: [TypeAnnotation.createTypeParam('T')],
272
+ typeArguments: [TypeAnnotation.createPrimitive('Any')],
274
273
  }),
275
274
  }),
276
275
  ],
@@ -279,7 +278,16 @@ export default new Namespace({
279
278
  typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
280
279
  }),
281
280
  ],
282
- })*/
281
+ }),
282
+ new Function({
283
+ name: 'noDuplicates',
284
+ params: [],
285
+ returns: [
286
+ new Return({
287
+ typeAnnotation: TypeAnnotation.createPrimitive('Boolean'),
288
+ }),
289
+ ],
290
+ }),
283
291
  genEmptyParamFunction('string'),
284
292
  genEmptyParamFunction('number'),
285
293
  new Function({
@@ -412,13 +420,12 @@ export default new Namespace({
412
420
  }),
413
421
  genEmptyParamFunction('halfWidth'),
414
422
  genEmptyParamFunction('fullWidth'),
415
- /* hash ?
416
423
  new Function({
417
424
  name: 'hash',
418
425
  params: [
419
426
  new Param({
420
- name: 'divisor',
421
- typeAnnotation: TypeAnnotation.createPrimitive('Integer'),
427
+ name: 'algorithm',
428
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
422
429
  }),
423
430
  ],
424
431
  returns: [
@@ -427,7 +434,6 @@ export default new Namespace({
427
434
  }),
428
435
  ],
429
436
  }),
430
- */
431
437
  genEmptyParamFunction('hexColor'),
432
438
  genEmptyParamFunction('hex'),
433
439
  genEmptyParamFunction('creditCard'),
@@ -1,15 +1,15 @@
1
1
  import { TypeAnnotation, PRIMITIVE_TYPE } from '../../TypeAnnotation__';
2
2
 
3
3
  export const primitiveTypeList: Array<TypeAnnotation> = [
4
- TypeAnnotation.createPrimitive('Boolean', { text: 'Boolean 布尔值' }),
5
- TypeAnnotation.createPrimitive('Integer', { text: 'Integer 整数' }),
6
- TypeAnnotation.createPrimitive('Long', { text: 'Long 长整数' }),
7
- TypeAnnotation.createPrimitive('Double', { text: 'Double 小数' }),
8
- TypeAnnotation.createPrimitive('String', { text: 'String 字符串' }),
9
- TypeAnnotation.createPrimitive('Text', { text: 'Text 长文本' }),
10
- TypeAnnotation.createPrimitive('Binary', { text: 'Binary 二进制流' }),
11
- TypeAnnotation.createPrimitive('Date', { text: 'Date 日期' }),
12
- TypeAnnotation.createPrimitive('Time', { text: 'Time 时间' }),
13
- TypeAnnotation.createPrimitive('DateTime', { text: 'DateTime 日期时间' }),
14
- TypeAnnotation.createPrimitive('Email', { text: 'Email 电子邮箱' }),
4
+ TypeAnnotation.createPrimitive('Boolean'),
5
+ TypeAnnotation.createPrimitive('Integer'),
6
+ TypeAnnotation.createPrimitive('Long'),
7
+ TypeAnnotation.createPrimitive('Double'),
8
+ TypeAnnotation.createPrimitive('String'),
9
+ TypeAnnotation.createPrimitive('Text'),
10
+ TypeAnnotation.createPrimitive('Binary'),
11
+ TypeAnnotation.createPrimitive('Date'),
12
+ TypeAnnotation.createPrimitive('Time'),
13
+ TypeAnnotation.createPrimitive('DateTime'),
14
+ TypeAnnotation.createPrimitive('Email'),
15
15
  ];
@@ -70,6 +70,7 @@ export * from './Process__';
70
70
  export * from './ProcessElement__';
71
71
  export * from './ProcessComponent__';
72
72
  export * from './ProcessOutcome__';
73
+ export * from './Assignee__';
73
74
  export * from './Role__';
74
75
  export * from './Configuration__';
75
76
  export * from './ConfigGroup__';
@@ -62,7 +62,6 @@ export const KEYWORDS = [
62
62
  'enum',
63
63
  'enums',
64
64
  'eval',
65
- 'event',
66
65
  'events',
67
66
  'expect',
68
67
  'experimental',
@@ -104,6 +103,7 @@ export const KEYWORDS = [
104
103
  'is',
105
104
  'it',
106
105
  'lazy',
106
+ 'length',
107
107
  'let',
108
108
  'logging',
109
109
  'logic',