@lcap/nasl 2.20.1-beta.2 → 2.20.1-beta.3

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 (224) hide show
  1. package/docs/classes/EntityProperty.html +1 -1
  2. package/out/automate/engine/operators.d.ts +10 -1
  3. package/out/automate/engine/operators.js +14 -5
  4. package/out/automate/engine/operators.js.map +1 -1
  5. package/out/automate/engine/viewCache.d.ts +1 -0
  6. package/out/automate/template/myProcess.d.ts +1 -0
  7. package/out/automate/template/myProcess.js +9021 -9021
  8. package/out/automate/template/myProcess.js.map +1 -1
  9. package/out/common/BaseNode.js.map +1 -1
  10. package/out/common/Command.d.ts +1 -1
  11. package/out/common/EventEmitter.d.ts +1 -1
  12. package/out/concepts/Abort__.d.ts +25 -0
  13. package/out/concepts/Abort__.js +80 -0
  14. package/out/concepts/Abort__.js.map +1 -0
  15. package/out/concepts/Anchor__.js.map +1 -1
  16. package/out/concepts/AnonymousFunction__.js.map +1 -1
  17. package/out/concepts/App__.js.map +1 -1
  18. package/out/concepts/Argument__.js.map +1 -1
  19. package/out/concepts/Assignee__.js.map +1 -1
  20. package/out/concepts/AssignmentLine__.js.map +1 -1
  21. package/out/concepts/Assignment__.js.map +1 -1
  22. package/out/concepts/Attribute__.js.map +1 -1
  23. package/out/concepts/BatchAssignment__.js.map +1 -1
  24. package/out/concepts/BinaryExpression__.js.map +1 -1
  25. package/out/concepts/BindAttribute__.js.map +1 -1
  26. package/out/concepts/BindDirective__.js.map +1 -1
  27. package/out/concepts/BindEvent__.js.map +1 -1
  28. package/out/concepts/BindStyle__.js.map +1 -1
  29. package/out/concepts/BooleanLiteral__.js.map +1 -1
  30. package/out/concepts/CallFunction__.js.map +1 -1
  31. package/out/concepts/CallInterface__.d.ts +1 -0
  32. package/out/concepts/CallInterface__.js +32 -2
  33. package/out/concepts/CallInterface__.js.map +1 -1
  34. package/out/concepts/CallLogic__.js +2 -2
  35. package/out/concepts/CallLogic__.js.map +1 -1
  36. package/out/concepts/CallQueryComponent__.js.map +1 -1
  37. package/out/concepts/Comment__.js.map +1 -1
  38. package/out/concepts/CompletionProperty__.js.map +1 -1
  39. package/out/concepts/ConfigGroup__.js.map +1 -1
  40. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  41. package/out/concepts/ConfigProperty__.js.map +1 -1
  42. package/out/concepts/Configuration__.js.map +1 -1
  43. package/out/concepts/Constant__.js.map +1 -1
  44. package/out/concepts/DataElement__.js.map +1 -1
  45. package/out/concepts/DataSource__.js.map +1 -1
  46. package/out/concepts/DatabaseTypeAnnotation__.d.ts +31 -0
  47. package/out/concepts/DatabaseTypeAnnotation__.js +78 -0
  48. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -0
  49. package/out/concepts/Destination__.js +6 -6
  50. package/out/concepts/Destination__.js.map +1 -1
  51. package/out/concepts/End__.js.map +1 -1
  52. package/out/concepts/EntityIndex__.d.ts +1 -1
  53. package/out/concepts/EntityIndex__.js.map +1 -1
  54. package/out/concepts/EntityProperty__.d.ts +1 -1
  55. package/out/concepts/EntityProperty__.js.map +1 -1
  56. package/out/concepts/Entity__.js.map +1 -1
  57. package/out/concepts/EnumItem__.js.map +1 -1
  58. package/out/concepts/Enum__.js.map +1 -1
  59. package/out/concepts/Event__.js.map +1 -1
  60. package/out/concepts/ExternalDestination__.js.map +1 -1
  61. package/out/concepts/ForEachStatement__.js.map +1 -1
  62. package/out/concepts/FrontendLibrary__.js.map +1 -1
  63. package/out/concepts/Frontend__.js.map +1 -1
  64. package/out/concepts/Function__.js.map +1 -1
  65. package/out/concepts/Identifier__.js.map +1 -1
  66. package/out/concepts/IfStatement__.js.map +1 -1
  67. package/out/concepts/Integration__.d.ts +53 -0
  68. package/out/concepts/Integration__.js +143 -0
  69. package/out/concepts/Integration__.js.map +1 -0
  70. package/out/concepts/InterfaceParam__.js.map +1 -1
  71. package/out/concepts/Interface__.d.ts +9 -0
  72. package/out/concepts/Interface__.js +54 -0
  73. package/out/concepts/Interface__.js.map +1 -1
  74. package/out/concepts/JSBlock__.js.map +1 -1
  75. package/out/concepts/JavaLogic__.d.ts +42 -0
  76. package/out/concepts/JavaLogic__.js +122 -0
  77. package/out/concepts/JavaLogic__.js.map +1 -0
  78. package/out/concepts/LogicItem__.js.map +1 -1
  79. package/out/concepts/Logic__.js.map +1 -1
  80. package/out/concepts/MatchCase__.js.map +1 -1
  81. package/out/concepts/Match__.js.map +1 -1
  82. package/out/concepts/MemberExpression__.js.map +1 -1
  83. package/out/concepts/MicroApp__.d.ts +51 -0
  84. package/out/concepts/MicroApp__.js +113 -0
  85. package/out/concepts/MicroApp__.js.map +1 -0
  86. package/out/concepts/Module__.d.ts +1 -1
  87. package/out/concepts/Module__.js.map +1 -1
  88. package/out/concepts/Namespace__.js.map +1 -1
  89. package/out/concepts/NewComposite__.js.map +1 -1
  90. package/out/concepts/NewList__.js.map +1 -1
  91. package/out/concepts/NewMap__.js.map +1 -1
  92. package/out/concepts/New__.js.map +1 -1
  93. package/out/concepts/NullLiteral__.js.map +1 -1
  94. package/out/concepts/NumericLiteral__.js.map +1 -1
  95. package/out/concepts/OqlQueryComponent__.js +2 -0
  96. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  97. package/out/concepts/Param__.js +1 -1
  98. package/out/concepts/Param__.js.map +1 -1
  99. package/out/concepts/Point__.js.map +1 -1
  100. package/out/concepts/ProcessComponent__.js.map +1 -1
  101. package/out/concepts/ProcessElement__.js.map +1 -1
  102. package/out/concepts/ProcessOutcome__.js.map +1 -1
  103. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  104. package/out/concepts/Process__.js.map +1 -1
  105. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  106. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  107. package/out/concepts/QueryFromExpression__.js.map +1 -1
  108. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  109. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  110. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  111. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  112. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  113. package/out/concepts/Rect__.js.map +1 -1
  114. package/out/concepts/Return__.js.map +1 -1
  115. package/out/concepts/Role__.js.map +1 -1
  116. package/out/concepts/SelectMembers__.js.map +1 -1
  117. package/out/concepts/Slot__.js.map +1 -1
  118. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  119. package/out/concepts/Start__.js.map +1 -1
  120. package/out/concepts/StringInterpolation__.js.map +1 -1
  121. package/out/concepts/StringLiteral__.js.map +1 -1
  122. package/out/concepts/StructureProperty__.js.map +1 -1
  123. package/out/concepts/Structure__.js.map +1 -1
  124. package/out/concepts/SwitchCase__.js.map +1 -1
  125. package/out/concepts/SwitchStatement__.js.map +1 -1
  126. package/out/concepts/Theme__.js.map +1 -1
  127. package/out/concepts/Transactional__.js.map +1 -1
  128. package/out/concepts/TypeAnnotation__.js.map +1 -1
  129. package/out/concepts/TypeParam__.js.map +1 -1
  130. package/out/concepts/UnaryExpression__.js.map +1 -1
  131. package/out/concepts/Unparsed__.js.map +1 -1
  132. package/out/concepts/UseComponent__.js.map +1 -1
  133. package/out/concepts/ValidationRule__.js.map +1 -1
  134. package/out/concepts/Variable__.js.map +1 -1
  135. package/out/concepts/ViewBlock__.js.map +1 -1
  136. package/out/concepts/ViewComponent__.js.map +1 -1
  137. package/out/concepts/ViewElement__.js.map +1 -1
  138. package/out/concepts/View__.js.map +1 -1
  139. package/out/concepts/WhileStatement__.js.map +1 -1
  140. package/out/config.d.ts +1 -1
  141. package/out/decorators/index.d.ts +2 -2
  142. package/out/generator/icestark.d.ts +2 -0
  143. package/out/generator/icestark.js +48 -0
  144. package/out/generator/icestark.js.map +1 -0
  145. package/out/generator/microApp.d.ts +2 -0
  146. package/out/generator/microApp.js +35 -0
  147. package/out/generator/microApp.js.map +1 -0
  148. package/out/generator/permission.d.ts +1 -1
  149. package/out/generator/qiankun.d.ts +2 -0
  150. package/out/generator/qiankun.js +52 -0
  151. package/out/generator/qiankun.js.map +1 -0
  152. package/out/manager/stepRecorder.d.ts +20 -0
  153. package/out/manager/stepRecorder.js +110 -0
  154. package/out/manager/stepRecorder.js.map +1 -0
  155. package/out/sentry/index.d.ts +29 -0
  156. package/out/sentry/index.js +111 -0
  157. package/out/sentry/index.js.map +1 -0
  158. package/out/server/getMemberIdentifier.js +3 -2
  159. package/out/server/getMemberIdentifier.js.map +1 -1
  160. package/out/server/getProcesses.d.ts +3 -3
  161. package/out/server/getScope.d.ts +1 -1
  162. package/out/server/naslServer.d.ts +1 -1
  163. package/out/server/naslServer.js +11 -1
  164. package/out/server/naslServer.js.map +1 -1
  165. package/out/service/creator/add.configs.js +2 -0
  166. package/out/service/creator/add.configs.js.map +1 -1
  167. package/out/service/creator/errHandles.js +5 -0
  168. package/out/service/creator/errHandles.js.map +1 -1
  169. package/out/service/creator/index.js +2 -0
  170. package/out/service/creator/index.js.map +1 -1
  171. package/out/service/storage/api.d.ts +18 -0
  172. package/out/service/storage/api.js +12 -0
  173. package/out/service/storage/api.js.map +1 -1
  174. package/out/service/storage/init.d.ts +41 -1
  175. package/out/service/storage/init.js +172 -42
  176. package/out/service/storage/init.js.map +1 -1
  177. package/out/service/storage/service.d.ts +9 -1
  178. package/out/service/storage/service.js +27 -1
  179. package/out/service/storage/service.js.map +1 -1
  180. package/out/templator/genCreateBlock.js +1 -1
  181. package/out/templator/genCreateBlock.js.map +1 -1
  182. package/out/templator/genCurdEditMultipleKeyBlock.js +2 -2
  183. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  184. package/out/templator/genCurdMultipleKeyBlock.js +2 -3
  185. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  186. package/out/templator/genEditTableBlock.js +2 -2
  187. package/out/templator/genEditTableBlock.js.map +1 -1
  188. package/out/templator/genSelectBlock.js +1 -1
  189. package/out/templator/genTableBlock.js +2 -2
  190. package/out/templator/genTableBlock.js.map +1 -1
  191. package/out/templator/genUpdateBlock.js +1 -1
  192. package/out/templator/genUpdateBlock.js.map +1 -1
  193. package/out/translator/index.d.ts +1 -1
  194. package/out/translator/lsp.d.ts +3 -3
  195. package/out/utils/index.d.ts +4 -4
  196. package/package.json +2 -2
  197. package/src/automate/engine/operators.js +13 -5
  198. package/src/automate/template/myProcess.js +11451 -11452
  199. package/src/automate/upgrader/2.20.js +1 -0
  200. package/src/concepts/CallInterface__.ts +34 -20
  201. package/src/concepts/CallLogic__.ts +2 -2
  202. package/src/concepts/Destination__.ts +6 -6
  203. package/src/concepts/Interface__.ts +59 -7
  204. package/src/concepts/OqlQueryComponent__.ts +2 -0
  205. package/src/concepts/Param__.ts +1 -1
  206. package/src/server/getMemberIdentifier.ts +5 -2
  207. package/src/server/naslServer.ts +8 -1
  208. package/src/service/creator/add.configs.js +3 -0
  209. package/src/service/creator/errHandles.js +6 -0
  210. package/src/service/creator/index.js +3 -0
  211. package/src/service/storage/api.js +12 -0
  212. package/src/service/storage/init.ts +204 -41
  213. package/src/service/storage/service.ts +29 -1
  214. package/src/templator/genCreateBlock.ts +1 -1
  215. package/src/templator/genCurdEditMultipleKeyBlock.ts +2 -2
  216. package/src/templator/genCurdMultipleKeyBlock.ts +2 -3
  217. package/src/templator/genEditTableBlock.ts +2 -2
  218. package/src/templator/genSelectBlock.ts +1 -1
  219. package/src/templator/genTableBlock.ts +2 -2
  220. package/src/templator/genUpdateBlock.ts +1 -1
  221. package/out/automate/engine/2.14-components.d.ts +0 -1115
  222. package/out/automate/engine/2.14-components.js +0 -1087
  223. package/out/automate/engine/2.14-components.js.map +0 -1
  224. package/yarn-error.log +0 -2087
