@lcap/nasl 1.0.0-alpha.9 → 1.0.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/automate/engine/index.d.ts +3 -0
- package/out/automate/engine/index.js +414 -0
- package/out/automate/engine/index.js.map +1 -0
- package/out/automate/engine/operators.d.ts +13 -0
- package/out/automate/engine/operators.js +63 -0
- package/out/automate/engine/operators.js.map +1 -0
- package/out/automate/engine/uniqueName.d.ts +6 -0
- package/out/automate/engine/uniqueName.js +39 -0
- package/out/automate/engine/uniqueName.js.map +1 -0
- package/out/automate/engine/utils.d.ts +24 -0
- package/out/automate/engine/utils.js +379 -0
- package/out/automate/engine/utils.js.map +1 -0
- package/out/common/BaseNode.d.ts +21 -1
- package/out/common/BaseNode.js +232 -84
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.d.ts +19 -1
- package/out/concepts/App__.js +88 -45
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +5 -1
- package/out/concepts/Argument__.js +21 -3
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +201 -0
- package/out/concepts/Assignee__.js +298 -0
- package/out/concepts/Assignee__.js.map +1 -0
- package/out/concepts/Assignment__.js +5 -0
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +8 -7
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +19 -0
- package/out/concepts/BindAttribute__.js +55 -10
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +23 -3
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +2 -2
- package/out/concepts/BindEvent__.js +67 -34
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +2 -0
- package/out/concepts/BooleanLiteral__.js +10 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.js +58 -25
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +5 -0
- package/out/concepts/CallInterface__.js +238 -31
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +4 -4
- package/out/concepts/CallLogic__.js +107 -50
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +38 -3
- package/out/concepts/CallQueryComponent__.js +329 -75
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.js +6 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.d.ts +3 -1
- package/out/concepts/CompletionProperty__.js +2 -0
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +3 -3
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +3 -3
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +3 -3
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +1 -0
- package/out/concepts/Constant__.js +16 -2
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +12 -0
- package/out/concepts/Destination__.js +115 -22
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +9 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.js +4 -2
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +11 -0
- package/out/concepts/EntityProperty__.js +71 -5
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +5 -4
- package/out/concepts/Entity__.js +35 -19
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +5 -0
- package/out/concepts/Enum__.js +24 -12
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +3 -3
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +1 -1
- package/out/concepts/ForEachStatement__.js +11 -15
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Function__.js +13 -13
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +3 -0
- package/out/concepts/Identifier__.js +77 -30
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +4 -4
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +6 -4
- package/out/concepts/InterfaceParam__.js +57 -19
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +42 -30
- package/out/concepts/Interface__.js +133 -17
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +1 -0
- package/out/concepts/JSBlock__.js +3 -0
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -1
- package/out/concepts/LogicItem__.js +14 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +20 -1
- package/out/concepts/Logic__.js +194 -37
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +2 -0
- package/out/concepts/MemberExpression__.js +49 -13
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +126 -120
- package/out/concepts/Module__.js +36 -26
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +5 -1
- package/out/concepts/Namespace__.js +48 -37
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +3 -0
- package/out/concepts/NullLiteral__.js +11 -1
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +1 -1
- package/out/concepts/NumericLiteral__.js +17 -6
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/Param__.d.ts +7 -3
- package/out/concepts/Param__.js +64 -28
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +6 -6
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +0 -4
- package/out/concepts/ProcessElement__.js +123 -54
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +1 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/Process__.d.ts +7 -1
- package/out/concepts/Process__.js +81 -85
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +1 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +1 -0
- package/out/concepts/QueryFieldExpression__.js +3 -0
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +3 -0
- package/out/concepts/QueryGroupByExpression__.js +20 -0
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +5 -5
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +2 -2
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +3 -3
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +4 -1
- package/out/concepts/Return__.js +74 -23
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +4 -0
- package/out/concepts/Role__.js +13 -4
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +2 -2
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -1
- package/out/concepts/StringLiteral__.js +22 -39
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +5 -4
- package/out/concepts/StructureProperty__.js +55 -26
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +44 -30
- package/out/concepts/Structure__.js +44 -12
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +4 -4
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -2
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +5 -5
- package/out/concepts/TypeAnnotation__.js +82 -20
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +10 -8
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.js +1 -1
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -0
- package/out/concepts/ValidationRule__.js +48 -13
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +10 -1
- package/out/concepts/Variable__.js +77 -20
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +15 -15
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +17 -11
- package/out/concepts/ViewElement__.js +302 -204
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +13 -12
- package/out/concepts/View__.js +124 -102
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +3 -3
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +4 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/{nasl.validate.d.ts → nasl.auth.d.ts} +0 -0
- package/out/concepts/basics/stdlib/nasl.auth.js +30 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.browser.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.browser.js +41 -0
- package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js +25 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -0
- package/out/concepts/basics/stdlib/nasl.interface.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.interface.js +4 -4
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +20 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +138 -18
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +54 -20
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +1 -1
- package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +11 -10
- package/out/concepts/basics/types/coreTypeList.js.map +1 -1
- package/out/concepts/basics/types/index.d.ts +1 -0
- package/out/concepts/basics/types/index.js +3 -1
- package/out/concepts/basics/types/index.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/config.d.ts +1 -2
- package/out/config.js +1 -2
- package/out/config.js.map +1 -1
- package/out/enums/KEYWORDS.d.ts +3 -0
- package/out/enums/KEYWORDS.js +1199 -0
- package/out/enums/KEYWORDS.js.map +1 -0
- package/out/{terms → enums}/LEVEL_NAME_MAP.d.ts +0 -0
- package/out/{terms → enums}/LEVEL_NAME_MAP.js +0 -0
- package/out/{terms → enums}/LEVEL_NAME_MAP.js.map +1 -1
- package/out/eventBus.d.ts +3 -0
- package/out/eventBus.js +7 -0
- package/out/eventBus.js.map +1 -0
- package/out/generator/genBundleFiles.d.ts +7 -2
- package/out/generator/genBundleFiles.js +168 -27
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +20 -20
- package/out/generator/genMetaData.js +50 -15
- package/out/generator/genMetaData.js.map +1 -1
- package/out/index.d.ts +2 -0
- package/out/index.js +2 -0
- package/out/index.js.map +1 -1
- package/out/manager/diagnostic.d.ts +2 -2
- package/out/server/createUiTs.d.ts +1 -0
- package/out/server/createUiTs.js +49 -5
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +38 -23
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.d.ts +1 -0
- package/out/server/extendBaseNode.js +323 -0
- package/out/server/extendBaseNode.js.map +1 -0
- package/out/server/getExtensionModules.js +2 -0
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getFunctions.d.ts +1 -0
- package/out/server/getFunctions.js +7 -1
- package/out/server/getFunctions.js.map +1 -1
- package/out/server/getLogics.js +84 -18
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +16 -1
- package/out/server/getMemberIdentifier.js +326 -38
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcesses.d.ts +8 -1
- package/out/server/getProcesses.js +383 -1
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getScope.d.ts +13 -0
- package/out/server/getScope.js +61 -0
- package/out/server/getScope.js.map +1 -0
- package/out/server/index.d.ts +1 -0
- package/out/server/index.js +5 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +36 -57
- package/out/server/naslServer.js +689 -615
- package/out/server/naslServer.js.map +1 -1
- package/out/server/process2LogicNamespace.d.ts +10 -0
- package/out/server/process2LogicNamespace.js +29 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +22 -3
- package/out/server/translator.js +369 -123
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.d.ts +1 -0
- package/out/service/creator/add.configs.js +68 -0
- package/out/service/creator/add.configs.js.map +1 -0
- package/out/service/creator/errHandles.d.ts +18 -0
- package/out/service/creator/errHandles.js +60 -0
- package/out/service/creator/errHandles.js.map +1 -0
- package/out/service/creator/index.d.ts +1 -0
- package/out/service/creator/index.js +72 -0
- package/out/service/creator/index.js.map +1 -0
- package/out/service/storage/api.d.ts +18 -0
- package/out/service/storage/api.js +17 -0
- package/out/service/storage/api.js.map +1 -0
- package/out/service/storage/init.js +221 -37
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/service.d.ts +2 -0
- package/out/service/storage/service.js +10 -0
- package/out/service/storage/service.js.map +1 -0
- package/out/service/storage/storagePoint.d.ts +1 -14
- package/out/service/storage/storagePoint.js +16 -16
- package/out/service/storage/storagePoint.js.map +1 -1
- package/out/templator/genCreateBlock.js +6 -6
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +13 -17
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +11 -11
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +5 -5
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +2 -2
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +6 -4
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.d.ts +3 -1
- package/out/templator/genGridViewBlock.js +61 -6
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.d.ts +2 -0
- package/out/templator/genQueryComponent.js +34 -18
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +5 -15
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.d.ts +1 -1
- package/out/templator/genTableBlock.js +4 -5
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +10 -11
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +16 -5
- package/out/templator/utils.js +10 -5
- package/out/templator/utils.js.map +1 -1
- package/out/test/fixtures/env.js +0 -1
- package/out/test/fixtures/env.js.map +1 -1
- package/out/test/units/page/Element.spec.js +3 -3
- package/out/test/units/page/Element.spec.js.map +1 -1
- package/out/test/units/temp/temp.spec.js +1 -1
- package/out/test/units/temp/temp.spec.js.map +1 -1
- package/out/utils/index.d.ts +6 -0
- package/out/utils/index.js +25 -1
- package/out/utils/index.js.map +1 -1
- package/out/utils/string.d.ts +1 -1
- package/out/utils/string.js +38 -9
- package/out/utils/string.js.map +1 -1
- package/package.json +2 -2
- package/src/automate/engine/index.js +95 -119
- package/src/automate/engine/operators.js +63 -0
- package/src/automate/engine/uniqueName.js +36 -0
- package/src/automate/engine/utils.js +63 -19
- package/src/common/BaseNode.ts +229 -74
- package/src/concepts/App__.ts +92 -85
- package/src/concepts/Argument__.ts +23 -3
- package/src/concepts/Assignee__.ts +467 -0
- package/src/concepts/Assignment__.ts +4 -1
- package/src/concepts/BinaryExpression__.ts +9 -7
- package/src/concepts/BindAttribute__.ts +69 -9
- package/src/concepts/BindDirective__.ts +22 -3
- package/src/concepts/BindEvent__.ts +67 -23
- package/src/concepts/BooleanLiteral__.ts +8 -0
- package/src/concepts/CallFunction__.ts +55 -23
- package/src/concepts/CallInterface__.ts +236 -26
- package/src/concepts/CallLogic__.ts +111 -52
- package/src/concepts/CallQueryComponent__.ts +315 -67
- package/src/concepts/Comment__.ts +6 -2
- package/src/concepts/CompletionProperty__.ts +5 -1
- package/src/concepts/ConfigGroup__.ts +3 -3
- package/src/concepts/ConfigProperty__.ts +3 -3
- package/src/concepts/Configuration__.ts +3 -3
- package/src/concepts/Constant__.ts +14 -2
- package/src/concepts/Destination__.ts +123 -37
- package/src/concepts/End__.ts +8 -1
- package/src/concepts/EntityIndex__.ts +4 -2
- package/src/concepts/EntityProperty__.ts +56 -5
- package/src/concepts/Entity__.ts +38 -21
- package/src/concepts/Enum__.ts +23 -26
- package/src/concepts/Event__.ts +3 -3
- package/src/concepts/ForEachStatement__.ts +16 -21
- package/src/concepts/Function__.ts +13 -13
- package/src/concepts/Identifier__.ts +84 -42
- package/src/concepts/IfStatement__.ts +4 -4
- package/src/concepts/InterfaceParam__.ts +57 -16
- package/src/concepts/Interface__.ts +130 -16
- package/src/concepts/JSBlock__.ts +4 -0
- package/src/concepts/LogicItem__.ts +16 -1
- package/src/concepts/Logic__.ts +192 -39
- package/src/concepts/MemberExpression__.ts +58 -15
- package/src/concepts/Module__.ts +35 -24
- package/src/concepts/Namespace__.ts +49 -37
- package/src/concepts/NullLiteral__.ts +8 -1
- package/src/concepts/NumericLiteral__.ts +17 -6
- package/src/concepts/Param__.ts +64 -16
- package/src/concepts/ProcessComponent__.ts +6 -6
- package/src/concepts/ProcessElement__.ts +149 -44
- package/src/concepts/ProcessOutcome__.ts +1 -1
- package/src/concepts/Process__.ts +85 -98
- package/src/concepts/QueryAggregateExpression__.ts +1 -1
- package/src/concepts/QueryFieldExpression__.ts +4 -0
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryGroupByExpression__.ts +23 -0
- package/src/concepts/QueryJoinExpression__.ts +5 -5
- package/src/concepts/QueryLimitExpression__.ts +2 -2
- package/src/concepts/QuerySelectExpression__.ts +3 -3
- package/src/concepts/Return__.ts +69 -17
- package/src/concepts/Role__.ts +5 -4
- package/src/concepts/SqlQueryComponent__.ts +2 -2
- package/src/concepts/StringLiteral__.ts +21 -39
- package/src/concepts/StructureProperty__.ts +50 -18
- package/src/concepts/Structure__.ts +32 -10
- package/src/concepts/SwitchCase__.ts +4 -4
- package/src/concepts/SwitchStatement__.ts +2 -2
- package/src/concepts/TypeAnnotation__.ts +66 -15
- package/src/concepts/UnaryExpression__.ts +10 -8
- package/src/concepts/Unparsed__.ts +1 -1
- package/src/concepts/ValidationRule__.ts +44 -14
- package/src/concepts/Variable__.ts +70 -16
- package/src/concepts/ViewComponent__.ts +15 -15
- package/src/concepts/ViewElement__.ts +289 -166
- package/src/concepts/View__.ts +135 -69
- package/src/concepts/WhileStatement__.ts +4 -4
- package/src/concepts/basics/stdlib/index.ts +4 -2
- package/src/concepts/basics/stdlib/nasl.auth.ts +26 -0
- package/src/concepts/basics/stdlib/nasl.browser.ts +37 -0
- package/src/concepts/basics/stdlib/nasl.configuration.ts +21 -0
- package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.ui.ts +20 -1
- package/src/concepts/basics/stdlib/nasl.util.ts +140 -18
- package/src/concepts/basics/stdlib/nasl.validation.ts +45 -11
- package/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts +1 -1
- package/src/concepts/basics/types/coreTypeList.ts +11 -11
- package/src/concepts/basics/types/index.ts +1 -0
- package/src/concepts/index__.ts +1 -0
- package/src/config.ts +1 -2
- package/src/enums/KEYWORDS.ts +1197 -0
- package/src/{terms → enums}/LEVEL_NAME_MAP.ts +0 -0
- package/src/eventBus.ts +5 -0
- package/src/generator/genBundleFiles.ts +182 -30
- package/src/generator/genMetaData.ts +72 -21
- package/src/index.ts +2 -0
- package/src/manager/diagnostic.ts +2 -2
- package/src/server/createUiTs.ts +45 -7
- package/src/server/entity2LogicNamespace.ts +41 -25
- package/src/server/extendBaseNode.ts +318 -0
- package/src/server/getExtensionModules.ts +2 -0
- package/src/server/getFunctions.ts +6 -0
- package/src/server/getLogics.ts +87 -19
- package/src/server/getMemberIdentifier.ts +282 -65
- package/src/server/getProcesses.ts +397 -4
- package/src/server/getScope.ts +67 -0
- package/src/server/index.ts +13 -1
- package/src/server/naslServer.ts +694 -632
- package/src/server/process2LogicNamespace.ts +30 -2
- package/src/server/translator.ts +425 -128
- package/src/service/config/index.js +1 -1
- package/src/service/creator/errHandles.js +5 -2
- package/src/service/creator/index.js +0 -6
- package/src/service/storage/api.js +14 -0
- package/src/service/storage/init.ts +218 -45
- package/src/service/storage/service.ts +6 -0
- package/src/service/storage/storagePoint.ts +16 -16
- package/src/templator/genCreateBlock.ts +6 -6
- package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -30
- package/src/templator/genCurdMultipleKeyBlock.ts +11 -11
- package/src/templator/genEditTableBlock.ts +5 -5
- package/src/templator/genEnumSelectBlock.ts +2 -2
- package/src/templator/genGetBlock.ts +7 -9
- package/src/templator/genGridViewBlock.ts +59 -9
- package/src/templator/genQueryComponent.ts +46 -32
- package/src/templator/genSelectBlock.ts +5 -15
- package/src/templator/genTableBlock.ts +5 -9
- package/src/templator/genUpdateBlock.ts +10 -12
- package/src/templator/utils.ts +12 -6
- package/src/test/fixtures/env.ts +0 -2
- package/src/test/units/page/Element.spec.ts +3 -3
- package/src/test/units/temp/temp.spec.ts +1 -1
- package/src/utils/index.ts +24 -0
- package/src/utils/string.ts +39 -9
- package/out/concepts/basics/stdlib/nasl.validate.js +0 -527
- package/out/concepts/basics/stdlib/nasl.validate.js.map +0 -1
- package/out/data/Module.d.ts +0 -34
- package/out/data/Module.js +0 -53
- package/out/data/Module.js.map +0 -1
- package/src/automate/engine/index.d.ts +0 -3
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CallLogic, BindEvent, App, Namespace, Entity, BaseNode, Logic, Param, TypeAnnotation, Return, Process, ProcessElement } from '..';
|
|
2
2
|
import { genLaunchProcess, genUserTaskLogic } from './getProcesses';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 给调用逻辑用
|
|
6
|
+
* @param process
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
4
9
|
export function process2LogicNamespace(process: Process) {
|
|
5
10
|
const children: Array<Namespace> = [];
|
|
6
11
|
process.elements.forEach((e) => {
|
|
@@ -9,14 +14,20 @@ export function process2LogicNamespace(process: Process) {
|
|
|
9
14
|
const ns = new Namespace({
|
|
10
15
|
name: e.name,
|
|
11
16
|
logics: [l],
|
|
17
|
+
originConcept: 'UserTask',
|
|
12
18
|
});
|
|
13
19
|
// 与process 中 toEmbededTS 所设置的 namespace 相关
|
|
14
20
|
const path = `app.processes.${process.name}.elements.${e.name}.logics`;
|
|
15
21
|
l.getNamespace = function() {
|
|
16
22
|
return path;
|
|
17
23
|
}
|
|
24
|
+
const api = `/api/${process.name}/${e.name}/${l.name}`;
|
|
25
|
+
l.getPath = function() {
|
|
26
|
+
return api;
|
|
27
|
+
}
|
|
18
28
|
children.push(ns);
|
|
19
|
-
ns.path = `app.processes.${process.name}.elements.${e.name}
|
|
29
|
+
ns.path = `app.processes.${process.name}.elements.${e.name}`;
|
|
30
|
+
ns.expanded = true;
|
|
20
31
|
}
|
|
21
32
|
});
|
|
22
33
|
const launchLogic = genLaunchProcess(process);
|
|
@@ -26,6 +37,13 @@ export function process2LogicNamespace(process: Process) {
|
|
|
26
37
|
children,
|
|
27
38
|
});
|
|
28
39
|
ns.path = `app.processes.${process.name}.logics`;
|
|
40
|
+
const api = `/api/${process.name}/${launchLogic.name}`;
|
|
41
|
+
launchLogic.getNamespace = function() {
|
|
42
|
+
return ns.path;
|
|
43
|
+
}
|
|
44
|
+
launchLogic.getPath = function() {
|
|
45
|
+
return api;
|
|
46
|
+
}
|
|
29
47
|
return ns;
|
|
30
48
|
}
|
|
31
49
|
|
|
@@ -41,7 +59,11 @@ interface processTreeFragment {
|
|
|
41
59
|
logics: Array<Logic>,
|
|
42
60
|
}>
|
|
43
61
|
}
|
|
44
|
-
|
|
62
|
+
/**
|
|
63
|
+
* 给侧边栏树形用
|
|
64
|
+
* @param process
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
45
67
|
export function processToTreeFragment(process: Process) {
|
|
46
68
|
const fragment: processTreeFragment = {
|
|
47
69
|
level: 'processTreeFragment',
|
|
@@ -54,6 +76,10 @@ export function processToTreeFragment(process: Process) {
|
|
|
54
76
|
if (e.type === 'UserTask') {
|
|
55
77
|
const l = genUserTaskLogic(e);
|
|
56
78
|
l.parentKey = 'readonly'
|
|
79
|
+
l.params.forEach(p => {
|
|
80
|
+
p.readonly = true;
|
|
81
|
+
})
|
|
82
|
+
l.parentNode = process;
|
|
57
83
|
fragment.elements.push({
|
|
58
84
|
level: 'processTreeElementFragment',
|
|
59
85
|
id: e.id,
|
|
@@ -64,6 +90,8 @@ export function processToTreeFragment(process: Process) {
|
|
|
64
90
|
});
|
|
65
91
|
|
|
66
92
|
const launchLogic = genLaunchProcess(process);
|
|
93
|
+
launchLogic.parentNode = process;
|
|
94
|
+
|
|
67
95
|
fragment.logics.push(launchLogic);
|
|
68
96
|
launchLogic.parentKey = 'readonly'
|
|
69
97
|
return fragment;
|
package/src/server/translator.ts
CHANGED
|
@@ -1,8 +1,60 @@
|
|
|
1
|
-
import naslServer from
|
|
2
|
-
|
|
1
|
+
import naslServer from './naslServer';
|
|
2
|
+
import {
|
|
3
|
+
Module,
|
|
4
|
+
BaseNode,
|
|
5
|
+
App,
|
|
6
|
+
Structure,
|
|
7
|
+
Logic,
|
|
8
|
+
Entity,
|
|
9
|
+
TypeAnnotation,
|
|
10
|
+
MemberExpression,
|
|
11
|
+
EntityProperty,
|
|
12
|
+
EntityIndex,
|
|
13
|
+
View,
|
|
14
|
+
Destination,
|
|
15
|
+
Enum,
|
|
16
|
+
BindEvent,
|
|
17
|
+
QueryFromExpression,
|
|
18
|
+
QueryJoinExpression,
|
|
19
|
+
QueryFieldExpression,
|
|
20
|
+
Identifier,
|
|
21
|
+
CallLogic,
|
|
22
|
+
EnumItem,
|
|
23
|
+
Param,
|
|
24
|
+
Process,
|
|
25
|
+
Interface,
|
|
26
|
+
Argument,
|
|
27
|
+
ViewElement,
|
|
28
|
+
BindAttribute,
|
|
29
|
+
Assignment,
|
|
30
|
+
CallQueryComponent,
|
|
31
|
+
Role,
|
|
32
|
+
Configuration,
|
|
33
|
+
CallInterface,
|
|
34
|
+
Return,
|
|
35
|
+
ProcessElement,
|
|
36
|
+
NullLiteral,
|
|
37
|
+
SwitchCase,
|
|
38
|
+
WhileStatement,
|
|
39
|
+
IfStatement,
|
|
40
|
+
UnaryExpression,
|
|
41
|
+
ForEachStatement,
|
|
42
|
+
CallFunction,
|
|
43
|
+
ProcessOutcome,
|
|
44
|
+
} from '../concepts';
|
|
45
|
+
import { SourceMapItem } from '../translator';
|
|
46
|
+
import { Diagnostic } from '../manager/diagnostic';
|
|
47
|
+
export interface MinRange {
|
|
48
|
+
node: BaseNode;
|
|
49
|
+
item: SourceMapItem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function transformType(tsType: string): string {
|
|
3
53
|
if (tsType === 'string' || tsType === 'String')
|
|
4
54
|
return '字符串';
|
|
5
|
-
else if (tsType === 'number'
|
|
55
|
+
else if (tsType === 'number')
|
|
56
|
+
return '数字';
|
|
57
|
+
else if (tsType === 'Integer')
|
|
6
58
|
return '整数';
|
|
7
59
|
else if (tsType === 'Double')
|
|
8
60
|
return '小数';
|
|
@@ -11,11 +63,27 @@ export function transformType(tsType: string): string {
|
|
|
11
63
|
else if (tsType === 'DateTime')
|
|
12
64
|
return '日期时间';
|
|
13
65
|
else if (tsType === 'Date')
|
|
14
|
-
return '时间';
|
|
15
|
-
else if (tsType === 'Time')
|
|
16
66
|
return '日期';
|
|
67
|
+
else if (tsType === 'Time')
|
|
68
|
+
return '时间';
|
|
17
69
|
else if (tsType === 'boolean' || tsType === 'Boolean')
|
|
18
70
|
return '布尔值';
|
|
71
|
+
else if (tsType === 'unknown')
|
|
72
|
+
return '未知类型';
|
|
73
|
+
else if (tsType === 'Enums')
|
|
74
|
+
return '枚举';
|
|
75
|
+
else if (tsType === 'views')
|
|
76
|
+
return '页面';
|
|
77
|
+
else if (tsType === 'void')
|
|
78
|
+
return '无返回值';
|
|
79
|
+
else if (tsType === '__elements')
|
|
80
|
+
return '页面元素';
|
|
81
|
+
else if (tsType === 'extensions')
|
|
82
|
+
return '拓展模块';
|
|
83
|
+
else if (tsType === 'Promise<void>')
|
|
84
|
+
return '未知类型';
|
|
85
|
+
else if (tsType.startsWith('{') && tsType.endsWith('}'))
|
|
86
|
+
return '当前节点';
|
|
19
87
|
else if (tsType.endsWith('[]')) {
|
|
20
88
|
return `List<${transformType(tsType.slice(0, -2))}>`;
|
|
21
89
|
} else if (tsType.startsWith('<T extends ') && tsType.endsWith('>() => T')) {
|
|
@@ -25,144 +93,244 @@ export function transformType(tsType: string): string {
|
|
|
25
93
|
tsStr += index === 0 ? transformType(item) : ' | ' + transformType(item);
|
|
26
94
|
});
|
|
27
95
|
return tsStr;
|
|
96
|
+
} else if (tsType.includes(' & ')) {
|
|
97
|
+
const types = tsType.split(' & ');
|
|
98
|
+
let tsStr = '';
|
|
99
|
+
types.forEach((item, index) => {
|
|
100
|
+
tsStr += index === 0 ? transformType(item) : ' | ' + transformType(item);
|
|
101
|
+
});
|
|
102
|
+
return tsStr;
|
|
103
|
+
} else if (tsType.includes(' | ')) {
|
|
104
|
+
const types = tsType.split(' | ');
|
|
105
|
+
let tsStr = '';
|
|
106
|
+
types.forEach((item, index) => {
|
|
107
|
+
tsStr += index === 0 ? transformType(item) : ' | ' + transformType(item);
|
|
108
|
+
});
|
|
109
|
+
return tsStr;
|
|
28
110
|
} else {
|
|
29
111
|
return tsType;
|
|
30
112
|
}
|
|
31
113
|
}
|
|
32
114
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
115
|
+
const NAMESPACE_CONCEPT_MAP: Record<string, string> = {
|
|
116
|
+
entities: '实体',
|
|
117
|
+
structures: '数据结构',
|
|
118
|
+
enums: '枚举',
|
|
119
|
+
logics: '逻辑',
|
|
120
|
+
interfaces: '接口',
|
|
121
|
+
views: '页面',
|
|
122
|
+
elements: '元素',
|
|
123
|
+
processes: '流程',
|
|
124
|
+
roles: '角色',
|
|
125
|
+
extensions: '扩展模块',
|
|
126
|
+
apis: '接口应用',
|
|
127
|
+
components: '扩展组件',
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
function transformNamespace(tsNamespace: string): string {
|
|
131
|
+
for (const key in NAMESPACE_CONCEPT_MAP) {
|
|
132
|
+
const value = NAMESPACE_CONCEPT_MAP[key];
|
|
133
|
+
if (tsNamespace.endsWith(key))
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
return tsNamespace;
|
|
40
137
|
}
|
|
41
138
|
|
|
42
|
-
|
|
139
|
+
function transformMethod(tsMethod: string): string {
|
|
43
140
|
if (tsMethod === 'forEach')
|
|
44
141
|
return 'ForEach';
|
|
45
|
-
|
|
142
|
+
else
|
|
143
|
+
return tsMethod;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function transformIdentifier(identifier: string): string {
|
|
147
|
+
if (NAMESPACE_CONCEPT_MAP[identifier])
|
|
148
|
+
return NAMESPACE_CONCEPT_MAP[identifier];
|
|
149
|
+
else
|
|
150
|
+
return ` ${transformType(identifier)} 上的`;
|
|
46
151
|
}
|
|
152
|
+
|
|
47
153
|
export function outOriginalvalue(value: string) {
|
|
48
154
|
return value;
|
|
49
155
|
}
|
|
50
156
|
|
|
157
|
+
const TS_RULES: Array<{
|
|
158
|
+
re: RegExp;
|
|
159
|
+
result: string;
|
|
160
|
+
transforms?: Array<(str: string) => string>;
|
|
161
|
+
}> = [
|
|
162
|
+
{
|
|
163
|
+
re: /Object literal may only specify known properties, and '(.+?)' does not exist in type/,
|
|
164
|
+
result: '当前参数$1,不可用',
|
|
165
|
+
transforms: [outOriginalvalue],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
re: /Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/,
|
|
169
|
+
result: '参数类型不一致!传入类型:$1,接收类型:$2。',
|
|
170
|
+
transforms: [transformType, transformType],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
re: /Type '(.+?)' is not assignable to type '(.+?)'/,
|
|
174
|
+
result: '左右参数类型不一致!左边类型:$2,右边类型:$1。',
|
|
175
|
+
transforms: [transformType, transformType],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
re: /Type '(.+?)' does not satisfy the constraint '(.+?)'/,
|
|
179
|
+
result: '参数类型不一致!传入类型:$1,接收类型:$2。',
|
|
180
|
+
transforms: [transformType, transformType],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
re: /This condition will always return '(.+?)' since the types '(.+?)' and '(.+?)' have no overlap/,
|
|
184
|
+
result: '左右参数类型不一致!左边类型:$2,右边类型:$3。',
|
|
185
|
+
transforms: [transformType, transformType, transformType],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
re: /Type '(.+?)' is missing the following properties from type '(.+?)'/,
|
|
189
|
+
result: '类型不一致!左边类型:$2,右边类型:$1。',
|
|
190
|
+
transforms: [transformType, transformType],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
re: /Property '(.+?)' is missing in type '(.+?)' but required in type '(.+?)'/,
|
|
194
|
+
result: '类型不一致!左边类型:$3,右边类型:$2。',
|
|
195
|
+
transforms: [outOriginalvalue, transformType, transformType],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
re: /Expression expected/,
|
|
199
|
+
result: '表达式不能为空。',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
re: /Cannot find name '__(?:IDENTIFIER|LEFT|RIGHT)__'/,
|
|
203
|
+
result: '表达式不能为空。',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
re: /Cannot find name '__(?:QueryFieldExpression)__'/,
|
|
207
|
+
result: '数据查询:实体字段不能为空。',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
re: /Cannot find name '__(?:WHERE_MULTIPLE_CONDITION)__'/,
|
|
211
|
+
result: '数据查询:筛选条件不能有多个表达式。',
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
re: /Cannot find name '__(?:HAVING_MULTIPLE_CONDITION)__'/,
|
|
215
|
+
result: '数据查询:聚合属性过滤不能有多个表达式。',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
re: /Cannot find name '__(?:EMPTY_AGGREGATE_NAME)__'/,
|
|
219
|
+
result: '数据查询:聚合函数名称不能为空。',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
re: /Cannot find name '__(?:EMPTY_AGGREGATE_ALIAS)__'/,
|
|
223
|
+
result: '数据查询:聚合函数别名不能为空。',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
re: /No value exists in scope for the shorthand property '__(?:IDENTIFIER|LEFT|RIGHT)__'. Either declare one or provide an initializer./,
|
|
227
|
+
result: '用户任务未关联页面',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
re: /'(.+?)' is declared but its value is never read/,
|
|
231
|
+
result: "已添加'$1',但从来没有使用过。",
|
|
232
|
+
transforms: [transformType, transformType],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
re: /'(.+?)' has no exported member(?: named)? '(.+?)'/,
|
|
236
|
+
result: '找不到$1 $2。',
|
|
237
|
+
transforms: [transformNamespace, transformType],
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
re: /Unreachable code detected\./,
|
|
241
|
+
result: '逻辑中有未使用的。',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
re: /Property '__slice' does not exist on type '(.+?)'/,
|
|
245
|
+
result: 'ForEach:循环列表:参数类型不匹配!所需类型:数组、集合等,提供类型:$1',
|
|
246
|
+
transforms: [transformType],
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
re: /Property '(.+?)' does not exist on type 'typeof (.+?)'/,
|
|
250
|
+
result: '找不到$2 $1。',
|
|
251
|
+
transforms: [transformMethod, transformIdentifier],
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
re: /Property '(.+?)' does not exist on type '(.+?)'/,
|
|
255
|
+
result: '找不到$2 $1。',
|
|
256
|
+
transforms: [transformMethod, transformIdentifier],
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
re: /Cannot find name '(.+?)'. Did you mean '(.+?)'\?/,
|
|
260
|
+
result: '找不到 $1。',
|
|
261
|
+
transforms: [outOriginalvalue, outOriginalvalue],
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
re: /Expected (.+?) type arguments, but got (.+?)/,
|
|
265
|
+
result: '预期 $1 个类型参数,但传入了 $2 个。',
|
|
266
|
+
transforms: [outOriginalvalue, outOriginalvalue],
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
re: /Expected (.+?) arguments, but got (.+?)./,
|
|
270
|
+
result: '预期 $1 个参数,但传入了 $2 个。',
|
|
271
|
+
transforms: [outOriginalvalue, outOriginalvalue],
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
re: /The (.+?)-hand side of an arithmetic operation must be of type (.+?). type./,
|
|
275
|
+
result: '表达式错误!',
|
|
276
|
+
transforms: [outOriginalvalue, outOriginalvalue],
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
re: /Operator '(.+?)' cannot be applied to types '(.+?)' and '(.+?)'./,
|
|
280
|
+
result: '符号:$1 参数类型不匹配!所需类型:基础类型>$2,提供类型:$3。',
|
|
281
|
+
transforms: [outOriginalvalue, transformType, transformType],
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
re: /Object is possibly 'undefined'./,
|
|
285
|
+
result: '所选择的内容未定义。',
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
re: /Cannot find name '(.+?)'./,
|
|
289
|
+
result: '所选择的内容 $1 未定义。',
|
|
290
|
+
transforms: [outOriginalvalue],
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
re: /Duplicate identifier '(.+?)'./,
|
|
294
|
+
result: '当前内容中有重复的 $1,可能会影响使用。',
|
|
295
|
+
transforms: [outOriginalvalue],
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
const POST_RULES: Array<{
|
|
300
|
+
re: RegExp;
|
|
301
|
+
result: string;
|
|
302
|
+
transforms?: Array<(str: string) => string>;
|
|
303
|
+
}> = [
|
|
304
|
+
{
|
|
305
|
+
re: /__IDENTIFIER__/g,
|
|
306
|
+
result: 'undefined',
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
re: /Integer|"Integer"/g,
|
|
310
|
+
result: '整数',
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
re: /Long|"Long"/g,
|
|
314
|
+
result: '长整数',
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
re: /Double|"Double"/g,
|
|
318
|
+
result: '小数',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
re: /never/g,
|
|
322
|
+
result: '不接受任何类型',
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
Object.keys(NAMESPACE_CONCEPT_MAP).forEach((key) => {
|
|
326
|
+
POST_RULES.push({
|
|
327
|
+
re: new RegExp(key, 'g'),
|
|
328
|
+
result: NAMESPACE_CONCEPT_MAP[key],
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
51
332
|
export function translateDiagnosticMessage(message: string) {
|
|
52
|
-
const
|
|
53
|
-
re: RegExp,
|
|
54
|
-
result: string,
|
|
55
|
-
transforms?: Array<(str: string) => string>,
|
|
56
|
-
}> = [
|
|
57
|
-
{
|
|
58
|
-
re: /^Type '(.+?)' is not assignable to type '(.+?)'\./,
|
|
59
|
-
result: '左右参数类型不一致!左边类型:$2,右边类型:$1。',
|
|
60
|
-
transforms: [transformType, transformType],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
re: /^Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'\./,
|
|
64
|
-
result: '参数类型不一致!传入类型:$1,接收类型:$2。',
|
|
65
|
-
transforms: [transformType, transformType],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
re: /^This condition will always return 'false' since the types '(.+?)' and '(.+?)' have no overlap\.$/,
|
|
69
|
-
result: '参数类型不匹配!左边类型:$1,右边类型:$2。',
|
|
70
|
-
transforms: [transformType, transformType],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
re: /^Type '(.+?)' is missing the following properties from type '(.+?)'/,
|
|
74
|
-
result: '类型不匹配!左边类型:$1,右边类型:$2。',
|
|
75
|
-
transforms: [transformType, transformType],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
re: /^Expression expected\.$/,
|
|
79
|
-
result: '表达式不能为空。',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
re: /^Cannot find name '__(?:IDENTIFIER|LEFT|RIGHT)__'\.$/,
|
|
83
|
-
result: '表达式不能为空。',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
re: /^Cannot find name '__(?:QueryFieldExpression)__'\.$/,
|
|
87
|
-
result: '实体字段不能为空。',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
re: /^Cannot find name '__(?:WHERE_MULTIPLE_CONDITION)__'\.$/,
|
|
91
|
-
result: '筛选条件不能有多个表达式。',
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
re: /^Cannot find name '__(?:HAVING_MULTIPLE_CONDITION)__'\.$/,
|
|
95
|
-
result: '聚合属性过滤不能有多个表达式。',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
re: /^Cannot find name '__(?:EMPTY_AGGREGATE_NAME)__'\.$/,
|
|
99
|
-
result: '聚合函数名称不能为空。',
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
re: /^Cannot find name '__(?:EMPTY_AGGREGATE_ALIAS)__'\.$/,
|
|
103
|
-
result: '聚合函数别名不能为空。',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
re: /^'(.+?)' is declared but its value is never read\.$/,
|
|
107
|
-
result: "已添加'$1',但从来没有使用过。",
|
|
108
|
-
transforms: [transformType, transformType],
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
re: /'(.+?)' has no exported member(?: named)? '(.+?)'/,
|
|
112
|
-
result: "找不到数据结构 '$2'。",
|
|
113
|
-
transforms: [transformType, transformNamespace],
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
re: /^Unreachable code detected\.$/,
|
|
117
|
-
result: '逻辑中有未使用的。',
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
re: /Property '__slice' does not exist on type '(.+?)'./,
|
|
121
|
-
result: 'For Each:循环列表:参数类型不匹配!所需类型:基础类型>字符串、数组、集合等,提供类型:$1',
|
|
122
|
-
transforms: [transformType],
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
re: /Property '(.+?)' does not exist on type 'typeof logics'./,
|
|
126
|
-
result: '当前逻辑$1未找到',
|
|
127
|
-
transforms: [outOriginalvalue],
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
re: /Property '(.+?)' does not exist on type 'typeof (.+?)'./,
|
|
131
|
-
result: '$2上找不到$1',
|
|
132
|
-
transforms: [transformMethod, transformType],
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
re: /Property '(.+?)' does not exist on type '(.+?)'./,
|
|
136
|
-
result: '$2上找不到$1',
|
|
137
|
-
transforms: [transformMethod, transformType],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
re: /Cannot find name '(.+?)'. Did you mean '(.+?)'\?/,
|
|
141
|
-
result: '没有$1,您可以换成$2',
|
|
142
|
-
transforms: [outOriginalvalue, outOriginalvalue],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
re: /Expected (.+?) arguments, but got (.+?)./,
|
|
146
|
-
result: '预期$1个参数,但得到$2个',
|
|
147
|
-
transforms: [outOriginalvalue, outOriginalvalue],
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
re: /The (.+?)-hand side of an arithmetic operation must be of type (.+?). type./,
|
|
151
|
-
result: '表达式错误',
|
|
152
|
-
transforms: [outOriginalvalue, outOriginalvalue],
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
re: /Operator '(.+?)' cannot be applied to types '(.+?)' and '(.+?)'./,
|
|
156
|
-
result: '符号$1左右类型不同,左侧$2,右侧$3',
|
|
157
|
-
transforms: [outOriginalvalue, transformType, transformType],
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
re: /Object is possibly 'undefined'./,
|
|
161
|
-
result: '所选择的内容未定义',
|
|
162
|
-
},
|
|
163
|
-
];
|
|
164
|
-
|
|
165
|
-
for (const rule of translateRules) {
|
|
333
|
+
for (const rule of TS_RULES) {
|
|
166
334
|
const cap = rule.re.exec(message);
|
|
167
335
|
if (cap) {
|
|
168
336
|
return rule.result.replace(/\$(\d+)/g, (m, index) => rule.transforms[index - 1](cap[index]));
|
|
@@ -170,3 +338,132 @@ export function translateDiagnosticMessage(message: string) {
|
|
|
170
338
|
}
|
|
171
339
|
return message;
|
|
172
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* 节点和ts 报错结合,转成更精准的ts报错
|
|
343
|
+
* @param minRange
|
|
344
|
+
* @param tsErrorDetail 报错具体信息
|
|
345
|
+
* @returns
|
|
346
|
+
*/
|
|
347
|
+
export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diagnostic) {
|
|
348
|
+
const text = tsErrorDetail.originalDiagnostic.text;
|
|
349
|
+
let node = minRange.node;
|
|
350
|
+
// 有一些节点报错信息不向外暴露,缺失一些原生标签等等的展示
|
|
351
|
+
if (node instanceof View || node instanceof ViewElement) {
|
|
352
|
+
if (text.startsWith(`'nasl.ui' has no exported member named `)) {
|
|
353
|
+
return null;
|
|
354
|
+
} else if (text.startsWith(`Property '`) && text.includes(`does not exist on type 'typeof ui'.`)) {
|
|
355
|
+
return null;
|
|
356
|
+
} else if (text.startsWith(`Namespace 'nasl.ui' has no exported member `)) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// 处理bindevent参数没传递的报错
|
|
361
|
+
if (/Expected (.+?) arguments, but got (.+?)./.exec(text)) {
|
|
362
|
+
// bindevent本身现在就不传参数
|
|
363
|
+
if (node instanceof BindEvent) {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// 因为缺少参数时候有可能有特殊情况,因为原本少的多了就会找到 callLogic上,
|
|
369
|
+
// 但是只少一个的时候就会找到准确的Argument上 需要特殊处理, ui层就可以统一处理
|
|
370
|
+
if (/Expected (.+?) arguments, but got (.+?)./.exec(text) && node.getAncestor('CallLogic')) {
|
|
371
|
+
node = node.getAncestor('CallLogic');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (node instanceof Argument) {
|
|
375
|
+
// if (/Type '(.+?)' is not assignable to type '(.+?)'./.exec(text)) {
|
|
376
|
+
// }
|
|
377
|
+
// Argument在callInterface上的报错放到内部
|
|
378
|
+
if (node.expression) {
|
|
379
|
+
node = node.expression;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// 处理一些复制过来的内容 Identifier或者MemberExpression内容缺失,错误要像上冒
|
|
384
|
+
if (node instanceof Identifier || node instanceof MemberExpression) {
|
|
385
|
+
if (node.parentNode instanceof MemberExpression) {
|
|
386
|
+
let parentNode: BaseNode = node;
|
|
387
|
+
while (parentNode && parentNode.parentNode instanceof MemberExpression) {
|
|
388
|
+
parentNode = parentNode.parentNode;
|
|
389
|
+
}
|
|
390
|
+
node = parentNode || node;
|
|
391
|
+
|
|
392
|
+
let str = tsErrorDetail.message;
|
|
393
|
+
str = (node as any).constructor.nodeTitle + ':' + str;
|
|
394
|
+
tsErrorDetail.message = str;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// 类型报错的,需要放到上一级
|
|
399
|
+
if (/'(.+?)' has no exported member(?: named)? '(.+?)'/.exec(text) || /Property '(.+?)' does not exist on type '(.+?)'./.exec(text)) {
|
|
400
|
+
if (node instanceof TypeAnnotation) {
|
|
401
|
+
// 变量type的报错放到内部
|
|
402
|
+
node = node.parentNode;
|
|
403
|
+
let str = tsErrorDetail.message;
|
|
404
|
+
if (node) {
|
|
405
|
+
str = (node as any).constructor.nodeTitle + ':' + str;
|
|
406
|
+
}
|
|
407
|
+
tsErrorDetail.message = str;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* 所有问题的报错处理具体信息
|
|
413
|
+
* 转成一个最合理的文案
|
|
414
|
+
*/
|
|
415
|
+
if (/^Cannot find name '__(?:IDENTIFIER|LEFT|RIGHT)__'\.$/.exec(text)) {
|
|
416
|
+
if (node instanceof IfStatement || node instanceof SwitchCase || node instanceof WhileStatement) {
|
|
417
|
+
tsErrorDetail.message = (node as any).constructor.nodeTitle + ':参数不能为空!所需类型:基础类型>布尔值';
|
|
418
|
+
} else if (node instanceof ForEachStatement) {
|
|
419
|
+
tsErrorDetail.message = 'ForEach:结束值:不能为空!所需类型:基础类型>整数';
|
|
420
|
+
} else if (node instanceof UnaryExpression) {
|
|
421
|
+
tsErrorDetail.message = '!:参数不能为空!';
|
|
422
|
+
} else if (node instanceof Assignment) {
|
|
423
|
+
tsErrorDetail.message = '赋值:参数不能为空!';
|
|
424
|
+
} else if ((node instanceof Argument && node.parentNode instanceof CallInterface) || node instanceof CallInterface) {
|
|
425
|
+
tsErrorDetail.message = '调用接口:参数不能为空!';
|
|
426
|
+
} else if ((node instanceof Argument && node.parentNode instanceof CallFunction) || node instanceof CallFunction) {
|
|
427
|
+
tsErrorDetail.message = '调用函数:参数不能为空!';
|
|
428
|
+
} else if ((node instanceof Argument && node.parentNode instanceof CallLogic) || node instanceof CallLogic) {
|
|
429
|
+
tsErrorDetail.message = '调用逻辑:参数不能为空!';
|
|
430
|
+
} else if (node instanceof ProcessOutcome) {
|
|
431
|
+
tsErrorDetail.message = (node as any).constructor.nodeTitle + ':不能为空!';
|
|
432
|
+
} else if (node instanceof Argument || node instanceof TypeAnnotation) {
|
|
433
|
+
let str = tsErrorDetail.message;
|
|
434
|
+
str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
|
|
435
|
+
tsErrorDetail.message = str;
|
|
436
|
+
} else if (node instanceof Identifier) {
|
|
437
|
+
// 根据父级内容推断当前缺少啥
|
|
438
|
+
const identifierToString = (node: Identifier) => {
|
|
439
|
+
let str = tsErrorDetail.message;
|
|
440
|
+
if (node.parentNode instanceof Assignment) {
|
|
441
|
+
str = '赋值:参数不能为空!';
|
|
442
|
+
} else if (node.parentNode instanceof Argument && node.parentNode.parentNode instanceof CallLogic) {
|
|
443
|
+
str = '调用逻辑:参数不能为空!';
|
|
444
|
+
} else {
|
|
445
|
+
str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
|
|
446
|
+
tsErrorDetail.message = str;
|
|
447
|
+
}
|
|
448
|
+
return str;
|
|
449
|
+
};
|
|
450
|
+
tsErrorDetail.message = identifierToString(node);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// 左右类型不一致的,把上级信息带上
|
|
454
|
+
if (/^Type '(.+?)' is not assignable to type '(.+?)'\./.exec(text) || /^This condition will always return '(.+?)' since the types '(.+?)' and '(.+?)' have no overlap./.exec(text)) {
|
|
455
|
+
let str = tsErrorDetail.message;
|
|
456
|
+
str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
|
|
457
|
+
tsErrorDetail.message = str;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
for (const rule of POST_RULES) {
|
|
461
|
+
if (rule.re.test(tsErrorDetail.message))
|
|
462
|
+
tsErrorDetail.message = tsErrorDetail.message.replace(rule.re, rule.result);
|
|
463
|
+
}
|
|
464
|
+
node.tsErrorDetail = tsErrorDetail;
|
|
465
|
+
return {
|
|
466
|
+
node,
|
|
467
|
+
...tsErrorDetail,
|
|
468
|
+
};
|
|
469
|
+
}
|