@lcap/nasl 3.3.3-beta.2 → 3.3.3-beta.4

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 (306) hide show
  1. package/out/automate/template/myProcess.d.ts +1 -1
  2. package/out/automate/template/myProcess.js +3 -2
  3. package/out/automate/template/myProcess.js.map +1 -1
  4. package/out/common/BaseNode.d.ts +26 -16
  5. package/out/common/BaseNode.js +35 -11
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/Anchor__.js +2 -1
  8. package/out/concepts/Anchor__.js.map +1 -1
  9. package/out/concepts/AnonymousFunction__.js +6 -3
  10. package/out/concepts/AnonymousFunction__.js.map +1 -1
  11. package/out/concepts/Argument__.js +4 -3
  12. package/out/concepts/Argument__.js.map +1 -1
  13. package/out/concepts/Assignment__.js +3 -2
  14. package/out/concepts/Assignment__.js.map +1 -1
  15. package/out/concepts/Attribute__.js +2 -1
  16. package/out/concepts/Attribute__.js.map +1 -1
  17. package/out/concepts/AuthLogicForCallInterface__.js +3 -2
  18. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  19. package/out/concepts/BackendVariable__.js +4 -3
  20. package/out/concepts/BackendVariable__.js.map +1 -1
  21. package/out/concepts/BatchAssignment__.js +7 -5
  22. package/out/concepts/BatchAssignment__.js.map +1 -1
  23. package/out/concepts/BinaryExpression__.js +7 -7
  24. package/out/concepts/BinaryExpression__.js.map +1 -1
  25. package/out/concepts/BindAttribute__.js +9 -14
  26. package/out/concepts/BindAttribute__.js.map +1 -1
  27. package/out/concepts/BindDirective__.js +2 -1
  28. package/out/concepts/BindDirective__.js.map +1 -1
  29. package/out/concepts/BindEvent__.js +5 -3
  30. package/out/concepts/BindEvent__.js.map +1 -1
  31. package/out/concepts/BindStyle__.js +2 -1
  32. package/out/concepts/BindStyle__.js.map +1 -1
  33. package/out/concepts/CallAuthInterface__.js +5 -2
  34. package/out/concepts/CallAuthInterface__.js.map +1 -1
  35. package/out/concepts/CallFunction__.js +6 -2
  36. package/out/concepts/CallFunction__.js.map +1 -1
  37. package/out/concepts/CallInterface__.js +14 -9
  38. package/out/concepts/CallInterface__.js.map +1 -1
  39. package/out/concepts/CallLogic__.js +10 -5
  40. package/out/concepts/CallLogic__.js.map +1 -1
  41. package/out/concepts/CallQueryComponent__.js +8 -15
  42. package/out/concepts/CallQueryComponent__.js.map +1 -1
  43. package/out/concepts/CompletionProperty__.js +2 -1
  44. package/out/concepts/CompletionProperty__.js.map +1 -1
  45. package/out/concepts/ConfigGroup__.js +3 -2
  46. package/out/concepts/ConfigGroup__.js.map +1 -1
  47. package/out/concepts/ConfigProperty__.js +3 -2
  48. package/out/concepts/ConfigProperty__.js.map +1 -1
  49. package/out/concepts/Configuration__.js +3 -2
  50. package/out/concepts/Configuration__.js.map +1 -1
  51. package/out/concepts/Connection__.js +3 -2
  52. package/out/concepts/Connection__.js.map +1 -1
  53. package/out/concepts/Connector__.js +15 -10
  54. package/out/concepts/Connector__.js.map +1 -1
  55. package/out/concepts/Constant__.js +2 -1
  56. package/out/concepts/Constant__.js.map +1 -1
  57. package/out/concepts/DataSource__.js +3 -2
  58. package/out/concepts/DataSource__.js.map +1 -1
  59. package/out/concepts/Destination__.js +2 -1
  60. package/out/concepts/Destination__.js.map +1 -1
  61. package/out/concepts/EntityProperty__.js +6 -3
  62. package/out/concepts/EntityProperty__.js.map +1 -1
  63. package/out/concepts/Entity__.js +6 -4
  64. package/out/concepts/Entity__.js.map +1 -1
  65. package/out/concepts/Enum__.js +2 -1
  66. package/out/concepts/Enum__.js.map +1 -1
  67. package/out/concepts/Event__.js +3 -2
  68. package/out/concepts/Event__.js.map +1 -1
  69. package/out/concepts/ExternalDestination__.js +2 -1
  70. package/out/concepts/ExternalDestination__.js.map +1 -1
  71. package/out/concepts/ForEachStatement__.js +4 -2
  72. package/out/concepts/ForEachStatement__.js.map +1 -1
  73. package/out/concepts/Frontend__.js +14 -9
  74. package/out/concepts/Frontend__.js.map +1 -1
  75. package/out/concepts/Function__.js +11 -6
  76. package/out/concepts/Function__.js.map +1 -1
  77. package/out/concepts/Identifier__.js +3 -0
  78. package/out/concepts/Identifier__.js.map +1 -1
  79. package/out/concepts/IfStatement__.js +2 -1
  80. package/out/concepts/IfStatement__.js.map +1 -1
  81. package/out/concepts/InterfaceParam__.js +2 -1
  82. package/out/concepts/InterfaceParam__.js.map +1 -1
  83. package/out/concepts/Interface__.js +6 -3
  84. package/out/concepts/Interface__.js.map +1 -1
  85. package/out/concepts/JSBlock__.js +5 -5
  86. package/out/concepts/JSBlock__.js.map +1 -1
  87. package/out/concepts/Logic__.js +25 -19
  88. package/out/concepts/Logic__.js.map +1 -1
  89. package/out/concepts/MatchCase__.js +6 -4
  90. package/out/concepts/MatchCase__.js.map +1 -1
  91. package/out/concepts/Match__.js +2 -1
  92. package/out/concepts/Match__.js.map +1 -1
  93. package/out/concepts/MemberExpression__.js +2 -1
  94. package/out/concepts/MemberExpression__.js.map +1 -1
  95. package/out/concepts/MetadataType__.d.ts +1 -1
  96. package/out/concepts/MetadataType__.js +8 -6
  97. package/out/concepts/MetadataType__.js.map +1 -1
  98. package/out/concepts/MsgTriggerEvent__.js +3 -2
  99. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  100. package/out/concepts/MsgTriggerLauncher__.js +3 -2
  101. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  102. package/out/concepts/Namespace__.js +33 -22
  103. package/out/concepts/Namespace__.js.map +1 -1
  104. package/out/concepts/NewComposite__.js +38 -18
  105. package/out/concepts/NewComposite__.js.map +1 -1
  106. package/out/concepts/NewList__.js +5 -3
  107. package/out/concepts/NewList__.js.map +1 -1
  108. package/out/concepts/NewMap__.js +5 -3
  109. package/out/concepts/NewMap__.js.map +1 -1
  110. package/out/concepts/NumericLiteral__.js +2 -1
  111. package/out/concepts/NumericLiteral__.js.map +1 -1
  112. package/out/concepts/OqlQueryComponent__.js +4 -3
  113. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  114. package/out/concepts/OverriddenLogic__.js +13 -7
  115. package/out/concepts/OverriddenLogic__.js.map +1 -1
  116. package/out/concepts/Param__.js +4 -3
  117. package/out/concepts/Param__.js.map +1 -1
  118. package/out/concepts/ProcessComponent__.js +6 -4
  119. package/out/concepts/ProcessComponent__.js.map +1 -1
  120. package/out/concepts/ProcessElement__.js +22 -14
  121. package/out/concepts/ProcessElement__.js.map +1 -1
  122. package/out/concepts/ProcessOutcome__.d.ts +1 -2
  123. package/out/concepts/ProcessOutcome__.js +16 -1
  124. package/out/concepts/ProcessOutcome__.js.map +1 -1
  125. package/out/concepts/ProcessOutcomes__.d.ts +1 -2
  126. package/out/concepts/ProcessOutcomes__.js +16 -1
  127. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  128. package/out/concepts/Process__.js +15 -10
  129. package/out/concepts/Process__.js.map +1 -1
  130. package/out/concepts/QueryAggregateExpression__.js +2 -1
  131. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  132. package/out/concepts/QueryFromExpression__.js +2 -1
  133. package/out/concepts/QueryFromExpression__.js.map +1 -1
  134. package/out/concepts/QueryGroupByExpression__.js +2 -1
  135. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  136. package/out/concepts/QueryJoinExpression__.js +3 -2
  137. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  138. package/out/concepts/QueryLimitExpression__.js +2 -1
  139. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  140. package/out/concepts/QueryOrderByExpression__.js +2 -1
  141. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  142. package/out/concepts/QuerySelectExpression__.js +3 -2
  143. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  144. package/out/concepts/Return__.js +4 -3
  145. package/out/concepts/Return__.js.map +1 -1
  146. package/out/concepts/SelectMembers__.js +3 -2
  147. package/out/concepts/SelectMembers__.js.map +1 -1
  148. package/out/concepts/Slot__.js +2 -1
  149. package/out/concepts/Slot__.js.map +1 -1
  150. package/out/concepts/SqlQueryComponent__.js +2 -1
  151. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  152. package/out/concepts/StringInterpolation__.js +5 -2
  153. package/out/concepts/StringInterpolation__.js.map +1 -1
  154. package/out/concepts/StructureProperty__.js +2 -1
  155. package/out/concepts/StructureProperty__.js.map +1 -1
  156. package/out/concepts/Structure__.js +6 -4
  157. package/out/concepts/Structure__.js.map +1 -1
  158. package/out/concepts/SwitchCase__.js +2 -1
  159. package/out/concepts/SwitchCase__.js.map +1 -1
  160. package/out/concepts/SwitchStatement__.js +2 -1
  161. package/out/concepts/SwitchStatement__.js.map +1 -1
  162. package/out/concepts/TriggerEvent__.js +3 -2
  163. package/out/concepts/TriggerEvent__.js.map +1 -1
  164. package/out/concepts/TypeAnnotation__.js +9 -4
  165. package/out/concepts/TypeAnnotation__.js.map +1 -1
  166. package/out/concepts/UnaryExpression__.js +2 -1
  167. package/out/concepts/UnaryExpression__.js.map +1 -1
  168. package/out/concepts/ValidationRule__.js +2 -1
  169. package/out/concepts/ValidationRule__.js.map +1 -1
  170. package/out/concepts/Variable__.js +4 -3
  171. package/out/concepts/Variable__.js.map +1 -1
  172. package/out/concepts/ViewElement__.js +26 -5
  173. package/out/concepts/ViewElement__.js.map +1 -1
  174. package/out/concepts/View__.js +9 -4
  175. package/out/concepts/View__.js.map +1 -1
  176. package/out/concepts/WhileStatement__.js +2 -1
  177. package/out/concepts/WhileStatement__.js.map +1 -1
  178. package/out/concepts/types__.d.ts +2 -3
  179. package/out/decorators/index.d.ts +3 -3
  180. package/out/generator/genBundleFiles.js +4 -4
  181. package/out/generator/genMetaData.js +4 -4
  182. package/out/generator/genMetaData.js.map +1 -1
  183. package/out/generator/genReleaseBody.js +7 -5
  184. package/out/generator/genReleaseBody.js.map +1 -1
  185. package/out/generator/icestark.d.ts +1 -1
  186. package/out/generator/icestark.js +4 -2
  187. package/out/generator/icestark.js.map +1 -1
  188. package/out/generator/qiankun.d.ts +1 -1
  189. package/out/generator/qiankun.js +3 -1
  190. package/out/generator/qiankun.js.map +1 -1
  191. package/out/server/formatTsUtils.d.ts +3 -3
  192. package/out/server/getMemberIdentifier.d.ts +4 -4
  193. package/out/server/getMemberIdentifier.js +2 -2
  194. package/out/server/getMemberIdentifier.js.map +1 -1
  195. package/out/server/naslServer.js +2 -2
  196. package/out/server/naslServer.js.map +1 -1
  197. package/out/server/translator.js +11 -0
  198. package/out/server/translator.js.map +1 -1
  199. package/out/service/storage/jsoner.js +20 -1
  200. package/out/service/storage/jsoner.js.map +1 -1
  201. package/out/translator/utils.d.ts +1 -0
  202. package/out/translator/utils.js +16 -2
  203. package/out/translator/utils.js.map +1 -1
  204. package/package.json +1 -1
  205. package/sandbox/stdlib/nasl.oql.ts +6 -1
  206. package/sandbox/stdlib/nasl.util.ts +142 -142
  207. package/src/automate/template/myProcess.js +3 -2
  208. package/src/common/BaseNode.ts +64 -33
  209. package/src/concepts/Anchor__.ts +2 -1
  210. package/src/concepts/AnonymousFunction__.ts +6 -3
  211. package/src/concepts/Argument__.ts +7 -6
  212. package/src/concepts/Assignment__.ts +17 -17
  213. package/src/concepts/Attribute__.ts +2 -1
  214. package/src/concepts/AuthLogicForCallInterface__.ts +3 -2
  215. package/src/concepts/BackendVariable__.ts +7 -6
  216. package/src/concepts/BatchAssignment__.ts +7 -5
  217. package/src/concepts/BinaryExpression__.ts +10 -12
  218. package/src/concepts/BindAttribute__.ts +18 -15
  219. package/src/concepts/BindDirective__.ts +15 -14
  220. package/src/concepts/BindEvent__.ts +5 -3
  221. package/src/concepts/BindStyle__.ts +2 -1
  222. package/src/concepts/CallAuthInterface__.ts +5 -2
  223. package/src/concepts/CallFunction__.ts +17 -5
  224. package/src/concepts/CallInterface__.ts +18 -13
  225. package/src/concepts/CallLogic__.ts +22 -9
  226. package/src/concepts/CallQueryComponent__.ts +8 -14
  227. package/src/concepts/CompletionProperty__.ts +2 -1
  228. package/src/concepts/ConfigGroup__.ts +3 -2
  229. package/src/concepts/ConfigProperty__.ts +3 -2
  230. package/src/concepts/Configuration__.ts +3 -2
  231. package/src/concepts/Connection__.ts +3 -2
  232. package/src/concepts/Connector__.ts +15 -10
  233. package/src/concepts/Constant__.ts +2 -1
  234. package/src/concepts/DataSource__.ts +3 -2
  235. package/src/concepts/Destination__.ts +2 -1
  236. package/src/concepts/EntityProperty__.ts +7 -3
  237. package/src/concepts/Entity__.ts +6 -4
  238. package/src/concepts/Enum__.ts +2 -1
  239. package/src/concepts/Event__.ts +3 -2
  240. package/src/concepts/ExternalDestination__.ts +2 -1
  241. package/src/concepts/ForEachStatement__.ts +4 -2
  242. package/src/concepts/Frontend__.ts +14 -9
  243. package/src/concepts/Function__.ts +11 -6
  244. package/src/concepts/Identifier__.ts +7 -4
  245. package/src/concepts/IfStatement__.ts +2 -1
  246. package/src/concepts/InterfaceParam__.ts +2 -1
  247. package/src/concepts/Interface__.ts +6 -3
  248. package/src/concepts/JSBlock__.ts +24 -25
  249. package/src/concepts/Logic__.ts +26 -20
  250. package/src/concepts/MatchCase__.ts +6 -4
  251. package/src/concepts/Match__.ts +2 -1
  252. package/src/concepts/MemberExpression__.ts +2 -1
  253. package/src/concepts/MetadataType__.ts +18 -17
  254. package/src/concepts/MsgTriggerEvent__.ts +3 -2
  255. package/src/concepts/MsgTriggerLauncher__.ts +3 -2
  256. package/src/concepts/Namespace__.ts +33 -22
  257. package/src/concepts/NewComposite__.ts +37 -18
  258. package/src/concepts/NewList__.ts +13 -11
  259. package/src/concepts/NewMap__.ts +11 -9
  260. package/src/concepts/NumericLiteral__.ts +2 -1
  261. package/src/concepts/OqlQueryComponent__.ts +9 -8
  262. package/src/concepts/OverriddenLogic__.ts +13 -7
  263. package/src/concepts/Param__.ts +15 -14
  264. package/src/concepts/ProcessComponent__.ts +6 -4
  265. package/src/concepts/ProcessElement__.ts +22 -14
  266. package/src/concepts/ProcessOutcome__.ts +17 -2
  267. package/src/concepts/ProcessOutcomes__.ts +17 -2
  268. package/src/concepts/Process__.ts +15 -10
  269. package/src/concepts/QueryAggregateExpression__.ts +2 -1
  270. package/src/concepts/QueryFromExpression__.ts +2 -1
  271. package/src/concepts/QueryGroupByExpression__.ts +2 -1
  272. package/src/concepts/QueryJoinExpression__.ts +3 -2
  273. package/src/concepts/QueryLimitExpression__.ts +2 -1
  274. package/src/concepts/QueryOrderByExpression__.ts +2 -1
  275. package/src/concepts/QuerySelectExpression__.ts +3 -2
  276. package/src/concepts/Return__.ts +7 -6
  277. package/src/concepts/SelectMembers__.ts +3 -2
  278. package/src/concepts/Slot__.ts +2 -1
  279. package/src/concepts/SqlQueryComponent__.ts +2 -1
  280. package/src/concepts/StringInterpolation__.ts +13 -3
  281. package/src/concepts/StructureProperty__.ts +2 -1
  282. package/src/concepts/Structure__.ts +6 -4
  283. package/src/concepts/SwitchCase__.ts +2 -1
  284. package/src/concepts/SwitchStatement__.ts +2 -1
  285. package/src/concepts/TriggerEvent__.ts +3 -2
  286. package/src/concepts/TypeAnnotation__.ts +35 -28
  287. package/src/concepts/UnaryExpression__.ts +2 -1
  288. package/src/concepts/ValidationRule__.ts +2 -1
  289. package/src/concepts/Variable__.ts +7 -6
  290. package/src/concepts/ViewElement__.ts +27 -8
  291. package/src/concepts/View__.ts +12 -7
  292. package/src/concepts/WhileStatement__.ts +2 -1
  293. package/src/concepts/types__.ts +2 -4
  294. package/src/decorators/index.ts +4 -4
  295. package/src/generator/genBundleFiles.ts +4 -4
  296. package/src/generator/genMetaData.ts +4 -4
  297. package/src/generator/genReleaseBody.ts +8 -4
  298. package/src/generator/icestark.ts +4 -2
  299. package/src/generator/qiankun.ts +3 -1
  300. package/src/server/formatTsUtils.ts +8 -8
  301. package/src/server/getMemberIdentifier.ts +6 -6
  302. package/src/server/naslServer.ts +4 -4
  303. package/src/server/translator.ts +10 -1
  304. package/src/service/storage/init.ts +2 -2
  305. package/src/service/storage/jsoner.ts +24 -3
  306. package/src/translator/utils.ts +15 -1
