@lcap/nasl 3.3.0-alpha → 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 +4 -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,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
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -122,7 +122,7 @@ export class QueryAggregateExpression extends LogicItem {
122
122
  }
123
123
 
124
124
  @withSourceMap()
125
- toEmbeddedTS(state?: TranslatorState): string {
125
+ toEmbeddedTS(state = createCompilerState()): string {
126
126
  // const { aggregateName, aggregateParam, asName } = this;
127
127
  // let code = '';
128
128
  // if (aggregateName && aggregateParam) {
@@ -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 CallQueryComponent from './CallQueryComponent__';
4
4
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -132,7 +132,7 @@ export class QueryFieldExpression extends LogicItem {
132
132
  }
133
133
 
134
134
  @withSourceMap()
135
- toEmbeddedTS(state?: TranslatorState): string {
135
+ toEmbeddedTS(state = createCompilerState()): string {
136
136
  const { entityAsName, propertyName, isDotStar } = this;
137
137
  const callQueryComponent = this.getAncestor('CallQueryComponent') as CallQueryComponent;
138
138
  if (callQueryComponent) {
@@ -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 type CallQueryComponent from './CallQueryComponent__';
4
4
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -247,7 +247,7 @@ export class QueryFromExpression extends LogicItem {
247
247
  }
248
248
 
249
249
  @withSourceMap()
250
- toEmbeddedTS(state?: TranslatorState): string {
250
+ toEmbeddedTS(state = createCompilerState()): string {
251
251
  let code = '';
252
252
  code += `nasl.langUtil.FROM(new nasl.langUtil.Collection<[${this.entityKey}]>()`;
253
253
  if (this.joinParts.length) {
@@ -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 CallQueryComponent from './CallQueryComponent__';
4
4
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -439,7 +439,7 @@ export class QueryJoinExpression extends LogicItem {
439
439
  }
440
440
 
441
441
  @withSourceMap()
442
- toEmbeddedTS(state?: TranslatorState): string {
442
+ toEmbeddedTS(state = createCompilerState()): string {
443
443
  let code = '';
444
444
  code += `.${this.joinType}_JOIN(new nasl.langUtil.Collection<[${this.entityKey}]>())\n`;
445
445
  if (this.onExpressions.length > 0) {
@@ -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
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -162,7 +162,7 @@ export class QueryLimitExpression extends LogicItem {
162
162
  //= ===============================================================================
163
163
 
164
164
  @withSourceMap()
165
- toEmbeddedTS(state?: TranslatorState): string {
165
+ toEmbeddedTS(state = createCompilerState()): string {
166
166
  const { pageElement, pageSizeElement } = this;
167
167
  let code = '[';
168
168
  code += `${pageElement.toEmbeddedTS(shiftState(state, 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
  //= ===============================================================================
4
4
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -176,7 +176,7 @@ export class QueryOrderByExpression extends LogicItem {
176
176
  }
177
177
 
178
178
  @withSourceMap()
179
- toEmbeddedTS(state?: TranslatorState): string {
179
+ toEmbeddedTS(state = createCompilerState()): string {
180
180
  const { orderElement, order } = this;
181
181
  let code = '[';
182
182
  code += `${orderElement.toEmbeddedTS(shiftState(state, code))}, `;
@@ -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 EntityProperty from './EntityProperty__';
5
5
  import StructureProperty from './StructureProperty__';
6
6
  import Structure from './Structure__';
@@ -294,7 +294,7 @@ export class Return extends BaseNode {
294
294
  }
295
295
 
296
296
  @withSourceMap()
297
- toEmbeddedTS(state?: TranslatorState): string {
297
+ toEmbeddedTS(state = createCompilerState()): string {
298
298
  let code = this.name || '__return';
299
299
  if (this.typeAnnotation) {
300
300
  code += ': ';
@@ -315,7 +315,7 @@ export class Return extends BaseNode {
315
315
  }
316
316
 
317
317
  @withSourceMap()
318
- toNaturalTS(state?: TranslatorState): string {
318
+ toNaturalTS(state = createCompilerState()): string {
319
319
  let code = this.name || '__return';
320
320
  if (this.typeAnnotation) {
321
321
  code += ': ';
@@ -103,7 +103,7 @@ export class Role extends BaseNode {
103
103
  // 自动生成的代码已结束。下面可以手动编写。
104
104
  //= ===============================================================================
105
105
  @withSourceMap()
106
- toEmbeddedTS(state?: TranslatorState): string {
106
+ toEmbeddedTS(state = createCompilerState()): string {
107
107
  let code = `export enum ${this.tsName} {\n`;
108
108
  code += ` ${this.tsName}='${this.tsName}'\n`;
109
109
  code += `${indent(state?.tabSize || 0)}}\n`;
@@ -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 BatchAssignment from './BatchAssignment__';
4
4
  import AssignmentLine from './AssignmentLine__';
5
5
  //= ===============================================================================
@@ -371,7 +371,7 @@ export class SelectMembers extends BaseNode {
371
371
  }
372
372
 
373
373
  @withSourceMap()
374
- toEmbeddedTS(state?: TranslatorState): string {
374
+ toEmbeddedTS(state = createCompilerState()): string {
375
375
  const code = '';
376
376
  return code;
377
377
  }
@@ -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 SqlQueryComponent 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
  if (this.ideVersion === '2.11') {
235
235
  code = `(function(): `;
@@ -258,7 +258,7 @@ export class SqlQueryComponent extends LogicItem {
258
258
  }
259
259
 
260
260
  @withSourceMap()
261
- toNaturalTS(state?: TranslatorState): string {
261
+ toNaturalTS(state = createCompilerState()): string {
262
262
  const code: string = `nasl.oql.query(\`${this.code}\`)`;
263
263
  return code;
264
264
  }
@@ -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
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -57,7 +57,7 @@ export class Start extends LogicItem {
57
57
  }
58
58
 
59
59
  @withSourceMap()
60
- toEmbeddedTS(state?: TranslatorState): string {
60
+ toEmbeddedTS(state = createCompilerState()): string {
61
61
  return '';
62
62
  }
63
63
 
@@ -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 { ElementToVueOptions } from './ViewElement__';
4
4
  import { StringLiteral } from './StringLiteral__';
5
5
  //= ===============================================================================
@@ -309,7 +309,7 @@ export class StringInterpolation extends LogicItem {
309
309
  }
310
310
 
311
311
  @withSourceMap()
312
- toEmbeddedTS(state?: TranslatorState): string {
312
+ toEmbeddedTS(state = createCompilerState()): string {
313
313
  let code = 'nasl.util.stringInterpolation(';
314
314
  this.expressions.forEach((exp, idx) => {
315
315
  code += exp.toEmbeddedTS(shiftState(state, code));
@@ -322,7 +322,7 @@ export class StringInterpolation extends LogicItem {
322
322
  }
323
323
 
324
324
  @withSourceMap()
325
- toNaturalTS(state?: TranslatorState): string {
325
+ toNaturalTS(state = createCompilerState()): string {
326
326
  let code = '`';
327
327
  this.expressions.forEach((exp) => {
328
328
  if (exp.concept === 'StringLiteral') {
@@ -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
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -105,7 +105,7 @@ export class StringLiteral extends LogicItem {
105
105
  }
106
106
 
107
107
  @withSourceMap()
108
- toNaturalTS(state?: TranslatorState, isRequired?: boolean): string {
108
+ toNaturalTS(state = createCompilerState(), isRequired?: boolean): string {
109
109
  return `'${this.value}'`;
110
110
  }
111
111
 
@@ -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 { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
5
5
  //= ===============================================================================
6
6
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -255,7 +255,7 @@ export class StructureProperty extends BaseNode {
255
255
  isLeaf: boolean = true;
256
256
 
257
257
  @withSourceMap()
258
- toEmbeddedTS(state?: TranslatorState): string {
258
+ toEmbeddedTS(state = createCompilerState()): string {
259
259
  let code = this.name;
260
260
  if (this.typeAnnotation) {
261
261
  code += ': ';
@@ -269,7 +269,7 @@ export class StructureProperty extends BaseNode {
269
269
  }
270
270
 
271
271
  @withSourceMap()
272
- toNaturalTS(state?: TranslatorState): string {
272
+ toNaturalTS(state = createCompilerState()): string {
273
273
  let code = this.name;
274
274
  if (this.typeAnnotation) {
275
275
  code += ': ';
@@ -557,7 +557,7 @@ export class Structure extends BaseNode {
557
557
  }
558
558
 
559
559
  @withSourceMap()
560
- toEmbeddedTS(state?: TranslatorState): string {
560
+ toEmbeddedTS(state = createCompilerState()): string {
561
561
  let code = `export class ${this.tsName} {\n`;
562
562
  code += indent((state?.tabSize || 0) + 1);
563
563
  code += `__name: '${this.getTsNamespace()}.${this.tsName}';\n`;
@@ -572,7 +572,7 @@ export class Structure extends BaseNode {
572
572
  }
573
573
 
574
574
  @withSourceMap()
575
- toNaturalTS(state?: TranslatorState): string {
575
+ toNaturalTS(state = createCompilerState()): string {
576
576
  let code = `class ${this.name} {\n`;
577
577
  // code += `${indent(state.tabSize + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
578
578
  this.properties.forEach((property) => {
@@ -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
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -314,7 +314,7 @@ export class SwitchCase extends LogicItem {
314
314
  }
315
315
 
316
316
  @withSourceMap()
317
- toNaturalTS(state?: TranslatorState, isLast?: boolean, isFirst?: boolean): string {
317
+ toNaturalTS(state = createCompilerState(), isLast?: boolean, isFirst?: boolean): string {
318
318
  let code = '\n';
319
319
  if (!isLast) {
320
320
  code += indent(state.tabSize + 2);
@@ -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
  //= ===============================================================================
5
5
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -218,7 +218,7 @@ export class SwitchStatement extends LogicItem {
218
218
  }
219
219
 
220
220
  @withSourceMap()
221
- toEmbeddedTS(state?: TranslatorState): string {
221
+ toEmbeddedTS(state = createCompilerState()): string {
222
222
  let code = '';
223
223
  // 最后一项是else
224
224
  this.cases.forEach((item, index) => {
@@ -233,7 +233,7 @@ export class SwitchStatement extends LogicItem {
233
233
  }
234
234
 
235
235
  @withSourceMap()
236
- toNaturalTS(state?: TranslatorState): string {
236
+ toNaturalTS(state = createCompilerState()): string {
237
237
  let code = '';
238
238
  // 最后一项是else
239
239
  this.cases.forEach((item, index) => {
@@ -201,7 +201,7 @@ export class TriggerLauncher extends BaseNode {
201
201
  //= ===============================================================================
202
202
 
203
203
  @withSourceMap()
204
- toEmbeddedTS(state?: TranslatorState): string {
204
+ toEmbeddedTS(state = createCompilerState()): string {
205
205
  let code = '';
206
206
  code += `export function ${this.name} () {\n`;
207
207
  try {
@@ -1,7 +1,7 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import App from './App__';
3
3
  import Structure from './Structure__';
4
- import { TranslatorState, shiftState, withSourceMap } from '../translator';
4
+ import { TranslatorState, shiftState, withSourceMap, createCompilerState } from '../translator';
5
5
  import { genHash } from '../generator';
6
6
  import { firstUpperCase } from '../utils/string';
7
7
 
@@ -873,7 +873,7 @@ export class TypeAnnotation extends BaseNode {
873
873
  }
874
874
 
875
875
  @withSourceMap()
876
- toEmbeddedTS(state?: TranslatorState): string {
876
+ toEmbeddedTS(state = createCompilerState()): string {
877
877
  if (this.typeKind === 'primitive' || this.typeKind === 'reference') {
878
878
  if (this.typeKind === 'reference' && this.typeNamespace && this.typeNamespace.endsWith('enums')) {
879
879
  return `${this.tsCalleeNamespace}.${this.typeName}`;
@@ -921,7 +921,7 @@ export class TypeAnnotation extends BaseNode {
921
921
  }
922
922
 
923
923
  @withSourceMap()
924
- toNaturalTS(state?: TranslatorState): string {
924
+ toNaturalTS(state = createCompilerState()): string {
925
925
  if (this.typeKind === 'primitive' || this.typeKind === 'reference') {
926
926
  if (this.typeKind === 'reference' && this.typeNamespace && this.typeNamespace.endsWith('enums')) {
927
927
  return this.tsCalleeNamespace.startsWith('nasl.ui') ? `${this.tsCalleeNamespace}.${this.typeName}` : `${this.typeName}`;
@@ -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 自动生成,请不手动修改!
@@ -61,7 +61,7 @@ export class TypeParam extends BaseNode {
61
61
  }
62
62
 
63
63
  @withSourceMap()
64
- toNaturalTS(state?: TranslatorState, prefix?: string): string {
64
+ toNaturalTS(state = createCompilerState(), prefix?: string): string {
65
65
  return this.name;
66
66
  }
67
67
 
@@ -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 { ElementToVueOptions } from './ViewElement__';
4
4
 
5
5
  //= ===============================================================================
@@ -153,7 +153,7 @@ export class UnaryExpression extends LogicItem {
153
153
  }
154
154
 
155
155
  @withSourceMap()
156
- toEmbeddedTS(state?: TranslatorState): string {
156
+ toEmbeddedTS(state = createCompilerState()): string {
157
157
  if (this.operator === 'isNull') {
158
158
  const fnName = this.operator.toUpperCase();
159
159
  let code = '';
@@ -173,7 +173,7 @@ export class UnaryExpression extends LogicItem {
173
173
  }
174
174
 
175
175
  @withSourceMap()
176
- toNaturalTS(state?: TranslatorState): string {
176
+ toNaturalTS(state = createCompilerState()): string {
177
177
  if (this.operator === 'isNull') {
178
178
  let code = '((';
179
179
  code += this.argument?.toNaturalTS ? this.argument.toNaturalTS(shiftState(state, '', { inline: true })) : '__IDENTIFIER__';
@@ -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 Function from './Function__';
4
4
  import { ElementToVueOptions } from './ViewElement__';
5
5
  import { getValidationInFunction } from '../server/getFunctions';
@@ -461,7 +461,7 @@ export class ValidationRule extends LogicItem {
461
461
  }
462
462
 
463
463
  @withSourceMap()
464
- toEmbeddedTS(state?: TranslatorState): string {
464
+ toEmbeddedTS(state = createCompilerState()): string {
465
465
  let code = '';
466
466
 
467
467
  const { calleeName, target, calleeKey, arguments: args, errorMessage, view } = this;
@@ -1,6 +1,6 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
2
  import { dataTypesMap } from './basics/types';
3
- import { TranslatorState, shiftState, withSourceMap, createCompilerState, indent } from '../translator';
3
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
4
4
  import { ElementToVueOptions } from './ViewElement__';
5
5
  import EntityProperty from './EntityProperty__';
6
6
  import StructureProperty from './StructureProperty__';
@@ -312,7 +312,7 @@ export class Variable extends BaseNode {
312
312
  }
313
313
 
314
314
  @withSourceMap()
315
- toEmbeddedTS(state?: TranslatorState): string {
315
+ toEmbeddedTS(state = createCompilerState()): string {
316
316
  let code = this.name;
317
317
  if (this.typeAnnotation) {
318
318
  code += ': ';
@@ -330,7 +330,7 @@ export class Variable extends BaseNode {
330
330
  }
331
331
 
332
332
  @withSourceMap()
333
- toNaturalTS(state?: TranslatorState): string {
333
+ toNaturalTS(state = createCompilerState()): string {
334
334
  let code = this.name;
335
335
  if (this.typeAnnotation) {
336
336
  code += ': ';
@@ -2,7 +2,7 @@ import * as babelParser from '@babel/parser';
2
2
  import * as json5 from 'json5';
3
3
  import * as compiler from 'vue-template-compiler';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
- import { TranslatorState, shiftState, withSourceMap, indent } from '../translator';
5
+ import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
6
6
  import { stdlibNamespace } from '../concepts';
7
7
 
8
8
  import { LogicItem } from './LogicItem__';
@@ -1723,7 +1723,7 @@ export class ViewElement extends BaseNode {
1723
1723
  }
1724
1724
 
1725
1725
  @withSourceMap()
1726
- toNaturalTS(state?: TranslatorState, parentLevel?: number): string {
1726
+ toNaturalTS(state = createCompilerState(), parentLevel?: number): string {
1727
1727
  let code = '';
1728
1728
  const levelIndex = parentLevel || 0;
1729
1729
  if (Array.isArray(this.bindEvents)) {
@@ -1894,7 +1894,7 @@ export class View extends BaseNode {
1894
1894
  }
1895
1895
 
1896
1896
  @withSourceMap()
1897
- toEmbeddedTS(state?: TranslatorState): string {
1897
+ toEmbeddedTS(state = createCompilerState()): string {
1898
1898
  function chineseTsName(name: string) {
1899
1899
  let tsName = name;
1900
1900
  // 匹配所有特殊字符都转为_
@@ -2074,7 +2074,7 @@ export class View extends BaseNode {
2074
2074
  }
2075
2075
 
2076
2076
  @withSourceMap()
2077
- toNaturalTS(state?: TranslatorState, currentNode?: BaseNode): string {
2077
+ toNaturalTS(state = createCompilerState(), currentNode?: BaseNode): string {
2078
2078
  let code = `export function ${this.tsName}_view`;
2079
2079
  const advanceMap: Map<Variable, Assignment | BatchAssignment> = new Map();
2080
2080
  this.traverseChildren((el) => {
@@ -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
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
5
5
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -264,7 +264,7 @@ export class WhileStatement extends LogicItem {
264
264
  }
265
265
 
266
266
  @withSourceMap()
267
- toEmbeddedTS(state?: TranslatorState): string {
267
+ toEmbeddedTS(state = createCompilerState()): string {
268
268
  let code = '';
269
269
  code += 'while (nasl.core.ensureBoolean(';
270
270
  code += this.test
@@ -291,7 +291,7 @@ export class WhileStatement extends LogicItem {
291
291
  }
292
292
 
293
293
  @withSourceMap()
294
- toNaturalTS(state?: TranslatorState): string {
294
+ toNaturalTS(state = createCompilerState()): string {
295
295
  let code = '';
296
296
  code += 'while (';
297
297
  code += this.test ? this.test.toNaturalTS(shiftState(state, code, {
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from './eventBus';
10
10
  export * as breakpoint from './breakpoint';
11
11
  export { loadApp, loadAppSync, handleApp, batchAction, batchQuery, mountDatabaseTypes } from './service/storage/init';
12
12
  export { createService } from './service/creator';
13
+ export * from './natural';
@@ -4,24 +4,24 @@ const docsMap: any = {};
4
4
  if (globalThis.process) { // For TS build
5
5
  const fs = require('fs');
6
6
  knowledgeMap = {
7
- index: fs.readFileSync(require.resolve('../../docs-for-aigc/index.md'), 'utf8'),
8
- '实体和实体属性、实体索引': fs.readFileSync(require.resolve('../../docs-for-aigc/实体和实体属性、实体索引.d.ts'), 'utf8'),
9
- '应用和数据源、数据源和实体': fs.readFileSync(require.resolve('../../docs-for-aigc/应用和数据源、数据源和实体.d.ts'), 'utf8'),
10
- 类型标注: fs.readFileSync(require.resolve('../../docs-for-aigc/类型标注.d.ts'), 'utf8'),
11
- 页面: fs.readFileSync(require.resolve('../../docs-for-aigc/页面.d.ts'), 'utf8'),
12
- 逻辑: fs.readFileSync(require.resolve('../../docs-for-aigc/逻辑.d.ts'), 'utf8'),
7
+ // index: fs.readFileSync(require.resolve('../../docs-for-aigc/index.md'), 'utf8'),
8
+ // '实体和实体属性、实体索引': fs.readFileSync(require.resolve('../../docs-for-aigc/实体和实体属性、实体索引.d.ts'), 'utf8'),
9
+ // '应用和数据源、数据源和实体': fs.readFileSync(require.resolve('../../docs-for-aigc/应用和数据源、数据源和实体.d.ts'), 'utf8'),
10
+ // 类型标注: fs.readFileSync(require.resolve('../../docs-for-aigc/类型标注.d.ts'), 'utf8'),
11
+ // 页面: fs.readFileSync(require.resolve('../../docs-for-aigc/页面.d.ts'), 'utf8'),
12
+ // 逻辑: fs.readFileSync(require.resolve('../../docs-for-aigc/逻辑.d.ts'), 'utf8'),
13
13
  };
14
14
  }
15
15
  /// #endif
16
16
  /// #if process.env.BUILD_TARGET !== 'node'
17
17
  if (globalThis.window) { // For TS build
18
18
  knowledgeMap = {
19
- index: require('!!raw-loader!../../docs-for-aigc/index.md').default,
20
- '实体和实体属性、实体索引': require('!!raw-loader!../../docs-for-aigc/实体和实体属性、实体索引.d.ts').default,
21
- '应用和数据源、数据源和实体': require('!!raw-loader!../../docs-for-aigc/应用和数据源、数据源和实体.d.ts').default,
22
- 类型标注: require('!!raw-loader!../../docs-for-aigc/类型标注.d.ts').default,
23
- 页面: require('!!raw-loader!../../docs-for-aigc/页面.d.ts').default,
24
- 逻辑: require('!!raw-loader!../../docs-for-aigc/逻辑.d.ts').default,
19
+ // index: require('!!raw-loader!../../docs-for-aigc/index.md').default,
20
+ // '实体和实体属性、实体索引': require('!!raw-loader!../../docs-for-aigc/实体和实体属性、实体索引.d.ts').default,
21
+ // '应用和数据源、数据源和实体': require('!!raw-loader!../../docs-for-aigc/应用和数据源、数据源和实体.d.ts').default,
22
+ // 类型标注: require('!!raw-loader!../../docs-for-aigc/类型标注.d.ts').default,
23
+ // 页面: require('!!raw-loader!../../docs-for-aigc/页面.d.ts').default,
24
+ // 逻辑: require('!!raw-loader!../../docs-for-aigc/逻辑.d.ts').default,
25
25
  };
26
26
  }
27
27
  /// #endif