@lcap/nasl 2.19.0-beta.1 → 2.19.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/out/automate/engine/index.d.ts +2 -2
- package/out/automate/engine/index.js +6 -7
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/operators.d.ts +2 -2
- package/out/automate/engine/operators.js +14 -5
- package/out/automate/engine/operators.js.map +1 -1
- package/out/automate/engine/uniqueName.d.ts +2 -2
- package/out/automate/engine/uniqueName.js +5 -5
- package/out/automate/engine/uniqueName.js.map +1 -1
- package/out/automate/engine/utils.js +4 -1
- package/out/automate/engine/utils.js.map +1 -1
- package/out/automate/template/myProcess.d.ts +1 -1
- package/out/automate/template/myProcess.js +9023 -9023
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/bak/translator.js +16 -24
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +12 -0
- package/out/common/BaseNode.js +88 -14
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/EventEmitter.d.ts +1 -0
- package/out/common/EventEmitter.js +3 -0
- package/out/common/EventEmitter.js.map +1 -1
- package/out/common/Messager.js +1 -0
- package/out/common/Messager.js.map +1 -1
- package/out/concepts/Abort__.d.ts +25 -0
- package/out/concepts/Abort__.js +80 -0
- package/out/concepts/Abort__.js.map +1 -0
- package/out/concepts/Anchor__.d.ts +1 -0
- package/out/concepts/Anchor__.js +3 -0
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +1 -0
- package/out/concepts/AnonymousFunction__.js +3 -0
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +99 -256
- package/out/concepts/App__.js +232 -405
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +1 -0
- package/out/concepts/Argument__.js +3 -0
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +1 -0
- package/out/concepts/Assignee__.js +3 -0
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +1 -0
- package/out/concepts/AssignmentLine__.js +3 -0
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +1 -0
- package/out/concepts/Assignment__.js +3 -0
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +10 -14
- package/out/concepts/Attribute__.js +15 -39
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +1 -0
- package/out/concepts/BatchAssignment__.js +6 -3
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +1 -0
- package/out/concepts/BinaryExpression__.js +3 -0
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +13 -0
- package/out/concepts/BindAttribute__.js +296 -38
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +13 -0
- package/out/concepts/BindDirective__.js +223 -15
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +6 -0
- package/out/concepts/BindEvent__.js +30 -22
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +13 -0
- package/out/concepts/BindStyle__.js +200 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +1 -0
- package/out/concepts/BooleanLiteral__.js +3 -0
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +1 -0
- package/out/concepts/CallFunction__.js +3 -0
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -0
- package/out/concepts/CallInterface__.js +51 -5
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +12 -0
- package/out/concepts/CallLogic__.js +141 -131
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +3 -0
- package/out/concepts/CallQueryComponent__.js +109 -38
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +1 -0
- package/out/concepts/Comment__.js +3 -0
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.d.ts +2 -0
- package/out/concepts/CompletionProperty__.js +4 -0
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +2 -0
- package/out/concepts/ConfigGroup__.js +16 -0
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.d.ts +1 -0
- package/out/concepts/ConfigPropertyValue__.js +3 -0
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +24 -0
- package/out/concepts/ConfigProperty__.js +83 -0
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +2 -0
- package/out/concepts/Configuration__.js +16 -0
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +6 -0
- package/out/concepts/Constant__.js +9 -0
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.d.ts +1 -0
- package/out/concepts/DataElement__.js +3 -0
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +3 -0
- package/out/concepts/DataSource__.js +20 -5
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +31 -0
- package/out/concepts/DatabaseTypeAnnotation__.js +78 -0
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -0
- package/out/concepts/Destination__.d.ts +3 -0
- package/out/concepts/Destination__.js +98 -16
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.d.ts +1 -0
- package/out/concepts/End__.js +4 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -0
- package/out/concepts/EntityIndex__.js +3 -0
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +34 -5
- package/out/concepts/EntityProperty__.js +197 -56
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +3 -1
- package/out/concepts/Entity__.js +33 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +6 -5
- package/out/concepts/EnumItem__.js +9 -6
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +21 -19
- package/out/concepts/Enum__.js +31 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.d.ts +1 -0
- package/out/concepts/Event__.js +3 -0
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +2 -0
- package/out/concepts/ExternalDestination__.js +25 -4
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +1 -0
- package/out/concepts/ForEachStatement__.js +4 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +213 -0
- package/out/concepts/FrontendLibrary__.js +352 -0
- package/out/concepts/FrontendLibrary__.js.map +1 -0
- package/out/concepts/Frontend__.d.ts +373 -0
- package/out/concepts/Frontend__.js +685 -0
- package/out/concepts/Frontend__.js.map +1 -0
- package/out/concepts/Function__.d.ts +1 -0
- package/out/concepts/Function__.js +3 -0
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +1 -0
- package/out/concepts/Identifier__.js +26 -5
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +1 -0
- package/out/concepts/IfStatement__.js +5 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.d.ts +53 -0
- package/out/concepts/Integration__.js +143 -0
- package/out/concepts/Integration__.js.map +1 -0
- package/out/concepts/InterfaceParam__.d.ts +1 -3
- package/out/concepts/InterfaceParam__.js +3 -56
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +14 -0
- package/out/concepts/Interface__.js +87 -0
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +1 -0
- package/out/concepts/JSBlock__.js +8 -1
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +42 -0
- package/out/concepts/JavaLogic__.js +122 -0
- package/out/concepts/JavaLogic__.js.map +1 -0
- package/out/concepts/LogicItem__.d.ts +7 -1
- package/out/concepts/LogicItem__.js +11 -0
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +7 -0
- package/out/concepts/Logic__.js +74 -17
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +1 -0
- package/out/concepts/MatchCase__.js +4 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +6 -3
- package/out/concepts/Match__.js +116 -20
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -0
- package/out/concepts/MemberExpression__.js +14 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MicroApp__.d.ts +51 -0
- package/out/concepts/MicroApp__.js +113 -0
- package/out/concepts/MicroApp__.js.map +1 -0
- package/out/concepts/Module__.d.ts +96 -56
- package/out/concepts/Module__.js +169 -58
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +1 -0
- package/out/concepts/Namespace__.js +3 -0
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +4 -4
- package/out/concepts/NewComposite__.js +139 -122
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +2 -0
- package/out/concepts/NewList__.js +49 -24
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +2 -0
- package/out/concepts/NewMap__.js +53 -23
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.d.ts +1 -0
- package/out/concepts/New__.js +3 -0
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +1 -0
- package/out/concepts/NullLiteral__.js +3 -0
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +1 -0
- package/out/concepts/NumericLiteral__.js +6 -9
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +1 -1
- package/out/concepts/OqlQueryComponent__.js +43 -58
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +7 -3
- package/out/concepts/Param__.js +17 -60
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.d.ts +1 -0
- package/out/concepts/Point__.js +3 -0
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.d.ts +1 -0
- package/out/concepts/ProcessComponent__.js +3 -0
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +1 -0
- package/out/concepts/ProcessElement__.js +16 -4
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +1 -0
- package/out/concepts/ProcessOutcome__.js +3 -0
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +1 -0
- package/out/concepts/ProcessOutcomes__.js +3 -0
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +5 -20
- package/out/concepts/Process__.js +4 -7
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +1 -0
- package/out/concepts/QueryAggregateExpression__.js +3 -0
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +1 -0
- package/out/concepts/QueryFieldExpression__.js +7 -1
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +1 -0
- package/out/concepts/QueryFromExpression__.js +3 -0
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +1 -0
- package/out/concepts/QueryGroupByExpression__.js +3 -0
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +1 -0
- package/out/concepts/QueryJoinExpression__.js +3 -0
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +1 -0
- package/out/concepts/QueryLimitExpression__.js +3 -0
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +1 -0
- package/out/concepts/QueryOrderByExpression__.js +3 -0
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.d.ts +105 -16
- package/out/concepts/QuerySelectExpression__.js +102 -9
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.d.ts +1 -0
- package/out/concepts/Rect__.js +3 -0
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +6 -3
- package/out/concepts/Return__.js +13 -59
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +1 -0
- package/out/concepts/Role__.js +3 -0
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +1 -0
- package/out/concepts/SelectMembers__.js +3 -0
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.d.ts +17 -0
- package/out/concepts/Slot__.js +46 -0
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +1 -1
- package/out/concepts/SqlQueryComponent__.js +3 -46
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.d.ts +1 -0
- package/out/concepts/Start__.js +3 -0
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +1 -0
- package/out/concepts/StringInterpolation__.js +6 -1
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -0
- package/out/concepts/StringLiteral__.js +9 -6
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +9 -3
- package/out/concepts/StructureProperty__.js +21 -57
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -0
- package/out/concepts/Structure__.js +3 -0
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +1 -0
- package/out/concepts/SwitchCase__.js +5 -2
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +1 -0
- package/out/concepts/SwitchStatement__.js +3 -0
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.d.ts +1 -0
- package/out/concepts/Theme__.js +3 -0
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +6 -0
- package/out/concepts/Transactional__.js +9 -0
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +9 -3
- package/out/concepts/TypeAnnotation__.js +96 -10
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -0
- package/out/concepts/TypeParam__.js +3 -0
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +1 -0
- package/out/concepts/UnaryExpression__.js +3 -0
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +1 -0
- package/out/concepts/Unparsed__.js +3 -0
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.d.ts +1 -0
- package/out/concepts/UseComponent__.js +3 -0
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +2 -0
- package/out/concepts/ValidationRule__.js +56 -0
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +6 -3
- package/out/concepts/Variable__.js +14 -60
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.d.ts +35 -0
- package/out/concepts/ViewBlock__.js +85 -0
- package/out/concepts/ViewBlock__.js.map +1 -0
- package/out/concepts/ViewComponent__.d.ts +93 -0
- package/out/concepts/ViewComponent__.js +114 -0
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +8 -0
- package/out/concepts/ViewElement__.js +66 -10
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +9 -3
- package/out/concepts/View__.js +64 -16
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +1 -0
- package/out/concepts/WhileStatement__.js +3 -0
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.collection.js +7 -2
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
- package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
- package/out/concepts/basics/stdlib/nasl.core.js +34 -0
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.js +6 -6
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +71 -43
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +146 -21
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +13 -13
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +1 -5
- 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 +8 -0
- package/out/concepts/index__.js +8 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/decorators/index.js +3 -3
- package/out/decorators/index.js.map +1 -1
- package/out/enums/KEYWORDS.d.ts +1 -0
- package/out/enums/KEYWORDS.js +16 -1
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +6 -3
- package/out/generator/genBundleFiles.js +66 -48
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.d.ts +2 -2
- package/out/generator/genMetaData.js +3 -3
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +19 -4
- package/out/generator/genReleaseBody.js +147 -54
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/icestark.d.ts +2 -0
- package/out/generator/icestark.js +48 -0
- package/out/generator/icestark.js.map +1 -0
- package/out/generator/microApp.d.ts +2 -0
- package/out/generator/microApp.js +35 -0
- package/out/generator/microApp.js.map +1 -0
- package/out/generator/permission.d.ts +1 -0
- package/out/generator/permission.js +24 -29
- package/out/generator/permission.js.map +1 -1
- package/out/generator/qiankun.d.ts +2 -0
- package/out/generator/qiankun.js +52 -0
- package/out/generator/qiankun.js.map +1 -0
- package/out/index.d.ts +2 -1
- package/out/index.js +4 -1
- package/out/index.js.map +1 -1
- package/out/manager/stepRecorder.d.ts +20 -0
- package/out/manager/stepRecorder.js +110 -0
- package/out/manager/stepRecorder.js.map +1 -0
- package/out/sentry/index.d.ts +29 -0
- package/out/sentry/index.js +111 -0
- package/out/sentry/index.js.map +1 -0
- package/out/server/entity2LogicNamespace.js +3 -1
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +113 -2
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +2 -1
- package/out/server/formatTsUtils.js +163 -17
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.d.ts +2 -2
- package/out/server/getLogics.js +63 -17
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.d.ts +1 -0
- package/out/server/getMemberIdentifier.js +34 -6
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/index.js +1 -0
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +16 -4
- package/out/server/naslServer.js +1170 -181
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +114 -38
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.js +2 -0
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/creator/index.js +2 -0
- package/out/service/creator/index.js.map +1 -1
- package/out/service/storage/api.d.ts +27 -0
- package/out/service/storage/api.js +19 -0
- package/out/service/storage/api.js.map +1 -1
- package/out/service/storage/init.d.ts +44 -1
- package/out/service/storage/init.js +262 -37
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/service.d.ts +12 -1
- package/out/service/storage/service.js +32 -1
- package/out/service/storage/service.js.map +1 -1
- package/out/templator/genCallComponentLogic.d.ts +1 -1
- package/out/templator/genCallComponentLogic.js.map +1 -1
- package/out/templator/genCreateBlock.js +7 -4
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.d.ts +7 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +122 -8
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +6 -8
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +48 -20
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -1
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +2 -2
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +7 -1
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +23 -9
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.d.ts +12 -1
- package/out/templator/genSelectBlock.js +273 -2
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +4 -4
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +9 -4
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +19 -33
- package/out/templator/utils.js +11 -8
- package/out/templator/utils.js.map +1 -1
- package/out/translator/index.js +4 -1
- package/out/translator/index.js.map +1 -1
- package/out/utils/traverse.js +8 -2
- package/out/utils/traverse.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.core.ts +2 -0
- package/sandbox/stdlib/nasl.util.ts +2 -1
- package/src/concepts/BatchAssignment__.ts +1 -1
- package/src/concepts/CallLogic__.ts +2 -64
- package/src/concepts/NewComposite__.ts +5 -7
- package/src/concepts/NewList__.ts +2 -1
- package/src/concepts/NewMap__.ts +2 -1
- package/src/concepts/OqlQueryComponent__.ts +2 -0
- package/src/concepts/ViewElement__.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
- package/src/generator/genBundleFiles.ts +10 -1
- package/src/server/naslServer.ts +12 -9
- package/src/server/translator.ts +33 -6
- package/ts-worker/lib/tsserver.js +4 -1
- package/sandbox/stdlib/dist/nasl.logging.js +0 -0
- package/sandbox/stdlib/dist/nasl.util.js +0 -0
- package/src/automate/engine/dist/index.dev.js +0 -517
- package/src/common/dist/BaseNode.js +0 -1101
- package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1602
- package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
- package/src/concepts/dist/BindAttribute__.js +0 -760
- package/src/concepts/dist/BindEvent__.js +0 -732
- package/src/concepts/dist/CallFunction__.js +0 -527
- package/src/concepts/dist/CallLogic__.js +0 -932
- package/src/concepts/dist/Identifier__.js +0 -311
- package/src/concepts/dist/StringInterpolation__.js +0 -231
- package/src/concepts/dist/TypeAnnotation__.js +0 -834
- package/src/concepts/dist/ViewElement__.js +0 -1692
- package/src/concepts/dist/View__.js +0 -1601
- package/src/generator/dist/genBundleFiles.js +0 -261
- package/src/generator/dist/genMetaData.js +0 -245
- package/src/generator/dist/permission.js +0 -392
- package/src/server/dist/naslServer.js +0 -3590
- package/src/service/storage/dist/init.js +0 -579
- package/src/templator/dist/genEditTableBlock.js +0 -204
- package/src/templator/dist/genGridViewBlock.js +0 -265
- package/src/templator/dist/genListViewBlock.js +0 -84
- package/src/templator/dist/genTableBlock.js +0 -209
- package/src/templator/dist/utils.js +0 -527
- package/ts-worker/dist/webpack.config.dev.js +0 -106
- /package/src/service/{dataSource → datasource}/api.js +0 -0
- /package/src/service/{dataSource → datasource}/index.js +0 -0
package/out/server/naslServer.js
CHANGED
|
@@ -33,6 +33,7 @@ const path = __importStar(require("path"));
|
|
|
33
33
|
const worker_threads_1 = require("worker_threads");
|
|
34
34
|
/// #endif
|
|
35
35
|
const config_1 = require("../config");
|
|
36
|
+
const sentry_1 = require("../sentry");
|
|
36
37
|
const Messager_1 = __importDefault(require("../common/Messager"));
|
|
37
38
|
const getMemberIdentifier_1 = require("../server/getMemberIdentifier");
|
|
38
39
|
const concepts_1 = require("../concepts");
|
|
@@ -44,24 +45,30 @@ const diagnostic_1 = require("../manager/diagnostic");
|
|
|
44
45
|
const createUiTs_1 = __importDefault(require("./createUiTs"));
|
|
45
46
|
const coreTypeList_1 = require("../concepts/basics/types/coreTypeList");
|
|
46
47
|
const formatTsUtils_1 = require("./formatTsUtils");
|
|
48
|
+
const utils = __importStar(require("../utils"));
|
|
47
49
|
const naslStdlibMap_1 = __importDefault(require("./naslStdlibMap"));
|
|
48
50
|
const jsoner = __importStar(require("../service/storage/jsoner"));
|
|
49
51
|
const EventEmitter_1 = require("../common/EventEmitter");
|
|
52
|
+
const utils_1 = require("../utils");
|
|
53
|
+
const decimal_js_1 = require("decimal.js");
|
|
50
54
|
const EmbeddedTSFileLineMap = {
|
|
51
55
|
Entity: 3,
|
|
52
56
|
};
|
|
53
57
|
const EmbeddedTSFileOffsetMap = {
|
|
54
58
|
Variable: 12,
|
|
59
|
+
ConfigProperty: 12,
|
|
55
60
|
};
|
|
56
|
-
|
|
57
|
-
const filesToCheck = new Set();
|
|
58
|
-
// 单个文件正在change,不允许同时两个文件一起change
|
|
59
|
-
let singleFileChangeIng = false;
|
|
61
|
+
const SentryMessager = (0, sentry_1.sentryMonitorTSWorkerMessager)(Messager_1.default);
|
|
60
62
|
let isChangeInterface = false; //判断是否导入接口
|
|
61
63
|
let actionArr = []; //用于导入接口收集更改的节点
|
|
62
64
|
let timer = null; //超时器用于收集导入接口相关
|
|
63
65
|
// 联合类型切割取出类型
|
|
64
66
|
function getDisplayString2Type(displayString) {
|
|
67
|
+
const targetString = displayString.match(/value:\s(\S+)\)/)[1];
|
|
68
|
+
let targetType = null;
|
|
69
|
+
if (targetString.startsWith('nasl.core.')) {
|
|
70
|
+
targetType = targetString.slice(10);
|
|
71
|
+
}
|
|
65
72
|
// 取出匹配的内容
|
|
66
73
|
const reg = /<([^()]+)>/g;
|
|
67
74
|
// 解决extends 导致类型缺失的问题
|
|
@@ -86,6 +93,9 @@ function getDisplayString2Type(displayString) {
|
|
|
86
93
|
return item;
|
|
87
94
|
}
|
|
88
95
|
});
|
|
96
|
+
if (targetType) {
|
|
97
|
+
return typeList.filter((item) => item !== targetType);
|
|
98
|
+
}
|
|
89
99
|
return typeList;
|
|
90
100
|
}
|
|
91
101
|
exports.getDisplayString2Type = getDisplayString2Type;
|
|
@@ -104,6 +114,10 @@ class NaslServer {
|
|
|
104
114
|
embeddedTSEmitter = undefined;
|
|
105
115
|
// 需要执行修改的文件
|
|
106
116
|
changeStackList = [];
|
|
117
|
+
filesToCheck;
|
|
118
|
+
singleFileChangeIng;
|
|
119
|
+
// 包含组件逻辑调用的逻辑map
|
|
120
|
+
logicSetWithComponentLogic = new Set();
|
|
107
121
|
constructor() {
|
|
108
122
|
/// #if process.env.BUILD_TARGET === 'node'
|
|
109
123
|
if (globalThis.process) // For TS build
|
|
@@ -112,10 +126,15 @@ class NaslServer {
|
|
|
112
126
|
/// #endif
|
|
113
127
|
/// #if process.env.BUILD_TARGET !== 'node'
|
|
114
128
|
if (globalThis.window) // For TS build
|
|
129
|
+
/* !!!如果改动这里需要看下关联的对应文件:webpack/ts-worker/loader.js */
|
|
115
130
|
this.worker = new worker_threads_1.Worker('/ts-worker.js');
|
|
116
131
|
/// #endif
|
|
132
|
+
// 要Check的文件
|
|
133
|
+
this.filesToCheck = new Set();
|
|
134
|
+
// 单个文件正在change,不允许同时两个文件一起change
|
|
135
|
+
this.singleFileChangeIng = false;
|
|
117
136
|
this.diagnosticManager = new diagnostic_1.DiagnosticManager();
|
|
118
|
-
this.messager = new
|
|
137
|
+
this.messager = new SentryMessager({
|
|
119
138
|
protocol: 'ts-worker',
|
|
120
139
|
sender: 'ide',
|
|
121
140
|
context: this,
|
|
@@ -125,6 +144,12 @@ class NaslServer {
|
|
|
125
144
|
if (data && data.event === 'publishDiagnostics') {
|
|
126
145
|
const records = await this._resolveDiagnosticRecords(data.records);
|
|
127
146
|
this.diagnosticManager.pushAll(records);
|
|
147
|
+
try {
|
|
148
|
+
(0, common_1.invokeCommand)('naslServer:nodeChange');
|
|
149
|
+
}
|
|
150
|
+
catch (e) {
|
|
151
|
+
console.log('no "naslServer:nodeChange" event received');
|
|
152
|
+
}
|
|
128
153
|
}
|
|
129
154
|
},
|
|
130
155
|
});
|
|
@@ -148,12 +173,12 @@ class NaslServer {
|
|
|
148
173
|
const changeNode = changeEvent.target;
|
|
149
174
|
const { fileNode } = this.getCurrentSource(changeNode);
|
|
150
175
|
if (changeNode !== fileNode || !changeEvent.field) {
|
|
151
|
-
const
|
|
176
|
+
const findLastIndex = this.changeStackList.findLastIndex((changeStackItem) => {
|
|
152
177
|
const target = changeStackItem.target;
|
|
153
178
|
const { fileNode: targetFileNode } = this.getCurrentSource(target);
|
|
154
179
|
return targetFileNode === fileNode;
|
|
155
180
|
});
|
|
156
|
-
if (
|
|
181
|
+
if (findLastIndex === this.changeStackList.length - 1) {
|
|
157
182
|
this.changeStackList.pop();
|
|
158
183
|
}
|
|
159
184
|
}
|
|
@@ -194,6 +219,10 @@ class NaslServer {
|
|
|
194
219
|
await this.getDiagnosticRecordsAndPushAll();
|
|
195
220
|
}
|
|
196
221
|
contentToFile(module, results) {
|
|
222
|
+
// 禁用的依赖库不生成代码 区分 undefined 和 false
|
|
223
|
+
if (module instanceof concepts_1.Module && module.type === 'extension' && module.enable === false) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
197
226
|
module.structures.forEach((structure) => {
|
|
198
227
|
try {
|
|
199
228
|
const result = structure.toEmbeddedTSFile();
|
|
@@ -205,18 +234,53 @@ class NaslServer {
|
|
|
205
234
|
catch (err) {
|
|
206
235
|
}
|
|
207
236
|
});
|
|
208
|
-
module.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
237
|
+
if (module instanceof concepts_1.App) {
|
|
238
|
+
module.frontends?.forEach((frontend) => {
|
|
239
|
+
try {
|
|
240
|
+
const result = frontend.toEmbeddedTSFile();
|
|
241
|
+
results.push(result);
|
|
242
|
+
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
243
|
+
frontend.sourceMap = result.sourceMap;
|
|
244
|
+
this.file2NodeMap.set(result.filePath, frontend);
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
console.log(err);
|
|
248
|
+
}
|
|
249
|
+
frontend.variables?.forEach((frontendVariable) => {
|
|
250
|
+
try {
|
|
251
|
+
const result = frontendVariable.toEmbeddedTSFile();
|
|
252
|
+
results.push(result);
|
|
253
|
+
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
254
|
+
frontendVariable.sourceMap = result.sourceMap;
|
|
255
|
+
this.file2NodeMap.set(result.filePath, frontendVariable);
|
|
256
|
+
}
|
|
257
|
+
catch (err) {
|
|
258
|
+
console.log(err);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
// view的生成
|
|
262
|
+
if (!config_1.config.closeViews) {
|
|
263
|
+
this.view2TSFile(frontend.views, results);
|
|
264
|
+
}
|
|
265
|
+
frontend.componentDependencies?.forEach((item) => this.contentToFile(item, results));
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
module.frontends?.forEach((frontend) => {
|
|
270
|
+
try {
|
|
271
|
+
frontend.logics.forEach((logic) => {
|
|
272
|
+
const result = logic.toEmbeddedTSFile();
|
|
273
|
+
results.push(result);
|
|
274
|
+
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
275
|
+
logic.sourceMap = result.sourceMap;
|
|
276
|
+
this.file2NodeMap.set(result.filePath, logic);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
catch (err) {
|
|
280
|
+
console.log(err);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
220
284
|
module.dataSources?.forEach((dataSource) => {
|
|
221
285
|
// 本身dataSource也要生成一个文件用于改名
|
|
222
286
|
try {
|
|
@@ -274,10 +338,6 @@ class NaslServer {
|
|
|
274
338
|
catch (err) {
|
|
275
339
|
}
|
|
276
340
|
});
|
|
277
|
-
// view的生成
|
|
278
|
-
if (!config_1.config.closeViews) {
|
|
279
|
-
this.view2TSFile(module.views, results);
|
|
280
|
-
}
|
|
281
341
|
module.processes.forEach((process) => {
|
|
282
342
|
try {
|
|
283
343
|
const result = process.toEmbeddedTSFile();
|
|
@@ -301,6 +361,21 @@ class NaslServer {
|
|
|
301
361
|
}
|
|
302
362
|
});
|
|
303
363
|
}
|
|
364
|
+
module.configuration?.groups?.forEach((_group) => {
|
|
365
|
+
if (_group.name === 'custom') {
|
|
366
|
+
_group.properties.forEach((_property) => {
|
|
367
|
+
try {
|
|
368
|
+
const result = _property.toEmbeddedTSFile();
|
|
369
|
+
results.push(result);
|
|
370
|
+
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
371
|
+
_property.sourceMap = result.sourceMap;
|
|
372
|
+
this.file2NodeMap.set(result.filePath, _property);
|
|
373
|
+
}
|
|
374
|
+
catch (err) {
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
});
|
|
304
379
|
}
|
|
305
380
|
view2TSFile(viewsChildren, results) {
|
|
306
381
|
// 如果有子页面
|
|
@@ -328,7 +403,6 @@ class NaslServer {
|
|
|
328
403
|
// 其他模块的创建内容
|
|
329
404
|
app.dependencies.forEach((item) => this.contentToFile(item, results));
|
|
330
405
|
app.interfaceDependencies.forEach((item) => this.contentToFile(item, results));
|
|
331
|
-
app.componentDependencies.forEach((item) => this.contentToFile(item, results));
|
|
332
406
|
}
|
|
333
407
|
catch (err) {
|
|
334
408
|
console.log(err);
|
|
@@ -358,8 +432,7 @@ class NaslServer {
|
|
|
358
432
|
await this.openApp(app);
|
|
359
433
|
// 重新check一遍所有内容
|
|
360
434
|
await this.getDiagnosticRecordsAndPushAll();
|
|
361
|
-
//
|
|
362
|
-
await this.createdNaslAnnotatedJSON(app);
|
|
435
|
+
// check内容后,会自动走增量类型标注完善全部类型
|
|
363
436
|
}
|
|
364
437
|
/**
|
|
365
438
|
* 初始化之前添加文件
|
|
@@ -464,6 +537,9 @@ class NaslServer {
|
|
|
464
537
|
* fileNode
|
|
465
538
|
*/
|
|
466
539
|
const { currentSource, fileNode } = this.getCurrentSource(callFunction);
|
|
540
|
+
if (!currentSource) {
|
|
541
|
+
return [];
|
|
542
|
+
}
|
|
467
543
|
try {
|
|
468
544
|
const quickInfo = await this._getTypeQuickinfo({
|
|
469
545
|
file: fileNode.getEmbeddedFilePath(),
|
|
@@ -503,8 +579,8 @@ class NaslServer {
|
|
|
503
579
|
}
|
|
504
580
|
}
|
|
505
581
|
/**
|
|
506
|
-
*
|
|
507
|
-
* @param node
|
|
582
|
+
* 获取表格的dataschema类型
|
|
583
|
+
* @param node 当前表格节点
|
|
508
584
|
* @param allType 是不是需要全部类型 默认不要
|
|
509
585
|
* @returns 全部类型的str 或者 最后一个.后的内容
|
|
510
586
|
*/
|
|
@@ -512,6 +588,9 @@ class NaslServer {
|
|
|
512
588
|
if (!(node instanceof concepts_1.ViewElement))
|
|
513
589
|
return;
|
|
514
590
|
const { currentSource, fileNode } = this.getCurrentSource(node);
|
|
591
|
+
if (!currentSource) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
515
594
|
const quickInfo = await this._getTypeQuickinfo({
|
|
516
595
|
file: fileNode.getEmbeddedFilePath(),
|
|
517
596
|
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
@@ -570,6 +649,9 @@ class NaslServer {
|
|
|
570
649
|
if (!(node instanceof concepts_1.ViewElement))
|
|
571
650
|
return;
|
|
572
651
|
const { currentSource, fileNode } = this.getCurrentSource(node);
|
|
652
|
+
if (!currentSource) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
573
655
|
const quickInfo = await this._getTypeQuickinfo({
|
|
574
656
|
file: fileNode.getEmbeddedFilePath(),
|
|
575
657
|
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
@@ -684,6 +766,14 @@ class NaslServer {
|
|
|
684
766
|
const records = await this.getDiagnosticRecords(fileNames);
|
|
685
767
|
// diagnosticManager.pushAll(records);
|
|
686
768
|
}
|
|
769
|
+
/**
|
|
770
|
+
* 节点异常是只能挂载单个,如果已经了就不赋值了
|
|
771
|
+
*/
|
|
772
|
+
baseNodeAssignmentTsError(node, tsErrorDetail) {
|
|
773
|
+
if (node.tsErrorDetail)
|
|
774
|
+
return;
|
|
775
|
+
node.tsErrorDetail = tsErrorDetail;
|
|
776
|
+
}
|
|
687
777
|
/**
|
|
688
778
|
* 处理诊断结果
|
|
689
779
|
* @param records 结果
|
|
@@ -704,7 +794,7 @@ class NaslServer {
|
|
|
704
794
|
if (item.node) {
|
|
705
795
|
item.node.tsErrorDetail = undefined;
|
|
706
796
|
// 如果logic中有报错就把标识置为true
|
|
707
|
-
if (item.node
|
|
797
|
+
if (item.node?.logic?.haveError) {
|
|
708
798
|
item.node.logic.haveError = false;
|
|
709
799
|
}
|
|
710
800
|
}
|
|
@@ -737,6 +827,51 @@ class NaslServer {
|
|
|
737
827
|
.map((diag) => this._resolveDiagnostic(diag, node, record))
|
|
738
828
|
.filter((diag) => !!diag);
|
|
739
829
|
record.semanticDiagnostics.push(...this._attachDiagnostics(node));
|
|
830
|
+
// 报错降级逻辑
|
|
831
|
+
record.semanticDiagnostics = record.semanticDiagnostics
|
|
832
|
+
.map((diagnostic) => {
|
|
833
|
+
// 错误降级如果属于草稿态的就降级
|
|
834
|
+
if (diagnostic?.node) {
|
|
835
|
+
let currentNode = diagnostic.node;
|
|
836
|
+
if (diagnostic.severity === 'warning') {
|
|
837
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
838
|
+
return null;
|
|
839
|
+
}
|
|
840
|
+
else if (currentNode.concept === 'OqlQueryComponent') {
|
|
841
|
+
// OQL别名错误降级为警告
|
|
842
|
+
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
843
|
+
// 重置 图标和错误等级
|
|
844
|
+
diagnostic.severity = 'warning';
|
|
845
|
+
if (diagnostic.node?.tsErrorDetail) {
|
|
846
|
+
// 重置组件节点上的错误信息
|
|
847
|
+
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
848
|
+
}
|
|
849
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
while (currentNode?.parentNode?.concept !== 'App') {
|
|
854
|
+
if (currentNode.parentKey?.toLowerCase()?.includes('playground')) {
|
|
855
|
+
// 草稿区降级
|
|
856
|
+
// 重置 图标和错误等级
|
|
857
|
+
diagnostic.severity = 'warning';
|
|
858
|
+
if (diagnostic.node?.tsErrorDetail) {
|
|
859
|
+
// 重置组件节点上的错误信息
|
|
860
|
+
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
861
|
+
}
|
|
862
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
863
|
+
return null;
|
|
864
|
+
}
|
|
865
|
+
currentNode = currentNode.parentNode;
|
|
866
|
+
}
|
|
867
|
+
// 没有降级的继续遍历,如果在logic中,logic本身需要有error状态
|
|
868
|
+
// 如果logic中有报错就把标识置为true
|
|
869
|
+
if (diagnostic.node?.logic) {
|
|
870
|
+
diagnostic.node.logic.haveError = true;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return diagnostic;
|
|
874
|
+
}).filter((diag) => !!diag);
|
|
740
875
|
// 建议诊断
|
|
741
876
|
// 实体下的建议不用展示,因为都是平台自己写的逻辑
|
|
742
877
|
// if (node instanceof Entity) {
|
|
@@ -750,15 +885,71 @@ class NaslServer {
|
|
|
750
885
|
// // logic在for循环中,不展示any提示
|
|
751
886
|
// record.suggestionDiagnostics = record.suggestionDiagnostics.filter((item) => !item.text.includes(`implicitly has an 'any' type, but a better type may be inferred from usage.`));
|
|
752
887
|
// }
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
888
|
+
// 处理后的警告异常提示信息
|
|
889
|
+
record.suggestionDiagnostics = record.suggestionDiagnostics.map((diag) => {
|
|
890
|
+
// 上面错误降级下来的
|
|
891
|
+
if (diag?.node) {
|
|
892
|
+
return diag;
|
|
893
|
+
// 一些已知警告的单独处理
|
|
894
|
+
}
|
|
895
|
+
else if ([`'__LogicEmpty' is declared but its value is never read.`,
|
|
896
|
+
`'__destinationEmpty__' is declared but its value is never read.`,
|
|
897
|
+
`'__devConfigValueEmpty' is declared but its value is never read.`,
|
|
898
|
+
`'__onlineConfigValueEmpty' is declared but its value is never read.`,
|
|
899
|
+
`'__UpdateNoProperty__' is declared but its value is never read.`].includes(diag.text)) {
|
|
900
|
+
return this._resolveDiagnostic(diag, node, record);
|
|
901
|
+
}
|
|
902
|
+
else if ((diag.text).includes(` is declared but its value is never read.`)) {
|
|
903
|
+
// 局部变量和输入变量未使用的警告
|
|
904
|
+
if ((node.concept === 'View' || node.concept === 'Logic') && node.parentNode.concept !== 'Module') {
|
|
905
|
+
/**
|
|
906
|
+
* javalogic不用提示
|
|
907
|
+
*/
|
|
908
|
+
if (node.concept === 'Logic' && this._isJavalogic(node)) {
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
const minRange = this._findMinRange(diag, node);
|
|
912
|
+
if (minRange) {
|
|
913
|
+
/**
|
|
914
|
+
* 如果节点是入参类型
|
|
915
|
+
* 而且不是foreach中
|
|
916
|
+
* 而且不是事件逻辑的入参
|
|
917
|
+
*/
|
|
918
|
+
if (minRange.node instanceof concepts_1.Param && minRange.node.parentNode.concept !== 'ForEachStatement' && !minRange.node.getAncestor('BindEvent')) {
|
|
919
|
+
const diagnostic = {
|
|
920
|
+
node: minRange.node,
|
|
921
|
+
severity: 'warning',
|
|
922
|
+
message: `未使用的输入参数${minRange.node.name}`,
|
|
923
|
+
};
|
|
924
|
+
return diagnostic;
|
|
925
|
+
}
|
|
926
|
+
else if (minRange.node instanceof concepts_1.Variable) {
|
|
927
|
+
const diagnostic = {
|
|
928
|
+
node: minRange.node,
|
|
929
|
+
severity: 'warning',
|
|
930
|
+
message: `未使用的变量${minRange.node.name}`,
|
|
931
|
+
};
|
|
932
|
+
return diagnostic;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return null;
|
|
938
|
+
}).filter((diag) => !!diag);
|
|
758
939
|
record.suggestionDiagnostics.push(...this._attachSuggestionDiagnostics(node));
|
|
759
940
|
});
|
|
760
941
|
return records;
|
|
761
942
|
}
|
|
943
|
+
/**
|
|
944
|
+
* 判断是否是Javalogic
|
|
945
|
+
*/
|
|
946
|
+
_isJavalogic(node) {
|
|
947
|
+
const body = node.body || [];
|
|
948
|
+
if (body && body.length && body[0].concept === 'JavaLogic') {
|
|
949
|
+
return true;
|
|
950
|
+
}
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
762
953
|
/**
|
|
763
954
|
* 额外的建议诊断
|
|
764
955
|
* @param fileNode 文件级别的节点
|
|
@@ -767,24 +958,9 @@ class NaslServer {
|
|
|
767
958
|
_attachSuggestionDiagnostics(fileNode) {
|
|
768
959
|
const diagnostics = [];
|
|
769
960
|
if (fileNode instanceof concepts_1.Logic || fileNode instanceof concepts_1.View) {
|
|
770
|
-
// 判断逻辑是否已经删除
|
|
771
|
-
if (fileNode instanceof concepts_1.Logic && fileNode.parentNode instanceof concepts_1.App && !fileNode.parentNode.logics.includes(fileNode))
|
|
772
|
-
return diagnostics;
|
|
773
|
-
// 判断页面是否已经删除
|
|
774
|
-
let removed = false;
|
|
775
|
-
let curNode = fileNode;
|
|
776
|
-
// 递归检查,防止从顶层页面开始删除影响子页面内容检查
|
|
777
|
-
while (curNode instanceof concepts_1.View && !removed) {
|
|
778
|
-
if (curNode.parentNode instanceof concepts_1.View && !curNode.parentNode.children.includes(curNode)
|
|
779
|
-
|| curNode.parentNode instanceof concepts_1.App && !curNode.parentNode.views.includes(curNode)) {
|
|
780
|
-
removed = true;
|
|
781
|
-
}
|
|
782
|
-
curNode = curNode.parentNode;
|
|
783
|
-
}
|
|
784
|
-
if (removed)
|
|
785
|
-
return diagnostics;
|
|
786
961
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
787
|
-
|
|
962
|
+
// 表达式模式才需要校验返回值类型
|
|
963
|
+
if (node instanceof concepts_1.Match && node.isExpression) {
|
|
788
964
|
const { cases, expression } = node || {};
|
|
789
965
|
const typeAnnotationMap = {};
|
|
790
966
|
// 最多数的类型
|
|
@@ -898,8 +1074,8 @@ class NaslServer {
|
|
|
898
1074
|
if (Array.isArray(body) && body.length) {
|
|
899
1075
|
const lastExpression = body[body.length - 1];
|
|
900
1076
|
diagnostic.node = lastExpression;
|
|
901
|
-
diagnostic.message =
|
|
902
|
-
lastExpression
|
|
1077
|
+
diagnostic.message = `匹配:该分支类型与多数类型不一致,将产生Union类型。当前类型:${typeAnnotation?.headTitle},多数类型:${maxTypeAnnotation?.headTitle}`;
|
|
1078
|
+
this.baseNodeAssignmentTsError(lastExpression, diagnostic);
|
|
903
1079
|
diagnostics.push(diagnostic);
|
|
904
1080
|
}
|
|
905
1081
|
});
|
|
@@ -907,31 +1083,235 @@ class NaslServer {
|
|
|
907
1083
|
}
|
|
908
1084
|
}
|
|
909
1085
|
}
|
|
1086
|
+
else if (node instanceof concepts_1.NewList && !node.typeAnnotation) {
|
|
1087
|
+
// 匿名函数返回值有可能是newList,需要过滤。代码来源:AnonymousFunction.__ts
|
|
1088
|
+
const grandParent = node.parentNode?.parentNode?.parentNode;
|
|
1089
|
+
if (grandParent instanceof concepts_1.CallLogic
|
|
1090
|
+
&& /dataSources\.[^.]+\.entities\.[^.]+\.logics/.test(grandParent.calleeNamespace)
|
|
1091
|
+
&& ['update', 'updateBy', 'createOrUpdate', 'batchUpdate'].includes(grandParent.calleeName)) {
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
const { items } = node || {};
|
|
1095
|
+
const typeAnnotationMap = {};
|
|
1096
|
+
// 最多数的类型
|
|
1097
|
+
let maxTypeAnnotationInfo = {
|
|
1098
|
+
typeAnnotation: null,
|
|
1099
|
+
count: 0,
|
|
1100
|
+
};
|
|
1101
|
+
if (Array.isArray(items)) {
|
|
1102
|
+
items.forEach((item) => {
|
|
1103
|
+
const typeAnnotation = item.__TypeAnnotation;
|
|
1104
|
+
// 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
|
|
1105
|
+
if (typeAnnotation) {
|
|
1106
|
+
const sortedTypeKey = typeAnnotation.sortedTypeKey;
|
|
1107
|
+
if (!typeAnnotationMap[sortedTypeKey]) {
|
|
1108
|
+
typeAnnotationMap[sortedTypeKey] = {
|
|
1109
|
+
typeAnnotation,
|
|
1110
|
+
items: [],
|
|
1111
|
+
count: 0,
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
const typeAnnotationInfo = typeAnnotationMap[sortedTypeKey];
|
|
1115
|
+
typeAnnotationInfo.items.push(item);
|
|
1116
|
+
typeAnnotationInfo.count++;
|
|
1117
|
+
const { count } = typeAnnotationInfo;
|
|
1118
|
+
if (maxTypeAnnotationInfo.count < count) {
|
|
1119
|
+
maxTypeAnnotationInfo = {
|
|
1120
|
+
typeAnnotation,
|
|
1121
|
+
count,
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
const { typeAnnotation: maxTypeAnnotation, } = maxTypeAnnotationInfo;
|
|
1128
|
+
for (const sortedTypeKey in typeAnnotationMap) {
|
|
1129
|
+
const { typeAnnotation, items } = typeAnnotationMap[sortedTypeKey];
|
|
1130
|
+
if (maxTypeAnnotation?.sortedTypeKey !== typeAnnotation?.sortedTypeKey) {
|
|
1131
|
+
if (Array.isArray(items)) {
|
|
1132
|
+
items.forEach((item) => {
|
|
1133
|
+
const diagnostic = {
|
|
1134
|
+
node: item,
|
|
1135
|
+
severity: 'warning',
|
|
1136
|
+
message: `NewList期望的类型是${maxTypeAnnotation?.headTitle}`,
|
|
1137
|
+
};
|
|
1138
|
+
this.baseNodeAssignmentTsError(item, diagnostic);
|
|
1139
|
+
diagnostics.push(diagnostic);
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
else if (node instanceof concepts_1.NewMap && !node.typeAnnotation) {
|
|
1146
|
+
const { values } = node || {};
|
|
1147
|
+
const typeAnnotationMap = {};
|
|
1148
|
+
// 最多数的类型
|
|
1149
|
+
let maxTypeAnnotationInfo = {
|
|
1150
|
+
typeAnnotation: null,
|
|
1151
|
+
count: 0,
|
|
1152
|
+
};
|
|
1153
|
+
if (Array.isArray(values)) {
|
|
1154
|
+
values.forEach((value) => {
|
|
1155
|
+
if (!value)
|
|
1156
|
+
return;
|
|
1157
|
+
const typeAnnotation = value.__TypeAnnotation;
|
|
1158
|
+
// 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
|
|
1159
|
+
if (typeAnnotation) {
|
|
1160
|
+
const sortedTypeKey = typeAnnotation.sortedTypeKey;
|
|
1161
|
+
if (!typeAnnotationMap[sortedTypeKey]) {
|
|
1162
|
+
typeAnnotationMap[sortedTypeKey] = {
|
|
1163
|
+
typeAnnotation,
|
|
1164
|
+
values: [],
|
|
1165
|
+
count: 0,
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
const typeAnnotationInfo = typeAnnotationMap[sortedTypeKey];
|
|
1169
|
+
typeAnnotationInfo.values.push(value);
|
|
1170
|
+
typeAnnotationInfo.count++;
|
|
1171
|
+
const { count } = typeAnnotationInfo;
|
|
1172
|
+
if (maxTypeAnnotationInfo.count < count) {
|
|
1173
|
+
maxTypeAnnotationInfo = {
|
|
1174
|
+
typeAnnotation,
|
|
1175
|
+
count,
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
const { typeAnnotation: maxTypeAnnotation, } = maxTypeAnnotationInfo;
|
|
1182
|
+
for (const sortedTypeKey in typeAnnotationMap) {
|
|
1183
|
+
const { typeAnnotation, values } = typeAnnotationMap[sortedTypeKey];
|
|
1184
|
+
if (maxTypeAnnotation?.sortedTypeKey !== typeAnnotation?.sortedTypeKey) {
|
|
1185
|
+
if (Array.isArray(values)) {
|
|
1186
|
+
values.forEach((value) => {
|
|
1187
|
+
const diagnostic = {
|
|
1188
|
+
node: value,
|
|
1189
|
+
severity: 'warning',
|
|
1190
|
+
message: `NewMap中values值所期望的类型是${maxTypeAnnotation?.headTitle}`,
|
|
1191
|
+
};
|
|
1192
|
+
this.baseNodeAssignmentTsError(value, diagnostic);
|
|
1193
|
+
diagnostics.push(diagnostic);
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
else if (node.concept === 'JSBlock') {
|
|
1200
|
+
// 初始js代码块先屏蔽掉
|
|
1201
|
+
if (node.code === `location.href = '/';`) {
|
|
1202
|
+
return null;
|
|
1203
|
+
}
|
|
1204
|
+
const diagnostic = {
|
|
1205
|
+
node,
|
|
1206
|
+
severity: 'warning',
|
|
1207
|
+
message: '不建议使用js代码块',
|
|
1208
|
+
};
|
|
1209
|
+
diagnostics.push(diagnostic);
|
|
1210
|
+
}
|
|
1211
|
+
else if (node.concept === 'Unparsed') {
|
|
1212
|
+
const diagnostic = {
|
|
1213
|
+
node,
|
|
1214
|
+
severity: 'warning',
|
|
1215
|
+
message: '不建议使用自定义表达式',
|
|
1216
|
+
};
|
|
1217
|
+
diagnostics.push(diagnostic);
|
|
1218
|
+
}
|
|
1219
|
+
else if (node instanceof concepts_1.CallQueryComponent) {
|
|
1220
|
+
// 可视化查询中不允许有复杂的数据结构
|
|
1221
|
+
const contentVariables = [];
|
|
1222
|
+
utils.traverse(({ node }) => {
|
|
1223
|
+
if (node?.parentNode?.concept !== 'MemberExpression') {
|
|
1224
|
+
if (node?.concept === 'MemberExpression') {
|
|
1225
|
+
contentVariables.push(node);
|
|
1226
|
+
}
|
|
1227
|
+
else if (node?.concept === 'Identifier') {
|
|
1228
|
+
// 因为要是父级是MemberExpression, 就放入了父级,子级就不需要了
|
|
1229
|
+
contentVariables.push(node);
|
|
1230
|
+
// QueryFromExpression QueryJoinExpression
|
|
1231
|
+
}
|
|
1232
|
+
else if ((node?.concept === 'QueryFieldExpression' && !node.isDotStar) || node?.concept === 'QueryGroupByExpression') {
|
|
1233
|
+
contentVariables.push(node);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}, { node }, {
|
|
1237
|
+
mode: 'anyObject',
|
|
1238
|
+
excludedKeySet: new Set(['parentNode', '_events', 'globalDataMap', 'havingPlayground', 'wherePlayground']),
|
|
1239
|
+
});
|
|
1240
|
+
contentVariables?.forEach((variable) => {
|
|
1241
|
+
// 如果是复杂数据结构
|
|
1242
|
+
if (variable.__TypeAnnotation?.isComplexType()) {
|
|
1243
|
+
if (variable.__TypeAnnotation?.typeName === 'List' && variable.__TypeAnnotation?.typeArguments?.[0]?.typeKind === 'primitive') {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
const diagnostic = {
|
|
1247
|
+
node,
|
|
1248
|
+
severity: 'warning',
|
|
1249
|
+
message: `数据查询中不可以使用复杂类型!当前类型:${variable.__TypeAnnotation?.typeChineseTitle}。`,
|
|
1250
|
+
};
|
|
1251
|
+
this.baseNodeAssignmentTsError(variable, diagnostic);
|
|
1252
|
+
diagnostics.push(diagnostic);
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
910
1256
|
});
|
|
911
1257
|
}
|
|
912
1258
|
return diagnostics;
|
|
913
1259
|
}
|
|
1260
|
+
// 是否包含组件逻辑
|
|
1261
|
+
hasComponentLogics(expression) {
|
|
1262
|
+
let flag = false;
|
|
1263
|
+
(0, utils_1.traverse)((current) => {
|
|
1264
|
+
const { node } = current || {};
|
|
1265
|
+
const { concept } = node || {};
|
|
1266
|
+
if (concept === 'CallLogic') {
|
|
1267
|
+
// 调用组件逻辑
|
|
1268
|
+
if (node.isComponentLogic) {
|
|
1269
|
+
flag = true;
|
|
1270
|
+
}
|
|
1271
|
+
else if (node.isViewLogic) { // 调用页面逻辑
|
|
1272
|
+
const logicNode = node.view?.logics?.find?.((viewLogic) => viewLogic.name === node.calleeName);
|
|
1273
|
+
if (logicNode) {
|
|
1274
|
+
if (this.logicSetWithComponentLogic.has(logicNode.nodePath)) {
|
|
1275
|
+
flag = true;
|
|
1276
|
+
}
|
|
1277
|
+
else {
|
|
1278
|
+
const logicItem = logicNode.body?.find?.((logicItem) => this.hasComponentLogics(logicItem));
|
|
1279
|
+
if (logicItem) {
|
|
1280
|
+
flag = true;
|
|
1281
|
+
this.logicSetWithComponentLogic.add(logicNode.nodePath);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}, {
|
|
1288
|
+
node: expression,
|
|
1289
|
+
}, {
|
|
1290
|
+
mode: 'anyObject',
|
|
1291
|
+
excludedKeySet: new Set([
|
|
1292
|
+
'parentNode',
|
|
1293
|
+
'sourceMap',
|
|
1294
|
+
'storageJSON',
|
|
1295
|
+
'tsErrorDetail',
|
|
1296
|
+
'NaslAnnotatedJSON',
|
|
1297
|
+
'calledFrom',
|
|
1298
|
+
'_events',
|
|
1299
|
+
'_collectingList',
|
|
1300
|
+
'_historyList',
|
|
1301
|
+
]),
|
|
1302
|
+
});
|
|
1303
|
+
return flag;
|
|
1304
|
+
}
|
|
914
1305
|
/**
|
|
915
1306
|
* 额外的诊断
|
|
916
1307
|
* @param fileNode 文件级别的节点
|
|
917
1308
|
* @returns 诊断结果
|
|
918
1309
|
*/
|
|
919
1310
|
_attachDiagnostics(fileNode) {
|
|
1311
|
+
// 每次诊断前先清空这个Set
|
|
1312
|
+
this.logicSetWithComponentLogic = new Set();
|
|
920
1313
|
const diagnostics = [];
|
|
921
1314
|
if (fileNode instanceof concepts_1.View) {
|
|
922
|
-
// 判断页面是否已经删除
|
|
923
|
-
let removed = false;
|
|
924
|
-
let curNode = fileNode;
|
|
925
|
-
// 递归检查,防止从顶层页面开始删除影响子页面内容检查
|
|
926
|
-
while (curNode instanceof concepts_1.View && !removed) {
|
|
927
|
-
if (curNode.parentNode instanceof concepts_1.View && !curNode.parentNode.children.includes(curNode)
|
|
928
|
-
|| curNode.parentNode instanceof concepts_1.App && !curNode.parentNode.views.includes(curNode)) {
|
|
929
|
-
removed = true;
|
|
930
|
-
}
|
|
931
|
-
curNode = curNode.parentNode;
|
|
932
|
-
}
|
|
933
|
-
if (removed)
|
|
934
|
-
return diagnostics;
|
|
935
1315
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
936
1316
|
if (node instanceof concepts_1.ViewElement && node.view === fileNode) {
|
|
937
1317
|
if (node.tag) {
|
|
@@ -939,24 +1319,38 @@ class NaslServer {
|
|
|
939
1319
|
if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
|
|
940
1320
|
const bindExpression = bindAttr.expression;
|
|
941
1321
|
let diagnostic;
|
|
942
|
-
if (bindExpression.concept
|
|
943
|
-
|
|
944
|
-
node: bindAttr,
|
|
945
|
-
severity: 'error',
|
|
946
|
-
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
else {
|
|
1322
|
+
if (bindExpression.concept === 'MemberExpression') {
|
|
1323
|
+
let current = bindExpression;
|
|
950
1324
|
if (bindExpression.isEnum()) {
|
|
951
1325
|
diagnostic = {
|
|
952
|
-
node:
|
|
1326
|
+
node: bindExpression,
|
|
953
1327
|
severity: 'error',
|
|
954
1328
|
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
955
1329
|
};
|
|
956
1330
|
}
|
|
1331
|
+
else {
|
|
1332
|
+
while (current.object) {
|
|
1333
|
+
if (current.object.concept !== 'MemberExpression' && current.object.concept !== 'Identifier') {
|
|
1334
|
+
diagnostic = {
|
|
1335
|
+
node: bindExpression,
|
|
1336
|
+
severity: 'error',
|
|
1337
|
+
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
1338
|
+
};
|
|
1339
|
+
break;
|
|
1340
|
+
}
|
|
1341
|
+
current = current.object;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
else if (bindExpression.concept !== 'Identifier') {
|
|
1346
|
+
diagnostic = {
|
|
1347
|
+
node: bindExpression,
|
|
1348
|
+
severity: 'error',
|
|
1349
|
+
message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
|
|
1350
|
+
};
|
|
957
1351
|
}
|
|
958
1352
|
if (diagnostic) {
|
|
959
|
-
|
|
1353
|
+
bindExpression.tsErrorDetail = diagnostic;
|
|
960
1354
|
diagnostics.push(diagnostic);
|
|
961
1355
|
}
|
|
962
1356
|
}
|
|
@@ -976,7 +1370,13 @@ class NaslServer {
|
|
|
976
1370
|
if (node.logic && node.logic !== nodeIn.logic)
|
|
977
1371
|
return;
|
|
978
1372
|
// 跟变量无关的赋值过滤
|
|
979
|
-
|
|
1373
|
+
let jsCode = '';
|
|
1374
|
+
try {
|
|
1375
|
+
jsCode = nodeIn.toJS();
|
|
1376
|
+
}
|
|
1377
|
+
catch (err) {
|
|
1378
|
+
console.log(err);
|
|
1379
|
+
}
|
|
980
1380
|
if (!jsCode.includes(`${node.name} = `))
|
|
981
1381
|
return;
|
|
982
1382
|
// 页面局部变量
|
|
@@ -1013,7 +1413,7 @@ class NaslServer {
|
|
|
1013
1413
|
}
|
|
1014
1414
|
});
|
|
1015
1415
|
if (!msg)
|
|
1016
|
-
msg = '
|
|
1416
|
+
msg = '未设置类型或未赋值。直接赋值系统可以自动推断类型。';
|
|
1017
1417
|
const diagnostic = {
|
|
1018
1418
|
node,
|
|
1019
1419
|
severity: 'error',
|
|
@@ -1023,6 +1423,31 @@ class NaslServer {
|
|
|
1023
1423
|
diagnostics.push(diagnostic);
|
|
1024
1424
|
}
|
|
1025
1425
|
}
|
|
1426
|
+
else if (node instanceof concepts_1.BindAttribute || node instanceof concepts_1.BindDirective || node instanceof concepts_1.BindStyle) {
|
|
1427
|
+
if (Array.isArray(node.bindExpressions)) {
|
|
1428
|
+
const exp = node.bindExpressions.find((bindExpression) => this.hasComponentLogics(bindExpression));
|
|
1429
|
+
if (exp) {
|
|
1430
|
+
//const element: any = node.getAncestor('ViewElement');
|
|
1431
|
+
//const api = config.allNodesAPI[element?.tag];
|
|
1432
|
+
//const attr = api?.attrs?.find?.((attr) => {
|
|
1433
|
+
// return attr.name === node.name;
|
|
1434
|
+
//});
|
|
1435
|
+
const map = {
|
|
1436
|
+
BindAttribute: '属性',
|
|
1437
|
+
BindDirective: '指令',
|
|
1438
|
+
BindStyle: '样式属性',
|
|
1439
|
+
};
|
|
1440
|
+
//“${attr?.title || node.title || node.name}”
|
|
1441
|
+
const diagnostic = {
|
|
1442
|
+
node,
|
|
1443
|
+
severity: 'error',
|
|
1444
|
+
message: `${map[node.concept]}表达式不能绑定组件逻辑`,
|
|
1445
|
+
};
|
|
1446
|
+
node.tsErrorDetail = diagnostic;
|
|
1447
|
+
diagnostics.push(diagnostic);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1026
1451
|
else {
|
|
1027
1452
|
this.checkNodeError(node, diagnostics);
|
|
1028
1453
|
}
|
|
@@ -1074,14 +1499,14 @@ class NaslServer {
|
|
|
1074
1499
|
if (envText) {
|
|
1075
1500
|
const diagnostic = {
|
|
1076
1501
|
node: fileNode,
|
|
1077
|
-
severity: '
|
|
1502
|
+
severity: 'warning',
|
|
1078
1503
|
message: `数据源配置:数据源 ${property.name} ${envText}环境数据源连接不通,请先检查${envText}环境数据源配置`,
|
|
1079
1504
|
// 保留原来的内容方便查询一些问题
|
|
1080
1505
|
originalDiagnostic: {
|
|
1081
1506
|
fileName: '',
|
|
1082
1507
|
start: null,
|
|
1083
1508
|
end: null,
|
|
1084
|
-
category: '
|
|
1509
|
+
category: 'warning',
|
|
1085
1510
|
text: `DataSource connection error`,
|
|
1086
1511
|
},
|
|
1087
1512
|
};
|
|
@@ -1092,10 +1517,239 @@ class NaslServer {
|
|
|
1092
1517
|
}
|
|
1093
1518
|
}
|
|
1094
1519
|
}
|
|
1520
|
+
// 加上对实体属性存储类型的校验规则
|
|
1521
|
+
if (fileNode instanceof concepts_1.Entity) {
|
|
1522
|
+
const entity = fileNode;
|
|
1523
|
+
const dbType = entity.dataSource.dataSourceSqlType;
|
|
1524
|
+
const { origin, properties } = entity || {};
|
|
1525
|
+
if (dbType && !['excel', 'table'].includes(origin) && Array.isArray(properties) && properties.length) {
|
|
1526
|
+
properties.forEach((property) => {
|
|
1527
|
+
if (property) {
|
|
1528
|
+
const { typeAnnotation, databaseTypeAnnotation, rules } = property;
|
|
1529
|
+
const { typeName } = typeAnnotation || {};
|
|
1530
|
+
const rulesMap = {};
|
|
1531
|
+
if (Array.isArray(rules)) {
|
|
1532
|
+
rules.forEach((rule) => {
|
|
1533
|
+
const match = rule.match(/^([^()]+)\(([\d\-.]+)\)$/);
|
|
1534
|
+
if (match) {
|
|
1535
|
+
const [, key, value] = match;
|
|
1536
|
+
rulesMap[key] = value;
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
const diagnostic = {
|
|
1541
|
+
node: property,
|
|
1542
|
+
severity: 'error',
|
|
1543
|
+
message: '',
|
|
1544
|
+
};
|
|
1545
|
+
const dataBaseTyp = property.currentDataBaseType;
|
|
1546
|
+
typeAnnotation.tsErrorDetail = null;
|
|
1547
|
+
if (!dataBaseTyp && databaseTypeAnnotation) {
|
|
1548
|
+
const { typeName: databaseTypeName } = databaseTypeAnnotation;
|
|
1549
|
+
const errorMsg = `平台目前暂不支持${dbType}数据库的${databaseTypeName}存储类型`;
|
|
1550
|
+
diagnostic.message = errorMsg;
|
|
1551
|
+
const tsErrorDetail = {
|
|
1552
|
+
severity: 'error',
|
|
1553
|
+
errorPos: {
|
|
1554
|
+
typeName: errorMsg,
|
|
1555
|
+
},
|
|
1556
|
+
};
|
|
1557
|
+
databaseTypeAnnotation.tsErrorDetail = tsErrorDetail;
|
|
1558
|
+
}
|
|
1559
|
+
else {
|
|
1560
|
+
const { options } = dataBaseTyp || {};
|
|
1561
|
+
if (options) {
|
|
1562
|
+
if (databaseTypeAnnotation) {
|
|
1563
|
+
databaseTypeAnnotation.tsErrorDetail = null;
|
|
1564
|
+
const databaseTypeAnnotationErrorDetail = {
|
|
1565
|
+
severity: 'error',
|
|
1566
|
+
errorPos: {},
|
|
1567
|
+
};
|
|
1568
|
+
for (const key in options) {
|
|
1569
|
+
const option = options[key];
|
|
1570
|
+
const { comment, require, min, max } = option || {};
|
|
1571
|
+
const databaseTypeArg = databaseTypeAnnotation.arguments?.[key];
|
|
1572
|
+
// 如果必填的值没有填,报错
|
|
1573
|
+
if (require && !databaseTypeArg && key !== 'scale') {
|
|
1574
|
+
diagnostic.message = `${comment}不能为空`;
|
|
1575
|
+
databaseTypeAnnotationErrorDetail.errorPos[key] = `${comment}不能为空`;
|
|
1576
|
+
}
|
|
1577
|
+
else if (min && +min > +databaseTypeArg) {
|
|
1578
|
+
diagnostic.message = `${comment}不能小于最小值${min}`;
|
|
1579
|
+
databaseTypeAnnotationErrorDetail.errorPos[key] = `${comment}不能小于最小值${min}`;
|
|
1580
|
+
}
|
|
1581
|
+
else if (max && +max < +databaseTypeArg) {
|
|
1582
|
+
diagnostic.message = `${comment}不能大于最大值${max}`;
|
|
1583
|
+
databaseTypeAnnotationErrorDetail.errorPos[key] = `${comment}不能大于最大值${max}`;
|
|
1584
|
+
}
|
|
1585
|
+
if (Object.keys(databaseTypeAnnotationErrorDetail.errorPos).length) {
|
|
1586
|
+
databaseTypeAnnotation.tsErrorDetail = databaseTypeAnnotationErrorDetail;
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
const typeAnnotationErrorDetail = {
|
|
1591
|
+
severity: 'warning',
|
|
1592
|
+
errorPos: {},
|
|
1593
|
+
};
|
|
1594
|
+
const precisionOption = options?.precision;
|
|
1595
|
+
const { default: defaultVal } = precisionOption || {};
|
|
1596
|
+
const precision = databaseTypeAnnotation ? databaseTypeAnnotation.arguments?.precision : defaultVal;
|
|
1597
|
+
const ruleScale = typeAnnotation?.ruleMap?.scale;
|
|
1598
|
+
const scale = ruleScale !== undefined ? ruleScale + '' : '';
|
|
1599
|
+
let ensureScale = true;
|
|
1600
|
+
switch (typeName) {
|
|
1601
|
+
case 'String': {
|
|
1602
|
+
const defaultVal = options.length?.default;
|
|
1603
|
+
const length = databaseTypeAnnotation ? databaseTypeAnnotation.arguments?.length : defaultVal;
|
|
1604
|
+
if (length) {
|
|
1605
|
+
[
|
|
1606
|
+
{
|
|
1607
|
+
key: 'minLength',
|
|
1608
|
+
text: '小',
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
key: 'maxLength',
|
|
1612
|
+
text: '大',
|
|
1613
|
+
},
|
|
1614
|
+
].forEach(({ key, text }) => {
|
|
1615
|
+
const curLength = rulesMap[key];
|
|
1616
|
+
if (+curLength > +length) {
|
|
1617
|
+
const errorMsg = `最${text}长度超出存储长度`;
|
|
1618
|
+
const diag = {
|
|
1619
|
+
node: property,
|
|
1620
|
+
severity: 'warning',
|
|
1621
|
+
message: errorMsg,
|
|
1622
|
+
};
|
|
1623
|
+
diagnostics.push(diag);
|
|
1624
|
+
typeAnnotationErrorDetail.errorPos[key] = errorMsg;
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
case 'Long': {
|
|
1630
|
+
const { min: ruleMin, max: ruleMax } = dataBaseTyp;
|
|
1631
|
+
const minVal = rulesMap.min;
|
|
1632
|
+
const maxVal = rulesMap.max;
|
|
1633
|
+
// 最大最小值都要校验存储上下限
|
|
1634
|
+
[
|
|
1635
|
+
{
|
|
1636
|
+
key: 'min',
|
|
1637
|
+
name: '最小值',
|
|
1638
|
+
value: minVal,
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
key: 'max',
|
|
1642
|
+
name: '最大值',
|
|
1643
|
+
value: maxVal,
|
|
1644
|
+
},
|
|
1645
|
+
].forEach(({ key, name, value }) => {
|
|
1646
|
+
if (ruleMin && value && new decimal_js_1.Decimal(ruleMin).greaterThan(new decimal_js_1.Decimal(value))) { // 超出存储下限
|
|
1647
|
+
const diag = {
|
|
1648
|
+
node: property,
|
|
1649
|
+
severity: 'warning',
|
|
1650
|
+
message: `${name}超出存储下限${ruleMin}`,
|
|
1651
|
+
};
|
|
1652
|
+
diagnostics.push(diag);
|
|
1653
|
+
typeAnnotationErrorDetail.errorPos[key] = `${name}超出存储下限`;
|
|
1654
|
+
}
|
|
1655
|
+
if (ruleMax && value && new decimal_js_1.Decimal(ruleMax).lessThan(new decimal_js_1.Decimal(value))) { // 超出存储上限
|
|
1656
|
+
const diag = {
|
|
1657
|
+
node: property,
|
|
1658
|
+
severity: 'warning',
|
|
1659
|
+
message: `${name}超出存储上限${ruleMax}`,
|
|
1660
|
+
};
|
|
1661
|
+
diagnostics.push(diag);
|
|
1662
|
+
typeAnnotationErrorDetail.errorPos[key] = `${name}超出存储上限`;
|
|
1663
|
+
}
|
|
1664
|
+
});
|
|
1665
|
+
break;
|
|
1666
|
+
}
|
|
1667
|
+
case 'Decimal': {
|
|
1668
|
+
if (precisionOption) {
|
|
1669
|
+
if (+precision < +scale) {
|
|
1670
|
+
const diag = {
|
|
1671
|
+
node: property,
|
|
1672
|
+
severity: 'error',
|
|
1673
|
+
message: '',
|
|
1674
|
+
};
|
|
1675
|
+
const errorMsg = `小数位数必须小于或等于精度${precision}`;
|
|
1676
|
+
diag.message = errorMsg;
|
|
1677
|
+
diagnostics.push(diag);
|
|
1678
|
+
ensureScale = false;
|
|
1679
|
+
typeAnnotationErrorDetail.errorPos.scale = errorMsg;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
break;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
const minVal = rulesMap.min;
|
|
1686
|
+
const maxVal = rulesMap.max;
|
|
1687
|
+
// 最 大/小 值不能 大/于 由精度和小数位数 确定的范围
|
|
1688
|
+
if (precisionOption && ensureScale) {
|
|
1689
|
+
const memoryStr = '9'.repeat(+precision);
|
|
1690
|
+
// 储存整数部分
|
|
1691
|
+
const memoryIntAbsStr = memoryStr.slice(0, +precision - +(scale || '0')) || '0';
|
|
1692
|
+
// 储存小数部分
|
|
1693
|
+
const memoryScaleStr = memoryStr.slice(0, +(scale || '0'));
|
|
1694
|
+
// 储存绝对值
|
|
1695
|
+
const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? '.' + memoryScaleStr : '');
|
|
1696
|
+
const decimalMemoryAbsVal = new decimal_js_1.Decimal(memoryAbsVal);
|
|
1697
|
+
[
|
|
1698
|
+
{
|
|
1699
|
+
key: 'min',
|
|
1700
|
+
text: '小',
|
|
1701
|
+
val: minVal,
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
key: 'max',
|
|
1705
|
+
text: '大',
|
|
1706
|
+
val: maxVal,
|
|
1707
|
+
},
|
|
1708
|
+
].forEach(({ key, text, val }) => {
|
|
1709
|
+
if (val) {
|
|
1710
|
+
const decimalVal = new decimal_js_1.Decimal(val);
|
|
1711
|
+
// 是否是负数
|
|
1712
|
+
const isNegative = decimalVal.isNegative();
|
|
1713
|
+
// 填入的值的绝对值是否大于存储绝对值
|
|
1714
|
+
if (decimalMemoryAbsVal.lessThan(decimalVal.abs())) {
|
|
1715
|
+
const errorMsg = `最${text}值不得${isNegative ? '小' : '大'}于${isNegative ? '-' : ''}${memoryAbsVal}`;
|
|
1716
|
+
const diag = {
|
|
1717
|
+
node: property,
|
|
1718
|
+
severity: 'warning',
|
|
1719
|
+
message: errorMsg,
|
|
1720
|
+
};
|
|
1721
|
+
diagnostics.push(diag);
|
|
1722
|
+
typeAnnotationErrorDetail.errorPos[key] = errorMsg;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
if (['Long', 'Decimal'].includes(typeName) && !typeAnnotationErrorDetail.errorPos.min) {
|
|
1728
|
+
if (minVal && maxVal && new decimal_js_1.Decimal(maxVal).lessThan(minVal)) {
|
|
1729
|
+
const errorMsg = '最小值不得大于最大值';
|
|
1730
|
+
const diag = {
|
|
1731
|
+
node: property,
|
|
1732
|
+
severity: 'warning',
|
|
1733
|
+
message: errorMsg,
|
|
1734
|
+
};
|
|
1735
|
+
diagnostics.push(diag);
|
|
1736
|
+
typeAnnotationErrorDetail.errorPos.min = errorMsg;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
if (Object.keys(typeAnnotationErrorDetail.errorPos).length) {
|
|
1740
|
+
typeAnnotation.tsErrorDetail = typeAnnotationErrorDetail;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
if (diagnostic.message) {
|
|
1745
|
+
property.__showAdvanced = true;
|
|
1746
|
+
diagnostics.push(diagnostic);
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1095
1752
|
if (fileNode instanceof concepts_1.Logic) {
|
|
1096
|
-
// 判断逻辑是否已经删除
|
|
1097
|
-
if (fileNode.parentNode instanceof concepts_1.App && !fileNode.parentNode.logics.includes(fileNode))
|
|
1098
|
-
return diagnostics;
|
|
1099
1753
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
1100
1754
|
//OQL支持返回复合类型数据了
|
|
1101
1755
|
// SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
|
|
@@ -1108,23 +1762,49 @@ class NaslServer {
|
|
|
1108
1762
|
// node.tsErrorDetail = diagnostic;
|
|
1109
1763
|
// diagnostics.push(diagnostic);
|
|
1110
1764
|
// }
|
|
1765
|
+
if (node instanceof concepts_1.OqlQueryComponent) {
|
|
1766
|
+
// 自动推导情况
|
|
1767
|
+
const typeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(node.__nodeType);
|
|
1768
|
+
if (!node.typeAnnotation && typeAnnotation) {
|
|
1769
|
+
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
1770
|
+
const typeArguments = typeAnnotation.typeArguments;
|
|
1771
|
+
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
1772
|
+
const diagnostic = {
|
|
1773
|
+
node,
|
|
1774
|
+
severity: 'error',
|
|
1775
|
+
message: `SQL查询:返回类型不支持单个复杂类型 ${typeArguments[0].headTitle}。`,
|
|
1776
|
+
};
|
|
1777
|
+
node.tsErrorDetail = diagnostic;
|
|
1778
|
+
diagnostics.push(diagnostic);
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1111
1783
|
if (node instanceof concepts_1.Return || node instanceof concepts_1.Variable) {
|
|
1112
1784
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
1113
1785
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
1114
1786
|
let used = false;
|
|
1115
1787
|
fileNode?.sourceMap.forEach((valueIn, nodeIn) => {
|
|
1116
1788
|
if (!used && nodeIn
|
|
1117
|
-
&& (nodeIn instanceof concepts_1.BatchAssignment || (nodeIn instanceof concepts_1.Assignment && nodeIn.left?.name))
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1789
|
+
&& (nodeIn instanceof concepts_1.BatchAssignment || (nodeIn instanceof concepts_1.Assignment && nodeIn.left?.name))) {
|
|
1790
|
+
let jsCode = '';
|
|
1791
|
+
try {
|
|
1792
|
+
jsCode = nodeIn.toJS();
|
|
1793
|
+
}
|
|
1794
|
+
catch (err) {
|
|
1795
|
+
console.log(err);
|
|
1796
|
+
}
|
|
1797
|
+
if (jsCode.includes(`${node.name} = `)) {
|
|
1798
|
+
used = true;
|
|
1799
|
+
if (!nodeIn.tsErrorDetail) {
|
|
1800
|
+
const diagnostic = {
|
|
1801
|
+
node: nodeIn,
|
|
1802
|
+
severity: 'error',
|
|
1803
|
+
message: `${nodeIn.label}左边 ${node.name} 未设置类型,右边必须为有返回值的内容。`,
|
|
1804
|
+
};
|
|
1805
|
+
nodeIn.tsErrorDetail = diagnostic;
|
|
1806
|
+
diagnostics.push(diagnostic);
|
|
1807
|
+
}
|
|
1128
1808
|
}
|
|
1129
1809
|
}
|
|
1130
1810
|
});
|
|
@@ -1195,31 +1875,43 @@ class NaslServer {
|
|
|
1195
1875
|
}
|
|
1196
1876
|
});
|
|
1197
1877
|
}
|
|
1878
|
+
Object.keys(typeMap).forEach((item) => {
|
|
1879
|
+
if (typeMap[item].length > 1) {
|
|
1880
|
+
typeMap[item].forEach((nodeItem) => {
|
|
1881
|
+
const diagnostic = {
|
|
1882
|
+
node: nodeItem,
|
|
1883
|
+
severity: 'error',
|
|
1884
|
+
message: '匹配:重复添加类型',
|
|
1885
|
+
titleTip: '重复添加此项',
|
|
1886
|
+
};
|
|
1887
|
+
nodeItem.tsErrorDetail = diagnostic;
|
|
1888
|
+
diagnostics.push(diagnostic);
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
else if (node.expression) {
|
|
1894
|
+
const diagnostic = {
|
|
1895
|
+
node: node.expression,
|
|
1896
|
+
severity: 'error',
|
|
1897
|
+
message: '类型不匹配,传入类型:void',
|
|
1898
|
+
};
|
|
1899
|
+
node.expression.tsErrorDetail = diagnostic;
|
|
1900
|
+
diagnostics.push(diagnostic);
|
|
1198
1901
|
}
|
|
1199
|
-
Object.keys(typeMap).forEach((item) => {
|
|
1200
|
-
if (typeMap[item].length > 1) {
|
|
1201
|
-
typeMap[item].forEach((nodeItem) => {
|
|
1202
|
-
const diagnostic = {
|
|
1203
|
-
node: nodeItem,
|
|
1204
|
-
severity: 'error',
|
|
1205
|
-
message: '匹配:重复添加类型',
|
|
1206
|
-
titleTip: '重复添加此项',
|
|
1207
|
-
};
|
|
1208
|
-
nodeItem.tsErrorDetail = diagnostic;
|
|
1209
|
-
diagnostics.push(diagnostic);
|
|
1210
|
-
});
|
|
1211
|
-
}
|
|
1212
|
-
});
|
|
1213
1902
|
}
|
|
1214
|
-
if (node instanceof concepts_1.MatchCase && node.getAncestor('Match')?.isExpression && node.body.length === 0
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1903
|
+
if (node instanceof concepts_1.MatchCase && node.getAncestor('Match')?.isExpression && node.body.length === 0) {
|
|
1904
|
+
// 如果不是其他就标红
|
|
1905
|
+
if ((node?.getIndexOfParent() !== (node.getAncestor('Match')?.cases?.length || 0) - 1)) {
|
|
1906
|
+
const diagnostic = {
|
|
1907
|
+
node,
|
|
1908
|
+
severity: 'error',
|
|
1909
|
+
message: '匹配分支:返回内容不能为空',
|
|
1910
|
+
titleTip: '返回内容不能为空',
|
|
1911
|
+
};
|
|
1912
|
+
node.tsErrorDetail = diagnostic;
|
|
1913
|
+
diagnostics.push(diagnostic);
|
|
1914
|
+
}
|
|
1223
1915
|
}
|
|
1224
1916
|
// 如果节点是match的patterns 里的
|
|
1225
1917
|
if (node?.parentKey === 'patterns' && node.parentNode instanceof concepts_1.MatchCase) {
|
|
@@ -1284,22 +1976,87 @@ class NaslServer {
|
|
|
1284
1976
|
}
|
|
1285
1977
|
/**
|
|
1286
1978
|
* 如果节点是内置函数
|
|
1287
|
-
* 穷举在线上的情况,不在线上就void报错,
|
|
1979
|
+
* 穷举在线上的情况,不在线上就void报错, callinterface 因为原来有报错,所以就忽略掉
|
|
1288
1980
|
* && 他在父级中,不在body
|
|
1289
1981
|
* && 也不再 if的线上
|
|
1290
1982
|
* && 也不再 switch的线上consequent
|
|
1291
1983
|
* && 也不再草稿区域
|
|
1292
1984
|
* && 不在 parentNode.parentNode(只用处理两层的,超过两层上就需要报错,只用直接是参数位第一层的需要) 是 callfunction 和 callInfterfase中,因为这两本身有强制类型,内置函数或者一些带T的声明那种,
|
|
1293
1985
|
* && 而且也没有类型,就说明在槽位里,就需要报错
|
|
1986
|
+
*
|
|
1987
|
+
* 如果是内置函数而且也不在线上
|
|
1988
|
+
* 只有下面自己实现的函数才会报错
|
|
1294
1989
|
*/
|
|
1295
|
-
if (node instanceof concepts_1.CallFunction && node.parentKey !== 'body' && node.parentKey !== 'alternate' && node.parentKey !== 'playground' && node.parentKey !== 'consequent' && node.parentNode?.parentNode?.concept !== '
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1990
|
+
if (node instanceof concepts_1.CallFunction && node.parentKey !== 'body' && node.parentKey !== 'alternate' && node.parentKey !== 'playground' && node.parentKey !== 'consequent' && node.parentNode?.parentNode?.concept !== 'CallInterface' && !node.__TypeAnnotation) {
|
|
1991
|
+
let showErr = false;
|
|
1992
|
+
if (node.parentNode?.parentNode?.concept === 'CallLogic') {
|
|
1993
|
+
// calllogic 中别的类型会强校验,但是内置函数,不会强制校验,下面这几个其实是走的内置函数的实现,所以需要手动增加一下校验
|
|
1994
|
+
const { calleeNamespace, calleeName } = node.parentNode.parentNode;
|
|
1995
|
+
if ((calleeNamespace === 'nasl.ui' || calleeNamespace === 'nasl.util') && (calleeName === 'showMessage' || calleeName === 'consoleLog' || calleeName === 'jsonSerialize' || calleeName === 'jsonDeserialize')) {
|
|
1996
|
+
showErr = true;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
else {
|
|
2000
|
+
showErr = true;
|
|
2001
|
+
}
|
|
2002
|
+
if (showErr) {
|
|
2003
|
+
const diagnostic = {
|
|
2004
|
+
node,
|
|
2005
|
+
severity: 'error',
|
|
2006
|
+
message: `类型不匹配,传入类型:void`,
|
|
2007
|
+
};
|
|
2008
|
+
node.tsErrorDetail = diagnostic;
|
|
2009
|
+
diagnostics.push(diagnostic);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
// newMap key或者value没填都要有报错
|
|
2013
|
+
if (node instanceof concepts_1.NewMap) {
|
|
2014
|
+
// 如果一项没有key 或者没有 value 就报错
|
|
2015
|
+
const findFlag = node.keys?.some((key, index) => !key || !node.values?.[index]);
|
|
2016
|
+
if (findFlag) {
|
|
2017
|
+
const diagnostic = {
|
|
2018
|
+
node,
|
|
2019
|
+
severity: 'error',
|
|
2020
|
+
message: `新建Map的key和value应该都必填`,
|
|
2021
|
+
};
|
|
2022
|
+
node.tsErrorDetail = diagnostic;
|
|
2023
|
+
diagnostics.push(diagnostic);
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
// 赋值语句左右list 和 map等可以 必须都一样
|
|
2027
|
+
if (node instanceof concepts_1.Assignment && !node.tsErrorDetail) {
|
|
2028
|
+
const leftType = node.left?.__TypeAnnotation || {};
|
|
2029
|
+
const rightType = node.right?.__TypeAnnotation || {};
|
|
2030
|
+
// 如果左边节点是 泛型,而且 左边泛型的名字 和 右边一样, 而且是list 或者map 就强制报错
|
|
2031
|
+
// 而且右边原来没有报错
|
|
2032
|
+
if (leftType.typeKind === 'generic' && leftType.typeKind === rightType.typeKind && leftType.typeName === rightType.typeName && ['Map', 'List'].includes(leftType.typeName)) {
|
|
2033
|
+
if (!(node.right.tsErrorDetail) && leftType.sortedTypeKey !== rightType.sortedTypeKey) {
|
|
2034
|
+
const excludeList = [
|
|
2035
|
+
'nasl.collection.List<nasl.core.String>',
|
|
2036
|
+
'nasl.collection.List<nasl.core.Email>',
|
|
2037
|
+
'nasl.collection.Map<nasl.core.String, nasl.core.String>',
|
|
2038
|
+
'nasl.collection.Map<nasl.core.String, nasl.core.Email>',
|
|
2039
|
+
];
|
|
2040
|
+
const excludeList2 = [
|
|
2041
|
+
'nasl.collection.List<>',
|
|
2042
|
+
'nasl.collection.List<T>',
|
|
2043
|
+
];
|
|
2044
|
+
// 先特殊处理等 类型合并后就可以去掉了
|
|
2045
|
+
if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
|
|
2046
|
+
return null;
|
|
2047
|
+
}
|
|
2048
|
+
else if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
|
|
2049
|
+
return null;
|
|
2050
|
+
}
|
|
2051
|
+
const diagnostic = {
|
|
2052
|
+
node: node.right,
|
|
2053
|
+
severity: 'error',
|
|
2054
|
+
message: `左右参数类型不一致!左边类型:${leftType.typeChineseTitle},右边类型:${rightType.typeChineseTitle}。`,
|
|
2055
|
+
};
|
|
2056
|
+
node.right.tsErrorDetail = diagnostic;
|
|
2057
|
+
diagnostics.push(diagnostic);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
1303
2060
|
}
|
|
1304
2061
|
}
|
|
1305
2062
|
/* 接口导入查找 */
|
|
@@ -1367,8 +2124,13 @@ class NaslServer {
|
|
|
1367
2124
|
*/
|
|
1368
2125
|
_resolveDiagnostic(diagnostic, fileNode, record) {
|
|
1369
2126
|
// 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
|
|
1370
|
-
if (fileNode.module)
|
|
2127
|
+
if (fileNode.module && !(fileNode instanceof concepts_1.ConfigProperty)) {
|
|
1371
2128
|
return;
|
|
2129
|
+
}
|
|
2130
|
+
// 过滤掉java依赖库的报错
|
|
2131
|
+
// if ('compilerInfoMap' in fileNode && (fileNode as any).compilerInfoMap?.java) {
|
|
2132
|
+
// return;
|
|
2133
|
+
// }
|
|
1372
2134
|
const minRange = this._findMinRange(diagnostic, fileNode);
|
|
1373
2135
|
const tsErrorDetail = {
|
|
1374
2136
|
severity: diagnostic.category === 'error' ? 'error' : 'warning',
|
|
@@ -1420,9 +2182,27 @@ class NaslServer {
|
|
|
1420
2182
|
else {
|
|
1421
2183
|
// 没有节点 或者 行差比较小比已有的小就可以
|
|
1422
2184
|
// 一般出现在一大块上,多半是if for 等等没有参数
|
|
1423
|
-
if (!minRange
|
|
2185
|
+
if (!minRange) {
|
|
1424
2186
|
minRange = { node, item };
|
|
1425
2187
|
}
|
|
2188
|
+
else if ((0, translator_1.lsp2tspNumber)(item.range.start.line) === diagnostic.start.line && diagnostic.start.offset >= (0, translator_1.lsp2tspNumber)(item.range.start.character)) {
|
|
2189
|
+
// 如果当前遍历的内容的行和列都 小于之前的, 而且是有效的
|
|
2190
|
+
// 如果两个内容位置行数是一样的,就比较下找到内容的位置信息
|
|
2191
|
+
// 找到的内容的开始位置, 要大于申明内容开始的位置,要不就不包含在内了
|
|
2192
|
+
if (diagnostic.start.offset - item.range.start.character <= diagnostic.start.offset - minRange.item.range.start.character) {
|
|
2193
|
+
minRange = { node, item };
|
|
2194
|
+
}
|
|
2195
|
+
else {
|
|
2196
|
+
if (diagnostic.start.offset < (0, translator_1.lsp2tspNumber)(minRange.item.range.start.character)) {
|
|
2197
|
+
minRange = { node, item };
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
|
|
2202
|
+
if (minRange.item.range.start.line !== diagnostic.start.line) {
|
|
2203
|
+
minRange = { node, item };
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
1426
2206
|
}
|
|
1427
2207
|
}
|
|
1428
2208
|
}
|
|
@@ -1588,6 +2368,114 @@ class NaslServer {
|
|
|
1588
2368
|
refsList = [...methodRefs];
|
|
1589
2369
|
}
|
|
1590
2370
|
}
|
|
2371
|
+
if (node instanceof concepts_1.Process) {
|
|
2372
|
+
if (currentSource) {
|
|
2373
|
+
const code = currentSource.code;
|
|
2374
|
+
const prefix = '__ProcessIdentification__';
|
|
2375
|
+
let positions = [];
|
|
2376
|
+
let pos = code.indexOf(prefix);
|
|
2377
|
+
while (pos !== -1) {
|
|
2378
|
+
positions.push(pos);
|
|
2379
|
+
pos = code.indexOf(prefix, pos + prefix.length);
|
|
2380
|
+
}
|
|
2381
|
+
positions.shift();
|
|
2382
|
+
// 拿到标识下定义的const process = {...}
|
|
2383
|
+
positions = positions.map((position) => code.indexOf('const', position + prefix.length));
|
|
2384
|
+
const promises = positions.map((item) => this.references({
|
|
2385
|
+
file: fileNode.getEmbeddedFilePath(),
|
|
2386
|
+
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
2387
|
+
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character + item),
|
|
2388
|
+
}));
|
|
2389
|
+
const results = await Promise.all(promises);
|
|
2390
|
+
results.forEach((constRefs) => {
|
|
2391
|
+
refsList = [...refsList, ...constRefs.refs];
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
if ((node instanceof concepts_1.Param || node instanceof concepts_1.Return) && node.parentNode instanceof concepts_1.Process) {
|
|
2396
|
+
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2397
|
+
if (currentSource) {
|
|
2398
|
+
const code = currentSource.code;
|
|
2399
|
+
const prefix = '__ProcessIdentification__';
|
|
2400
|
+
const positions = [];
|
|
2401
|
+
let pos = code.indexOf(prefix);
|
|
2402
|
+
pos = code.indexOf(node.name, pos + prefix.length);
|
|
2403
|
+
// pos === -1:两种情况:
|
|
2404
|
+
// 1、找到最后一个节点了,继续找找不下去了。
|
|
2405
|
+
// 2、创建、删除节点的时候也会找不到(本身这两种操作就不应该进到这个方法)
|
|
2406
|
+
while (pos !== -1) {
|
|
2407
|
+
positions.push(pos);
|
|
2408
|
+
pos = code.indexOf(prefix, pos + prefix.length);
|
|
2409
|
+
pos = pos === -1 ? pos : code.indexOf(node.name, pos + prefix.length);
|
|
2410
|
+
}
|
|
2411
|
+
positions.shift();
|
|
2412
|
+
// 拿到标识下定义的参数名字
|
|
2413
|
+
const promises = positions.map((item) => this.references({
|
|
2414
|
+
file: fileNode.getEmbeddedFilePath(),
|
|
2415
|
+
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
2416
|
+
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character + item),
|
|
2417
|
+
}));
|
|
2418
|
+
const results = await Promise.all(promises);
|
|
2419
|
+
results.forEach((constRefs) => {
|
|
2420
|
+
refsList = [...refsList, ...constRefs.refs];
|
|
2421
|
+
});
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
if (node instanceof concepts_1.ProcessElement) {
|
|
2425
|
+
if (currentSource) {
|
|
2426
|
+
const code = currentSource.code;
|
|
2427
|
+
const prefix = '__ProcessIdentification__';
|
|
2428
|
+
let positions = [];
|
|
2429
|
+
let pos = code.indexOf(prefix);
|
|
2430
|
+
while (pos !== -1) {
|
|
2431
|
+
positions.push(pos);
|
|
2432
|
+
pos = code.indexOf(prefix, pos + prefix.length);
|
|
2433
|
+
}
|
|
2434
|
+
// 拿到标识下定义的const process = {...}
|
|
2435
|
+
positions = positions.map((position) => code.indexOf(`${node.name}:`, position + prefix.length));
|
|
2436
|
+
const promises = positions.map((item) => this.references({
|
|
2437
|
+
file: fileNode.getEmbeddedFilePath(),
|
|
2438
|
+
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
2439
|
+
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character + item),
|
|
2440
|
+
}));
|
|
2441
|
+
const results = await Promise.all(promises);
|
|
2442
|
+
results.forEach((constRefs) => {
|
|
2443
|
+
refsList = [...refsList, ...constRefs.refs];
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
if (node instanceof concepts_1.Return && node.parentNode instanceof concepts_1.ProcessElement) {
|
|
2448
|
+
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2449
|
+
if (currentSource) {
|
|
2450
|
+
const code = currentSource.code;
|
|
2451
|
+
const prefix = '__ProcessIdentification__';
|
|
2452
|
+
const positions = [];
|
|
2453
|
+
let pos = code.indexOf(prefix);
|
|
2454
|
+
// 需要再次定位到processelement对象上,避免process上存在同名参数
|
|
2455
|
+
pos = code.indexOf(node.parentNode.name, pos + prefix.length);
|
|
2456
|
+
pos = pos === -1 ? pos : code.indexOf(node.name, pos + prefix.length);
|
|
2457
|
+
// pos === -1:两种情况:
|
|
2458
|
+
// 1、找到最后一个节点了,继续找找不下去了。
|
|
2459
|
+
// 2、创建、删除节点的时候也会找不到(本身这两种操作就不应该进到这个方法)
|
|
2460
|
+
while (pos !== -1) {
|
|
2461
|
+
positions.push(pos);
|
|
2462
|
+
pos = code.indexOf(prefix, pos + prefix.length);
|
|
2463
|
+
// 需要再次定位到processelement对象上,避免process上存在同名参数
|
|
2464
|
+
pos = pos === -1 ? pos : code.indexOf(node.parentNode.name, pos + node.parentNode.name.length);
|
|
2465
|
+
pos = pos === -1 ? pos : code.indexOf(node.name, pos + prefix.length);
|
|
2466
|
+
}
|
|
2467
|
+
// 拿到标识下定义的参数名字
|
|
2468
|
+
const promises = positions.map((item) => this.references({
|
|
2469
|
+
file: fileNode.getEmbeddedFilePath(),
|
|
2470
|
+
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
2471
|
+
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character + item),
|
|
2472
|
+
}));
|
|
2473
|
+
const results = await Promise.all(promises);
|
|
2474
|
+
results.forEach((constRefs) => {
|
|
2475
|
+
refsList = [...refsList, ...constRefs.refs];
|
|
2476
|
+
});
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
1591
2479
|
// console.log(refsList, 'refsList');
|
|
1592
2480
|
return refsList;
|
|
1593
2481
|
}
|
|
@@ -1684,7 +2572,7 @@ class NaslServer {
|
|
|
1684
2572
|
// 因为要用下面的点位信息
|
|
1685
2573
|
const name = minRange.node.name;
|
|
1686
2574
|
// 如果name不改,那就是要改命名空间
|
|
1687
|
-
if (newValue === name) {
|
|
2575
|
+
if (node instanceof concepts_1.Frontend || newValue === name) {
|
|
1688
2576
|
const namespace = minRange.node.namespace;
|
|
1689
2577
|
// 先看下标位置
|
|
1690
2578
|
const lineText = record.lineText;
|
|
@@ -1807,6 +2695,24 @@ class NaslServer {
|
|
|
1807
2695
|
minRange.newValue = newTsNameSpace;
|
|
1808
2696
|
}
|
|
1809
2697
|
}
|
|
2698
|
+
if (node instanceof concepts_1.Frontend && minRange.node instanceof concepts_1.Destination) {
|
|
2699
|
+
const tsCalleeNamespace = minRange.node.tsCalleeNamespace;
|
|
2700
|
+
const tsName = minRange.node.tsName;
|
|
2701
|
+
const oldValue = tsCalleeNamespace + '.' + tsName;
|
|
2702
|
+
// 先看下标位置
|
|
2703
|
+
const lineText = record.lineText;
|
|
2704
|
+
const index = lineText.indexOf(oldValue);
|
|
2705
|
+
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
2706
|
+
const start = record.start.offset - index - 1;
|
|
2707
|
+
const end = record.end.offset - index - 1;
|
|
2708
|
+
if (start <= tsCalleeNamespace.length) {
|
|
2709
|
+
// 新的完整的value
|
|
2710
|
+
let newTsNameSpace = tsCalleeNamespace.substring(0, start) + newValue + tsCalleeNamespace.substring(end, tsCalleeNamespace.length);
|
|
2711
|
+
minRange.setTypeMethods = 'setViewNamespace';
|
|
2712
|
+
newTsNameSpace = newTsNameSpace.replace(/\.\$/g, '.');
|
|
2713
|
+
minRange.newValue = newTsNameSpace;
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
1810
2716
|
// 如果是事件修改
|
|
1811
2717
|
// 如果是view也需要加前缀
|
|
1812
2718
|
// logic 和 views名称修改 可能会触发bindEvent修改
|
|
@@ -2085,6 +2991,31 @@ class NaslServer {
|
|
|
2085
2991
|
}
|
|
2086
2992
|
return result;
|
|
2087
2993
|
}
|
|
2994
|
+
// 通过当前节点,查找被引用的节点
|
|
2995
|
+
async nodeFindRefNodes(node) {
|
|
2996
|
+
let refsList = await this._isHaveRef(node);
|
|
2997
|
+
// 如果查找引用查到自己里面的引用不展示
|
|
2998
|
+
refsList = refsList.filter((item) =>
|
|
2999
|
+
// 自己引用自己的过滤掉
|
|
3000
|
+
// 删除的时候过滤一把组件删除提示
|
|
3001
|
+
// 展示组件自己屏蔽掉
|
|
3002
|
+
!item.isDefinition && !item.lineText.includes(' = new nasl.ui.'));
|
|
3003
|
+
// 最后返回的结果
|
|
3004
|
+
const result = new Set();
|
|
3005
|
+
try {
|
|
3006
|
+
refsList.forEach((record) => {
|
|
3007
|
+
const fileNode = this.file2NodeMap.get(record.file);
|
|
3008
|
+
if (!fileNode)
|
|
3009
|
+
return;
|
|
3010
|
+
const minRange = this._findMinRange(record, fileNode);
|
|
3011
|
+
result.add(minRange.node);
|
|
3012
|
+
});
|
|
3013
|
+
}
|
|
3014
|
+
catch (err) {
|
|
3015
|
+
console.log(err);
|
|
3016
|
+
}
|
|
3017
|
+
return [...result];
|
|
3018
|
+
}
|
|
2088
3019
|
// 获取节点的上层渲染
|
|
2089
3020
|
_getTreeMap(minRange, fileNode, resMap, nodeMap) {
|
|
2090
3021
|
const minRangeNode = minRange.node;
|
|
@@ -2219,12 +3150,15 @@ class NaslServer {
|
|
|
2219
3150
|
// 如果没有sourceMap,就继续向上找 ,或者到module结束
|
|
2220
3151
|
// 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
|
|
2221
3152
|
// 如果当前节点是view就不要向上查找了
|
|
3153
|
+
// 配置参数的ConfigProperty也不需要向上找
|
|
2222
3154
|
while (!sourceMap
|
|
2223
3155
|
&& fileNode
|
|
2224
3156
|
&& !(fileNode.parentNode instanceof concepts_1.App)
|
|
2225
3157
|
&& !(fileNode.parentNode instanceof concepts_1.Module)
|
|
2226
3158
|
&& !(fileNode.parentNode instanceof concepts_1.DataSource)
|
|
2227
|
-
&& !(fileNode instanceof concepts_1.
|
|
3159
|
+
&& !(fileNode.parentNode instanceof concepts_1.Frontend)
|
|
3160
|
+
&& !(fileNode instanceof concepts_1.View)
|
|
3161
|
+
&& !(fileNode instanceof concepts_1.ConfigProperty)) {
|
|
2228
3162
|
fileNode = fileNode.parentNode;
|
|
2229
3163
|
sourceMap = fileNode?.sourceMap;
|
|
2230
3164
|
}
|
|
@@ -2344,7 +3278,7 @@ class NaslServer {
|
|
|
2344
3278
|
if (node instanceof concepts_1.Param) {
|
|
2345
3279
|
// index在nasl foreach上有脏数据
|
|
2346
3280
|
if (node.parentKey === 'index' && node.parentNode instanceof concepts_1.ForEachStatement) {
|
|
2347
|
-
return concepts_1.TypeAnnotation.createPrimitive('
|
|
3281
|
+
return concepts_1.TypeAnnotation.createPrimitive('Long');
|
|
2348
3282
|
}
|
|
2349
3283
|
}
|
|
2350
3284
|
if (node instanceof concepts_1.CallQueryComponent || node instanceof concepts_1.SqlQueryComponent || node instanceof concepts_1.OqlQueryComponent) {
|
|
@@ -2398,6 +3332,11 @@ class NaslServer {
|
|
|
2398
3332
|
types.set(node, node.typeAnnotation);
|
|
2399
3333
|
return;
|
|
2400
3334
|
}
|
|
3335
|
+
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
3336
|
+
// 只有虚拟节点的入参,才没有类型
|
|
3337
|
+
if (node.concept === 'Param' && node.parentKey !== 'virtualParams') {
|
|
3338
|
+
return;
|
|
3339
|
+
}
|
|
2401
3340
|
if (![
|
|
2402
3341
|
'Identifier',
|
|
2403
3342
|
'UnaryExpression',
|
|
@@ -2412,6 +3351,10 @@ class NaslServer {
|
|
|
2412
3351
|
'NewComposite',
|
|
2413
3352
|
'NewList',
|
|
2414
3353
|
'NewMap',
|
|
3354
|
+
'OqlQueryComponent',
|
|
3355
|
+
'QueryFieldExpression',
|
|
3356
|
+
'QueryGroupByExpression',
|
|
3357
|
+
'Param',
|
|
2415
3358
|
].includes(node.concept))
|
|
2416
3359
|
return;
|
|
2417
3360
|
// 要去ls那边获取的
|
|
@@ -2421,6 +3364,7 @@ class NaslServer {
|
|
|
2421
3364
|
line: (0, translator_1.lsp2tspNumber)(item.range.start.line),
|
|
2422
3365
|
offset: (0, translator_1.lsp2tspNumber)(item.range.start.character),
|
|
2423
3366
|
};
|
|
3367
|
+
// 位置计算偏移
|
|
2424
3368
|
if (node.concept === 'BinaryExpression'
|
|
2425
3369
|
|| node.concept === 'CallLogic'
|
|
2426
3370
|
|| node.concept === 'CallFunction'
|
|
@@ -2446,7 +3390,7 @@ class NaslServer {
|
|
|
2446
3390
|
}
|
|
2447
3391
|
fileDetail.offset = fileDetail.offset + indexOf;
|
|
2448
3392
|
}
|
|
2449
|
-
else if (node.concept === 'MemberExpression' || node.concept === 'Identifier') {
|
|
3393
|
+
else if (node.concept === 'MemberExpression' || node.concept === 'Identifier' || node.concept === 'QueryFieldExpression' || node.concept === 'QueryGroupByExpression') {
|
|
2450
3394
|
if (item.code.includes('.')) {
|
|
2451
3395
|
const codeArr = item.code?.split('.');
|
|
2452
3396
|
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
@@ -2457,7 +3401,12 @@ class NaslServer {
|
|
|
2457
3401
|
}
|
|
2458
3402
|
else if (node.concept === 'Match') {
|
|
2459
3403
|
// 去查return 后面的返回值,变成函数调用
|
|
2460
|
-
|
|
3404
|
+
if (item.code?.endsWith(';\n')) {
|
|
3405
|
+
fileDetail.line = item.range.end.line - 1;
|
|
3406
|
+
}
|
|
3407
|
+
else {
|
|
3408
|
+
fileDetail.line = item.range.end.line;
|
|
3409
|
+
}
|
|
2461
3410
|
const indexOf = item.code.indexOf('return __MatchExpressionFuntion');
|
|
2462
3411
|
let newCode = item.code.substring(0, indexOf);
|
|
2463
3412
|
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
@@ -2470,11 +3419,14 @@ class NaslServer {
|
|
|
2470
3419
|
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
2471
3420
|
fileDetail.offset = newCode.length + 'return '.length;
|
|
2472
3421
|
}
|
|
3422
|
+
else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
3423
|
+
fileDetail.offset += 10;
|
|
3424
|
+
}
|
|
2473
3425
|
args.push(fileDetail);
|
|
2474
3426
|
});
|
|
2475
|
-
console.time('请求');
|
|
3427
|
+
// console.time('请求');
|
|
2476
3428
|
const resultMap = (await this.getNaslNodeTypeFull(args)).response;
|
|
2477
|
-
console.timeEnd('请求');
|
|
3429
|
+
// console.timeEnd('请求');
|
|
2478
3430
|
// console.log(resultMap);
|
|
2479
3431
|
// const result = (await this.getNaslNodeQuickInfoFull(args)).response;
|
|
2480
3432
|
// console.log(result);
|
|
@@ -2487,7 +3439,7 @@ class NaslServer {
|
|
|
2487
3439
|
// console.log('方案2:', item?.[0]?.nodeType);
|
|
2488
3440
|
const nodeTypeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(item?.[0]?.nodeType);
|
|
2489
3441
|
// console.log(newQuickInfoNodes[index].node, nodeTypeAnnotation, nodeTypeAnnotation?.typeKey);
|
|
2490
|
-
types.set(newQuickInfoNodes[index].node, nodeTypeAnnotation);
|
|
3442
|
+
types.set(newQuickInfoNodes[index].node, Object.freeze(nodeTypeAnnotation));
|
|
2491
3443
|
newQuickInfoNodes[index].node.__nodeType = Object.freeze(item?.[0]?.nodeType);
|
|
2492
3444
|
// console.log('方案1:', displayString1);
|
|
2493
3445
|
});
|
|
@@ -2507,8 +3459,8 @@ class NaslServer {
|
|
|
2507
3459
|
// 直接从最后一项的返回值取,有就有没有就没有
|
|
2508
3460
|
if (node.body?.length) {
|
|
2509
3461
|
const last = node.body[node.body.length - 1];
|
|
2510
|
-
if (last
|
|
2511
|
-
types.set(node, last
|
|
3462
|
+
if (types.get(last)) {
|
|
3463
|
+
types.set(node, types.get(last));
|
|
2512
3464
|
}
|
|
2513
3465
|
}
|
|
2514
3466
|
}
|
|
@@ -2519,11 +3471,24 @@ class NaslServer {
|
|
|
2519
3471
|
// 因为node可能是经过处理的TypeAnnotation
|
|
2520
3472
|
node.__isCorrectTypeAnnotation = true;
|
|
2521
3473
|
if (value) {
|
|
3474
|
+
if (node instanceof concepts_1.OqlQueryComponent) {
|
|
3475
|
+
// 自动推导情况
|
|
3476
|
+
const typeAnnotation = value;
|
|
3477
|
+
if (!node.typeAnnotation && typeAnnotation) {
|
|
3478
|
+
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
3479
|
+
const typeArguments = typeAnnotation.typeArguments;
|
|
3480
|
+
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
3481
|
+
node.__TypeAnnotation = null;
|
|
3482
|
+
return;
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
2522
3487
|
if (value instanceof concepts_1.TypeAnnotation) {
|
|
2523
|
-
node.__TypeAnnotation =
|
|
3488
|
+
node.__TypeAnnotation = value;
|
|
2524
3489
|
}
|
|
2525
3490
|
else if (value.typeAnnotation) {
|
|
2526
|
-
node.__TypeAnnotation =
|
|
3491
|
+
node.__TypeAnnotation = value.typeAnnotation;
|
|
2527
3492
|
}
|
|
2528
3493
|
}
|
|
2529
3494
|
else {
|
|
@@ -2533,7 +3498,7 @@ class NaslServer {
|
|
|
2533
3498
|
}
|
|
2534
3499
|
catch (err) {
|
|
2535
3500
|
if (globalThis.window) {
|
|
2536
|
-
console.log(err);
|
|
3501
|
+
// console.log(err);
|
|
2537
3502
|
}
|
|
2538
3503
|
}
|
|
2539
3504
|
});
|
|
@@ -2588,7 +3553,9 @@ class NaslServer {
|
|
|
2588
3553
|
}
|
|
2589
3554
|
// 全量标注并且返回json
|
|
2590
3555
|
async getNaslAnnotatedJSON(app, releaseFlag) {
|
|
2591
|
-
|
|
3556
|
+
if (this.changeStackList?.length) {
|
|
3557
|
+
throw new Error(`当前还有${this.changeStackList.length}个文件还在执行更新操作,请稍后再试!或刷新后重试!`);
|
|
3558
|
+
}
|
|
2592
3559
|
const nodes = [];
|
|
2593
3560
|
this.file2NodeMap.forEach((fileNode, filePath) => {
|
|
2594
3561
|
// 先不排除view,传递给后端的时候,去除views下的标注
|
|
@@ -2602,6 +3569,7 @@ class NaslServer {
|
|
|
2602
3569
|
});
|
|
2603
3570
|
}
|
|
2604
3571
|
});
|
|
3572
|
+
console.time('全量标注');
|
|
2605
3573
|
const typesMap = await this.getQuickInfoNodesTypeMap(nodes, true);
|
|
2606
3574
|
// console.log(typesMap, 'typesMap')
|
|
2607
3575
|
console.timeEnd('全量标注');
|
|
@@ -2613,24 +3581,6 @@ class NaslServer {
|
|
|
2613
3581
|
}
|
|
2614
3582
|
return json;
|
|
2615
3583
|
}
|
|
2616
|
-
// 加载全量nasl节点标注
|
|
2617
|
-
async createdNaslAnnotatedJSON(app) {
|
|
2618
|
-
// 全量标注
|
|
2619
|
-
const nodes = [];
|
|
2620
|
-
this.file2NodeMap.forEach((fileNode, filePath) => {
|
|
2621
|
-
// 先不排除view,传递给后端的时候,去除views下的标注
|
|
2622
|
-
if (!['Structure', 'DataSource', 'Entity', 'Enum', 'Role'].includes(fileNode.concept)) {
|
|
2623
|
-
fileNode.sourceMap.forEach((item, node) => {
|
|
2624
|
-
nodes.push({
|
|
2625
|
-
filePath,
|
|
2626
|
-
node,
|
|
2627
|
-
item,
|
|
2628
|
-
});
|
|
2629
|
-
});
|
|
2630
|
-
}
|
|
2631
|
-
});
|
|
2632
|
-
await this.getQuickInfoNodesTypeMap(nodes, true);
|
|
2633
|
-
}
|
|
2634
3584
|
// 增量标注
|
|
2635
3585
|
async IncrementalAnnotationJSON(records) {
|
|
2636
3586
|
console.time('增量标注');
|
|
@@ -2672,7 +3622,7 @@ class NaslServer {
|
|
|
2672
3622
|
}
|
|
2673
3623
|
}
|
|
2674
3624
|
// 旧版本数据查询需要确认是匿名数据结构的 ListTotal 类型
|
|
2675
|
-
if (node instanceof concepts_1.CallQueryComponent && node.
|
|
3625
|
+
if (node instanceof concepts_1.CallQueryComponent && !node.isAutoInfer()) {
|
|
2676
3626
|
const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
|
|
2677
3627
|
jsonNode.typeAnnotation = {
|
|
2678
3628
|
concept: 'TypeAnnotation',
|
|
@@ -2706,7 +3656,7 @@ class NaslServer {
|
|
|
2706
3656
|
concept: 'TypeAnnotation',
|
|
2707
3657
|
typeKind: 'primitive',
|
|
2708
3658
|
typeNamespace: 'nasl.core',
|
|
2709
|
-
typeName: '
|
|
3659
|
+
typeName: 'Long',
|
|
2710
3660
|
typeArguments: null,
|
|
2711
3661
|
inferred: null,
|
|
2712
3662
|
},
|
|
@@ -2720,7 +3670,7 @@ class NaslServer {
|
|
|
2720
3670
|
// index在nasl foreach上有脏数据
|
|
2721
3671
|
if (node.parentKey === 'index' && node.parentNode instanceof concepts_1.ForEachStatement) {
|
|
2722
3672
|
const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
|
|
2723
|
-
jsonNode.typeAnnotation = concepts_1.TypeAnnotation.createPrimitive('
|
|
3673
|
+
jsonNode.typeAnnotation = concepts_1.TypeAnnotation.createPrimitive('Long').toJSON();
|
|
2724
3674
|
}
|
|
2725
3675
|
}
|
|
2726
3676
|
if (node instanceof concepts_1.Match) {
|
|
@@ -2743,6 +3693,10 @@ class NaslServer {
|
|
|
2743
3693
|
jsonNode.typeAnnotation = value.toJSON();
|
|
2744
3694
|
}
|
|
2745
3695
|
}
|
|
3696
|
+
if (node instanceof concepts_1.NewComposite && node.typeAnnotation?.typeKind === 'anonymousStructure') {
|
|
3697
|
+
const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
|
|
3698
|
+
jsonNode.typeAnnotation = value.toJSON();
|
|
3699
|
+
}
|
|
2746
3700
|
});
|
|
2747
3701
|
}
|
|
2748
3702
|
/**
|
|
@@ -2752,7 +3706,7 @@ class NaslServer {
|
|
|
2752
3706
|
*/
|
|
2753
3707
|
getArgumentTypeAnnotation(node, QuickInfoNodes, types) {
|
|
2754
3708
|
// 直接复用内部expression的type类型
|
|
2755
|
-
if (node.parentNode instanceof concepts_1.CallLogic && node.parentNode.calleeNamespace
|
|
3709
|
+
if (node.parentNode instanceof concepts_1.CallLogic && node.parentNode.calleeNamespace?.includes('entities') && node.parentNode.calleeNamespace?.includes('logics') && node.parentNode.calleeName === 'delete') {
|
|
2756
3710
|
const nodeType = node.parentNode?.__nodeType;
|
|
2757
3711
|
if (nodeType && Array.isArray(nodeType.fnParams)) {
|
|
2758
3712
|
const index = node.parentNode.arguments.indexOf(node);
|
|
@@ -2770,7 +3724,7 @@ class NaslServer {
|
|
|
2770
3724
|
const App = node.app;
|
|
2771
3725
|
const parent = (node.parentNode);
|
|
2772
3726
|
// 如果nasl包下的 ,很多声明都含有T啥的先用自己内部的
|
|
2773
|
-
if (!parent.calleeNamespace || parent.calleeNamespace
|
|
3727
|
+
if (!parent.calleeNamespace || parent.calleeNamespace?.startsWith('nasl')) {
|
|
2774
3728
|
if (types.get(node.expression)) {
|
|
2775
3729
|
return {
|
|
2776
3730
|
typeAnnotation: types.get(node.expression),
|
|
@@ -2883,6 +3837,12 @@ class NaslServer {
|
|
|
2883
3837
|
// 如果是要删除的内容,就是当前的file节点,要关闭当前文件,就把内容置为空
|
|
2884
3838
|
if (fileNode === targetNode) {
|
|
2885
3839
|
outputFiles = [{ file: filePath, fileContent: '' }];
|
|
3840
|
+
// 去掉原来存储的当前节点的nasl内存的存储,和错误的存储
|
|
3841
|
+
// 已经删除的就不用在去check错误了
|
|
3842
|
+
// check就会去取类型啥的,没有必要
|
|
3843
|
+
this.diagnosticManager.deleteOwn(fileNode.id);
|
|
3844
|
+
// 删除文件同时删除ls存储nasl 的引用
|
|
3845
|
+
this.file2NodeMap.delete(filePath);
|
|
2886
3846
|
}
|
|
2887
3847
|
else {
|
|
2888
3848
|
// 如果是要删除logic一个小内容,要覆盖全部内容
|
|
@@ -2891,7 +3851,7 @@ class NaslServer {
|
|
|
2891
3851
|
}
|
|
2892
3852
|
// 更新文件之后
|
|
2893
3853
|
await this.updateFiles({ outputFiles });
|
|
2894
|
-
newRefs.refs.forEach((ref) => filesToCheck.add(ref.file));
|
|
3854
|
+
newRefs.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
2895
3855
|
}
|
|
2896
3856
|
/**
|
|
2897
3857
|
* 除去rename场景下的更新
|
|
@@ -2910,13 +3870,17 @@ class NaslServer {
|
|
|
2910
3870
|
line: EmbeddedTSFileLineMap[fileNode.concept] ?? 2,
|
|
2911
3871
|
offset: EmbeddedTSFileOffsetMap[fileNode.concept] ?? 6,
|
|
2912
3872
|
});
|
|
2913
|
-
|
|
3873
|
+
const files = new Set();
|
|
3874
|
+
newRefs.refs.forEach((ref) => {
|
|
3875
|
+
this.filesToCheck.add(ref.file);
|
|
3876
|
+
files.add(ref.file);
|
|
3877
|
+
});
|
|
2914
3878
|
// 唤起建立连接弹框
|
|
2915
3879
|
// 文件级别的建立连接采取提醒
|
|
2916
3880
|
if (action === 'create' && targetNode.__init) {
|
|
2917
3881
|
// 清除临时状态, 完成本次创建
|
|
2918
3882
|
delete targetNode.__init;
|
|
2919
|
-
if (fileNode === targetNode &&
|
|
3883
|
+
if (fileNode === targetNode && files.size > 1) {
|
|
2920
3884
|
const confirmParms = {
|
|
2921
3885
|
actionType: 'createEstablishConnection',
|
|
2922
3886
|
node: fileNode,
|
|
@@ -2950,8 +3914,8 @@ class NaslServer {
|
|
|
2950
3914
|
line: EmbeddedTSFileLineMap[fileNode.concept] ?? 2,
|
|
2951
3915
|
offset: EmbeddedTSFileOffsetMap[fileNode.concept] ?? 6,
|
|
2952
3916
|
});
|
|
2953
|
-
oldRefs.refs.forEach((ref) => filesToCheck.add(ref.file));
|
|
2954
|
-
filesToCheck.delete(oldFilePath);
|
|
3917
|
+
oldRefs.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
3918
|
+
this.filesToCheck.delete(oldFilePath);
|
|
2955
3919
|
// 更新文件之后
|
|
2956
3920
|
await this.updateFiles({ outputFiles });
|
|
2957
3921
|
// 查一下新函数名的依赖
|
|
@@ -2962,7 +3926,7 @@ class NaslServer {
|
|
|
2962
3926
|
});
|
|
2963
3927
|
const newRefFileList = new Set();
|
|
2964
3928
|
newRefs.refs.forEach((ref) => {
|
|
2965
|
-
filesToCheck.add(ref.file);
|
|
3929
|
+
this.filesToCheck.add(ref.file);
|
|
2966
3930
|
newRefFileList.add(ref.file);
|
|
2967
3931
|
});
|
|
2968
3932
|
// 文件级别重命名,有依赖才唤起弹框
|
|
@@ -2989,7 +3953,7 @@ class NaslServer {
|
|
|
2989
3953
|
line: EmbeddedTSFileLineMap[fileNode.concept] ?? 2,
|
|
2990
3954
|
offset: EmbeddedTSFileOffsetMap[fileNode.concept] ?? 6,
|
|
2991
3955
|
});
|
|
2992
|
-
newRefs2.refs.forEach((ref) => filesToCheck.add(ref.file));
|
|
3956
|
+
newRefs2.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
2993
3957
|
}
|
|
2994
3958
|
else {
|
|
2995
3959
|
// 查一下当前属性依赖的文件
|
|
@@ -3004,7 +3968,7 @@ class NaslServer {
|
|
|
3004
3968
|
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
3005
3969
|
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character),
|
|
3006
3970
|
});
|
|
3007
|
-
oldRefs.refs.forEach((ref) => filesToCheck.add(ref.file));
|
|
3971
|
+
oldRefs.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
3008
3972
|
// 更新文件之后
|
|
3009
3973
|
await this.updateFiles({ outputFiles });
|
|
3010
3974
|
const newRefs2 = await this.references({
|
|
@@ -3012,7 +3976,7 @@ class NaslServer {
|
|
|
3012
3976
|
line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
|
|
3013
3977
|
offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character),
|
|
3014
3978
|
});
|
|
3015
|
-
newRefs2.refs.forEach((ref) => filesToCheck.add(ref.file));
|
|
3979
|
+
newRefs2.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
3016
3980
|
}
|
|
3017
3981
|
}
|
|
3018
3982
|
}
|
|
@@ -3027,6 +3991,31 @@ class NaslServer {
|
|
|
3027
3991
|
*/
|
|
3028
3992
|
async incidentalAction(action, fileNode, targetNode, oldpath) {
|
|
3029
3993
|
if ((action === 'create' || action === 'delete' || (action === 'update' && oldpath)) && fileNode === targetNode) {
|
|
3994
|
+
//删除、更改、新增端
|
|
3995
|
+
if (fileNode instanceof concepts_1.Frontend && (fileNode.views?.length || fileNode.variables?.length)) {
|
|
3996
|
+
const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
|
|
3997
|
+
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
3998
|
+
const fileNodeItem = fileNodeChildren[i];
|
|
3999
|
+
const result = fileNodeItem.toEmbeddedTSFile();
|
|
4000
|
+
fileNodeItem.sourceMap = result.sourceMap;
|
|
4001
|
+
if (action === 'create') {
|
|
4002
|
+
await this.handleChange(fileNodeItem, fileNodeItem, result, action);
|
|
4003
|
+
await this.incidentalAction(action, fileNodeItem, fileNodeItem);
|
|
4004
|
+
}
|
|
4005
|
+
else if (action === 'delete') {
|
|
4006
|
+
await this.handleDelete(fileNodeItem, fileNodeItem, result);
|
|
4007
|
+
await this.incidentalAction(action, fileNodeItem, fileNodeItem);
|
|
4008
|
+
}
|
|
4009
|
+
else if (action === 'update' && oldpath) {
|
|
4010
|
+
const parentPath = oldpath.replace('.ts', '/');
|
|
4011
|
+
const foldName = fileNodeItem.concept === 'View' ? 'views' : 'variables';
|
|
4012
|
+
const currentOldPath = parentPath + foldName + '/' + fileNodeItem.name + '.ts';
|
|
4013
|
+
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4014
|
+
await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
|
|
4015
|
+
await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
}
|
|
3030
4019
|
// 删除或者新增页面
|
|
3031
4020
|
if (fileNode instanceof concepts_1.View && fileNode.children?.length) {
|
|
3032
4021
|
const fileNodeChildren = fileNode.children;
|
|
@@ -3101,14 +4090,14 @@ class NaslServer {
|
|
|
3101
4090
|
}
|
|
3102
4091
|
}
|
|
3103
4092
|
async receiveHandleChange($event) {
|
|
3104
|
-
singleFileChangeIng = true;
|
|
4093
|
+
this.singleFileChangeIng = true;
|
|
3105
4094
|
// 行为
|
|
3106
4095
|
const action = $event.action;
|
|
3107
4096
|
const targetNode = $event.target;
|
|
3108
4097
|
// 当前操作的文件节点
|
|
3109
4098
|
const { fileNode } = this.getCurrentSource(targetNode);
|
|
3110
4099
|
// 如果是导入模块就,就引入对应模块,先不处理module和Configuration,下面的内容会自动创建
|
|
3111
|
-
if (!fileNode || fileNode instanceof concepts_1.Module || fileNode instanceof concepts_1.Configuration) {
|
|
4100
|
+
if (!fileNode || fileNode instanceof concepts_1.Module || fileNode instanceof concepts_1.Configuration || fileNode instanceof concepts_1.Integration) {
|
|
3112
4101
|
// module单独处理
|
|
3113
4102
|
if (fileNode instanceof concepts_1.Module) {
|
|
3114
4103
|
await this.incidentalAction(action, fileNode, targetNode);
|
|
@@ -3148,20 +4137,20 @@ class NaslServer {
|
|
|
3148
4137
|
return true;
|
|
3149
4138
|
}
|
|
3150
4139
|
changeFileNext() {
|
|
3151
|
-
if (!singleFileChangeIng) {
|
|
4140
|
+
if (!this.singleFileChangeIng) {
|
|
3152
4141
|
const item = this.changeStackList.shift();
|
|
3153
4142
|
this.receiveHandleChange(item).catch((err) => {
|
|
3154
4143
|
console.log(err, 'receiveHandleChangeErr');
|
|
3155
4144
|
}).finally(async () => {
|
|
3156
4145
|
// 每一个文件与change接触就把状态置为false,让下一个进入
|
|
3157
|
-
singleFileChangeIng = false;
|
|
4146
|
+
this.singleFileChangeIng = false;
|
|
3158
4147
|
if (this.changeStackList.length) {
|
|
3159
4148
|
this.changeFileNext();
|
|
3160
4149
|
}
|
|
3161
4150
|
else {
|
|
3162
|
-
console.
|
|
3163
|
-
await this.getDiagnosticRecordsAndPushAll(Array.from(filesToCheck));
|
|
3164
|
-
filesToCheck.clear();
|
|
4151
|
+
console.info(Array.from(this.filesToCheck));
|
|
4152
|
+
await this.getDiagnosticRecordsAndPushAll(Array.from(this.filesToCheck));
|
|
4153
|
+
this.filesToCheck.clear();
|
|
3165
4154
|
}
|
|
3166
4155
|
});
|
|
3167
4156
|
}
|