@lcap/nasl 3.3.0-alpha.1 → 3.3.0-alpha.2

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 (260) hide show
  1. package/out/concepts/Abort__.js +2 -1
  2. package/out/concepts/Abort__.js.map +1 -1
  3. package/out/concepts/Anchor__.js +1 -1
  4. package/out/concepts/Anchor__.js.map +1 -1
  5. package/out/concepts/AnonymousFunction__.js +2 -2
  6. package/out/concepts/AnonymousFunction__.js.map +1 -1
  7. package/out/concepts/Argument__.js +1 -1
  8. package/out/concepts/Argument__.js.map +1 -1
  9. package/out/concepts/Assignee__.js.map +1 -1
  10. package/out/concepts/AssignmentLine__.js +1 -1
  11. package/out/concepts/AssignmentLine__.js.map +1 -1
  12. package/out/concepts/Assignment__.js +2 -2
  13. package/out/concepts/Assignment__.js.map +1 -1
  14. package/out/concepts/BackendVariable__.js +1 -1
  15. package/out/concepts/BackendVariable__.js.map +1 -1
  16. package/out/concepts/Backend__.js +1 -1
  17. package/out/concepts/Backend__.js.map +1 -1
  18. package/out/concepts/BatchAssignment__.js +2 -2
  19. package/out/concepts/BatchAssignment__.js.map +1 -1
  20. package/out/concepts/BinaryExpression__.js +2 -2
  21. package/out/concepts/BinaryExpression__.js.map +1 -1
  22. package/out/concepts/BindAttribute__.js +2 -2
  23. package/out/concepts/BindAttribute__.js.map +1 -1
  24. package/out/concepts/BindDirective__.js +1 -1
  25. package/out/concepts/BindDirective__.js.map +1 -1
  26. package/out/concepts/BindEvent__.js +1 -1
  27. package/out/concepts/BindEvent__.js.map +1 -1
  28. package/out/concepts/BindStyle__.js +1 -1
  29. package/out/concepts/BindStyle__.js.map +1 -1
  30. package/out/concepts/BooleanLiteral__.js +1 -1
  31. package/out/concepts/BooleanLiteral__.js.map +1 -1
  32. package/out/concepts/CallAuthInterface__.js +1 -1
  33. package/out/concepts/CallAuthInterface__.js.map +1 -1
  34. package/out/concepts/CallConnector__.js +1 -1
  35. package/out/concepts/CallConnector__.js.map +1 -1
  36. package/out/concepts/CallFunction__.js +2 -2
  37. package/out/concepts/CallFunction__.js.map +1 -1
  38. package/out/concepts/CallInterface__.js +2 -2
  39. package/out/concepts/CallInterface__.js.map +1 -1
  40. package/out/concepts/CallLogic__.js +2 -2
  41. package/out/concepts/CallLogic__.js.map +1 -1
  42. package/out/concepts/CallQueryComponent__.js +1 -1
  43. package/out/concepts/CallQueryComponent__.js.map +1 -1
  44. package/out/concepts/Comment__.js +1 -1
  45. package/out/concepts/Comment__.js.map +1 -1
  46. package/out/concepts/ConfigProperty__.js +1 -1
  47. package/out/concepts/ConfigProperty__.js.map +1 -1
  48. package/out/concepts/Constant__.js +1 -1
  49. package/out/concepts/Constant__.js.map +1 -1
  50. package/out/concepts/DataSource__.js +1 -1
  51. package/out/concepts/DataSource__.js.map +1 -1
  52. package/out/concepts/Destination__.js +2 -2
  53. package/out/concepts/Destination__.js.map +1 -1
  54. package/out/concepts/End__.js +1 -1
  55. package/out/concepts/End__.js.map +1 -1
  56. package/out/concepts/EntityIndex__.js +1 -1
  57. package/out/concepts/EntityIndex__.js.map +1 -1
  58. package/out/concepts/EntityProperty__.js +2 -2
  59. package/out/concepts/EntityProperty__.js.map +1 -1
  60. package/out/concepts/Entity__.js +2 -2
  61. package/out/concepts/Entity__.js.map +1 -1
  62. package/out/concepts/EnumItem__.js +2 -2
  63. package/out/concepts/EnumItem__.js.map +1 -1
  64. package/out/concepts/Enum__.js +2 -2
  65. package/out/concepts/Enum__.js.map +1 -1
  66. package/out/concepts/ForEachStatement__.js +2 -2
  67. package/out/concepts/ForEachStatement__.js.map +1 -1
  68. package/out/concepts/Frontend__.js +1 -1
  69. package/out/concepts/Frontend__.js.map +1 -1
  70. package/out/concepts/Function__.js +2 -2
  71. package/out/concepts/Function__.js.map +1 -1
  72. package/out/concepts/Identifier__.js +1 -1
  73. package/out/concepts/Identifier__.js.map +1 -1
  74. package/out/concepts/IfStatement__.js +2 -2
  75. package/out/concepts/IfStatement__.js.map +1 -1
  76. package/out/concepts/Interface__.js +1 -1
  77. package/out/concepts/Interface__.js.map +1 -1
  78. package/out/concepts/JSBlock__.js +1 -1
  79. package/out/concepts/JSBlock__.js.map +1 -1
  80. package/out/concepts/JavaLogic__.js +1 -1
  81. package/out/concepts/JavaLogic__.js.map +1 -1
  82. package/out/concepts/LogicItem__.js +3 -2
  83. package/out/concepts/LogicItem__.js.map +1 -1
  84. package/out/concepts/Logic__.js +1 -1
  85. package/out/concepts/Logic__.js.map +1 -1
  86. package/out/concepts/MatchCase__.js +1 -1
  87. package/out/concepts/MatchCase__.js.map +1 -1
  88. package/out/concepts/Match__.js +2 -2
  89. package/out/concepts/Match__.js.map +1 -1
  90. package/out/concepts/MemberExpression__.js +2 -2
  91. package/out/concepts/MemberExpression__.js.map +1 -1
  92. package/out/concepts/NewComposite__.js +2 -2
  93. package/out/concepts/NewComposite__.js.map +1 -1
  94. package/out/concepts/NewList__.js +2 -2
  95. package/out/concepts/NewList__.js.map +1 -1
  96. package/out/concepts/NewMap__.js +2 -2
  97. package/out/concepts/NewMap__.js.map +1 -1
  98. package/out/concepts/New__.js +1 -1
  99. package/out/concepts/New__.js.map +1 -1
  100. package/out/concepts/NullLiteral__.js +1 -1
  101. package/out/concepts/NullLiteral__.js.map +1 -1
  102. package/out/concepts/NumericLiteral__.js +1 -1
  103. package/out/concepts/NumericLiteral__.js.map +1 -1
  104. package/out/concepts/OqlQueryComponent__.js +2 -2
  105. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  106. package/out/concepts/Param__.js +1 -1
  107. package/out/concepts/Param__.js.map +1 -1
  108. package/out/concepts/ProcessElement__.js +1 -1
  109. package/out/concepts/ProcessElement__.js.map +1 -1
  110. package/out/concepts/ProcessOutcome__.js +1 -1
  111. package/out/concepts/ProcessOutcome__.js.map +1 -1
  112. package/out/concepts/ProcessOutcomes__.js +1 -1
  113. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  114. package/out/concepts/Process__.js +1 -1
  115. package/out/concepts/Process__.js.map +1 -1
  116. package/out/concepts/QueryAggregateExpression__.js +1 -1
  117. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  118. package/out/concepts/QueryFieldExpression__.js +1 -1
  119. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  120. package/out/concepts/QueryFromExpression__.js +1 -1
  121. package/out/concepts/QueryFromExpression__.js.map +1 -1
  122. package/out/concepts/QueryJoinExpression__.js +1 -1
  123. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  124. package/out/concepts/QueryLimitExpression__.js +1 -1
  125. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  126. package/out/concepts/QueryOrderByExpression__.js +1 -1
  127. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  128. package/out/concepts/Return__.js +2 -2
  129. package/out/concepts/Return__.js.map +1 -1
  130. package/out/concepts/Role__.js +1 -1
  131. package/out/concepts/Role__.js.map +1 -1
  132. package/out/concepts/SelectMembers__.js +1 -1
  133. package/out/concepts/SelectMembers__.js.map +1 -1
  134. package/out/concepts/SqlQueryComponent__.js +2 -2
  135. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  136. package/out/concepts/Start__.js +1 -1
  137. package/out/concepts/Start__.js.map +1 -1
  138. package/out/concepts/StringInterpolation__.js +2 -2
  139. package/out/concepts/StringInterpolation__.js.map +1 -1
  140. package/out/concepts/StringLiteral__.js +1 -1
  141. package/out/concepts/StringLiteral__.js.map +1 -1
  142. package/out/concepts/StructureProperty__.js +2 -2
  143. package/out/concepts/StructureProperty__.js.map +1 -1
  144. package/out/concepts/Structure__.js +2 -2
  145. package/out/concepts/Structure__.js.map +1 -1
  146. package/out/concepts/SwitchCase__.js +1 -1
  147. package/out/concepts/SwitchCase__.js.map +1 -1
  148. package/out/concepts/SwitchStatement__.js +2 -2
  149. package/out/concepts/SwitchStatement__.js.map +1 -1
  150. package/out/concepts/TriggerLauncher__.js +1 -1
  151. package/out/concepts/TriggerLauncher__.js.map +1 -1
  152. package/out/concepts/TypeAnnotation__.js +2 -2
  153. package/out/concepts/TypeAnnotation__.js.map +1 -1
  154. package/out/concepts/TypeParam__.js +1 -1
  155. package/out/concepts/TypeParam__.js.map +1 -1
  156. package/out/concepts/UnaryExpression__.js +2 -2
  157. package/out/concepts/UnaryExpression__.js.map +1 -1
  158. package/out/concepts/ValidationRule__.js +1 -1
  159. package/out/concepts/ValidationRule__.js.map +1 -1
  160. package/out/concepts/Variable__.js +2 -2
  161. package/out/concepts/Variable__.js.map +1 -1
  162. package/out/concepts/ViewElement__.js +1 -1
  163. package/out/concepts/ViewElement__.js.map +1 -1
  164. package/out/concepts/View__.js +2 -2
  165. package/out/concepts/View__.js.map +1 -1
  166. package/out/concepts/WhileStatement__.js +2 -2
  167. package/out/concepts/WhileStatement__.js.map +1 -1
  168. package/out/index.d.ts +1 -0
  169. package/out/index.js +1 -0
  170. package/out/index.js.map +1 -1
  171. package/out/natural/knowledgeMap.js +12 -12
  172. package/out/natural/knowledgeMap.js.map +1 -1
  173. package/package.json +2 -1
  174. package/src/concepts/Abort__.ts +2 -2
  175. package/src/concepts/Anchor__.ts +2 -2
  176. package/src/concepts/AnonymousFunction__.ts +3 -3
  177. package/src/concepts/Argument__.ts +2 -2
  178. package/src/concepts/Assignee__.ts +1 -1
  179. package/src/concepts/AssignmentLine__.ts +2 -2
  180. package/src/concepts/Assignment__.ts +3 -3
  181. package/src/concepts/BackendVariable__.ts +2 -2
  182. package/src/concepts/Backend__.ts +1 -1
  183. package/src/concepts/BatchAssignment__.ts +3 -3
  184. package/src/concepts/BinaryExpression__.ts +3 -3
  185. package/src/concepts/BindAttribute__.ts +3 -3
  186. package/src/concepts/BindDirective__.ts +2 -2
  187. package/src/concepts/BindEvent__.ts +1 -1
  188. package/src/concepts/BindStyle__.ts +2 -2
  189. package/src/concepts/BooleanLiteral__.ts +2 -2
  190. package/src/concepts/CallAuthInterface__.ts +2 -2
  191. package/src/concepts/CallConnector__.ts +2 -2
  192. package/src/concepts/CallFunction__.ts +3 -3
  193. package/src/concepts/CallInterface__.ts +3 -3
  194. package/src/concepts/CallLogic__.ts +3 -3
  195. package/src/concepts/CallQueryComponent__.ts +2 -2
  196. package/src/concepts/Comment__.ts +2 -2
  197. package/src/concepts/ConfigProperty__.ts +2 -2
  198. package/src/concepts/Connection__.ts +1 -1
  199. package/src/concepts/Constant__.ts +2 -2
  200. package/src/concepts/DataSource__.ts +1 -1
  201. package/src/concepts/Destination__.ts +3 -3
  202. package/src/concepts/End__.ts +2 -2
  203. package/src/concepts/EntityIndex__.ts +2 -2
  204. package/src/concepts/EntityProperty__.ts +3 -3
  205. package/src/concepts/Entity__.ts +2 -2
  206. package/src/concepts/EnumItem__.ts +3 -3
  207. package/src/concepts/Enum__.ts +2 -2
  208. package/src/concepts/ForEachStatement__.ts +3 -3
  209. package/src/concepts/Frontend__.ts +1 -1
  210. package/src/concepts/Function__.ts +3 -3
  211. package/src/concepts/Identifier__.ts +2 -2
  212. package/src/concepts/IfStatement__.ts +3 -3
  213. package/src/concepts/Interface__.ts +1 -1
  214. package/src/concepts/JSBlock__.ts +2 -2
  215. package/src/concepts/JavaLogic__.ts +2 -2
  216. package/src/concepts/LogicItem__.ts +3 -3
  217. package/src/concepts/Logic__.ts +1 -1
  218. package/src/concepts/MatchCase__.ts +2 -2
  219. package/src/concepts/Match__.ts +3 -3
  220. package/src/concepts/MemberExpression__.ts +3 -3
  221. package/src/concepts/NewComposite__.ts +3 -3
  222. package/src/concepts/NewList__.ts +3 -3
  223. package/src/concepts/NewMap__.ts +3 -3
  224. package/src/concepts/New__.ts +2 -2
  225. package/src/concepts/NullLiteral__.ts +2 -2
  226. package/src/concepts/NumericLiteral__.ts +2 -2
  227. package/src/concepts/OqlQueryComponent__.ts +3 -3
  228. package/src/concepts/Param__.ts +2 -2
  229. package/src/concepts/ProcessElement__.ts +2 -2
  230. package/src/concepts/ProcessOutcome__.ts +2 -2
  231. package/src/concepts/ProcessOutcomes__.ts +2 -2
  232. package/src/concepts/Process__.ts +1 -1
  233. package/src/concepts/QueryAggregateExpression__.ts +2 -2
  234. package/src/concepts/QueryFieldExpression__.ts +2 -2
  235. package/src/concepts/QueryFromExpression__.ts +2 -2
  236. package/src/concepts/QueryJoinExpression__.ts +2 -2
  237. package/src/concepts/QueryLimitExpression__.ts +2 -2
  238. package/src/concepts/QueryOrderByExpression__.ts +2 -2
  239. package/src/concepts/Return__.ts +3 -3
  240. package/src/concepts/Role__.ts +1 -1
  241. package/src/concepts/SelectMembers__.ts +2 -2
  242. package/src/concepts/SqlQueryComponent__.ts +3 -3
  243. package/src/concepts/Start__.ts +2 -2
  244. package/src/concepts/StringInterpolation__.ts +3 -3
  245. package/src/concepts/StringLiteral__.ts +2 -2
  246. package/src/concepts/StructureProperty__.ts +3 -3
  247. package/src/concepts/Structure__.ts +2 -2
  248. package/src/concepts/SwitchCase__.ts +2 -2
  249. package/src/concepts/SwitchStatement__.ts +3 -3
  250. package/src/concepts/TriggerLauncher__.ts +1 -1
  251. package/src/concepts/TypeAnnotation__.ts +3 -3
  252. package/src/concepts/TypeParam__.ts +2 -2
  253. package/src/concepts/UnaryExpression__.ts +3 -3
  254. package/src/concepts/ValidationRule__.ts +2 -2
  255. package/src/concepts/Variable__.ts +3 -3
  256. package/src/concepts/ViewElement__.ts +2 -2
  257. package/src/concepts/View__.ts +2 -2
  258. package/src/concepts/WhileStatement__.ts +3 -3
  259. package/src/index.ts +1 -0
  260. package/src/natural/knowledgeMap.ts +12 -12
