@lcap/nasl 3.4.0-alpha.2 → 3.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/out/common/BaseNode.d.ts +14 -11
  2. package/out/common/BaseNode.js +72 -52
  3. package/out/common/BaseNode.js.map +1 -1
  4. package/out/concepts/Anchor__.js +3 -1
  5. package/out/concepts/Anchor__.js.map +1 -1
  6. package/out/concepts/AnonymousFunction__.js +10 -3
  7. package/out/concepts/AnonymousFunction__.js.map +1 -1
  8. package/out/concepts/App__.js +69 -18
  9. package/out/concepts/App__.js.map +1 -1
  10. package/out/concepts/Argument__.js +3 -1
  11. package/out/concepts/Argument__.js.map +1 -1
  12. package/out/concepts/Assignee__.js +18 -5
  13. package/out/concepts/Assignee__.js.map +1 -1
  14. package/out/concepts/AssignmentLine__.js +6 -2
  15. package/out/concepts/AssignmentLine__.js.map +1 -1
  16. package/out/concepts/Assignment__.js +6 -2
  17. package/out/concepts/Assignment__.js.map +1 -1
  18. package/out/concepts/Attribute__.js +3 -1
  19. package/out/concepts/Attribute__.js.map +1 -1
  20. package/out/concepts/AuthLogicForCallInterface__.js +4 -1
  21. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  22. package/out/concepts/AuthLogic__.js.map +1 -1
  23. package/out/concepts/BackendVariable__.js +3 -1
  24. package/out/concepts/BackendVariable__.js.map +1 -1
  25. package/out/concepts/Backend__.js +4 -1
  26. package/out/concepts/Backend__.js.map +1 -1
  27. package/out/concepts/BatchAssignment__.js +11 -3
  28. package/out/concepts/BatchAssignment__.js.map +1 -1
  29. package/out/concepts/BinaryExpression__.js +6 -2
  30. package/out/concepts/BinaryExpression__.js.map +1 -1
  31. package/out/concepts/BindAttribute__.js +20 -6
  32. package/out/concepts/BindAttribute__.js.map +1 -1
  33. package/out/concepts/BindDirective__.js +7 -2
  34. package/out/concepts/BindDirective__.js.map +1 -1
  35. package/out/concepts/BindEvent__.js +8 -2
  36. package/out/concepts/BindEvent__.js.map +1 -1
  37. package/out/concepts/BindStyle__.js +7 -2
  38. package/out/concepts/BindStyle__.js.map +1 -1
  39. package/out/concepts/CallAuthInterface__.js +4 -1
  40. package/out/concepts/CallAuthInterface__.js.map +1 -1
  41. package/out/concepts/CallFunction__.js +8 -2
  42. package/out/concepts/CallFunction__.js.map +1 -1
  43. package/out/concepts/CallInterface__.d.ts +2 -1
  44. package/out/concepts/CallInterface__.js +51 -13
  45. package/out/concepts/CallInterface__.js.map +1 -1
  46. package/out/concepts/CallLogic__.js +11 -3
  47. package/out/concepts/CallLogic__.js.map +1 -1
  48. package/out/concepts/CallQueryComponent__.js +34 -10
  49. package/out/concepts/CallQueryComponent__.js.map +1 -1
  50. package/out/concepts/CompletionProperty__.js +3 -1
  51. package/out/concepts/CompletionProperty__.js.map +1 -1
  52. package/out/concepts/ConfigGroup__.js +4 -1
  53. package/out/concepts/ConfigGroup__.js.map +1 -1
  54. package/out/concepts/ConfigProperty__.js +4 -1
  55. package/out/concepts/ConfigProperty__.js.map +1 -1
  56. package/out/concepts/Configuration__.js +4 -1
  57. package/out/concepts/Configuration__.js.map +1 -1
  58. package/out/concepts/Connection__.js +4 -1
  59. package/out/concepts/Connection__.js.map +1 -1
  60. package/out/concepts/Connector__.js +26 -7
  61. package/out/concepts/Connector__.js.map +1 -1
  62. package/out/concepts/Constant__.js +3 -1
  63. package/out/concepts/Constant__.js.map +1 -1
  64. package/out/concepts/DataSource__.js +4 -1
  65. package/out/concepts/DataSource__.js.map +1 -1
  66. package/out/concepts/Destination__.js +7 -2
  67. package/out/concepts/Destination__.js.map +1 -1
  68. package/out/concepts/EntityIndex__.js +3 -1
  69. package/out/concepts/EntityIndex__.js.map +1 -1
  70. package/out/concepts/EntityProperty__.js +9 -3
  71. package/out/concepts/EntityProperty__.js.map +1 -1
  72. package/out/concepts/Entity__.js +8 -2
  73. package/out/concepts/Entity__.js.map +1 -1
  74. package/out/concepts/Enum__.js +4 -1
  75. package/out/concepts/Enum__.js.map +1 -1
  76. package/out/concepts/Event__.js +4 -1
  77. package/out/concepts/Event__.js.map +1 -1
  78. package/out/concepts/ExternalDestination__.js +6 -2
  79. package/out/concepts/ExternalDestination__.js.map +1 -1
  80. package/out/concepts/ForEachStatement__.js +19 -6
  81. package/out/concepts/ForEachStatement__.js.map +1 -1
  82. package/out/concepts/FrontendLibrary__.js +8 -2
  83. package/out/concepts/FrontendLibrary__.js.map +1 -1
  84. package/out/concepts/Frontend__.js +19 -5
  85. package/out/concepts/Frontend__.js.map +1 -1
  86. package/out/concepts/Function__.js +19 -5
  87. package/out/concepts/Function__.js.map +1 -1
  88. package/out/concepts/IfStatement__.js +11 -3
  89. package/out/concepts/IfStatement__.js.map +1 -1
  90. package/out/concepts/Integration__.js +7 -2
  91. package/out/concepts/Integration__.js.map +1 -1
  92. package/out/concepts/InterfaceParam__.js +3 -1
  93. package/out/concepts/InterfaceParam__.js.map +1 -1
  94. package/out/concepts/Interface__.js +11 -3
  95. package/out/concepts/Interface__.js.map +1 -1
  96. package/out/concepts/Logic__.js +46 -46
  97. package/out/concepts/Logic__.js.map +1 -1
  98. package/out/concepts/MatchCase__.js +8 -2
  99. package/out/concepts/MatchCase__.js.map +1 -1
  100. package/out/concepts/Match__.js +7 -2
  101. package/out/concepts/Match__.js.map +1 -1
  102. package/out/concepts/MemberExpression__.js +6 -2
  103. package/out/concepts/MemberExpression__.js.map +1 -1
  104. package/out/concepts/Module__.js +55 -14
  105. package/out/concepts/Module__.js.map +1 -1
  106. package/out/concepts/MsgTriggerEvent__.js +4 -1
  107. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  108. package/out/concepts/MsgTriggerLauncher__.js +4 -1
  109. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  110. package/out/concepts/Namespace__.js +48 -12
  111. package/out/concepts/Namespace__.js.map +1 -1
  112. package/out/concepts/NewComposite__.js +15 -4
  113. package/out/concepts/NewComposite__.js.map +1 -1
  114. package/out/concepts/NewList__.js +7 -2
  115. package/out/concepts/NewList__.js.map +1 -1
  116. package/out/concepts/NewMap__.js +11 -3
  117. package/out/concepts/NewMap__.js.map +1 -1
  118. package/out/concepts/NumericLiteral__.js +3 -1
  119. package/out/concepts/NumericLiteral__.js.map +1 -1
  120. package/out/concepts/OqlQueryComponent__.js +3 -1
  121. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  122. package/out/concepts/OverriddenLogic__.js +28 -8
  123. package/out/concepts/OverriddenLogic__.js.map +1 -1
  124. package/out/concepts/Param__.js +3 -1
  125. package/out/concepts/Param__.js.map +1 -1
  126. package/out/concepts/ProcessComponent__.js +8 -2
  127. package/out/concepts/ProcessComponent__.js.map +1 -1
  128. package/out/concepts/ProcessElement__.js +30 -8
  129. package/out/concepts/ProcessElement__.js.map +1 -1
  130. package/out/concepts/ProcessOutcomes__.js +3 -1
  131. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  132. package/out/concepts/Process__.js +20 -5
  133. package/out/concepts/Process__.js.map +1 -1
  134. package/out/concepts/QueryAggregateExpression__.js +3 -1
  135. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  136. package/out/concepts/QueryFromExpression__.js +4 -1
  137. package/out/concepts/QueryFromExpression__.js.map +1 -1
  138. package/out/concepts/QueryGroupByExpression__.js +3 -1
  139. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  140. package/out/concepts/QueryJoinExpression__.js +8 -2
  141. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  142. package/out/concepts/QueryLimitExpression__.js +6 -2
  143. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  144. package/out/concepts/QueryOrderByExpression__.js +6 -2
  145. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  146. package/out/concepts/QuerySelectExpression__.js +4 -1
  147. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  148. package/out/concepts/Return__.js +3 -1
  149. package/out/concepts/Return__.js.map +1 -1
  150. package/out/concepts/SelectMembers__.js +7 -2
  151. package/out/concepts/SelectMembers__.js.map +1 -1
  152. package/out/concepts/Slot__.js +3 -1
  153. package/out/concepts/Slot__.js.map +1 -1
  154. package/out/concepts/SqlQueryComponent__.js +3 -1
  155. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  156. package/out/concepts/StringInterpolation__.js +4 -1
  157. package/out/concepts/StringInterpolation__.js.map +1 -1
  158. package/out/concepts/StructureProperty__.js +3 -1
  159. package/out/concepts/StructureProperty__.js.map +1 -1
  160. package/out/concepts/Structure__.js +8 -2
  161. package/out/concepts/Structure__.js.map +1 -1
  162. package/out/concepts/SwitchCase__.js +7 -2
  163. package/out/concepts/SwitchCase__.js.map +1 -1
  164. package/out/concepts/SwitchStatement__.js +4 -1
  165. package/out/concepts/SwitchStatement__.js.map +1 -1
  166. package/out/concepts/TriggerEvent__.js +4 -1
  167. package/out/concepts/TriggerEvent__.js.map +1 -1
  168. package/out/concepts/TypeAnnotation__.js +12 -3
  169. package/out/concepts/TypeAnnotation__.js.map +1 -1
  170. package/out/concepts/UnaryExpression__.js +3 -1
  171. package/out/concepts/UnaryExpression__.js.map +1 -1
  172. package/out/concepts/ValidationRule__.js +10 -3
  173. package/out/concepts/ValidationRule__.js.map +1 -1
  174. package/out/concepts/Variable__.js +3 -1
  175. package/out/concepts/Variable__.js.map +1 -1
  176. package/out/concepts/ViewComponent__.js +24 -6
  177. package/out/concepts/ViewComponent__.js.map +1 -1
  178. package/out/concepts/ViewElement__.js +24 -7
  179. package/out/concepts/ViewElement__.js.map +1 -1
  180. package/out/concepts/View__.js +27 -7
  181. package/out/concepts/View__.js.map +1 -1
  182. package/out/concepts/WhileStatement__.js +7 -2
  183. package/out/concepts/WhileStatement__.js.map +1 -1
  184. package/out/concepts/types__.d.ts +2 -3
  185. package/out/decorators/index.d.ts +3 -3
  186. package/out/decorators/index.js +3 -1
  187. package/out/decorators/index.js.map +1 -1
  188. package/out/natural/genNaturalTS.js +1 -1
  189. package/out/natural/genNaturalTS.js.map +1 -1
  190. package/out/server/formatTsUtils.d.ts +3 -3
  191. package/out/server/getMemberIdentifier.d.ts +4 -4
  192. package/out/server/naslServer.d.ts +1 -1
  193. package/out/server/naslServer.js +4 -2
  194. package/out/server/naslServer.js.map +1 -1
  195. package/out/translator/utils.js +24 -28
  196. package/out/translator/utils.js.map +1 -1
  197. package/package.json +1 -1
  198. package/src/common/BaseNode.ts +92 -68
  199. package/src/concepts/Anchor__.ts +3 -1
  200. package/src/concepts/AnonymousFunction__.ts +10 -3
  201. package/src/concepts/App__.ts +69 -18
  202. package/src/concepts/Argument__.ts +3 -1
  203. package/src/concepts/Assignee__.ts +18 -5
  204. package/src/concepts/AssignmentLine__.ts +6 -2
  205. package/src/concepts/Assignment__.ts +6 -2
  206. package/src/concepts/Attribute__.ts +3 -1
  207. package/src/concepts/AuthLogicForCallInterface__.ts +4 -1
  208. package/src/concepts/AuthLogic__.ts +3 -0
  209. package/src/concepts/BackendVariable__.ts +3 -1
  210. package/src/concepts/Backend__.ts +4 -1
  211. package/src/concepts/BatchAssignment__.ts +11 -3
  212. package/src/concepts/BinaryExpression__.ts +6 -2
  213. package/src/concepts/BindAttribute__.ts +20 -7
  214. package/src/concepts/BindDirective__.ts +7 -2
  215. package/src/concepts/BindEvent__.ts +8 -2
  216. package/src/concepts/BindStyle__.ts +7 -2
  217. package/src/concepts/CallAuthInterface__.ts +4 -1
  218. package/src/concepts/CallFunction__.ts +8 -2
  219. package/src/concepts/CallInterface__.ts +49 -14
  220. package/src/concepts/CallLogic__.ts +11 -3
  221. package/src/concepts/CallQueryComponent__.ts +34 -10
  222. package/src/concepts/CompletionProperty__.ts +3 -1
  223. package/src/concepts/ConfigGroup__.ts +4 -1
  224. package/src/concepts/ConfigProperty__.ts +4 -1
  225. package/src/concepts/Configuration__.ts +4 -1
  226. package/src/concepts/Connection__.ts +4 -1
  227. package/src/concepts/Connector__.ts +26 -7
  228. package/src/concepts/Constant__.ts +3 -1
  229. package/src/concepts/DataSource__.ts +4 -1
  230. package/src/concepts/Destination__.ts +7 -2
  231. package/src/concepts/EntityIndex__.ts +3 -1
  232. package/src/concepts/EntityProperty__.ts +9 -3
  233. package/src/concepts/Entity__.ts +8 -2
  234. package/src/concepts/Enum__.ts +4 -1
  235. package/src/concepts/Event__.ts +4 -1
  236. package/src/concepts/ExternalDestination__.ts +6 -2
  237. package/src/concepts/ForEachStatement__.ts +19 -6
  238. package/src/concepts/FrontendLibrary__.ts +8 -2
  239. package/src/concepts/Frontend__.ts +19 -5
  240. package/src/concepts/Function__.ts +19 -5
  241. package/src/concepts/IfStatement__.ts +11 -3
  242. package/src/concepts/Integration__.ts +7 -2
  243. package/src/concepts/InterfaceParam__.ts +3 -1
  244. package/src/concepts/Interface__.ts +11 -3
  245. package/src/concepts/Logic__.ts +62 -57
  246. package/src/concepts/MatchCase__.ts +8 -2
  247. package/src/concepts/Match__.ts +7 -2
  248. package/src/concepts/MemberExpression__.ts +6 -2
  249. package/src/concepts/Module__.ts +55 -14
  250. package/src/concepts/MsgTriggerEvent__.ts +4 -1
  251. package/src/concepts/MsgTriggerLauncher__.ts +4 -1
  252. package/src/concepts/Namespace__.ts +48 -12
  253. package/src/concepts/NewComposite__.ts +15 -4
  254. package/src/concepts/NewList__.ts +7 -2
  255. package/src/concepts/NewMap__.ts +11 -3
  256. package/src/concepts/NumericLiteral__.ts +3 -1
  257. package/src/concepts/OqlQueryComponent__.ts +3 -1
  258. package/src/concepts/OverriddenLogic__.ts +28 -8
  259. package/src/concepts/Param__.ts +3 -1
  260. package/src/concepts/ProcessComponent__.ts +8 -2
  261. package/src/concepts/ProcessElement__.ts +30 -8
  262. package/src/concepts/ProcessOutcomes__.ts +3 -1
  263. package/src/concepts/Process__.ts +20 -5
  264. package/src/concepts/QueryAggregateExpression__.ts +3 -1
  265. package/src/concepts/QueryFromExpression__.ts +4 -1
  266. package/src/concepts/QueryGroupByExpression__.ts +3 -1
  267. package/src/concepts/QueryJoinExpression__.ts +8 -2
  268. package/src/concepts/QueryLimitExpression__.ts +6 -2
  269. package/src/concepts/QueryOrderByExpression__.ts +6 -2
  270. package/src/concepts/QuerySelectExpression__.ts +4 -1
  271. package/src/concepts/Return__.ts +3 -1
  272. package/src/concepts/SelectMembers__.ts +7 -2
  273. package/src/concepts/Slot__.ts +3 -1
  274. package/src/concepts/SqlQueryComponent__.ts +3 -1
  275. package/src/concepts/StringInterpolation__.ts +4 -1
  276. package/src/concepts/StructureProperty__.ts +3 -1
  277. package/src/concepts/Structure__.ts +8 -2
  278. package/src/concepts/SwitchCase__.ts +7 -2
  279. package/src/concepts/SwitchStatement__.ts +4 -1
  280. package/src/concepts/TriggerEvent__.ts +4 -1
  281. package/src/concepts/TypeAnnotation__.ts +13 -4
  282. package/src/concepts/UnaryExpression__.ts +3 -1
  283. package/src/concepts/ValidationRule__.ts +10 -3
  284. package/src/concepts/Variable__.ts +3 -1
  285. package/src/concepts/ViewComponent__.ts +24 -6
  286. package/src/concepts/ViewElement__.ts +92 -72
  287. package/src/concepts/View__.ts +27 -7
  288. package/src/concepts/WhileStatement__.ts +7 -2
  289. package/src/concepts/types__.ts +2 -4
  290. package/src/decorators/index.ts +7 -5
  291. package/src/natural/genNaturalTS.ts +1 -1
  292. package/src/server/formatTsUtils.ts +8 -8
  293. package/src/server/getMemberIdentifier.ts +4 -4
  294. package/src/server/naslServer.ts +4 -4
  295. package/src/service/storage/init.ts +2 -2
  296. package/src/translator/utils.ts +7 -9
