@lcap/nasl 1.0.2 → 2.12.0

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 (299) hide show
  1. package/out/automate/engine/index.d.ts +1 -0
  2. package/out/automate/engine/index.js +34 -12
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/operators.d.ts +10 -2
  5. package/out/automate/engine/operators.js +105 -7
  6. package/out/automate/engine/operators.js.map +1 -1
  7. package/out/automate/engine/uniqueName.d.ts +8 -2
  8. package/out/automate/engine/uniqueName.js +72 -4
  9. package/out/automate/engine/uniqueName.js.map +1 -1
  10. package/out/automate/engine/utils.d.ts +1 -0
  11. package/out/automate/engine/utils.js +92 -67
  12. package/out/automate/engine/utils.js.map +1 -1
  13. package/out/automate/template/process.d.ts +9 -0
  14. package/out/automate/template/process.js +10976 -0
  15. package/out/automate/template/process.js.map +1 -0
  16. package/out/bak/translator.js +1 -0
  17. package/out/bak/translator.js.map +1 -1
  18. package/out/common/BaseNode.d.ts +5 -0
  19. package/out/common/BaseNode.js +24 -3
  20. package/out/common/BaseNode.js.map +1 -1
  21. package/out/concepts/App__.d.ts +51 -49
  22. package/out/concepts/App__.js +86 -53
  23. package/out/concepts/App__.js.map +1 -1
  24. package/out/concepts/BindAttribute__.js +2 -2
  25. package/out/concepts/BindAttribute__.js.map +1 -1
  26. package/out/concepts/BindDirective__.js +10 -3
  27. package/out/concepts/BindDirective__.js.map +1 -1
  28. package/out/concepts/BindEvent__.js +15 -6
  29. package/out/concepts/BindEvent__.js.map +1 -1
  30. package/out/concepts/BooleanLiteral__.d.ts +4 -0
  31. package/out/concepts/BooleanLiteral__.js +11 -0
  32. package/out/concepts/BooleanLiteral__.js.map +1 -1
  33. package/out/concepts/CallFunction__.js +8 -2
  34. package/out/concepts/CallFunction__.js.map +1 -1
  35. package/out/concepts/CallLogic__.js +48 -30
  36. package/out/concepts/CallLogic__.js.map +1 -1
  37. package/out/concepts/CallQueryComponent__.d.ts +8 -7
  38. package/out/concepts/CallQueryComponent__.js +86 -76
  39. package/out/concepts/CallQueryComponent__.js.map +1 -1
  40. package/out/concepts/Comment__.js +1 -1
  41. package/out/concepts/Comment__.js.map +1 -1
  42. package/out/concepts/ConfigGroup__.d.ts +1 -0
  43. package/out/concepts/ConfigGroup__.js +7 -0
  44. package/out/concepts/ConfigGroup__.js.map +1 -1
  45. package/out/concepts/ConfigProperty__.d.ts +1 -0
  46. package/out/concepts/ConfigProperty__.js +3 -0
  47. package/out/concepts/ConfigProperty__.js.map +1 -1
  48. package/out/concepts/Configuration__.d.ts +1 -0
  49. package/out/concepts/Configuration__.js +3 -0
  50. package/out/concepts/Configuration__.js.map +1 -1
  51. package/out/concepts/DataSource__.d.ts +143 -0
  52. package/out/concepts/DataSource__.js +318 -0
  53. package/out/concepts/DataSource__.js.map +1 -0
  54. package/out/concepts/Destination__.js +8 -8
  55. package/out/concepts/Destination__.js.map +1 -1
  56. package/out/concepts/End__.js +2 -2
  57. package/out/concepts/End__.js.map +1 -1
  58. package/out/concepts/EntityIndex__.d.ts +5 -0
  59. package/out/concepts/EntityIndex__.js +6 -0
  60. package/out/concepts/EntityIndex__.js.map +1 -1
  61. package/out/concepts/EntityProperty__.d.ts +9 -0
  62. package/out/concepts/EntityProperty__.js +19 -2
  63. package/out/concepts/EntityProperty__.js.map +1 -1
  64. package/out/concepts/Entity__.d.ts +5 -0
  65. package/out/concepts/Entity__.js +20 -10
  66. package/out/concepts/Entity__.js.map +1 -1
  67. package/out/concepts/Enum__.js +12 -6
  68. package/out/concepts/Enum__.js.map +1 -1
  69. package/out/concepts/ForEachStatement__.js +2 -2
  70. package/out/concepts/ForEachStatement__.js.map +1 -1
  71. package/out/concepts/Function__.d.ts +18 -0
  72. package/out/concepts/Function__.js +96 -1
  73. package/out/concepts/Function__.js.map +1 -1
  74. package/out/concepts/Identifier__.js +6 -15
  75. package/out/concepts/Identifier__.js.map +1 -1
  76. package/out/concepts/IfStatement__.js +8 -8
  77. package/out/concepts/IfStatement__.js.map +1 -1
  78. package/out/concepts/Interface__.js +19 -12
  79. package/out/concepts/Interface__.js.map +1 -1
  80. package/out/concepts/JSBlock__.js +3 -5
  81. package/out/concepts/JSBlock__.js.map +1 -1
  82. package/out/concepts/Logic__.js +44 -44
  83. package/out/concepts/Logic__.js.map +1 -1
  84. package/out/concepts/Module__.d.ts +116 -194
  85. package/out/concepts/Module__.js +31 -114
  86. package/out/concepts/Module__.js.map +1 -1
  87. package/out/concepts/Namespace__.d.ts +0 -86
  88. package/out/concepts/Namespace__.js +1 -108
  89. package/out/concepts/Namespace__.js.map +1 -1
  90. package/out/concepts/Param__.d.ts +2 -1
  91. package/out/concepts/Param__.js +1 -1
  92. package/out/concepts/Param__.js.map +1 -1
  93. package/out/concepts/ProcessElement__.js +30 -10
  94. package/out/concepts/ProcessElement__.js.map +1 -1
  95. package/out/concepts/Process__.d.ts +1 -1
  96. package/out/concepts/Process__.js +17 -10
  97. package/out/concepts/Process__.js.map +1 -1
  98. package/out/concepts/QueryFieldExpression__.js +8 -1
  99. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  100. package/out/concepts/QueryFromExpression__.d.ts +4 -0
  101. package/out/concepts/QueryFromExpression__.js +13 -2
  102. package/out/concepts/QueryFromExpression__.js.map +1 -1
  103. package/out/concepts/QueryJoinExpression__.d.ts +4 -0
  104. package/out/concepts/QueryJoinExpression__.js +14 -3
  105. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  106. package/out/concepts/Return__.js +1 -1
  107. package/out/concepts/Return__.js.map +1 -1
  108. package/out/concepts/Role__.js +10 -3
  109. package/out/concepts/Role__.js.map +1 -1
  110. package/out/concepts/SqlQueryComponent__.d.ts +14 -0
  111. package/out/concepts/SqlQueryComponent__.js +48 -5
  112. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  113. package/out/concepts/StringLiteral__.d.ts +1 -1
  114. package/out/concepts/StringLiteral__.js +1 -1
  115. package/out/concepts/StructureProperty__.js +6 -5
  116. package/out/concepts/StructureProperty__.js.map +1 -1
  117. package/out/concepts/Structure__.js +19 -12
  118. package/out/concepts/Structure__.js.map +1 -1
  119. package/out/concepts/SwitchCase__.d.ts +1 -1
  120. package/out/concepts/SwitchCase__.js +23 -25
  121. package/out/concepts/SwitchCase__.js.map +1 -1
  122. package/out/concepts/SwitchStatement__.js +1 -6
  123. package/out/concepts/SwitchStatement__.js.map +1 -1
  124. package/out/concepts/TypeAnnotation__.d.ts +8 -0
  125. package/out/concepts/TypeAnnotation__.js +44 -2
  126. package/out/concepts/TypeAnnotation__.js.map +1 -1
  127. package/out/concepts/Variable__.js +1 -1
  128. package/out/concepts/Variable__.js.map +1 -1
  129. package/out/concepts/ViewElement__.js +25 -20
  130. package/out/concepts/ViewElement__.js.map +1 -1
  131. package/out/concepts/View__.d.ts +0 -2
  132. package/out/concepts/View__.js +27 -32
  133. package/out/concepts/View__.js.map +1 -1
  134. package/out/concepts/WhileStatement__.js +4 -4
  135. package/out/concepts/WhileStatement__.js.map +1 -1
  136. package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
  137. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  138. package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
  139. package/out/concepts/basics/stdlib/nasl.process.js +410 -0
  140. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  141. package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
  142. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  143. package/out/concepts/basics/stdlib/nasl.util.js +280 -2
  144. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  145. package/out/concepts/basics/types/index.d.ts +1 -0
  146. package/out/concepts/basics/types/index.js +4 -1
  147. package/out/concepts/basics/types/index.js.map +1 -1
  148. package/out/concepts/index__.d.ts +1 -0
  149. package/out/concepts/index__.js +1 -0
  150. package/out/concepts/index__.js.map +1 -1
  151. package/out/generator/genBundleFiles.d.ts +3 -1
  152. package/out/generator/genBundleFiles.js +23 -5
  153. package/out/generator/genBundleFiles.js.map +1 -1
  154. package/out/generator/genMetaData.d.ts +1 -0
  155. package/out/generator/genMetaData.js +20 -12
  156. package/out/generator/genMetaData.js.map +1 -1
  157. package/out/index.d.ts +1 -1
  158. package/out/index.js +2 -1
  159. package/out/index.js.map +1 -1
  160. package/out/server/createUiTs.js +1 -0
  161. package/out/server/createUiTs.js.map +1 -1
  162. package/out/server/getLogics.js +27 -1
  163. package/out/server/getLogics.js.map +1 -1
  164. package/out/server/getMemberIdentifier.js +5 -0
  165. package/out/server/getMemberIdentifier.js.map +1 -1
  166. package/out/server/getProcesses.d.ts +4 -0
  167. package/out/server/getProcesses.js +69 -1
  168. package/out/server/getProcesses.js.map +1 -1
  169. package/out/server/naslServer.d.ts +1 -0
  170. package/out/server/naslServer.js +223 -26
  171. package/out/server/naslServer.js.map +1 -1
  172. package/out/server/process2LogicNamespace.js +10 -1
  173. package/out/server/process2LogicNamespace.js.map +1 -1
  174. package/out/server/translator.js +37 -1
  175. package/out/server/translator.js.map +1 -1
  176. package/out/service/creator/errHandles.js +5 -0
  177. package/out/service/creator/errHandles.js.map +1 -1
  178. package/out/service/storage/init.d.ts +1 -0
  179. package/out/service/storage/init.js +95 -84
  180. package/out/service/storage/init.js.map +1 -1
  181. package/out/templator/genCreateBlock.js +34 -24
  182. package/out/templator/genCreateBlock.js.map +1 -1
  183. package/out/templator/genCurdEditMultipleKeyBlock.js +28 -18
  184. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  185. package/out/templator/genCurdMultipleKeyBlock.js +45 -29
  186. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  187. package/out/templator/genEditTableBlock.js +15 -13
  188. package/out/templator/genEditTableBlock.js.map +1 -1
  189. package/out/templator/genEnumSelectBlock.js +1 -1
  190. package/out/templator/genEnumSelectBlock.js.map +1 -1
  191. package/out/templator/genGridViewBlock.js +29 -24
  192. package/out/templator/genGridViewBlock.js.map +1 -1
  193. package/out/templator/genListViewBlock.js +7 -5
  194. package/out/templator/genListViewBlock.js.map +1 -1
  195. package/out/templator/genQueryComponent.js +25 -26
  196. package/out/templator/genQueryComponent.js.map +1 -1
  197. package/out/templator/genSelectBlock.js +8 -7
  198. package/out/templator/genSelectBlock.js.map +1 -1
  199. package/out/templator/genTableBlock.js +31 -21
  200. package/out/templator/genTableBlock.js.map +1 -1
  201. package/out/templator/genUpdateBlock.js +34 -24
  202. package/out/templator/genUpdateBlock.js.map +1 -1
  203. package/out/templator/utils.d.ts +2 -2
  204. package/out/templator/utils.js.map +1 -1
  205. package/out/test/integration/connect-file.js +6 -6
  206. package/out/test/integration/connect-file.js.map +1 -1
  207. package/out/translator/index.js +1 -1
  208. package/out/translator/index.js.map +1 -1
  209. package/out/utils/index.d.ts +5 -0
  210. package/out/utils/index.js +50 -1
  211. package/out/utils/index.js.map +1 -1
  212. package/package.json +1 -1
  213. package/src/automate/engine/index.js +33 -8
  214. package/src/automate/engine/operators.js +114 -17
  215. package/src/automate/engine/uniqueName.js +77 -9
  216. package/src/automate/engine/utils.js +95 -68
  217. package/src/automate/template/process.js +10999 -0
  218. package/src/bak/translator.js +1 -0
  219. package/src/common/BaseNode.ts +21 -4
  220. package/src/concepts/App__.ts +128 -94
  221. package/src/concepts/BindAttribute__.ts +2 -2
  222. package/src/concepts/BindDirective__.ts +9 -7
  223. package/src/concepts/BindEvent__.ts +14 -6
  224. package/src/concepts/BooleanLiteral__.ts +12 -0
  225. package/src/concepts/CallFunction__.ts +6 -2
  226. package/src/concepts/CallLogic__.ts +47 -32
  227. package/src/concepts/CallQueryComponent__.ts +92 -81
  228. package/src/concepts/Comment__.ts +1 -1
  229. package/src/concepts/ConfigGroup__.ts +3 -1
  230. package/src/concepts/ConfigProperty__.ts +4 -0
  231. package/src/concepts/Configuration__.ts +3 -0
  232. package/src/concepts/DataSource__.ts +391 -0
  233. package/src/concepts/Destination__.ts +24 -8
  234. package/src/concepts/End__.ts +2 -2
  235. package/src/concepts/EntityIndex__.ts +7 -0
  236. package/src/concepts/EntityProperty__.ts +20 -2
  237. package/src/concepts/Entity__.ts +23 -11
  238. package/src/concepts/Enum__.ts +25 -6
  239. package/src/concepts/ForEachStatement__.ts +2 -2
  240. package/src/concepts/Function__.ts +95 -1
  241. package/src/concepts/Identifier__.ts +15 -15
  242. package/src/concepts/IfStatement__.ts +9 -9
  243. package/src/concepts/Interface__.ts +20 -12
  244. package/src/concepts/JSBlock__.ts +3 -12
  245. package/src/concepts/Logic__.ts +45 -79
  246. package/src/concepts/Module__.ts +141 -342
  247. package/src/concepts/Namespace__.ts +1 -204
  248. package/src/concepts/Param__.ts +3 -2
  249. package/src/concepts/ProcessElement__.ts +33 -12
  250. package/src/concepts/Process__.ts +18 -12
  251. package/src/concepts/QueryFieldExpression__.ts +9 -1
  252. package/src/concepts/QueryFromExpression__.ts +13 -2
  253. package/src/concepts/QueryJoinExpression__.ts +14 -3
  254. package/src/concepts/Return__.ts +1 -1
  255. package/src/concepts/Role__.ts +10 -4
  256. package/src/concepts/SqlQueryComponent__.ts +47 -11
  257. package/src/concepts/StringLiteral__.ts +1 -1
  258. package/src/concepts/StructureProperty__.ts +6 -9
  259. package/src/concepts/Structure__.ts +19 -11
  260. package/src/concepts/SwitchCase__.ts +23 -27
  261. package/src/concepts/SwitchStatement__.ts +1 -5
  262. package/src/concepts/TypeAnnotation__.ts +43 -2
  263. package/src/concepts/Variable__.ts +1 -1
  264. package/src/concepts/ViewElement__.ts +26 -39
  265. package/src/concepts/View__.ts +29 -34
  266. package/src/concepts/WhileStatement__.ts +4 -4
  267. package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
  268. package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
  269. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
  270. package/src/concepts/basics/stdlib/nasl.util.ts +281 -2
  271. package/src/concepts/basics/types/index.ts +1 -0
  272. package/src/concepts/index__.ts +1 -0
  273. package/src/generator/genBundleFiles.ts +28 -7
  274. package/src/generator/genMetaData.ts +22 -13
  275. package/src/index.ts +1 -1
  276. package/src/server/createUiTs.ts +1 -0
  277. package/src/server/getLogics.ts +29 -4
  278. package/src/server/getMemberIdentifier.ts +4 -0
  279. package/src/server/getProcesses.ts +68 -0
  280. package/src/server/naslServer.ts +227 -30
  281. package/src/server/process2LogicNamespace.ts +29 -19
  282. package/src/server/translator.ts +39 -1
  283. package/src/service/creator/errHandles.js +6 -0
  284. package/src/service/storage/init.ts +97 -86
  285. package/src/templator/genCreateBlock.ts +35 -26
  286. package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -21
  287. package/src/templator/genCurdMultipleKeyBlock.ts +46 -31
  288. package/src/templator/genEditTableBlock.ts +17 -14
  289. package/src/templator/genEnumSelectBlock.ts +1 -1
  290. package/src/templator/genGridViewBlock.ts +30 -25
  291. package/src/templator/genListViewBlock.ts +10 -7
  292. package/src/templator/genQueryComponent.ts +28 -27
  293. package/src/templator/genSelectBlock.ts +9 -8
  294. package/src/templator/genTableBlock.ts +32 -23
  295. package/src/templator/genUpdateBlock.ts +35 -25
  296. package/src/templator/utils.ts +2 -2
  297. package/src/test/integration/connect-file.ts +6 -6
  298. package/src/translator/index.ts +1 -1
  299. package/src/utils/index.ts +51 -0