@@ -1,7 +1,7 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import View from './View__';
3
3
  import { getNodeByNodeCallee } from '../automate/engine/utils';
4
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
4
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
5
5
  import { ElementToVueOptions } from './ViewElement__';
6
6
  import { BindAttribute, Param } from '..';
7
7
 
@@ -690,7 +690,7 @@ export class Destination extends LogicItem {
690
690
  }
691
691
 
692
692
  @withSourceMap()
693
- toEmbeddedTS(state?: TranslatorState): string {
693
+ toEmbeddedTS(state = createCompilerState()): string {
694
694
  let code = '';
695
695
 
696
696
  const node = this.viewNode;
@@ -745,7 +745,7 @@ export class Destination extends LogicItem {
745
745
 
746
746
 
747
747
  @withSourceMap()
748
- toNaturalTS(state?: TranslatorState): string {
748
+ toNaturalTS(state = createCompilerState()): string {
749
749
  let code = '';
750
750
 
751
751
  const node = this.viewNode;
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, indent } from '../translator';
2
+ import { TranslatorState, indent, createCompilerState } from '../translator';
3
3
  import Return from './Return__';
4
4
  import Logic from './Logic__';
5
5
  //= ===============================================================================
@@ -64,7 +64,7 @@ export class End extends LogicItem {
64
64
  return code;
65
65
  }
66
66
 
67
- toEmbeddedTS(state?: TranslatorState): string {
67
+ toEmbeddedTS(state = createCompilerState()): string {
68
68
  let code = '';
69
69
  let ret;
70
70
  let logic;
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -180,7 +180,7 @@ export class EntityIndex extends BaseNode {
180
180
  }
181
181
 
182
182
  @withSourceMap()
183
- toEmbeddedTS(state?: TranslatorState): string {
183
+ toEmbeddedTS(state = createCompilerState()): string {
184
184
  return `{ ${this.name}: [${this.propertyNames.map((item) => `this.${item}`).join(', ')}] },`;
185
185
  }
186
186
 
@@ -1,6 +1,6 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import { dataTypesMap } from './basics/types';
3
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
3
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
4
4
  import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
5
5
  import CallQueryComponent from './CallQueryComponent__';
6
6
  import StructureProperty from './StructureProperty__';
@@ -575,7 +575,7 @@ export class EntityProperty extends BaseNode {
575
575
  }
576
576
 
577
577
  @withSourceMap()
578
- toEmbeddedTS(state?: TranslatorState): string {
578
+ toEmbeddedTS(state = createCompilerState()): string {
579
579
  let code = '';
580
580
  if (this.relationNamespace && this.relationEntity && this.relationProperty) {
581
581
  code += `@nasl.annotation.EntityRelation(new ${this.relationNamespace}.${this.relationEntity}().${this.relationProperty})\n`;
@@ -595,7 +595,7 @@ export class EntityProperty extends BaseNode {
595
595
  }
596
596
 
597
597
  @withSourceMap()
598
- toNaturalTS(state?: TranslatorState): string {
598
+ toNaturalTS(state = createCompilerState()): string {
599
599
  let code = '';
600
600
  if (this.relationNamespace && this.relationEntity && this.relationProperty) {
601
601
  code += `@EntityRelation(() => new ${this.relationEntity}().${this.relationProperty})\n`;
@@ -809,7 +809,7 @@ export class Entity extends BaseNode {
809
809
  }
810
810
 
811
811
  @withSourceMap()
812
- toEmbeddedTS(state?: TranslatorState): string {
812
+ toEmbeddedTS(state = createCompilerState()): string {
813
813
  let code = `export class ${this.name} {\n`;
814
814
  code += indent((state?.tabSize || 0) + 1);
815
815
  code += `__name: '${this.getNamespace()}.${this.name}';\n`;
@@ -848,7 +848,7 @@ export class Entity extends BaseNode {
848
848
  }
849
849
 
850
850
  @withSourceMap()
851
- toNaturalTS(state?: TranslatorState): string {
851
+ toNaturalTS(state = createCompilerState()): string {
852
852
  let code = `class ${this.name} {\n`;
853
853
  // code += `${indent(state.tabSize + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
854
854
  this.properties.forEach((property) => {
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -123,12 +123,12 @@ export class EnumItem extends BaseNode {
123
123
  expression: undefined;
124
124
 
125
125
  @withSourceMap()
126
- toEmbeddedTS(state?: TranslatorState): string {
126
+ toEmbeddedTS(state = createCompilerState()): string {
127
127
  return `static '${this.value}': ${this.enumeration.name}`;
128
128
  }
129
129
 
130
130
  @withSourceMap()
131
- toNaturalTS(state?: TranslatorState): string {
131
+ toNaturalTS(state = createCompilerState()): string {
132
132
  return `'${this.value}' = '${this.label}'`;
133
133
  }
134
134
 
@@ -295,7 +295,7 @@ export class Enum extends BaseNode {
295
295
  }
296
296
 
297
297
  @withSourceMap()
298
- toEmbeddedTS(state?: TranslatorState): string {
298
+ toEmbeddedTS(state = createCompilerState()): string {
299
299
  let code = `export class ${this.name} extends nasl.core.Enums {\n`;
300
300
  // 增加一个单独的标签
301
301
  code += `${indent((state?.tabSize || 0) + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
@@ -316,7 +316,7 @@ export class Enum extends BaseNode {
316
316
  }
317
317
 
318
318
  @withSourceMap()
319
- toNaturalTS(state?: TranslatorState): string {
319
+ toNaturalTS(state = createCompilerState()): string {
320
320
  let code = `enum ${this.name} {\n`;
321
321
  this.enumItems.forEach((property) => {
322
322
  code += indent(state.tabSize + 1);
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import TypeAnnotation from './TypeAnnotation__';
4
4
  import Identifier from './Identifier__';
5
5
  import MemberExpression from './MemberExpression__';
@@ -529,7 +529,7 @@ export class ForEachStatement extends LogicItem {
529
529
  }
530
530
 
531
531
  @withSourceMap()
532
- toEmbeddedTS(state?: TranslatorState): string {
532
+ toEmbeddedTS(state = createCompilerState()): string {
533
533
  let code = '';
534
534
  code += this.each
535
535
  ? this.each.toEmbeddedTS(
@@ -572,7 +572,7 @@ export class ForEachStatement extends LogicItem {
572
572
  }
573
573
 
574
574
  @withSourceMap()
575
- toNaturalTS(state?: TranslatorState): string {
575
+ toNaturalTS(state = createCompilerState()): string {
576
576
  let code = '';
577
577
  code += this.each
578
578
  ? this.each.toNaturalTS(
@@ -1162,7 +1162,7 @@ export class Frontend extends BaseNode {
1162
1162
  }
1163
1163
 
1164
1164
  @withSourceMap()
1165
- toEmbeddedTS(state?: TranslatorState): string {
1165
+ toEmbeddedTS(state = createCompilerState()): string {
1166
1166
  let code = `export namespace ${this.name} {\n`;
1167
1167
  code += 'const name = ';
1168
1168
  code += `"${this.name}";\n`;
@@ -1,6 +1,6 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import Namespace from './Namespace__';
3
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
3
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
4
4
  import { ElementToVueOptions } from './ViewElement__';
5
5
  import asyncFuncMap from '../common/asyncFuncMap';
6
6
 
@@ -1047,7 +1047,7 @@ export class Function extends BaseNode {
1047
1047
  }
1048
1048
 
1049
1049
  @withSourceMap()
1050
- toEmbeddedTS(state?: TranslatorState): string {
1050
+ toEmbeddedTS(state = createCompilerState()): string {
1051
1051
  let code = '';
1052
1052
  if (this.returnExpression) {
1053
1053
  code += `(`;
@@ -1074,7 +1074,7 @@ export class Function extends BaseNode {
1074
1074
  }
1075
1075
 
1076
1076
  @withSourceMap()
1077
- toNaturalTS(state?: TranslatorState): string {
1077
+ toNaturalTS(state = createCompilerState()): string {
1078
1078
  let code = '';
1079
1079
  if (this.returnExpression) {
1080
1080
  code += `(`;
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
  import { BindAttribute, CallLogic, TypeAnnotation } from '..';
4
4
  import { ElementToVueOptions } from './ViewElement__';
5
5
  import { findConceptKeyWordByNamespace } from '../utils';
@@ -201,7 +201,7 @@ export class Identifier extends LogicItem {
201
201
  }
202
202
 
203
203
  @withSourceMap()
204
- toEmbeddedTS(state?: TranslatorState): string {
204
+ toEmbeddedTS(state = createCompilerState()): string {
205
205
  // 只有data-source可以是函数 ,也可能是属性
206
206
  if (this.parentNode instanceof BindAttribute && this.parentNode.name === 'data-source') {
207
207
  const { view } = this;
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
 
4
4
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -417,7 +417,7 @@ export class IfStatement extends LogicItem {
417
417
  }
418
418
 
419
419
  @withSourceMap()
420
- toEmbeddedTS(state?: TranslatorState): string {
420
+ toEmbeddedTS(state = createCompilerState()): string {
421
421
  let code = '';
422
422
  code += 'if (nasl.core.ensureBoolean(';
423
423
  code += this.test
@@ -456,7 +456,7 @@ export class IfStatement extends LogicItem {
456
456
  }
457
457
 
458
458
  @withSourceMap()
459
- toNaturalTS(state?: TranslatorState): string {
459
+ toNaturalTS(state = createCompilerState()): string {
460
460
  let code = '';
461
461
  code += 'if (';
462
462
  code += this.test ? this.test.toNaturalTS(shiftState(state, code, {
@@ -896,7 +896,7 @@ export class Interface extends BaseNode {
896
896
  }
897
897
 
898
898
  @withSourceMap()
899
- toEmbeddedTS(state?: TranslatorState): string {
899
+ toEmbeddedTS(state = createCompilerState()): string {
900
900
  let code = '';
901
901
  const getCheckerCode = () => {
902
902
  if (this.validation) {
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { withSourceMap, TranslatorState } from '../translator';
2
+ import { withSourceMap, TranslatorState, createCompilerState } from '../translator';
3
3
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -80,7 +80,7 @@ export class JSBlock extends LogicItem {
80
80
  }
81
81
 
82
82
  @withSourceMap()
83
- toEmbeddedTS(state?: TranslatorState): string {
83
+ toEmbeddedTS(state = createCompilerState()): string {
84
84
  return 'nasl.core.universalVariable';
85
85
  }
86
86
 
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, indent } from '../translator';
2
+ import { TranslatorState, indent, createCompilerState } from '../translator';
3
3
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -81,7 +81,7 @@ export class JavaLogic extends LogicItem {
81
81
  * @param state 编译状态
82
82
  * @returns 生成的代码
83
83
  */
84
- toEmbeddedTS(state?: TranslatorState): string {
84
+ toEmbeddedTS(state = createCompilerState()): string {
85
85
  let code = '';
86
86
  const ret = this.logic.returns[0];
87
87
  if (ret) {
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState } from '../translator';
2
+ import { TranslatorState, createCompilerState } from '../translator';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
4
  import CallQueryComponent from './CallQueryComponent__';
5
5
  import CallInterface from './CallInterface__';
@@ -330,7 +330,7 @@ export class LogicItem extends BaseNode {
330
330
  * @param state 编译状态
331
331
  * @returns 生成的代码
332
332
  */
333
- toEmbeddedTS(state?: TranslatorState): string {
333
+ toEmbeddedTS(state = createCompilerState()): string {
334
334
  return this.toJS(state);
335
335
  }
336
336
 
@@ -339,7 +339,7 @@ export class LogicItem extends BaseNode {
339
339
  * @param state 编译状态
340
340
  * @returns 生成的代码
341
341
  */
342
- toNaturalTS(state?: TranslatorState): string {
342
+ toNaturalTS(state = createCompilerState()): string {
343
343
  return this.toEmbeddedTS(state);
344
344
  }
345
345
 
@@ -1884,7 +1884,7 @@ export class Logic extends BaseNode {
1884
1884
  }
1885
1885
 
1886
1886
  @withSourceMap()
1887
- toNaturalTS(state?: TranslatorState, prefix?: string, logicName?: string): string {
1887
+ toNaturalTS(state = createCompilerState(), prefix?: string, logicName?: string): string {
1888
1888
  if (!logicName) {
1889
1889
  if (this.parentNode instanceof BindEvent && this.parentNode.parentNode instanceof View) {
1890
1890
  logicName = `on_view_${this.name}`;
@@ -1,6 +1,6 @@
1
1
  // @ts-nocheck
2
2
  import { v4 as uuidv4 } from 'uuid';
3
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
3
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
4
4
  import Match from './Match__';
5
5
  import MemberExpression from './MemberExpression__';
6
6
  import BooleanLiteral from './BooleanLiteral__';
@@ -842,7 +842,7 @@ export class MatchCase extends LogicItem {
842
842
 
843
843
 
844
844
  @withSourceMap()
845
- toNaturalTS(state?: TranslatorState, index?: number, parentCode?: string): string {
845
+ toNaturalTS(state = createCompilerState(), index?: number, parentCode?: string): string {
846
846
  let code = '\n';
847
847
 
848
848
  const parentNode = (this.parentNode as Match);
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import TypeAnnotation, { isUnion } from './TypeAnnotation__';
4
4
  import BooleanLiteral from './BooleanLiteral__';
5
5
  import MemberExpression from './MemberExpression__';
@@ -675,7 +675,7 @@ export class Match extends LogicItem {
675
675
  }
676
676
 
677
677
  @withSourceMap()
678
- toEmbeddedTS(state?: TranslatorState): string {
678
+ toEmbeddedTS(state = createCompilerState()): string {
679
679
  let code = '';
680
680
 
681
681
  if (this.parentNode.concept === 'Logic') {
@@ -733,7 +733,7 @@ export class Match extends LogicItem {
733
733
  }
734
734
 
735
735
  @withSourceMap()
736
- toNaturalTS(state?: TranslatorState): string {
736
+ toNaturalTS(state = createCompilerState()): string {
737
737
  let code = '';
738
738
 
739
739
  if (this.parentNode?.concept === 'Logic') {
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, createCompilerState } from '../translator';
3
3
  import { Enum, TypeAnnotation } from '..';
4
4
  import { ElementToVueOptions } from './ViewElement__';
5
5
  import Identifier from './Identifier__';
@@ -324,7 +324,7 @@ export class MemberExpression extends LogicItem {
324
324
  * @returns
325
325
  */
326
326
  @withSourceMap()
327
- toEmbeddedTS(state?: TranslatorState): string {
327
+ toEmbeddedTS(state = createCompilerState()): string {
328
328
  let code = '';
329
329
  const leftCode = this.object ? `${this.object.toEmbeddedTS(shiftState(state, code, { inline: true }))}.` : '';
330
330
  code += this.object ? `${this.object.toEmbeddedTS(shiftState(state, code, { inline: true }))}.` : '';
@@ -341,7 +341,7 @@ export class MemberExpression extends LogicItem {
341
341
  }
342
342
 
343
343
  @withSourceMap()
344
- toNaturalTS(state?: TranslatorState): string {
344
+ toNaturalTS(state = createCompilerState()): string {
345
345
  let code = '';
346
346
  const leftCode = this.object ? `${this.object.toNaturalTS(shiftState(state, code, { inline: true }))}.` : '';
347
347
  code += this.object ? `${this.object.toNaturalTS(shiftState(state, code, { inline: true }))}.` : '';
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
4
  import MemberExpression from './MemberExpression__';
5
5
  import StructureProperty from './StructureProperty__';
@@ -1167,7 +1167,7 @@ export class NewComposite extends LogicItem {
1167
1167
  }
1168
1168
 
1169
1169
  @withSourceMap()
1170
- toEmbeddedTS(state?: TranslatorState): string {
1170
+ toEmbeddedTS(state = createCompilerState()): string {
1171
1171
  const indent0 = indent(state?.tabSize || 0);
1172
1172
  const indent1 = indent((state?.tabSize || 0) + 1);
1173
1173
  const indent2 = indent((state?.tabSize || 0) + 2);
@@ -1325,7 +1325,7 @@ export class NewComposite extends LogicItem {
1325
1325
  }
1326
1326
 
1327
1327
  @withSourceMap()
1328
- toNaturalTS(state?: TranslatorState): string {
1328
+ toNaturalTS(state = createCompilerState()): string {
1329
1329
  const indent0 = indent((state?.tabSize || 0));
1330
1330
  const indent1 = indent((state?.tabSize || 0) + 1);
1331
1331
  const indent2 = indent((state?.tabSize || 0) + 2);
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import AnonymousFunction from './AnonymousFunction__';
4
4
  import { ElementToVueOptions } from './ViewElement__';
5
5
  //= ===============================================================================
@@ -378,7 +378,7 @@ export class NewList extends LogicItem {
378
378
  }
379
379
 
380
380
  @withSourceMap()
381
- toEmbeddedTS(state?: TranslatorState): string {
381
+ toEmbeddedTS(state = createCompilerState()): string {
382
382
  const indent0 = indent(state?.tabSize || 0);
383
383
  const indent1 = indent((state?.tabSize || 0) + 1);
384
384
  const indent2 = indent((state?.tabSize || 0) + 2);
@@ -447,7 +447,7 @@ export class NewList extends LogicItem {
447
447
  }
448
448
 
449
449
  @withSourceMap()
450
- toNaturalTS(state?: TranslatorState): string {
450
+ toNaturalTS(state = createCompilerState()): string {
451
451
  const indent0 = indent((state?.tabSize || 0));
452
452
  let code = '';
453
453
  if (this.typeAnnotation) {
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
4
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -584,7 +584,7 @@ export class NewMap extends LogicItem {
584
584
  }
585
585
 
586
586
  @withSourceMap()
587
- toEmbeddedTS(state?: TranslatorState): string {
587
+ toEmbeddedTS(state = createCompilerState()): string {
588
588
  const indent0 = indent(state?.tabSize || 0);
589
589
  const indent1 = indent((state?.tabSize || 0) + 1);
590
590
  const indent2 = indent((state?.tabSize || 0) + 2);
@@ -678,7 +678,7 @@ export class NewMap extends LogicItem {
678
678
  }
679
679
 
680
680
  @withSourceMap()
681
- toNaturalTS(state?: TranslatorState): string {
681
+ toNaturalTS(state = createCompilerState()): string {
682
682
  let code = '';
683
683
  if (this.typeAnnotation) {
684
684
  code += `new ${this.typeAnnotation.sortedTypeKey}()`;
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, createCompilerState } from '../translator';
3
3
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -51,7 +51,7 @@ export class New extends LogicItem {
51
51
  }
52
52
 
53
53
  @withSourceMap()
54
- toEmbeddedTS(state?: TranslatorState): string {
54
+ toEmbeddedTS(state = createCompilerState()): string {
55
55
  const code = '__IDENTIFIER__';
56
56
  return code;
57
57
  }
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
4
 
5
5
  //= ===============================================================================
@@ -64,7 +64,7 @@ export class NullLiteral extends LogicItem {
64
64
  }
65
65
 
66
66
  @withSourceMap()
67
- toEmbeddedTS(state?: TranslatorState) {
67
+ toEmbeddedTS(state = createCompilerState()) {
68
68
  return 'null';
69
69
  }
70
70
 
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
  import { ElementToVueOptions } from './ViewElement__';
4
4
 
5
5
  //= ===============================================================================
@@ -129,7 +129,7 @@ export class NumericLiteral extends LogicItem {
129
129
  }
130
130
 
131
131
  @withSourceMap()
132
- toEmbeddedTS(state?: TranslatorState): string {
132
+ toEmbeddedTS(state = createCompilerState()): string {
133
133
  const type = `${this.typeAnnotation.typeNamespace}.${this.typeAnnotation.typeName}`;
134
134
  const code = this.value ? `new ${type}(${this.value})` : '__IDENTIFIER__';
135
135
  return code;
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
4
4
  import StructureProperty from './StructureProperty__';
5
5
  import Structure from './Structure__';
@@ -229,7 +229,7 @@ export class OqlQueryComponent extends LogicItem {
229
229
  }
230
230
 
231
231
  @withSourceMap()
232
- toEmbeddedTS(state?: TranslatorState): string {
232
+ toEmbeddedTS(state = createCompilerState()): string {
233
233
  let code: string;
234
234
  const { typeAnnotation } = this;
235
235
  if (typeAnnotation) {
@@ -290,7 +290,7 @@ export class OqlQueryComponent extends LogicItem {
290
290
  }
291
291
 
292
292
  @withSourceMap()
293
- toNaturalTS(state?: TranslatorState): string {
293
+ toNaturalTS(state = createCompilerState()): string {
294
294
  const code: string = `nasl.oql.query(\`${this.code}\`)`;
295
295
  return code;
296
296
  }
@@ -1,6 +1,6 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import { dataTypesMap } from './basics/types';
3
- import { TranslatorState, shiftState, withSourceMap } from '../translator';
3
+ import { TranslatorState, shiftState, withSourceMap, createCompilerState } from '../translator';
4
4
  import LogicItem from './LogicItem__';
5
5
  import EntityProperty from './EntityProperty__';
6
6
  import Structure from './Structure__';
@@ -386,7 +386,7 @@ export class Param extends BaseNode {
386
386
  }
387
387
 
388
388
  @withSourceMap()
389
- toNaturalTS(state?: TranslatorState, dontType?: boolean): string {
389
+ toNaturalTS(state = createCompilerState(), dontType?: boolean): string {
390
390
  let code = this.name;
391
391
  // 回调函数类的参数
392
392
  if (this?.typeAnnotation?.typeKind === 'function') {
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
2
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
3
3
  import {
4
4
  genUserTaskLogic,
5
5
  getPreviousTask,
@@ -1660,7 +1660,7 @@ export class ProcessElement extends BaseNode {
1660
1660
  }
1661
1661
 
1662
1662
  @withSourceMap()
1663
- toEmbeddedTS(state?: TranslatorState): string {
1663
+ toEmbeddedTS(state = createCompilerState()): string {
1664
1664
  // this.syncLogic();
1665
1665
  const tab0 = indent(state?.tabSize || 0);
1666
1666
  const tab1 = indent((state?.tabSize || 0) + 1);
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
 
4
4
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -71,7 +71,7 @@ export class ProcessOutcome extends LogicItem {
71
71
  // 自动生成的代码已结束。下面可以手动编写。
72
72
  //= ===============================================================================
73
73
  @withSourceMap()
74
- toEmbeddedTS(state?: TranslatorState): string {
74
+ toEmbeddedTS(state = createCompilerState()): string {
75
75
  const code = `return () => ${this.flowRef ? `"${this.flowRef}"` : '__IDENTIFIER__'}`;
76
76
  return code;
77
77
  }
@@ -1,5 +1,5 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { TranslatorState, withSourceMap } from '../translator';
2
+ import { TranslatorState, withSourceMap, createCompilerState } from '../translator';
3
3
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -70,7 +70,7 @@ export class ProcessOutcomes extends LogicItem {
70
70
  // 自动生成的代码已结束。下面可以手动编写。
71
71
  //= ===============================================================================
72
72
  @withSourceMap()
73
- toEmbeddedTS(state?: TranslatorState): string {
73
+ toEmbeddedTS(state = createCompilerState()): string {
74
74
  const code = `return () => ${this.flowRefs?.length > 0 ? `"${this.flowRefs}"` : '__IDENTIFIER__'}`;
75
75
  return code;
76
76
  }
@@ -1294,7 +1294,7 @@ export class Process extends BaseNode {
1294
1294
  }
1295
1295
 
1296
1296
  @withSourceMap()
1297
- toEmbeddedTS(state?: TranslatorState): string {
1297
+ toEmbeddedTS(state = createCompilerState()): string {
1298
1298
  let code = `export namespace ${this.name} {\n`;
1299
1299
  const tab0 = indent(state?.tabSize || 0);
1300
1300
  const tab1 = indent((state?.tabSize || 0) + 1);