@lcap/nasl 3.7.3-beta.1 → 3.8.0-beta.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/.mocharc.js +0 -1
- package/out/automate/engine/utils.js +6 -1
- package/out/automate/engine/utils.js.map +1 -1
- package/out/bak/translator.js +37 -0
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/shared/utils.d.ts +1 -0
- package/out/breakpoint/shared/utils.js +1 -1
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +11 -0
- package/out/common/BaseNode.js +101 -5
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Annotatable__.d.ts +109 -0
- package/out/concepts/Annotatable__.js +161 -0
- package/out/concepts/Annotatable__.js.map +1 -0
- package/out/concepts/AnnotationProperty__.d.ts +48 -0
- package/out/concepts/AnnotationProperty__.js +74 -0
- package/out/concepts/AnnotationProperty__.js.map +1 -0
- package/out/concepts/Annotation__.d.ts +128 -0
- package/out/concepts/Annotation__.js +248 -0
- package/out/concepts/Annotation__.js.map +1 -0
- package/out/concepts/App__.d.ts +14 -26
- package/out/concepts/App__.js +50 -20
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/ApplyAnnotation__.d.ts +87 -0
- package/out/concepts/ApplyAnnotation__.js +140 -0
- package/out/concepts/ApplyAnnotation__.js.map +1 -0
- package/out/concepts/Argument__.d.ts +19 -0
- package/out/concepts/Argument__.js +126 -0
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/AssigneeV2__.d.ts +169 -0
- package/out/concepts/AssigneeV2__.js +176 -1
- package/out/concepts/AssigneeV2__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.js +1 -1
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +1 -0
- package/out/concepts/BooleanLiteral__.js +9 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/BusinessLogic__.js +1 -1
- package/out/concepts/BusinessLogic__.js.map +1 -1
- package/out/concepts/CallFunction__.js +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +15 -0
- package/out/concepts/CallLogic__.js +149 -17
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/ConnectorLogic__.js +1 -1
- package/out/concepts/ConnectorLogic__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +0 -2
- package/out/concepts/DatabaseTypeAnnotation__.js +0 -20
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/DepartmentManagerV2__.d.ts +29 -0
- package/out/concepts/DepartmentManagerV2__.js +56 -0
- package/out/concepts/DepartmentManagerV2__.js.map +1 -0
- package/out/concepts/DepartmentV2__.d.ts +33 -0
- package/out/concepts/DepartmentV2__.js +63 -0
- package/out/concepts/DepartmentV2__.js.map +1 -0
- package/out/concepts/DirectManagerV2__.d.ts +25 -0
- package/out/concepts/DirectManagerV2__.js +53 -0
- package/out/concepts/DirectManagerV2__.js.map +1 -0
- package/out/concepts/End__.js +9 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +0 -2
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +2 -2
- package/out/concepts/Entity__.js +4 -7
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +1 -12
- package/out/concepts/EnumItem__.js +17 -49
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/EnumSelectSetter__.d.ts +4 -0
- package/out/concepts/EnumSelectSetter__.js +7 -0
- package/out/concepts/EnumSelectSetter__.js.map +1 -1
- package/out/concepts/Enum__.js +1 -4
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +52 -48
- package/out/concepts/FrontendLibrary__.js +45 -36
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/FrontendType__.d.ts +4 -0
- package/out/concepts/FrontendType__.js +7 -0
- package/out/concepts/FrontendType__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +2 -0
- package/out/concepts/Frontend__.js +21 -2
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/HistoryProcessV2__.js +4 -1
- package/out/concepts/HistoryProcessV2__.js.map +1 -1
- package/out/concepts/I18nInfo__.d.ts +0 -1
- package/out/concepts/I18nInfo__.js +0 -7
- package/out/concepts/I18nInfo__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -0
- package/out/concepts/Identifier__.js +31 -0
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +1 -4
- package/out/concepts/Interface__.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 +16 -1
- package/out/concepts/Logic__.js +133 -15
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/ManagerV2__.d.ts +34 -0
- package/out/concepts/ManagerV2__.js +61 -0
- package/out/concepts/ManagerV2__.js.map +1 -0
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +7 -7
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -0
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +88 -0
- package/out/concepts/Module__.js +85 -0
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/OperatePermissionV2__.d.ts +1 -1
- package/out/concepts/OperatePermissionV2__.js.map +1 -1
- package/out/concepts/Param__.d.ts +4 -0
- package/out/concepts/Param__.js +13 -21
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElementV2__.d.ts +6 -1
- package/out/concepts/ProcessElementV2__.js +20 -0
- package/out/concepts/ProcessElementV2__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +7 -0
- package/out/concepts/ProcessElement__.js +47 -0
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessV2__.d.ts +1 -34
- package/out/concepts/ProcessV2__.js +3 -70
- package/out/concepts/ProcessV2__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/StaticString__.d.ts +0 -4
- package/out/concepts/StaticString__.js +0 -11
- package/out/concepts/StaticString__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +1 -0
- package/out/concepts/StructureProperty__.js +14 -5
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +4 -0
- package/out/concepts/Structure__.js +6 -9
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SubLogic__.d.ts +418 -0
- package/out/concepts/SubLogic__.js +992 -0
- package/out/concepts/SubLogic__.js.map +1 -0
- package/out/concepts/Theme__.d.ts +9 -0
- package/out/concepts/Theme__.js +10 -0
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +0 -1
- package/out/concepts/Transactional__.js +0 -7
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +18 -0
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -0
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +6 -1
- package/out/concepts/ValidationRule__.js +6 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +8 -2
- package/out/concepts/ViewElement__.js +213 -32
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +10 -2
- package/out/concepts/View__.js +129 -17
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.processV2.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.processV2.js +50 -4
- package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -1
- package/out/concepts/basics/types/index.js +2 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +9 -0
- package/out/concepts/index__.js +9 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/utils/asserts.d.ts +409 -0
- package/out/concepts/utils/asserts.js +564 -14
- package/out/concepts/utils/asserts.js.map +1 -1
- package/out/concepts/utils/types.d.ts +33 -2
- package/out/generator/genBundleFiles.d.ts +13 -9
- package/out/generator/genBundleFiles.js +383 -63
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.js +2 -0
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/release-body/body.js +1 -0
- package/out/generator/release-body/body.js.map +1 -1
- package/out/generator/release-body/utils.d.ts +15 -7
- package/out/generator/release-body/utils.js +50 -7
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/natural/genNaturalTS.js +2 -4
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/getContext/index.js +0 -2
- package/out/natural/getContext/index.js.map +1 -1
- package/out/natural/transformTS2UI.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +1 -1
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/extendBaseNode.js +9 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getLogics.js +10 -6
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +6 -0
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcessesV2.d.ts +3 -2
- package/out/server/getProcessesV2.js +15 -6
- package/out/server/getProcessesV2.js.map +1 -1
- package/out/server/naslServer.d.ts +5 -1
- package/out/server/naslServer.js +120 -30
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +4 -0
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +2 -1
- package/out/service/storage/init.js +28 -71
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.d.ts +6 -2
- package/out/templator/genCreateBlock.js +25 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.d.ts +22 -0
- package/out/templator/genCurdEditMultipleKeyBlock.js +60 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.d.ts +13 -3
- package/out/templator/genCurdMultipleKeyBlock.js +29 -23
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.d.ts +1 -1
- package/out/templator/genGetBlock.js +3 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genListViewBlock.d.ts +1 -1
- package/out/templator/genListViewBlock.js +3 -2
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +1 -1
- package/out/templator/genSelectBlock.js +3 -2
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +9 -4
- package/out/templator/genTableBlock.js +31 -17
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.d.ts +2 -2
- package/out/templator/genUpdateBlock.js +11 -11
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/translator/types.d.ts +0 -4
- package/out/translator/utils.d.ts +0 -1
- package/out/translator/utils.js +1 -6
- package/out/translator/utils.js.map +1 -1
- package/out/utils/delay/index.d.ts +0 -0
- package/out/utils/delay/index.js +1 -0
- package/out/utils/delay/index.js.map +1 -0
- package/out/utils/env.d.ts +0 -4
- package/out/utils/env.js +3 -6
- package/out/utils/env.js.map +1 -1
- package/out/utils/index.d.ts +3 -2
- package/out/utils/index.js +18 -14
- package/out/utils/index.js.map +1 -1
- package/out/utils/time-slicing/controller.js.map +1 -1
- package/out/utils/types.d.ts +0 -17
- package/package.json +27 -20
- package/sandbox/stdlib/extension.component.ts +29 -0
- package/sandbox/stdlib/nasl.process.ts +17 -0
- package/sandbox/stdlib/nasl.processV2.ts +10 -5
- package/sandbox/stdlib/nasl.util.ts +3 -1
- package/src/automate/engine/utils.js +7 -2
- package/src/bak/translator.js +42 -1
- package/src/breakpoint/shared/utils.ts +2 -1
- package/src/common/BaseNode.ts +117 -5
- package/src/concepts/Annotatable__.ts +263 -0
- package/src/concepts/AnnotationProperty__.ts +102 -0
- package/src/concepts/Annotation__.ts +344 -0
- package/src/concepts/App__.ts +917 -26
- package/src/concepts/ApplyAnnotation__.ts +198 -0
- package/src/concepts/Argument__.ts +145 -1
- package/src/concepts/AssigneeV2__.ts +387 -1
- package/src/concepts/AuthLogicForCallInterface__.ts +1 -1
- package/src/concepts/AuthLogic__.ts +1 -1
- package/src/concepts/BooleanLiteral__.ts +9 -1
- package/src/concepts/BusinessLogic__.ts +1 -1
- package/src/concepts/CallFunction__.ts +1 -1
- package/src/concepts/CallLogic__.ts +153 -16
- package/src/concepts/ConnectorLogic__.ts +1 -1
- package/src/concepts/DatabaseTypeAnnotation__.ts +0 -11
- package/src/concepts/DepartmentManagerV2__.ts +70 -0
- package/src/concepts/DepartmentV2__.ts +75 -0
- package/src/concepts/DirectManagerV2__.ts +65 -0
- package/src/concepts/End__.ts +10 -1
- package/src/concepts/EntityProperty__.ts +0 -5
- package/src/concepts/Entity__.ts +5 -9
- package/src/concepts/EnumItem__.ts +16 -65
- package/src/concepts/EnumSelectSetter__.ts +6 -0
- package/src/concepts/Enum__.ts +1 -6
- package/src/concepts/ForEachStatement__.ts +1 -1
- package/src/concepts/FrontendLibrary__.ts +88 -80
- package/src/concepts/FrontendType__.ts +6 -0
- package/src/concepts/Frontend__.ts +26 -3
- package/src/concepts/HistoryProcessV2__.ts +5 -0
- package/src/concepts/I18nInfo__.ts +0 -5
- package/src/concepts/Identifier__.ts +32 -0
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/Interface__.ts +1 -6
- package/src/concepts/LogicItem__.ts +1 -0
- package/src/concepts/Logic__.ts +140 -17
- package/src/concepts/ManagerV2__.ts +78 -0
- package/src/concepts/MatchCase__.ts +9 -8
- package/src/concepts/MemberExpression__.ts +1 -0
- package/src/concepts/Module__.ts +194 -0
- package/src/concepts/OperatePermissionV2__.ts +1 -1
- package/src/concepts/Param__.ts +17 -20
- package/src/concepts/ProcessElementV2__.ts +23 -0
- package/src/concepts/ProcessElement__.ts +18 -0
- package/src/concepts/ProcessV2__.ts +4 -70
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/StaticString__.ts +0 -13
- package/src/concepts/StructureProperty__.ts +16 -7
- package/src/concepts/Structure__.ts +10 -11
- package/src/concepts/SubLogic__.ts +1516 -0
- package/src/concepts/Theme__.ts +9 -0
- package/src/concepts/Transactional__.ts +0 -5
- package/src/concepts/TriggerLauncher__.ts +1 -1
- package/src/concepts/TypeAnnotation__.ts +17 -0
- package/src/concepts/TypeParam__.ts +3 -0
- package/src/concepts/ValidationRule__.ts +6 -1
- package/src/concepts/ViewElement__.ts +224 -34
- package/src/concepts/View__.ts +135 -22
- package/src/concepts/basics/stdlib/nasl.processV2.ts +56 -3
- package/src/concepts/basics/types/index.ts +1 -1
- package/src/concepts/index__.ts +9 -0
- package/src/concepts/utils/asserts.ts +595 -0
- package/src/concepts/utils/types.ts +53 -0
- package/src/generator/genBundleFiles.ts +408 -68
- package/src/generator/genMetaData.ts +3 -0
- package/src/generator/release-body/body.ts +1 -0
- package/src/generator/release-body/utils.ts +159 -55
- package/src/natural/genNaturalTS.ts +3 -5
- package/src/natural/getContext/index.ts +0 -2
- package/src/natural/transformTS2UI.ts +5 -2
- package/src/natural/transformTSCode.ts +2 -2
- package/src/server/extendBaseNode.ts +11 -2
- package/src/server/getLogics.ts +9 -7
- package/src/server/getMemberIdentifier.ts +7 -0
- package/src/server/getProcessesV2.ts +16 -6
- package/src/server/naslServer.ts +133 -30
- package/src/server/translator.ts +4 -0
- package/src/service/storage/init.ts +52 -97
- package/src/templator/genCreateBlock.ts +35 -14
- package/src/templator/genCurdEditMultipleKeyBlock.ts +65 -1
- package/src/templator/genCurdMultipleKeyBlock.ts +42 -23
- package/src/templator/genGetBlock.ts +4 -3
- package/src/templator/genListViewBlock.ts +3 -3
- package/src/templator/genSelectBlock.ts +4 -2
- package/src/templator/genTableBlock.ts +32 -17
- package/src/templator/genUpdateBlock.ts +21 -18
- package/src/translator/types.ts +0 -4
- package/src/translator/utils.ts +0 -6
- package/src/utils/delay/index.ts +0 -0
- package/src/utils/env.ts +4 -5
- package/src/utils/index.ts +16 -4
- package/src/utils/time-slicing/controller.ts +1 -0
- package/src/utils/types.ts +0 -20
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +2 -1
- package/ts-worker/bundle.js +1 -1
- package/ts-worker/src/index.js +1 -0
- package/out/utils/language-cache/constant.d.ts +0 -18
- package/out/utils/language-cache/constant.js +0 -35
- package/out/utils/language-cache/constant.js.map +0 -1
- package/out/utils/language-cache/index.d.ts +0 -2
- package/out/utils/language-cache/index.js +0 -19
- package/out/utils/language-cache/index.js.map +0 -1
- package/out/utils/language-cache/nasl.d.ts +0 -10
- package/out/utils/language-cache/nasl.js +0 -98
- package/out/utils/language-cache/nasl.js.map +0 -1
- package/out/utils/language-cache/types.d.ts +0 -44
- package/out/utils/language-cache/types.js +0 -4
- package/out/utils/language-cache/types.js.map +0 -1
- package/src/utils/language-cache/constant.ts +0 -37
- package/src/utils/language-cache/index.ts +0 -2
- package/src/utils/language-cache/nasl.ts +0 -83
- package/src/utils/language-cache/types.ts +0 -48
|
@@ -40,6 +40,8 @@ const concepts_1 = require("../concepts");
|
|
|
40
40
|
const babelParser = __importStar(require("@babel/parser"));
|
|
41
41
|
const json5 = __importStar(require("json5"));
|
|
42
42
|
const compiler = __importStar(require("vue-template-compiler"));
|
|
43
|
+
const BooleanLiteral__1 = require("./BooleanLiteral__");
|
|
44
|
+
const StringLiteral__1 = require("./StringLiteral__");
|
|
43
45
|
const LogicItem__1 = require("./LogicItem__");
|
|
44
46
|
const Logic__1 = require("./Logic__");
|
|
45
47
|
const config_1 = require("../config");
|
|
@@ -92,6 +94,15 @@ function transAstNodeToNaslNode(astNode, namespace) {
|
|
|
92
94
|
let node = null;
|
|
93
95
|
if (astNode.type === 'CallExpression' && astNode.callee.object.name === '$utils') {
|
|
94
96
|
const calleeName = astNode.callee.property.name || astNode.callee.property.value;
|
|
97
|
+
const _arguments = astNode.arguments
|
|
98
|
+
.map((argument) => ({
|
|
99
|
+
concept: 'Argument',
|
|
100
|
+
name: '',
|
|
101
|
+
kind: 'Statement',
|
|
102
|
+
keyword: '',
|
|
103
|
+
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
104
|
+
}))
|
|
105
|
+
.filter((item) => item.expression), _typeArguments = astNode.arguments.map((argument) => transAstNodeToNaslTypeNode(Object.assign({}, argument))).filter((item) => item);
|
|
95
106
|
node = {
|
|
96
107
|
concept: 'CallFunction',
|
|
97
108
|
name: '',
|
|
@@ -99,19 +110,15 @@ function transAstNodeToNaslNode(astNode, namespace) {
|
|
|
99
110
|
kind: 'Expression',
|
|
100
111
|
calleeNamespace: 'nasl.util',
|
|
101
112
|
calleeName,
|
|
102
|
-
arguments:
|
|
103
|
-
|
|
104
|
-
concept: 'Argument',
|
|
105
|
-
name: '',
|
|
106
|
-
kind: 'Statement',
|
|
107
|
-
keyword: '',
|
|
108
|
-
expression: transAstNodeToNaslNode(Object.assign({}, argument)),
|
|
109
|
-
}))
|
|
110
|
-
.filter((item) => item.expression),
|
|
111
|
-
typeArguments: astNode.arguments
|
|
112
|
-
.map((argument) => transAstNodeToNaslTypeNode(Object.assign({}, argument)))
|
|
113
|
-
.filter((item) => item),
|
|
113
|
+
arguments: _arguments,
|
|
114
|
+
typeArguments: _typeArguments,
|
|
114
115
|
};
|
|
116
|
+
if (calleeName === 'Convert') {
|
|
117
|
+
node.arguments = [_arguments[0]];
|
|
118
|
+
if (_typeArguments.length === 0 && _arguments?.length === 2) {
|
|
119
|
+
node.typeArguments = [_arguments?.[1].expression];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
115
122
|
}
|
|
116
123
|
else if (astNode.type === 'MemberExpression') {
|
|
117
124
|
if (astNode.object?.name === '$global') {
|
|
@@ -152,13 +159,23 @@ function transAstNodeToNaslNode(astNode, namespace) {
|
|
|
152
159
|
kind: 'Expression',
|
|
153
160
|
};
|
|
154
161
|
}
|
|
155
|
-
else if (astNode.type === 'ArrayExpression'
|
|
162
|
+
else if (astNode.type === 'ArrayExpression') {
|
|
156
163
|
node = {
|
|
157
164
|
concept: 'Unparsed',
|
|
158
165
|
label: '原子项',
|
|
159
166
|
code: astNode.value,
|
|
160
167
|
};
|
|
161
168
|
}
|
|
169
|
+
else if (astNode.type === 'ObjectExpression') {
|
|
170
|
+
const properties = astNode.properties.map((property) => ({
|
|
171
|
+
key: property.key.value,
|
|
172
|
+
value: property.value.value,
|
|
173
|
+
}));
|
|
174
|
+
node = {};
|
|
175
|
+
properties.forEach((property) => {
|
|
176
|
+
node[property.key] = property.value;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
162
179
|
else if (astNode.type === 'TemplateLiteral') {
|
|
163
180
|
// 模板字符串翻译成字符串插值
|
|
164
181
|
const { expressions, quasis } = astNode;
|
|
@@ -295,11 +312,12 @@ const decorators_1 = require("../decorators");
|
|
|
295
312
|
const utils = __importStar(require("../utils"));
|
|
296
313
|
const create_1 = require("../utils/create");
|
|
297
314
|
const asserts = __importStar(require("./utils/asserts"));
|
|
298
|
-
const
|
|
315
|
+
const BindDirective__1 = __importDefault(require("./BindDirective__"));
|
|
316
|
+
const Annotatable__1 = __importDefault(require("./Annotatable__"));
|
|
299
317
|
/**
|
|
300
318
|
* 页面元素
|
|
301
319
|
*/
|
|
302
|
-
let ViewElement = ViewElement_1 = class ViewElement extends
|
|
320
|
+
let ViewElement = ViewElement_1 = class ViewElement extends Annotatable__1.default {
|
|
303
321
|
/**
|
|
304
322
|
* @param source 需要合并的部分参数
|
|
305
323
|
*/
|
|
@@ -1509,7 +1527,6 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
1509
1527
|
code += element.toTextualNASL((0, translator_1.shiftState)(state, code, {
|
|
1510
1528
|
tabSize: state.tabSize + 2,
|
|
1511
1529
|
}));
|
|
1512
|
-
code += ',\n';
|
|
1513
1530
|
});
|
|
1514
1531
|
code += `${(0, translator_1.indent)(state.tabSize + 1)}] },\n`;
|
|
1515
1532
|
}
|
|
@@ -1519,13 +1536,15 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
1519
1536
|
});
|
|
1520
1537
|
// 翻译其余的子集
|
|
1521
1538
|
if (defaultArr.length) {
|
|
1522
|
-
|
|
1523
|
-
defaultArr.forEach((element) => {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1539
|
+
throw new Error('多个插槽必须都在 template 内');
|
|
1540
|
+
// defaultArr.forEach((element) => {
|
|
1541
|
+
// code += element.toTextualNASL(
|
|
1542
|
+
// shiftState(state, code, {
|
|
1543
|
+
// tabSize: state.tabSize,
|
|
1544
|
+
// }),
|
|
1545
|
+
// // levelIndex,
|
|
1546
|
+
// );
|
|
1547
|
+
// });
|
|
1529
1548
|
}
|
|
1530
1549
|
}
|
|
1531
1550
|
else {
|
|
@@ -2191,11 +2210,23 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
2191
2210
|
this.refName && parts.push(`:ref="\`${this.refName}\`"`);
|
|
2192
2211
|
this.keyName && parts.push(`:key="\`${this.keyName}\`"`);
|
|
2193
2212
|
this.staticClass && parts.push(`class="${this.staticClass}"`);
|
|
2213
|
+
let dataRefList = [];
|
|
2194
2214
|
const vIfs = [];
|
|
2195
2215
|
[]
|
|
2196
2216
|
.concat(this.bindAttrs, this.bindDirectives, this.bindEvents)
|
|
2197
2217
|
.forEach((attr) => {
|
|
2198
2218
|
let result = newOptions.attrFormat(attr, this, attr?.toVue(newOptions));
|
|
2219
|
+
// 属性翻译为指令 :仅封闭态流程表单内使用
|
|
2220
|
+
if (options?.filterAttr
|
|
2221
|
+
&& options?.filterAttr?.length > 0
|
|
2222
|
+
&& attr.concept === 'BindAttribute'
|
|
2223
|
+
&& attr.name === 'processHidden') {
|
|
2224
|
+
options?.filterAttr.map(filterAttrName => {
|
|
2225
|
+
if (attr.name === filterAttrName) {
|
|
2226
|
+
result = null;
|
|
2227
|
+
}
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2199
2230
|
if (options?.isExport &&
|
|
2200
2231
|
attr?.concept === 'BindAttribute' &&
|
|
2201
2232
|
attr?.name === 'src' &&
|
|
@@ -2213,6 +2244,138 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
2213
2244
|
}
|
|
2214
2245
|
result && parts.push(result);
|
|
2215
2246
|
});
|
|
2247
|
+
const genDirectiveByAnno = (viewElement) => {
|
|
2248
|
+
if (viewElement?.applyAnnotations?.length > 0) {
|
|
2249
|
+
// todo: 根据注解生成自定义指令 v-annoName="context"
|
|
2250
|
+
// 血缘算法要生成一个所有的 Entity-ViewElement 的映射map
|
|
2251
|
+
// context 从 血缘算法映射获取 getRelataionByElement()
|
|
2252
|
+
return viewElement.applyAnnotations.map((aa) => {
|
|
2253
|
+
const getExpressionValue = (expression) => {
|
|
2254
|
+
if (expression?.concept === 'BooleanLiteral') {
|
|
2255
|
+
return BooleanLiteral__1.BooleanLiteral.from(expression)?.toBoolean();
|
|
2256
|
+
}
|
|
2257
|
+
if (expression?.concept === 'NewList') {
|
|
2258
|
+
return eval(expression.toUI().replace('新建:', ''));
|
|
2259
|
+
}
|
|
2260
|
+
return expression?.value;
|
|
2261
|
+
};
|
|
2262
|
+
let argsList = aa.arguments.map((arg) => getExpressionValue(arg.expression));
|
|
2263
|
+
let annoArgs = {
|
|
2264
|
+
argsList,
|
|
2265
|
+
dataRefList,
|
|
2266
|
+
};
|
|
2267
|
+
// debugger
|
|
2268
|
+
// 所有参数序列化之后当字符串传进指令参数 (目前不支持<div v-demo="{ color: 'white', text: 'hello!' }"></div>
|
|
2269
|
+
let expression = StringLiteral__1.StringLiteral.from({
|
|
2270
|
+
concept: 'StringLiteral',
|
|
2271
|
+
kind: 'Expression',
|
|
2272
|
+
name: '',
|
|
2273
|
+
value: JSON.stringify(annoArgs),
|
|
2274
|
+
});
|
|
2275
|
+
let annoDirective = BindDirective__1.default.from({
|
|
2276
|
+
name: aa.annotationName,
|
|
2277
|
+
// arg:'arg',
|
|
2278
|
+
expression,
|
|
2279
|
+
});
|
|
2280
|
+
return annoDirective;
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
let isH5ListViewLayout = this?.tag === 'van-cell' && this.getAncestorByTag('ViewElement', 'van-list-view');
|
|
2285
|
+
let isListViewLayout = this?.tag === 'u-linear-layout' && this.getAncestorByTag('ViewElement', 'u-list-view');
|
|
2286
|
+
let isGridViewLayout = this?.tag === 'u-linear-layout' && this.getAncestorByTag('ViewElement', 'u-grid-view');
|
|
2287
|
+
const getLogicDataRef = (viewElement) => {
|
|
2288
|
+
// 自上向下查找, 指令需要翻译到绑定值元素的上级父元素
|
|
2289
|
+
// 这个元素需要满足 1 向下能找到 绑定了值的表单子元素
|
|
2290
|
+
// 2 向上能找到 固定的几种表单元素 且带有dataSource 并找到对应的calllogic name
|
|
2291
|
+
let targetTag = ['u-table-view-column']; //'u-form-item' 逻辑无法感知到表单绑定值的变更
|
|
2292
|
+
let logicName;
|
|
2293
|
+
const addDataRefDriective = (ve) => {
|
|
2294
|
+
ve?.bindAttrs?.find((attr) => {
|
|
2295
|
+
let type = attr?.expression?.object?.__TypeAnnotation;
|
|
2296
|
+
if (type) {
|
|
2297
|
+
console.log('type: ', type);
|
|
2298
|
+
let { typeKind, typeName, typeNamespace } = type || {};
|
|
2299
|
+
// todo 这里可能不是匿名数据结构吗
|
|
2300
|
+
if (typeKind === 'anonymousStructure') {
|
|
2301
|
+
let parent = this.getAncestorByTag('ViewElement', 'u-table-view') ||
|
|
2302
|
+
this.getAncestorByTag('ViewElement', 'u-list-view') ||
|
|
2303
|
+
this.getAncestorByTag('ViewElement', 'u-grid-view') ||
|
|
2304
|
+
this.getAncestorByTag('ViewElement', 'van-grid-view') ||
|
|
2305
|
+
this.getAncestorByTag('ViewElement', 'van-list-view');
|
|
2306
|
+
if (parent?.tag) {
|
|
2307
|
+
let dataSourceAttr = parent?.bindAttrs?.find((it) => it?.name === 'dataSource');
|
|
2308
|
+
if (dataSourceAttr?.expression?.concept === 'CallLogic') {
|
|
2309
|
+
if (dataSourceAttr?.expression?.calleeNamespace === 'app.logics') {
|
|
2310
|
+
logicName = dataSourceAttr?.expression?.calleeName;
|
|
2311
|
+
// debugger
|
|
2312
|
+
let ref = {
|
|
2313
|
+
typeNamespace: 'app.logics',
|
|
2314
|
+
typeName: logicName,
|
|
2315
|
+
propName: attr?.expression.toUI()?.replace('current.item.', ''),
|
|
2316
|
+
};
|
|
2317
|
+
console.log('ref: ', ref);
|
|
2318
|
+
dataRefList.push(ref);
|
|
2319
|
+
// 要考虑 多个元素 每个元素有多个注解的情况
|
|
2320
|
+
let result = genDirectiveByAnno(viewElement)?.map((d) => d?.toVue());
|
|
2321
|
+
result && result?.length > 0 && parts.push(...result);
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
});
|
|
2328
|
+
};
|
|
2329
|
+
// 特殊的 'van-text' 'van-grid-view' 默认没有线性布局包裹 文本
|
|
2330
|
+
if (viewElement?.tag === 'van-text') {
|
|
2331
|
+
addDataRefDriective(viewElement);
|
|
2332
|
+
}
|
|
2333
|
+
if (targetTag.includes(viewElement?.tag) || isH5ListViewLayout || isGridViewLayout || isListViewLayout) {
|
|
2334
|
+
this.traverseChildren((ve) => {
|
|
2335
|
+
addDataRefDriective(ve);
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
// 已知问题: 逻辑的表格可以推导 表单无法推导(如果是实体拖过来的 还是指向实体)
|
|
2340
|
+
// 已知问题: 目前采用隐藏父元素的方式; 后续有任何 tag 或者结构更改都不生效
|
|
2341
|
+
getLogicDataRef(this);
|
|
2342
|
+
const getEntityDataRef = (viewElement) => {
|
|
2343
|
+
// 这个类型都是 默认找到子元素的数据引用 然后加到自己的指令上
|
|
2344
|
+
let targetTag = ['u-table-view-column', 'u-form-item'];
|
|
2345
|
+
const addDataRefDriective = (ve) => {
|
|
2346
|
+
ve?.bindAttrs?.find((attr) => {
|
|
2347
|
+
let type = attr?.expression?.object?.__TypeAnnotation;
|
|
2348
|
+
if (type) {
|
|
2349
|
+
let { typeKind, typeName, typeNamespace } = type || {};
|
|
2350
|
+
if (typeKind === 'reference' && typeNamespace) {
|
|
2351
|
+
let entityPropName = attr?.expression?.property?.name;
|
|
2352
|
+
// debugger;
|
|
2353
|
+
let ref = {
|
|
2354
|
+
typeNamespace,
|
|
2355
|
+
typeName,
|
|
2356
|
+
propName: entityPropName,
|
|
2357
|
+
};
|
|
2358
|
+
dataRefList.push(ref);
|
|
2359
|
+
let result = genDirectiveByAnno(viewElement)?.map((d) => d?.toVue());
|
|
2360
|
+
result && result?.length > 0 && parts.push(...result);
|
|
2361
|
+
}
|
|
2362
|
+
// typeName "Entity1"
|
|
2363
|
+
// typeNamespace "app.dataSources.defaultDS.entities"
|
|
2364
|
+
}
|
|
2365
|
+
});
|
|
2366
|
+
};
|
|
2367
|
+
// 特殊的 'van-text' 'van-grid-view' 默认没有线性布局包裹 文本
|
|
2368
|
+
if (viewElement?.tag === 'van-text') {
|
|
2369
|
+
addDataRefDriective(viewElement);
|
|
2370
|
+
}
|
|
2371
|
+
if (targetTag.includes(viewElement?.tag) || isH5ListViewLayout || isGridViewLayout || isListViewLayout) {
|
|
2372
|
+
this.traverseChildren((ve) => addDataRefDriective(ve));
|
|
2373
|
+
}
|
|
2374
|
+
// 数据网格: 指令单元是线性布局 (数据列表结构也一样)
|
|
2375
|
+
// 1 向下能找到 一个绑定了数据源的元素
|
|
2376
|
+
// 2 向上是线性布局 卡片 template gridView
|
|
2377
|
+
};
|
|
2378
|
+
getEntityDataRef(this);
|
|
2216
2379
|
if (vIfs.length === 2)
|
|
2217
2380
|
parts.push(`v-if="(${vIfs[0]}) && (${vIfs[1]})"`);
|
|
2218
2381
|
else if (vIfs.length === 1)
|
|
@@ -2284,6 +2447,21 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
2284
2447
|
staticStyle = staticStyle.replace(/url\('\/assets\/(.*?)'\)/, `url('${this.app.sysPrefixPath}/assets/$1')`);
|
|
2285
2448
|
}
|
|
2286
2449
|
staticStyle && parts.push(`style="${staticStyle}"`);
|
|
2450
|
+
// input hidden属性 要翻译到上级元素的 栅格列的if指令
|
|
2451
|
+
// 从父查子 若有hidden 直接输出null
|
|
2452
|
+
if (this?.name?.includes('grid_layout_column')
|
|
2453
|
+
&& !(options?.filterAttr && options?.filterAttr?.length > 0)) {
|
|
2454
|
+
let checkHiddenAttr = (it) => it?.bindAttrs?.find((attr) => attr?.name === 'processHidden');
|
|
2455
|
+
let getHiddenChild = (el) => {
|
|
2456
|
+
return el.children?.find((it) => {
|
|
2457
|
+
return it.children?.find((item) => checkHiddenAttr(item));
|
|
2458
|
+
//return checkHiddenAttr(it)
|
|
2459
|
+
});
|
|
2460
|
+
};
|
|
2461
|
+
if (getHiddenChild(this)) {
|
|
2462
|
+
parts.push(`v-show="window.Vue.prototype.$env.VUE_APP_DESIGNER"`);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2287
2465
|
if (!content.length) {
|
|
2288
2466
|
shouldIndent = false;
|
|
2289
2467
|
}
|
|
@@ -2310,14 +2488,7 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
2310
2488
|
* 从父级删除该节点
|
|
2311
2489
|
* @internal
|
|
2312
2490
|
*/
|
|
2313
|
-
delete() {
|
|
2314
|
-
super.delete();
|
|
2315
|
-
if (this.parentNode) {
|
|
2316
|
-
this.traverseChildren((ele) => {
|
|
2317
|
-
this.likeComponent?.removeExistingViewElement(ele);
|
|
2318
|
-
});
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2491
|
+
delete() { }
|
|
2321
2492
|
findElementByName(name) {
|
|
2322
2493
|
return utils.traverse((current) => {
|
|
2323
2494
|
if (current.node.name === name)
|
|
@@ -2530,6 +2701,13 @@ let ViewElement = ViewElement_1 = class ViewElement extends BaseNode_1.default {
|
|
|
2530
2701
|
this.getBindAttribute('id')?.value === 'dynamicRenderContainer' &&
|
|
2531
2702
|
this.getBindAttribute('processPrefix'));
|
|
2532
2703
|
}
|
|
2704
|
+
getAncestorByTag(concept, tag) {
|
|
2705
|
+
let parentNode = this?.parentNode;
|
|
2706
|
+
while (parentNode && parentNode.concept && !(parentNode.concept === concept && parentNode?.tag === tag)) {
|
|
2707
|
+
parentNode = parentNode.parentNode;
|
|
2708
|
+
}
|
|
2709
|
+
return parentNode;
|
|
2710
|
+
}
|
|
2533
2711
|
};
|
|
2534
2712
|
/** 类名 */
|
|
2535
2713
|
ViewElement.ConceptName = 'ViewElement';
|
|
@@ -2539,7 +2717,7 @@ ViewElement.ConceptName = 'ViewElement';
|
|
|
2539
2717
|
*/
|
|
2540
2718
|
ViewElement.isAbstract = false;
|
|
2541
2719
|
/** 继承链 */
|
|
2542
|
-
ViewElement.inheritanceChain = ['BaseNode'];
|
|
2720
|
+
ViewElement.inheritanceChain = ['Annotatable', 'BaseNode'];
|
|
2543
2721
|
ViewElement.TAG_NAME_PREFIX_REG = /^([lieu]|van)[-_]/;
|
|
2544
2722
|
__decorate([
|
|
2545
2723
|
(0, decorators_1.property)('concept')
|
|
@@ -2547,6 +2725,9 @@ __decorate([
|
|
|
2547
2725
|
__decorate([
|
|
2548
2726
|
(0, decorators_1.property)()
|
|
2549
2727
|
], ViewElement.prototype, "tag", void 0);
|
|
2728
|
+
__decorate([
|
|
2729
|
+
(0, decorators_1.property)()
|
|
2730
|
+
], ViewElement.prototype, "refNamespace", void 0);
|
|
2550
2731
|
__decorate([
|
|
2551
2732
|
(0, decorators_1.property)()
|
|
2552
2733
|
], ViewElement.prototype, "name", void 0);
|