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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/out/automate/engine/index.d.ts +1 -1
  2. package/out/automate/engine/index.js +73 -25
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/utils.js +7 -6
  5. package/out/automate/engine/utils.js.map +1 -1
  6. package/out/common/BaseNode.d.ts +5 -4
  7. package/out/common/BaseNode.js +48 -41
  8. package/out/common/BaseNode.js.map +1 -1
  9. package/out/concepts/App__.d.ts +18 -1
  10. package/out/concepts/App__.js +64 -24
  11. package/out/concepts/App__.js.map +1 -1
  12. package/out/concepts/Argument__.js +2 -2
  13. package/out/concepts/Argument__.js.map +1 -1
  14. package/out/concepts/Assignee__.d.ts +190 -0
  15. package/out/concepts/Assignee__.js +264 -0
  16. package/out/concepts/Assignee__.js.map +1 -0
  17. package/out/concepts/BinaryExpression__.js +6 -6
  18. package/out/concepts/BinaryExpression__.js.map +1 -1
  19. package/out/concepts/BindAttribute__.d.ts +19 -0
  20. package/out/concepts/BindAttribute__.js +36 -2
  21. package/out/concepts/BindAttribute__.js.map +1 -1
  22. package/out/concepts/BindDirective__.js +21 -1
  23. package/out/concepts/BindDirective__.js.map +1 -1
  24. package/out/concepts/BindEvent__.d.ts +1 -0
  25. package/out/concepts/BindEvent__.js +38 -14
  26. package/out/concepts/BindEvent__.js.map +1 -1
  27. package/out/concepts/CallFunction__.js +20 -7
  28. package/out/concepts/CallFunction__.js.map +1 -1
  29. package/out/concepts/CallInterface__.d.ts +11 -8
  30. package/out/concepts/CallInterface__.js +160 -23
  31. package/out/concepts/CallInterface__.js.map +1 -1
  32. package/out/concepts/CallLogic__.d.ts +1 -0
  33. package/out/concepts/CallLogic__.js +17 -7
  34. package/out/concepts/CallLogic__.js.map +1 -1
  35. package/out/concepts/CallQueryComponent__.d.ts +5 -1
  36. package/out/concepts/CallQueryComponent__.js +15 -11
  37. package/out/concepts/CallQueryComponent__.js.map +1 -1
  38. package/out/concepts/Comment__.js +6 -2
  39. package/out/concepts/Comment__.js.map +1 -1
  40. package/out/concepts/ConfigGroup__.js +1 -1
  41. package/out/concepts/ConfigGroup__.js.map +1 -1
  42. package/out/concepts/ConfigProperty__.js +1 -1
  43. package/out/concepts/ConfigProperty__.js.map +1 -1
  44. package/out/concepts/Configuration__.js +1 -1
  45. package/out/concepts/Configuration__.js.map +1 -1
  46. package/out/concepts/Destination__.d.ts +11 -0
  47. package/out/concepts/Destination__.js +59 -19
  48. package/out/concepts/Destination__.js.map +1 -1
  49. package/out/concepts/End__.js +10 -2
  50. package/out/concepts/End__.js.map +1 -1
  51. package/out/concepts/EntityProperty__.d.ts +7 -0
  52. package/out/concepts/EntityProperty__.js +60 -3
  53. package/out/concepts/EntityProperty__.js.map +1 -1
  54. package/out/concepts/Entity__.d.ts +4 -1
  55. package/out/concepts/Entity__.js +29 -12
  56. package/out/concepts/Entity__.js.map +1 -1
  57. package/out/concepts/Enum__.d.ts +4 -0
  58. package/out/concepts/Enum__.js +9 -6
  59. package/out/concepts/Enum__.js.map +1 -1
  60. package/out/concepts/Event__.js +1 -1
  61. package/out/concepts/Event__.js.map +1 -1
  62. package/out/concepts/ForEachStatement__.js +8 -12
  63. package/out/concepts/ForEachStatement__.js.map +1 -1
  64. package/out/concepts/Function__.js +5 -5
  65. package/out/concepts/Function__.js.map +1 -1
  66. package/out/concepts/Identifier__.js +26 -24
  67. package/out/concepts/Identifier__.js.map +1 -1
  68. package/out/concepts/IfStatement__.js +2 -2
  69. package/out/concepts/IfStatement__.js.map +1 -1
  70. package/out/concepts/InterfaceParam__.d.ts +2 -0
  71. package/out/concepts/InterfaceParam__.js +41 -21
  72. package/out/concepts/InterfaceParam__.js.map +1 -1
  73. package/out/concepts/Interface__.d.ts +3 -0
  74. package/out/concepts/Interface__.js +105 -9
  75. package/out/concepts/Interface__.js.map +1 -1
  76. package/out/concepts/LogicItem__.d.ts +2 -1
  77. package/out/concepts/LogicItem__.js +14 -0
  78. package/out/concepts/LogicItem__.js.map +1 -1
  79. package/out/concepts/Logic__.d.ts +3 -0
  80. package/out/concepts/Logic__.js +57 -16
  81. package/out/concepts/Logic__.js.map +1 -1
  82. package/out/concepts/MemberExpression__.js +13 -6
  83. package/out/concepts/MemberExpression__.js.map +1 -1
  84. package/out/concepts/Module__.d.ts +6 -0
  85. package/out/concepts/Module__.js +18 -8
  86. package/out/concepts/Module__.js.map +1 -1
  87. package/out/concepts/Namespace__.d.ts +4 -0
  88. package/out/concepts/Namespace__.js +23 -12
  89. package/out/concepts/Namespace__.js.map +1 -1
  90. package/out/concepts/Param__.d.ts +2 -1
  91. package/out/concepts/Param__.js +35 -22
  92. package/out/concepts/Param__.js.map +1 -1
  93. package/out/concepts/ProcessComponent__.js +2 -2
  94. package/out/concepts/ProcessComponent__.js.map +1 -1
  95. package/out/concepts/ProcessElement__.js +20 -18
  96. package/out/concepts/ProcessElement__.js.map +1 -1
  97. package/out/concepts/ProcessOutcome__.js +1 -1
  98. package/out/concepts/ProcessOutcome__.js.map +1 -1
  99. package/out/concepts/Process__.d.ts +6 -1
  100. package/out/concepts/Process__.js +18 -14
  101. package/out/concepts/Process__.js.map +1 -1
  102. package/out/concepts/QueryAggregateExpression__.js +1 -1
  103. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  104. package/out/concepts/QueryFromExpression__.js +1 -1
  105. package/out/concepts/QueryFromExpression__.js.map +1 -1
  106. package/out/concepts/QueryJoinExpression__.js +2 -2
  107. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  108. package/out/concepts/QuerySelectExpression__.js +1 -1
  109. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  110. package/out/concepts/Return__.d.ts +1 -0
  111. package/out/concepts/Return__.js +38 -25
  112. package/out/concepts/Return__.js.map +1 -1
  113. package/out/concepts/SqlQueryComponent__.js +1 -1
  114. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  115. package/out/concepts/StringLiteral__.d.ts +1 -1
  116. package/out/concepts/StringLiteral__.js +2 -2
  117. package/out/concepts/StringLiteral__.js.map +1 -1
  118. package/out/concepts/StructureProperty__.d.ts +5 -4
  119. package/out/concepts/StructureProperty__.js +54 -31
  120. package/out/concepts/StructureProperty__.js.map +1 -1
  121. package/out/concepts/Structure__.d.ts +1 -0
  122. package/out/concepts/Structure__.js +18 -5
  123. package/out/concepts/Structure__.js.map +1 -1
  124. package/out/concepts/SwitchCase__.js +3 -3
  125. package/out/concepts/SwitchCase__.js.map +1 -1
  126. package/out/concepts/SwitchStatement__.js +1 -1
  127. package/out/concepts/SwitchStatement__.js.map +1 -1
  128. package/out/concepts/TypeAnnotation__.d.ts +3 -5
  129. package/out/concepts/TypeAnnotation__.js +36 -14
  130. package/out/concepts/TypeAnnotation__.js.map +1 -1
  131. package/out/concepts/UnaryExpression__.js +4 -2
  132. package/out/concepts/UnaryExpression__.js.map +1 -1
  133. package/out/concepts/ValidationRule__.d.ts +1 -0
  134. package/out/concepts/ValidationRule__.js +27 -1
  135. package/out/concepts/ValidationRule__.js.map +1 -1
  136. package/out/concepts/Variable__.d.ts +1 -0
  137. package/out/concepts/Variable__.js +38 -25
  138. package/out/concepts/Variable__.js.map +1 -1
  139. package/out/concepts/ViewComponent__.js +5 -5
  140. package/out/concepts/ViewComponent__.js.map +1 -1
  141. package/out/concepts/ViewElement__.d.ts +7 -1
  142. package/out/concepts/ViewElement__.js +154 -117
  143. package/out/concepts/ViewElement__.js.map +1 -1
  144. package/out/concepts/View__.d.ts +4 -0
  145. package/out/concepts/View__.js +38 -25
  146. package/out/concepts/View__.js.map +1 -1
  147. package/out/concepts/WhileStatement__.js +1 -1
  148. package/out/concepts/WhileStatement__.js.map +1 -1
  149. package/out/concepts/basics/stdlib/index.js +3 -1
  150. package/out/concepts/basics/stdlib/index.js.map +1 -1
  151. package/out/concepts/basics/stdlib/nasl.auth.d.ts +3 -0
  152. package/out/concepts/basics/stdlib/nasl.auth.js +30 -0
  153. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
  154. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +3 -0
  155. package/out/concepts/basics/stdlib/nasl.browser copy.js +70 -0
  156. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +1 -0
  157. package/out/concepts/basics/stdlib/nasl.browser.js +6 -35
  158. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  159. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
  160. package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
  161. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
  162. package/out/concepts/basics/stdlib/nasl.util.js +49 -41
  163. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  164. package/out/concepts/basics/stdlib/nasl.validation.js +26 -20
  165. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  166. package/out/concepts/basics/types/coreTypeList.js +11 -11
  167. package/out/concepts/basics/types/coreTypeList.js.map +1 -1
  168. package/out/concepts/index__.d.ts +1 -0
  169. package/out/concepts/index__.js +1 -0
  170. package/out/concepts/index__.js.map +1 -1
  171. package/out/enums/KEYWORDS.js +1 -1
  172. package/out/enums/KEYWORDS.js.map +1 -1
  173. package/out/generator/genBundleFiles.d.ts +1 -0
  174. package/out/generator/genBundleFiles.js +122 -93
  175. package/out/generator/genBundleFiles.js.map +1 -1
  176. package/out/manager/diagnostic.d.ts +1 -1
  177. package/out/server/createUiTs.d.ts +1 -0
  178. package/out/server/createUiTs.js +19 -2
  179. package/out/server/createUiTs.js.map +1 -1
  180. package/out/server/entity2LogicNamespace.js +24 -9
  181. package/out/server/entity2LogicNamespace.js.map +1 -1
  182. package/out/server/getExtensionModules.js +2 -0
  183. package/out/server/getExtensionModules.js.map +1 -1
  184. package/out/server/getLogics.js +40 -56
  185. package/out/server/getLogics.js.map +1 -1
  186. package/out/server/getMemberIdentifier.d.ts +4 -0
  187. package/out/server/getMemberIdentifier.js +90 -48
  188. package/out/server/getMemberIdentifier.js.map +1 -1
  189. package/out/server/getProcesses.d.ts +2 -2
  190. package/out/server/getProcesses.js +34 -11
  191. package/out/server/getProcesses.js.map +1 -1
  192. package/out/server/index.js +4 -0
  193. package/out/server/index.js.map +1 -1
  194. package/out/server/naslServer.d.ts +11 -30
  195. package/out/server/naslServer.js +410 -199
  196. package/out/server/naslServer.js.map +1 -1
  197. package/out/server/process2LogicNamespace.d.ts +10 -0
  198. package/out/server/process2LogicNamespace.js +16 -0
  199. package/out/server/process2LogicNamespace.js.map +1 -1
  200. package/out/server/translator.d.ts +22 -3
  201. package/out/server/translator.js +336 -130
  202. package/out/server/translator.js.map +1 -1
  203. package/out/service/storage/init.js +29 -15
  204. package/out/service/storage/init.js.map +1 -1
  205. package/out/templator/genCreateBlock.js +5 -5
  206. package/out/templator/genCreateBlock.js.map +1 -1
  207. package/out/templator/genCurdEditMultipleKeyBlock.js +9 -13
  208. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  209. package/out/templator/genCurdMultipleKeyBlock.js +7 -7
  210. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  211. package/out/templator/genEditTableBlock.js +2 -2
  212. package/out/templator/genEditTableBlock.js.map +1 -1
  213. package/out/templator/genGetBlock.js +4 -2
  214. package/out/templator/genGetBlock.js.map +1 -1
  215. package/out/templator/genGridViewBlock.d.ts +1 -1
  216. package/out/templator/genGridViewBlock.js +3 -3
  217. package/out/templator/genGridViewBlock.js.map +1 -1
  218. package/out/templator/genQueryComponent.d.ts +2 -0
  219. package/out/templator/genQueryComponent.js +1 -0
  220. package/out/templator/genQueryComponent.js.map +1 -1
  221. package/out/templator/genTableBlock.d.ts +1 -1
  222. package/out/templator/genTableBlock.js +3 -3
  223. package/out/templator/genTableBlock.js.map +1 -1
  224. package/out/templator/genUpdateBlock.js +7 -7
  225. package/out/templator/genUpdateBlock.js.map +1 -1
  226. package/out/templator/utils.d.ts +3 -1
  227. package/out/templator/utils.js +2 -1
  228. package/out/templator/utils.js.map +1 -1
  229. package/out/utils/index.d.ts +6 -0
  230. package/out/utils/index.js +20 -1
  231. package/out/utils/index.js.map +1 -1
  232. package/package.json +2 -1
  233. package/src/automate/engine/index.js +73 -25
  234. package/src/automate/engine/utils.js +7 -6
  235. package/src/common/BaseNode.ts +51 -42
  236. package/src/concepts/App__.ts +104 -26
  237. package/src/concepts/Argument__.ts +3 -2
  238. package/src/concepts/Assignee__.ts +437 -0
  239. package/src/concepts/BinaryExpression__.ts +7 -6
  240. package/src/concepts/BindAttribute__.ts +51 -2
  241. package/src/concepts/BindDirective__.ts +20 -1
  242. package/src/concepts/BindEvent__.ts +39 -16
  243. package/src/concepts/CallFunction__.ts +21 -8
  244. package/src/concepts/CallInterface__.ts +161 -42
  245. package/src/concepts/CallLogic__.ts +21 -9
  246. package/src/concepts/CallQueryComponent__.ts +15 -13
  247. package/src/concepts/Comment__.ts +6 -2
  248. package/src/concepts/ConfigGroup__.ts +1 -1
  249. package/src/concepts/ConfigProperty__.ts +1 -1
  250. package/src/concepts/Configuration__.ts +1 -1
  251. package/src/concepts/Destination__.ts +57 -19
  252. package/src/concepts/End__.ts +9 -11
  253. package/src/concepts/EntityProperty__.ts +56 -3
  254. package/src/concepts/Entity__.ts +33 -20
  255. package/src/concepts/Enum__.ts +8 -7
  256. package/src/concepts/Event__.ts +1 -1
  257. package/src/concepts/ForEachStatement__.ts +8 -13
  258. package/src/concepts/Function__.ts +5 -5
  259. package/src/concepts/Identifier__.ts +31 -26
  260. package/src/concepts/IfStatement__.ts +2 -2
  261. package/src/concepts/InterfaceParam__.ts +39 -20
  262. package/src/concepts/Interface__.ts +103 -9
  263. package/src/concepts/LogicItem__.ts +16 -1
  264. package/src/concepts/Logic__.ts +60 -18
  265. package/src/concepts/MemberExpression__.ts +18 -6
  266. package/src/concepts/Module__.ts +19 -8
  267. package/src/concepts/Namespace__.ts +24 -12
  268. package/src/concepts/Param__.ts +34 -23
  269. package/src/concepts/ProcessComponent__.ts +2 -2
  270. package/src/concepts/ProcessElement__.ts +51 -50
  271. package/src/concepts/ProcessOutcome__.ts +1 -1
  272. package/src/concepts/Process__.ts +32 -28
  273. package/src/concepts/QueryAggregateExpression__.ts +1 -1
  274. package/src/concepts/QueryFromExpression__.ts +1 -1
  275. package/src/concepts/QueryJoinExpression__.ts +2 -2
  276. package/src/concepts/QuerySelectExpression__.ts +1 -1
  277. package/src/concepts/Return__.ts +35 -25
  278. package/src/concepts/SqlQueryComponent__.ts +1 -1
  279. package/src/concepts/StringLiteral__.ts +2 -2
  280. package/src/concepts/StructureProperty__.ts +49 -29
  281. package/src/concepts/Structure__.ts +17 -5
  282. package/src/concepts/SwitchCase__.ts +3 -3
  283. package/src/concepts/SwitchStatement__.ts +1 -1
  284. package/src/concepts/TypeAnnotation__.ts +34 -12
  285. package/src/concepts/UnaryExpression__.ts +4 -2
  286. package/src/concepts/ValidationRule__.ts +24 -1
  287. package/src/concepts/Variable__.ts +35 -24
  288. package/src/concepts/ViewComponent__.ts +5 -5
  289. package/src/concepts/ViewElement__.ts +168 -113
  290. package/src/concepts/View__.ts +44 -25
  291. package/src/concepts/WhileStatement__.ts +1 -1
  292. package/src/concepts/basics/stdlib/index.ts +3 -1
  293. package/src/concepts/basics/stdlib/nasl.auth.ts +26 -0
  294. package/src/concepts/basics/stdlib/nasl.browser.ts +7 -41
  295. package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
  296. package/src/concepts/basics/stdlib/nasl.util.ts +49 -41
  297. package/src/concepts/basics/stdlib/nasl.validation.ts +17 -11
  298. package/src/concepts/basics/types/coreTypeList.ts +11 -11
  299. package/src/concepts/index__.ts +1 -0
  300. package/src/enums/KEYWORDS.ts +1 -1
  301. package/src/generator/genBundleFiles.ts +131 -112
  302. package/src/manager/diagnostic.ts +1 -1
  303. package/src/server/createUiTs.ts +22 -4
  304. package/src/server/entity2LogicNamespace.ts +25 -9
  305. package/src/server/getExtensionModules.ts +2 -0
  306. package/src/server/getLogics.ts +42 -58
  307. package/src/server/getMemberIdentifier.ts +88 -46
  308. package/src/server/getProcesses.ts +32 -9
  309. package/src/server/index.ts +12 -1
  310. package/src/server/naslServer.ts +422 -215
  311. package/src/server/process2LogicNamespace.ts +17 -1
  312. package/src/server/translator.ts +392 -134
  313. package/src/service/storage/init.ts +27 -16
  314. package/src/templator/genCreateBlock.ts +5 -5
  315. package/src/templator/genCurdEditMultipleKeyBlock.ts +25 -26
  316. package/src/templator/genCurdMultipleKeyBlock.ts +7 -7
  317. package/src/templator/genEditTableBlock.ts +2 -2
  318. package/src/templator/genGetBlock.ts +5 -7
  319. package/src/templator/genGridViewBlock.ts +4 -7
  320. package/src/templator/genQueryComponent.ts +1 -0
  321. package/src/templator/genTableBlock.ts +4 -7
  322. package/src/templator/genUpdateBlock.ts +7 -8
  323. package/src/templator/utils.ts +2 -1
  324. package/src/utils/index.ts +19 -0
