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

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 (254) hide show
  1. package/out/automate/engine/index.js +1 -1
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/common/BaseNode.d.ts +4 -4
  4. package/out/common/BaseNode.js +45 -41
  5. package/out/common/BaseNode.js.map +1 -1
  6. package/out/concepts/App__.d.ts +17 -0
  7. package/out/concepts/App__.js +54 -12
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/Argument__.js +2 -2
  10. package/out/concepts/Argument__.js.map +1 -1
  11. package/out/concepts/BinaryExpression__.js +8 -6
  12. package/out/concepts/BinaryExpression__.js.map +1 -1
  13. package/out/concepts/BindAttribute__.d.ts +21 -21
  14. package/out/concepts/BindAttribute__.js +4 -3
  15. package/out/concepts/BindAttribute__.js.map +1 -1
  16. package/out/concepts/BindDirective__.d.ts +3 -3
  17. package/out/concepts/BindDirective__.js +22 -2
  18. package/out/concepts/BindDirective__.js.map +1 -1
  19. package/out/concepts/BindEvent__.d.ts +9 -8
  20. package/out/concepts/BindEvent__.js +17 -7
  21. package/out/concepts/BindEvent__.js.map +1 -1
  22. package/out/concepts/CallFunction__.js +10 -5
  23. package/out/concepts/CallFunction__.js.map +1 -1
  24. package/out/concepts/CallInterface__.js +11 -1
  25. package/out/concepts/CallInterface__.js.map +1 -1
  26. package/out/concepts/CallLogic__.d.ts +1 -0
  27. package/out/concepts/CallLogic__.js +17 -7
  28. package/out/concepts/CallLogic__.js.map +1 -1
  29. package/out/concepts/CallQueryComponent__.d.ts +0 -1
  30. package/out/concepts/CallQueryComponent__.js +5 -8
  31. package/out/concepts/CallQueryComponent__.js.map +1 -1
  32. package/out/concepts/Comment__.js +6 -2
  33. package/out/concepts/Comment__.js.map +1 -1
  34. package/out/concepts/ConfigGroup__.js +1 -1
  35. package/out/concepts/ConfigGroup__.js.map +1 -1
  36. package/out/concepts/ConfigProperty__.js +1 -1
  37. package/out/concepts/ConfigProperty__.js.map +1 -1
  38. package/out/concepts/Configuration__.js +1 -1
  39. package/out/concepts/Configuration__.js.map +1 -1
  40. package/out/concepts/Destination__.js +10 -7
  41. package/out/concepts/Destination__.js.map +1 -1
  42. package/out/concepts/EntityProperty__.d.ts +3 -0
  43. package/out/concepts/EntityProperty__.js +38 -0
  44. package/out/concepts/EntityProperty__.js.map +1 -1
  45. package/out/concepts/Entity__.d.ts +34 -31
  46. package/out/concepts/Entity__.js +29 -12
  47. package/out/concepts/Entity__.js.map +1 -1
  48. package/out/concepts/Enum__.js +1 -1
  49. package/out/concepts/Enum__.js.map +1 -1
  50. package/out/concepts/Event__.js +1 -1
  51. package/out/concepts/Event__.js.map +1 -1
  52. package/out/concepts/ForEachStatement__.js +8 -12
  53. package/out/concepts/ForEachStatement__.js.map +1 -1
  54. package/out/concepts/Function__.js +4 -4
  55. package/out/concepts/Function__.js.map +1 -1
  56. package/out/concepts/Identifier__.js +13 -7
  57. package/out/concepts/Identifier__.js.map +1 -1
  58. package/out/concepts/IfStatement__.js +2 -2
  59. package/out/concepts/IfStatement__.js.map +1 -1
  60. package/out/concepts/InterfaceParam__.d.ts +2 -0
  61. package/out/concepts/InterfaceParam__.js +10 -0
  62. package/out/concepts/InterfaceParam__.js.map +1 -1
  63. package/out/concepts/Interface__.js +3 -3
  64. package/out/concepts/Interface__.js.map +1 -1
  65. package/out/concepts/LogicItem__.d.ts +1 -0
  66. package/out/concepts/LogicItem__.js +14 -0
  67. package/out/concepts/LogicItem__.js.map +1 -1
  68. package/out/concepts/Logic__.d.ts +1 -0
  69. package/out/concepts/Logic__.js +16 -11
  70. package/out/concepts/Logic__.js.map +1 -1
  71. package/out/concepts/Module__.js +8 -8
  72. package/out/concepts/Module__.js.map +1 -1
  73. package/out/concepts/Namespace__.js +12 -12
  74. package/out/concepts/Namespace__.js.map +1 -1
  75. package/out/concepts/Param__.d.ts +1 -0
  76. package/out/concepts/Param__.js +3 -0
  77. package/out/concepts/Param__.js.map +1 -1
  78. package/out/concepts/ProcessComponent__.js +2 -2
  79. package/out/concepts/ProcessComponent__.js.map +1 -1
  80. package/out/concepts/ProcessElement__.js +5 -5
  81. package/out/concepts/ProcessElement__.js.map +1 -1
  82. package/out/concepts/ProcessOutcome__.js +1 -1
  83. package/out/concepts/ProcessOutcome__.js.map +1 -1
  84. package/out/concepts/Process__.js +4 -4
  85. package/out/concepts/Process__.js.map +1 -1
  86. package/out/concepts/QueryFromExpression__.js +1 -1
  87. package/out/concepts/QueryFromExpression__.js.map +1 -1
  88. package/out/concepts/QueryJoinExpression__.js +2 -2
  89. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  90. package/out/concepts/QuerySelectExpression__.js +1 -1
  91. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  92. package/out/concepts/Return__.d.ts +1 -0
  93. package/out/concepts/Return__.js +6 -3
  94. package/out/concepts/Return__.js.map +1 -1
  95. package/out/concepts/StringLiteral__.d.ts +1 -1
  96. package/out/concepts/StringLiteral__.js +2 -2
  97. package/out/concepts/StringLiteral__.js.map +1 -1
  98. package/out/concepts/StructureProperty__.d.ts +3 -6
  99. package/out/concepts/StructureProperty__.js +38 -32
  100. package/out/concepts/StructureProperty__.js.map +1 -1
  101. package/out/concepts/Structure__.js +3 -3
  102. package/out/concepts/Structure__.js.map +1 -1
  103. package/out/concepts/SwitchCase__.js +3 -3
  104. package/out/concepts/SwitchCase__.js.map +1 -1
  105. package/out/concepts/SwitchStatement__.js +1 -1
  106. package/out/concepts/SwitchStatement__.js.map +1 -1
  107. package/out/concepts/TypeAnnotation__.js +10 -2
  108. package/out/concepts/TypeAnnotation__.js.map +1 -1
  109. package/out/concepts/UnaryExpression__.js +1 -1
  110. package/out/concepts/UnaryExpression__.js.map +1 -1
  111. package/out/concepts/ValidationRule__.d.ts +1 -0
  112. package/out/concepts/ValidationRule__.js +27 -1
  113. package/out/concepts/ValidationRule__.js.map +1 -1
  114. package/out/concepts/Variable__.d.ts +1 -0
  115. package/out/concepts/Variable__.js +6 -3
  116. package/out/concepts/Variable__.js.map +1 -1
  117. package/out/concepts/ViewComponent__.js +5 -5
  118. package/out/concepts/ViewComponent__.js.map +1 -1
  119. package/out/concepts/ViewElement__.d.ts +63 -60
  120. package/out/concepts/ViewElement__.js +123 -88
  121. package/out/concepts/ViewElement__.js.map +1 -1
  122. package/out/concepts/View__.d.ts +4 -0
  123. package/out/concepts/View__.js +26 -10
  124. package/out/concepts/View__.js.map +1 -1
  125. package/out/concepts/WhileStatement__.js +1 -1
  126. package/out/concepts/WhileStatement__.js.map +1 -1
  127. package/out/concepts/basics/stdlib/index.js +3 -1
  128. package/out/concepts/basics/stdlib/index.js.map +1 -1
  129. package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
  130. package/out/concepts/basics/stdlib/nasl.auth.js +39 -0
  131. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
  132. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
  133. package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
  134. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
  135. package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
  136. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  137. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
  138. package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
  139. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
  140. package/out/concepts/basics/stdlib/nasl.util.js +0 -29
  141. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  142. package/out/enums/KEYWORDS.js +1 -0
  143. package/out/enums/KEYWORDS.js.map +1 -1
  144. package/out/generator/genBundleFiles.js +98 -72
  145. package/out/generator/genBundleFiles.js.map +1 -1
  146. package/out/server/createUiTs.d.ts +1 -0
  147. package/out/server/createUiTs.js +15 -1
  148. package/out/server/createUiTs.js.map +1 -1
  149. package/out/server/getLogics.js +27 -45
  150. package/out/server/getLogics.js.map +1 -1
  151. package/out/server/getMemberIdentifier.js +3 -3
  152. package/out/server/getMemberIdentifier.js.map +1 -1
  153. package/out/server/getProcesses.d.ts +1 -1
  154. package/out/server/getProcesses.js +2 -2
  155. package/out/server/getProcesses.js.map +1 -1
  156. package/out/server/naslServer.d.ts +1 -3
  157. package/out/server/naslServer.js +73 -57
  158. package/out/server/naslServer.js.map +1 -1
  159. package/out/server/translator.d.ts +0 -3
  160. package/out/server/translator.js +16 -7
  161. package/out/server/translator.js.map +1 -1
  162. package/out/service/storage/init.js +21 -12
  163. package/out/service/storage/init.js.map +1 -1
  164. package/out/templator/genCreateBlock.js +3 -3
  165. package/out/templator/genCreateBlock.js.map +1 -1
  166. package/out/templator/genCurdEditMultipleKeyBlock.js +6 -10
  167. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  168. package/out/templator/genCurdMultipleKeyBlock.js +2 -2
  169. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  170. package/out/templator/genGetBlock.js +1 -1
  171. package/out/templator/genGetBlock.js.map +1 -1
  172. package/out/templator/genQueryComponent.d.ts +2 -0
  173. package/out/templator/genQueryComponent.js +1 -0
  174. package/out/templator/genQueryComponent.js.map +1 -1
  175. package/out/templator/genUpdateBlock.js +5 -5
  176. package/out/templator/genUpdateBlock.js.map +1 -1
  177. package/out/templator/utils.d.ts +3 -1
  178. package/out/templator/utils.js +2 -1
  179. package/out/templator/utils.js.map +1 -1
  180. package/package.json +1 -1
  181. package/src/automate/engine/index.js +1 -1
  182. package/src/common/BaseNode.ts +46 -42
  183. package/src/concepts/App__.ts +54 -12
  184. package/src/concepts/Argument__.ts +3 -2
  185. package/src/concepts/BinaryExpression__.ts +8 -6
  186. package/src/concepts/BindAttribute__.ts +26 -32
  187. package/src/concepts/BindDirective__.ts +24 -9
  188. package/src/concepts/BindEvent__.ts +25 -29
  189. package/src/concepts/CallFunction__.ts +11 -6
  190. package/src/concepts/CallInterface__.ts +11 -1
  191. package/src/concepts/CallLogic__.ts +21 -40
  192. package/src/concepts/CallQueryComponent__.ts +6 -10
  193. package/src/concepts/Comment__.ts +6 -2
  194. package/src/concepts/ConfigGroup__.ts +1 -1
  195. package/src/concepts/ConfigProperty__.ts +1 -1
  196. package/src/concepts/Configuration__.ts +1 -1
  197. package/src/concepts/Destination__.ts +9 -7
  198. package/src/concepts/EntityProperty__.ts +36 -0
  199. package/src/concepts/Entity__.ts +63 -50
  200. package/src/concepts/Enum__.ts +1 -1
  201. package/src/concepts/Event__.ts +1 -1
  202. package/src/concepts/ForEachStatement__.ts +8 -13
  203. package/src/concepts/Function__.ts +4 -4
  204. package/src/concepts/Identifier__.ts +15 -18
  205. package/src/concepts/IfStatement__.ts +2 -2
  206. package/src/concepts/InterfaceParam__.ts +11 -0
  207. package/src/concepts/Interface__.ts +3 -3
  208. package/src/concepts/LogicItem__.ts +15 -0
  209. package/src/concepts/Logic__.ts +34 -50
  210. package/src/concepts/Module__.ts +8 -8
  211. package/src/concepts/Namespace__.ts +12 -12
  212. package/src/concepts/Param__.ts +3 -0
  213. package/src/concepts/ProcessComponent__.ts +2 -2
  214. package/src/concepts/ProcessElement__.ts +5 -5
  215. package/src/concepts/ProcessOutcome__.ts +1 -1
  216. package/src/concepts/Process__.ts +4 -4
  217. package/src/concepts/QueryFromExpression__.ts +1 -1
  218. package/src/concepts/QueryJoinExpression__.ts +2 -2
  219. package/src/concepts/QuerySelectExpression__.ts +1 -1
  220. package/src/concepts/Return__.ts +6 -3
  221. package/src/concepts/StringLiteral__.ts +2 -2
  222. package/src/concepts/StructureProperty__.ts +36 -29
  223. package/src/concepts/Structure__.ts +3 -3
  224. package/src/concepts/SwitchCase__.ts +3 -3
  225. package/src/concepts/SwitchStatement__.ts +1 -1
  226. package/src/concepts/TypeAnnotation__.ts +8 -2
  227. package/src/concepts/UnaryExpression__.ts +1 -1
  228. package/src/concepts/ValidationRule__.ts +24 -1
  229. package/src/concepts/Variable__.ts +6 -3
  230. package/src/concepts/ViewComponent__.ts +5 -5
  231. package/src/concepts/ViewElement__.ts +183 -147
  232. package/src/concepts/View__.ts +30 -32
  233. package/src/concepts/WhileStatement__.ts +1 -1
  234. package/src/concepts/basics/stdlib/index.ts +3 -1
  235. package/src/concepts/basics/stdlib/nasl.auth.ts +35 -0
  236. package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
  237. package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
  238. package/src/concepts/basics/stdlib/nasl.util.ts +0 -29
  239. package/src/enums/KEYWORDS.ts +1 -0
  240. package/src/generator/genBundleFiles.ts +102 -74
  241. package/src/server/createUiTs.ts +18 -3
  242. package/src/server/getLogics.ts +29 -47
  243. package/src/server/getMemberIdentifier.ts +3 -3
  244. package/src/server/getProcesses.ts +2 -2
  245. package/src/server/naslServer.ts +84 -62
  246. package/src/server/translator.ts +18 -6
  247. package/src/service/storage/init.ts +20 -13
  248. package/src/templator/genCreateBlock.ts +3 -3
  249. package/src/templator/genCurdEditMultipleKeyBlock.ts +22 -23
  250. package/src/templator/genCurdMultipleKeyBlock.ts +2 -2
  251. package/src/templator/genGetBlock.ts +1 -1
  252. package/src/templator/genQueryComponent.ts +1 -0
  253. package/src/templator/genUpdateBlock.ts +5 -6
  254. package/src/templator/utils.ts +2 -1
