@lcap/nasl 4.4.0-beta.3 → 4.4.0-beta.30
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/generator/genBundleFiles.d.ts +2 -0
- package/out/generator/genBundleFiles.d.ts.map +1 -1
- package/out/generator/genBundleFiles.js +77 -12
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/icestark.d.ts +1 -1
- package/out/generator/icestark.d.ts.map +1 -1
- package/out/generator/icestark.js +6 -1
- package/out/generator/icestark.js.map +1 -1
- package/out/generator/qiankun.d.ts +1 -1
- package/out/generator/qiankun.d.ts.map +1 -1
- package/out/generator/qiankun.js +9 -3
- package/out/generator/qiankun.js.map +1 -1
- package/out/generator/release-body/body.d.ts +0 -1
- package/out/generator/release-body/body.d.ts.map +1 -1
- package/out/generator/release-body/body.js +1 -390
- package/out/generator/release-body/body.js.map +1 -1
- package/out/generator/release-body/data.d.ts.map +1 -1
- package/out/generator/release-body/data.js +38 -11
- package/out/generator/release-body/data.js.map +1 -1
- package/out/generator/release-body/internal.d.ts +1 -0
- package/out/generator/release-body/internal.d.ts.map +1 -1
- package/out/generator/release-body/internal.js.map +1 -1
- package/out/generator/release-body/share-content.js +1 -1
- package/out/generator/release-body/share-content.js.map +1 -1
- package/out/generator/release-body/types.d.ts +2 -0
- package/out/generator/release-body/types.d.ts.map +1 -1
- package/out/generator/release-body/utils.d.ts +1 -0
- package/out/generator/release-body/utils.d.ts.map +1 -1
- package/out/generator/release-body/utils.js +2 -1
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/generator/templates/chunk.js +1 -1
- package/out/generator/templates/runtime.js +2 -2
- package/out/generator/wujie.d.ts +1 -1
- package/out/generator/wujie.d.ts.map +1 -1
- package/out/generator/wujie.js +6 -1
- package/out/generator/wujie.js.map +1 -1
- package/out/natural/exports/nasl2Files.d.ts +34 -0
- package/out/natural/exports/nasl2Files.d.ts.map +1 -0
- package/out/natural/exports/nasl2Files.js +237 -0
- package/out/natural/exports/nasl2Files.js.map +1 -0
- package/out/natural/{transform2BatchActions.d.ts → exports/transform2BatchActions.d.ts} +20 -2
- package/out/natural/exports/transform2BatchActions.d.ts.map +1 -0
- package/out/natural/exports/transform2BatchActions.js +1233 -0
- package/out/natural/exports/transform2BatchActions.js.map +1 -0
- package/out/natural/index.d.ts +12 -12
- package/out/natural/index.d.ts.map +1 -1
- package/out/natural/index.js +12 -14
- package/out/natural/index.js.map +1 -1
- package/out/natural/{genNaturalTS.d.ts → old/getContext/genNaturalTS.d.ts} +12 -12
- package/out/natural/old/getContext/genNaturalTS.d.ts.map +1 -0
- package/out/natural/{genNaturalTS.js → old/getContext/genNaturalTS.js} +65 -65
- package/out/natural/old/getContext/genNaturalTS.js.map +1 -0
- package/out/natural/old/getContext/genTextualNASL.d.ts.map +1 -0
- package/out/natural/old/getContext/genTextualNASL.js.map +1 -0
- package/out/natural/{getContext → old/getContext}/getUILib.d.ts +1 -1
- package/out/natural/old/getContext/getUILib.d.ts.map +1 -0
- package/out/natural/{getContext → old/getContext}/getUILib.js +14 -14
- package/out/natural/old/getContext/getUILib.js.map +1 -0
- package/out/natural/{getContext → old/getContext}/index.d.ts +3 -3
- package/out/natural/old/getContext/index.d.ts.map +1 -0
- package/out/natural/{getContext → old/getContext}/index.js +4 -4
- package/out/natural/old/getContext/index.js.map +1 -0
- package/out/natural/old/getContext/naslStdlibMap.d.ts.map +1 -0
- package/out/natural/{getContext → old/getContext}/naslStdlibMap.js +10 -10
- package/out/natural/old/getContext/naslStdlibMap.js.map +1 -0
- package/out/natural/{transformTS2UI.d.ts → old/parser/transformTS2UI.d.ts} +2 -2
- package/out/natural/old/parser/transformTS2UI.d.ts.map +1 -0
- package/out/natural/{transformTS2UI.js → old/parser/transformTS2UI.js} +13 -14
- package/out/natural/old/parser/transformTS2UI.js.map +1 -0
- package/out/natural/{transformTSCode.d.ts → old/parser/transformTSCode.d.ts} +1 -1
- package/out/natural/old/parser/transformTSCode.d.ts.map +1 -0
- package/out/natural/{transformTSCode.js → old/parser/transformTSCode.js} +32 -8
- package/out/natural/old/parser/transformTSCode.js.map +1 -0
- package/out/natural/{tools.d.ts → old/tools.d.ts} +0 -4
- package/out/natural/old/tools.d.ts.map +1 -0
- package/out/natural/{tools.js → old/tools.js} +7 -25
- package/out/natural/old/tools.js.map +1 -0
- package/out/natural/{parseNaturalTS.d.ts → parser/parseNaturalTS.d.ts} +9 -2
- package/out/natural/parser/parseNaturalTS.d.ts.map +1 -0
- package/out/natural/{parseNaturalTS.js → parser/parseNaturalTS.js} +119 -38
- package/out/natural/parser/parseNaturalTS.js.map +1 -0
- package/out/natural/{parseNaturalTSXView.d.ts → parser/parseNaturalTSXView.d.ts} +1 -2
- package/out/natural/parser/parseNaturalTSXView.d.ts.map +1 -0
- package/out/natural/{parseNaturalTSXView.js → parser/parseNaturalTSXView.js} +181 -139
- package/out/natural/parser/parseNaturalTSXView.js.map +1 -0
- package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.d.ts +7 -0
- package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.js +38 -0
- package/out/natural/transforms/checker/checkDataQueryCalleeNameOrder.js.map +1 -0
- package/out/natural/transforms/checker/checkDefaultValue.d.ts +14 -0
- package/out/natural/transforms/checker/checkDefaultValue.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkDefaultValue.js +39 -0
- package/out/natural/transforms/checker/checkDefaultValue.js.map +1 -0
- package/out/natural/transforms/checker/checkLcapEntity.d.ts +16 -0
- package/out/natural/transforms/checker/checkLcapEntity.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkLcapEntity.js +337 -0
- package/out/natural/transforms/checker/checkLcapEntity.js.map +1 -0
- package/out/natural/transforms/checker/checkValidationCalleeName.d.ts +3 -0
- package/out/natural/transforms/checker/checkValidationCalleeName.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkValidationCalleeName.js +88 -0
- package/out/natural/transforms/checker/checkValidationCalleeName.js.map +1 -0
- package/out/natural/transforms/checker/checkViewElement.d.ts +29 -0
- package/out/natural/transforms/checker/checkViewElement.d.ts.map +1 -0
- package/out/natural/transforms/checker/checkViewElement.js +618 -0
- package/out/natural/transforms/checker/checkViewElement.js.map +1 -0
- package/out/natural/transforms/checker/index.d.ts +19 -0
- package/out/natural/transforms/checker/index.d.ts.map +1 -0
- package/out/natural/transforms/checker/index.js +30 -0
- package/out/natural/transforms/checker/index.js.map +1 -0
- package/out/natural/transforms/transform2Entity.d.ts +13 -1
- package/out/natural/transforms/transform2Entity.d.ts.map +1 -1
- package/out/natural/transforms/transform2Entity.js +172 -17
- package/out/natural/transforms/transform2Entity.js.map +1 -1
- package/out/natural/transforms/transform2Enum.d.ts +1 -1
- package/out/natural/transforms/transform2Enum.d.ts.map +1 -1
- package/out/natural/transforms/transform2Enum.js +5 -1
- package/out/natural/transforms/transform2Enum.js.map +1 -1
- package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts +2 -2
- package/out/natural/transforms/transform2GlobalLogicDeclaration.d.ts.map +1 -1
- package/out/natural/transforms/transform2GlobalLogicDeclaration.js +18 -4
- package/out/natural/transforms/transform2GlobalLogicDeclaration.js.map +1 -1
- package/out/natural/transforms/transform2Logic.d.ts +4 -4
- package/out/natural/transforms/transform2Logic.d.ts.map +1 -1
- package/out/natural/transforms/transform2Logic.js +58 -17
- package/out/natural/transforms/transform2Logic.js.map +1 -1
- package/out/natural/transforms/transform2LogicItem.d.ts +11 -4
- package/out/natural/transforms/transform2LogicItem.d.ts.map +1 -1
- package/out/natural/transforms/transform2LogicItem.js +279 -178
- package/out/natural/transforms/transform2LogicItem.js.map +1 -1
- package/out/natural/transforms/transform2MetadataType.d.ts +1 -1
- package/out/natural/transforms/transform2MetadataType.d.ts.map +1 -1
- package/out/natural/transforms/transform2MetadataType.js +1 -1
- package/out/natural/transforms/transform2MetadataType.js.map +1 -1
- package/out/natural/transforms/transform2Param.d.ts +4 -0
- package/out/natural/transforms/transform2Param.d.ts.map +1 -0
- package/out/natural/transforms/transform2Param.js +114 -0
- package/out/natural/transforms/transform2Param.js.map +1 -0
- package/out/natural/transforms/transform2Structure.d.ts +1 -1
- package/out/natural/transforms/transform2Structure.d.ts.map +1 -1
- package/out/natural/transforms/transform2Structure.js +13 -2
- package/out/natural/transforms/transform2Structure.js.map +1 -1
- package/out/natural/transforms/transform2TypeAnnotation.d.ts +1 -1
- package/out/natural/transforms/transform2TypeAnnotation.d.ts.map +1 -1
- package/out/natural/transforms/transform2TypeAnnotation.js +3 -3
- package/out/natural/transforms/transform2TypeAnnotation.js.map +1 -1
- package/out/natural/transforms/transform2ValidationRule.d.ts +2 -2
- package/out/natural/transforms/transform2ValidationRule.d.ts.map +1 -1
- package/out/natural/transforms/transform2ValidationRule.js +6 -1
- package/out/natural/transforms/transform2ValidationRule.js.map +1 -1
- package/out/natural/transforms/transform2Variable.d.ts +4 -3
- package/out/natural/transforms/transform2Variable.d.ts.map +1 -1
- package/out/natural/transforms/transform2Variable.js +57 -6
- package/out/natural/transforms/transform2Variable.js.map +1 -1
- package/out/natural/transforms/transformThemeAndStyle.d.ts +5 -2
- package/out/natural/transforms/transformThemeAndStyle.d.ts.map +1 -1
- package/out/natural/transforms/transformThemeAndStyle.js +26 -13
- package/out/natural/transforms/transformThemeAndStyle.js.map +1 -1
- package/out/natural/transforms/utils/createComponentLookupMap.d.ts +32 -0
- package/out/natural/transforms/utils/createComponentLookupMap.d.ts.map +1 -0
- package/out/natural/transforms/utils/createComponentLookupMap.js +57 -0
- package/out/natural/transforms/utils/createComponentLookupMap.js.map +1 -0
- package/out/natural/transforms/utils/iconNames.d.ts +2 -0
- package/out/natural/transforms/utils/iconNames.d.ts.map +1 -0
- package/out/natural/transforms/utils/iconNames.js +299 -0
- package/out/natural/transforms/utils/iconNames.js.map +1 -0
- package/out/natural/transforms/utils/misc.d.ts +16 -0
- package/out/natural/transforms/utils/misc.d.ts.map +1 -0
- package/out/natural/transforms/utils/misc.js +240 -0
- package/out/natural/transforms/utils/misc.js.map +1 -0
- package/out/natural/transforms/utils/normalizeNode.d.ts +3 -0
- package/out/natural/transforms/utils/normalizeNode.d.ts.map +1 -0
- package/out/natural/transforms/utils/normalizeNode.js +15 -0
- package/out/natural/transforms/utils/normalizeNode.js.map +1 -0
- package/out/natural/transforms/utils/parseDecorator.d.ts +74 -0
- package/out/natural/transforms/utils/parseDecorator.d.ts.map +1 -0
- package/out/natural/transforms/utils/parseDecorator.js +252 -0
- package/out/natural/transforms/utils/parseDecorator.js.map +1 -0
- package/out/natural/transforms/utils/transform2Directory.d.ts +59 -0
- package/out/natural/transforms/utils/transform2Directory.d.ts.map +1 -0
- package/out/natural/transforms/utils/transform2Directory.js +229 -0
- package/out/natural/transforms/utils/transform2Directory.js.map +1 -0
- package/out/natural/{transforms/utils.d.ts → utils/index.d.ts} +35 -18
- package/out/natural/utils/index.d.ts.map +1 -0
- package/out/natural/utils/index.js +206 -0
- package/out/natural/utils/index.js.map +1 -0
- package/out/natural/utils/nasl-file-types.d.ts +45 -0
- package/out/natural/utils/nasl-file-types.d.ts.map +1 -0
- package/out/natural/utils/nasl-file-types.js +131 -0
- package/out/natural/utils/nasl-file-types.js.map +1 -0
- package/out/server/OQL/sqlDbTypes.json +717 -0
- package/out/server/createUiTs.d.ts +0 -1
- package/out/server/createUiTs.d.ts.map +1 -1
- package/out/server/createUiTs.js +1 -118
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/extendBaseNode.d.ts.map +1 -1
- package/out/server/extendBaseNode.js +17 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/findReference.js +1 -1
- package/out/server/findReference.js.map +1 -1
- package/out/server/naslServer.d.ts +0 -1
- package/out/server/naslServer.d.ts.map +1 -1
- package/out/server/naslServer.js +66 -55
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js.map +1 -1
- package/out/service/autofix/rules/rule-convert-incompatible-assignment-to-union.js.map +1 -1
- package/out/service/creator/add.configs.js +1 -1
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/storage/init.d.ts +1 -1
- package/out/service/storage/init.d.ts.map +1 -1
- package/out/service/storage/init.js +26 -9
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/specTools.d.ts +20 -8
- package/out/service/storage/specTools.d.ts.map +1 -1
- package/out/service/storage/specTools.js +157 -5
- package/out/service/storage/specTools.js.map +1 -1
- package/out/templator/block2nasl/jsx2nasl/transform-func2nasl.d.ts +4 -0
- package/out/templator/block2nasl/jsx2nasl/transform-func2nasl.d.ts.map +1 -1
- package/out/templator/block2nasl/jsx2nasl/transform-func2nasl.js +20 -1
- package/out/templator/block2nasl/jsx2nasl/transform-func2nasl.js.map +1 -1
- package/out/templator/block2nasl/jsx2nasl/transform-tsx2nasl.d.ts.map +1 -1
- package/out/templator/block2nasl/jsx2nasl/transform-tsx2nasl.js +28 -1
- package/out/templator/block2nasl/jsx2nasl/transform-tsx2nasl.js.map +1 -1
- package/out/templator/block2nasl/transformBlock2Nasl.js +2 -2
- package/out/templator/block2nasl/transformBlock2Nasl.js.map +1 -1
- package/out/templator/block2nasl/viewMergeBlock.js +3 -2
- package/out/templator/block2nasl/viewMergeBlock.js.map +1 -1
- package/out/utils/can-i-use.d.ts.map +1 -1
- package/out/utils/can-i-use.js +1 -0
- package/out/utils/can-i-use.js.map +1 -1
- package/package.json +9 -9
- package/sandbox/stdlib/nasl.core.ts +2 -0
- package/sandbox/stdlib/nasl.io.ts +1 -1
- package/sandbox/stdlib/nasl.oql.ts +2 -0
- package/sandbox/stdlib/nasl.util.ts +1 -1
- package/sandbox/stdlib/nasl.validation.ts +50 -14
- package/out/natural/genNaturalTS.d.ts.map +0 -1
- package/out/natural/genNaturalTS.js.map +0 -1
- package/out/natural/genTextualNASL.d.ts.map +0 -1
- package/out/natural/genTextualNASL.js.map +0 -1
- package/out/natural/getContext/getUILib.d.ts.map +0 -1
- package/out/natural/getContext/getUILib.js.map +0 -1
- package/out/natural/getContext/index.d.ts.map +0 -1
- package/out/natural/getContext/index.js.map +0 -1
- package/out/natural/getContext/nasl2Files.d.ts +0 -15
- package/out/natural/getContext/nasl2Files.d.ts.map +0 -1
- package/out/natural/getContext/nasl2Files.js +0 -75
- package/out/natural/getContext/nasl2Files.js.map +0 -1
- package/out/natural/getContext/naslStdlibMap.d.ts.map +0 -1
- package/out/natural/getContext/naslStdlibMap.js.map +0 -1
- package/out/natural/parseNaturalTS.d.ts.map +0 -1
- package/out/natural/parseNaturalTS.js.map +0 -1
- package/out/natural/parseNaturalTSXView.d.ts.map +0 -1
- package/out/natural/parseNaturalTSXView.js.map +0 -1
- package/out/natural/tools.d.ts.map +0 -1
- package/out/natural/tools.js.map +0 -1
- package/out/natural/transform2BatchActions.d.ts.map +0 -1
- package/out/natural/transform2BatchActions.js +0 -387
- package/out/natural/transform2BatchActions.js.map +0 -1
- package/out/natural/transformTS2UI.d.ts.map +0 -1
- package/out/natural/transformTS2UI.js.map +0 -1
- package/out/natural/transformTSCode.d.ts.map +0 -1
- package/out/natural/transformTSCode.js.map +0 -1
- package/out/natural/transforms/utils.d.ts.map +0 -1
- package/out/natural/transforms/utils.js +0 -407
- package/out/natural/transforms/utils.js.map +0 -1
- /package/out/natural/{genTextualNASL.d.ts → old/getContext/genTextualNASL.d.ts} +0 -0
- /package/out/natural/{genTextualNASL.js → old/getContext/genTextualNASL.js} +0 -0
- /package/out/natural/{getContext → old/getContext}/naslStdlibMap.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkDataQueryCalleeNameOrder = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 数据查询 子句的预期顺序
|
|
6
|
+
*/
|
|
7
|
+
const expectedOrder = [
|
|
8
|
+
"FROM",
|
|
9
|
+
"JOIN",
|
|
10
|
+
"WHERE",
|
|
11
|
+
"GROUP_BY",
|
|
12
|
+
"SELECT",
|
|
13
|
+
"HAVING",
|
|
14
|
+
"ORDER_BY",
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* 检查 数据查询 调用名称的顺序是否正确
|
|
18
|
+
* @param calleeNames 数据查询 调用名称数组
|
|
19
|
+
* @returns 顺序是否正确
|
|
20
|
+
*/
|
|
21
|
+
function checkDataQueryCalleeNameOrder(calleeNames) {
|
|
22
|
+
let currentIndex = -1;
|
|
23
|
+
for (const name of calleeNames) {
|
|
24
|
+
const expectedIndex = expectedOrder.findIndex((item) => name?.includes(item));
|
|
25
|
+
if (expectedIndex === -1) {
|
|
26
|
+
// 如果名称不在期望顺序中,返回 false
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if (expectedIndex < currentIndex) {
|
|
30
|
+
// 如果当前名称的索引小于前一个名称的索引,返回 false
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
currentIndex = expectedIndex;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
exports.checkDataQueryCalleeNameOrder = checkDataQueryCalleeNameOrder;
|
|
38
|
+
//# sourceMappingURL=checkDataQueryCalleeNameOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkDataQueryCalleeNameOrder.js","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkDataQueryCalleeNameOrder.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAM,aAAa,GAAG;IACpB,MAAM;IACN,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;CACX,CAAC;AAEF;;;;GAIG;AACH,SAAgB,6BAA6B,CAAC,WAA0B;IACtE,IAAI,YAAY,GAAG,CAAC,CAAC,CAAC;IAEtB,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CACrD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CACrB,CAAC;QACF,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;YACzB,uBAAuB;YACvB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,aAAa,GAAG,YAAY,EAAE,CAAC;YACjC,+BAA+B;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,YAAY,GAAG,aAAa,CAAC;IAC/B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAnBD,sEAmBC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as babelTypes from '@babel/types';
|
|
2
|
+
import * as naslTypes from '../../../concepts';
|
|
3
|
+
import { type ParseNaturalTSState } from '../../utils';
|
|
4
|
+
/**
|
|
5
|
+
* 检查默认值类型
|
|
6
|
+
* - Date、Time、DateTime 类型不支持默认值
|
|
7
|
+
* - 其他类型仅支持字面量类型和枚举值
|
|
8
|
+
* @param node 默认值表达式节点
|
|
9
|
+
* @param parseState 解析状态
|
|
10
|
+
* @param typeAnnotation 类型注解
|
|
11
|
+
* @returns 默认值对象或 undefined
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkDefaultValue(node: babelTypes.Expression | null | undefined, parseState: ParseNaturalTSState, typeAnnotation: naslTypes.TypeAnnotation): naslTypes.DefaultValue | undefined;
|
|
14
|
+
//# sourceMappingURL=checkDefaultValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkDefaultValue.d.ts","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkDefaultValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,KAAK,mBAAmB,EAAc,MAAM,aAAa,CAAC;AAInE;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,CAAC,UAAU,GAAG,IAAI,GAAG,SAAS,EAC9C,UAAU,EAAE,mBAAmB,EAC/B,cAAc,EAAE,SAAS,CAAC,cAAc,GACvC,SAAS,CAAC,YAAY,GAAG,SAAS,CAyBpC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkDefaultValue = void 0;
|
|
4
|
+
const transform2LogicItem_1 = require("../transform2LogicItem");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const NO_DEFAULT_VALUE_TYPES = new Set(['Date', 'Time', 'DateTime']);
|
|
7
|
+
/**
|
|
8
|
+
* 检查默认值类型
|
|
9
|
+
* - Date、Time、DateTime 类型不支持默认值
|
|
10
|
+
* - 其他类型仅支持字面量类型和枚举值
|
|
11
|
+
* @param node 默认值表达式节点
|
|
12
|
+
* @param parseState 解析状态
|
|
13
|
+
* @param typeAnnotation 类型注解
|
|
14
|
+
* @returns 默认值对象或 undefined
|
|
15
|
+
*/
|
|
16
|
+
function checkDefaultValue(node, parseState, typeAnnotation) {
|
|
17
|
+
if (NO_DEFAULT_VALUE_TYPES.has(typeAnnotation?.typeName)) {
|
|
18
|
+
(0, utils_1.throwError)(parseState, `类型 ${typeAnnotation.typeName} 不支持设置默认值`, node);
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const defaultValue = (0, transform2LogicItem_1.transform2DefaultValue)(node, {
|
|
22
|
+
transformType: 'attr',
|
|
23
|
+
isRestricted: true,
|
|
24
|
+
typeAnnotation,
|
|
25
|
+
...parseState,
|
|
26
|
+
});
|
|
27
|
+
if (defaultValue?.expression) {
|
|
28
|
+
// 检查默认值类型:仅支持字面量类型和枚举值
|
|
29
|
+
const concept = defaultValue.expression.concept;
|
|
30
|
+
const isLiteral = concept && concept.endsWith('Literal');
|
|
31
|
+
const isEnum = concept === 'MemberExpression' && defaultValue.expression?.object?.namespace?.includes('app.enums');
|
|
32
|
+
if (!isLiteral && !isEnum) {
|
|
33
|
+
(0, utils_1.throwError)(parseState, `默认值仅支持基础类型字面量和枚举值,不支持 ${concept} 类型`, node);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return defaultValue;
|
|
37
|
+
}
|
|
38
|
+
exports.checkDefaultValue = checkDefaultValue;
|
|
39
|
+
//# sourceMappingURL=checkDefaultValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkDefaultValue.js","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkDefaultValue.ts"],"names":[],"mappings":";;;AAEA,gEAAgE;AAChE,uCAAmE;AAEnE,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAErE;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,IAA8C,EAC9C,UAA+B,EAC/B,cAAwC;IAExC,IAAI,sBAAsB,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,CAAC;QACzD,IAAA,kBAAU,EAAC,UAAU,EAAE,MAAM,cAAc,CAAC,QAAQ,WAAW,EAAE,IAAI,CAAC,CAAC;QACvE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,4CAAsB,EAAC,IAAI,EAAE;QAChD,aAAa,EAAE,MAAM;QACrB,YAAY,EAAE,IAAI;QAClB,cAAc;QACd,GAAG,UAAU;KACd,CAAC,CAAC;IAEH,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC;QAC7B,uBAAuB;QACvB,MAAM,OAAO,GAAG,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC;QAChD,MAAM,SAAS,GAAG,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,OAAO,KAAK,kBAAkB,IAAK,YAAY,CAAC,UAAkB,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;QAE5H,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1B,IAAA,kBAAU,EAAC,UAAU,EAAE,yBAAyB,OAAO,KAAK,EAAE,IAAI,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AA7BD,8CA6BC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { naslTypes, type ParseNaturalTSState } from '../../utils';
|
|
2
|
+
/**
|
|
3
|
+
* 权限中心 LCAP 实体字段映射表
|
|
4
|
+
*/
|
|
5
|
+
export declare const LCAP_ENTITIES_MAP: Record<string, Record<string, string>>;
|
|
6
|
+
/**
|
|
7
|
+
* 权限中心 LCAP 实体定义详情
|
|
8
|
+
*/
|
|
9
|
+
export declare const LCAP_ENTITIES_DEFINITION_MAP: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* 校验 Lcap 实体及其字段
|
|
12
|
+
* @param entity 转换后的实体对象
|
|
13
|
+
* @param parseState 解析状态
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkLcapEntity(entity: naslTypes.Entity, parseState: ParseNaturalTSState): void;
|
|
16
|
+
//# sourceMappingURL=checkLcapEntity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkLcapEntity.d.ts","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkLcapEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAoB9E;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiElE,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0N/D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAmC/F"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkLcapEntity = exports.LCAP_ENTITIES_DEFINITION_MAP = exports.LCAP_ENTITIES_MAP = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
/**
|
|
6
|
+
* 通用基础字段
|
|
7
|
+
*/
|
|
8
|
+
const BASE_FIELDS = {
|
|
9
|
+
id: 'Integer',
|
|
10
|
+
createdTime: 'DateTime',
|
|
11
|
+
updatedTime: 'DateTime',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 通用字段
|
|
15
|
+
*/
|
|
16
|
+
const AUDIT_FIELDS = {
|
|
17
|
+
...BASE_FIELDS,
|
|
18
|
+
createdBy: 'String',
|
|
19
|
+
updatedBy: 'String',
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 权限中心 LCAP 实体字段映射表
|
|
23
|
+
*/
|
|
24
|
+
exports.LCAP_ENTITIES_MAP = {
|
|
25
|
+
LcapUser: {
|
|
26
|
+
...BASE_FIELDS,
|
|
27
|
+
userId: 'String',
|
|
28
|
+
userName: 'String',
|
|
29
|
+
password: 'String',
|
|
30
|
+
phone: 'String',
|
|
31
|
+
email: 'String',
|
|
32
|
+
displayName: 'String',
|
|
33
|
+
status: 'app.enums.UserStatusEnum',
|
|
34
|
+
source: 'app.enums.UserSourceEnum',
|
|
35
|
+
directLeaderId: 'String',
|
|
36
|
+
},
|
|
37
|
+
LcapRole: {
|
|
38
|
+
...AUDIT_FIELDS,
|
|
39
|
+
uuid: 'String',
|
|
40
|
+
name: 'String',
|
|
41
|
+
description: 'String',
|
|
42
|
+
roleStatus: 'Boolean',
|
|
43
|
+
editable: 'Boolean',
|
|
44
|
+
},
|
|
45
|
+
LcapPermission: {
|
|
46
|
+
...AUDIT_FIELDS,
|
|
47
|
+
uuid: 'String',
|
|
48
|
+
name: 'String',
|
|
49
|
+
description: 'String',
|
|
50
|
+
},
|
|
51
|
+
LcapResource: {
|
|
52
|
+
...AUDIT_FIELDS,
|
|
53
|
+
uuid: 'String',
|
|
54
|
+
name: 'String',
|
|
55
|
+
description: 'String',
|
|
56
|
+
type: 'String',
|
|
57
|
+
clientType: 'String',
|
|
58
|
+
},
|
|
59
|
+
LcapDepartment: {
|
|
60
|
+
...AUDIT_FIELDS,
|
|
61
|
+
name: 'String',
|
|
62
|
+
deptId: 'String',
|
|
63
|
+
parentDeptId: 'String',
|
|
64
|
+
},
|
|
65
|
+
LcapUserRoleMapping: {
|
|
66
|
+
...AUDIT_FIELDS,
|
|
67
|
+
userId: 'String',
|
|
68
|
+
roleId: 'Integer',
|
|
69
|
+
userName: 'String',
|
|
70
|
+
source: 'String',
|
|
71
|
+
},
|
|
72
|
+
LcapRolePerMapping: {
|
|
73
|
+
...AUDIT_FIELDS,
|
|
74
|
+
roleId: 'Integer',
|
|
75
|
+
permissionId: 'Integer',
|
|
76
|
+
},
|
|
77
|
+
LcapPerResMapping: {
|
|
78
|
+
...AUDIT_FIELDS,
|
|
79
|
+
permissionId: 'Integer',
|
|
80
|
+
resourceId: 'Integer',
|
|
81
|
+
},
|
|
82
|
+
LcapUserDeptMapping: {
|
|
83
|
+
...AUDIT_FIELDS,
|
|
84
|
+
userId: 'String',
|
|
85
|
+
deptId: 'String',
|
|
86
|
+
isDeptLeader: 'Integer',
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* 权限中心 LCAP 实体定义详情
|
|
91
|
+
*/
|
|
92
|
+
exports.LCAP_ENTITIES_DEFINITION_MAP = {
|
|
93
|
+
LcapUser: `@Entity({
|
|
94
|
+
title: '制品应用的用户实体',
|
|
95
|
+
description: '实体名称不允许改动,默认生成的字段不允许改动,可新增自定义字段',
|
|
96
|
+
directory: 'permission_center(权限中心)'
|
|
97
|
+
})
|
|
98
|
+
export class LcapUser {
|
|
99
|
+
@EntityProperty({
|
|
100
|
+
title: '主键',
|
|
101
|
+
primaryKey: true,
|
|
102
|
+
required: true
|
|
103
|
+
})
|
|
104
|
+
id: Integer;
|
|
105
|
+
|
|
106
|
+
@EntityProperty({ title: '创建时间' })
|
|
107
|
+
createdTime: DateTime;
|
|
108
|
+
|
|
109
|
+
@EntityProperty({ title: '更新时间' })
|
|
110
|
+
updatedTime: DateTime;
|
|
111
|
+
|
|
112
|
+
@EntityProperty({
|
|
113
|
+
title: '用户ID',
|
|
114
|
+
description: '第三方登录方式唯一id;普通登录使用userName+source作为userId',
|
|
115
|
+
required: true
|
|
116
|
+
})
|
|
117
|
+
userId: String;
|
|
118
|
+
|
|
119
|
+
@EntityProperty({
|
|
120
|
+
title: '用户名',
|
|
121
|
+
description: '普通登录用户名,类似账号的概念',
|
|
122
|
+
required: true
|
|
123
|
+
})
|
|
124
|
+
userName: String;
|
|
125
|
+
|
|
126
|
+
@EntityProperty({
|
|
127
|
+
title: '登录密码',
|
|
128
|
+
description: '普通登录密码,密码建议加密存储。第三方登录不会存储密码'
|
|
129
|
+
})
|
|
130
|
+
password: String;
|
|
131
|
+
|
|
132
|
+
@EntityProperty({ title: '手机号' })
|
|
133
|
+
phone: String;
|
|
134
|
+
|
|
135
|
+
@EntityProperty({ title: '邮箱' })
|
|
136
|
+
email: String;
|
|
137
|
+
|
|
138
|
+
@EntityProperty({
|
|
139
|
+
title: '昵称',
|
|
140
|
+
description: '展示的名称'
|
|
141
|
+
})
|
|
142
|
+
displayName: String;
|
|
143
|
+
|
|
144
|
+
@EntityProperty({
|
|
145
|
+
title: '状态',
|
|
146
|
+
description: '标识当前用户的状态'
|
|
147
|
+
})
|
|
148
|
+
status: app.enums.UserStatusEnum = app.enums.UserStatusEnum['Normal'];
|
|
149
|
+
|
|
150
|
+
@EntityProperty({
|
|
151
|
+
title: '用户来源',
|
|
152
|
+
description: '当前条用户数据来自哪个用户源,如普通登录、微信登录',
|
|
153
|
+
required: true
|
|
154
|
+
})
|
|
155
|
+
source: app.enums.UserSourceEnum = app.enums.UserSourceEnum['Normal'];
|
|
156
|
+
|
|
157
|
+
@EntityProperty({ title: '直属主管' })
|
|
158
|
+
directLeaderId: String;
|
|
159
|
+
|
|
160
|
+
__IndexList() {
|
|
161
|
+
return [{ userIdIndex: [this.userId] }];
|
|
162
|
+
}
|
|
163
|
+
}`,
|
|
164
|
+
LcapRole: `@Entity({
|
|
165
|
+
title: '角色实体',
|
|
166
|
+
description: '操作该表可完成角色管理。默认生成的字段不允许改动,可新增自定义字段',
|
|
167
|
+
directory: 'permission_center(权限中心)'
|
|
168
|
+
})
|
|
169
|
+
export class LcapRole {
|
|
170
|
+
@EntityProperty({ title: '主键', primaryKey: true })
|
|
171
|
+
id: Integer;
|
|
172
|
+
|
|
173
|
+
@EntityProperty({ title: '创建时间' })
|
|
174
|
+
createdTime: DateTime;
|
|
175
|
+
|
|
176
|
+
@EntityProperty({ title: '更新时间' })
|
|
177
|
+
updatedTime: DateTime;
|
|
178
|
+
|
|
179
|
+
@EntityProperty({ title: '创建者' })
|
|
180
|
+
createdBy: String;
|
|
181
|
+
|
|
182
|
+
@EntityProperty({ title: '更新者' })
|
|
183
|
+
updatedBy: String;
|
|
184
|
+
|
|
185
|
+
@EntityProperty({ title: '唯一标识' })
|
|
186
|
+
uuid: String;
|
|
187
|
+
|
|
188
|
+
@EntityProperty({ title: '角色名称', required: true })
|
|
189
|
+
name: String;
|
|
190
|
+
|
|
191
|
+
@EntityProperty({ title: '角色描述' })
|
|
192
|
+
description: String;
|
|
193
|
+
|
|
194
|
+
@EntityProperty({
|
|
195
|
+
title: '角色状态',
|
|
196
|
+
description: '可配置 true 启用,false 禁用'
|
|
197
|
+
})
|
|
198
|
+
roleStatus: Boolean = true;
|
|
199
|
+
|
|
200
|
+
@EntityProperty({
|
|
201
|
+
title: '是否可编辑',
|
|
202
|
+
description: '系统字段,web新增为可编辑true,ide新增为不可编辑false'
|
|
203
|
+
})
|
|
204
|
+
editable: Boolean = true;
|
|
205
|
+
}`,
|
|
206
|
+
LcapPermission: `@Entity({
|
|
207
|
+
title: '权限实体',
|
|
208
|
+
description: '新增角色的同时一般需要绑定角色对应的权限',
|
|
209
|
+
directory: 'permission_center(权限中心)'
|
|
210
|
+
})
|
|
211
|
+
export class LcapPermission {
|
|
212
|
+
@EntityProperty({ title: '主键', primaryKey: true })
|
|
213
|
+
id: Integer;
|
|
214
|
+
|
|
215
|
+
@EntityProperty({ title: '创建时间' })
|
|
216
|
+
createdTime: DateTime;
|
|
217
|
+
|
|
218
|
+
@EntityProperty({ title: '更新时间' })
|
|
219
|
+
updatedTime: DateTime;
|
|
220
|
+
|
|
221
|
+
@EntityProperty({ title: '创建者' })
|
|
222
|
+
createdBy: String;
|
|
223
|
+
|
|
224
|
+
@EntityProperty({ title: '更新者' })
|
|
225
|
+
updatedBy: String;
|
|
226
|
+
|
|
227
|
+
@EntityProperty({ title: '唯一标识' })
|
|
228
|
+
uuid: String;
|
|
229
|
+
|
|
230
|
+
@EntityProperty({ title: '权限名称', required: true })
|
|
231
|
+
name: String;
|
|
232
|
+
|
|
233
|
+
@EntityProperty({ title: '权限描述' })
|
|
234
|
+
description: String;
|
|
235
|
+
}`,
|
|
236
|
+
LcapResource: `@Entity({
|
|
237
|
+
title: '资源实体',
|
|
238
|
+
description: '该表的数据是新建组件后,系统自动上报的。name字段对应资源路径',
|
|
239
|
+
directory: 'permission_center(权限中心)'
|
|
240
|
+
})
|
|
241
|
+
export class LcapResource {
|
|
242
|
+
@EntityProperty({ title: '主键', primaryKey: true })
|
|
243
|
+
id: Integer;
|
|
244
|
+
|
|
245
|
+
@EntityProperty({ title: '创建时间' })
|
|
246
|
+
createdTime: DateTime;
|
|
247
|
+
|
|
248
|
+
@EntityProperty({ title: '更新时间' })
|
|
249
|
+
updatedTime: DateTime;
|
|
250
|
+
|
|
251
|
+
@EntityProperty({ title: '创建者' })
|
|
252
|
+
createdBy: String;
|
|
253
|
+
|
|
254
|
+
@EntityProperty({ title: '更新者' })
|
|
255
|
+
updatedBy: String;
|
|
256
|
+
|
|
257
|
+
@EntityProperty({ title: '唯一标识' })
|
|
258
|
+
uuid: String;
|
|
259
|
+
|
|
260
|
+
@EntityProperty({
|
|
261
|
+
title: '资源名称',
|
|
262
|
+
description: '资源路径,如 /test/api',
|
|
263
|
+
required: true
|
|
264
|
+
})
|
|
265
|
+
name: String;
|
|
266
|
+
|
|
267
|
+
@EntityProperty({ title: '资源描述' })
|
|
268
|
+
description: String;
|
|
269
|
+
|
|
270
|
+
@EntityProperty({ title: '资源类型' })
|
|
271
|
+
type: String;
|
|
272
|
+
|
|
273
|
+
@EntityProperty({ title: '端标识' })
|
|
274
|
+
clientType: String;
|
|
275
|
+
}`,
|
|
276
|
+
LcapDepartment: `@Entity({
|
|
277
|
+
title: '部门实体',
|
|
278
|
+
description: '新增部门的同时一般需要指定上一级部门。默认生成的字段不允许改动,可新增自定义字段',
|
|
279
|
+
directory: 'permission_center(权限中心)'
|
|
280
|
+
})
|
|
281
|
+
export class LcapDepartment {
|
|
282
|
+
@EntityProperty({ title: '主键', primaryKey: true, required: true })
|
|
283
|
+
id: Integer;
|
|
284
|
+
|
|
285
|
+
@EntityProperty({ title: '创建时间' })
|
|
286
|
+
createdTime: DateTime;
|
|
287
|
+
|
|
288
|
+
@EntityProperty({ title: '更新时间' })
|
|
289
|
+
updatedTime: DateTime;
|
|
290
|
+
|
|
291
|
+
@EntityProperty({ title: '创建者' })
|
|
292
|
+
createdBy: String;
|
|
293
|
+
|
|
294
|
+
@EntityProperty({ title: '更新者' })
|
|
295
|
+
updatedBy: String;
|
|
296
|
+
|
|
297
|
+
@EntityProperty({ title: '部门名称' })
|
|
298
|
+
name: String;
|
|
299
|
+
|
|
300
|
+
@EntityProperty({ title: '部门标识' })
|
|
301
|
+
deptId: String;
|
|
302
|
+
|
|
303
|
+
@EntityProperty({ title: '父部门标识' })
|
|
304
|
+
parentDeptId: String;
|
|
305
|
+
|
|
306
|
+
__IndexList() {
|
|
307
|
+
return [{ deptIdIndex: [this.deptId] }];
|
|
308
|
+
}
|
|
309
|
+
}`,
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* 校验 Lcap 实体及其字段
|
|
313
|
+
* @param entity 转换后的实体对象
|
|
314
|
+
* @param parseState 解析状态
|
|
315
|
+
*/
|
|
316
|
+
function checkLcapEntity(entity, parseState) {
|
|
317
|
+
const lcapEntityFields = exports.LCAP_ENTITIES_MAP[entity.name];
|
|
318
|
+
if (!lcapEntityFields) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const entityFields = new Map(entity.properties.map((p) => [p.name, p]));
|
|
322
|
+
for (const [fieldName, expectedType] of Object.entries(lcapEntityFields)) {
|
|
323
|
+
const field = entityFields.get(fieldName);
|
|
324
|
+
if (!field) {
|
|
325
|
+
return (0, utils_1.throwError)(parseState, `实体 ${entity.name} 缺少必需属性: ${fieldName}。不能修改以下属性, 可新增其他属性。\n${exports.LCAP_ENTITIES_DEFINITION_MAP[entity.name] || JSON.stringify(lcapEntityFields, null, 2)}`);
|
|
326
|
+
}
|
|
327
|
+
const actualType = field?.typeAnnotation?.toNaturalTS();
|
|
328
|
+
if (actualType !== expectedType) {
|
|
329
|
+
return (0, utils_1.throwError)(parseState, `实体 ${entity.name} 的属性 ${fieldName} 类型不匹配。期望: ${expectedType}, 实际: ${actualType}`);
|
|
330
|
+
}
|
|
331
|
+
if (entity.name === 'LcapResource' && fieldName === 'description' && field?.required) {
|
|
332
|
+
return (0, utils_1.throwError)(parseState, `实体 LcapResource 的属性 description 不能设置为必填`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
exports.checkLcapEntity = checkLcapEntity;
|
|
337
|
+
//# sourceMappingURL=checkLcapEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkLcapEntity.js","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkLcapEntity.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkValidationCalleeName.d.ts","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkValidationCalleeName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAmF1E,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,UAAU,CAAC,cAAc,EAC/B,UAAU,EAAE,mBAAmB,aAYhC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkValidationCalleeName = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const allowedCalleeNames = [
|
|
6
|
+
// 空值判断规则
|
|
7
|
+
'required',
|
|
8
|
+
'filled',
|
|
9
|
+
'notEmpty',
|
|
10
|
+
'empty',
|
|
11
|
+
// 范围判断规则
|
|
12
|
+
'minLength',
|
|
13
|
+
'maxLength',
|
|
14
|
+
'rangeLength',
|
|
15
|
+
'min',
|
|
16
|
+
'max',
|
|
17
|
+
'range',
|
|
18
|
+
// 类型判断规则
|
|
19
|
+
'integer',
|
|
20
|
+
'numeric',
|
|
21
|
+
'decimal',
|
|
22
|
+
// 正则判断规则
|
|
23
|
+
'regex',
|
|
24
|
+
// 相等或包含判断规则
|
|
25
|
+
'is',
|
|
26
|
+
'isNot',
|
|
27
|
+
'equals',
|
|
28
|
+
'notEquals',
|
|
29
|
+
'confirmed',
|
|
30
|
+
'includes',
|
|
31
|
+
'excludes',
|
|
32
|
+
'included',
|
|
33
|
+
'excluded',
|
|
34
|
+
'unique',
|
|
35
|
+
// 字母数字判断规则
|
|
36
|
+
'alpha',
|
|
37
|
+
'alphaNum',
|
|
38
|
+
'alphaDash',
|
|
39
|
+
'alphaNumDash',
|
|
40
|
+
'alphaSpaces',
|
|
41
|
+
'lowerCase',
|
|
42
|
+
'upperCase',
|
|
43
|
+
// 常用规则 / 特定场景判断规则
|
|
44
|
+
'mobile',
|
|
45
|
+
'email',
|
|
46
|
+
'ip',
|
|
47
|
+
'port',
|
|
48
|
+
'halfWidth',
|
|
49
|
+
'fullWidth',
|
|
50
|
+
'macAddress',
|
|
51
|
+
'ascii',
|
|
52
|
+
'base64',
|
|
53
|
+
'byteLength',
|
|
54
|
+
'dataURI',
|
|
55
|
+
'divisibleBy',
|
|
56
|
+
'hash',
|
|
57
|
+
'md5',
|
|
58
|
+
'hex',
|
|
59
|
+
'hexColor',
|
|
60
|
+
'creditCard',
|
|
61
|
+
'fqdn',
|
|
62
|
+
'ipOrFQDN',
|
|
63
|
+
'ipRange',
|
|
64
|
+
'isbn',
|
|
65
|
+
'issn',
|
|
66
|
+
'isin',
|
|
67
|
+
'iso8601',
|
|
68
|
+
'iso31661Alpha2',
|
|
69
|
+
'iso31661Alpha3',
|
|
70
|
+
'json',
|
|
71
|
+
'jwt',
|
|
72
|
+
'latLong',
|
|
73
|
+
'mongoId',
|
|
74
|
+
'postalCode',
|
|
75
|
+
'url',
|
|
76
|
+
'uuid',
|
|
77
|
+
'chinese',
|
|
78
|
+
];
|
|
79
|
+
function checkValidationCalleeName(calleeName, node, parseState) {
|
|
80
|
+
if (calleeName === 'pattern') {
|
|
81
|
+
return (0, utils_1.throwError)(parseState, '禁止使用 pattern,请使用 regex 函数进行正则表达式判断,例如:regex(/^[a-z]/g)', node);
|
|
82
|
+
}
|
|
83
|
+
if (!allowedCalleeNames.includes(calleeName)) {
|
|
84
|
+
return (0, utils_1.throwError)(parseState, `nasl.validation 中不存在函数 ${calleeName}`, node);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.checkValidationCalleeName = checkValidationCalleeName;
|
|
88
|
+
//# sourceMappingURL=checkValidationCalleeName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkValidationCalleeName.js","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkValidationCalleeName.ts"],"names":[],"mappings":";;;AAAA,uCAA0E;AAE1E,MAAM,kBAAkB,GAAG;IACzB,SAAS;IACT,UAAU;IACV,QAAQ;IACR,UAAU;IACV,OAAO;IAEP,SAAS;IACT,WAAW;IACX,WAAW;IACX,aAAa;IACb,KAAK;IACL,KAAK;IACL,OAAO;IAEP,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IAET,SAAS;IACT,OAAO;IAEP,YAAY;IACZ,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,WAAW;IACX,WAAW;IACX,UAAU;IACV,UAAU;IACV,UAAU;IACV,UAAU;IACV,QAAQ;IAER,WAAW;IACX,OAAO;IACP,UAAU;IACV,WAAW;IACX,cAAc;IACd,aAAa;IACb,WAAW;IACX,WAAW;IAEX,kBAAkB;IAClB,QAAQ;IACR,OAAO;IACP,IAAI;IACJ,MAAM;IACN,WAAW;IACX,WAAW;IACX,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,aAAa;IACb,MAAM;IACN,KAAK;IACL,KAAK;IACL,UAAU;IACV,YAAY;IACZ,MAAM;IACN,UAAU;IACV,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;IACT,gBAAgB;IAChB,gBAAgB;IAChB,MAAM;IACN,KAAK;IACL,SAAS;IACT,SAAS;IACT,YAAY;IACZ,KAAK;IACL,MAAM;IACN,SAAS;CACV,CAAC;AAEF,SAAgB,yBAAyB,CACvC,UAAkB,EAClB,IAA+B,EAC/B,UAA+B;IAE/B,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,IAAA,kBAAU,EACf,UAAU,EACV,wDAAwD,EACxD,IAAI,CACL,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAA,kBAAU,EAAC,UAAU,EAAE,0BAA0B,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AAfD,8DAeC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { babelTypes, naslTypes, type ParseViewState } from '../../utils';
|
|
2
|
+
export interface CheckViewElementParams {
|
|
3
|
+
viewElement: naslTypes.ViewElement;
|
|
4
|
+
node: babelTypes.JSXElement;
|
|
5
|
+
options: ParseViewState;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 组件特性校验函数
|
|
9
|
+
* @param tag 组件标签名
|
|
10
|
+
* @param featureType 特性类型
|
|
11
|
+
* @param featureName 特性名称
|
|
12
|
+
* @param options 解析状态选项
|
|
13
|
+
* @param attr JSX属性节点
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateComponentFeature(tag: string, featureType: 'event' | 'slot' | 'prop', featureName: string, options: ParseViewState, attr: babelTypes.JSXAttribute): void;
|
|
16
|
+
/**
|
|
17
|
+
* 验证父组件约束
|
|
18
|
+
* @param tag 当前组件标签
|
|
19
|
+
* @param options 解析状态选项
|
|
20
|
+
* @param node JSX节点
|
|
21
|
+
* @returns 如果违反约束则返回错误,否则返回 undefined
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateParentConstraints(tag: string, options: ParseViewState, node: babelTypes.JSXElement): void | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* 对 ViewElement 进行校验
|
|
26
|
+
* 根据组件标签调用相应的校验函数
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkViewElement(params: CheckViewElementParams): void;
|
|
29
|
+
//# sourceMappingURL=checkViewElement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkViewElement.d.ts","sourceRoot":"","sources":["../../../../src/natural/transforms/checker/checkViewElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAc,KAAK,cAAc,EAA+B,MAAM,aAAa,CAAC;AAIlH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC;IACnC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC;IAC5B,OAAO,EAAE,cAAc,CAAC;CACzB;AAoGD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,EACtC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,UAAU,CAAC,YAAY,GAC5B,IAAI,CA4EN;AAiGD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,UAAU,CAAC,UAAU,GAC1B,IAAI,GAAG,SAAS,CA+DlB;AAoWD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,QA4B9D"}
|