@@ -244,7 +244,7 @@ export class InterfaceParam extends BaseNode {
244
244
  // eslint-disable-next-line prefer-rest-params
245
245
  throw new Error('找不到类型:' + arguments[0]);
246
246
  } else {
247
- typeAnnotation._delete();
247
+ typeAnnotation._delete?.();
248
248
  const relationOptions = { parentId: this.id, parentConcept: this.concept, parentNode: this };
249
249
  Object.assign(typeAnnotation, relationOptions);
250
250
  }
@@ -279,29 +279,48 @@ export class InterfaceParam extends BaseNode {
279
279
  // }
280
280
  return code;
281
281
  }
282
+
283
+ get hasChildren() {
284
+ const { typeKind, typeNamespace } = this.typeAnnotation;
285
+ if (typeKind === 'reference' || typeKind === 'generic') {
286
+ if (typeNamespace.endsWith('.enums'))
287
+ return null;
288
+ return [{}];
289
+ }
290
+ return null;
291
+ }
292
+ get isTreeLeaf() {
293
+ return !this.hasChildren;
294
+ }
282
295
  getSelectRef() {
283
- const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
284
- let completionChildren;
285
- if (typeKind === 'reference') {
286
- if (typeNamespace === 'nasl.ui') {
287
- const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
288
- const properties = node.properties || [];
289
- completionChildren = properties;
296
+ try {
297
+ const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
298
+ let completionChildren;
299
+ if (typeKind === 'reference') {
300
+ if (typeNamespace === 'nasl.ui') {
301
+ const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
302
+ const properties = node.properties || [];
303
+ completionChildren = properties;
304
+ } else if (typeNamespace.endsWith('.enums')) {
305
+ completionChildren = undefined;
306
+ } else {
307
+ const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
308
+ const properties = node.properties || [];
309
+ completionChildren = properties;
310
+ }
311
+ } else if (typeKind === 'generic') {
312
+ if (typeNamespace === 'nasl.collection') {
313
+ const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
314
+ const properties = node.properties || [];
315
+ completionChildren = properties;
316
+ }
290
317
  } else {
291
- const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
292
- const properties = node.properties || [];
293
- completionChildren = properties;
294
- }
295
- } else if (typeKind === 'generic') {
296
- if (typeNamespace === 'nasl.collection') {
297
- const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
298
- const properties = node.properties || [];
299
- completionChildren = properties;
318
+ completionChildren = undefined;
300
319
  }
301
- } else {
302
- completionChildren = undefined;
320
+ return completionChildren;
321
+ } catch (err) {
322
+ console.log(err);
303
323
  }
304
- return completionChildren;
305
324
  }
306
325
  //================================================================================
307
326
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -171,7 +171,7 @@ export class Interface extends BaseNode {
171
171
  name: options,
172
172
  }, this, 'params');
173
173
  } else if (options instanceof InterfaceParam) {
174
- options.delete(); // 同一实例不支持多处存在
174
+ options.ensureDelete(); // 同一实例不支持多处存在
175
175
  interfaceParam = options;
176
176
  Object.assign(interfaceParam, relationOptions);
177
177
  } else {
@@ -269,7 +269,7 @@ export class Interface extends BaseNode {
269
269
  }
270
270
 
271
271
 
272
- getReturnUniqueName(name = 'result1') {
272
+ getReturnUniqueName(name = 'result') {
273
273
  return utils.unique(name, this.getVarExistingNames());
274
274
  }
275
275
 
@@ -309,7 +309,7 @@ export class Interface extends BaseNode {
309
309
  name: options,
310
310
  }, this, 'returns');
311
311
  } else if (options instanceof Return) {
312
- options.delete(); // 同一实例不支持多处存在
312
+ options.ensureDelete(); // 同一实例不支持多处存在
313
313
  ret = options;
314
314
  Object.assign(ret, relationOptions);
315
315
  } else {
@@ -522,7 +522,7 @@ export class Interface extends BaseNode {
522
522
  toService() {
523
523
  return {
524
524
  config: {
525
- serviceType: 'export',
525
+ serviceType: 'external',
526
526
  },
527
527
  url: {
528
528
  method: this.method,
@@ -563,7 +563,7 @@ export class Interface extends BaseNode {
563
563
  }
564
564
 
565
565
  toEmbeddedTSFile() {
566
- let code = `namespace ${this.getNamespace()} {\n`;
566
+ let code = `namespace ${this.getTsNamespace()} {\n`;
567
567
 
568
568
  const state = createCompilerState(code, { tabSize: 1 });
569
569
  try {
@@ -581,9 +581,12 @@ export class Interface extends BaseNode {
581
581
  }
582
582
 
583
583
  get calleeKey(): string {
584
- return `${this.getNamespace()}.${this.name} `;
584
+ return `${this.getTsNamespace()}.${this.name} `;
585
585
  }
586
586
 
587
+ get calleewholeKey() {
588
+ return this.getNamespace() + '.' + this.name;
589
+ }
587
590
  /**
588
591
  * 生成宿主语言的文件路径
589
592
  * @param name 一般不用传,用于 rename
@@ -593,10 +596,90 @@ export class Interface extends BaseNode {
593
596
  return `/embedded/${this.app.name}${_path}/interfaces/${name}.ts`;
594
597
  }
595
598
 
599
+ get tsName(): string {
600
+ const excludeds = [
601
+ 'abstract',
602
+ 'arguments',
603
+ 'await',
604
+ 'boolean',
605
+ 'break',
606
+ 'byte',
607
+ 'case',
608
+ 'catch',
609
+ 'char',
610
+ 'class',
611
+ 'const',
612
+ 'continue',
613
+ 'debugger',
614
+ 'default',
615
+ 'delete',
616
+ 'do',
617
+ 'double',
618
+ 'else',
619
+ 'enum',
620
+ 'eval',
621
+ 'export',
622
+ 'extends',
623
+ 'false',
624
+ 'final',
625
+ 'finally',
626
+ 'float',
627
+ 'for',
628
+ 'function',
629
+ 'goto',
630
+ 'if',
631
+ 'implements',
632
+ 'import',
633
+ 'in',
634
+ 'instanceof',
635
+ 'int',
636
+ 'interface',
637
+ 'let',
638
+ 'long',
639
+ 'native',
640
+ 'new',
641
+ 'null',
642
+ 'package',
643
+ 'private',
644
+ 'protected',
645
+ 'public',
646
+ 'return',
647
+ 'short',
648
+ 'static',
649
+ 'super',
650
+ 'switch',
651
+ 'synchronized',
652
+ 'this',
653
+ 'throw',
654
+ 'throws',
655
+ 'transient',
656
+ 'true',
657
+ 'try',
658
+ 'typeof',
659
+ 'var',
660
+ 'void',
661
+ 'volatile',
662
+ 'while',
663
+ 'with',
664
+ 'yield,as',
665
+ 'any',
666
+ 'number',
667
+ 'string',
668
+ 'get',
669
+ 'type',
670
+ 'typeof',
671
+ 'instanceof',
672
+ 'require',
673
+ ];
674
+ if (excludeds.includes(this.name)) {
675
+ return '_' + this.name;
676
+ }
677
+ return this.name;
678
+ }
596
679
  @withSourceMap()
597
680
  toEmbeddedTS(state?: TranslatorState): string {
598
681
  let code = '';
599
- code += `export function ${this.name}(`;
682
+ code += `export function ${this.tsName}(`;
600
683
  this.params.forEach((param, index) => {
601
684
  if (index === 0) {
602
685
  code += '{';
@@ -626,7 +709,7 @@ export class Interface extends BaseNode {
626
709
  });
627
710
  code += '{\n';
628
711
 
629
- code += this.module ? '' : 'let logic =' + (this.parentNode as Namespace).getNamespace() + '.logics.' + this.originLogicName + '\n';
712
+ code += this.module ? '' : 'let logic =' + (this.parentNode as Namespace).getTsNamespace() + '.logics.' + this.originLogicName + '\n';
630
713
  code += 'let ';
631
714
  code += this.returns[0].toEmbeddedTS(shiftState(state, code, { inline: true }));
632
715
  code += ';\n';
@@ -635,7 +718,7 @@ export class Interface extends BaseNode {
635
718
  code += '\n }';
636
719
  } else {
637
720
  code += 'void {';
638
- code += this.module ? '' : 'let logic =' + (this.parentNode as Namespace).getNamespace() + '.logics.' + this.originLogicName + '\n';
721
+ code += this.module ? '' : 'let logic =' + (this.parentNode as Namespace).getTsNamespace() + '.logics.' + this.originLogicName + '\n';
639
722
  code += '};';
640
723
  }
641
724
  code += '\n';
@@ -648,6 +731,17 @@ export class Interface extends BaseNode {
648
731
  else
649
732
  throw new Error('无法获取命名空间,请设置 parentNode!');
650
733
  }
734
+ getTsNamespace() {
735
+ if (this.parentNode.concept === 'App') {
736
+ return `${(this.parentNode as Namespace).getNamespace()}.interfaces`;
737
+ } else {
738
+ if (this.parentNode && (this.parentNode as Namespace).getTsNamespace) {
739
+ return `${(this.parentNode as Namespace).getTsNamespace()}.interfaces`;
740
+ } else {
741
+ throw new Error('无法获取命名空间,请设置 parentNode!');
742
+ }
743
+ }
744
+ }
651
745
 
652
746
  getVarExistingNames(excludedList: Array<InterfaceParam | Return> = []) {
653
747
  const excludedSet = new Set(excludedList);
@@ -1,6 +1,7 @@
1
1
  import { TranslatorState } from '../translator';
2
2
  import CallFunction from './CallFunction__';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
+ import CallQueryComponent from './CallQueryComponent__';
4
5
 
5
6
  //================================================================================
6
7
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -29,7 +30,7 @@ export class LogicItem extends BaseNode {
29
30
  * 产品概念
30
31
  */
31
32
  @property()
32
- concept: 'LogicItem' | 'Start' | 'End' | 'IfStatement' | 'SwitchStatement' | 'SwitchCase' | 'ForEachStatement' | 'WhileStatement' | 'Assignment' | 'Comment' | 'CallLogic' | 'CallFunction' | 'CallInterface' | 'Destination' | 'ValidationRule' | 'Argument' | 'JSBlock' | 'Identifier' | 'NullLiteral' | 'BooleanLiteral' | 'StringLiteral' | 'NumericLiteral' | 'BinaryExpression' | 'UnaryExpression' | 'MemberExpression' | 'Unparsed' | 'CallQueryComponent' | 'QueryFromExpression' | 'QueryJoinExpression' | 'QueryFieldExpression' | 'QueryAggregateExpression' | 'QueryOrderByExpression' | 'QueryGroupByExpression' | 'QuerySelectExpression' | 'QueryLimitExpression' | 'SqlQueryComponent' | 'ProcessOutcome' = 'LogicItem';
33
+ concept: 'LogicItem' | 'Start' | 'End' | 'IfStatement' | 'SwitchStatement' | 'SwitchCase' | 'ForEachStatement' | 'WhileStatement' | 'Assignment' | 'Comment' | 'CallLogic' | 'CallFunction' | 'CallInterface' | 'Destination' | 'ValidationRule' | 'Argument' | 'JSBlock' | 'Identifier' | 'NullLiteral' | 'BooleanLiteral' | 'StringLiteral' | 'NumericLiteral' | 'BinaryExpression' | 'UnaryExpression' | 'MemberExpression' | 'Unparsed' | 'CallQueryComponent' | 'QueryFromExpression' | 'QueryJoinExpression' | 'QueryFieldExpression' | 'QueryAggregateExpression' | 'QueryOrderByExpression' | 'QueryGroupByExpression' | 'QuerySelectExpression' | 'QueryLimitExpression' | 'SqlQueryComponent' | 'ProcessOutcome' | 'Assignee' = 'LogicItem';
33
34
 
34
35
  /**
35
36
  * 逻辑项标题
@@ -224,6 +225,20 @@ export class LogicItem extends BaseNode {
224
225
  return this.toJS(state);
225
226
  }
226
227
 
228
+ delete() {
229
+ let actionMsg = '删除逻辑项';
230
+ if(this.name) actionMsg += `“${this.name}”`;
231
+ this.app?.emit('collect:start', {
232
+ actionMsg,
233
+ });
234
+ super.delete();
235
+ this.traverseChildren((el) => {
236
+ if(el?.concept === 'CallQueryComponent')
237
+ (el as CallQueryComponent).removeStructure();
238
+ });
239
+ this.app?.emit('collect:end');
240
+ }
241
+
227
242
  //================================================================================
228
243
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
229
244
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -270,7 +270,7 @@ export class Logic extends BaseNode {
270
270
  name: options,
271
271
  }, this, 'typeParams');
272
272
  } else if (options instanceof TypeParam) {
273
- options.delete(); // 同一实例不支持多处存在
273
+ options.ensureDelete(); // 同一实例不支持多处存在
274
274
  typeParam = options;
275
275
  Object.assign(typeParam, relationOptions);
276
276
  } else {
@@ -408,7 +408,7 @@ export class Logic extends BaseNode {
408
408
  name: options,
409
409
  }, this, 'params');
410
410
  } else if (options instanceof Param) {
411
- options.delete(); // 同一实例不支持多处存在
411
+ options.ensureDelete(); // 同一实例不支持多处存在
412
412
  param = options;
413
413
  Object.assign(param, relationOptions);
414
414
  } else {
@@ -506,7 +506,7 @@ export class Logic extends BaseNode {
506
506
  }
507
507
 
508
508
 
509
- getReturnUniqueName(name = 'result1') {
509
+ getReturnUniqueName(name = 'result') {
510
510
  return utils.unique(name, this.getVarExistingNames());
511
511
  }
512
512
 
@@ -546,7 +546,7 @@ export class Logic extends BaseNode {
546
546
  name: options,
547
547
  }, this, 'returns');
548
548
  } else if (options instanceof Return) {
549
- options.delete(); // 同一实例不支持多处存在
549
+ options.ensureDelete(); // 同一实例不支持多处存在
550
550
  ret = options;
551
551
  Object.assign(ret, relationOptions);
552
552
  } else {
@@ -684,7 +684,7 @@ export class Logic extends BaseNode {
684
684
  name: options,
685
685
  }, this, 'variables');
686
686
  } else if (options instanceof Variable) {
687
- options.delete(); // 同一实例不支持多处存在
687
+ options.ensureDelete(); // 同一实例不支持多处存在
688
688
  variable = options;
689
689
  Object.assign(variable, relationOptions);
690
690
  } else {
@@ -805,7 +805,7 @@ export class Logic extends BaseNode {
805
805
  const relationOptions = { parentNode: this, parentKey: 'body' };
806
806
  let logicItem: LogicItem;
807
807
  if (options instanceof LogicItem) {
808
- options.delete(); // 同一实例不支持多处存在
808
+ options.ensureDelete(); // 同一实例不支持多处存在
809
809
  logicItem = options;
810
810
  Object.assign(logicItem, relationOptions);
811
811
  } else {
@@ -909,7 +909,7 @@ export class Logic extends BaseNode {
909
909
  const relationOptions = { parentNode: this, parentKey: 'playground' };
910
910
  let logicItem: LogicItem;
911
911
  if (options instanceof LogicItem) {
912
- options.delete(); // 同一实例不支持多处存在
912
+ options.ensureDelete(); // 同一实例不支持多处存在
913
913
  logicItem = options;
914
914
  Object.assign(logicItem, relationOptions);
915
915
  } else {
@@ -1296,6 +1296,10 @@ export class Logic extends BaseNode {
1296
1296
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1297
1297
  // 自动生成的代码已结束。下面可以手动编写。
1298
1298
  //================================================================================
1299
+ // 用于calllogic树中定位是那个logic,回显
1300
+ get calleewholeKey() {
1301
+ return this.getNamespace() + '.' + this.name;
1302
+ }
1299
1303
  // 设置定时任务
1300
1304
  setCronAndTriggerType(cron: string, triggerType: string) {
1301
1305
  const object = {
@@ -1371,10 +1375,6 @@ export class Logic extends BaseNode {
1371
1375
  });
1372
1376
  }
1373
1377
 
1374
- if (Array.isArray(this.returns) && this.returns.length) {
1375
- code += `return ${this.returns[0].name};\n`;
1376
- }
1377
-
1378
1378
  code += indent(state.tabSize) + '}\n';
1379
1379
 
1380
1380
  return code;
@@ -1456,7 +1456,7 @@ export class Logic extends BaseNode {
1456
1456
  }
1457
1457
 
1458
1458
  @withSourceMap()
1459
- toEmbeddedTSInProcess(state?: TranslatorState, prependCode?: string, noName? :boolean): string {
1459
+ toEmbeddedTSInProcess(state?: TranslatorState, prependCode?: string, noName?: boolean): string {
1460
1460
  let code = '';
1461
1461
  code += `${noName ? '' : `${this.name}:`} function(`;
1462
1462
  this.params.forEach((param, index) => {
@@ -1465,7 +1465,7 @@ export class Logic extends BaseNode {
1465
1465
  code += ', ';
1466
1466
  });
1467
1467
  code += `) {\n`;
1468
- code += (prependCode || '');
1468
+ code += prependCode || '';
1469
1469
  code += '\n';
1470
1470
  this.variables.forEach((variable) => {
1471
1471
  code += indent(state.tabSize + 1) + 'let ';
@@ -1510,16 +1510,21 @@ export class Logic extends BaseNode {
1510
1510
  if (!prefix) {
1511
1511
  code += `export function ${this.name}(`;
1512
1512
  } else if (prefix === 'noExport') {
1513
- code += ` function ${this.name}(`;
1513
+ code += `function ${this.name}(`;
1514
1514
  } else if (prefix === 'inObject') {
1515
- code += ` ${this.name}(`;
1515
+ code += `${this.name}(`;
1516
1516
  }
1517
1517
  this.params.forEach((param, index) => {
1518
1518
  code += param.toEmbeddedTS(shiftState(state, code, { inline: true }));
1519
1519
  if (index !== this.params.length - 1)
1520
1520
  code += ', ';
1521
1521
  });
1522
- code += `) {\n`;
1522
+ code += ')';
1523
+ if (this.returns.length) {
1524
+ code += ': ';
1525
+ code += this.returns[0].typeAnnotation.toEmbeddedTS(shiftState(state, code, { inline: true }));
1526
+ }
1527
+ code += '{\n';
1523
1528
 
1524
1529
  this.variables.forEach((variable) => {
1525
1530
  code += indent(state.tabSize + 1) + 'let ';
@@ -1563,7 +1568,27 @@ export class Logic extends BaseNode {
1563
1568
  parentNodeNamespace = this.parentNode.getNamespace();
1564
1569
  }
1565
1570
 
1566
- parentNodeNamespace = (['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser'].includes(parentNodeNamespace) || parentNodeNamespace.includes('.logics')) ? parentNodeNamespace : `${parentNodeNamespace}.logics`;
1571
+ parentNodeNamespace
1572
+ = ['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration'].includes(parentNodeNamespace) || parentNodeNamespace.includes('.logics') ? parentNodeNamespace : `${parentNodeNamespace}.logics`;
1573
+ if (this.parentNode instanceof View) {
1574
+ return (parentNodeNamespace = '');
1575
+ }
1576
+ return parentNodeNamespace;
1577
+ } else
1578
+ throw new Error('无法获取命名空间,请设置 parentNode!');
1579
+ }
1580
+
1581
+ getTsNamespace(): string {
1582
+ if (this.parentNode) {
1583
+ let parentNodeNamespace = '';
1584
+ if (this.parentNode instanceof Namespace || this.parentNode instanceof App) {
1585
+ parentNodeNamespace = this.parentNode.getNamespace();
1586
+ } else if (this.parentNode instanceof Module) {
1587
+ parentNodeNamespace = this.parentNode.getTsNamespace();
1588
+ }
1589
+
1590
+ parentNodeNamespace
1591
+ = ['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration'].includes(parentNodeNamespace) || parentNodeNamespace.includes('.logics') ? parentNodeNamespace : `${parentNodeNamespace}.logics`;
1567
1592
  if (this.parentNode instanceof View) {
1568
1593
  return (parentNodeNamespace = '');
1569
1594
  }
@@ -1582,12 +1607,13 @@ export class Logic extends BaseNode {
1582
1607
  }
1583
1608
 
1584
1609
  toEmbeddedTSFile() {
1585
- let code = `namespace ${this.getNamespace()} {\n`;
1610
+ let code = `namespace ${this.getTsNamespace()} {\n`;
1586
1611
 
1587
1612
  const state = createCompilerState(code, { tabSize: 1 });
1588
1613
  try {
1589
1614
  code += this.toEmbeddedTS(state);
1590
1615
  } catch (err) {
1616
+ console.log(err, '有问题翻译失败');
1591
1617
  code += '';
1592
1618
  }
1593
1619
  code += '}\n';
@@ -1643,6 +1669,22 @@ export class Logic extends BaseNode {
1643
1669
  fake: boolean;
1644
1670
 
1645
1671
  getPath: () => string;
1672
+
1673
+ delete() {
1674
+ let actionMsg = '删除逻辑项';
1675
+ if (this.name)
1676
+ actionMsg += `“${this.name}”`;
1677
+ this.app?.emit('collect:start', {
1678
+ actionMsg,
1679
+ });
1680
+ super.delete();
1681
+ this.traverseChildren((el) => {
1682
+ if (el?.concept === 'CallQueryComponent')
1683
+ (el as CallQueryComponent).removeStructure();
1684
+ });
1685
+ this.app?.emit('collect:end');
1686
+ }
1687
+
1646
1688
  //================================================================================
1647
1689
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
1648
1690
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -2,8 +2,11 @@ import { TranslatorState, shiftState, withSourceMap, indent } from '../translato
2
2
  import { TypeAnnotation } from '..';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
4
  import BinaryExpression from './BinaryExpression__';
5
+ import BindAttribute from './BindAttribute__';
5
6
  import Assignment from './Assignment__';
6
7
 
8
+ const Identifier_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
9
+
7
10
  //================================================================================
8
11
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
9
12
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -144,16 +147,25 @@ export class MemberExpression extends LogicItem {
144
147
  // 选中的数据类型,这个用作暂存
145
148
  typeAnnotation: TypeAnnotation = undefined;
146
149
  toVue(options?: ElementToVueOptions) {
147
- const object: string = this.object.toVue(options);
148
- const property = this.property.toVue(options);
150
+ const object = String(this.object.toVue(options)); // undefined 也让正常展示
151
+ const property = String(this.property.toVue(options));
152
+
153
+ const bindAttr: BindAttribute = this.getAncestor('BindAttribute') as BindAttribute;
154
+ if (bindAttr && (bindAttr.sync || bindAttr.model))
155
+ return Identifier_RE.test(property) ? `${object}.${property}` : `${object}['${property}']`;
156
+
149
157
  const lastPart = object.split(' && ').pop();
150
- return options?.finalCode === false ? `${object}.${property}` : `${object} && ${lastPart}.${property}`;
158
+ if (Identifier_RE.test(property))
159
+ return options?.finalCode === false ? `${object}.${property}` : `${object} && ${lastPart}.${property}`;
160
+ else
161
+ return options?.finalCode === false ? `${object}['${property}']` : `${object} && ${lastPart}['${property}']`;
151
162
  }
152
163
 
153
164
  toUI(): string {
154
165
  const object: string = this.object.toUI();
155
166
  const property = this.property.toUI();
156
- return `${object}.${property}`;
167
+
168
+ return Identifier_RE.test(property) ? `${object}.${property}` : `${object}['${property}']`;
157
169
  }
158
170
 
159
171
  toJS(): string {
@@ -169,11 +181,11 @@ export class MemberExpression extends LogicItem {
169
181
  }
170
182
  // 在赋值语句的左侧
171
183
  if (node) {
172
- return `${object}.${property}`;
184
+ return Identifier_RE.test(property) ? `${object}.${property}` : `${object}['${property}']`;
173
185
  }
174
186
  }
175
187
  const lastPart = object.split(' && ').pop();
176
- return `${object} && ${lastPart}.${property}`;
188
+ return Identifier_RE.test(property) ? `${object} && ${lastPart}.${property}` : `${object} && ${lastPart}['${property}']`;
177
189
  }
178
190
 
179
191
  setValue(newValue: string) {
@@ -198,7 +198,7 @@ export class Module extends BaseNode {
198
198
  name: options,
199
199
  }, this, 'entities');
200
200
  } else if (options instanceof Entity) {
201
- options.delete(); // 同一实例不支持多处存在
201
+ options.ensureDelete(); // 同一实例不支持多处存在
202
202
  entity = options;
203
203
  Object.assign(entity, relationOptions);
204
204
  } else {
@@ -340,7 +340,7 @@ export class Module extends BaseNode {
340
340
  name: options,
341
341
  }, this, 'structures');
342
342
  } else if (options instanceof Structure) {
343
- options.delete(); // 同一实例不支持多处存在
343
+ options.ensureDelete(); // 同一实例不支持多处存在
344
344
  structure = options;
345
345
  Object.assign(structure, relationOptions);
346
346
  } else {
@@ -482,7 +482,7 @@ export class Module extends BaseNode {
482
482
  name: options,
483
483
  }, this, 'enums');
484
484
  } else if (options instanceof Enum) {
485
- options.delete(); // 同一实例不支持多处存在
485
+ options.ensureDelete(); // 同一实例不支持多处存在
486
486
  enumeration = options;
487
487
  Object.assign(enumeration, relationOptions);
488
488
  } else {
@@ -624,7 +624,7 @@ export class Module extends BaseNode {
624
624
  name: options,
625
625
  }, this, 'logics');
626
626
  } else if (options instanceof Logic) {
627
- options.delete(); // 同一实例不支持多处存在
627
+ options.ensureDelete(); // 同一实例不支持多处存在
628
628
  logic = options;
629
629
  Object.assign(logic, relationOptions);
630
630
  } else {
@@ -766,7 +766,7 @@ export class Module extends BaseNode {
766
766
  name: options,
767
767
  }, this, 'interfaces');
768
768
  } else if (options instanceof Interface) {
769
- options.delete(); // 同一实例不支持多处存在
769
+ options.ensureDelete(); // 同一实例不支持多处存在
770
770
  itface = options;
771
771
  Object.assign(itface, relationOptions);
772
772
  } else {
@@ -908,7 +908,7 @@ export class Module extends BaseNode {
908
908
  name: options,
909
909
  }, this, 'views');
910
910
  } else if (options instanceof View) {
911
- options.delete(); // 同一实例不支持多处存在
911
+ options.ensureDelete(); // 同一实例不支持多处存在
912
912
  view = options;
913
913
  Object.assign(view, relationOptions);
914
914
  } else {
@@ -1050,7 +1050,7 @@ export class Module extends BaseNode {
1050
1050
  name: options,
1051
1051
  }, this, 'processes');
1052
1052
  } else if (options instanceof Process) {
1053
- options.delete(); // 同一实例不支持多处存在
1053
+ options.ensureDelete(); // 同一实例不支持多处存在
1054
1054
  process = options;
1055
1055
  Object.assign(process, relationOptions);
1056
1056
  } else {
@@ -1192,7 +1192,7 @@ export class Module extends BaseNode {
1192
1192
  name: options,
1193
1193
  }, this, 'viewComponents');
1194
1194
  } else if (options instanceof ViewComponent) {
1195
- options.delete(); // 同一实例不支持多处存在
1195
+ options.ensureDelete(); // 同一实例不支持多处存在
1196
1196
  viewComponent = options;
1197
1197
  Object.assign(viewComponent, relationOptions);
1198
1198
  } else {
@@ -1695,11 +1695,22 @@ export class Module extends BaseNode {
1695
1695
  // 自动生成的代码已结束。下面可以手动编写。
1696
1696
  //================================================================================
1697
1697
 
1698
+ /**
1699
+ * 生成宿主语言的文件路径
1700
+ * @param name 一般不用传,用于 rename
1701
+ */
1702
+ getEmbeddedFilePath(name = this.name) {
1703
+ return `/embedded/${this.app.name}/${this.parentKey}/${this.name}`;
1704
+ }
1698
1705
  /**
1699
1706
  * 获取命名空间和
1700
1707
  * 暂时不考虑 Module 嵌套的情况
1701
1708
  */
1702
1709
  getNamespace() {
1710
+ return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.name}`;
1711
+ }
1712
+
1713
+ getTsNamespace() {
1703
1714
  return `${moduleNameSpace[this.parentKey as ModuleKeyType]}.${this.tsName}`;
1704
1715
  }
1705
1716