@@ -21,6 +21,7 @@ const excludedKeySet = new Set([
21
21
  export function replace(script) {
22
22
  script = script.replace('execTemplate = function(app,', 'execTemplate = function(app, frontend, ');
23
23
  script = script.replace('_uniqueName.initAppUniqueNames(app);', '_uniqueName.initAppUniqueNames(app, frontend);');
24
+ script = script.replace('_addModule(app', '_addModule(app, frontend');
24
25
  return script;
25
26
  }
26
27
 
@@ -61,8 +61,6 @@ export class CallInterface extends LogicItem {
61
61
  @property('Argument')
62
62
  arguments: Array<Argument> = [];
63
63
 
64
-
65
-
66
64
  /**
67
65
  * @param source 需要合并的部分参数
68
66
  */
@@ -76,13 +74,6 @@ export class CallInterface extends LogicItem {
76
74
  return super.from(source, parentNode, parentKey) as CallInterface;
77
75
  }
78
76
 
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
77
  /**
87
78
  * 插入实际参数
88
79
  * @internal
@@ -115,8 +106,6 @@ export class CallInterface extends LogicItem {
115
106
  return argument;
116
107
  }
117
108
 
118
-
119
-
120
109
  /**
121
110
  * 插入实际参数
122
111
  * @param argumentOptions 实际参数参数
@@ -139,8 +128,6 @@ export class CallInterface extends LogicItem {
139
128
  return node;
140
129
  }
141
130
 
142
-
143
-
144
131
  /**
145
132
  * 添加实际参数
146
133
  * @internal
@@ -160,8 +147,6 @@ export class CallInterface extends LogicItem {
160
147
  return this._insertArgumentAt(options as any, index);
161
148
  }
162
149
 
163
-
164
-
165
150
  /**
166
151
  * 添加实际参数
167
152
  * @param argumentOptions 实际参数参数
@@ -185,9 +170,6 @@ export class CallInterface extends LogicItem {
185
170
  return node;
186
171
  }
187
172
 
188
-
189
-
190
-
191
173
  /**
192
174
  * 删除实际参数
193
175
  * @param argument 已有的实际参数实例
@@ -195,7 +177,7 @@ export class CallInterface extends LogicItem {
195
177
  removeArgument(argument: Argument): void;
196
178
 
197
179
  removeArgument(options: Argument) {
198
- let argument: Argument = options;
180
+ const argument: Argument = options;
199
181
  return argument.delete();
200
182
  }
201
183
 
@@ -227,6 +209,38 @@ export class CallInterface extends LogicItem {
227
209
  // 自动生成的代码已结束。下面可以手动编写。
228
210
  //================================================================================
229
211
 
212
+ async deleteCallNode() {
213
+ // 计算之前选择的接口的引用次数
214
+ if (this.calleeKey !== '__IDENTIFIER__') {
215
+ const oldItf = this.getCallNode();
216
+ if (oldItf) {
217
+ let refCount = 0;
218
+ let isSelfRef = false;
219
+ // 选择无变化时
220
+
221
+ const refs = await oldItf.findUsage();
222
+ refs.forEach((val: any) => {
223
+ const loopFindNode = (item: any) => {
224
+ if (item.children) {
225
+ item.children.forEach((child: any) => loopFindNode(child));
226
+ } else {
227
+ refCount++;
228
+ if (item.node === this) {
229
+ isSelfRef = true;
230
+ }
231
+ }
232
+ };
233
+ loopFindNode(val);
234
+ });
235
+
236
+ // 仅被自己引用则删除
237
+ if (isSelfRef && refCount === 1) {
238
+ oldItf.delete();
239
+ }
240
+ }
241
+ }
242
+ }
243
+
230
244
  get tsCalleeNamespace() {
231
245
  if (this.calleeNamespace) {
232
246
  let tsCalleeNamespace = this.calleeNamespace;
@@ -550,7 +564,7 @@ export class CallInterface extends LogicItem {
550
564
  const node = this.getCallNode();
551
565
  let logicParam: InterfaceParam[] = [];
552
566
  const Arguments: Argument[] = [];
553
- if (node) {
567
+ if (node?.params) {
554
568
  logicParam = node.params;
555
569
  }
556
570
  if (this.arguments?.length) {
@@ -567,7 +567,7 @@ export class CallLogic extends LogicItem {
567
567
 
568
568
  const node = this.getCallNode();
569
569
  let logicParam: Param[] = [];
570
- if (node) {
570
+ if (node?.params) {
571
571
  logicParam = node.params;
572
572
  }
573
573
  if (this.arguments?.length) {
@@ -1041,7 +1041,7 @@ export class CallLogic extends LogicItem {
1041
1041
  const node = this.getCallNode();
1042
1042
  let logicParam: Param[] = [];
1043
1043
  const Arguments: Argument[] = [];
1044
- if (node) {
1044
+ if (node?.params) {
1045
1045
  logicParam = node.params;
1046
1046
  }
1047
1047
  if (this.arguments?.length) {
@@ -353,7 +353,7 @@ export class Destination extends LogicItem {
353
353
  if (Array.isArray(completeArguments) && completeArguments.length) {
354
354
  const node = this.viewNode;
355
355
  let logicParam: Param[] = [];
356
- if (node) {
356
+ if (node?.params) {
357
357
  logicParam = node.params;
358
358
  }
359
359
  const logicParamLen = logicParam.length;
@@ -407,7 +407,7 @@ export class Destination extends LogicItem {
407
407
  if (completeArguments.length) {
408
408
  const node = this.viewNode;
409
409
  let logicParam: Param[] = [];
410
- if (node) {
410
+ if (node?.params) {
411
411
  logicParam = node.params;
412
412
  }
413
413
  const logicParamLength = logicParam.length;
@@ -447,7 +447,7 @@ export class Destination extends LogicItem {
447
447
  if (completeArguments.length) {
448
448
  const node = this.viewNode;
449
449
  let logicParam: Param[] = [];
450
- if (node) {
450
+ if (node?.params) {
451
451
  logicParam = node.params;
452
452
  }
453
453
  const logicParamLength = logicParam.length;
@@ -488,7 +488,7 @@ export class Destination extends LogicItem {
488
488
  if (completeArguments.length) {
489
489
  const node = this.viewNode;
490
490
  let logicParam: Param[] = [];
491
- if (node) {
491
+ if (node?.params) {
492
492
  logicParam = node.params;
493
493
  }
494
494
  const logicParamLength = logicParam.length;
@@ -668,7 +668,7 @@ export class Destination extends LogicItem {
668
668
 
669
669
  const node = this.viewNode;
670
670
  let logicParam: Param[] = [];
671
- if (node) {
671
+ if (node?.params) {
672
672
  logicParam = node.params;
673
673
  }
674
674
  const logicParamLength = logicParam.length;
@@ -759,7 +759,7 @@ export class Destination extends LogicItem {
759
759
  const node = this.viewNode;
760
760
  let logicParam: Param[] = [];
761
761
  const Arguments: Argument[] = [];
762
- if (node) {
762
+ if (node?.params) {
763
763
  logicParam = node.params;
764
764
  }
765
765
  if (this.arguments?.length) {
@@ -2,6 +2,7 @@ import { TranslatorState, shiftState, withSourceMap, createCompilerState } from
2
2
  import Namespace from './Namespace__';
3
3
  import TypeAnnotation from './TypeAnnotation__';
4
4
  import Structure from './Structure__';
5
+ import Param from './Param__';
5
6
  //================================================================================
6
7
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
7
8
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -133,7 +134,7 @@ export class Interface extends BaseNode {
133
134
  });
134
135
  }
135
136
 
136
- getInterfaceParamUniqueName(name = 'interfaceParam1') {
137
+ getInterfaceParamUniqueName(name = 'interfaceParam1') {
137
138
  return utils.unique(name, this.getVarExistingNames(), undefined, false);
138
139
  }
139
140
 
@@ -270,7 +271,6 @@ export class Interface extends BaseNode {
270
271
  return node;
271
272
  }
272
273
 
273
-
274
274
  getReturnUniqueName(name = 'result') {
275
275
  return utils.unique(name, this.getVarExistingNames(), undefined, false);
276
276
  }
@@ -408,9 +408,6 @@ export class Interface extends BaseNode {
408
408
  return node;
409
409
  }
410
410
 
411
-
412
-
413
-
414
411
  /**
415
412
  * 删除接口参数
416
413
  * @param name 接口参数名称
@@ -459,8 +456,6 @@ export class Interface extends BaseNode {
459
456
  return params;
460
457
  }
461
458
 
462
-
463
-
464
459
  /**
465
460
  * 删除输出参数
466
461
  * @param name 输出参数名称
@@ -514,6 +509,18 @@ export class Interface extends BaseNode {
514
509
  // 自动生成的代码已结束。下面可以手动编写。
515
510
  //================================================================================
516
511
 
512
+ /**
513
+ * 协议
514
+ */
515
+ // @property()
516
+ // protocol: string = undefined;
517
+
518
+ /**
519
+ * 协议参数列表
520
+ */
521
+ // @property('Param')
522
+ // protocolParams: Array<Param> = [];
523
+
517
524
  /**
518
525
  * 是否可编辑
519
526
  * */
@@ -545,6 +552,21 @@ export class Interface extends BaseNode {
545
552
  });
546
553
  }
547
554
 
555
+ // 更新所有调用接口
556
+ async updateAllRefCallInterface() {
557
+ const refs = await this.findUsage();
558
+ refs.forEach((val: any) => {
559
+ const loopFindNode = (item: any) => {
560
+ if (item.children) {
561
+ item.children.forEach((i: any) => loopFindNode(i));
562
+ } else {
563
+ item.node.setCallee(this);
564
+ }
565
+ };
566
+ loopFindNode(val);
567
+ });
568
+ }
569
+
548
570
  /* 删除空数据模块 */
549
571
  deleteLogincAndModule() {
550
572
  this.rootNode.emit('collect:start', {
@@ -823,6 +845,36 @@ export class Interface extends BaseNode {
823
845
  return [...this.params, ...this.returns].filter((item) => !excludedSet.has(item)).map((item) => item.name);
824
846
  }
825
847
 
848
+ // 递归找出 response/request 的 Body/Returns 引用的数据结构
849
+ getRefStructures(structures: Structure[] = []): Set<Structure> {
850
+ const structuresSet: Set<Structure> = new Set();
851
+ const loopSaveStructure = (typeAnnotation: TypeAnnotation) => {
852
+ if (!typeAnnotation)
853
+ return;
854
+ if (typeAnnotation.typeKind === 'reference') {
855
+ const targetStructure = structures.find((s) => s.name === typeAnnotation.typeName);
856
+ if (targetStructure && !structuresSet.has(targetStructure)) {
857
+ structuresSet.add(targetStructure);
858
+ targetStructure?.properties.forEach((prop) => {
859
+ loopSaveStructure(prop.typeAnnotation);
860
+ });
861
+ }
862
+ } else if (typeAnnotation.typeKind === 'generic') {
863
+ typeAnnotation.typeArguments.forEach(loopSaveStructure);
864
+ }
865
+ };
866
+
867
+ const { params = [], returns = [] } = this;
868
+ [...params, ...returns].forEach((p) => {
869
+ if ('in' in p && p.in === 'cookie') {
870
+ p.in = 'header';
871
+ return;
872
+ }
873
+ loopSaveStructure(p?.typeAnnotation);
874
+ });
875
+ return structuresSet;
876
+ }
877
+
826
878
  //================================================================================
827
879
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
828
880
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -339,6 +339,8 @@ export class OqlQueryComponent extends LogicItem {
339
339
  },
340
340
  }).then((res: any) => {
341
341
  this.codeSourceMap = res || { typescript: '', lexicalErrorCode: 1001 };
342
+ }).catch(() => {
343
+ this.codeSourceMap = { typescript: '', lexicalErrorCode: 1001 };
342
344
  });
343
345
  } else {
344
346
  this.codeSourceMap = { typescript: '', lexicalErrorCode: 1001 };
@@ -302,7 +302,7 @@ export class Param extends BaseNode {
302
302
  parsedValue = tryJSONParse(defaultValue) ?? defaultValue;
303
303
  }
304
304
  }
305
- code += `${this.name} || (this.$route.query.hasOwnProperty('${this.name}') ? this.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}', this.$route.query.${this.name}) : ${JSON.stringify(this.defaultValue)})`;
305
+ code += `${this.name} !== undefined ? ${this.name} : (this.$route.query.hasOwnProperty('${this.name}') ? this.$genInitFromSchema('${typeAnnotation?.sortedTypeKey}', this.$route.query.${this.name}) : ${JSON.stringify(this.defaultValue)})`;
306
306
 
307
307
  if (needGenInitFromSchema) {
308
308
  code += `)`;
@@ -150,8 +150,11 @@ function getCurrentLogic(node: BaseNode,
150
150
  expanded: boolean;
151
151
  icon: string;
152
152
  }[]) {
153
- // 只有data-source可以
154
- if (node instanceof Identifier && node.parentNode instanceof BindAttribute && (node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file')) {
153
+ // 只有data-source check-file可以
154
+ if (
155
+ (node instanceof BindAttribute && (node.name === 'data-source' || node.name === 'check-file'))
156
+ || (node instanceof Identifier && node.parentNode instanceof BindAttribute && (node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file'))
157
+ ) {
155
158
  const view = node.view;
156
159
  const viewLogics = view.logics;
157
160
  const logicVariable = viewLogics.map((item) => {
@@ -214,6 +214,9 @@ export class NaslServer {
214
214
  if (data && data.event === 'publishDiagnostics') {
215
215
  const records = await this._resolveDiagnosticRecords(data.records);
216
216
  this.diagnosticManager.pushAll(records);
217
+ try {
218
+ invokeCommand('naslServer:nodeChange');
219
+ } catch (e) { console.log('no "naslServer:nodeChange" event received'); }
217
220
  }
218
221
  },
219
222
  });
@@ -1793,10 +1796,14 @@ export class NaslServer {
1793
1796
  'nasl.collection.Map<nasl.core.String, nasl.core.Text>',
1794
1797
  'nasl.collection.Map<nasl.core.String, nasl.core.Email>',
1795
1798
  ];
1799
+ const excludeList2 = [
1800
+ 'nasl.collection.List<>',
1801
+ 'nasl.collection.List<T>',
1802
+ ];
1796
1803
  // 先特殊处理等 类型合并后就可以去掉了
1797
1804
  if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
1798
1805
  return null;
1799
- } else if (['nasl.collection.List<>'].includes(leftType.sortedTypeKey) || ['nasl.collection.List<>'].includes(rightType.sortedTypeKey)) {
1806
+ } else if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
1800
1807
  return null;
1801
1808
  }
1802
1809
  const diagnostic = {
@@ -22,6 +22,9 @@ function httpCode(response, params, requestInfo) {
22
22
  }
23
23
 
24
24
  function shortResponse(response, params, requestInfo) {
25
+ if(params === false)
26
+ return response;
27
+
25
28
  if (response.data && response.data.result !== undefined) {
26
29
  return response.data.result;
27
30
  } else {
@@ -32,6 +32,12 @@ export default {
32
32
  return;
33
33
  }
34
34
 
35
+ // 检测到当前应用已在新 tab 页打开
36
+ if(err.code === 500502) {
37
+ eventBus.emit('multiTabOpened');
38
+ return;
39
+ }
40
+
35
41
  if (versionStatus[err.code])
36
42
  eventBus.emit('updateVersionStatus', {
37
43
  status: versionStatus[err.code],
@@ -48,6 +48,9 @@ const requester = function (requestInfo) {
48
48
  withCredentials: !baseURL,
49
49
  };
50
50
 
51
+ if(config.timeout)
52
+ requestOptions.timeout = config.timeout;
53
+
51
54
  if (aslConfig.debugRequestAll || (aslConfig.debugRequest && requestOptions.method !== 'GET')) {
52
55
  console.debug('[Request Debug]', requestOptions);
53
56
  }
@@ -11,4 +11,16 @@ export default {
11
11
  path: '/proxy/nasl-storage/api/storage/batchAction',
12
12
  },
13
13
  },
14
+ batchInstruct: {
15
+ url: {
16
+ method: 'post',
17
+ path: '/proxy/nasl-storage/api/storage/batchInstruct',
18
+ },
19
+ },
20
+ saveFrontendNasl: {
21
+ url: {
22
+ method: 'post',
23
+ path: '/proxy/nasl-storage/api/storage/saveFrontendNasl',
24
+ },
25
+ },
14
26
  };