@lcap/nasl 2.20.0-beta.2 → 2.20.0
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/engine/index.d.ts +1 -1
- package/out/automate/engine/index.js +2 -3
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +1 -1
- package/out/automate/engine/uniqueName.js +2 -2
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.js +4 -1
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/template/myProcess.d.ts +1 -1
- package/out/automate/template/myProcess.js +2 -2
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/bak/translator.js +14 -22
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.js +4 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +1 -0
- package/out/common/Command.js +5 -1
- package/out/common/Command.js.map +1 -1
- package/out/concepts/App__.d.ts +4 -0
- package/out/concepts/App__.js +30 -6
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.js +4 -3
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +3 -3
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +7 -0
- package/out/concepts/BindAttribute__.js +270 -39
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +7 -0
- package/out/concepts/BindDirective__.js +215 -17
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +7 -0
- package/out/concepts/BindStyle__.js +194 -4
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/CallFunction__.js +22 -8
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +3 -2
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +3 -0
- package/out/concepts/CallLogic__.js +78 -89
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +20 -3
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +1 -0
- package/out/concepts/ConfigGroup__.js +13 -0
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +19 -0
- package/out/concepts/ConfigProperty__.js +61 -0
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +1 -0
- package/out/concepts/Configuration__.js +13 -0
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +1 -0
- package/out/concepts/Destination__.js +61 -7
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +9 -1
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +5 -5
- package/out/concepts/EnumItem__.js +6 -6
- package/out/concepts/Enum__.d.ts +20 -19
- package/out/concepts/Enum__.js +28 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +1 -0
- package/out/concepts/ExternalDestination__.js +21 -3
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +2 -0
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -1
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Identifier__.js +16 -5
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +9 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/JSBlock__.js +5 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +79 -79
- package/out/concepts/Logic__.js +16 -3
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.d.ts +0 -3
- package/out/concepts/Match__.js +11 -66
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +9 -0
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +16 -0
- package/out/concepts/Module__.js +43 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +2 -4
- package/out/concepts/NewComposite__.js +91 -126
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +1 -0
- package/out/concepts/NewList__.js +22 -2
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +1 -0
- package/out/concepts/NewMap__.js +43 -11
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +40 -12
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.js +10 -2
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +2 -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 -0
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/Return__.js +10 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +14 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.js +6 -6
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +9 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +6 -3
- package/out/concepts/TypeAnnotation__.js +67 -13
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +53 -0
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +9 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +17 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +1 -3
- package/out/concepts/View__.js +22 -11
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.collection.js +6 -1
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.core.js +34 -0
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +4 -2
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -0
- package/out/concepts/basics/types/index.js +3 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -1
- package/out/concepts/index__.js +0 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/enums/KEYWORDS.js +8 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.js +24 -5
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +2 -3
- package/out/generator/genReleaseBody.js +97 -23
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.d.ts +2 -10
- package/out/generator/permission.js +27 -14
- package/out/generator/permission.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +2 -20
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +16 -5
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +2 -1
- package/out/server/formatTsUtils.js +40 -10
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.d.ts +2 -2
- package/out/server/getLogics.js +3 -3
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +27 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +7 -1
- package/out/server/naslServer.js +519 -46
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +109 -33
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +21 -1
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +1 -3
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +1 -3
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +2 -2
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +7 -1
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +1 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +2 -2
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +2 -3
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/utils/traverse.js +8 -2
- package/out/utils/traverse.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/sandbox/stdlib/nasl.collection.ts +1 -0
- package/sandbox/stdlib/nasl.core.ts +34 -0
- package/sandbox/stdlib/nasl.oql.ts +71 -15
- package/sandbox/stdlib/nasl.util.ts +9 -3
- package/src/automate/engine/dist/index.dev.js +517 -0
- package/src/automate/engine/index.js +2 -3
- package/src/automate/engine/uniqueName.js +2 -2
- package/src/automate/engine/utils.js +4 -2
- package/src/automate/template/myProcess.js +2 -2
- package/src/bak/translator.js +16 -25
- package/src/common/BaseNode.ts +3 -1
- package/src/common/Command.ts +4 -0
- package/src/common/dist/BaseNode.js +1101 -0
- package/src/concepts/App__.ts +36 -7
- package/src/concepts/Assignee__.ts +4 -3
- package/src/concepts/BatchAssignment__.ts +3 -3
- package/src/concepts/BindAttribute__.ts +299 -38
- package/src/concepts/BindDirective__.ts +204 -31
- package/src/concepts/BindStyle__.ts +187 -24
- package/src/concepts/CallFunction__.ts +55 -10
- package/src/concepts/CallInterface__.ts +3 -2
- package/src/concepts/CallLogic__.ts +110 -90
- package/src/concepts/CallQueryComponent__.ts +18 -3
- package/src/concepts/ConfigGroup__.ts +17 -4
- package/src/concepts/ConfigProperty__.ts +70 -4
- package/src/concepts/Configuration__.ts +14 -5
- package/src/concepts/DataSource__.ts +4 -1
- package/src/concepts/Destination__.ts +61 -7
- package/src/concepts/EntityProperty__.ts +7 -1
- package/src/concepts/EnumItem__.ts +6 -6
- package/src/concepts/Enum__.ts +22 -19
- package/src/concepts/ExternalDestination__.ts +28 -8
- package/src/concepts/ForEachStatement__.ts +2 -0
- package/src/concepts/Frontend__.ts +2 -1
- package/src/concepts/Identifier__.ts +16 -5
- package/src/concepts/InterfaceParam__.ts +7 -1
- package/src/concepts/JSBlock__.ts +3 -2
- package/src/concepts/Logic__.ts +95 -83
- package/src/concepts/Match__.ts +31 -67
- package/src/concepts/MemberExpression__.ts +6 -0
- package/src/concepts/Module__.ts +57 -0
- package/src/concepts/NewComposite__.ts +95 -140
- package/src/concepts/NewList__.ts +23 -2
- package/src/concepts/NewMap__.ts +48 -24
- package/src/concepts/OqlQueryComponent__.ts +40 -20
- package/src/concepts/Param__.ts +178 -176
- package/src/concepts/ProcessElement__.ts +2 -1
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/ProcessOutcomes__.ts +1 -1
- package/src/concepts/Process__.ts +1 -0
- package/src/concepts/Return__.ts +8 -2
- package/src/concepts/StringInterpolation__.ts +19 -7
- package/src/concepts/StringLiteral__.ts +7 -6
- package/src/concepts/StructureProperty__.ts +7 -1
- package/src/concepts/TypeAnnotation__.ts +101 -14
- package/src/concepts/ValidationRule__.ts +58 -9
- package/src/concepts/Variable__.ts +11 -1
- package/src/concepts/ViewElement__.ts +39 -2
- package/src/concepts/View__.ts +26 -14
- package/src/concepts/basics/stdlib/dist/nasl.util.js +1602 -0
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +24 -0
- package/src/concepts/basics/stdlib/nasl.collection.ts +6 -1
- package/src/concepts/basics/stdlib/nasl.configuration.ts +3 -0
- package/src/concepts/basics/stdlib/nasl.core.ts +33 -2
- package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
- package/src/concepts/basics/types/index.ts +1 -0
- package/src/concepts/dist/BindAttribute__.js +795 -0
- package/src/concepts/dist/BindEvent__.js +732 -0
- package/src/concepts/dist/CallFunction__.js +527 -0
- package/src/concepts/dist/CallLogic__.js +932 -0
- package/src/concepts/dist/Destination__.js +708 -0
- package/src/concepts/dist/ExternalDestination__.js +298 -0
- package/src/concepts/dist/Identifier__.js +311 -0
- package/src/concepts/dist/StringInterpolation__.js +231 -0
- package/src/concepts/dist/TypeAnnotation__.js +834 -0
- package/src/concepts/dist/ViewElement__.js +1692 -0
- package/src/concepts/dist/View__.js +1601 -0
- package/src/concepts/index__.ts +0 -1
- package/src/enums/KEYWORDS.ts +8 -0
- package/src/generator/dist/genBundleFiles.js +261 -0
- package/src/generator/dist/genMetaData.js +245 -0
- package/src/generator/dist/permission.js +405 -0
- package/src/generator/genBundleFiles.ts +24 -5
- package/src/generator/genReleaseBody.ts +75 -30
- package/src/generator/permission.ts +31 -15
- package/src/server/entity2LogicNamespace.ts +2 -20
- package/src/server/extendBaseNode.ts +15 -5
- package/src/server/formatTsUtils.ts +41 -10
- package/src/server/getLogics.ts +4 -4
- package/src/server/getMemberIdentifier.ts +27 -1
- package/src/server/index.ts +2 -0
- package/src/server/naslServer.ts +520 -48
- package/src/server/translator.ts +96 -34
- package/src/service/storage/dist/init.js +579 -0
- package/src/service/storage/init.ts +22 -2
- package/src/templator/dist/genEditTableBlock.js +204 -0
- package/src/templator/dist/genGridViewBlock.js +265 -0
- package/src/templator/dist/genListViewBlock.js +84 -0
- package/src/templator/dist/genTableBlock.js +209 -0
- package/src/templator/dist/utils.js +527 -0
- package/src/templator/genCreateBlock.ts +1 -3
- package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -3
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -4
- package/src/templator/genGetBlock.ts +1 -1
- package/src/templator/genGridViewBlock.ts +3 -4
- package/src/templator/genListViewBlock.ts +9 -3
- package/src/templator/genSelectBlock.ts +1 -1
- package/src/templator/genTableBlock.ts +3 -3
- package/src/templator/genUpdateBlock.ts +2 -3
- package/src/utils/traverse.ts +10 -2
- package/ts-worker/lib/tsserver.js +10 -2
- package/ts-worker/package.json +1 -0
- package/ts-worker/webpack.config.js +11 -2
- package/out/concepts/ConstructArgument__.d.ts +0 -40
- package/out/concepts/ConstructArgument__.js +0 -108
- package/out/concepts/ConstructArgument__.js.map +0 -1
- package/out/concepts/Construct__.d.ts +0 -189
- package/out/concepts/Construct__.js +0 -340
- package/out/concepts/Construct__.js.map +0 -1
- package/out/templator/sql-parser/index.d.ts +0 -1
- package/out/templator/sql-parser/index.js +0 -228
- package/out/templator/sql-parser/index.js.map +0 -1
- package/out/templator/sql-parser/parser.js +0 -26664
- package/out/templator/sql-parser/parser.js.map +0 -1
package/src/concepts/App__.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { getNaslNodeByNodeCallee, getNodeByNodeCallee } from '../automate/engine
|
|
|
9
9
|
import ConfigProperty from './ConfigProperty__';
|
|
10
10
|
import TypeAnnotation from './TypeAnnotation__';
|
|
11
11
|
import View from './View__';
|
|
12
|
-
// import CallLogic from './CallLogic__';
|
|
13
12
|
interface MessageData {
|
|
14
13
|
logicName: string
|
|
15
14
|
param?: string
|
|
@@ -18,6 +17,8 @@ interface MessageData {
|
|
|
18
17
|
type: number
|
|
19
18
|
resultName?:string,
|
|
20
19
|
}
|
|
20
|
+
// import CallLogic from './CallLogic__';
|
|
21
|
+
|
|
21
22
|
//================================================================================
|
|
22
23
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
23
24
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -2224,8 +2225,13 @@ export class App extends BaseNode {
|
|
|
2224
2225
|
return null;
|
|
2225
2226
|
}
|
|
2226
2227
|
const nameItem = nameArr[index];
|
|
2227
|
-
const isKeyword = index % 2 === mod;
|
|
2228
|
-
if (!isKeyword && Array.isArray(node)) {
|
|
2228
|
+
// const isKeyword = index % 2 === mod;
|
|
2229
|
+
// if (!isKeyword && Array.isArray(node)) {
|
|
2230
|
+
// node = node.find(({ name }) => name === nameItem);
|
|
2231
|
+
// } else {
|
|
2232
|
+
// node = node[nameItem];
|
|
2233
|
+
// }
|
|
2234
|
+
if (Array.isArray(node)) {
|
|
2229
2235
|
node = node.find(({ name }) => name === nameItem);
|
|
2230
2236
|
} else {
|
|
2231
2237
|
node = node[nameItem];
|
|
@@ -2460,7 +2466,7 @@ export class App extends BaseNode {
|
|
|
2460
2466
|
interfaceName: item.name,
|
|
2461
2467
|
param: param.name,
|
|
2462
2468
|
type: 1,
|
|
2463
|
-
message: `参数“${param.name}
|
|
2469
|
+
message: `参数“${param.name}”已被删除,请确定请求类型无误后点击“重新导出”`,
|
|
2464
2470
|
});
|
|
2465
2471
|
}
|
|
2466
2472
|
const interfaceTypeAnnotation = param.typeAnnotation.toJSON() as TypeAnnotation;
|
|
@@ -2479,7 +2485,7 @@ export class App extends BaseNode {
|
|
|
2479
2485
|
interfaceName: item.name,
|
|
2480
2486
|
param: param.name,
|
|
2481
2487
|
type: 2,
|
|
2482
|
-
message: `参数“${param.name}
|
|
2488
|
+
message: `参数“${param.name}”数据类型变更,请确定请求类型无误后点击“重新导出”`,
|
|
2483
2489
|
});
|
|
2484
2490
|
}
|
|
2485
2491
|
});
|
|
@@ -2530,7 +2536,7 @@ export class App extends BaseNode {
|
|
|
2530
2536
|
type: 7,
|
|
2531
2537
|
message: `输出参数“${logicReturns[0].name}”没有数据类型,无法导出`,
|
|
2532
2538
|
});
|
|
2533
|
-
} else if (
|
|
2539
|
+
} else if (!logicReturns[0]?.__TypeAnnotation.isSame(interfaceReturns[0]?.typeAnnotation)) {
|
|
2534
2540
|
errorList.push({
|
|
2535
2541
|
logicName: logic.name,
|
|
2536
2542
|
interfaceName: item.name,
|
|
@@ -2554,7 +2560,7 @@ export class App extends BaseNode {
|
|
|
2554
2560
|
errorList.push({
|
|
2555
2561
|
logicName: logic.name,
|
|
2556
2562
|
param: i,
|
|
2557
|
-
message: `新增参数“${i}
|
|
2563
|
+
message: `新增参数“${i}”,请确定请求类型无误后点击“重新导出”`,
|
|
2558
2564
|
type: 3,
|
|
2559
2565
|
});
|
|
2560
2566
|
}
|
|
@@ -2595,6 +2601,29 @@ export class App extends BaseNode {
|
|
|
2595
2601
|
return Array.from(new Set(resultLogics));
|
|
2596
2602
|
}
|
|
2597
2603
|
|
|
2604
|
+
genAllCustomComponents() {
|
|
2605
|
+
const frontends = this.frontends;
|
|
2606
|
+
const compMap: {
|
|
2607
|
+
pc: Array<any>
|
|
2608
|
+
h5: Array<any>
|
|
2609
|
+
} = {
|
|
2610
|
+
pc: [],
|
|
2611
|
+
h5: [],
|
|
2612
|
+
};
|
|
2613
|
+
const existingSet = new Set();
|
|
2614
|
+
frontends.forEach((frontend) => {
|
|
2615
|
+
if (frontend.componentDependencies) {
|
|
2616
|
+
frontend.componentDependencies.forEach((dep) => {
|
|
2617
|
+
const { name } = dep;
|
|
2618
|
+
if (!existingSet.has(name)) {
|
|
2619
|
+
compMap[frontend.type].push(dep);
|
|
2620
|
+
}
|
|
2621
|
+
});
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
return compMap;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2598
2627
|
//================================================================================
|
|
2599
2628
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2600
2629
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -664,10 +664,11 @@ export class Assignee extends LogicItem {
|
|
|
664
664
|
code += `${logic.toEmbeddedTSInProcess(shiftState(state, code, { tabSize: (state?.tabSize || 0) }), prevCode, false, true)}\n`;
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
|
-
code += `${tab}
|
|
668
|
-
this.dynamicUsers.forEach((u) => {
|
|
667
|
+
code += `${tab}nasl.util.concatString(`;
|
|
668
|
+
this.dynamicUsers.forEach((u, index) => {
|
|
669
669
|
code += u.toEmbeddedTS(shiftState(state, code));
|
|
670
|
-
|
|
670
|
+
if (index + 1 < this.dynamicUsers.length)
|
|
671
|
+
code += ', ';
|
|
671
672
|
});
|
|
672
673
|
code += ')\n';
|
|
673
674
|
// code += `${this.dynamicUsers.map(u => u.toEmbeddedTS(shiftState(state, code))).join(',\n')})\n`;
|
|
@@ -634,7 +634,7 @@ export class BatchAssignment extends LogicItem {
|
|
|
634
634
|
let count = 0;
|
|
635
635
|
const typeAnnotationEnd = () => {
|
|
636
636
|
const l = this.left.members.every((item) => item.__isCorrectTypeAnnotation);
|
|
637
|
-
const r = this.rights.every((right) => right.members.every((item) => item.__isCorrectTypeAnnotation));
|
|
637
|
+
const r = this.rights.every((right) => right.members.every((item) => item.__isCorrectTypeAnnotation) && right.expression.__isCorrectTypeAnnotation);
|
|
638
638
|
count++;
|
|
639
639
|
if (l && r) {
|
|
640
640
|
autoConnection();
|
|
@@ -780,7 +780,7 @@ export class BatchAssignment extends LogicItem {
|
|
|
780
780
|
// 修改连线
|
|
781
781
|
if (selectMember.parentKey === 'left') {
|
|
782
782
|
members.forEach((item: any, index: any) => {
|
|
783
|
-
if (keepMembers
|
|
783
|
+
if (keepMembers?.has(item.completeName)) {
|
|
784
784
|
const lines = this.findlines(item, selectMember);
|
|
785
785
|
lines.forEach((line) => {
|
|
786
786
|
const newLine = Object.assign({}, line, { leftIndex: [line.leftIndex[0], index] });
|
|
@@ -796,7 +796,7 @@ export class BatchAssignment extends LogicItem {
|
|
|
796
796
|
const splitIndex = this.rights.findIndex((right) => selectMember === right);
|
|
797
797
|
newLines = this.assignmentLines.filter(({ rightIndex }) => rightIndex[0] !== splitIndex);
|
|
798
798
|
members.forEach((item, index) => {
|
|
799
|
-
if (keepMembers
|
|
799
|
+
if (keepMembers?.has(item.completeName)) {
|
|
800
800
|
const lines = this.findlines(item, selectMember);
|
|
801
801
|
lines.forEach((line) => {
|
|
802
802
|
const newLine = Object.assign({}, line, { rightIndex: [line.rightIndex[0], index] });
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TranslatorState, shiftState, withSourceMap } from '../translator';
|
|
2
2
|
import { ElementToVueOptions } from './ViewElement__';
|
|
3
3
|
import Namespace from './Namespace__';
|
|
4
|
+
import MemberExpression from './MemberExpression__';
|
|
5
|
+
|
|
4
6
|
//================================================================================
|
|
5
7
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
6
8
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -24,6 +26,7 @@ import Module from './Module__';
|
|
|
24
26
|
import App from './App__';
|
|
25
27
|
import Frontend from './Frontend__';
|
|
26
28
|
import Process from './Process__';
|
|
29
|
+
import Identifier from './Identifier__';
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* 元素绑定属性
|
|
@@ -394,6 +397,8 @@ export class BindAttribute extends BaseNode {
|
|
|
394
397
|
return node;
|
|
395
398
|
}
|
|
396
399
|
|
|
400
|
+
|
|
401
|
+
|
|
397
402
|
/**
|
|
398
403
|
* 插入逻辑项
|
|
399
404
|
* @internal
|
|
@@ -426,6 +431,8 @@ export class BindAttribute extends BaseNode {
|
|
|
426
431
|
return logicItem;
|
|
427
432
|
}
|
|
428
433
|
|
|
434
|
+
|
|
435
|
+
|
|
429
436
|
/**
|
|
430
437
|
* 插入逻辑项
|
|
431
438
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -448,6 +455,8 @@ export class BindAttribute extends BaseNode {
|
|
|
448
455
|
return node;
|
|
449
456
|
}
|
|
450
457
|
|
|
458
|
+
|
|
459
|
+
|
|
451
460
|
/**
|
|
452
461
|
* 添加逻辑项
|
|
453
462
|
* @internal
|
|
@@ -467,6 +476,8 @@ export class BindAttribute extends BaseNode {
|
|
|
467
476
|
return this._insertItemInPlaygroundAt(options as any, index);
|
|
468
477
|
}
|
|
469
478
|
|
|
479
|
+
|
|
480
|
+
|
|
470
481
|
/**
|
|
471
482
|
* 添加逻辑项
|
|
472
483
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -490,6 +501,9 @@ export class BindAttribute extends BaseNode {
|
|
|
490
501
|
return node;
|
|
491
502
|
}
|
|
492
503
|
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
493
507
|
/**
|
|
494
508
|
* 删除逻辑项
|
|
495
509
|
* @param name 逻辑项名称
|
|
@@ -515,6 +529,8 @@ export class BindAttribute extends BaseNode {
|
|
|
515
529
|
return expression.delete();
|
|
516
530
|
}
|
|
517
531
|
|
|
532
|
+
|
|
533
|
+
|
|
518
534
|
/**
|
|
519
535
|
* 删除跳转页面
|
|
520
536
|
* @param name 跳转页面名称
|
|
@@ -540,6 +556,8 @@ export class BindAttribute extends BaseNode {
|
|
|
540
556
|
return destination.delete();
|
|
541
557
|
}
|
|
542
558
|
|
|
559
|
+
|
|
560
|
+
|
|
543
561
|
/**
|
|
544
562
|
* 删除外部链接
|
|
545
563
|
* @param name 外部链接名称
|
|
@@ -565,6 +583,8 @@ export class BindAttribute extends BaseNode {
|
|
|
565
583
|
return externalDestination.delete();
|
|
566
584
|
}
|
|
567
585
|
|
|
586
|
+
|
|
587
|
+
|
|
568
588
|
/**
|
|
569
589
|
* 删除验证规则
|
|
570
590
|
* @param name 验证规则名称
|
|
@@ -590,6 +610,8 @@ export class BindAttribute extends BaseNode {
|
|
|
590
610
|
return validationRule.delete();
|
|
591
611
|
}
|
|
592
612
|
|
|
613
|
+
|
|
614
|
+
|
|
593
615
|
/**
|
|
594
616
|
* 删除经办人
|
|
595
617
|
* @param name 经办人名称
|
|
@@ -615,6 +637,8 @@ export class BindAttribute extends BaseNode {
|
|
|
615
637
|
return assignee.delete();
|
|
616
638
|
}
|
|
617
639
|
|
|
640
|
+
|
|
641
|
+
|
|
618
642
|
/**
|
|
619
643
|
* 删除逻辑项
|
|
620
644
|
* @param logicItem 已有的逻辑项实例
|
|
@@ -622,7 +646,7 @@ export class BindAttribute extends BaseNode {
|
|
|
622
646
|
removeItemInPlayground(logicItem: LogicItem): void;
|
|
623
647
|
|
|
624
648
|
removeItemInPlayground(options: LogicItem) {
|
|
625
|
-
|
|
649
|
+
let logicItem: LogicItem = options;
|
|
626
650
|
return logicItem.delete();
|
|
627
651
|
}
|
|
628
652
|
|
|
@@ -680,59 +704,296 @@ export class BindAttribute extends BaseNode {
|
|
|
680
704
|
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
681
705
|
}
|
|
682
706
|
|
|
707
|
+
// 属性上绑定的表达式
|
|
708
|
+
get bindExpressions() {
|
|
709
|
+
const expressions: any[] = [];
|
|
710
|
+
// 跳转需要特殊处理
|
|
711
|
+
if (['externalDestination', 'destination'].includes(this.name)) {
|
|
712
|
+
const { link, arguments: params, anchor } = (this as any)[this.name] || {};
|
|
713
|
+
// externalDestination有跳转链接表达式
|
|
714
|
+
if (link) {
|
|
715
|
+
expressions.push(link);
|
|
716
|
+
}
|
|
717
|
+
// destination有参数
|
|
718
|
+
if (Array.isArray(params)) {
|
|
719
|
+
expressions.push(...params);
|
|
720
|
+
}
|
|
721
|
+
// 锚点表达式
|
|
722
|
+
if (anchor?.expression) {
|
|
723
|
+
expressions.push(anchor?.expression);
|
|
724
|
+
}
|
|
725
|
+
} else if (this.name === 'rules') {
|
|
726
|
+
if (Array.isArray(this.rules)) {
|
|
727
|
+
this.rules.forEach((rule) => {
|
|
728
|
+
const { arguments: args, errorMessage } = rule || {};
|
|
729
|
+
if (Array.isArray(args)) {
|
|
730
|
+
expressions.push(...args);
|
|
731
|
+
}
|
|
732
|
+
expressions.push(errorMessage);
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
} else if (this.expression) {
|
|
736
|
+
expressions.push(this.expression);
|
|
737
|
+
}
|
|
738
|
+
return expressions;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// 是否需要用标识符替换
|
|
742
|
+
get needReplaceWithIdentifier() {
|
|
743
|
+
let bindExpression = false;
|
|
744
|
+
const expressions: any[] = this.bindExpressions;
|
|
745
|
+
if (Array.isArray(expressions) && expressions.length) {
|
|
746
|
+
expressions.forEach((expression) => {
|
|
747
|
+
let rootMemberExpression: any;
|
|
748
|
+
let tempNode = expression;
|
|
749
|
+
while (tempNode?.concept === 'MemberExpression') {
|
|
750
|
+
rootMemberExpression = tempNode;
|
|
751
|
+
tempNode = (tempNode as MemberExpression)?.object;
|
|
752
|
+
}
|
|
753
|
+
// 变量和变量的成员表达式不进行替换
|
|
754
|
+
if (
|
|
755
|
+
!(
|
|
756
|
+
['Identifier', 'StringLiteral'].includes(expression?.concept)
|
|
757
|
+
|| (rootMemberExpression && rootMemberExpression.object?.concept === 'Identifier')
|
|
758
|
+
)
|
|
759
|
+
&& (this.type === 'dynamic' || (this.name === 'rules' && this.rules))
|
|
760
|
+
) {
|
|
761
|
+
bindExpression = true;
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
return bindExpression;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// 获取表达式在页面中的名字
|
|
769
|
+
get expressionNameInView() {
|
|
770
|
+
const nameList: string[] = [];
|
|
771
|
+
let node: BaseNode = this;
|
|
772
|
+
while (node) {
|
|
773
|
+
nameList.unshift(node.name);
|
|
774
|
+
if (node.concept === 'ViewElement') {
|
|
775
|
+
node = null;
|
|
776
|
+
} else {
|
|
777
|
+
nameList.unshift(node.parentKey);
|
|
778
|
+
node = node.parentNode;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
return nameList.join('_').replace(/-/g, '_');
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// 获取表达式生成器名称
|
|
785
|
+
get expressionBuilderName() {
|
|
786
|
+
let expressionInViewName = this.expressionNameInView;
|
|
787
|
+
expressionInViewName = expressionInViewName.charAt(0).toUpperCase() + expressionInViewName.slice(1);
|
|
788
|
+
return `gen${expressionInViewName}`;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// 获取参数列表
|
|
792
|
+
getArgsList() {
|
|
793
|
+
const viewElement = this?.getAncestor('ViewElement');
|
|
794
|
+
const argsList = [];
|
|
795
|
+
let parent = viewElement?.parentNode;
|
|
796
|
+
let index = 0;
|
|
797
|
+
while (parent && parent.concept !== 'View') {
|
|
798
|
+
if ((parent as ViewElement).slotScope) {
|
|
799
|
+
argsList.unshift(index === 0 ? 'current' : 'current' + index);
|
|
800
|
+
index++;
|
|
801
|
+
}
|
|
802
|
+
parent = parent.parentNode;
|
|
803
|
+
}
|
|
804
|
+
return argsList;
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// 表达式中需要被监听的变量
|
|
808
|
+
get watchedVariableMap() {
|
|
809
|
+
const map: any = {};
|
|
810
|
+
// 页面中表达式用到的变量需要监听,从而重新执行match表达式
|
|
811
|
+
utils.traverse((current: any) => {
|
|
812
|
+
const { node } = current || {};
|
|
813
|
+
const { concept } = node || {};
|
|
814
|
+
if (['Identifier'].includes(concept)) {
|
|
815
|
+
let expressionNode = node;
|
|
816
|
+
let memberExpressionNode = node?.parentNode;
|
|
817
|
+
while (memberExpressionNode?.concept === 'MemberExpression') {
|
|
818
|
+
expressionNode = memberExpressionNode;
|
|
819
|
+
const { concept: objConcept } = memberExpressionNode.object || {};
|
|
820
|
+
if (!['MemberExpression', 'Identifier'].includes(objConcept)) {
|
|
821
|
+
memberExpressionNode = null;
|
|
822
|
+
expressionNode = null;
|
|
823
|
+
} else {
|
|
824
|
+
memberExpressionNode = memberExpressionNode.object;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
if (expressionNode) {
|
|
828
|
+
map[expressionNode.toJS()] = true;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}, {
|
|
832
|
+
node: this,
|
|
833
|
+
}, {
|
|
834
|
+
mode: 'anyObject',
|
|
835
|
+
excludedKeySet: new Set([
|
|
836
|
+
// 排除playground里的表达式
|
|
837
|
+
'playground',
|
|
838
|
+
'parentNode',
|
|
839
|
+
'sourceMap',
|
|
840
|
+
'storageJSON',
|
|
841
|
+
'tsErrorDetail',
|
|
842
|
+
'NaslAnnotatedJSON',
|
|
843
|
+
'calledFrom',
|
|
844
|
+
'_events',
|
|
845
|
+
'_collectingList',
|
|
846
|
+
'_historyList',
|
|
847
|
+
]),
|
|
848
|
+
});
|
|
849
|
+
return map;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
getInViewMethod(state?: TranslatorState) {
|
|
853
|
+
const argsList = this.getArgsList() || [];
|
|
854
|
+
const hasArgs = !!argsList.length;
|
|
855
|
+
let argStr = '';
|
|
856
|
+
|
|
857
|
+
// 容错代码
|
|
858
|
+
let ftCode = '';
|
|
859
|
+
if (hasArgs) {
|
|
860
|
+
argsList.forEach((arg) => {
|
|
861
|
+
ftCode += `if (!this.${this.expressionNameInView}${argStr}) {
|
|
862
|
+
this.${this.expressionNameInView}${argStr} = {};
|
|
863
|
+
}\n`;
|
|
864
|
+
argStr += `[${arg}.hasOwnProperty('__nodeKey') ? ${arg}.__nodeKey : ${arg}.index]`;
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
ftCode += `if (!this.${this.expressionNameInView}${argStr}) {
|
|
868
|
+
this.${this.expressionNameInView}${argStr} = {};
|
|
869
|
+
}`;
|
|
870
|
+
|
|
871
|
+
// 新的参数
|
|
872
|
+
const paramList = Object.keys(this.watchedVariableMap);
|
|
873
|
+
let newParams = `const newParams = [];`;
|
|
874
|
+
if (Array.isArray(paramList) && paramList.length) {
|
|
875
|
+
paramList.forEach((param) => {
|
|
876
|
+
newParams += `newParams.push(${param});\n`;
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// 表达式主体
|
|
881
|
+
let expressionStr = '';
|
|
882
|
+
if (this.type === 'dynamic') {
|
|
883
|
+
if (['externalDestination', 'destination'].includes(this.name)) {
|
|
884
|
+
expressionStr = (this as any)[this.name].toInViewMethod() || '';
|
|
885
|
+
} else {
|
|
886
|
+
expressionStr = this.expression?.toJS() || '';
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
if (this.name === 'rules' && this.rules) {
|
|
890
|
+
const ruleStrs = this.rules.map((rule) => rule.toInViewMethod());
|
|
891
|
+
expressionStr = `[${ruleStrs.join(' , ')}]`;
|
|
892
|
+
}
|
|
893
|
+
// 变量重新设置,为了触发重新调用
|
|
894
|
+
let setVarStr = `this.${this.expressionNameInView}${argStr} = {
|
|
895
|
+
...(this.${this.expressionNameInView}${argStr} || {}),
|
|
896
|
+
value: value,
|
|
897
|
+
};`;
|
|
898
|
+
if (Array.isArray(argsList) && argsList.length) {
|
|
899
|
+
setVarStr += `this.${this.expressionNameInView} = {...this.${this.expressionNameInView}};\n`;
|
|
900
|
+
}
|
|
901
|
+
const code = `${this.expressionBuilderName} (${argsList.join(', ')}) {
|
|
902
|
+
// 容错代码
|
|
903
|
+
${ftCode}
|
|
904
|
+
(async () => {
|
|
905
|
+
// 旧的参数
|
|
906
|
+
const oldParams = this.${this.expressionNameInView}${argStr}.params;
|
|
907
|
+
// 新的参数
|
|
908
|
+
${newParams}
|
|
909
|
+
const isLooseEqual = this.$isLooseEqualFn(oldParams, newParams);
|
|
910
|
+
if (!isLooseEqual) {
|
|
911
|
+
this.${this.expressionNameInView}${argStr}.params = newParams;
|
|
912
|
+
const value = ${expressionStr};
|
|
913
|
+
${setVarStr}
|
|
914
|
+
}
|
|
915
|
+
})();
|
|
916
|
+
return this.${this.expressionNameInView}${argStr}.value;
|
|
917
|
+
}`;
|
|
918
|
+
|
|
919
|
+
return code;
|
|
920
|
+
}
|
|
921
|
+
|
|
683
922
|
/**
|
|
684
923
|
* 转换成 Vue 的模板格式
|
|
685
924
|
*/
|
|
686
925
|
toVue(options?: ElementToVueOptions) {
|
|
926
|
+
let str = '';
|
|
687
927
|
let value = this.value;
|
|
688
|
-
if (this.type === 'dynamic') {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
928
|
+
if (this.type === 'dynamic' || (this.name === 'rules' && this.rules)) {
|
|
929
|
+
// 需要用标识符替换
|
|
930
|
+
if (options?.finalCode !== false && this.needReplaceWithIdentifier) {
|
|
931
|
+
const argsList = this.getArgsList();
|
|
932
|
+
value = `${this.expressionBuilderName}(${argsList.join(', ')})`;
|
|
933
|
+
} else if (this.name === 'rules' && this.rules) {
|
|
934
|
+
const ruleStrs = this.rules.map((rule) => rule.toVue(options));
|
|
935
|
+
value = `[${ruleStrs.join(' , ')}]`;
|
|
936
|
+
} else if (['destination', 'externalDestination'].includes(this.name)) {
|
|
937
|
+
value = (this as any)?.[this.name]?.toVue(options) || '';
|
|
938
|
+
} else {
|
|
939
|
+
value = this.expression?.toVue(options) || '';
|
|
940
|
+
}
|
|
941
|
+
} else if (this.type === 'string') {
|
|
942
|
+
if (this.name === 'destination') {
|
|
943
|
+
if (this.frontend?.basePath) {
|
|
944
|
+
value = `${this.frontend?.basePath}${value}`;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
if (this.name === 'href' && value.startsWith('/')) {
|
|
948
|
+
if (this.frontend?.basePath) {
|
|
949
|
+
value = `${this.frontend?.basePath}${value}`;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
692
952
|
}
|
|
953
|
+
|
|
693
954
|
if (value !== undefined && value !== null && typeof value === 'string') {
|
|
694
955
|
value = value.replace(/"/g, "'");
|
|
695
956
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
if (
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
// 文本默认要经过toString转换
|
|
713
|
-
if (options.finalCode !== false && name === 'text' && !this.sync && this.type === 'dynamic') {
|
|
714
|
-
const expTypeAnnotation = (this.expression as any)?.typeAnnotation || this.expression?.__TypeAnnotation;
|
|
715
|
-
value = `$utils['ToString'](${value}, '${expTypeAnnotation?.sortedTypeKey}')`;
|
|
716
|
-
}
|
|
717
|
-
if (this.type === 'string') {
|
|
718
|
-
str += `${name}="${value}"`;
|
|
957
|
+
let name = this.name;
|
|
958
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
959
|
+
if (name === 'download') {
|
|
960
|
+
str += 'download="true" ';
|
|
961
|
+
name = 'href';
|
|
962
|
+
}
|
|
963
|
+
// 文本默认要经过toString转换
|
|
964
|
+
if (options?.finalCode !== false && name === 'text' && !this.sync && this.type === 'dynamic') {
|
|
965
|
+
const expTypeAnnotation = (this.expression as any)?.typeAnnotation || this.expression?.__TypeAnnotation;
|
|
966
|
+
value = `$utils['ToString'](${value}, '${expTypeAnnotation?.sortedTypeKey}')`;
|
|
967
|
+
}
|
|
968
|
+
if (this.type === 'string' && name !== 'rules') {
|
|
969
|
+
str += `${name}="${value}"`;
|
|
970
|
+
} else {
|
|
971
|
+
if (this.sync) {
|
|
972
|
+
str += `:${name}.sync="${value}"`;
|
|
719
973
|
} else {
|
|
720
|
-
|
|
974
|
+
if (name === 'destination') {
|
|
975
|
+
str += `:destination="${value}"`;
|
|
976
|
+
} else if (name === 'externalDestination') {
|
|
977
|
+
str += `:link="${value}"`;
|
|
978
|
+
} else if (name === 'rules') {
|
|
979
|
+
str += `:${name}="${value}"`;
|
|
980
|
+
} else {
|
|
981
|
+
str += `:${name}="${value}"`;
|
|
982
|
+
}
|
|
721
983
|
}
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
984
|
+
}
|
|
985
|
+
} else if (this.type === 'string' && this.value === '')
|
|
986
|
+
if (!['destination', 'externalDestination'].includes(this.name)) {
|
|
987
|
+
str = `${name}="${this.value}"`;
|
|
988
|
+
}
|
|
989
|
+
return str;
|
|
729
990
|
}
|
|
730
991
|
|
|
731
992
|
@withSourceMap()
|
|
732
993
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
733
994
|
let code = '() => {';
|
|
734
|
-
if (this.name
|
|
735
|
-
code += this.
|
|
995
|
+
if (['destination', 'externalDestination'].includes(this.name) && this.type === 'dynamic') {
|
|
996
|
+
code += (this as any)[this.name].toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
736
997
|
code += ';\n';
|
|
737
998
|
} else if (this.name === 'rules') {
|
|
738
999
|
this.rules?.forEach((item, index) => {
|