@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
@@ -12,7 +12,7 @@ import {
12
12
  Logic,
13
13
  ConfigProperty,
14
14
  App,
15
- SynatxNode,
15
+ SyntaxNode,
16
16
  BindAttribute,
17
17
  Interface,
18
18
  CallLogic,
@@ -278,7 +278,7 @@ function findNode(typeKey: string, node: BaseNode) {
278
278
  * @param item 当前节点的内容
279
279
  * @param node 获取变量框的位置
280
280
  */
281
- export function nextFindTypeChild(typeKey: string, item: any, node: SynatxNode) {
281
+ export function nextFindTypeChild(typeKey: string, item: any, node: SyntaxNode) {
282
282
  const newType = findNode(typeKey, node);
283
283
  if ((newType as Structure)?.properties && (newType as Structure).properties.length) {
284
284
  // 处理泛型的内容要取到值
@@ -312,7 +312,7 @@ export function nextFindTypeChild(typeKey: string, item: any, node: SynatxNode)
312
312
  lCAPRolePerMapping: dataSources.defaultDS.entities.LCAPRolePerMapping;
313
313
  }>`
314
314
  */
315
- function getAStructureScopeType(type: string, parent: any, node: SynatxNode) {
315
+ function getAStructureScopeType(type: string, parent: any, node: SyntaxNode) {
316
316
  let newType = type
317
317
  .replaceAll(' ', '')
318
318
  .replaceAll('\n', '')
@@ -412,7 +412,7 @@ function getAStructureScopeType(type: string, parent: any, node: SynatxNode) {
412
412
  total: nasl.core.Long;
413
413
  }`
414
414
  */
415
- function getAStructureObjectStringType(type: string, parent: any, node: SynatxNode) {
415
+ function getAStructureObjectStringType(type: string, parent: any, node: SyntaxNode) {
416
416
  let newType = type
417
417
  .replaceAll(' ', '')
418
418
  .replaceAll('\n', '')
@@ -467,7 +467,7 @@ function getAStructureObjectStringType(type: string, parent: any, node: SynatxNo
467
467
  completionProperty.icon = getNodeiconFromLogic(completionProperty, node);
468
468
  return completionProperty;
469
469
  }
470
- function nextObjectTypeChild(typeKey: string, item: any, node: SynatxNode) {
470
+ function nextObjectTypeChild(typeKey: string, item: any, node: SyntaxNode) {
471
471
  const newType = findNode(typeKey, node);
472
472
  if ((newType as Structure)?.properties && (newType as Structure).properties.length) {
473
473
  // 处理泛型的内容要取到值
@@ -492,7 +492,7 @@ function nextObjectTypeChild(typeKey: string, item: any, node: SynatxNode) {
492
492
  }
493
493
  }
494
494
 
495
- function getNodeTypeVariableData(nodeType: any, item: any, node: SynatxNode) {
495
+ function getNodeTypeVariableData(nodeType: any, item: any, node: SyntaxNode) {
496
496
  item.value = item.text;
497
497
  item.name = item.text;
498
498
  const parentExpression = new Identifier({ name: item.text });
@@ -589,7 +589,7 @@ function getNextFlag(typeKey: string, typeKeyMap: Map<string, number>) {
589
589
  return true;
590
590
  }
591
591
  // 格式化变量数据
592
- export function formatVariableData(data: unknown | variableItem[], node: SynatxNode, parent?: any) {
592
+ export function formatVariableData(data: unknown | variableItem[], node: SyntaxNode, parent?: any) {
593
593
  if (Array.isArray(data)) {
594
594
  let result = data.map((item) => {
595
595
  item.children = [];
@@ -688,7 +688,7 @@ export function formatVariableData(data: unknown | variableItem[], node: SynatxN
688
688
  }
689
689
 
690
690
  // 从logic获取节点的icon
691
- function getNodeiconFromLogic(completionProperty: CompletionProperty, node: SynatxNode): string {
691
+ function getNodeiconFromLogic(completionProperty: CompletionProperty, node: SyntaxNode): string {
692
692
  const { name: propName } = completionProperty;
693
693
  const { view } = node as Param;
694
694
  const logic = (node as Param).logic || (node as Param).OverriddenLogic || (node as Param).AuthLogic || (node as Param).AuthLogicForCallInterface;
@@ -11,7 +11,7 @@ import {
11
11
  LogicItem,
12
12
  Frontend,
13
13
  View,
14
- SynatxNode,
14
+ SyntaxNode,
15
15
  ViewElement,
16
16
  PAGE_COMPONENT_INCLUDE_TAG_MAP,
17
17
  } from '..';
@@ -173,10 +173,10 @@ function getCurrentLogic(
173
173
  ) {
174
174
  // 只有data-source check-file可以
175
175
  if (
176
- (node instanceof BindAttribute && (node.name === 'data-source' || node.name === 'check-file')) ||
176
+ (node instanceof BindAttribute && (node.name === 'data-source' || node.name === 'check-file' || node.name === 'can-dragable-handler' || node.name === 'can-dropin-handler')) ||
177
177
  (node instanceof Identifier &&
178
178
  node.parentNode instanceof BindAttribute &&
179
- (node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file'))
179
+ (node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file' || node.parentNode.name === 'can-dragable-handler' || node.parentNode.name === 'can-dropin-handler'))
180
180
  ) {
181
181
  const { view } = node;
182
182
  const viewLogics = view.logics;
@@ -194,7 +194,7 @@ function getCurrentLogic(
194
194
  }
195
195
  }
196
196
 
197
- export async function getMemberIdentifier(node: SynatxNode) {
197
+ export async function getMemberIdentifier(node: SyntaxNode) {
198
198
  if (node) {
199
199
  // 获取字面量
200
200
  const literals = getLiteralsIdentifier();
@@ -278,7 +278,7 @@ export function getBackendVariablesIdentifier(node: BaseNode): CompletionPropert
278
278
  return newvariables;
279
279
  }
280
280
  // 获取变量
281
- export async function getVariableIdentifier(node: SynatxNode): Promise<CompletionProperty[]> {
281
+ export async function getVariableIdentifier(node: SyntaxNode): Promise<CompletionProperty[]> {
282
282
  let completionData: CompletionProperty[] = [new CompletionProperty({})];
283
283
  // 只获取第一层内容
284
284
  const app = node.getAncestor('App');
@@ -474,7 +474,7 @@ function flatElements(elements: ViewElement[], componentList: CompletionProperty
474
474
  }
475
475
 
476
476
  // 获取页面组件
477
- export function getPageComponentsIdentifier(node: SynatxNode): CompletionProperty[] {
477
+ export function getPageComponentsIdentifier(node: SyntaxNode): CompletionProperty[] {
478
478
  const { fileNode } = node.getCurrentSource();
479
479
  const stashElements = (fileNode as View).elements;
480
480
  const componentList: CompletionProperty[] = []
@@ -80,7 +80,7 @@ import {
80
80
  AuthLogicForCallInterface,
81
81
  Connector,
82
82
  AuthInterface,
83
- SynatxNode,
83
+ SyntaxNode,
84
84
  Connection,
85
85
  TriggerLauncher,
86
86
  CallConnector,
@@ -2197,7 +2197,7 @@ class NaslServer {
2197
2197
  }
2198
2198
  }
2199
2199
  }
2200
-
2200
+
2201
2201
  if (node instanceof Return || node instanceof Variable) {
2202
2202
  const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
2203
2203
  if (!node.typeAnnotation && !node.__TypeAnnotation) {
@@ -2320,11 +2320,11 @@ class NaslServer {
2320
2320
 
2321
2321
  _treeMetadataType2CoreType(type: TypeAnnotation, app: App) {
2322
2322
  type.typeArguments?.forEach((item: TypeAnnotation) => {
2323
- if (item.typeNamespace.endsWith('.metadataTypes')) {
2323
+ if (item.typeNamespace?.endsWith('.metadataTypes')) {
2324
2324
  let originType = {} as TypeAnnotation
2325
2325
  if (item.typeNamespace === 'app.metadataTypes') {
2326
2326
  originType = app.metadataTypes?.find((metadataType) => metadataType.name === item.typeName)?.typeAnnotation;
2327
- } else if (item.typeNamespace.startsWith('extensions.') && item.typeNamespace.endsWith('.metadataTypes')) {
2327
+ } else if (item.typeNamespace?.startsWith('extensions.') && item.typeNamespace?.endsWith('.metadataTypes')) {
2328
2328
  const dependencyName = item.typeNamespace.replace('extensions.', '').replace('.metadataTypes', '')
2329
2329
  originType = app.dependencies?.find((dependency) => dependency.name === dependencyName)?.metadataTypes?.find((ele) => ele.name === item.typeName)?.typeAnnotation ?? {} as TypeAnnotation
2330
2330
  }
@@ -33,7 +33,6 @@ import {
33
33
  CallInterface,
34
34
  Return,
35
35
  ProcessElement,
36
- NullLiteral,
37
36
  SwitchCase,
38
37
  WhileStatement,
39
38
  IfStatement,
@@ -41,6 +40,7 @@ import {
41
40
  ForEachStatement,
42
41
  CallFunction,
43
42
  ProcessOutcome,
43
+ ProcessOutcomes,
44
44
  Function,
45
45
  Anchor,
46
46
  BatchAssignment,
@@ -573,6 +573,15 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
573
573
  }
574
574
  } else if (node.parentNode instanceof NewList && text.includes(`parameter of type 'never'`)) {
575
575
  tsErrorDetail.message = '自动推导不出类型!newList中有未知类型';
576
+ } else if (node instanceof ProcessOutcome || node instanceof ProcessOutcomes) {
577
+ const cap = /Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text);
578
+ const selectComes = cap[1].split(' | ');
579
+ const currentComes = cap[2].split(' | ');
580
+ if (node instanceof ProcessOutcome) {
581
+ tsErrorDetail.message = `流向出口不存在,${selectComes.map((item) => item).join(',')}出口流不属于[${currentComes.map((item) => item).join(',')}]当中的某个流`
582
+ } else {
583
+ tsErrorDetail.message = `流向出口不存在,${selectComes.map((item) => item).join(',')}有错误的出口流`
584
+ }
576
585
  }
577
586
  }
578
587
  if (node instanceof Argument || node instanceof Anchor) {
@@ -1,5 +1,5 @@
1
1
  import { cloneDeep } from 'lodash';
2
- import { App, LogicItem, Logic, Module, View, ViewElement, Argument, SelectMembers, SynatxNode, BindDirective, CallLogic } from '../../concepts';
2
+ import { App, LogicItem, Logic, Module, View, ViewElement, Argument, SelectMembers, SyntaxNode, BindDirective, CallLogic } from '../../concepts';
3
3
  import { addBreakpointNodesFromApp } from '../../breakpoint';
4
4
  import { getConceptConstructor } from '../../decorators';
5
5
  import { config } from '../../config';
@@ -454,7 +454,7 @@ async function doAction(app: any, actionItem: any) {
454
454
  try {
455
455
  if (Array.isArray(list)) {
456
456
  list.forEach((event) => {
457
- const emitTarget = event?.originEvent?.target as SynatxNode;
457
+ const emitTarget = event?.originEvent?.target as SyntaxNode;
458
458
  const _path: string = event.originEvent.path;
459
459
  const _root = _path.split('.')?.[1] || '';
460
460
  if (['backend', 'overriddenLogics', 'dataSources', 'processes', 'roles', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies', 'authLogics', 'authLogicsForCallInterface', 'triggerLaunchers', 'connections'].some((item) => _root.startsWith(item))) {
@@ -28,6 +28,27 @@ function excludeProperties(node: any, excludes: string[]) {
28
28
  return newNode;
29
29
  }
30
30
 
31
+ // "app.configuration.groups[name=system].properties[name=system.custom.log.level]"
32
+ function splitPath(path: string) {
33
+ path = path || '';
34
+ const res = [];
35
+ let prevDot = -1;
36
+ let countLeftBracket = 0;
37
+ for(let i=0;i<path.length;i+=1) {
38
+ if(path[i] === '[')
39
+ countLeftBracket += 1;
40
+ else if(path[i] === ']')
41
+ countLeftBracket -= 1;
42
+
43
+ if(path[i] === '.' && countLeftBracket === 0) {
44
+ res.push(path.slice(prevDot+1, i));
45
+ prevDot = i;
46
+ }
47
+ }
48
+ res.push(path.slice(prevDot+1));
49
+ return res;
50
+ }
51
+
31
52
  /**
32
53
  * 通过路径查找节点
33
54
  * @param json 根节点
@@ -35,7 +56,7 @@ function excludeProperties(node: any, excludes: string[]) {
35
56
  * @returns
36
57
  */
37
58
  export function queryNodeByPath(json: any, path: string): any {
38
- const pathArr = path?.split('.') || [];
59
+ const pathArr = splitPath(path);
39
60
  let pathItem = pathArr.shift();
40
61
  let node: any = json;
41
62
  while (pathItem) {
@@ -69,9 +90,9 @@ export async function batchQuery(json: any, queryList: Array<Query>) {
69
90
  if (node) {
70
91
  if (Array.isArray(node)) {
71
92
  return node.map((nodeItem) => excludeProperties(nodeItem, excludes));
72
- }
93
+ }
73
94
  return excludeProperties(node, excludes);
74
-
95
+
75
96
  }
76
97
  return null;
77
98
  });
@@ -121,7 +121,7 @@ export function withSourceMap() {
121
121
  export function transfromMetadataType(expTypeAnnotation: TypeAnnotation, app: App) {
122
122
  let { sortedTypeKey, typeKind, typeNamespace, typeName } = expTypeAnnotation || {};
123
123
  if (expTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
124
- const referenceNode = app.findNodeByCompleteName(expTypeAnnotation.typeNamespace + '.' + expTypeAnnotation.typeName) || {}
124
+ const referenceNode = app?.findNodeByCompleteName(expTypeAnnotation.typeNamespace + '.' + expTypeAnnotation.typeName) || {}
125
125
  const typeAn = referenceNode.typeAnnotation || {};
126
126
  typeKind = typeAn.typeKind;
127
127
  typeNamespace = typeAn.typeNamespace;
@@ -134,4 +134,18 @@ export function transfromMetadataType(expTypeAnnotation: TypeAnnotation, app: Ap
134
134
  typeName,
135
135
  sortedTypeKey
136
136
  }
137
+ }
138
+
139
+ export function transfromUnionTypeAnnotation(expTypeAnnotation: TypeAnnotation, app: App) {
140
+ // 针对union类型,typeAnntatation拿不到app数据,暂时先在这里处理
141
+ if (expTypeAnnotation?.typeKind === 'union' && expTypeAnnotation?.typeArguments?.length) {
142
+ expTypeAnnotation?.typeArguments?.forEach((typeArg: any) => {
143
+ if (typeArg.typeNamespace?.endsWith('.metadataTypes')) {
144
+ const referenceNode = app?.findNodeByCompleteName(typeArg.typeNamespace + '.' + typeArg.typeName)?.typeAnnotation || {};
145
+ typeArg.typeName = referenceNode.typeName
146
+ typeArg.typeKind = referenceNode.typeKind
147
+ typeArg.typeNamespace = referenceNode.typeNamespace
148
+ }
149
+ })
150
+ }
137
151
  }