@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 } 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
|
|
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
|
|
342
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
343
343
|
return this.toEmbeddedTS(state);
|
|
344
344
|
}
|
|
345
345
|
|
package/src/concepts/Logic__.ts
CHANGED
|
@@ -1884,7 +1884,7 @@ export class Logic extends BaseNode {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
|
|
1886
1886
|
@withSourceMap()
|
|
1887
|
-
toNaturalTS(state
|
|
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}`;
|
|
@@ -2259,6 +2259,7 @@ export class Logic extends BaseNode {
|
|
|
2259
2259
|
delete() {
|
|
2260
2260
|
let actionMsg = '删除逻辑项';
|
|
2261
2261
|
if (this.name) actionMsg += `“${this.name}”`;
|
|
2262
|
+
this.app?.emit('logicDeleted', { actionMsg: this.nodePath})
|
|
2262
2263
|
this.app?.emit('collect:start', {
|
|
2263
2264
|
actionMsg,
|
|
2264
2265
|
});
|
|
@@ -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
|
|
845
|
+
toNaturalTS(state = createCompilerState(), index?: number, parentCode?: string): string {
|
|
846
846
|
let code = '\n';
|
|
847
847
|
|
|
848
848
|
const parentNode = (this.parentNode as Match);
|
package/src/concepts/Match__.ts
CHANGED
|
@@ -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
|
|
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
|
|
736
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
737
737
|
let code = '';
|
|
738
738
|
|
|
739
739
|
if (this.parentNode?.concept === 'Logic') {
|
|
@@ -1,9 +1,9 @@
|
|
|
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__';
|
|
6
|
-
import BindAttribute from './BindAttribute__';
|
|
6
|
+
import BindAttribute, { attrConvertCamelCase } from './BindAttribute__';
|
|
7
7
|
import Assignment from './Assignment__';
|
|
8
8
|
import BatchAssignment from './BatchAssignment__';
|
|
9
9
|
|
|
@@ -21,6 +21,12 @@ import LogicItem from './LogicItem__';
|
|
|
21
21
|
|
|
22
22
|
const Identifier_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
23
23
|
|
|
24
|
+
const atrrParamsMap:Record<string, string> = {
|
|
25
|
+
page: 'pageNumber',
|
|
26
|
+
size: 'pageSize',
|
|
27
|
+
sort: 'sorting.field',
|
|
28
|
+
order: 'sorting.order'
|
|
29
|
+
};
|
|
24
30
|
/**
|
|
25
31
|
* 成员表达式
|
|
26
32
|
*/
|
|
@@ -135,6 +141,7 @@ export class MemberExpression extends LogicItem {
|
|
|
135
141
|
return params;
|
|
136
142
|
}
|
|
137
143
|
|
|
144
|
+
|
|
138
145
|
//= ===============================================================================
|
|
139
146
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
140
147
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
@@ -150,6 +157,25 @@ export class MemberExpression extends LogicItem {
|
|
|
150
157
|
if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') && this.property?.name === 'length') {
|
|
151
158
|
return `Object.keys(${this.object?.toJS()}).length`;
|
|
152
159
|
}
|
|
160
|
+
if (this.object instanceof Identifier && this.object?.namespace?.startsWith('elements.') && this.object?.namespace?.endsWith('.property')) {
|
|
161
|
+
let elementName = ''
|
|
162
|
+
if (this.object.namespace.startsWith('elements.$ce')) {
|
|
163
|
+
elementName = this.getAncestor('ViewElement')?.name
|
|
164
|
+
} else {
|
|
165
|
+
elementName = this.object.name
|
|
166
|
+
}
|
|
167
|
+
let propertyName = ''
|
|
168
|
+
let subProperty = ''
|
|
169
|
+
if (this.property instanceof Identifier) {
|
|
170
|
+
const namespace = this.property.namespace
|
|
171
|
+
const namespaceList = namespace.includes('.') ? namespace.split('.') : [namespace]
|
|
172
|
+
propertyName = namespaceList[0]
|
|
173
|
+
subProperty = namespaceList?.[1] ? `['${namespaceList?.[1]}']` : ''
|
|
174
|
+
}
|
|
175
|
+
return `this['__${elementName}_${propertyName}']${subProperty}`
|
|
176
|
+
} else if (this.object instanceof MemberExpression && this.object?.object?.name === 'elements' && this.object?.property?.name === '$ce') {
|
|
177
|
+
return this.transfromAtrrLogic();
|
|
178
|
+
}
|
|
153
179
|
const object = String(this.object?.toVue(options)); // undefined 也让正常展示
|
|
154
180
|
const property = String(this.property?.toVue(options));
|
|
155
181
|
|
|
@@ -170,6 +196,19 @@ export class MemberExpression extends LogicItem {
|
|
|
170
196
|
}
|
|
171
197
|
const object: string = this.object?.toUI();
|
|
172
198
|
const property = this.property?.toUI();
|
|
199
|
+
const paramsMap:Record<string, string> = {
|
|
200
|
+
'pageNumber': 'page',
|
|
201
|
+
'pageSize': 'size',
|
|
202
|
+
'sorting.field': 'sort',
|
|
203
|
+
'sorting.order': 'order'
|
|
204
|
+
};
|
|
205
|
+
if (paramsMap[this.property.name]) {
|
|
206
|
+
this.property.name = paramsMap[this.property.name]
|
|
207
|
+
}
|
|
208
|
+
if (this.object instanceof Identifier && property === '$ce' && object === 'elements') return
|
|
209
|
+
if (this.object instanceof MemberExpression && this.object?.object?.name === 'elements' && this.object?.property?.name === '$ce') {
|
|
210
|
+
return Identifier_RE.test(property) ? `当前组件.${property}` : `当前组件['${property}']`;
|
|
211
|
+
}
|
|
173
212
|
|
|
174
213
|
return Identifier_RE.test(property) ? `${object}.${property}` : `${object}['${property}']`;
|
|
175
214
|
}
|
|
@@ -182,6 +221,25 @@ export class MemberExpression extends LogicItem {
|
|
|
182
221
|
if (this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') && this.property?.name === 'length') {
|
|
183
222
|
return `Object.keys(${this.object?.toJS()}).length`;
|
|
184
223
|
}
|
|
224
|
+
if (this.object instanceof Identifier && this.property instanceof Identifier && this.object?.namespace?.startsWith('elements.') && this.object?.namespace?.endsWith('.property')) {
|
|
225
|
+
let elementName = ''
|
|
226
|
+
if (this.object.namespace.startsWith('elements.$ce')) {
|
|
227
|
+
elementName = this.getAncestor('ViewElement')?.name
|
|
228
|
+
} else {
|
|
229
|
+
elementName = this.object.name
|
|
230
|
+
}
|
|
231
|
+
let propertyName = ''
|
|
232
|
+
let subProperty = ''
|
|
233
|
+
if (this.property instanceof Identifier) {
|
|
234
|
+
const namespace = this.property.namespace
|
|
235
|
+
const namespaceList = namespace.includes('.') ? namespace.split('.') : [namespace]
|
|
236
|
+
propertyName = namespaceList[0]
|
|
237
|
+
subProperty = namespaceList?.[1] ? `['${namespaceList?.[1]}']` : ''
|
|
238
|
+
}
|
|
239
|
+
return `this['__${elementName}_${propertyName}']${subProperty}`
|
|
240
|
+
} else if (this.object instanceof MemberExpression && this.object?.object?.name === 'elements' && this.object?.property?.name === '$ce') {
|
|
241
|
+
return this.transfromAtrrLogic();
|
|
242
|
+
}
|
|
185
243
|
const object: string = this.object?.toJS();
|
|
186
244
|
const property = this.property?.toJS();
|
|
187
245
|
// 在赋值语句的左侧,不能有 &&
|
|
@@ -281,6 +339,19 @@ export class MemberExpression extends LogicItem {
|
|
|
281
339
|
|
|
282
340
|
return value;
|
|
283
341
|
}
|
|
342
|
+
transfromAtrrLogic() {
|
|
343
|
+
let elementName = this.getAncestor('ViewElement')?.name
|
|
344
|
+
let propertyName = ''
|
|
345
|
+
let subProperty = ''
|
|
346
|
+
let name = this.property.name
|
|
347
|
+
if (atrrParamsMap[this.property.name]) {
|
|
348
|
+
name = atrrParamsMap[this.property.name]
|
|
349
|
+
}
|
|
350
|
+
const namesList = name.includes('.') ? name.split('.') : [name]
|
|
351
|
+
propertyName = namesList[0]
|
|
352
|
+
subProperty = namesList?.[1] ? `['${namesList?.[1]}']` : ''
|
|
353
|
+
return `this['__${elementName}_${propertyName}']${subProperty}`
|
|
354
|
+
}
|
|
284
355
|
|
|
285
356
|
get completeName() {
|
|
286
357
|
const object: string = this.object?.completeName;
|
|
@@ -324,7 +395,7 @@ export class MemberExpression extends LogicItem {
|
|
|
324
395
|
* @returns
|
|
325
396
|
*/
|
|
326
397
|
@withSourceMap()
|
|
327
|
-
toEmbeddedTS(state
|
|
398
|
+
toEmbeddedTS(state = createCompilerState()): string {
|
|
328
399
|
let code = '';
|
|
329
400
|
const leftCode = this.object ? `${this.object.toEmbeddedTS(shiftState(state, code, { inline: true }))}.` : '';
|
|
330
401
|
code += this.object ? `${this.object.toEmbeddedTS(shiftState(state, code, { inline: true }))}.` : '';
|
|
@@ -337,11 +408,48 @@ export class MemberExpression extends LogicItem {
|
|
|
337
408
|
const newCode = `${code.substring(0, lastIndex)}['${code.substring(lastIndex + 1, code.length)}']`;
|
|
338
409
|
code = newCode;
|
|
339
410
|
}
|
|
411
|
+
if (this.object instanceof Identifier && this.object?.namespace?.startsWith('elements.') && this.object?.namespace?.endsWith('.property')) {
|
|
412
|
+
let newCode = ''
|
|
413
|
+
if (this.object?.namespace?.startsWith('elements.$ce')) {
|
|
414
|
+
const elementName = this.getAncestor('ViewElement')?.name
|
|
415
|
+
newCode += `__elements_completionProperty.${elementName}`
|
|
416
|
+
if (this.property instanceof Identifier) {
|
|
417
|
+
const namespace = this.property.namespace
|
|
418
|
+
const namespaceList = namespace.includes('.') ? namespace.split('.') : [namespace]
|
|
419
|
+
namespaceList.forEach((item) => {
|
|
420
|
+
newCode += `.${attrConvertCamelCase(item)}`
|
|
421
|
+
})
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
newCode += `__elements.${this.object?.name}`
|
|
425
|
+
if (this.property instanceof Identifier) {
|
|
426
|
+
const namespace = this.property.namespace
|
|
427
|
+
const namespaceList = namespace.includes('.') ? namespace.split('.') : [namespace]
|
|
428
|
+
namespaceList.forEach((item) => {
|
|
429
|
+
newCode += `['${item}']`
|
|
430
|
+
})
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return newCode
|
|
434
|
+
}
|
|
435
|
+
if (this.object instanceof MemberExpression && this.object?.object?.name === 'elements' && this.object?.property?.name === '$ce') {
|
|
436
|
+
let newCode = ''
|
|
437
|
+
const elementName = this.getAncestor('ViewElement')?.name
|
|
438
|
+
newCode += `__elements_completionProperty['${elementName}']`
|
|
439
|
+
if (atrrParamsMap[this.property.name]) {
|
|
440
|
+
const name = atrrParamsMap[this.property.name]
|
|
441
|
+
const nameList = name.includes('.') ? name.split('.') : [name]
|
|
442
|
+
nameList.forEach((item) => {
|
|
443
|
+
newCode += `.${attrConvertCamelCase(item)}`
|
|
444
|
+
})
|
|
445
|
+
}
|
|
446
|
+
return newCode
|
|
447
|
+
}
|
|
340
448
|
return code;
|
|
341
449
|
}
|
|
342
450
|
|
|
343
451
|
@withSourceMap()
|
|
344
|
-
toNaturalTS(state
|
|
452
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
345
453
|
let code = '';
|
|
346
454
|
const leftCode = this.object ? `${this.object.toNaturalTS(shiftState(state, code, { inline: true }))}.` : '';
|
|
347
455
|
code += this.object ? `${this.object.toNaturalTS(shiftState(state, code, { inline: true }))}.` : '';
|
package/src/concepts/Module__.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
type PropertyType = 'structures' | 'enums' | 'entities' | 'interfaces' | 'processes' | 'views';
|
|
2
|
+
const moduleNameSpace = {
|
|
3
|
+
dependencies: 'extensions',
|
|
4
|
+
interfaceDependencies: 'apis',
|
|
5
|
+
componentDependencies: 'components',
|
|
6
|
+
};
|
|
7
|
+
type ModuleKeyType = 'dependencies' | 'interfaceDependencies' | 'componentDependencies';
|
|
2
8
|
import ConfigProperty from './ConfigProperty__';
|
|
3
|
-
|
|
9
|
+
//================================================================================
|
|
4
10
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
5
11
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
6
|
-
|
|
12
|
+
//================================================================================
|
|
7
13
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
8
14
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
9
15
|
|
|
10
16
|
import * as utils from '../utils';
|
|
17
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
18
|
import BaseNode from '../common/BaseNode';
|
|
12
19
|
import classMap from '../common/classMap';
|
|
13
20
|
import DataSource from './DataSource__';
|
|
@@ -24,14 +31,6 @@ import TriggerLauncher from './TriggerLauncher__';
|
|
|
24
31
|
import Connection from './Connection__';
|
|
25
32
|
import App from './App__';
|
|
26
33
|
|
|
27
|
-
type PropertyType = 'structures' | 'enums' | 'entities' | 'interfaces' | 'processes' | 'views';
|
|
28
|
-
const moduleNameSpace = {
|
|
29
|
-
dependencies: 'extensions',
|
|
30
|
-
interfaceDependencies: 'apis',
|
|
31
|
-
componentDependencies: 'components',
|
|
32
|
-
};
|
|
33
|
-
type ModuleKeyType = 'dependencies' | 'interfaceDependencies' | 'componentDependencies';
|
|
34
|
-
|
|
35
34
|
/**
|
|
36
35
|
* 模块
|
|
37
36
|
*/
|
|
@@ -177,12 +176,10 @@ export class Module extends BaseNode {
|
|
|
177
176
|
* @param source 需要合并的部分参数
|
|
178
177
|
*/
|
|
179
178
|
constructor(source?: Partial<Module>) {
|
|
180
|
-
|
|
181
|
-
source = { ...Module.getDefaultOptions(), ...source };
|
|
179
|
+
source = Object.assign({}, Module.getDefaultOptions(), source);
|
|
182
180
|
super(source);
|
|
183
181
|
super.subConstructor(source);
|
|
184
182
|
}
|
|
185
|
-
|
|
186
183
|
getClassName() {
|
|
187
184
|
return 'Module';
|
|
188
185
|
}
|
|
@@ -207,7 +204,6 @@ export class Module extends BaseNode {
|
|
|
207
204
|
const excludedSet = new Set(excludedList);
|
|
208
205
|
return ((this.dataSources as DataSource[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
209
206
|
}
|
|
210
|
-
|
|
211
207
|
getDataSourceUniqueName(name = 'dataSource1') {
|
|
212
208
|
return utils.unique(name, this.getDataSourceExistingNames(), undefined, false);
|
|
213
209
|
}
|
|
@@ -361,7 +357,6 @@ export class Module extends BaseNode {
|
|
|
361
357
|
const excludedSet = new Set(excludedList);
|
|
362
358
|
return ((this.structures as Structure[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
363
359
|
}
|
|
364
|
-
|
|
365
360
|
getStructureUniqueName(name = 'Structure1') {
|
|
366
361
|
return utils.unique(name, this.getStructureExistingNames(), undefined, false);
|
|
367
362
|
}
|
|
@@ -515,7 +510,6 @@ export class Module extends BaseNode {
|
|
|
515
510
|
const excludedSet = new Set(excludedList);
|
|
516
511
|
return ((this.enums as Enum[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
517
512
|
}
|
|
518
|
-
|
|
519
513
|
getEnumUniqueName(name = 'Enum1') {
|
|
520
514
|
return utils.unique(name, this.getEnumExistingNames(), undefined, false);
|
|
521
515
|
}
|
|
@@ -669,7 +663,6 @@ export class Module extends BaseNode {
|
|
|
669
663
|
const excludedSet = new Set(excludedList);
|
|
670
664
|
return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
671
665
|
}
|
|
672
|
-
|
|
673
666
|
getLogicUniqueName(name = 'logic1') {
|
|
674
667
|
return utils.unique(name, this.getLogicExistingNames(), undefined, false);
|
|
675
668
|
}
|
|
@@ -823,7 +816,6 @@ export class Module extends BaseNode {
|
|
|
823
816
|
const excludedSet = new Set(excludedList);
|
|
824
817
|
return ((this.interfaces as Interface[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
825
818
|
}
|
|
826
|
-
|
|
827
819
|
getInterfaceUniqueName(name = 'Interface1') {
|
|
828
820
|
return utils.unique(name, this.getInterfaceExistingNames(), undefined, false);
|
|
829
821
|
}
|
|
@@ -977,7 +969,6 @@ export class Module extends BaseNode {
|
|
|
977
969
|
const excludedSet = new Set(excludedList);
|
|
978
970
|
return ((this.views as View[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
979
971
|
}
|
|
980
|
-
|
|
981
972
|
getViewUniqueName(name = 'view1') {
|
|
982
973
|
return utils.unique(name, this.getViewExistingNames(), undefined, false);
|
|
983
974
|
}
|
|
@@ -1131,7 +1122,6 @@ export class Module extends BaseNode {
|
|
|
1131
1122
|
const excludedSet = new Set(excludedList);
|
|
1132
1123
|
return ((this.frontendVariables as Variable[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1133
1124
|
}
|
|
1134
|
-
|
|
1135
1125
|
getVariableUniqueName(name = 'variable1') {
|
|
1136
1126
|
return utils.unique(name, this.getVarExistingNames(), undefined, true);
|
|
1137
1127
|
}
|
|
@@ -1285,7 +1275,6 @@ export class Module extends BaseNode {
|
|
|
1285
1275
|
const excludedSet = new Set(excludedList);
|
|
1286
1276
|
return ((this.processes as Process[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1287
1277
|
}
|
|
1288
|
-
|
|
1289
1278
|
getProcessUniqueName(name = 'Process1') {
|
|
1290
1279
|
return utils.unique(name, this.getProcessExistingNames(), undefined, false);
|
|
1291
1280
|
}
|
|
@@ -1439,7 +1428,6 @@ export class Module extends BaseNode {
|
|
|
1439
1428
|
const excludedSet = new Set(excludedList);
|
|
1440
1429
|
return ((this.frontends as FrontendLibrary[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1441
1430
|
}
|
|
1442
|
-
|
|
1443
1431
|
getFrontendLibraryUniqueName(name = 'frontendLibrary1') {
|
|
1444
1432
|
return utils.unique(name, this.getFrontendLibraryExistingNames(), undefined, false);
|
|
1445
1433
|
}
|
|
@@ -1593,7 +1581,6 @@ export class Module extends BaseNode {
|
|
|
1593
1581
|
const excludedSet = new Set(excludedList);
|
|
1594
1582
|
return ((this.triggerLaunchers as TriggerLauncher[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1595
1583
|
}
|
|
1596
|
-
|
|
1597
1584
|
getTriggerLauncherUniqueName(name = 'triggerLauncher1') {
|
|
1598
1585
|
return utils.unique(name, this.getTriggerLauncherExistingNames(), undefined, false);
|
|
1599
1586
|
}
|
|
@@ -1747,7 +1734,6 @@ export class Module extends BaseNode {
|
|
|
1747
1734
|
const excludedSet = new Set(excludedList);
|
|
1748
1735
|
return ((this.connections as Connection[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1749
1736
|
}
|
|
1750
|
-
|
|
1751
1737
|
getConnectionUniqueName(name = 'connection1') {
|
|
1752
1738
|
return utils.unique(name, this.getConnectionExistingNames(), undefined, false);
|
|
1753
1739
|
}
|
|
@@ -1914,7 +1900,7 @@ export class Module extends BaseNode {
|
|
|
1914
1900
|
if (typeof options === 'string') {
|
|
1915
1901
|
dataSource = (this.dataSources as DataSource[]).find((item) => item.name === options);
|
|
1916
1902
|
if (!dataSource) {
|
|
1917
|
-
throw new Error(
|
|
1903
|
+
throw new Error('找不到数据源 ' + options);
|
|
1918
1904
|
}
|
|
1919
1905
|
} else {
|
|
1920
1906
|
dataSource = options;
|
|
@@ -1923,7 +1909,7 @@ export class Module extends BaseNode {
|
|
|
1923
1909
|
}
|
|
1924
1910
|
|
|
1925
1911
|
__removeDataSource(dataSource: DataSource) {
|
|
1926
|
-
const
|
|
1912
|
+
const parentKey = dataSource.parentKey;
|
|
1927
1913
|
const params: Params = {
|
|
1928
1914
|
parentNode: this,
|
|
1929
1915
|
parentKey,
|
|
@@ -1962,7 +1948,7 @@ export class Module extends BaseNode {
|
|
|
1962
1948
|
if (typeof options === 'string') {
|
|
1963
1949
|
structure = (this.structures as Structure[]).find((item) => item.name === options);
|
|
1964
1950
|
if (!structure) {
|
|
1965
|
-
throw new Error(
|
|
1951
|
+
throw new Error('找不到数据结构 ' + options);
|
|
1966
1952
|
}
|
|
1967
1953
|
} else {
|
|
1968
1954
|
structure = options;
|
|
@@ -1971,7 +1957,7 @@ export class Module extends BaseNode {
|
|
|
1971
1957
|
}
|
|
1972
1958
|
|
|
1973
1959
|
__removeStructure(structure: Structure) {
|
|
1974
|
-
const
|
|
1960
|
+
const parentKey = structure.parentKey;
|
|
1975
1961
|
const params: Params = {
|
|
1976
1962
|
parentNode: this,
|
|
1977
1963
|
parentKey,
|
|
@@ -2010,7 +1996,7 @@ export class Module extends BaseNode {
|
|
|
2010
1996
|
if (typeof options === 'string') {
|
|
2011
1997
|
enumeration = (this.enums as Enum[]).find((item) => item.name === options);
|
|
2012
1998
|
if (!enumeration) {
|
|
2013
|
-
throw new Error(
|
|
1999
|
+
throw new Error('找不到枚举 ' + options);
|
|
2014
2000
|
}
|
|
2015
2001
|
} else {
|
|
2016
2002
|
enumeration = options;
|
|
@@ -2019,7 +2005,7 @@ export class Module extends BaseNode {
|
|
|
2019
2005
|
}
|
|
2020
2006
|
|
|
2021
2007
|
__removeEnum(enumeration: Enum) {
|
|
2022
|
-
const
|
|
2008
|
+
const parentKey = enumeration.parentKey;
|
|
2023
2009
|
const params: Params = {
|
|
2024
2010
|
parentNode: this,
|
|
2025
2011
|
parentKey,
|
|
@@ -2058,7 +2044,7 @@ export class Module extends BaseNode {
|
|
|
2058
2044
|
if (typeof options === 'string') {
|
|
2059
2045
|
logic = (this.logics as Logic[]).find((item) => item.name === options);
|
|
2060
2046
|
if (!logic) {
|
|
2061
|
-
throw new Error(
|
|
2047
|
+
throw new Error('找不到逻辑 ' + options);
|
|
2062
2048
|
}
|
|
2063
2049
|
} else {
|
|
2064
2050
|
logic = options;
|
|
@@ -2067,7 +2053,7 @@ export class Module extends BaseNode {
|
|
|
2067
2053
|
}
|
|
2068
2054
|
|
|
2069
2055
|
__removeLogic(logic: Logic) {
|
|
2070
|
-
const
|
|
2056
|
+
const parentKey = logic.parentKey;
|
|
2071
2057
|
const params: Params = {
|
|
2072
2058
|
parentNode: this,
|
|
2073
2059
|
parentKey,
|
|
@@ -2106,7 +2092,7 @@ export class Module extends BaseNode {
|
|
|
2106
2092
|
if (typeof options === 'string') {
|
|
2107
2093
|
itface = (this.interfaces as Interface[]).find((item) => item.name === options);
|
|
2108
2094
|
if (!itface) {
|
|
2109
|
-
throw new Error(
|
|
2095
|
+
throw new Error('找不到接口 ' + options);
|
|
2110
2096
|
}
|
|
2111
2097
|
} else {
|
|
2112
2098
|
itface = options;
|
|
@@ -2115,7 +2101,7 @@ export class Module extends BaseNode {
|
|
|
2115
2101
|
}
|
|
2116
2102
|
|
|
2117
2103
|
__removeInterface(itface: Interface) {
|
|
2118
|
-
const
|
|
2104
|
+
const parentKey = itface.parentKey;
|
|
2119
2105
|
const params: Params = {
|
|
2120
2106
|
parentNode: this,
|
|
2121
2107
|
parentKey,
|
|
@@ -2154,7 +2140,7 @@ export class Module extends BaseNode {
|
|
|
2154
2140
|
if (typeof options === 'string') {
|
|
2155
2141
|
view = (this.views as View[]).find((item) => item.name === options);
|
|
2156
2142
|
if (!view) {
|
|
2157
|
-
throw new Error(
|
|
2143
|
+
throw new Error('找不到页面 ' + options);
|
|
2158
2144
|
}
|
|
2159
2145
|
} else {
|
|
2160
2146
|
view = options;
|
|
@@ -2163,7 +2149,7 @@ export class Module extends BaseNode {
|
|
|
2163
2149
|
}
|
|
2164
2150
|
|
|
2165
2151
|
__removeView(view: View) {
|
|
2166
|
-
const
|
|
2152
|
+
const parentKey = view.parentKey;
|
|
2167
2153
|
const params: Params = {
|
|
2168
2154
|
parentNode: this,
|
|
2169
2155
|
parentKey,
|
|
@@ -2202,7 +2188,7 @@ export class Module extends BaseNode {
|
|
|
2202
2188
|
if (typeof options === 'string') {
|
|
2203
2189
|
variable = (this.frontendVariables as Variable[]).find((item) => item.name === options);
|
|
2204
2190
|
if (!variable) {
|
|
2205
|
-
throw new Error(
|
|
2191
|
+
throw new Error('找不到变量 ' + options);
|
|
2206
2192
|
}
|
|
2207
2193
|
} else {
|
|
2208
2194
|
variable = options;
|
|
@@ -2211,7 +2197,7 @@ export class Module extends BaseNode {
|
|
|
2211
2197
|
}
|
|
2212
2198
|
|
|
2213
2199
|
__removeVariable(variable: Variable) {
|
|
2214
|
-
const
|
|
2200
|
+
const parentKey = variable.parentKey;
|
|
2215
2201
|
const params: Params = {
|
|
2216
2202
|
parentNode: this,
|
|
2217
2203
|
parentKey,
|
|
@@ -2250,7 +2236,7 @@ export class Module extends BaseNode {
|
|
|
2250
2236
|
if (typeof options === 'string') {
|
|
2251
2237
|
process = (this.processes as Process[]).find((item) => item.name === options);
|
|
2252
2238
|
if (!process) {
|
|
2253
|
-
throw new Error(
|
|
2239
|
+
throw new Error('找不到流程 ' + options);
|
|
2254
2240
|
}
|
|
2255
2241
|
} else {
|
|
2256
2242
|
process = options;
|
|
@@ -2259,7 +2245,7 @@ export class Module extends BaseNode {
|
|
|
2259
2245
|
}
|
|
2260
2246
|
|
|
2261
2247
|
__removeProcess(process: Process) {
|
|
2262
|
-
const
|
|
2248
|
+
const parentKey = process.parentKey;
|
|
2263
2249
|
const params: Params = {
|
|
2264
2250
|
parentNode: this,
|
|
2265
2251
|
parentKey,
|
|
@@ -2298,7 +2284,7 @@ export class Module extends BaseNode {
|
|
|
2298
2284
|
if (typeof options === 'string') {
|
|
2299
2285
|
frontendLibrary = (this.frontends as FrontendLibrary[]).find((item) => item.name === options);
|
|
2300
2286
|
if (!frontendLibrary) {
|
|
2301
|
-
throw new Error(
|
|
2287
|
+
throw new Error('找不到端包 ' + options);
|
|
2302
2288
|
}
|
|
2303
2289
|
} else {
|
|
2304
2290
|
frontendLibrary = options;
|
|
@@ -2307,7 +2293,7 @@ export class Module extends BaseNode {
|
|
|
2307
2293
|
}
|
|
2308
2294
|
|
|
2309
2295
|
__removeFrontendLibrary(frontendLibrary: FrontendLibrary) {
|
|
2310
|
-
const
|
|
2296
|
+
const parentKey = frontendLibrary.parentKey;
|
|
2311
2297
|
const params: Params = {
|
|
2312
2298
|
parentNode: this,
|
|
2313
2299
|
parentKey,
|
|
@@ -2346,7 +2332,7 @@ export class Module extends BaseNode {
|
|
|
2346
2332
|
if (typeof options === 'string') {
|
|
2347
2333
|
configuration = this.configuration;
|
|
2348
2334
|
if (!configuration) {
|
|
2349
|
-
throw new Error(
|
|
2335
|
+
throw new Error('找不到配置管理 ' + options);
|
|
2350
2336
|
}
|
|
2351
2337
|
} else {
|
|
2352
2338
|
configuration = options;
|
|
@@ -2355,7 +2341,7 @@ export class Module extends BaseNode {
|
|
|
2355
2341
|
}
|
|
2356
2342
|
|
|
2357
2343
|
__removeConfiguration(configuration: Configuration) {
|
|
2358
|
-
const
|
|
2344
|
+
const parentKey = configuration.parentKey;
|
|
2359
2345
|
const params: Params = {
|
|
2360
2346
|
parentNode: this,
|
|
2361
2347
|
parentKey,
|
|
@@ -2394,7 +2380,7 @@ export class Module extends BaseNode {
|
|
|
2394
2380
|
if (typeof options === 'string') {
|
|
2395
2381
|
triggerLauncher = (this.triggerLaunchers as TriggerLauncher[]).find((item) => item.name === options);
|
|
2396
2382
|
if (!triggerLauncher) {
|
|
2397
|
-
throw new Error(
|
|
2383
|
+
throw new Error('找不到触发器启动器 ' + options);
|
|
2398
2384
|
}
|
|
2399
2385
|
} else {
|
|
2400
2386
|
triggerLauncher = options;
|
|
@@ -2403,7 +2389,7 @@ export class Module extends BaseNode {
|
|
|
2403
2389
|
}
|
|
2404
2390
|
|
|
2405
2391
|
__removeTriggerLauncher(triggerLauncher: TriggerLauncher) {
|
|
2406
|
-
const
|
|
2392
|
+
const parentKey = triggerLauncher.parentKey;
|
|
2407
2393
|
const params: Params = {
|
|
2408
2394
|
parentNode: this,
|
|
2409
2395
|
parentKey,
|
|
@@ -2442,7 +2428,7 @@ export class Module extends BaseNode {
|
|
|
2442
2428
|
if (typeof options === 'string') {
|
|
2443
2429
|
connection = (this.connections as Connection[]).find((item) => item.name === options);
|
|
2444
2430
|
if (!connection) {
|
|
2445
|
-
throw new Error(
|
|
2431
|
+
throw new Error('找不到连接 ' + options);
|
|
2446
2432
|
}
|
|
2447
2433
|
} else {
|
|
2448
2434
|
connection = options;
|
|
@@ -2451,7 +2437,7 @@ export class Module extends BaseNode {
|
|
|
2451
2437
|
}
|
|
2452
2438
|
|
|
2453
2439
|
__removeConnection(connection: Connection) {
|
|
2454
|
-
const
|
|
2440
|
+
const parentKey = connection.parentKey;
|
|
2455
2441
|
const params: Params = {
|
|
2456
2442
|
parentNode: this,
|
|
2457
2443
|
parentKey,
|
|
@@ -2473,10 +2459,10 @@ export class Module extends BaseNode {
|
|
|
2473
2459
|
return params;
|
|
2474
2460
|
}
|
|
2475
2461
|
|
|
2476
|
-
|
|
2462
|
+
//================================================================================
|
|
2477
2463
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
2478
2464
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
2479
|
-
|
|
2465
|
+
//================================================================================
|
|
2480
2466
|
/**
|
|
2481
2467
|
* 用于区分存量应用新导入模块,存量应用替换数据结构使用
|
|
2482
2468
|
*/
|
|
@@ -2503,7 +2489,6 @@ export class Module extends BaseNode {
|
|
|
2503
2489
|
...object,
|
|
2504
2490
|
});
|
|
2505
2491
|
}
|
|
2506
|
-
|
|
2507
2492
|
/**
|
|
2508
2493
|
* 生成宿主语言的文件路径
|
|
2509
2494
|
* @param name 一般不用传,用于 rename
|
|
@@ -2511,7 +2496,6 @@ export class Module extends BaseNode {
|
|
|
2511
2496
|
getEmbeddedFilePath(name = this.name) {
|
|
2512
2497
|
return `/embedded/${this.app.name}/${this.parentKey}/${this.name}`;
|
|
2513
2498
|
}
|
|
2514
|
-
|
|
2515
2499
|
/**
|
|
2516
2500
|
* 获取命名空间和
|
|
2517
2501
|
* 暂时不考虑 Module 嵌套的情况
|
|
@@ -2530,7 +2514,6 @@ export class Module extends BaseNode {
|
|
|
2530
2514
|
}
|
|
2531
2515
|
return `${moduleNameSpace[this.parentKey as ModuleKeyType]}`;
|
|
2532
2516
|
}
|
|
2533
|
-
|
|
2534
2517
|
getTsNamespaceAndName() {
|
|
2535
2518
|
if (this.type === 'connector') {
|
|
2536
2519
|
return 'connector';
|
|
@@ -2612,15 +2595,15 @@ export class Module extends BaseNode {
|
|
|
2612
2595
|
}
|
|
2613
2596
|
}
|
|
2614
2597
|
|
|
2615
|
-
|
|
2598
|
+
//================================================================================
|
|
2616
2599
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2617
2600
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
2618
|
-
|
|
2601
|
+
//================================================================================
|
|
2619
2602
|
}
|
|
2620
2603
|
|
|
2621
2604
|
classMap.Module = Module;
|
|
2622
2605
|
export default Module;
|
|
2623
|
-
|
|
2606
|
+
//================================================================================
|
|
2624
2607
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
2625
2608
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
2626
|
-
|
|
2609
|
+
//================================================================================
|