@lcap/nasl 3.6.0-alpha.1 → 3.6.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/bak/translator.js +119 -39
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/generator/BreakpointNode.d.ts +3 -0
- package/out/breakpoint/generator/BreakpointNode.js +9 -0
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
- package/out/breakpoint/shared/constants.js +1 -0
- package/out/breakpoint/shared/constants.js.map +1 -1
- package/out/breakpoint/shared/utils.js +12 -6
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/breakpoint/store/core.js +1 -1
- package/out/breakpoint/store/core.js.map +1 -1
- package/out/common/BaseNode.d.ts +1 -4
- package/out/common/BaseNode.js +23 -37
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +6 -1
- package/out/concepts/AnonymousFunction__.js +34 -16
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +55 -51
- package/out/concepts/App__.js +76 -80
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +10 -2
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +16 -6
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +1 -0
- package/out/concepts/BindDirective__.js +19 -4
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +3 -1
- package/out/concepts/BindEvent__.js +39 -14
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BusinessComponent__.d.ts +641 -0
- package/out/concepts/BusinessComponent__.js +1921 -0
- package/out/concepts/BusinessComponent__.js.map +1 -0
- package/out/concepts/BusinessLogic__.d.ts +38 -0
- package/out/concepts/BusinessLogic__.js +358 -0
- package/out/concepts/BusinessLogic__.js.map +1 -0
- package/out/concepts/CallEvent__.d.ts +101 -0
- package/out/concepts/CallEvent__.js +280 -0
- package/out/concepts/CallEvent__.js.map +1 -0
- package/out/concepts/CallFunction__.d.ts +0 -1
- package/out/concepts/CallFunction__.js +10 -10
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -0
- package/out/concepts/CallLogic__.js +38 -27
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Constant__.js +7 -6
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +1 -1
- package/out/concepts/Destination__.js +7 -5
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +2 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/Event__.d.ts +14 -0
- package/out/concepts/Event__.js +61 -0
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +308 -0
- package/out/concepts/FrontendType__.js +605 -0
- package/out/concepts/FrontendType__.js.map +1 -0
- package/out/concepts/Frontend__.d.ts +0 -88
- package/out/concepts/Frontend__.js +1 -143
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +5 -0
- package/out/concepts/Identifier__.js +19 -9
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +1 -1
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +3 -1
- package/out/concepts/Logic__.js +31 -21
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/Match__.d.ts +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -1
- package/out/concepts/MemberExpression__.js +3 -3
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/ParamWithGroup__.d.ts +39 -0
- package/out/concepts/ParamWithGroup__.js +85 -0
- package/out/concepts/ParamWithGroup__.js.map +1 -0
- package/out/concepts/Param__.js +11 -3
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +9 -1
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/Return__.js +17 -9
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +2 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +17 -8
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +17 -1
- package/out/concepts/ViewElement__.js +145 -16
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +21 -20
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/index__.d.ts +5 -0
- package/out/concepts/index__.js +5 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/utils/asserts.d.ts +258 -3
- package/out/concepts/utils/asserts.js +351 -13
- package/out/concepts/utils/asserts.js.map +1 -1
- package/out/concepts/utils/types.d.ts +20 -3
- package/out/generator/genBundleFiles.js +25 -11
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.js +12 -3
- 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/natural/transformTSCode.js +1 -1
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +6 -4
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getLogics.js +62 -27
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +6 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.js +3 -3
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.js +40 -19
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +6 -1
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.js +1 -2
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -6
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +16 -16
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +36 -36
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +6 -5
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +12 -12
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +4 -4
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +3 -3
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +10 -10
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +10 -9
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +2 -2
- package/out/templator/utils.js.map +1 -1
- package/out/translator/utils.js +12 -1
- package/out/translator/utils.js.map +1 -1
- package/out/utils/i18nInfo.js +7 -2
- package/out/utils/i18nInfo.js.map +1 -1
- package/out/utils/index.d.ts +17 -0
- package/out/utils/index.js +184 -1
- package/out/utils/index.js.map +1 -1
- package/package.json +2 -2
- package/src/bak/translator.js +121 -43
- package/src/breakpoint/generator/BreakpointNode.ts +12 -0
- package/src/breakpoint/shared/constants.ts +1 -0
- package/src/breakpoint/shared/utils.ts +13 -8
- package/src/breakpoint/store/core.ts +1 -1
- package/src/common/BaseNode.ts +22 -41
- package/src/concepts/AnonymousFunction__.ts +36 -18
- package/src/concepts/App__.ts +129 -130
- package/src/concepts/BackendVariable__.ts +10 -2
- package/src/concepts/BindAttribute__.ts +14 -6
- package/src/concepts/BindDirective__.ts +19 -4
- package/src/concepts/BindEvent__.ts +41 -13
- package/src/concepts/BusinessComponent__.ts +2693 -0
- package/src/concepts/BusinessLogic__.ts +376 -0
- package/src/concepts/CallEvent__.ts +351 -0
- package/src/concepts/CallFunction__.ts +10 -13
- package/src/concepts/CallLogic__.ts +45 -32
- package/src/concepts/Constant__.ts +5 -7
- package/src/concepts/Destination__.ts +7 -5
- package/src/concepts/End__.ts +1 -0
- package/src/concepts/Event__.ts +70 -0
- package/src/concepts/FrontendType__.ts +919 -0
- package/src/concepts/Frontend__.ts +3 -251
- package/src/concepts/Identifier__.ts +29 -13
- package/src/concepts/LogicItem__.ts +1 -0
- package/src/concepts/Logic__.ts +36 -23
- package/src/concepts/MemberExpression__.ts +3 -3
- package/src/concepts/NewComposite__.ts +4 -6
- package/src/concepts/ParamWithGroup__.ts +101 -0
- package/src/concepts/Param__.ts +11 -3
- package/src/concepts/ProcessElement__.ts +8 -1
- package/src/concepts/Return__.ts +15 -12
- package/src/concepts/ValidationRule__.ts +6 -1
- package/src/concepts/Variable__.ts +17 -9
- package/src/concepts/ViewElement__.ts +168 -33
- package/src/concepts/View__.ts +23 -20
- package/src/concepts/index__.ts +5 -0
- package/src/concepts/utils/asserts.ts +367 -4
- package/src/concepts/utils/types.ts +28 -0
- package/src/generator/genBundleFiles.ts +33 -15
- package/src/generator/genReleaseBody.ts +14 -3
- package/src/generator/permission.ts +8 -6
- package/src/natural/transformTSCode.ts +1 -1
- package/src/server/extendBaseNode.ts +22 -20
- package/src/server/getLogics.ts +79 -41
- package/src/server/getMemberIdentifier.ts +7 -1
- package/src/server/getProcesses.ts +3 -3
- package/src/server/naslServer.ts +44 -20
- package/src/server/translator.ts +7 -1
- package/src/service/storage/init.ts +1 -2
- package/src/templator/genCreateBlock.ts +6 -6
- package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -16
- package/src/templator/genCurdMultipleKeyBlock.ts +36 -36
- package/src/templator/genGetBlock.ts +6 -5
- package/src/templator/genGridViewBlock.ts +12 -12
- package/src/templator/genListViewBlock.ts +4 -4
- package/src/templator/genSelectBlock.ts +3 -3
- package/src/templator/genTableBlock.ts +10 -10
- package/src/templator/genUpdateBlock.ts +10 -9
- package/src/templator/utils.ts +2 -2
- package/src/translator/utils.ts +12 -1
- package/src/utils/i18nInfo.ts +7 -2
- package/src/utils/index.ts +211 -1
- package/test/concepts/call-function/fixtures/from-string.json +68 -59
- package/test/concepts/call-function/fixtures/to-string-global-tz.json +67 -58
- package/test/concepts/call-function/fixtures/to-string-no-tz.json +57 -48
- package/test/concepts/call-function/fixtures/to-string-user-tz.json +69 -60
- package/test/concepts/call-function/fixtures/to-string-utc-tz.json +69 -60
- package/test/concepts/call-interface/fixtures/only-interface.json +81 -72
- package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +223 -214
- package/test/concepts/call-interface/fixtures/with-body-no-argument.json +85 -76
- package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +100 -91
- package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +88 -79
- package/test/concepts/call-interface/fixtures/with-headers.json +90 -81
- package/test/concepts/call-interface/fixtures/with-query-no-argument.json +88 -79
- package/test/concepts/call-interface/fixtures/with-query.json +90 -81
- package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +4 -2
- package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +104 -95
- package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +209 -200
- package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +97 -88
- package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +124 -115
- package/test/concepts/call-logic/fixtures/json-deserialize.json +120 -111
- package/test/concepts/call-logic/fixtures/json-serialize-with-string.json +124 -115
- package/test/concepts/call-logic/fixtures/json-serialize.json +124 -115
- package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +91 -82
- package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +88 -79
- package/test/concepts/call-logic/fixtures/view-component-with-validation.json +144 -135
- package/test/concepts/identifier/fixtures/view-variable.json +145 -136
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +1 -1
- package/test/concepts/view-element/fixtures/default-login.json +221 -212
- package/test/concepts/view-element/fixtures/default-not-found.json +183 -174
- package/test/concepts/view-element/fixtures/with-role-auth.json +91 -82
- package/test/concepts/view-element/fixtures/with-table.json +1894 -1885
- package/test/concepts/view-element/toVue.spec.ts +1 -0
- package/ts-worker/package.json +1 -1
- package/ts-worker/src/index.js +1 -0
package/src/concepts/App__.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { queryNodeByPath } from '../service/storage/jsoner';
|
|
2
2
|
import { getNaslNodeByNodeCallee, getNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
|
-
import ConfigProperty from './ConfigProperty__';
|
|
4
|
-
import TypeAnnotation from './TypeAnnotation__';
|
|
5
|
-
import View from './View__';
|
|
6
|
-
import AuthInterface from './AuthInterface__';
|
|
7
|
-
import Interface from './Interface__';
|
|
3
|
+
import type ConfigProperty from './ConfigProperty__';
|
|
4
|
+
import type TypeAnnotation from './TypeAnnotation__';
|
|
5
|
+
import type View from './View__';
|
|
6
|
+
import type AuthInterface from './AuthInterface__';
|
|
7
|
+
import type Interface from './Interface__';
|
|
8
|
+
import type Frontend from './Frontend__';
|
|
8
9
|
import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
|
|
9
10
|
|
|
10
|
-
// import CallLogic from './CallLogic__';
|
|
11
|
-
|
|
12
11
|
export interface AssetsInfo {
|
|
13
12
|
js: Array<string>;
|
|
14
13
|
css: Array<string>;
|
|
@@ -59,7 +58,7 @@ import type Enum from './Enum__';
|
|
|
59
58
|
import type Logic from './Logic__';
|
|
60
59
|
import type OverriddenLogic from './OverriddenLogic__';
|
|
61
60
|
import type AbstractInterface from './AbstractInterface__';
|
|
62
|
-
import type
|
|
61
|
+
import type FrontendType from './FrontendType__';
|
|
63
62
|
import Backend from './Backend__';
|
|
64
63
|
import type Process from './Process__';
|
|
65
64
|
import type Role from './Role__';
|
|
@@ -206,14 +205,14 @@ export class App extends BaseNode {
|
|
|
206
205
|
interfaces: Array<AbstractInterface> = [];
|
|
207
206
|
|
|
208
207
|
/**
|
|
209
|
-
*
|
|
208
|
+
* 端类型列表
|
|
210
209
|
*/
|
|
211
210
|
@property({
|
|
212
|
-
objectRef: '
|
|
211
|
+
objectRef: 'FrontendType',
|
|
213
212
|
isArray: true,
|
|
214
213
|
defaultValue: [],
|
|
215
214
|
})
|
|
216
|
-
|
|
215
|
+
frontendTypes: Array<FrontendType> = [];
|
|
217
216
|
|
|
218
217
|
/**
|
|
219
218
|
* 后端
|
|
@@ -1471,156 +1470,158 @@ export class App extends BaseNode {
|
|
|
1471
1470
|
return utils.unique(name, this.getAbstractInterfaceExistingNames(), undefined, true);
|
|
1472
1471
|
}
|
|
1473
1472
|
|
|
1474
|
-
|
|
1473
|
+
getFrontendTypeExistingNames(excludedList: Array<FrontendType> = []) {
|
|
1475
1474
|
const excludedSet = new Set(excludedList);
|
|
1476
|
-
return ((this.
|
|
1475
|
+
return ((this.frontendTypes as FrontendType[]) || [])
|
|
1476
|
+
.filter((item) => !excludedSet.has(item))
|
|
1477
|
+
.map((item) => item?.name);
|
|
1477
1478
|
}
|
|
1478
|
-
|
|
1479
|
-
return utils.unique(name, this.
|
|
1479
|
+
getFrontendTypeUniqueName(name = 'frontendType1') {
|
|
1480
|
+
return utils.unique(name, this.getFrontendTypeExistingNames(), undefined, true);
|
|
1480
1481
|
}
|
|
1481
1482
|
|
|
1482
1483
|
/**
|
|
1483
|
-
*
|
|
1484
|
+
* 插入端类型
|
|
1484
1485
|
* @internal
|
|
1485
|
-
* @param name
|
|
1486
|
+
* @param name 端类型名称,如果不填会自动生成一个唯一名称
|
|
1486
1487
|
*/
|
|
1487
|
-
|
|
1488
|
+
_insertFrontendTypeAt(name: string, index: number): FrontendType;
|
|
1488
1489
|
|
|
1489
1490
|
/**
|
|
1490
|
-
*
|
|
1491
|
+
* 插入端类型
|
|
1491
1492
|
* @internal
|
|
1492
|
-
* @param
|
|
1493
|
+
* @param frontendTypeOptions 端类型参数
|
|
1493
1494
|
*/
|
|
1494
|
-
|
|
1495
|
+
_insertFrontendTypeAt(frontendTypeOptions: Partial<FrontendType>, index: number): FrontendType;
|
|
1495
1496
|
|
|
1496
1497
|
/**
|
|
1497
|
-
*
|
|
1498
|
+
* 插入端类型
|
|
1498
1499
|
* @internal
|
|
1499
|
-
* @param
|
|
1500
|
+
* @param frontendType 已有的端类型实例
|
|
1500
1501
|
*/
|
|
1501
|
-
|
|
1502
|
+
_insertFrontendTypeAt(frontendType: FrontendType, index: number): FrontendType;
|
|
1502
1503
|
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1505
|
-
const relationOptions = { parentNode: this, parentKey: '
|
|
1506
|
-
const
|
|
1507
|
-
let
|
|
1504
|
+
_insertFrontendTypeAt(options: string | Partial<FrontendType> | FrontendType, index: number) {
|
|
1505
|
+
const frontendTypeOptions: any = {};
|
|
1506
|
+
const relationOptions = { parentNode: this, parentKey: 'frontendTypes' };
|
|
1507
|
+
const FrontendType = getConceptConstructor('FrontendType');
|
|
1508
|
+
let frontendType: FrontendType;
|
|
1508
1509
|
if (!options) {
|
|
1509
|
-
|
|
1510
|
+
frontendType = FrontendType.from(
|
|
1510
1511
|
{
|
|
1511
|
-
...
|
|
1512
|
-
name: this.
|
|
1512
|
+
...frontendTypeOptions,
|
|
1513
|
+
name: this.getFrontendTypeUniqueName(),
|
|
1513
1514
|
},
|
|
1514
1515
|
this,
|
|
1515
|
-
'
|
|
1516
|
+
'frontendTypes',
|
|
1516
1517
|
);
|
|
1517
1518
|
} else if (typeof options === 'string') {
|
|
1518
|
-
|
|
1519
|
+
frontendType = FrontendType.from(
|
|
1519
1520
|
{
|
|
1520
|
-
...
|
|
1521
|
+
...frontendTypeOptions,
|
|
1521
1522
|
name: options,
|
|
1522
1523
|
},
|
|
1523
1524
|
this,
|
|
1524
|
-
'
|
|
1525
|
+
'frontendTypes',
|
|
1525
1526
|
);
|
|
1526
|
-
} else if (asserts.
|
|
1527
|
+
} else if (asserts.isFrontendType(options)) {
|
|
1527
1528
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1528
|
-
|
|
1529
|
-
Object.assign(
|
|
1529
|
+
frontendType = options;
|
|
1530
|
+
Object.assign(frontendType, relationOptions);
|
|
1530
1531
|
} else {
|
|
1531
|
-
|
|
1532
|
+
frontendType = FrontendType.from(
|
|
1532
1533
|
{
|
|
1533
|
-
...
|
|
1534
|
+
...frontendTypeOptions,
|
|
1534
1535
|
...options,
|
|
1535
1536
|
},
|
|
1536
1537
|
this,
|
|
1537
|
-
'
|
|
1538
|
+
'frontendTypes',
|
|
1538
1539
|
);
|
|
1539
1540
|
}
|
|
1540
|
-
this.
|
|
1541
|
-
return
|
|
1541
|
+
this.frontendTypes.splice(index, 0, frontendType);
|
|
1542
|
+
return frontendType;
|
|
1542
1543
|
}
|
|
1543
1544
|
|
|
1544
1545
|
/**
|
|
1545
|
-
*
|
|
1546
|
-
* @param name
|
|
1546
|
+
* 插入端类型
|
|
1547
|
+
* @param name 端类型名称,如果不填会自动生成一个唯一名称
|
|
1547
1548
|
*/
|
|
1548
|
-
|
|
1549
|
+
insertFrontendTypeAt(name: string, index: number): FrontendType;
|
|
1549
1550
|
|
|
1550
1551
|
/**
|
|
1551
|
-
*
|
|
1552
|
-
* @param
|
|
1552
|
+
* 插入端类型
|
|
1553
|
+
* @param frontendTypeOptions 端类型参数
|
|
1553
1554
|
*/
|
|
1554
|
-
|
|
1555
|
+
insertFrontendTypeAt(frontendTypeOptions: Partial<FrontendType>, index: number): FrontendType;
|
|
1555
1556
|
|
|
1556
1557
|
/**
|
|
1557
|
-
*
|
|
1558
|
-
* @param
|
|
1558
|
+
* 插入端类型
|
|
1559
|
+
* @param frontendType 已有的端类型实例
|
|
1559
1560
|
*/
|
|
1560
|
-
|
|
1561
|
+
insertFrontendTypeAt(frontendType: FrontendType, index: number): FrontendType;
|
|
1561
1562
|
|
|
1562
|
-
|
|
1563
|
-
const node = this.
|
|
1563
|
+
insertFrontendTypeAt(options: string | Partial<FrontendType> | FrontendType, index: number) {
|
|
1564
|
+
const node = this._insertFrontendTypeAt(options as any, index);
|
|
1564
1565
|
node.create({
|
|
1565
1566
|
index,
|
|
1566
1567
|
parentNode: this,
|
|
1567
|
-
parentKey: '
|
|
1568
|
+
parentKey: 'frontendTypes',
|
|
1568
1569
|
});
|
|
1569
1570
|
return node;
|
|
1570
1571
|
}
|
|
1571
1572
|
|
|
1572
1573
|
/**
|
|
1573
|
-
*
|
|
1574
|
+
* 添加端类型
|
|
1574
1575
|
* @internal
|
|
1575
|
-
* @param name
|
|
1576
|
+
* @param name 端类型名称,如果不填会自动生成一个唯一名称
|
|
1576
1577
|
*/
|
|
1577
|
-
|
|
1578
|
+
_addFrontendType(name?: string): FrontendType;
|
|
1578
1579
|
|
|
1579
1580
|
/**
|
|
1580
|
-
*
|
|
1581
|
+
* 添加端类型
|
|
1581
1582
|
* @internal
|
|
1582
|
-
* @param
|
|
1583
|
+
* @param frontendTypeOptions 端类型参数
|
|
1583
1584
|
*/
|
|
1584
|
-
|
|
1585
|
+
_addFrontendType(frontendTypeOptions: Partial<FrontendType>): FrontendType;
|
|
1585
1586
|
|
|
1586
1587
|
/**
|
|
1587
|
-
*
|
|
1588
|
+
* 添加端类型
|
|
1588
1589
|
* @internal
|
|
1589
|
-
* @param
|
|
1590
|
+
* @param frontendType 已有的端类型实例
|
|
1590
1591
|
*/
|
|
1591
|
-
|
|
1592
|
+
_addFrontendType(frontendType: FrontendType): FrontendType;
|
|
1592
1593
|
|
|
1593
|
-
|
|
1594
|
-
const index = this.
|
|
1595
|
-
return this.
|
|
1594
|
+
_addFrontendType(options?: string | Partial<FrontendType> | FrontendType) {
|
|
1595
|
+
const index = this.frontendTypes.length;
|
|
1596
|
+
return this._insertFrontendTypeAt(options as any, index);
|
|
1596
1597
|
}
|
|
1597
1598
|
|
|
1598
1599
|
/**
|
|
1599
|
-
*
|
|
1600
|
+
* 添加端类型
|
|
1600
1601
|
* @internal
|
|
1601
|
-
* @param name
|
|
1602
|
+
* @param name 端类型名称,如果不填会自动生成一个唯一名称
|
|
1602
1603
|
*/
|
|
1603
|
-
|
|
1604
|
+
addFrontendType(name?: string): FrontendType;
|
|
1604
1605
|
|
|
1605
1606
|
/**
|
|
1606
|
-
*
|
|
1607
|
-
* @param
|
|
1607
|
+
* 添加端类型
|
|
1608
|
+
* @param frontendTypeOptions 端类型参数
|
|
1608
1609
|
*/
|
|
1609
|
-
|
|
1610
|
+
addFrontendType(frontendTypeOptions: Partial<FrontendType>): FrontendType;
|
|
1610
1611
|
|
|
1611
1612
|
/**
|
|
1612
|
-
*
|
|
1613
|
-
* @param
|
|
1613
|
+
* 添加端类型
|
|
1614
|
+
* @param frontendType 已有的端类型实例
|
|
1614
1615
|
*/
|
|
1615
|
-
|
|
1616
|
+
addFrontendType(frontendType: FrontendType): FrontendType;
|
|
1616
1617
|
|
|
1617
|
-
|
|
1618
|
-
const node = this.
|
|
1619
|
-
const index = this.
|
|
1618
|
+
addFrontendType(options?: string | Partial<FrontendType> | FrontendType) {
|
|
1619
|
+
const node = this._addFrontendType(options as any);
|
|
1620
|
+
const index = this.frontendTypes.indexOf(node);
|
|
1620
1621
|
node.create({
|
|
1621
1622
|
index,
|
|
1622
1623
|
parentNode: this,
|
|
1623
|
-
parentKey: '
|
|
1624
|
+
parentKey: 'frontendTypes',
|
|
1624
1625
|
});
|
|
1625
1626
|
return node;
|
|
1626
1627
|
}
|
|
@@ -3238,45 +3239,45 @@ export class App extends BaseNode {
|
|
|
3238
3239
|
}
|
|
3239
3240
|
|
|
3240
3241
|
/**
|
|
3241
|
-
*
|
|
3242
|
-
* @param name
|
|
3242
|
+
* 删除端类型
|
|
3243
|
+
* @param name 端类型名称
|
|
3243
3244
|
*/
|
|
3244
|
-
|
|
3245
|
+
removeFrontendType(name: string): void;
|
|
3245
3246
|
|
|
3246
3247
|
/**
|
|
3247
|
-
*
|
|
3248
|
-
* @param
|
|
3248
|
+
* 删除端类型
|
|
3249
|
+
* @param frontendType 已有的端类型实例
|
|
3249
3250
|
*/
|
|
3250
|
-
|
|
3251
|
+
removeFrontendType(frontendType: FrontendType): void;
|
|
3251
3252
|
|
|
3252
|
-
|
|
3253
|
-
let
|
|
3253
|
+
removeFrontendType(options: string | FrontendType) {
|
|
3254
|
+
let frontendType: FrontendType;
|
|
3254
3255
|
if (typeof options === 'string') {
|
|
3255
|
-
|
|
3256
|
-
if (!
|
|
3257
|
-
throw new Error('
|
|
3256
|
+
frontendType = (this.frontendTypes as FrontendType[]).find((item) => item.name === options);
|
|
3257
|
+
if (!frontendType) {
|
|
3258
|
+
throw new Error('找不到端类型 ' + options);
|
|
3258
3259
|
}
|
|
3259
3260
|
} else {
|
|
3260
|
-
|
|
3261
|
+
frontendType = options;
|
|
3261
3262
|
}
|
|
3262
|
-
return
|
|
3263
|
+
return frontendType.delete();
|
|
3263
3264
|
}
|
|
3264
3265
|
|
|
3265
|
-
|
|
3266
|
-
const parentKey =
|
|
3266
|
+
__removeFrontendType(frontendType: FrontendType) {
|
|
3267
|
+
const parentKey = frontendType.parentKey;
|
|
3267
3268
|
const params: Params = {
|
|
3268
3269
|
parentNode: this,
|
|
3269
3270
|
parentKey,
|
|
3270
3271
|
index: -1,
|
|
3271
3272
|
object: null,
|
|
3272
|
-
oldObject:
|
|
3273
|
+
oldObject: frontendType,
|
|
3273
3274
|
};
|
|
3274
3275
|
if (parentKey) {
|
|
3275
3276
|
params.parentKey = parentKey;
|
|
3276
3277
|
// @ts-ignore
|
|
3277
3278
|
const t = this.__v_raw || this;
|
|
3278
3279
|
// @ts-ignore
|
|
3279
|
-
const n =
|
|
3280
|
+
const n = frontendType.__v_raw || frontendType;
|
|
3280
3281
|
if (Array.isArray((t as any)[parentKey])) {
|
|
3281
3282
|
// @ts-ignore
|
|
3282
3283
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
@@ -3938,6 +3939,17 @@ export class App extends BaseNode {
|
|
|
3938
3939
|
composeCache: composeCacheType = {};
|
|
3939
3940
|
|
|
3940
3941
|
|
|
3942
|
+
/**
|
|
3943
|
+
* 获取组合节点
|
|
3944
|
+
*/
|
|
3945
|
+
getCompose(path: string[]) {
|
|
3946
|
+
let compose = this.composeCache;
|
|
3947
|
+
path.forEach((key) => {
|
|
3948
|
+
compose = compose?.[key];
|
|
3949
|
+
});
|
|
3950
|
+
return compose || null;
|
|
3951
|
+
}
|
|
3952
|
+
|
|
3941
3953
|
/**
|
|
3942
3954
|
* 获取组合节点
|
|
3943
3955
|
*/
|
|
@@ -4169,10 +4181,10 @@ export class App extends BaseNode {
|
|
|
4169
4181
|
names: [],
|
|
4170
4182
|
},
|
|
4171
4183
|
};
|
|
4172
|
-
const
|
|
4184
|
+
const frontendTypes = this.frontendTypes.filter((frontendType) => frontendType.kind === scope);
|
|
4173
4185
|
const existingSet = new Set();
|
|
4174
|
-
|
|
4175
|
-
|
|
4186
|
+
frontendTypes.forEach((frontendType) => {
|
|
4187
|
+
frontendType.componentDependencies.forEach((dep) => {
|
|
4176
4188
|
const { name, version } = dep;
|
|
4177
4189
|
const jsName = `${prefix}/packages/${name}@${version}/dist-theme/index.js`;
|
|
4178
4190
|
if (!existingSet.has(jsName)) {
|
|
@@ -4279,7 +4291,11 @@ export class App extends BaseNode {
|
|
|
4279
4291
|
structureCount: this.structures.length,
|
|
4280
4292
|
enumCount: this.enums.length,
|
|
4281
4293
|
logicCount: this.logics.length,
|
|
4282
|
-
viewCount: sum(
|
|
4294
|
+
viewCount: sum(
|
|
4295
|
+
this.frontendTypes.map((frontendType) =>
|
|
4296
|
+
sum(frontendType.frontends.map((frontend) => countView(frontend.views))),
|
|
4297
|
+
),
|
|
4298
|
+
),
|
|
4283
4299
|
processCount: this.processes.length,
|
|
4284
4300
|
};
|
|
4285
4301
|
}
|
|
@@ -4451,35 +4467,19 @@ export class App extends BaseNode {
|
|
|
4451
4467
|
return errorList;
|
|
4452
4468
|
}
|
|
4453
4469
|
|
|
4454
|
-
addFrontendForType(options?: string | Partial<Frontend> | Frontend) {
|
|
4455
|
-
let insertIndex = -1;
|
|
4456
|
-
this.frontends.forEach((frontend, index) => {
|
|
4457
|
-
if (frontend.type === (options as any).type) {
|
|
4458
|
-
insertIndex = index;
|
|
4459
|
-
}
|
|
4460
|
-
});
|
|
4461
|
-
if ((options as any).type === 'h5' && insertIndex === -1) {
|
|
4462
|
-
insertIndex = this.frontends.length;
|
|
4463
|
-
}
|
|
4464
|
-
const node = this._insertFrontendAt(options as any, insertIndex + 1);
|
|
4465
|
-
const index = this.frontends.indexOf(node);
|
|
4466
|
-
node.create({
|
|
4467
|
-
index,
|
|
4468
|
-
parentNode: this,
|
|
4469
|
-
parentKey: 'frontends',
|
|
4470
|
-
});
|
|
4471
|
-
return node;
|
|
4472
|
-
}
|
|
4473
|
-
|
|
4474
4470
|
getFrontendExistingTitles(excludedList: Array<Frontend> = []) {
|
|
4475
4471
|
const excludedSet = new Set(excludedList);
|
|
4476
|
-
return (
|
|
4472
|
+
return (this.frontendTypes || [])
|
|
4473
|
+
.map((frontendType) => frontendType.frontends?.filter((item) => !excludedSet.has(item)).map((item) => item.title))
|
|
4474
|
+
.flat(2);
|
|
4477
4475
|
}
|
|
4478
4476
|
|
|
4479
4477
|
getExtensionsCallbackLogics() {
|
|
4480
4478
|
let resultLogics: string[] = [];
|
|
4481
|
-
this.
|
|
4482
|
-
|
|
4479
|
+
this.frontendTypes.forEach((frontendType) => {
|
|
4480
|
+
frontendType?.frontends?.forEach((frontend) => {
|
|
4481
|
+
resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
|
|
4482
|
+
});
|
|
4483
4483
|
});
|
|
4484
4484
|
return Array.from(new Set(resultLogics));
|
|
4485
4485
|
}
|
|
@@ -4493,7 +4493,6 @@ export class App extends BaseNode {
|
|
|
4493
4493
|
}
|
|
4494
4494
|
|
|
4495
4495
|
genAllCustomComponents() {
|
|
4496
|
-
const { frontends } = this;
|
|
4497
4496
|
const compMap: {
|
|
4498
4497
|
pc: Array<any>;
|
|
4499
4498
|
h5: Array<any>;
|
|
@@ -4502,12 +4501,12 @@ export class App extends BaseNode {
|
|
|
4502
4501
|
h5: [],
|
|
4503
4502
|
};
|
|
4504
4503
|
const existingSet = new Set();
|
|
4505
|
-
|
|
4506
|
-
if (
|
|
4507
|
-
|
|
4504
|
+
this.frontendTypes.forEach((frontendType) => {
|
|
4505
|
+
if (frontendType.componentDependencies) {
|
|
4506
|
+
frontendType.componentDependencies.forEach((dep) => {
|
|
4508
4507
|
const { name } = dep;
|
|
4509
4508
|
if (!existingSet.has(name)) {
|
|
4510
|
-
compMap[
|
|
4509
|
+
compMap[frontendType.kind].push(dep);
|
|
4511
4510
|
}
|
|
4512
4511
|
});
|
|
4513
4512
|
}
|
|
@@ -321,12 +321,20 @@ export class BackendVariable extends BaseNode {
|
|
|
321
321
|
toJS(state?: TranslatorState): string {
|
|
322
322
|
const context = this.view ? 'this' : 'Vue.prototype';
|
|
323
323
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
324
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
325
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
326
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
327
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
328
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
329
|
+
typeKind = typeAn.typeKind;
|
|
330
|
+
typeName = typeAn.typeName;
|
|
331
|
+
}
|
|
324
332
|
const needGenInitFromSchema =
|
|
325
333
|
typeAnnotation &&
|
|
326
|
-
(!['primitive', 'union'].includes(
|
|
334
|
+
(!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
327
335
|
let code = `${this.name} =`;
|
|
328
336
|
if (needGenInitFromSchema) {
|
|
329
|
-
code += `${context}.$genInitFromSchema('${
|
|
337
|
+
code += `${context}.$genInitFromSchema('${sortedTypeKey}',`;
|
|
330
338
|
}
|
|
331
339
|
|
|
332
340
|
if (this.defaultValue?.expression) {
|
|
@@ -1085,10 +1085,14 @@ export class BindAttribute extends BaseNode {
|
|
|
1085
1085
|
const self = this;
|
|
1086
1086
|
const { name, type, value, rules, expression, playground } = self;
|
|
1087
1087
|
let code = '';
|
|
1088
|
-
|
|
1089
|
-
|
|
1088
|
+
// 业务组件
|
|
1089
|
+
const isBusinessComponent = self.viewElement?.isCorrespondingBusinessComponent;
|
|
1090
|
+
if (isBusinessComponent) {
|
|
1091
|
+
code += `${name}: `;
|
|
1092
|
+
} else if (self?.name === 'data-source' && self?.expression?.concept === 'CallLogic') {
|
|
1093
|
+
code += `() => {\n`;
|
|
1090
1094
|
} else {
|
|
1091
|
-
code
|
|
1095
|
+
code += '() => {\n';
|
|
1092
1096
|
}
|
|
1093
1097
|
if (['destination', 'externalDestination'].includes(name) && type === 'dynamic') {
|
|
1094
1098
|
code += yield* (self as any)[name].toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
@@ -1100,7 +1104,7 @@ export class BindAttribute extends BaseNode {
|
|
|
1100
1104
|
});
|
|
1101
1105
|
} else if (expression) {
|
|
1102
1106
|
code += yield* expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1103
|
-
code += '
|
|
1107
|
+
code += '\n';
|
|
1104
1108
|
} else if (name === 'url' && value) {
|
|
1105
1109
|
/**
|
|
1106
1110
|
* ls定制化处理
|
|
@@ -1126,13 +1130,15 @@ export class BindAttribute extends BaseNode {
|
|
|
1126
1130
|
code += ';\n';
|
|
1127
1131
|
}
|
|
1128
1132
|
}
|
|
1129
|
-
if (type === 'dynamic') {
|
|
1133
|
+
if (type === 'dynamic' && !isBusinessComponent) {
|
|
1130
1134
|
yield* wrapForEach(playground, function* warpForEachGenerator(item, index) {
|
|
1131
1135
|
code += yield* item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1132
1136
|
code += ';\n';
|
|
1133
1137
|
});
|
|
1134
1138
|
}
|
|
1135
|
-
|
|
1139
|
+
if (!isBusinessComponent) {
|
|
1140
|
+
code += '\n}';
|
|
1141
|
+
}
|
|
1136
1142
|
return code;
|
|
1137
1143
|
}
|
|
1138
1144
|
|
|
@@ -1168,6 +1174,8 @@ export class BindAttribute extends BaseNode {
|
|
|
1168
1174
|
type = `${self.value}`.includes('.') ? 'nasl.core.Decimal' : 'nasl.core.Long';
|
|
1169
1175
|
} else if (typeof self.value === 'boolean') {
|
|
1170
1176
|
type = 'nasl.core.Boolean';
|
|
1177
|
+
} else if (['page-size', 'page-number'].includes(self.name) && self.value === null) {
|
|
1178
|
+
type = 'nasl.core.Long'
|
|
1171
1179
|
}
|
|
1172
1180
|
code += `${type}`;
|
|
1173
1181
|
} else {
|
|
@@ -629,21 +629,36 @@ export class BindDirective extends BaseNode {
|
|
|
629
629
|
return str;
|
|
630
630
|
}
|
|
631
631
|
|
|
632
|
+
get viewElement() {
|
|
633
|
+
return this.getAncestor('ViewElement') as ViewElement;
|
|
634
|
+
}
|
|
635
|
+
|
|
632
636
|
@withSourceMapGenerator
|
|
633
637
|
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
634
638
|
const self = this;
|
|
635
|
-
|
|
639
|
+
// 业务组件
|
|
640
|
+
const isBusinessComponent = self.viewElement?.correspondingBusinessComponent;
|
|
641
|
+
let code = '';
|
|
642
|
+
if (!isBusinessComponent) {
|
|
643
|
+
code += '()=>{';
|
|
644
|
+
}
|
|
636
645
|
if (self.expression) {
|
|
637
646
|
code += yield* self.expression.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
638
|
-
code += '
|
|
647
|
+
code += '\n';
|
|
639
648
|
}
|
|
640
649
|
if (self.type === 'dynamic') {
|
|
641
650
|
yield* wrapForEach(self.playground, function* warpForEachGenerator(item, index) {
|
|
642
651
|
code += yield* item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
643
|
-
if (index !== self.playground.length - 1) code += '
|
|
652
|
+
if (index !== self.playground.length - 1) code += '\n';
|
|
644
653
|
});
|
|
645
654
|
}
|
|
646
|
-
|
|
655
|
+
if (isBusinessComponent) {
|
|
656
|
+
if (code) {
|
|
657
|
+
code = `${self.name === 'if' ? '__NASLIF' : self.name}: ${code}`;
|
|
658
|
+
}
|
|
659
|
+
} else {
|
|
660
|
+
code += '}';
|
|
661
|
+
}
|
|
647
662
|
return code;
|
|
648
663
|
}
|
|
649
664
|
|