@lcap/nasl 3.3.0-alpha.1 → 3.3.0-alpha.3
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.
- package/out/automate/upgrader/2.20.js.map +1 -1
- package/out/bak/translator.js +52 -1
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/shared/utils.js +0 -2
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/Command.d.ts +1 -0
- package/out/common/Command.js +9 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/Abort__.js +2 -1
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.js +1 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js +2 -2
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/Argument__.js +1 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +1 -1
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +2 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +1 -1
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.js +1 -1
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +2 -2
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +2 -2
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +2 -0
- package/out/concepts/BindAttribute__.js +79 -4
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +1 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +2 -1
- package/out/concepts/BindEvent__.js +44 -37
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +1 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.js +1 -1
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.js +1 -1
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.js +1 -1
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.js +2 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +2 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +69 -12
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +1 -1
- package/out/concepts/CallQueryComponent__.js +1 -1
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +1 -1
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +1 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Connection__.js +9 -10
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Constant__.js +1 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.js +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +2 -2
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +1 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.js +1 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +2 -2
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +2 -2
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.js +2 -2
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +2 -2
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +27 -37
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.js +1 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +2 -2
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +1 -1
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +1 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +1 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.js +1 -1
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.js +3 -2
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.js +2 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +2 -2
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -0
- package/out/concepts/MemberExpression__.js +117 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +1 -1
- package/out/concepts/Module__.js +34 -35
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.js +2 -2
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +2 -2
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +2 -2
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js +1 -1
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js +1 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +1 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +2 -2
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +1 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +1 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +1 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +1 -1
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +1 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +1 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +1 -1
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +1 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +1 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/Return__.js +2 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +1 -1
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +1 -1
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +2 -2
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js +1 -1
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +2 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +1 -1
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +2 -2
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +2 -2
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -2
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.js +1 -1
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +4 -3
- package/out/concepts/TypeAnnotation__.js +116 -75
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.js +1 -1
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +2 -2
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +14 -14
- package/out/concepts/ValidationRule__.js +28 -24
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +2 -2
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +88 -87
- package/out/concepts/ViewElement__.js +268 -204
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +6 -0
- package/out/concepts/View__.js +254 -11
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +2 -2
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.browser.js +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.event.js +2 -0
- package/out/concepts/basics/stdlib/nasl.event.js.map +1 -1
- package/out/generator/genBundleFiles.js +90 -1
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +1 -1
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.js +3 -3
- package/out/generator/permission.js.map +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/natural/genNaturalTS.js +7 -3
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/knowledgeMap.js +12 -12
- package/out/natural/knowledgeMap.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +1 -1
- package/out/natural/transformTSCode.js +115 -141
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +69 -44
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +72 -63
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +20 -23
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +149 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.d.ts +3 -3
- package/out/server/naslServer.js +182 -132
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +43 -33
- package/out/server/translator.js.map +1 -1
- package/out/service/defaultErrorMessage.json +6 -6
- package/out/service/storage/init.js +16 -0
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +12 -8
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +8 -7
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.d.ts +1 -1
- package/out/templator/genEditTableBlock.js +12 -6
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +2 -2
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +2 -2
- package/out/templator/genGridViewBlock.js +20 -7
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +2 -2
- package/out/templator/genListViewBlock.js +13 -5
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +2 -2
- package/out/templator/genSelectBlock.js +8 -6
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +10 -5
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +5 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/package.json +3 -1
- package/sandbox/stdlib/nasl.auth.ts +40 -44
- package/sandbox/stdlib/nasl.core.ts +8 -1
- package/sandbox/stdlib/nasl.http.ts +22 -22
- package/sandbox-natural/stdlib/nasl.util.ts +74 -15
- package/src/automate/upgrader/2.20.js +17 -13
- package/src/bak/translator.js +50 -1
- package/src/breakpoint/shared/utils.ts +0 -2
- package/src/common/Command.ts +8 -0
- package/src/concepts/Abort__.ts +2 -2
- package/src/concepts/Anchor__.ts +2 -2
- package/src/concepts/AnonymousFunction__.ts +3 -3
- package/src/concepts/Argument__.ts +2 -2
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/AssignmentLine__.ts +2 -2
- package/src/concepts/Assignment__.ts +3 -3
- package/src/concepts/BackendVariable__.ts +2 -2
- package/src/concepts/Backend__.ts +1 -1
- package/src/concepts/BatchAssignment__.ts +3 -3
- package/src/concepts/BinaryExpression__.ts +3 -3
- package/src/concepts/BindAttribute__.ts +69 -4
- package/src/concepts/BindDirective__.ts +2 -2
- package/src/concepts/BindEvent__.ts +44 -64
- package/src/concepts/BindStyle__.ts +2 -2
- package/src/concepts/BooleanLiteral__.ts +2 -2
- package/src/concepts/CallAuthInterface__.ts +2 -2
- package/src/concepts/CallConnector__.ts +2 -2
- package/src/concepts/CallFunction__.ts +3 -3
- package/src/concepts/CallInterface__.ts +3 -3
- package/src/concepts/CallLogic__.ts +69 -13
- package/src/concepts/CallQueryComponent__.ts +2 -2
- package/src/concepts/Comment__.ts +2 -2
- package/src/concepts/ConfigProperty__.ts +2 -2
- package/src/concepts/Connection__.ts +15 -21
- package/src/concepts/Constant__.ts +2 -2
- package/src/concepts/DataSource__.ts +1 -1
- package/src/concepts/Destination__.ts +3 -3
- package/src/concepts/End__.ts +2 -2
- package/src/concepts/EntityIndex__.ts +2 -2
- package/src/concepts/EntityProperty__.ts +3 -3
- package/src/concepts/Entity__.ts +2 -2
- package/src/concepts/EnumItem__.ts +3 -3
- package/src/concepts/Enum__.ts +2 -2
- package/src/concepts/ForEachStatement__.ts +35 -46
- package/src/concepts/Frontend__.ts +1 -1
- package/src/concepts/Function__.ts +3 -3
- package/src/concepts/Identifier__.ts +2 -2
- package/src/concepts/IfStatement__.ts +3 -3
- package/src/concepts/Interface__.ts +1 -1
- package/src/concepts/JSBlock__.ts +2 -2
- package/src/concepts/JavaLogic__.ts +2 -2
- package/src/concepts/LogicItem__.ts +3 -3
- package/src/concepts/Logic__.ts +2 -1
- package/src/concepts/MatchCase__.ts +2 -2
- package/src/concepts/Match__.ts +3 -3
- package/src/concepts/MemberExpression__.ts +112 -4
- package/src/concepts/Module__.ts +41 -58
- package/src/concepts/NewComposite__.ts +3 -3
- package/src/concepts/NewList__.ts +3 -3
- package/src/concepts/NewMap__.ts +3 -3
- package/src/concepts/New__.ts +2 -2
- package/src/concepts/NullLiteral__.ts +2 -2
- package/src/concepts/NumericLiteral__.ts +2 -2
- package/src/concepts/OqlQueryComponent__.ts +3 -3
- package/src/concepts/Param__.ts +2 -2
- package/src/concepts/ProcessElement__.ts +2 -2
- package/src/concepts/ProcessOutcome__.ts +2 -2
- package/src/concepts/ProcessOutcomes__.ts +2 -2
- package/src/concepts/Process__.ts +1 -1
- package/src/concepts/QueryAggregateExpression__.ts +2 -2
- package/src/concepts/QueryFieldExpression__.ts +2 -2
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/QueryLimitExpression__.ts +2 -2
- package/src/concepts/QueryOrderByExpression__.ts +2 -2
- package/src/concepts/Return__.ts +3 -3
- package/src/concepts/Role__.ts +1 -1
- package/src/concepts/SelectMembers__.ts +2 -2
- package/src/concepts/SqlQueryComponent__.ts +3 -3
- package/src/concepts/Start__.ts +2 -2
- package/src/concepts/StringInterpolation__.ts +3 -3
- package/src/concepts/StringLiteral__.ts +2 -2
- package/src/concepts/StructureProperty__.ts +3 -3
- package/src/concepts/Structure__.ts +2 -2
- package/src/concepts/SwitchCase__.ts +2 -2
- package/src/concepts/SwitchStatement__.ts +3 -3
- package/src/concepts/TriggerLauncher__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +145 -125
- package/src/concepts/TypeParam__.ts +2 -2
- package/src/concepts/UnaryExpression__.ts +3 -3
- package/src/concepts/ValidationRule__.ts +554 -524
- package/src/concepts/Variable__.ts +3 -3
- package/src/concepts/ViewElement__.ts +2445 -2498
- package/src/concepts/View__.ts +258 -10
- package/src/concepts/WhileStatement__.ts +3 -3
- package/src/concepts/basics/stdlib/nasl.browser.ts +1 -0
- package/src/concepts/basics/stdlib/nasl.event.ts +2 -0
- package/src/generator/genBundleFiles.ts +91 -1
- package/src/generator/genReleaseBody.ts +1 -1
- package/src/generator/permission.ts +3 -3
- package/src/index.ts +1 -0
- package/src/natural/genNaturalTS.ts +8 -4
- package/src/natural/knowledgeMap.ts +12 -12
- package/src/natural/transformTSCode.ts +139 -151
- package/src/server/extendBaseNode.ts +71 -45
- package/src/server/formatTsUtils.ts +64 -64
- package/src/server/getLogics.ts +23 -30
- package/src/server/getMemberIdentifier.ts +143 -0
- package/src/server/naslServer.ts +174 -148
- package/src/server/translator.ts +40 -39
- package/src/service/defaultErrorMessage.json +6 -6
- package/src/service/storage/init.ts +17 -0
- package/src/templator/genCreateBlock.ts +5 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +12 -8
- package/src/templator/genCurdMultipleKeyBlock.ts +8 -7
- package/src/templator/genEditTableBlock.ts +12 -7
- package/src/templator/genEnumSelectBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +6 -6
- package/src/templator/genGridViewBlock.ts +22 -9
- package/src/templator/genListViewBlock.ts +14 -5
- package/src/templator/genSelectBlock.ts +8 -6
- package/src/templator/genTableBlock.ts +10 -9
- package/src/templator/genUpdateBlock.ts +5 -3
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +11 -0
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +10 -0
- package/test/concepts/validation-rule/fixtures/argument-without-keyword.json +34 -0
- package/test/concepts/validation-rule/fixtures/empty-rule.json +9 -0
- package/test/concepts/validation-rule/validation-rule.spec.ts +15 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import { TranslatorState, withSourceMap,
|
|
2
|
+
import { TranslatorState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
3
3
|
import ConfigGroup from './ConfigGroup__';
|
|
4
4
|
import Namespace from './Namespace__';
|
|
5
5
|
import View from './View__';
|
|
@@ -355,7 +355,7 @@ export class ConfigProperty extends BaseNode {
|
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
@withSourceMap()
|
|
358
|
-
toEmbeddedTS(state
|
|
358
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
359
359
|
let modifier;
|
|
360
360
|
if (this.isPrivate) {
|
|
361
361
|
modifier = 'private';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
1
|
import { getNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
|
-
import { TranslatorState, shiftState, withSourceMap,
|
|
2
|
+
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState } from '../translator';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
//================================================================================
|
|
6
5
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
7
6
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
8
|
-
|
|
7
|
+
//================================================================================
|
|
9
8
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
10
9
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
11
10
|
|
|
12
11
|
import * as utils from '../utils';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
13
13
|
import BaseNode from '../common/BaseNode';
|
|
14
14
|
import classMap from '../common/classMap';
|
|
15
15
|
import ConfigProperty from './ConfigProperty__';
|
|
@@ -58,7 +58,6 @@ export class Connection extends BaseNode {
|
|
|
58
58
|
get module() {
|
|
59
59
|
return this.getAncestor('Module') as Module;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
61
|
/**
|
|
63
62
|
* 祖先 App
|
|
64
63
|
*/
|
|
@@ -70,12 +69,10 @@ export class Connection extends BaseNode {
|
|
|
70
69
|
* @param source 需要合并的部分参数
|
|
71
70
|
*/
|
|
72
71
|
constructor(source?: Partial<Connection>) {
|
|
73
|
-
|
|
74
|
-
source = { ...Connection.getDefaultOptions(), ...source };
|
|
72
|
+
source = Object.assign({}, Connection.getDefaultOptions(), source);
|
|
75
73
|
super(source);
|
|
76
74
|
super.subConstructor(source);
|
|
77
75
|
}
|
|
78
|
-
|
|
79
76
|
getClassName() {
|
|
80
77
|
return 'Connection';
|
|
81
78
|
}
|
|
@@ -95,7 +92,6 @@ export class Connection extends BaseNode {
|
|
|
95
92
|
}
|
|
96
93
|
return params;
|
|
97
94
|
}
|
|
98
|
-
|
|
99
95
|
/**
|
|
100
96
|
* 设置namespace
|
|
101
97
|
*/
|
|
@@ -149,7 +145,6 @@ export class Connection extends BaseNode {
|
|
|
149
145
|
const excludedSet = new Set(excludedList);
|
|
150
146
|
return ((this.properties as ConfigProperty[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
151
147
|
}
|
|
152
|
-
|
|
153
148
|
getConfigPropertyUniqueName(name = 'configProperty1') {
|
|
154
149
|
return utils.unique(name, this.getConfigPropertyExistingNames(), undefined, false);
|
|
155
150
|
}
|
|
@@ -316,7 +311,7 @@ export class Connection extends BaseNode {
|
|
|
316
311
|
if (typeof options === 'string') {
|
|
317
312
|
configProperty = (this.properties as ConfigProperty[]).find((item) => item.name === options);
|
|
318
313
|
if (!configProperty) {
|
|
319
|
-
throw new Error(
|
|
314
|
+
throw new Error('找不到配置属性 ' + options);
|
|
320
315
|
}
|
|
321
316
|
} else {
|
|
322
317
|
configProperty = options;
|
|
@@ -325,7 +320,7 @@ export class Connection extends BaseNode {
|
|
|
325
320
|
}
|
|
326
321
|
|
|
327
322
|
__removeConfigProperty(configProperty: ConfigProperty) {
|
|
328
|
-
const
|
|
323
|
+
const parentKey = configProperty.parentKey;
|
|
329
324
|
const params: Params = {
|
|
330
325
|
parentNode: this,
|
|
331
326
|
parentKey,
|
|
@@ -347,10 +342,10 @@ export class Connection extends BaseNode {
|
|
|
347
342
|
return params;
|
|
348
343
|
}
|
|
349
344
|
|
|
350
|
-
|
|
345
|
+
//================================================================================
|
|
351
346
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
352
347
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
353
|
-
|
|
348
|
+
//================================================================================
|
|
354
349
|
|
|
355
350
|
/**
|
|
356
351
|
* 获取connector 类型
|
|
@@ -358,7 +353,6 @@ export class Connection extends BaseNode {
|
|
|
358
353
|
get connector() {
|
|
359
354
|
return getNodeByNodeCallee(this.rootNode, this.namespace) as Connector;
|
|
360
355
|
}
|
|
361
|
-
|
|
362
356
|
getConnectorType(): String {
|
|
363
357
|
return this.connector?.connectorKind;
|
|
364
358
|
}
|
|
@@ -372,7 +366,7 @@ export class Connection extends BaseNode {
|
|
|
372
366
|
* @param name 一般不用传,用于 rename
|
|
373
367
|
*/
|
|
374
368
|
getEmbeddedFilePath(name = this.name) {
|
|
375
|
-
return `/embedded/${this.app.name}/connections/${
|
|
369
|
+
return `/embedded/${this.app.name}/connections/${name}.ts`;
|
|
376
370
|
}
|
|
377
371
|
|
|
378
372
|
getTsNamespace() {
|
|
@@ -407,20 +401,20 @@ export class Connection extends BaseNode {
|
|
|
407
401
|
code += '\n';
|
|
408
402
|
code += indent((state?.tabSize || 0) + 1);
|
|
409
403
|
code += 'return cb();\n';
|
|
410
|
-
code +=
|
|
404
|
+
code += indent(state?.tabSize || 0 + 4) + '}';
|
|
411
405
|
code += '\n';
|
|
412
406
|
return code;
|
|
413
407
|
}
|
|
414
408
|
|
|
415
|
-
|
|
409
|
+
//================================================================================
|
|
416
410
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
417
411
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
418
|
-
|
|
412
|
+
//================================================================================
|
|
419
413
|
}
|
|
420
414
|
|
|
421
415
|
classMap.Connection = Connection;
|
|
422
416
|
export default Connection;
|
|
423
|
-
|
|
417
|
+
//================================================================================
|
|
424
418
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
425
419
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
426
|
-
|
|
420
|
+
//================================================================================
|
|
@@ -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
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -244,7 +244,7 @@ export class Constant extends BaseNode {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
@withSourceMap()
|
|
247
|
-
toEmbeddedTS(state
|
|
247
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
248
248
|
let code = this.name;
|
|
249
249
|
if (this.typeAnnotation) {
|
|
250
250
|
code += ': ';
|
|
@@ -418,7 +418,7 @@ export class DataSource extends BaseNode {
|
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
@withSourceMap()
|
|
421
|
-
toEmbeddedTS(state
|
|
421
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
422
422
|
let code = `export namespace ${this.name} {\n`;
|
|
423
423
|
code += 'const name = ';
|
|
424
424
|
code += `"${this.name}";\n`;
|
|
@@ -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
|
|
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
|
|
748
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
749
749
|
let code = '';
|
|
750
750
|
|
|
751
751
|
const node = this.viewNode;
|
package/src/concepts/End__.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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`;
|
package/src/concepts/Entity__.ts
CHANGED
|
@@ -809,7 +809,7 @@ export class Entity extends BaseNode {
|
|
|
809
809
|
}
|
|
810
810
|
|
|
811
811
|
@withSourceMap()
|
|
812
|
-
toEmbeddedTS(state
|
|
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
|
|
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
|
|
126
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
127
127
|
return `static '${this.value}': ${this.enumeration.name}`;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
@withSourceMap()
|
|
131
|
-
toNaturalTS(state
|
|
131
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
132
132
|
return `'${this.value}' = '${this.label}'`;
|
|
133
133
|
}
|
|
134
134
|
|
package/src/concepts/Enum__.ts
CHANGED
|
@@ -295,7 +295,7 @@ export class Enum extends BaseNode {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
@withSourceMap()
|
|
298
|
-
toEmbeddedTS(state
|
|
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
|
|
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,13 +1,13 @@
|
|
|
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__';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
//================================================================================
|
|
8
8
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
9
9
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
10
|
-
|
|
10
|
+
//================================================================================
|
|
11
11
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
12
12
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
13
13
|
|
|
@@ -68,12 +68,10 @@ export class ForEachStatement extends LogicItem {
|
|
|
68
68
|
* @param source 需要合并的部分参数
|
|
69
69
|
*/
|
|
70
70
|
constructor(source?: Partial<ForEachStatement>) {
|
|
71
|
-
|
|
72
|
-
source = { ...ForEachStatement.getDefaultOptions(), ...source };
|
|
71
|
+
source = Object.assign({}, ForEachStatement.getDefaultOptions(), source);
|
|
73
72
|
super(source);
|
|
74
73
|
super.subConstructor(source);
|
|
75
74
|
}
|
|
76
|
-
|
|
77
75
|
getClassName() {
|
|
78
76
|
return 'ForEachStatement';
|
|
79
77
|
}
|
|
@@ -274,7 +272,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
274
272
|
if (typeof options === 'string') {
|
|
275
273
|
each = this.each;
|
|
276
274
|
if (!each) {
|
|
277
|
-
throw new Error(
|
|
275
|
+
throw new Error('找不到逻辑项 ' + options);
|
|
278
276
|
}
|
|
279
277
|
} else {
|
|
280
278
|
each = options;
|
|
@@ -299,7 +297,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
299
297
|
if (typeof options === 'string') {
|
|
300
298
|
start = this.start;
|
|
301
299
|
if (!start) {
|
|
302
|
-
throw new Error(
|
|
300
|
+
throw new Error('找不到逻辑项 ' + options);
|
|
303
301
|
}
|
|
304
302
|
} else {
|
|
305
303
|
start = options;
|
|
@@ -324,7 +322,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
324
322
|
if (typeof options === 'string') {
|
|
325
323
|
end = this.end;
|
|
326
324
|
if (!end) {
|
|
327
|
-
throw new Error(
|
|
325
|
+
throw new Error('找不到逻辑项 ' + options);
|
|
328
326
|
}
|
|
329
327
|
} else {
|
|
330
328
|
end = options;
|
|
@@ -344,7 +342,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
344
342
|
}
|
|
345
343
|
|
|
346
344
|
__removeLogicItem(logicItem: LogicItem) {
|
|
347
|
-
const
|
|
345
|
+
const parentKey = logicItem.parentKey;
|
|
348
346
|
const params: Params = {
|
|
349
347
|
parentNode: this,
|
|
350
348
|
parentKey,
|
|
@@ -383,7 +381,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
383
381
|
if (typeof options === 'string') {
|
|
384
382
|
item = this.item;
|
|
385
383
|
if (!item) {
|
|
386
|
-
throw new Error(
|
|
384
|
+
throw new Error('找不到输入参数 ' + options);
|
|
387
385
|
}
|
|
388
386
|
} else {
|
|
389
387
|
item = options;
|
|
@@ -408,7 +406,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
408
406
|
if (typeof options === 'string') {
|
|
409
407
|
index = this.index;
|
|
410
408
|
if (!index) {
|
|
411
|
-
throw new Error(
|
|
409
|
+
throw new Error('找不到输入参数 ' + options);
|
|
412
410
|
}
|
|
413
411
|
} else {
|
|
414
412
|
index = options;
|
|
@@ -417,7 +415,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
417
415
|
}
|
|
418
416
|
|
|
419
417
|
__removeParam(param: Param) {
|
|
420
|
-
const
|
|
418
|
+
const parentKey = param.parentKey;
|
|
421
419
|
const params: Params = {
|
|
422
420
|
parentNode: this,
|
|
423
421
|
parentKey,
|
|
@@ -439,10 +437,10 @@ export class ForEachStatement extends LogicItem {
|
|
|
439
437
|
return params;
|
|
440
438
|
}
|
|
441
439
|
|
|
442
|
-
|
|
440
|
+
//================================================================================
|
|
443
441
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
444
442
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
445
|
-
|
|
443
|
+
//================================================================================
|
|
446
444
|
|
|
447
445
|
public async checkItemIndexName() {
|
|
448
446
|
const itemNames = [];
|
|
@@ -498,16 +496,14 @@ export class ForEachStatement extends LogicItem {
|
|
|
498
496
|
: '';
|
|
499
497
|
const random = Math.random();
|
|
500
498
|
const number = Math.round(random * 10000);
|
|
499
|
+
const eachCode = `$forEachListVariable${number}`;
|
|
501
500
|
let endValue = '';
|
|
502
501
|
if (this.end) {
|
|
503
502
|
endValue = this.end.toJS();
|
|
504
503
|
} else if (this.each) {
|
|
505
|
-
endValue =
|
|
506
|
-
object: BaseNode.from({ ...this.each.toJSON(), name: this.each.name }) as LogicItem,
|
|
507
|
-
property: new Identifier({ name: 'length' }),
|
|
508
|
-
}).toJS();
|
|
504
|
+
endValue = `(${eachCode} || {}).length`;
|
|
509
505
|
}
|
|
510
|
-
code += `var $
|
|
506
|
+
code += `var ${eachCode} = ${list};\n`;
|
|
511
507
|
code += `var $forEachStartVariable${number} = ${this.start && this.start.toJS() ? this.start.toJS() : ''};\n`;
|
|
512
508
|
code += `var $forEachEndVariable${number} = ${endValue};\n`;
|
|
513
509
|
code += `if(Array.isArray($forEachListVariable${number})) {\n`;
|
|
@@ -516,11 +512,12 @@ export class ForEachStatement extends LogicItem {
|
|
|
516
512
|
code += `const ${this.item.name} = $forEachListVariable${number}[${this.index.name}];\n`;
|
|
517
513
|
if (Array.isArray(this.body)) {
|
|
518
514
|
this.body.forEach((logicItem) => {
|
|
519
|
-
code +=
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
515
|
+
code +=
|
|
516
|
+
logicItem.toJS(
|
|
517
|
+
shiftState(state, code, {
|
|
518
|
+
tabSize: 0,
|
|
519
|
+
})
|
|
520
|
+
) + '\n';
|
|
524
521
|
});
|
|
525
522
|
}
|
|
526
523
|
code += '}\n';
|
|
@@ -529,7 +526,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
529
526
|
}
|
|
530
527
|
|
|
531
528
|
@withSourceMap()
|
|
532
|
-
toEmbeddedTS(state
|
|
529
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
533
530
|
let code = '';
|
|
534
531
|
code += this.each
|
|
535
532
|
? this.each.toEmbeddedTS(
|
|
@@ -542,16 +539,7 @@ export class ForEachStatement extends LogicItem {
|
|
|
542
539
|
code += '.__slice(';
|
|
543
540
|
code += this.start ? this.start.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__';
|
|
544
541
|
code += ', ';
|
|
545
|
-
|
|
546
|
-
if (!virtualEnd && this.each) {
|
|
547
|
-
// if (['List', 'String', 'Email', 'Text', 'Map'].includes(this.each.__TypeAnnotation?.typeName)) {
|
|
548
|
-
virtualEnd = new MemberExpression({
|
|
549
|
-
object: BaseNode.from({ ...this.each.toJSON(), name: this.each.name }) as LogicItem,
|
|
550
|
-
property: new Identifier({ name: 'length' }),
|
|
551
|
-
});
|
|
552
|
-
// }
|
|
553
|
-
}
|
|
554
|
-
code += virtualEnd ? virtualEnd.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__';
|
|
542
|
+
code += this.end ? this.end.toEmbeddedTS(shiftState(state, code)) : 'null';
|
|
555
543
|
code += ').__forEach((';
|
|
556
544
|
code += this.item ? this.item.toEmbeddedTS(shiftState(state, code), true) : '__IDENTIFIER__';
|
|
557
545
|
code += ', ';
|
|
@@ -559,20 +547,21 @@ export class ForEachStatement extends LogicItem {
|
|
|
559
547
|
code += ') => {\n';
|
|
560
548
|
if (Array.isArray(this.body)) {
|
|
561
549
|
this.body.forEach((logicItem) => {
|
|
562
|
-
code +=
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
550
|
+
code +=
|
|
551
|
+
logicItem.toEmbeddedTS(
|
|
552
|
+
shiftState(state, code, {
|
|
553
|
+
tabSize: (state?.tabSize || 0) + 1,
|
|
554
|
+
})
|
|
555
|
+
) + ';\n';
|
|
567
556
|
});
|
|
568
557
|
}
|
|
569
|
-
code +=
|
|
558
|
+
code += indent(state?.tabSize || 0) + '})\n';
|
|
570
559
|
|
|
571
560
|
return code;
|
|
572
561
|
}
|
|
573
562
|
|
|
574
563
|
@withSourceMap()
|
|
575
|
-
toNaturalTS(state
|
|
564
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
576
565
|
let code = '';
|
|
577
566
|
code += this.each
|
|
578
567
|
? this.each.toNaturalTS(
|
|
@@ -617,12 +606,12 @@ export class ForEachStatement extends LogicItem {
|
|
|
617
606
|
//= ===============================================================================
|
|
618
607
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
619
608
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
620
|
-
|
|
609
|
+
//================================================================================
|
|
621
610
|
}
|
|
622
611
|
|
|
623
612
|
classMap.ForEachStatement = ForEachStatement;
|
|
624
613
|
export default ForEachStatement;
|
|
625
|
-
|
|
614
|
+
//================================================================================
|
|
626
615
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
627
616
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
628
|
-
|
|
617
|
+
//================================================================================
|
|
@@ -1162,7 +1162,7 @@ export class Frontend extends BaseNode {
|
|
|
1162
1162
|
}
|
|
1163
1163
|
|
|
1164
1164
|
@withSourceMap()
|
|
1165
|
-
toEmbeddedTS(state
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
84
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
85
85
|
let code = '';
|
|
86
86
|
const ret = this.logic.returns[0];
|
|
87
87
|
if (ret) {
|