@@ -312,7 +312,8 @@ export class BindDirective extends BaseNode {
312
312
  // @ts-ignore
313
313
  const n = logicItem.__v_raw || logicItem;
314
314
  if (Array.isArray((t as any)[parentKey])) {
315
- const index = (t as any)[parentKey].indexOf(n);
315
+ // @ts-ignore
316
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
316
317
  ~index && (this as any)[parentKey].splice(index, 1);
317
318
  params.index = index;
318
319
  } else if ((t as any)[parentKey] === n) {
@@ -532,18 +533,18 @@ export class BindDirective extends BaseNode {
532
533
  let str = '';
533
534
  // eslint-disable-next-line no-nested-ternary
534
535
  let value = this.value;
535
- if(this.type === 'string') {
536
- value = value.replace(/['"`\\]/g, (m) => {
537
- let escape = '\\\\';
538
- escape = '\\\\';
539
- /// #if process.env.BUILD_TARGET === 'node'
540
- escape = '\\';
541
- /// #endif
542
- if (m === '\\') {
543
- return `${escape}${escape}`;
544
- }
545
- return `${escape}${m}`;
546
- });
536
+ if (this.type === 'string') {
537
+ value = value.replace(/['"`\\]/g, (m) => {
538
+ let escape = '\\\\';
539
+ escape = '\\\\';
540
+ /// #if process.env.BUILD_TARGET === 'node'
541
+ escape = '\\';
542
+ /// #endif
543
+ if (m === '\\') {
544
+ return `${escape}${escape}`;
545
+ }
546
+ return `${escape}${m}`;
547
+ });
547
548
  }
548
549
  value = (this.type ?? 'string') !== 'string' ? this.value : value ? `\`${value}\`` : '';
549
550
  // 需要用标识符替换
@@ -558,7 +559,7 @@ export class BindDirective extends BaseNode {
558
559
  }
559
560
  }
560
561
  if (value !== undefined && value !== null && typeof value === 'string') {
561
- value = value?.replace(/"/g, "'");
562
+ value = value?.replace(/"/g, "'");
562
563
  }
563
564
  if (this.name === 'auth' && !!this.value) {
564
565
  const regex = /(.\w+\[name=\w+\])/g;
@@ -169,7 +169,7 @@ export class BindEvent extends BaseNode {
169
169
 
170
170
  getLogicExistingNames(excludedList: Array<Logic> = []) {
171
171
  const excludedSet = new Set(excludedList);
172
- return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
172
+ return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
173
173
  }
174
174
  getLogicUniqueName(name = 'logic1') {
175
175
  return utils.unique(name, this.getLogicExistingNames(), undefined, true);
@@ -461,7 +461,8 @@ export class BindEvent extends BaseNode {
461
461
  // @ts-ignore
462
462
  const n = logic.__v_raw || logic;
463
463
  if (Array.isArray((t as any)[parentKey])) {
464
- const index = (t as any)[parentKey].indexOf(n);
464
+ // @ts-ignore
465
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
465
466
  ~index && (this as any)[parentKey].splice(index, 1);
466
467
  params.index = index;
467
468
  } else if ((t as any)[parentKey] === n) {
@@ -499,7 +500,8 @@ export class BindEvent extends BaseNode {
499
500
  // @ts-ignore
500
501
  const n = logicItem.__v_raw || logicItem;
501
502
  if (Array.isArray((t as any)[parentKey])) {
502
- const index = (t as any)[parentKey].indexOf(n);
503
+ // @ts-ignore
504
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
503
505
  ~index && (this as any)[parentKey].splice(index, 1);
504
506
  params.index = index;
505
507
  } else if ((t as any)[parentKey] === n) {
@@ -277,7 +277,8 @@ export class BindStyle extends BaseNode {
277
277
  // @ts-ignore
278
278
  const n = logicItem.__v_raw || logicItem;
279
279
  if (Array.isArray((t as any)[parentKey])) {
280
- const index = (t as any)[parentKey].indexOf(n);
280
+ // @ts-ignore
281
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
281
282
  ~index && (this as any)[parentKey].splice(index, 1);
282
283
  params.index = index;
283
284
  } else if ((t as any)[parentKey] === n) {
@@ -55,7 +55,9 @@ export class CallAuthInterface extends CallInterface {
55
55
 
56
56
  getArgumentExistingNames(excludedList: Array<Argument> = []) {
57
57
  const excludedSet = new Set(excludedList);
58
- return ((this.authArguments as Argument[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
58
+ return ((this.authArguments as Argument[]) || [])
59
+ .filter((item) => !excludedSet.has(item))
60
+ .map((item) => item?.name);
59
61
  }
60
62
  getArgumentUniqueName(name = 'argument1') {
61
63
  return utils.unique(name, this.getArgumentExistingNames(), undefined, false);
@@ -247,7 +249,8 @@ export class CallAuthInterface extends CallInterface {
247
249
  // @ts-ignore
248
250
  const n = logicItem.__v_raw || logicItem;
249
251
  if (Array.isArray((t as any)[parentKey])) {
250
- const index = (t as any)[parentKey].indexOf(n);
252
+ // @ts-ignore
253
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
251
254
  ~index && (this as any)[parentKey].splice(index, 1);
252
255
  params.index = index;
253
256
  } else if ((t as any)[parentKey] === n) {
@@ -1,4 +1,12 @@
1
- import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, transfromMetadataType } from '../translator';
1
+ import {
2
+ TranslatorState,
3
+ shiftState,
4
+ withSourceMap,
5
+ indent,
6
+ createCompilerState,
7
+ transfromMetadataType,
8
+ transfromUnionTypeAnnotation,
9
+ } from '../translator';
2
10
  import Function from './Function__';
3
11
  import { ElementToVueOptions } from './ViewElement__';
4
12
  import Identifier from './Identifier__';
@@ -317,7 +325,8 @@ export class CallFunction extends LogicItem {
317
325
  // @ts-ignore
318
326
  const n = typeAnnotation.__v_raw || typeAnnotation;
319
327
  if (Array.isArray((t as any)[parentKey])) {
320
- const index = (t as any)[parentKey].indexOf(n);
328
+ // @ts-ignore
329
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
321
330
  ~index && (this as any)[parentKey].splice(index, 1);
322
331
  params.index = index;
323
332
  } else if ((t as any)[parentKey] === n) {
@@ -355,7 +364,8 @@ export class CallFunction extends LogicItem {
355
364
  // @ts-ignore
356
365
  const n = logicItem.__v_raw || logicItem;
357
366
  if (Array.isArray((t as any)[parentKey])) {
358
- const index = (t as any)[parentKey].indexOf(n);
367
+ // @ts-ignore
368
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
359
369
  ~index && (this as any)[parentKey].splice(index, 1);
360
370
  params.index = index;
361
371
  } else if ((t as any)[parentKey] === n) {
@@ -395,7 +405,8 @@ export class CallFunction extends LogicItem {
395
405
  this.arguments?.forEach((arg: any, index) => {
396
406
  let argStr = arg?.toVue(options);
397
407
  const argTypeAnnotation = arg.typeAnnotation || arg.__TypeAnnotation;
398
- const { sortedTypeKey } = transfromMetadataType(argTypeAnnotation, this.app)
408
+ transfromUnionTypeAnnotation(argTypeAnnotation, this.app);
409
+ const { sortedTypeKey } = transfromMetadataType(argTypeAnnotation, this.app);
399
410
  if (needToString) {
400
411
  argStr = `$utils['ToString']('${sortedTypeKey}', ${argStr})`;
401
412
  } else if (['HasValue'].includes(this.calleeName)) {
@@ -473,7 +484,8 @@ export class CallFunction extends LogicItem {
473
484
  this.arguments.forEach((arg: any, index) => {
474
485
  let argStr = arg?.toJS(shiftState(state, code));
475
486
  const argTypeAnnotation = arg.typeAnnotation || arg.__TypeAnnotation;
476
- const { sortedTypeKey } = transfromMetadataType(argTypeAnnotation, this.app)
487
+ transfromUnionTypeAnnotation(argTypeAnnotation, this.app);
488
+ const { sortedTypeKey } = transfromMetadataType(argTypeAnnotation, this.app);
477
489
  if (needToString) {
478
490
  argStr = `this.$utils['ToString']('${sortedTypeKey}', ${argStr})`;
479
491
  } else if (['HasValue'].includes(this.calleeName)) {
@@ -212,7 +212,8 @@ export class CallInterface extends LogicItem {
212
212
  // @ts-ignore
213
213
  const n = logicItem.__v_raw || logicItem;
214
214
  if (Array.isArray((t as any)[parentKey])) {
215
- const index = (t as any)[parentKey].indexOf(n);
215
+ // @ts-ignore
216
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
216
217
  ~index && (this as any)[parentKey].splice(index, 1);
217
218
  params.index = index;
218
219
  } else if ((t as any)[parentKey] === n) {
@@ -622,25 +623,29 @@ export class CallInterface extends LogicItem {
622
623
  setCallee(_interface: Interface) {
623
624
  const calleeNamespace = _interface.getNamespace();
624
625
  const calleeName = _interface.name;
625
- const params = _interface.params.map((param) => {
626
+ // 保留之前的参数
627
+ const params = _interface.params.reduce((res, param) => {
626
628
  const oldArgument = this.arguments.find((node) => node.keyword === param.name);
627
- return Argument.from(
628
- {
629
- keyword: param.name,
630
- expression: oldArgument ? oldArgument.expression : undefined,
631
- },
632
- this,
633
- 'arguments',
634
- );
635
- });
629
+ if (oldArgument && oldArgument.expression) {
630
+ res.push(Argument.from(
631
+ {
632
+ keyword: param.name,
633
+ expression: oldArgument.expression,
634
+ },
635
+ this,
636
+ 'arguments',
637
+ ));
638
+ }
639
+ return res
640
+ }, []);
636
641
  const oldArguments = this.arguments.reduce((res, argumentNode) => {
637
642
  const targetParam = _interface.params.find((item) => item.name === argumentNode.keyword);
638
- if (!targetParam) {
643
+ if (!targetParam && argumentNode && argumentNode.expression) {
639
644
  res.push(
640
645
  Argument.from(
641
646
  {
642
647
  keyword: argumentNode.keyword,
643
- expression: argumentNode ? argumentNode.expression : undefined,
648
+ expression: argumentNode.expression,
644
649
  },
645
650
  this,
646
651
  'arguments',
@@ -1,5 +1,11 @@
1
1
  import * as JSON5 from 'json5';
2
- import { TranslatorState, shiftState, withSourceMap, createCompilerState } from '../translator';
2
+ import {
3
+ TranslatorState,
4
+ shiftState,
5
+ withSourceMap,
6
+ createCompilerState,
7
+ transfromUnionTypeAnnotation,
8
+ } from '../translator';
3
9
  import Logic from './Logic__';
4
10
  import type Param from './Param__';
5
11
  import View from './View__';
@@ -376,7 +382,8 @@ export class CallLogic extends LogicItem {
376
382
  // @ts-ignore
377
383
  const n = typeAnnotation.__v_raw || typeAnnotation;
378
384
  if (Array.isArray((t as any)[parentKey])) {
379
- const index = (t as any)[parentKey].indexOf(n);
385
+ // @ts-ignore
386
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
380
387
  ~index && (this as any)[parentKey].splice(index, 1);
381
388
  params.index = index;
382
389
  } else if ((t as any)[parentKey] === n) {
@@ -414,7 +421,8 @@ export class CallLogic extends LogicItem {
414
421
  // @ts-ignore
415
422
  const n = logicItem.__v_raw || logicItem;
416
423
  if (Array.isArray((t as any)[parentKey])) {
417
- const index = (t as any)[parentKey].indexOf(n);
424
+ // @ts-ignore
425
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
418
426
  ~index && (this as any)[parentKey].splice(index, 1);
419
427
  params.index = index;
420
428
  } else if ((t as any)[parentKey] === n) {
@@ -466,7 +474,8 @@ export class CallLogic extends LogicItem {
466
474
  // @ts-ignore
467
475
  const n = bindAttribute.__v_raw || bindAttribute;
468
476
  if (Array.isArray((t as any)[parentKey])) {
469
- const index = (t as any)[parentKey].indexOf(n);
477
+ // @ts-ignore
478
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
470
479
  ~index && (this as any)[parentKey].splice(index, 1);
471
480
  params.index = index;
472
481
  } else if ((t as any)[parentKey] === n) {
@@ -828,7 +837,7 @@ export class CallLogic extends LogicItem {
828
837
 
829
838
  const keywordProcessIndex = findConceptKeyWordIndexFromNamespace(calleeNamespace, 'processes');
830
839
  const isProcessLogic = keywordProcessIndex !== -1;
831
- const isFrontendLibrary = calleeNamespace.startsWith('extensions') && calleeNamespace.indexOf('frontends');
840
+ const isFrontendLibrary = calleeNamespace?.startsWith('extensions') && calleeNamespace?.indexOf('frontends');
832
841
  // calleeNamespace不存在,一定是页面逻辑
833
842
  if (calleeNamespace) {
834
843
  const namespaceArr = calleeNamespace.split('.');
@@ -847,8 +856,9 @@ export class CallLogic extends LogicItem {
847
856
  const args = logic?.params || [];
848
857
  const keywordEntitiesIndex = findConceptKeyWordIndexFromNamespace(this.calleeNamespace, 'entities');
849
858
 
850
- code += `this.$logics['${this.calleeNamespace ? `${this.calleeNamespace}.${this.calleeName}` : this.calleeName
851
- }']`;
859
+ code += `this.$logics['${
860
+ this.calleeNamespace ? `${this.calleeNamespace}.${this.calleeName}` : this.calleeName
861
+ }']`;
852
862
  code += `({
853
863
  config: {
854
864
  download: false,
@@ -1050,9 +1060,12 @@ export class CallLogic extends LogicItem {
1050
1060
  if (needToString) {
1051
1061
  const arg = this.arguments[0];
1052
1062
  const argTypeAnnotation = (arg as any).typeAnnotation || arg.__TypeAnnotation;
1063
+ transfromUnionTypeAnnotation(argTypeAnnotation, this.app);
1053
1064
  let sortedTypeKey = argTypeAnnotation?.sortedTypeKey;
1054
1065
  if (argTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
1055
- const referenceNode = this.app.findNodeByCompleteName(argTypeAnnotation.typeNamespace + '.' + argTypeAnnotation.typeName) || {}
1066
+ const referenceNode =
1067
+ this.app.findNodeByCompleteName(argTypeAnnotation.typeNamespace + '.' + argTypeAnnotation.typeName) ||
1068
+ {};
1056
1069
  const typeAn = referenceNode.typeAnnotation || {};
1057
1070
  sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
1058
1071
  }
@@ -1448,7 +1461,7 @@ export class CallLogic extends LogicItem {
1448
1461
  state: Array.isArray(t) ? 2 : 1,
1449
1462
  };
1450
1463
  });
1451
- } catch (err) { }
1464
+ } catch (err) {}
1452
1465
  }
1453
1466
  return node;
1454
1467
  }
@@ -712,7 +712,8 @@ export class CallQueryComponent extends LogicItem {
712
712
  // @ts-ignore
713
713
  const n = typeAnnotation.__v_raw || typeAnnotation;
714
714
  if (Array.isArray((t as any)[parentKey])) {
715
- const index = (t as any)[parentKey].indexOf(n);
715
+ // @ts-ignore
716
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
716
717
  ~index && (this as any)[parentKey].splice(index, 1);
717
718
  params.index = index;
718
719
  } else if ((t as any)[parentKey] === n) {
@@ -908,7 +909,8 @@ export class CallQueryComponent extends LogicItem {
908
909
  // @ts-ignore
909
910
  const n = logicItem.__v_raw || logicItem;
910
911
  if (Array.isArray((t as any)[parentKey])) {
911
- const index = (t as any)[parentKey].indexOf(n);
912
+ // @ts-ignore
913
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
912
914
  ~index && (this as any)[parentKey].splice(index, 1);
913
915
  params.index = index;
914
916
  } else if ((t as any)[parentKey] === n) {
@@ -1214,20 +1216,12 @@ export class CallQueryComponent extends LogicItem {
1214
1216
  if (['COUNT', 'COUNTD'].includes(item.aggregateName)) {
1215
1217
  typeName = 'Long';
1216
1218
  } else if (['AVG'].includes(item.aggregateName)) {
1217
- const { entityAsName, propertyName } = item.aggregateParam;
1218
- const entity = entities.find((item: Entity) => item.name === entityAsName);
1219
- const property = entity?.properties.find((item: any) => item.name === propertyName);
1220
- const propertyTypeName = property?.typeAnnotation?.typeName;
1221
- if (propertyTypeName === 'Decimal') {
1222
- typeName = 'Decimal';
1223
- } else {
1224
- typeName = 'Decimal';
1225
- }
1219
+ typeName = 'Decimal';
1226
1220
  } else {
1227
1221
  const { entityAsName, propertyName } = item.aggregateParam;
1228
- const entity = entities.find((item: Entity) => item.name === entityAsName);
1229
- const property = entity?.properties.find((item) => item.name === propertyName);
1230
- typeName = property?.typeAnnotation?.typeName;
1222
+ const entity = entities.find((e: Entity) => e.name === entityAsName);
1223
+ const prop = entity?.properties.find((p) => p.name === propertyName);
1224
+ typeName = prop?.typeAnnotation?.typeName;
1231
1225
  }
1232
1226
  return {
1233
1227
  concept: 'StructureProperty',
@@ -215,7 +215,8 @@ export class CompletionProperty extends BaseNode {
215
215
  // @ts-ignore
216
216
  const n = typeAnnotation.__v_raw || typeAnnotation;
217
217
  if (Array.isArray((t as any)[parentKey])) {
218
- const index = (t as any)[parentKey].indexOf(n);
218
+ // @ts-ignore
219
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
219
220
  ~index && (this as any)[parentKey].splice(index, 1);
220
221
  params.index = index;
221
222
  } else if ((t as any)[parentKey] === n) {
@@ -91,7 +91,7 @@ export class ConfigGroup extends BaseNode {
91
91
  const excludedSet = new Set(excludedList);
92
92
  return ((this.properties as ConfigProperty[]) || [])
93
93
  .filter((item) => !excludedSet.has(item))
94
- .map((item) => item.name);
94
+ .map((item) => item?.name);
95
95
  }
96
96
  getConfigPropertyUniqueName(name = 'configProperty1') {
97
97
  return utils.unique(name, this.getConfigPropertyExistingNames(), undefined, false);
@@ -283,7 +283,8 @@ export class ConfigGroup extends BaseNode {
283
283
  // @ts-ignore
284
284
  const n = configProperty.__v_raw || configProperty;
285
285
  if (Array.isArray((t as any)[parentKey])) {
286
- const index = (t as any)[parentKey].indexOf(n);
286
+ // @ts-ignore
287
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
287
288
  ~index && (this as any)[parentKey].splice(index, 1);
288
289
  params.index = index;
289
290
  } else if ((t as any)[parentKey] === n) {
@@ -115,7 +115,7 @@ export class ConfigProperty extends BaseNode {
115
115
  const excludedSet = new Set(excludedList);
116
116
  return ((this.values as ConfigPropertyValue[]) || [])
117
117
  .filter((item) => !excludedSet.has(item))
118
- .map((item) => item.name);
118
+ .map((item) => item?.name);
119
119
  }
120
120
  getConfigPropertyValueUniqueName(name = 'configPropertyValue1') {
121
121
  return utils.unique(name, this.getConfigPropertyValueExistingNames(), undefined, false);
@@ -313,7 +313,8 @@ export class ConfigProperty extends BaseNode {
313
313
  // @ts-ignore
314
314
  const n = configPropertyValue.__v_raw || configPropertyValue;
315
315
  if (Array.isArray((t as any)[parentKey])) {
316
- const index = (t as any)[parentKey].indexOf(n);
316
+ // @ts-ignore
317
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
317
318
  ~index && (this as any)[parentKey].splice(index, 1);
318
319
  params.index = index;
319
320
  } else if ((t as any)[parentKey] === n) {
@@ -69,7 +69,7 @@ export class Configuration extends BaseNode {
69
69
 
70
70
  getConfigGroupExistingNames(excludedList: Array<ConfigGroup> = []) {
71
71
  const excludedSet = new Set(excludedList);
72
- return ((this.groups as ConfigGroup[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
72
+ return ((this.groups as ConfigGroup[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
73
73
  }
74
74
  getConfigGroupUniqueName(name = 'configGroup1') {
75
75
  return utils.unique(name, this.getConfigGroupExistingNames(), undefined, false);
@@ -261,7 +261,8 @@ export class Configuration extends BaseNode {
261
261
  // @ts-ignore
262
262
  const n = configGroup.__v_raw || configGroup;
263
263
  if (Array.isArray((t as any)[parentKey])) {
264
- const index = (t as any)[parentKey].indexOf(n);
264
+ // @ts-ignore
265
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
265
266
  ~index && (this as any)[parentKey].splice(index, 1);
266
267
  params.index = index;
267
268
  } else if ((t as any)[parentKey] === n) {
@@ -150,7 +150,7 @@ export class Connection extends BaseNode {
150
150
  const excludedSet = new Set(excludedList);
151
151
  return ((this.properties as ConfigProperty[]) || [])
152
152
  .filter((item) => !excludedSet.has(item))
153
- .map((item) => item.name);
153
+ .map((item) => item?.name);
154
154
  }
155
155
  getConfigPropertyUniqueName(name = 'configProperty1') {
156
156
  return utils.unique(name, this.getConfigPropertyExistingNames(), undefined, false);
@@ -342,7 +342,8 @@ export class Connection extends BaseNode {
342
342
  // @ts-ignore
343
343
  const n = configProperty.__v_raw || configProperty;
344
344
  if (Array.isArray((t as any)[parentKey])) {
345
- const index = (t as any)[parentKey].indexOf(n);
345
+ // @ts-ignore
346
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
346
347
  ~index && (this as any)[parentKey].splice(index, 1);
347
348
  params.index = index;
348
349
  } else if ((t as any)[parentKey] === n) {
@@ -294,7 +294,7 @@ export class Connector extends Module {
294
294
 
295
295
  getParamExistingNames(excludedList: Array<Param> = []) {
296
296
  const excludedSet = new Set(excludedList);
297
- return ((this.properties as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
297
+ return ((this.properties as Param[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
298
298
  }
299
299
  getParamUniqueName(name = 'param1') {
300
300
  return utils.unique(name, this.getParamExistingNames(), undefined, false);
@@ -447,7 +447,7 @@ export class Connector extends Module {
447
447
 
448
448
  getLogicExistingNames(excludedList: Array<Logic> = []) {
449
449
  const excludedSet = new Set(excludedList);
450
- return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
450
+ return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
451
451
  }
452
452
  getLogicUniqueName(name = 'logic1') {
453
453
  return utils.unique(name, this.getLogicExistingNames(), undefined, false);
@@ -602,7 +602,7 @@ export class Connector extends Module {
602
602
  const excludedSet = new Set(excludedList);
603
603
  return ((this.triggers as ConnectorTrigger[]) || [])
604
604
  .filter((item) => !excludedSet.has(item))
605
- .map((item) => item.name);
605
+ .map((item) => item?.name);
606
606
  }
607
607
  getConnectorTriggerUniqueName(name = 'connectorTrigger1') {
608
608
  return utils.unique(name, this.getConnectorTriggerExistingNames(), undefined, false);
@@ -755,7 +755,7 @@ export class Connector extends Module {
755
755
 
756
756
  getStructureExistingNames(excludedList: Array<Structure> = []) {
757
757
  const excludedSet = new Set(excludedList);
758
- return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
758
+ return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
759
759
  }
760
760
  getStructureUniqueName(name = 'structure1') {
761
761
  return utils.unique(name, this.getStructureExistingNames(), undefined, false);
@@ -908,7 +908,7 @@ export class Connector extends Module {
908
908
 
909
909
  getNamespaceExistingNames(excludedList: Array<Namespace> = []) {
910
910
  const excludedSet = new Set(excludedList);
911
- return ((this.namespaces as Namespace[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
911
+ return ((this.namespaces as Namespace[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
912
912
  }
913
913
  getNamespaceUniqueName(name = 'namespace1') {
914
914
  return utils.unique(name, this.getNamespaceExistingNames(), undefined, false);
@@ -1100,7 +1100,8 @@ export class Connector extends Module {
1100
1100
  // @ts-ignore
1101
1101
  const n = param.__v_raw || param;
1102
1102
  if (Array.isArray((t as any)[parentKey])) {
1103
- const index = (t as any)[parentKey].indexOf(n);
1103
+ // @ts-ignore
1104
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
1104
1105
  ~index && (this as any)[parentKey].splice(index, 1);
1105
1106
  params.index = index;
1106
1107
  } else if ((t as any)[parentKey] === n) {
@@ -1202,7 +1203,8 @@ export class Connector extends Module {
1202
1203
  // @ts-ignore
1203
1204
  const n = logic.__v_raw || logic;
1204
1205
  if (Array.isArray((t as any)[parentKey])) {
1205
- const index = (t as any)[parentKey].indexOf(n);
1206
+ // @ts-ignore
1207
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
1206
1208
  ~index && (this as any)[parentKey].splice(index, 1);
1207
1209
  params.index = index;
1208
1210
  } else if ((t as any)[parentKey] === n) {
@@ -1254,7 +1256,8 @@ export class Connector extends Module {
1254
1256
  // @ts-ignore
1255
1257
  const n = connectorTrigger.__v_raw || connectorTrigger;
1256
1258
  if (Array.isArray((t as any)[parentKey])) {
1257
- const index = (t as any)[parentKey].indexOf(n);
1259
+ // @ts-ignore
1260
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
1258
1261
  ~index && (this as any)[parentKey].splice(index, 1);
1259
1262
  params.index = index;
1260
1263
  } else if ((t as any)[parentKey] === n) {
@@ -1306,7 +1309,8 @@ export class Connector extends Module {
1306
1309
  // @ts-ignore
1307
1310
  const n = structure.__v_raw || structure;
1308
1311
  if (Array.isArray((t as any)[parentKey])) {
1309
- const index = (t as any)[parentKey].indexOf(n);
1312
+ // @ts-ignore
1313
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
1310
1314
  ~index && (this as any)[parentKey].splice(index, 1);
1311
1315
  params.index = index;
1312
1316
  } else if ((t as any)[parentKey] === n) {
@@ -1358,7 +1362,8 @@ export class Connector extends Module {
1358
1362
  // @ts-ignore
1359
1363
  const n = namespace.__v_raw || namespace;
1360
1364
  if (Array.isArray((t as any)[parentKey])) {
1361
- const index = (t as any)[parentKey].indexOf(n);
1365
+ // @ts-ignore
1366
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
1362
1367
  ~index && (this as any)[parentKey].splice(index, 1);
1363
1368
  params.index = index;
1364
1369
  } else if ((t as any)[parentKey] === n) {
@@ -216,7 +216,8 @@ export class Constant extends BaseNode {
216
216
  // @ts-ignore
217
217
  const n = typeAnnotation.__v_raw || typeAnnotation;
218
218
  if (Array.isArray((t as any)[parentKey])) {
219
- const index = (t as any)[parentKey].indexOf(n);
219
+ // @ts-ignore
220
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
220
221
  ~index && (this as any)[parentKey].splice(index, 1);
221
222
  params.index = index;
222
223
  } else if ((t as any)[parentKey] === n) {
@@ -110,7 +110,7 @@ export class DataSource extends BaseNode {
110
110
 
111
111
  getEntityExistingNames(excludedList: Array<Entity> = []) {
112
112
  const excludedSet = new Set(excludedList);
113
- return ((this.entities as Entity[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
113
+ return ((this.entities as Entity[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
114
114
  }
115
115
  getEntityUniqueName(name = 'Entity1') {
116
116
  return utils.unique(name, this.getEntityExistingNames(), undefined, true);
@@ -302,7 +302,8 @@ export class DataSource extends BaseNode {
302
302
  // @ts-ignore
303
303
  const n = entity.__v_raw || entity;
304
304
  if (Array.isArray((t as any)[parentKey])) {
305
- const index = (t as any)[parentKey].indexOf(n);
305
+ // @ts-ignore
306
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
306
307
  ~index && (this as any)[parentKey].splice(index, 1);
307
308
  params.index = index;
308
309
  } else if ((t as any)[parentKey] === n) {
@@ -290,7 +290,8 @@ export class Destination extends LogicItem {
290
290
  // @ts-ignore
291
291
  const n = logicItem.__v_raw || logicItem;
292
292
  if (Array.isArray((t as any)[parentKey])) {
293
- const index = (t as any)[parentKey].indexOf(n);
293
+ // @ts-ignore
294
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
294
295
  ~index && (this as any)[parentKey].splice(index, 1);
295
296
  params.index = index;
296
297
  } else if ((t as any)[parentKey] === n) {
@@ -342,7 +342,8 @@ export class EntityProperty extends BaseNode {
342
342
  // @ts-ignore
343
343
  const n = typeAnnotation.__v_raw || typeAnnotation;
344
344
  if (Array.isArray((t as any)[parentKey])) {
345
- const index = (t as any)[parentKey].indexOf(n);
345
+ // @ts-ignore
346
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
346
347
  ~index && (this as any)[parentKey].splice(index, 1);
347
348
  params.index = index;
348
349
  } else if ((t as any)[parentKey] === n) {
@@ -394,7 +395,8 @@ export class EntityProperty extends BaseNode {
394
395
  // @ts-ignore
395
396
  const n = databaseTypeAnnotation.__v_raw || databaseTypeAnnotation;
396
397
  if (Array.isArray((t as any)[parentKey])) {
397
- const index = (t as any)[parentKey].indexOf(n);
398
+ // @ts-ignore
399
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
398
400
  ~index && (this as any)[parentKey].splice(index, 1);
399
401
  params.index = index;
400
402
  } else if ((t as any)[parentKey] === n) {
@@ -767,7 +769,9 @@ export class EntityProperty extends BaseNode {
767
769
  let databaseTypeInfo;
768
770
  const items = this.typeAnnotation;
769
771
  if (items?.typeNamespace?.endsWith('.metadataTypes')) {
770
- const referenceNode = (this.getAncestor('App') as App).findNodeByCompleteName(items.typeNamespace + '.' + items.typeName)?.typeAnnotation || {};
772
+ const referenceNode =
773
+ (this.getAncestor('App') as App).findNodeByCompleteName(items.typeNamespace + '.' + items.typeName)
774
+ ?.typeAnnotation || {};
771
775
  typeKind = referenceNode.typeKind;
772
776
  typeName = referenceNode.typeName;
773
777
  typeNamespace = referenceNode.typeNamespace;
@@ -139,7 +139,7 @@ export class Entity extends BaseNode {
139
139
  const excludedSet = new Set(excludedList);
140
140
  return ((this.properties as EntityProperty[]) || [])
141
141
  .filter((item) => !excludedSet.has(item))
142
- .map((item) => item.name);
142
+ .map((item) => item?.name);
143
143
  }
144
144
  getPropertyUniqueName(name = 'property1') {
145
145
  return utils.unique(name, this.getPropertyExistingNames(), undefined, false);
@@ -292,7 +292,7 @@ export class Entity extends BaseNode {
292
292
 
293
293
  getEntityIndexExistingNames(excludedList: Array<EntityIndex> = []) {
294
294
  const excludedSet = new Set(excludedList);
295
- return ((this.indexes as EntityIndex[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
295
+ return ((this.indexes as EntityIndex[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item?.name);
296
296
  }
297
297
  getEntityIndexUniqueName(name = 'entityIndex1') {
298
298
  return utils.unique(name, this.getEntityIndexExistingNames(), undefined, false);
@@ -484,7 +484,8 @@ export class Entity extends BaseNode {
484
484
  // @ts-ignore
485
485
  const n = property.__v_raw || property;
486
486
  if (Array.isArray((t as any)[parentKey])) {
487
- const index = (t as any)[parentKey].indexOf(n);
487
+ // @ts-ignore
488
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
488
489
  ~index && (this as any)[parentKey].splice(index, 1);
489
490
  params.index = index;
490
491
  } else if ((t as any)[parentKey] === n) {
@@ -536,7 +537,8 @@ export class Entity extends BaseNode {
536
537
  // @ts-ignore
537
538
  const n = entityIndex.__v_raw || entityIndex;
538
539
  if (Array.isArray((t as any)[parentKey])) {
539
- const index = (t as any)[parentKey].indexOf(n);
540
+ // @ts-ignore
541
+ const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
540
542
  ~index && (this as any)[parentKey].splice(index, 1);
541
543
  params.index = index;
542
544
  } else if ((t as any)[parentKey] === n) {