@@ -1,3 +1,4 @@
1
+ import { v4 as uuidv4 } from 'uuid';
1
2
  import { FrontendLibrary } from './FrontendLibrary__';
2
3
  import {
3
4
  TranslatorState,
@@ -20,18 +21,15 @@ import MatchCase from './MatchCase__';
20
21
  import TypeAnnotation from './TypeAnnotation__';
21
22
  import CallInterface from './CallInterface__';
22
23
  import CallLogic from './CallLogic__';
23
- import ViewElement from './ViewElement__';
24
- import { SynatxNode } from './types__';
25
24
 
26
- //================================================================================
25
+ //= ===============================================================================
27
26
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
28
27
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
29
- //================================================================================
28
+ //= ===============================================================================
30
29
  import { EventPayload, Params } from '../common/EventEmitter';
31
30
  import { concept, excludedInJSON, property, className } from '../decorators';
32
31
 
33
32
  import * as utils from '../utils';
34
- import { v4 as uuidv4 } from 'uuid';
35
33
  import BaseNode from '../common/BaseNode';
36
34
  import Transactional from './Transactional__';
37
35
  import TypeParam from './TypeParam__';
@@ -46,7 +44,6 @@ import ProcessElement from './ProcessElement__';
46
44
  import App from './App__';
47
45
  import Frontend from './Frontend__';
48
46
  import Process from './Process__';
49
- import { NaslServer } from 'src/server';
50
47
 
51
48
  /**
52
49
  * 逻辑
@@ -109,44 +106,64 @@ export class Logic extends BaseNode {
109
106
  /**
110
107
  * 事务
111
108
  */
112
- @property('Transactional')
109
+ @property({
110
+ objectRef: 'Transactional',
111
+ })
113
112
  // @ts-ignore
114
113
  transactional!: Transactional;
115
114
 
116
115
  /**
117
116
  * 类型参数列表
118
117
  */
119
- @property('TypeParam')
118
+ @property({
119
+ objectRef: 'TypeParam',
120
+ isArray: true,
121
+ })
120
122
  typeParams: Array<TypeParam> = null;
121
123
 
122
124
  /**
123
125
  * 输入参数列表
124
126
  */
125
- @property('Param')
127
+ @property({
128
+ objectRef: 'Param',
129
+ isArray: true,
130
+ })
126
131
  params: Array<Param> = [];
127
132
 
128
133
  /**
129
134
  * 输出参数列表
130
135
  */
131
- @property('Return')
136
+ @property({
137
+ objectRef: 'Return',
138
+ isArray: true,
139
+ })
132
140
  returns: Array<Return> = [];
133
141
 
134
142
  /**
135
143
  * 变量列表
136
144
  */
137
- @property('Variable')
145
+ @property({
146
+ objectRef: 'Variable',
147
+ isArray: true,
148
+ })
138
149
  variables: Array<Variable> = [];
139
150
 
140
151
  /**
141
152
  * 逻辑项列表
142
153
  */
143
- @property('LogicItem')
154
+ @property({
155
+ objectRef: 'LogicItem',
156
+ isArray: true,
157
+ })
144
158
  body: Array<LogicItem> = [];
145
159
 
146
160
  /**
147
161
  * 逻辑项列表
148
162
  */
149
- @property('LogicItem')
163
+ @property({
164
+ objectRef: 'LogicItem',
165
+ isArray: true,
166
+ })
150
167
  playground: Array<LogicItem> = [];
151
168
 
152
169
  /**
@@ -155,36 +172,42 @@ export class Logic extends BaseNode {
155
172
  get module() {
156
173
  return this.getAncestor('Module') as Module;
157
174
  }
175
+
158
176
  /**
159
177
  * 祖先 App
160
178
  */
161
179
  get app() {
162
180
  return this.getAncestor('App') as App;
163
181
  }
182
+
164
183
  /**
165
184
  * 祖先 Connector
166
185
  */
167
186
  get connector() {
168
187
  return this.getAncestor('Connector') as Connector;
169
188
  }
189
+
170
190
  /**
171
191
  * 祖先 View
172
192
  */
173
193
  get view() {
174
194
  return this.getAncestor('View') as View;
175
195
  }
196
+
176
197
  /**
177
198
  * 祖先 Frontend
178
199
  */
179
200
  get frontend() {
180
201
  return this.getAncestor('Frontend') as Frontend;
181
202
  }
203
+
182
204
  /**
183
205
  * 祖先 ProcessElement
184
206
  */
185
207
  get processElement() {
186
208
  return this.getAncestor('ProcessElement') as ProcessElement;
187
209
  }
210
+
188
211
  /**
189
212
  * 祖先 Process
190
213
  */
@@ -196,7 +219,7 @@ export class Logic extends BaseNode {
196
219
  * @param source 需要合并的部分参数
197
220
  */
198
221
  constructor(source?: Partial<Logic>) {
199
- source = Object.assign({}, Logic.getDefaultOptions(), source);
222
+ source = { ...Logic.getDefaultOptions(), ...source};
200
223
  super(source);
201
224
  super.subConstructor(source);
202
225
  }
@@ -216,6 +239,7 @@ export class Logic extends BaseNode {
216
239
  }
217
240
  return params;
218
241
  }
242
+
219
243
  /**
220
244
  * 设置逻辑名称
221
245
  */
@@ -308,6 +332,7 @@ export class Logic extends BaseNode {
308
332
  const excludedSet = new Set(excludedList);
309
333
  return ((this.typeParams as TypeParam[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
310
334
  }
335
+
311
336
  getTypeParamUniqueName(name = 'typeParam1') {
312
337
  return utils.unique(name, this.getTypeParamExistingNames(), undefined, false);
313
338
  }
@@ -1121,7 +1146,7 @@ export class Logic extends BaseNode {
1121
1146
  if (typeof options === 'string') {
1122
1147
  transactional = this.transactional;
1123
1148
  if (!transactional) {
1124
- throw new Error('找不到事务 ' + options);
1149
+ throw new Error(`找不到事务 ${ options}`);
1125
1150
  }
1126
1151
  } else {
1127
1152
  transactional = options;
@@ -1130,7 +1155,7 @@ export class Logic extends BaseNode {
1130
1155
  }
1131
1156
 
1132
1157
  __removeTransactional(transactional: Transactional) {
1133
- const parentKey = transactional.parentKey;
1158
+ const {parentKey} = transactional;
1134
1159
  const params: Params = {
1135
1160
  parentNode: this,
1136
1161
  parentKey,
@@ -1169,7 +1194,7 @@ export class Logic extends BaseNode {
1169
1194
  if (typeof options === 'string') {
1170
1195
  typeParam = (this.typeParams as TypeParam[]).find((item) => item.name === options);
1171
1196
  if (!typeParam) {
1172
- throw new Error('找不到类型参数 ' + options);
1197
+ throw new Error(`找不到类型参数 ${ options}`);
1173
1198
  }
1174
1199
  } else {
1175
1200
  typeParam = options;
@@ -1178,7 +1203,7 @@ export class Logic extends BaseNode {
1178
1203
  }
1179
1204
 
1180
1205
  __removeTypeParam(typeParam: TypeParam) {
1181
- const parentKey = typeParam.parentKey;
1206
+ const {parentKey} = typeParam;
1182
1207
  const params: Params = {
1183
1208
  parentNode: this,
1184
1209
  parentKey,
@@ -1217,7 +1242,7 @@ export class Logic extends BaseNode {
1217
1242
  if (typeof options === 'string') {
1218
1243
  param = (this.params as Param[]).find((item) => item.name === options);
1219
1244
  if (!param) {
1220
- throw new Error('找不到输入参数 ' + options);
1245
+ throw new Error(`找不到输入参数 ${ options}`);
1221
1246
  }
1222
1247
  } else {
1223
1248
  param = options;
@@ -1226,7 +1251,7 @@ export class Logic extends BaseNode {
1226
1251
  }
1227
1252
 
1228
1253
  __removeParam(param: Param) {
1229
- const parentKey = param.parentKey;
1254
+ const {parentKey} = param;
1230
1255
  const params: Params = {
1231
1256
  parentNode: this,
1232
1257
  parentKey,
@@ -1265,7 +1290,7 @@ export class Logic extends BaseNode {
1265
1290
  if (typeof options === 'string') {
1266
1291
  ret = (this.returns as Return[]).find((item) => item.name === options);
1267
1292
  if (!ret) {
1268
- throw new Error('找不到输出参数 ' + options);
1293
+ throw new Error(`找不到输出参数 ${ options}`);
1269
1294
  }
1270
1295
  } else {
1271
1296
  ret = options;
@@ -1274,7 +1299,7 @@ export class Logic extends BaseNode {
1274
1299
  }
1275
1300
 
1276
1301
  __removeReturn(ret: Return) {
1277
- const parentKey = ret.parentKey;
1302
+ const {parentKey} = ret;
1278
1303
  const params: Params = {
1279
1304
  parentNode: this,
1280
1305
  parentKey,
@@ -1313,7 +1338,7 @@ export class Logic extends BaseNode {
1313
1338
  if (typeof options === 'string') {
1314
1339
  variable = (this.variables as Variable[]).find((item) => item.name === options);
1315
1340
  if (!variable) {
1316
- throw new Error('找不到变量 ' + options);
1341
+ throw new Error(`找不到变量 ${ options}`);
1317
1342
  }
1318
1343
  } else {
1319
1344
  variable = options;
@@ -1322,7 +1347,7 @@ export class Logic extends BaseNode {
1322
1347
  }
1323
1348
 
1324
1349
  __removeVariable(variable: Variable) {
1325
- const parentKey = variable.parentKey;
1350
+ const {parentKey} = variable;
1326
1351
  const params: Params = {
1327
1352
  parentNode: this,
1328
1353
  parentKey,
@@ -1351,7 +1376,7 @@ export class Logic extends BaseNode {
1351
1376
  removeItemInBody(logicItem: LogicItem): void;
1352
1377
 
1353
1378
  removeItemInBody(options: LogicItem) {
1354
- let logicItem: LogicItem = options;
1379
+ const logicItem: LogicItem = options;
1355
1380
  return logicItem.delete();
1356
1381
  }
1357
1382
 
@@ -1362,12 +1387,12 @@ export class Logic extends BaseNode {
1362
1387
  removeItemInPlayground(logicItem: LogicItem): void;
1363
1388
 
1364
1389
  removeItemInPlayground(options: LogicItem) {
1365
- let logicItem: LogicItem = options;
1390
+ const logicItem: LogicItem = options;
1366
1391
  return logicItem.delete();
1367
1392
  }
1368
1393
 
1369
1394
  __removeLogicItem(logicItem: LogicItem) {
1370
- const parentKey = logicItem.parentKey;
1395
+ const {parentKey} = logicItem;
1371
1396
  const params: Params = {
1372
1397
  parentNode: this,
1373
1398
  parentKey,
@@ -1389,10 +1414,10 @@ export class Logic extends BaseNode {
1389
1414
  return params;
1390
1415
  }
1391
1416
 
1392
- //================================================================================
1417
+ //= ===============================================================================
1393
1418
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1394
1419
  // 自动生成的代码已结束。下面可以手动编写。
1395
- //================================================================================
1420
+ //= ===============================================================================
1396
1421
  // 用于calllogic树中定位是那个logic,回显
1397
1422
  get calleewholeKey() {
1398
1423
  return `${this.getNamespace()}.${this.name}`;
@@ -1980,7 +2005,6 @@ ${indent(state.tabSize)} */\n`;
1980
2005
 
1981
2006
  // 需要类型推导的局部变量/返回值需要调整申明顺序
1982
2007
  const advanceMap: Map<Return | Variable, Assignment | BatchAssignment> = new Map();
1983
- const needGetSourceMapOqlList: Promise<any>[] = [];
1984
2008
  this.traverseChildren((el) => {
1985
2009
  if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
1986
2010
  const jsCode = el.toJS();
@@ -1995,27 +2019,8 @@ ${indent(state.tabSize)} */\n`;
1995
2019
  advanceMap.set(advanceRn, el);
1996
2020
  }
1997
2021
  }
1998
- // 如果有sql查询组件就需要把他们存起来
1999
- if (el instanceof OqlQueryComponent) {
2000
- if (!el.codeSourceMap) {
2001
- needGetSourceMapOqlList.push(el.requestEmbeddedTS());
2002
- }
2003
- }
2004
2022
  });
2005
2023
 
2006
- if (needGetSourceMapOqlList.length) {
2007
- Promise.all(needGetSourceMapOqlList).then(() => {
2008
- // 触发一下更新重新生成代码
2009
- (this.app as any)?.naslServer?.embeddedTSEmitter.emit('change', {
2010
- value: [{
2011
- originEvent: {
2012
- action: 'update',
2013
- target: this,
2014
- },
2015
- }],
2016
- });
2017
- });
2018
- }
2019
2024
  // 兼容 return 没有类型情况
2020
2025
  if (this.returns.length && this.returns[0].typeAnnotation) {
2021
2026
  code += ': ';
@@ -2031,13 +2036,13 @@ ${indent(state.tabSize)} */\n`;
2031
2036
  code += variable.toNaturalTS(shiftState(state, code, { inline: true }));
2032
2037
  code += ';\n';
2033
2038
  });
2034
-
2039
+
2035
2040
  this.returns.forEach((ret) => {
2036
2041
  code += `${indent(state.tabSize + 1)}let `;
2037
2042
  code += ret.toNaturalTS(shiftState(state, code, { inline: true }));
2038
2043
  code += ';\n';
2039
2044
  });
2040
-
2045
+
2041
2046
  code += `${indent(state.tabSize + 1)}// 当前位置\n`;
2042
2047
  if (!this.body.length && this.returns.length) {
2043
2048
  code += `${indent(state.tabSize + 1)}return ${this.returns[0].name};\n`;
@@ -2055,7 +2060,7 @@ ${indent(state.tabSize)} */\n`;
2055
2060
  }
2056
2061
  });
2057
2062
  }
2058
-
2063
+
2059
2064
  code += `${indent(state.tabSize)}}`;
2060
2065
  }
2061
2066
  if (prefix === 'inObject') {
@@ -2116,7 +2121,7 @@ ${indent(state.tabSize)} */\n`;
2116
2121
  handleForEachCode(code: string, forEachStatement: ForEachStatement): string {
2117
2122
  const { item, index, each } = forEachStatement;
2118
2123
  if (code.includes(item.name)) {
2119
- const eachTSCode = each.toEmbeddedTS();
2124
+ const eachTSCode = each ? each.toEmbeddedTS() : '__IDENTIFIER__'
2120
2125
  code = this.handleReplaceCode(
2121
2126
  code,
2122
2127
  item.name,
@@ -2455,14 +2460,14 @@ ${indent(state.tabSize)} */\n`;
2455
2460
  return findHasError;
2456
2461
  }
2457
2462
 
2458
- //================================================================================
2463
+ //= ===============================================================================
2459
2464
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
2460
2465
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
2461
- //================================================================================
2466
+ //= ===============================================================================
2462
2467
  }
2463
2468
 
2464
2469
  export default Logic;
2465
- //================================================================================
2470
+ //= ===============================================================================
2466
2471
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
2467
2472
  // 自动生成的代码已结束。下面可以手动编写。
2468
- //================================================================================
2473
+ //= ===============================================================================
@@ -37,13 +37,19 @@ export class MatchCase extends LogicItem {
37
37
  /**
38
38
  * 条件表达式
39
39
  */
40
- @property('LogicItem | TypeAnnotation')
40
+ @property({
41
+ objectRef: 'LogicItem | TypeAnnotation',
42
+ isArray: true,
43
+ })
41
44
  patterns: Array<LogicItem | TypeAnnotation> = [];
42
45
 
43
46
  /**
44
47
  * then
45
48
  */
46
- @property('LogicItem')
49
+ @property({
50
+ objectRef: 'LogicItem',
51
+ isArray: true,
52
+ })
47
53
  body: Array<LogicItem> = [];
48
54
 
49
55
  /**
@@ -38,7 +38,9 @@ export class Match extends LogicItem {
38
38
  /**
39
39
  * 逻辑项
40
40
  */
41
- @property('LogicItem')
41
+ @property({
42
+ objectRef: 'LogicItem',
43
+ })
42
44
  // @ts-ignore
43
45
  expression!: LogicItem;
44
46
 
@@ -51,7 +53,10 @@ export class Match extends LogicItem {
51
53
  /**
52
54
  * 匹配分支列表
53
55
  */
54
- @property('MatchCase')
56
+ @property({
57
+ objectRef: 'MatchCase',
58
+ isArray: true,
59
+ })
55
60
  cases: Array<MatchCase> = [];
56
61
 
57
62
  /**
@@ -46,14 +46,18 @@ export class MemberExpression extends LogicItem {
46
46
  /**
47
47
  * 逻辑项
48
48
  */
49
- @property('LogicItem')
49
+ @property({
50
+ objectRef: 'LogicItem',
51
+ })
50
52
  // @ts-ignore
51
53
  object!: LogicItem;
52
54
 
53
55
  /**
54
56
  * 逻辑项
55
57
  */
56
- @property('LogicItem')
58
+ @property({
59
+ objectRef: 'LogicItem',
60
+ })
57
61
  // @ts-ignore
58
62
  property!: LogicItem;
59
63
 
@@ -117,86 +117,127 @@ export class Module extends BaseNode {
117
117
  /**
118
118
  * 数据源列表
119
119
  */
120
- @property('DataSource')
120
+ @property({
121
+ objectRef: 'DataSource',
122
+ isArray: true,
123
+ })
121
124
  dataSources: Array<DataSource> = [];
122
125
 
123
126
  /**
124
127
  * 数据结构列表
125
128
  */
126
- @property('Structure')
129
+ @property({
130
+ objectRef: 'Structure',
131
+ isArray: true,
132
+ })
127
133
  structures: Array<Structure> = [];
128
134
 
129
135
  /**
130
136
  * 枚举列表
131
137
  */
132
- @property('Enum')
138
+ @property({
139
+ objectRef: 'Enum',
140
+ isArray: true,
141
+ })
133
142
  enums: Array<Enum> = [];
134
143
 
135
144
  /**
136
145
  * 逻辑列表
137
146
  */
138
- @property('Logic')
147
+ @property({
148
+ objectRef: 'Logic',
149
+ isArray: true,
150
+ })
139
151
  logics: Array<Logic> = [];
140
152
 
141
153
  /**
142
154
  * 接口列表
143
155
  */
144
- @property('Interface')
156
+ @property({
157
+ objectRef: 'Interface',
158
+ isArray: true,
159
+ })
145
160
  interfaces: Array<Interface> = [];
146
161
 
147
162
  /**
148
163
  * 页面列表
149
164
  */
150
- @property('View')
165
+ @property({
166
+ objectRef: 'View',
167
+ isArray: true,
168
+ })
151
169
  views: Array<View> = [];
152
170
 
153
171
  /**
154
172
  * 变量列表
155
173
  */
156
- @property('Variable')
174
+ @property({
175
+ objectRef: 'Variable',
176
+ isArray: true,
177
+ })
157
178
  frontendVariables: Array<Variable> = [];
158
179
 
159
180
  /**
160
181
  * 流程列表
161
182
  */
162
- @property('Process')
183
+ @property({
184
+ objectRef: 'Process',
185
+ isArray: true,
186
+ })
163
187
  processes: Array<Process> = [];
164
188
 
165
189
  /**
166
190
  * 前端库列表
167
191
  */
168
- @property('FrontendLibrary')
192
+ @property({
193
+ objectRef: 'FrontendLibrary',
194
+ isArray: true,
195
+ })
169
196
  frontends: Array<FrontendLibrary> = [];
170
197
 
171
198
  /**
172
199
  * 配置管理
173
200
  */
174
- @property('Configuration')
201
+ @property({
202
+ objectRef: 'Configuration',
203
+ })
175
204
  // @ts-ignore
176
205
  configuration!: Configuration;
177
206
 
178
207
  /**
179
208
  * 暴露接口的接口鉴权
180
209
  */
181
- @property('AuthLogic')
210
+ @property({
211
+ objectRef: 'AuthLogic',
212
+ isArray: true,
213
+ })
182
214
  authLogics: Array<AuthLogic> = [];
183
215
 
184
216
  /**
185
217
  * 调用接口的鉴权模板
186
218
  */
187
- @property('AuthLogicForCallInterface')
219
+ @property({
220
+ objectRef: 'AuthLogicForCallInterface',
221
+ isArray: true,
222
+ })
188
223
  authLogicsForCallInterface: Array<AuthLogicForCallInterface> = [];
189
224
 
190
225
  /**
191
226
  * 触发器启动器列表
192
227
  */
193
- @property('TriggerLauncher')
228
+ @property({
229
+ objectRef: 'TriggerLauncher',
230
+ isArray: true,
231
+ })
194
232
  triggerLaunchers: Array<TriggerLauncher> = [];
195
233
 
196
234
  /**
197
235
  * 连接列表
198
236
  */
199
- @property('Connection')
237
+ @property({
238
+ objectRef: 'Connection',
239
+ isArray: true,
240
+ })
200
241
  connections: Array<Connection> = [];
201
242
 
202
243
  /**
@@ -36,7 +36,10 @@ export class MsgTriggerEvent extends TriggerEvent {
36
36
  /**
37
37
  * 输入参数列表
38
38
  */
39
- @property('Param')
39
+ @property({
40
+ objectRef: 'Param',
41
+ isArray: true,
42
+ })
40
43
  properties: Array<Param> = [];
41
44
 
42
45
  /**
@@ -33,7 +33,10 @@ export class MsgTriggerLauncher extends TriggerLauncher {
33
33
  /**
34
34
  * 实际参数列表
35
35
  */
36
- @property('Argument')
36
+ @property({
37
+ objectRef: 'Argument',
38
+ isArray: true,
39
+ })
37
40
  properties: Array<Argument> = [];
38
41
 
39
42
  /**