@@ -234,8 +234,6 @@ export class View extends BaseNode {
234
234
  });
235
235
  }
236
236
 
237
-
238
-
239
237
  /**
240
238
  * 插入页面元素
241
239
  * @internal
@@ -272,7 +270,7 @@ export class View extends BaseNode {
272
270
  name: options,
273
271
  }, this, 'elements');
274
272
  } else if (options instanceof ViewElement) {
275
- options.delete(); // 同一实例不支持多处存在
273
+ options.ensureDelete(); // 同一实例不支持多处存在
276
274
  viewElement = options;
277
275
  Object.assign(viewElement, relationOptions);
278
276
  } else {
@@ -369,7 +367,6 @@ export class View extends BaseNode {
369
367
  return node;
370
368
  }
371
369
 
372
-
373
370
  getParamExistingNames(excludedList: Array<Param> = []) {
374
371
  const excludedSet = new Set(excludedList);
375
372
  return (this.params || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -414,7 +411,7 @@ export class View extends BaseNode {
414
411
  name: options,
415
412
  }, this, 'params');
416
413
  } else if (options instanceof Param) {
417
- options.delete(); // 同一实例不支持多处存在
414
+ options.ensureDelete(); // 同一实例不支持多处存在
418
415
  param = options;
419
416
  Object.assign(param, relationOptions);
420
417
  } else {
@@ -511,7 +508,6 @@ export class View extends BaseNode {
511
508
  return node;
512
509
  }
513
510
 
514
-
515
511
  getVariableExistingNames(excludedList: Array<Variable> = []) {
516
512
  const excludedSet = new Set(excludedList);
517
513
  return (this.variables || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -556,7 +552,7 @@ export class View extends BaseNode {
556
552
  name: options,
557
553
  }, this, 'variables');
558
554
  } else if (options instanceof Variable) {
559
- options.delete(); // 同一实例不支持多处存在
555
+ options.ensureDelete(); // 同一实例不支持多处存在
560
556
  variable = options;
561
557
  Object.assign(variable, relationOptions);
562
558
  } else {
@@ -653,7 +649,6 @@ export class View extends BaseNode {
653
649
  return node;
654
650
  }
655
651
 
656
-
657
652
  getLogicExistingNames(excludedList: Array<Logic> = []) {
658
653
  const excludedSet = new Set(excludedList);
659
654
  return (this.logics || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -698,7 +693,7 @@ export class View extends BaseNode {
698
693
  name: options,
699
694
  }, this, 'logics');
700
695
  } else if (options instanceof Logic) {
701
- options.delete(); // 同一实例不支持多处存在
696
+ options.ensureDelete(); // 同一实例不支持多处存在
702
697
  logic = options;
703
698
  Object.assign(logic, relationOptions);
704
699
  } else {
@@ -795,7 +790,6 @@ export class View extends BaseNode {
795
790
  return node;
796
791
  }
797
792
 
798
-
799
793
  getBindEventExistingNames(excludedList: Array<BindEvent> = []) {
800
794
  const excludedSet = new Set(excludedList);
801
795
  return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -840,7 +834,7 @@ export class View extends BaseNode {
840
834
  name: options,
841
835
  }, this, 'bindEvents');
842
836
  } else if (options instanceof BindEvent) {
843
- options.delete(); // 同一实例不支持多处存在
837
+ options.ensureDelete(); // 同一实例不支持多处存在
844
838
  bindEvent = options;
845
839
  Object.assign(bindEvent, relationOptions);
846
840
  } else {
@@ -937,9 +931,6 @@ export class View extends BaseNode {
937
931
  return node;
938
932
  }
939
933
 
940
-
941
-
942
-
943
934
  getViewExistingNames(excludedList: Array<View> = []) {
944
935
  const excludedSet = new Set(excludedList);
945
936
  return (this.children || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -984,7 +975,7 @@ export class View extends BaseNode {
984
975
  name: options,
985
976
  }, this, 'children');
986
977
  } else if (options instanceof View) {
987
- options.delete(); // 同一实例不支持多处存在
978
+ options.ensureDelete(); // 同一实例不支持多处存在
988
979
  view = options;
989
980
  Object.assign(view, relationOptions);
990
981
  } else {
@@ -1081,9 +1072,6 @@ export class View extends BaseNode {
1081
1072
  return node;
1082
1073
  }
1083
1074
 
1084
-
1085
-
1086
-
1087
1075
  /**
1088
1076
  * 删除页面元素
1089
1077
  * @param name 页面元素名称
@@ -1132,8 +1120,6 @@ export class View extends BaseNode {
1132
1120
  return params;
1133
1121
  }
1134
1122
 
1135
-
1136
-
1137
1123
  /**
1138
1124
  * 删除输入参数
1139
1125
  * @param name 输入参数名称
@@ -1182,8 +1168,6 @@ export class View extends BaseNode {
1182
1168
  return params;
1183
1169
  }
1184
1170
 
1185
-
1186
-
1187
1171
  /**
1188
1172
  * 删除局部变量
1189
1173
  * @param name 局部变量名称
@@ -1232,8 +1216,6 @@ export class View extends BaseNode {
1232
1216
  return params;
1233
1217
  }
1234
1218
 
1235
-
1236
-
1237
1219
  /**
1238
1220
  * 删除逻辑
1239
1221
  * @param name 逻辑名称
@@ -1282,8 +1264,6 @@ export class View extends BaseNode {
1282
1264
  return params;
1283
1265
  }
1284
1266
 
1285
-
1286
-
1287
1267
  /**
1288
1268
  * 删除元素绑定事件
1289
1269
  * @param name 元素绑定事件名称
@@ -1332,8 +1312,6 @@ export class View extends BaseNode {
1332
1312
  return params;
1333
1313
  }
1334
1314
 
1335
-
1336
-
1337
1315
  /**
1338
1316
  * 删除页面
1339
1317
  * @param name 页面名称
@@ -1746,13 +1724,14 @@ export class View extends BaseNode {
1746
1724
  code += '\n' + indent(state.tabSize + 1) + '}\n';
1747
1725
 
1748
1726
  if (Array.isArray(this.params)) {
1749
- code += indent(state.tabSize + 1) + `export function $destination(`;
1727
+ code += indent(state.tabSize + 1) + `export function $destination(options: {`;
1750
1728
  this.params.forEach((param, index) => {
1751
- code += `${param.toEmbeddedTS(shiftState(state, code, { inline: true }), true)}`;
1729
+ code += param.name + '?: ';
1730
+ code += param.typeAnnotation.toEmbeddedTS(shiftState(state, code));
1752
1731
  if (index !== this.params.length - 1)
1753
1732
  code += ', ';
1754
1733
  });
1755
- code += '){}\n';
1734
+ code += '}){}\n';
1756
1735
  }
1757
1736
  code += indent(state.tabSize) + '}\n';
1758
1737
  return code;
@@ -1810,6 +1789,25 @@ export class View extends BaseNode {
1810
1789
  return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
1811
1790
  }
1812
1791
 
1792
+ findViewByName(name: string): View {
1793
+ return utils.traverse((current) => {
1794
+ if (current.node.name === name)
1795
+ return current.node;
1796
+ }, { node: this });
1797
+ }
1798
+
1799
+ findElementByName(name: string): ViewElement {
1800
+ return this.elements[0]?.findElementByName(name);
1801
+ }
1802
+
1803
+ findElementByTag(tag: string): ViewElement {
1804
+ return this.elements[0]?.findElementByName(tag);
1805
+ }
1806
+
1807
+ findElementByAttr(name: string, value: string): ViewElement {
1808
+ return this.elements[0]?.findElementByAttr(name, value);
1809
+ }
1810
+
1813
1811
  _setAsIndexView(isIndex: boolean) {
1814
1812
  let views: View[] = [];
1815
1813
  if (this.parentNode.concept !== 'View') {
@@ -1856,7 +1854,7 @@ export class View extends BaseNode {
1856
1854
  //================================================================================
1857
1855
  }
1858
1856
 
1859
- classMap['View'] = View;
1857
+ classMap.View = View;
1860
1858
  export default View;
1861
1859
  //================================================================================
1862
1860
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -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,35 @@
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
+ new Param({
24
+ name: 'Point1',
25
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
26
+ }),
27
+ new Param({
28
+ name: 'Point2',
29
+ typeAnnotation: TypeAnnotation.createPrimitive('String'),
30
+ }),
31
+ ],
32
+ returns: [],
33
+ }),
34
+ ],
35
+ });
@@ -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',
@@ -691,7 +664,6 @@ export default new Namespace({
691
664
  new Function({
692
665
  name: 'Clone',
693
666
  description: '复制一个所选参数的实例',
694
- typeParams: [new TypeParam({ name: 'T' })],
695
667
  params: [
696
668
  new Param({
697
669
  name: 'struct',
@@ -707,7 +679,6 @@ export default new Namespace({
707
679
  new Function({
708
680
  name: 'Clear',
709
681
  description: '清除对象数据',
710
- typeParams: [new TypeParam({ name: 'T' })],
711
682
  params: [
712
683
  new Param({
713
684
  name: 'struct',
@@ -104,6 +104,7 @@ export const KEYWORDS = [
104
104
  'is',
105
105
  'it',
106
106
  'lazy',
107
+ 'length',
107
108
  'let',
108
109
  'logging',
109
110
  'logic',