@@ -16,7 +16,6 @@ import * as utils from '../utils';
16
16
  import { v4 as uuidv4 } from 'uuid';
17
17
  import BaseNode from '../common/BaseNode';
18
18
  import classMap from '../common/classMap';
19
- import Entity from './Entity__';
20
19
  import Structure from './Structure__';
21
20
  import Enum from './Enum__';
22
21
  import Logic from './Logic__';
@@ -71,13 +70,7 @@ export class Module extends BaseNode {
71
70
  * 外部语言依赖
72
71
  */
73
72
  @property()
74
- externalDependencyMap: { maven?: Array<{ groupId: string, artifactId: string, version: string }> } = undefined;
75
-
76
- /**
77
- * 实体列表
78
- */
79
- @property('Entity')
80
- entities: Array<Entity> = [];
73
+ externalDependencyMap: { maven?: Array<{ groupId: string; artifactId: string; version: string }> } = undefined;
81
74
 
82
75
  /**
83
76
  * 数据结构列表
@@ -152,149 +145,6 @@ export class Module extends BaseNode {
152
145
  }
153
146
  return params;
154
147
  }
155
-
156
-
157
- getEntityExistingNames(excludedList: Array<Entity> = []) {
158
- const excludedSet = new Set(excludedList);
159
- return (this.entities || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
160
- }
161
- getEntityUniqueName(name = 'Entity1') {
162
- return utils.unique(name, this.getEntityExistingNames(), undefined, false);
163
- }
164
-
165
- /**
166
- * 插入实体
167
- * @internal
168
- * @param name 实体名称,如果不填会自动生成一个唯一名称
169
- */
170
- _insertEntityAt(name: string, index: number): Entity;
171
-
172
- /**
173
- * 插入实体
174
- * @internal
175
- * @param entityOptions 实体参数
176
- */
177
- _insertEntityAt(entityOptions: Partial<Entity>, index: number): Entity;
178
-
179
- /**
180
- * 插入实体
181
- * @internal
182
- * @param entity 已有的实体实例
183
- */
184
- _insertEntityAt(entity: Entity, index: number): Entity;
185
-
186
- _insertEntityAt(options: string | Partial<Entity> | Entity, index: number) {
187
- const entityOptions: any = {};
188
- const relationOptions = { parentNode: this, parentKey: 'entities' };
189
- let entity: Entity;
190
- if (!options) {
191
- entity = Entity.from({
192
- ...entityOptions,
193
- name: this.getEntityUniqueName(),
194
- }, this, 'entities');
195
- } else if (typeof options === 'string') {
196
- entity = Entity.from({
197
- ...entityOptions,
198
- name: options,
199
- }, this, 'entities');
200
- } else if (options instanceof Entity) {
201
- options.ensureDelete(); // 同一实例不支持多处存在
202
- entity = options;
203
- Object.assign(entity, relationOptions);
204
- } else {
205
- entity = Entity.from({
206
- ...entityOptions,
207
- ...options,
208
- }, this, 'entities');
209
- }
210
- this.entities.splice(index, 0, entity);
211
- return entity;
212
- }
213
-
214
- /**
215
- * 插入实体
216
- * @param name 实体名称,如果不填会自动生成一个唯一名称
217
- */
218
- insertEntityAt(name: string, index: number): Entity;
219
-
220
- /**
221
- * 插入实体
222
- * @param entityOptions 实体参数
223
- */
224
- insertEntityAt(entityOptions: Partial<Entity>, index: number): Entity;
225
-
226
- /**
227
- * 插入实体
228
- * @param entity 已有的实体实例
229
- */
230
- insertEntityAt(entity: Entity, index: number): Entity;
231
-
232
- insertEntityAt(options: string | Partial<Entity> | Entity, index: number) {
233
- const node = this._insertEntityAt(options as any, index);
234
- node.create({
235
- index,
236
- parentNode: this,
237
- parentKey: 'entities',
238
- });
239
- return node;
240
- }
241
-
242
- /**
243
- * 添加实体
244
- * @internal
245
- * @param name 实体名称,如果不填会自动生成一个唯一名称
246
- */
247
- _addEntity(name?: string): Entity;
248
-
249
- /**
250
- * 添加实体
251
- * @internal
252
- * @param entityOptions 实体参数
253
- */
254
- _addEntity(entityOptions: Partial<Entity>): Entity;
255
-
256
- /**
257
- * 添加实体
258
- * @internal
259
- * @param entity 已有的实体实例
260
- */
261
- _addEntity(entity: Entity): Entity;
262
-
263
- _addEntity(options?: string | Partial<Entity> | Entity) {
264
- const index = 0;
265
- return this._insertEntityAt(options as any, index);
266
- }
267
-
268
- /**
269
- * 添加实体
270
- * @internal
271
- * @param name 实体名称,如果不填会自动生成一个唯一名称
272
- */
273
- addEntity(name?: string): Entity;
274
-
275
- /**
276
- * 添加实体
277
- * @param entityOptions 实体参数
278
- */
279
- addEntity(entityOptions: Partial<Entity>): Entity;
280
-
281
- /**
282
- * 添加实体
283
- * @param entity 已有的实体实例
284
- */
285
- addEntity(entity: Entity): Entity;
286
-
287
- addEntity(options?: string | Partial<Entity> | Entity) {
288
- const node = this._addEntity(options as any);
289
- const index = this.entities.indexOf(node);
290
- node.create({
291
- index,
292
- parentNode: this,
293
- parentKey: 'entities',
294
- });
295
- return node;
296
- }
297
-
298
148
 
299
149
  getStructureExistingNames(excludedList: Array<Structure> = []) {
300
150
  const excludedSet = new Set(excludedList);
@@ -305,24 +155,24 @@ export class Module extends BaseNode {
305
155
  }
306
156
 
307
157
  /**
308
- * 插入数据结构
309
- * @internal
310
- * @param name 数据结构名称,如果不填会自动生成一个唯一名称
311
- */
158
+ * 插入数据结构
159
+ * @internal
160
+ * @param name 数据结构名称,如果不填会自动生成一个唯一名称
161
+ */
312
162
  _insertStructureAt(name: string, index: number): Structure;
313
163
 
314
164
  /**
315
- * 插入数据结构
316
- * @internal
317
- * @param structureOptions 数据结构参数
318
- */
165
+ * 插入数据结构
166
+ * @internal
167
+ * @param structureOptions 数据结构参数
168
+ */
319
169
  _insertStructureAt(structureOptions: Partial<Structure>, index: number): Structure;
320
170
 
321
171
  /**
322
- * 插入数据结构
323
- * @internal
324
- * @param structure 已有的数据结构实例
325
- */
172
+ * 插入数据结构
173
+ * @internal
174
+ * @param structure 已有的数据结构实例
175
+ */
326
176
  _insertStructureAt(structure: Structure, index: number): Structure;
327
177
 
328
178
  _insertStructureAt(options: string | Partial<Structure> | Structure, index: number) {
@@ -437,7 +287,6 @@ export class Module extends BaseNode {
437
287
  return node;
438
288
  }
439
289
 
440
-
441
290
  getEnumExistingNames(excludedList: Array<Enum> = []) {
442
291
  const excludedSet = new Set(excludedList);
443
292
  return (this.enums || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -447,24 +296,24 @@ export class Module extends BaseNode {
447
296
  }
448
297
 
449
298
  /**
450
- * 插入枚举
451
- * @internal
452
- * @param name 枚举名称,如果不填会自动生成一个唯一名称
453
- */
299
+ * 插入枚举
300
+ * @internal
301
+ * @param name 枚举名称,如果不填会自动生成一个唯一名称
302
+ */
454
303
  _insertEnumAt(name: string, index: number): Enum;
455
304
 
456
305
  /**
457
- * 插入枚举
458
- * @internal
459
- * @param enumerationOptions 枚举参数
460
- */
306
+ * 插入枚举
307
+ * @internal
308
+ * @param enumerationOptions 枚举参数
309
+ */
461
310
  _insertEnumAt(enumerationOptions: Partial<Enum>, index: number): Enum;
462
311
 
463
312
  /**
464
- * 插入枚举
465
- * @internal
466
- * @param enumeration 已有的枚举实例
467
- */
313
+ * 插入枚举
314
+ * @internal
315
+ * @param enumeration 已有的枚举实例
316
+ */
468
317
  _insertEnumAt(enumeration: Enum, index: number): Enum;
469
318
 
470
319
  _insertEnumAt(options: string | Partial<Enum> | Enum, index: number) {
@@ -579,7 +428,6 @@ export class Module extends BaseNode {
579
428
  return node;
580
429
  }
581
430
 
582
-
583
431
  getLogicExistingNames(excludedList: Array<Logic> = []) {
584
432
  const excludedSet = new Set(excludedList);
585
433
  return (this.logics || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -589,24 +437,24 @@ export class Module extends BaseNode {
589
437
  }
590
438
 
591
439
  /**
592
- * 插入逻辑
593
- * @internal
594
- * @param name 逻辑名称,如果不填会自动生成一个唯一名称
595
- */
440
+ * 插入逻辑
441
+ * @internal
442
+ * @param name 逻辑名称,如果不填会自动生成一个唯一名称
443
+ */
596
444
  _insertLogicAt(name: string, index: number): Logic;
597
445
 
598
446
  /**
599
- * 插入逻辑
600
- * @internal
601
- * @param logicOptions 逻辑参数
602
- */
447
+ * 插入逻辑
448
+ * @internal
449
+ * @param logicOptions 逻辑参数
450
+ */
603
451
  _insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
604
452
 
605
453
  /**
606
- * 插入逻辑
607
- * @internal
608
- * @param logic 已有的逻辑实例
609
- */
454
+ * 插入逻辑
455
+ * @internal
456
+ * @param logic 已有的逻辑实例
457
+ */
610
458
  _insertLogicAt(logic: Logic, index: number): Logic;
611
459
 
612
460
  _insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
@@ -721,7 +569,6 @@ export class Module extends BaseNode {
721
569
  return node;
722
570
  }
723
571
 
724
-
725
572
  getInterfaceExistingNames(excludedList: Array<Interface> = []) {
726
573
  const excludedSet = new Set(excludedList);
727
574
  return (this.interfaces || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -731,24 +578,24 @@ export class Module extends BaseNode {
731
578
  }
732
579
 
733
580
  /**
734
- * 插入接口
735
- * @internal
736
- * @param name 接口名称,如果不填会自动生成一个唯一名称
737
- */
581
+ * 插入接口
582
+ * @internal
583
+ * @param name 接口名称,如果不填会自动生成一个唯一名称
584
+ */
738
585
  _insertInterfaceAt(name: string, index: number): Interface;
739
586
 
740
587
  /**
741
- * 插入接口
742
- * @internal
743
- * @param itfaceOptions 接口参数
744
- */
588
+ * 插入接口
589
+ * @internal
590
+ * @param itfaceOptions 接口参数
591
+ */
745
592
  _insertInterfaceAt(itfaceOptions: Partial<Interface>, index: number): Interface;
746
593
 
747
594
  /**
748
- * 插入接口
749
- * @internal
750
- * @param itface 已有的接口实例
751
- */
595
+ * 插入接口
596
+ * @internal
597
+ * @param itface 已有的接口实例
598
+ */
752
599
  _insertInterfaceAt(itface: Interface, index: number): Interface;
753
600
 
754
601
  _insertInterfaceAt(options: string | Partial<Interface> | Interface, index: number) {
@@ -863,7 +710,6 @@ export class Module extends BaseNode {
863
710
  return node;
864
711
  }
865
712
 
866
-
867
713
  getViewExistingNames(excludedList: Array<View> = []) {
868
714
  const excludedSet = new Set(excludedList);
869
715
  return (this.views || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -873,24 +719,24 @@ export class Module extends BaseNode {
873
719
  }
874
720
 
875
721
  /**
876
- * 插入页面
877
- * @internal
878
- * @param name 页面名称,如果不填会自动生成一个唯一名称
879
- */
722
+ * 插入页面
723
+ * @internal
724
+ * @param name 页面名称,如果不填会自动生成一个唯一名称
725
+ */
880
726
  _insertViewAt(name: string, index: number): View;
881
727
 
882
728
  /**
883
- * 插入页面
884
- * @internal
885
- * @param viewOptions 页面参数
886
- */
729
+ * 插入页面
730
+ * @internal
731
+ * @param viewOptions 页面参数
732
+ */
887
733
  _insertViewAt(viewOptions: Partial<View>, index: number): View;
888
734
 
889
735
  /**
890
- * 插入页面
891
- * @internal
892
- * @param view 已有的页面实例
893
- */
736
+ * 插入页面
737
+ * @internal
738
+ * @param view 已有的页面实例
739
+ */
894
740
  _insertViewAt(view: View, index: number): View;
895
741
 
896
742
  _insertViewAt(options: string | Partial<View> | View, index: number) {
@@ -1005,7 +851,6 @@ export class Module extends BaseNode {
1005
851
  return node;
1006
852
  }
1007
853
 
1008
-
1009
854
  getProcessExistingNames(excludedList: Array<Process> = []) {
1010
855
  const excludedSet = new Set(excludedList);
1011
856
  return (this.processes || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -1015,24 +860,24 @@ export class Module extends BaseNode {
1015
860
  }
1016
861
 
1017
862
  /**
1018
- * 插入流程
1019
- * @internal
1020
- * @param name 流程名称,如果不填会自动生成一个唯一名称
1021
- */
863
+ * 插入流程
864
+ * @internal
865
+ * @param name 流程名称,如果不填会自动生成一个唯一名称
866
+ */
1022
867
  _insertProcessAt(name: string, index: number): Process;
1023
868
 
1024
869
  /**
1025
- * 插入流程
1026
- * @internal
1027
- * @param processOptions 流程参数
1028
- */
870
+ * 插入流程
871
+ * @internal
872
+ * @param processOptions 流程参数
873
+ */
1029
874
  _insertProcessAt(processOptions: Partial<Process>, index: number): Process;
1030
875
 
1031
876
  /**
1032
- * 插入流程
1033
- * @internal
1034
- * @param process 已有的流程实例
1035
- */
877
+ * 插入流程
878
+ * @internal
879
+ * @param process 已有的流程实例
880
+ */
1036
881
  _insertProcessAt(process: Process, index: number): Process;
1037
882
 
1038
883
  _insertProcessAt(options: string | Partial<Process> | Process, index: number) {
@@ -1147,7 +992,6 @@ export class Module extends BaseNode {
1147
992
  return node;
1148
993
  }
1149
994
 
1150
-
1151
995
  getViewComponentExistingNames(excludedList: Array<ViewComponent> = []) {
1152
996
  const excludedSet = new Set(excludedList);
1153
997
  return (this.viewComponents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
@@ -1157,24 +1001,24 @@ export class Module extends BaseNode {
1157
1001
  }
1158
1002
 
1159
1003
  /**
1160
- * 插入页面组件
1161
- * @internal
1162
- * @param name 页面组件名称,如果不填会自动生成一个唯一名称
1163
- */
1004
+ * 插入页面组件
1005
+ * @internal
1006
+ * @param name 页面组件名称,如果不填会自动生成一个唯一名称
1007
+ */
1164
1008
  _insertViewComponentAt(name: string, index: number): ViewComponent;
1165
1009
 
1166
1010
  /**
1167
- * 插入页面组件
1168
- * @internal
1169
- * @param viewComponentOptions 页面组件参数
1170
- */
1011
+ * 插入页面组件
1012
+ * @internal
1013
+ * @param viewComponentOptions 页面组件参数
1014
+ */
1171
1015
  _insertViewComponentAt(viewComponentOptions: Partial<ViewComponent>, index: number): ViewComponent;
1172
1016
 
1173
1017
  /**
1174
- * 插入页面组件
1175
- * @internal
1176
- * @param viewComponent 已有的页面组件实例
1177
- */
1018
+ * 插入页面组件
1019
+ * @internal
1020
+ * @param viewComponent 已有的页面组件实例
1021
+ */
1178
1022
  _insertViewComponentAt(viewComponent: ViewComponent, index: number): ViewComponent;
1179
1023
 
1180
1024
  _insertViewComponentAt(options: string | Partial<ViewComponent> | ViewComponent, index: number) {
@@ -1289,63 +1133,10 @@ export class Module extends BaseNode {
1289
1133
  return node;
1290
1134
  }
1291
1135
 
1292
-
1293
-
1294
-
1295
- /**
1296
- * 删除实体
1297
- * @param name 实体名称
1298
- */
1299
- removeEntity(name: string): void;
1300
-
1301
1136
  /**
1302
- * 删除实体
1303
- * @param entity 已有的实体实例
1137
+ * 删除数据结构
1138
+ * @param name 数据结构名称
1304
1139
  */
1305
- removeEntity(entity: Entity): void;
1306
-
1307
- removeEntity(options: string | Entity) {
1308
- let entity: Entity;
1309
- if (typeof options === 'string') {
1310
- entity = this.entities.find((item) => item.name === options);
1311
- if (!entity) {
1312
- throw new Error('找不到实体 ' + options);
1313
- }
1314
- } else {
1315
- entity = options;
1316
- }
1317
- return entity.delete();
1318
- }
1319
-
1320
- __removeEntity(entity: Entity) {
1321
- const parentKey = entity.parentKey;
1322
- const params: Params = {
1323
- parentNode: this,
1324
- parentKey,
1325
- index: -1,
1326
- object: null,
1327
- oldObject: entity,
1328
- };
1329
- if (parentKey) {
1330
- params.parentKey = parentKey;
1331
- if (Array.isArray((this as any)[parentKey])) {
1332
- const index = (this as any)[parentKey].indexOf(entity);
1333
- ~index && (this as any)[parentKey].splice(index, 1);
1334
- params.index = index;
1335
- } else if ((this as any)[parentKey] === entity) {
1336
- params.index = 0;
1337
- (this as any)[parentKey] = undefined;
1338
- }
1339
- }
1340
- return params;
1341
- }
1342
-
1343
-
1344
-
1345
- /**
1346
- * 删除数据结构
1347
- * @param name 数据结构名称
1348
- */
1349
1140
  removeStructure(name: string): void;
1350
1141
 
1351
1142
  /**
@@ -1390,12 +1181,10 @@ export class Module extends BaseNode {
1390
1181
  return params;
1391
1182
  }
1392
1183
 
1393
-
1394
-
1395
1184
  /**
1396
- * 删除枚举
1397
- * @param name 枚举名称
1398
- */
1185
+ * 删除枚举
1186
+ * @param name 枚举名称
1187
+ */
1399
1188
  removeEnum(name: string): void;
1400
1189
 
1401
1190
  /**
@@ -1440,12 +1229,10 @@ export class Module extends BaseNode {
1440
1229
  return params;
1441
1230
  }
1442
1231
 
1443
-
1444
-
1445
1232
  /**
1446
- * 删除逻辑
1447
- * @param name 逻辑名称
1448
- */
1233
+ * 删除逻辑
1234
+ * @param name 逻辑名称
1235
+ */
1449
1236
  removeLogic(name: string): void;
1450
1237
 
1451
1238
  /**
@@ -1490,12 +1277,10 @@ export class Module extends BaseNode {
1490
1277
  return params;
1491
1278
  }
1492
1279
 
1493
-
1494
-
1495
1280
  /**
1496
- * 删除接口
1497
- * @param name 接口名称
1498
- */
1281
+ * 删除接口
1282
+ * @param name 接口名称
1283
+ */
1499
1284
  removeInterface(name: string): void;
1500
1285
 
1501
1286
  /**
@@ -1540,12 +1325,10 @@ export class Module extends BaseNode {
1540
1325
  return params;
1541
1326
  }
1542
1327
 
1543
-
1544
-
1545
1328
  /**
1546
- * 删除页面
1547
- * @param name 页面名称
1548
- */
1329
+ * 删除页面
1330
+ * @param name 页面名称
1331
+ */
1549
1332
  removeView(name: string): void;
1550
1333
 
1551
1334
  /**
@@ -1590,12 +1373,10 @@ export class Module extends BaseNode {
1590
1373
  return params;
1591
1374
  }
1592
1375
 
1593
-
1594
-
1595
1376
  /**
1596
- * 删除流程
1597
- * @param name 流程名称
1598
- */
1377
+ * 删除流程
1378
+ * @param name 流程名称
1379
+ */
1599
1380
  removeProcess(name: string): void;
1600
1381
 
1601
1382
  /**
@@ -1640,12 +1421,10 @@ export class Module extends BaseNode {
1640
1421
  return params;
1641
1422
  }
1642
1423
 
1643
-
1644
-
1645
1424
  /**
1646
- * 删除页面组件
1647
- * @param name 页面组件名称
1648
- */
1425
+ * 删除页面组件
1426
+ * @param name 页面组件名称
1427
+ */
1649
1428
  removeViewComponent(name: string): void;
1650
1429
 
1651
1430
  /**
@@ -1694,33 +1473,53 @@ export class Module extends BaseNode {
1694
1473
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1695
1474
  // 自动生成的代码已结束。下面可以手动编写。
1696
1475
  //================================================================================
1697
-
1698
1476
  /**
1477
+ * 用于区分存量应用新导入模块,存量应用替换数据结构使用
1478
+ */
1479
+ @property()
1480
+ isAdd: boolean;
1481
+
1482
+ setIsAdd(isAdd: boolean) {
1483
+ const object = {
1484
+ isAdd,
1485
+ };
1486
+ this.update({
1487
+ ...object,
1488
+ });
1489
+ }
1490
+ /**
1699
1491
  * 生成宿主语言的文件路径
1700
1492
  * @param name 一般不用传,用于 rename
1701
1493
  */
1702
- getEmbeddedFilePath(name = this.name) {
1703
- return `/embedded/${this.app.name}/${this.parentKey}/${this.name}`;
1704
- }
1705
- /**
1494
+ getEmbeddedFilePath(name = this.name) {
1495
+ return `/embedded/${this.app.name}/${this.parentKey}/${this.name}`;
1496
+ }
1497
+ /**
1706
1498
  * 获取命名空间和
1707
1499
  * 暂时不考虑 Module 嵌套的情况
1708
1500
  */
1709
- getNamespace() {
1710
- return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.name}`;
1711
- }
1501
+ getNamespace() {
1502
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
1503
+ }
1712
1504
 
1713
- getTsNamespace() {
1714
- return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.tsName}`;
1715
- }
1505
+ getTsNamespace() {
1506
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
1507
+ }
1508
+ getTsNamespaceAndName() {
1509
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.name}`;
1510
+ }
1716
1511
 
1717
- /**
1512
+ findEnumByName(name: string) {
1513
+ return this.enums.find((enumItem) => enumItem.name === name);
1514
+ }
1515
+
1516
+ /**
1718
1517
  * 获取属性节点是否存在
1719
1518
  */
1720
1519
 
1721
- findProperty(name: string, propertyType: PropertyType): any {
1722
- return (this[propertyType] as Array<any>).find((item) => item.name === name);
1723
- }
1520
+ findProperty(name: string, propertyType: PropertyType): any {
1521
+ return ((this as any)[propertyType] as Array<any>).find((item) => item.name === name);
1522
+ }
1724
1523
 
1725
1524
  //================================================================================
1726
1525
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -1728,7 +1527,7 @@ export class Module extends BaseNode {
1728
1527
  //================================================================================
1729
1528
  }
1730
1529
 
1731
- classMap['Module'] = Module;
1530
+ classMap.Module = Module;
1732
1531
  export default Module;
1733
1532
  //================================================================================
1734
1533
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