@lcap/nasl 3.3.0-beta.0 → 3.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/bak/translator.js +5 -8
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/generator/AfterStartNode.js +1 -2
- package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
- package/out/breakpoint/generator/BeforeEndNode.js +1 -2
- package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
- package/out/breakpoint/generator/BreakpointNode.js +9 -30
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
- package/out/breakpoint/shared/constants.d.ts +0 -1
- package/out/breakpoint/shared/constants.js +1 -7
- package/out/breakpoint/shared/constants.js.map +1 -1
- package/out/breakpoint/shared/utils.d.ts +1 -3
- package/out/breakpoint/shared/utils.js +4 -25
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/common/BaseNode.d.ts +8 -21
- package/out/common/BaseNode.js +69 -115
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.js +1 -6
- package/out/common/Command.js.map +1 -1
- package/out/common/EventEmitter.d.ts +1 -1
- package/out/common/EventEmitter.js +3 -1
- package/out/common/EventEmitter.js.map +1 -1
- package/out/common/classMap.d.ts +4 -0
- package/out/common/classMap.js +5 -0
- package/out/common/classMap.js.map +1 -0
- package/out/common/index.d.ts +1 -0
- package/out/common/index.js +1 -0
- package/out/common/index.js.map +1 -1
- package/out/concepts/Abort__.d.ts +2 -3
- package/out/concepts/Abort__.js +18 -15
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.d.ts +3 -3
- package/out/concepts/Anchor__.js +35 -18
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +3 -3
- package/out/concepts/AnonymousFunction__.js +53 -29
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +157 -160
- package/out/concepts/App__.js +80 -106
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +3 -3
- package/out/concepts/Argument__.js +42 -22
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +2 -3
- package/out/concepts/Assignee__.js +21 -19
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +2 -3
- package/out/concepts/AssignmentLine__.js +17 -15
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +3 -3
- package/out/concepts/Assignment__.js +42 -34
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +2 -3
- package/out/concepts/Attribute__.js +28 -36
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthInterface__.d.ts +3 -4
- package/out/concepts/AuthInterface__.js +17 -16
- package/out/concepts/AuthInterface__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.d.ts +3 -4
- package/out/concepts/AuthLogicForCallInterface__.js +27 -37
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.d.ts +3 -4
- package/out/concepts/AuthLogic__.js +19 -18
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +7 -8
- package/out/concepts/BackendVariable__.js +34 -39
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.d.ts +31 -32
- package/out/concepts/Backend__.js +22 -23
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +3 -3
- package/out/concepts/BatchAssignment__.js +54 -46
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +3 -3
- package/out/concepts/BinaryExpression__.js +62 -30
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +9 -12
- package/out/concepts/BindAttribute__.js +102 -81
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +3 -5
- package/out/concepts/BindDirective__.js +28 -34
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +3 -3
- package/out/concepts/BindEvent__.js +74 -51
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +3 -5
- package/out/concepts/BindStyle__.js +23 -24
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +3 -3
- package/out/concepts/BooleanLiteral__.js +24 -17
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +2 -3
- package/out/concepts/CallAuthInterface__.js +19 -17
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +4 -5
- package/out/concepts/CallConnector__.js +34 -41
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +3 -3
- package/out/concepts/CallFunction__.js +71 -33
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +3 -3
- package/out/concepts/CallInterface__.js +57 -26
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +6 -6
- package/out/concepts/CallLogic__.js +180 -135
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +2 -3
- package/out/concepts/CallQueryComponent__.js +41 -57
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +3 -3
- package/out/concepts/Comment__.js +24 -17
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.d.ts +2 -3
- package/out/concepts/CompletionProperty__.js +25 -30
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +2 -3
- package/out/concepts/ConfigGroup__.js +20 -21
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.d.ts +2 -3
- package/out/concepts/ConfigPropertyValue__.js +16 -16
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +2 -3
- package/out/concepts/ConfigProperty__.js +23 -26
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +2 -3
- package/out/concepts/Configuration__.js +18 -16
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +4 -4
- package/out/concepts/Connection__.js +18 -22
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/ConnectorTrigger__.d.ts +6 -7
- package/out/concepts/ConnectorTrigger__.js +21 -22
- package/out/concepts/ConnectorTrigger__.js.map +1 -1
- package/out/concepts/Connector__.d.ts +33 -139
- package/out/concepts/Connector__.js +34 -191
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +2 -3
- package/out/concepts/Constant__.js +23 -25
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.d.ts +46 -0
- package/out/concepts/DataElement__.js +118 -0
- package/out/concepts/DataElement__.js.map +1 -0
- package/out/concepts/DataSource__.d.ts +2 -7
- package/out/concepts/DataSource__.js +23 -31
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +4 -5
- package/out/concepts/DatabaseTypeAnnotation__.js +18 -18
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +11 -11
- package/out/concepts/Destination__.js +89 -39
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.d.ts +2 -3
- package/out/concepts/End__.js +17 -15
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +3 -4
- package/out/concepts/EntityIndex__.js +21 -23
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +4 -4
- package/out/concepts/EntityProperty__.js +67 -51
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +3 -3
- package/out/concepts/Entity__.js +51 -32
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +3 -3
- package/out/concepts/EnumItem__.js +25 -19
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +3 -3
- package/out/concepts/Enum__.js +35 -23
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.d.ts +2 -3
- package/out/concepts/Event__.js +21 -24
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +5 -6
- package/out/concepts/ExternalDestination__.js +25 -25
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +3 -3
- package/out/concepts/ForEachStatement__.js +60 -21
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +3 -4
- package/out/concepts/FrontendLibrary__.js +25 -27
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/FrontendVariable__.d.ts +3 -4
- package/out/concepts/FrontendVariable__.js +12 -12
- package/out/concepts/FrontendVariable__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +6 -8
- package/out/concepts/Frontend__.js +39 -47
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.d.ts +3 -3
- package/out/concepts/Function__.js +60 -37
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +3 -4
- package/out/concepts/Identifier__.js +29 -30
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +3 -3
- package/out/concepts/IfStatement__.js +51 -21
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.d.ts +2 -93
- package/out/concepts/Integration__.js +19 -157
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +4 -30
- package/out/concepts/InterfaceParam__.js +24 -58
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +5 -31
- package/out/concepts/Interface__.js +34 -89
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +3 -3
- package/out/concepts/JSBlock__.js +24 -17
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +3 -4
- package/out/concepts/JavaLogic__.js +21 -22
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +8 -3
- package/out/concepts/LogicItem__.js +30 -23
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +18 -17
- package/out/concepts/Logic__.js +188 -113
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +3 -3
- package/out/concepts/MatchCase__.js +110 -23
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +3 -3
- package/out/concepts/Match__.js +64 -20
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +3 -3
- package/out/concepts/MemberExpression__.js +59 -65
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MicroApp__.d.ts +2 -3
- package/out/concepts/MicroApp__.js +21 -26
- package/out/concepts/MicroApp__.js.map +1 -1
- package/out/concepts/Module__.d.ts +47 -219
- package/out/concepts/Module__.js +32 -232
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.d.ts +3 -4
- package/out/concepts/MsgTriggerEvent__.js +18 -16
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.d.ts +3 -4
- package/out/concepts/MsgTriggerLauncher__.js +19 -18
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +2 -4
- package/out/concepts/Namespace__.js +46 -64
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +3 -4
- package/out/concepts/NewComposite__.js +133 -71
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +4 -5
- package/out/concepts/NewList__.js +41 -35
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +4 -5
- package/out/concepts/NewMap__.js +38 -39
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.d.ts +2 -3
- package/out/concepts/New__.js +17 -15
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +2 -3
- package/out/concepts/NullLiteral__.js +17 -15
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +3 -3
- package/out/concepts/NumericLiteral__.js +27 -21
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +3 -3
- package/out/concepts/OqlQueryComponent__.js +30 -26
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +22 -14
- package/out/concepts/OverriddenLogic__.js +62 -73
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.d.ts +3 -3
- package/out/concepts/Param__.js +69 -34
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.d.ts +2 -3
- package/out/concepts/Point__.js +16 -16
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.d.ts +2 -3
- package/out/concepts/ProcessComponent__.js +22 -24
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +2 -3
- package/out/concepts/ProcessElement__.js +46 -61
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +2 -3
- package/out/concepts/ProcessOutcome__.js +18 -17
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +2 -3
- package/out/concepts/ProcessOutcomes__.js +17 -15
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +7 -5
- package/out/concepts/Process__.js +35 -46
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +2 -3
- package/out/concepts/QueryAggregateExpression__.js +22 -23
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +3 -4
- package/out/concepts/QueryFieldExpression__.js +20 -21
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +3 -4
- package/out/concepts/QueryFromExpression__.js +22 -23
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +2 -3
- package/out/concepts/QueryGroupByExpression__.js +19 -18
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +3 -4
- package/out/concepts/QueryJoinExpression__.js +25 -29
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +2 -3
- package/out/concepts/QueryLimitExpression__.js +22 -22
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +2 -3
- package/out/concepts/QueryOrderByExpression__.js +22 -22
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.d.ts +2 -3
- package/out/concepts/QuerySelectExpression__.js +21 -23
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.d.ts +2 -3
- package/out/concepts/Rect__.js +18 -20
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +3 -3
- package/out/concepts/Return__.js +45 -29
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +2 -3
- package/out/concepts/Role__.js +21 -22
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +2 -3
- package/out/concepts/SelectMembers__.js +21 -20
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.d.ts +2 -3
- package/out/concepts/Slot__.js +22 -26
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +3 -3
- package/out/concepts/SqlQueryComponent__.js +31 -28
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.d.ts +2 -3
- package/out/concepts/Start__.js +17 -15
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +3 -3
- package/out/concepts/StringInterpolation__.js +37 -17
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +3 -3
- package/out/concepts/StringLiteral__.js +22 -14
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +5 -5
- package/out/concepts/StructureProperty__.js +40 -33
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +12 -3
- package/out/concepts/Structure__.js +46 -45
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +3 -3
- package/out/concepts/SwitchCase__.js +54 -19
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +3 -3
- package/out/concepts/SwitchStatement__.js +39 -23
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.d.ts +2 -3
- package/out/concepts/Theme__.js +14 -12
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +2 -3
- package/out/concepts/Transactional__.js +17 -18
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TriggerEvent__.d.ts +2 -3
- package/out/concepts/TriggerEvent__.js +18 -19
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.d.ts +17 -6
- package/out/concepts/TriggerLauncher__.js +63 -26
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +6 -8
- package/out/concepts/TypeAnnotation__.js +79 -56
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +3 -3
- package/out/concepts/TypeParam__.js +23 -16
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +3 -3
- package/out/concepts/UnaryExpression__.js +39 -21
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +3 -3
- package/out/concepts/Unparsed__.js +23 -16
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.d.ts +2 -3
- package/out/concepts/UseComponent__.js +16 -16
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +16 -17
- package/out/concepts/ValidationRule__.js +15 -18
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +3 -3
- package/out/concepts/Variable__.js +45 -29
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.d.ts +3 -4
- package/out/concepts/ViewBlock__.js +19 -20
- package/out/concepts/ViewBlock__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +31 -32
- package/out/concepts/ViewComponent__.js +32 -35
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +81 -82
- package/out/concepts/ViewElement__.js +155 -259
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +4 -5
- package/out/concepts/View__.js +207 -141
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +3 -3
- package/out/concepts/WhileStatement__.js +41 -20
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -0
- package/out/concepts/index__.js +1 -0
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/types__.d.ts +2 -2
- package/out/decorators/index.d.ts +0 -2
- package/out/decorators/index.js +8 -12
- package/out/decorators/index.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +2 -2
- package/out/generator/genBundleFiles.js +4 -11
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genReleaseBody.d.ts +2 -4
- package/out/generator/genReleaseBody.js +136 -192
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/natural/RequirementAnalyzer.d.ts +22 -0
- package/out/natural/RequirementAnalyzer.js +196 -0
- package/out/natural/RequirementAnalyzer.js.map +1 -0
- package/out/natural/RequirementExecutor.d.ts +51 -0
- package/out/natural/RequirementExecutor.js +692 -0
- package/out/natural/RequirementExecutor.js.map +1 -0
- package/out/natural/componentData.d.ts +31 -0
- package/out/natural/componentData.js +85 -0
- package/out/natural/componentData.js.map +1 -0
- package/out/natural/genNaturalTS.d.ts +3 -0
- package/out/natural/genNaturalTS.js +90 -0
- package/out/natural/genNaturalTS.js.map +1 -0
- package/out/natural/index.d.ts +4 -0
- package/out/natural/index.js +21 -0
- package/out/natural/index.js.map +1 -0
- package/out/natural/knowledgeMap.d.ts +4 -0
- package/out/natural/knowledgeMap.js +40 -0
- package/out/natural/knowledgeMap.js.map +1 -0
- package/out/natural/naslStdlibMap.d.ts +2 -0
- package/out/natural/naslStdlibMap.js +26 -0
- package/out/natural/naslStdlibMap.js.map +1 -0
- package/out/natural/transformTSCode.d.ts +7 -0
- package/out/natural/transformTSCode.js +878 -0
- package/out/natural/transformTSCode.js.map +1 -0
- package/out/sentry/index.js +2 -2
- package/out/sentry/index.js.map +1 -1
- package/out/server/createUiTs.js +1 -34
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/extendBaseNode.js +17 -17
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +10 -0
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getConnector.d.ts +0 -3
- package/out/server/getConnector.js +1 -38
- package/out/server/getConnector.js.map +1 -1
- package/out/server/getMemberIdentifier.js +2 -1
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/index.js +0 -2
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +6 -17
- package/out/server/naslServer.js +213 -321
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +4 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/add.configs.js +0 -26
- package/out/service/creator/add.configs.js.map +1 -1
- package/out/service/creator/errHandles.js +3 -5
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/creator/index.js +0 -13
- package/out/service/creator/index.js.map +1 -1
- package/out/service/storage/init.js +16 -0
- package/out/service/storage/init.js.map +1 -1
- package/out/service/storage/jsoner.js +1 -1
- package/out/service/storage/jsoner.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +3 -3
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +3 -3
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +1 -1
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/translator/index.d.ts +48 -3
- package/out/translator/index.js +110 -17
- package/out/translator/index.js.map +1 -1
- package/out/translator/lsp.d.ts +45 -0
- package/out/translator/lsp.js +6 -0
- package/out/translator/lsp.js.map +1 -0
- package/out/translator/tsp.d.ts +12 -0
- package/out/translator/{types.js → tsp.js} +1 -1
- package/out/translator/tsp.js.map +1 -0
- package/out/utils/index.d.ts +0 -2
- package/out/utils/index.js +0 -2
- package/out/utils/index.js.map +1 -1
- package/out/utils/logger.d.ts +0 -4
- package/out/utils/logger.js +1 -13
- package/out/utils/logger.js.map +1 -1
- package/out/utils/time-slicing.js +1 -1
- package/out/utils/time-slicing.js.map +1 -1
- package/package.json +11 -5
- package/sandbox/stdlib/nasl.oql.ts +0 -2
- package/sandbox/stdlib/nasl.ui.definition.ts +1415 -2218
- package/sandbox-natural/stdlib/nasl.core.ts +36 -0
- package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
- package/sandbox-natural/stdlib/nasl.ui.ts +63 -0
- package/sandbox-natural/stdlib/nasl.util.ts +119 -0
- package/sandbox-natural/tsconfig.json +12 -0
- package/src/bak/translator.js +5 -8
- package/src/breakpoint/generator/AfterStartNode.ts +1 -2
- package/src/breakpoint/generator/BeforeEndNode.ts +1 -2
- package/src/breakpoint/generator/BreakpointNode.ts +9 -36
- package/src/breakpoint/shared/constants.ts +0 -7
- package/src/breakpoint/shared/utils.ts +3 -36
- package/src/common/BaseNode.ts +81 -140
- package/src/common/Command.ts +1 -6
- package/src/common/EventEmitter.ts +4 -2
- package/src/common/classMap.ts +3 -0
- package/src/common/index.ts +1 -0
- package/src/concepts/Abort__.ts +22 -20
- package/src/concepts/Anchor__.ts +38 -23
- package/src/concepts/AnonymousFunction__.ts +63 -39
- package/src/concepts/App__.ts +314 -364
- package/src/concepts/Argument__.ts +44 -27
- package/src/concepts/Assignee__.ts +39 -41
- package/src/concepts/AssignmentLine__.ts +23 -20
- package/src/concepts/Assignment__.ts +58 -54
- package/src/concepts/Attribute__.ts +34 -40
- package/src/concepts/AuthInterface__.ts +24 -22
- package/src/concepts/AuthLogicForCallInterface__.ts +41 -71
- package/src/concepts/AuthLogic__.ts +30 -21
- package/src/concepts/BackendVariable__.ts +54 -55
- package/src/concepts/Backend__.ts +59 -58
- package/src/concepts/BatchAssignment__.ts +78 -88
- package/src/concepts/BinaryExpression__.ts +66 -72
- package/src/concepts/BindAttribute__.ts +155 -135
- package/src/concepts/BindDirective__.ts +41 -45
- package/src/concepts/BindEvent__.ts +89 -80
- package/src/concepts/BindStyle__.ts +36 -37
- package/src/concepts/BooleanLiteral__.ts +28 -22
- package/src/concepts/CallAuthInterface__.ts +32 -29
- package/src/concepts/CallConnector__.ts +41 -50
- package/src/concepts/CallFunction__.ts +77 -45
- package/src/concepts/CallInterface__.ts +68 -36
- package/src/concepts/CallLogic__.ts +213 -166
- package/src/concepts/CallQueryComponent__.ts +88 -156
- package/src/concepts/Comment__.ts +29 -22
- package/src/concepts/CompletionProperty__.ts +30 -34
- package/src/concepts/ConfigGroup__.ts +29 -28
- package/src/concepts/ConfigPropertyValue__.ts +23 -22
- package/src/concepts/ConfigProperty__.ts +36 -42
- package/src/concepts/Configuration__.ts +26 -23
- package/src/concepts/Connection__.ts +21 -26
- package/src/concepts/ConnectorTrigger__.ts +34 -30
- package/src/concepts/Connector__.ts +87 -342
- package/src/concepts/Constant__.ts +36 -30
- package/src/concepts/DataElement__.ts +131 -0
- package/src/concepts/DataSource__.ts +33 -37
- package/src/concepts/DatabaseTypeAnnotation__.ts +24 -24
- package/src/concepts/Destination__.ts +104 -51
- package/src/concepts/End__.ts +25 -23
- package/src/concepts/EntityIndex__.ts +33 -36
- package/src/concepts/EntityProperty__.ts +84 -64
- package/src/concepts/Entity__.ts +67 -41
- package/src/concepts/EnumItem__.ts +32 -24
- package/src/concepts/Enum__.ts +42 -28
- package/src/concepts/Event__.ts +33 -33
- package/src/concepts/ExternalDestination__.ts +29 -29
- package/src/concepts/ForEachStatement__.ts +73 -34
- package/src/concepts/FrontendLibrary__.ts +38 -37
- package/src/concepts/FrontendVariable__.ts +20 -18
- package/src/concepts/Frontend__.ts +62 -66
- package/src/concepts/Function__.ts +80 -54
- package/src/concepts/Identifier__.ts +34 -37
- package/src/concepts/IfStatement__.ts +77 -40
- package/src/concepts/Integration__.ts +24 -244
- package/src/concepts/InterfaceParam__.ts +33 -69
- package/src/concepts/Interface__.ts +46 -104
- package/src/concepts/JSBlock__.ts +28 -22
- package/src/concepts/JavaLogic__.ts +26 -27
- package/src/concepts/LogicItem__.ts +47 -29
- package/src/concepts/Logic__.ts +226 -168
- package/src/concepts/MatchCase__.ts +128 -38
- package/src/concepts/Match__.ts +73 -28
- package/src/concepts/MemberExpression__.ts +139 -174
- package/src/concepts/MicroApp__.ts +27 -32
- package/src/concepts/Module__.ts +107 -527
- package/src/concepts/MsgTriggerEvent__.ts +33 -25
- package/src/concepts/MsgTriggerLauncher__.ts +30 -27
- package/src/concepts/Namespace__.ts +99 -109
- package/src/concepts/NewComposite__.ts +161 -130
- package/src/concepts/NewList__.ts +51 -45
- package/src/concepts/NewMap__.ts +48 -51
- package/src/concepts/New__.ts +22 -20
- package/src/concepts/NullLiteral__.ts +22 -20
- package/src/concepts/NumericLiteral__.ts +31 -26
- package/src/concepts/OqlQueryComponent__.ts +34 -33
- package/src/concepts/OverriddenLogic__.ts +94 -128
- package/src/concepts/Param__.ts +90 -51
- package/src/concepts/Point__.ts +22 -22
- package/src/concepts/ProcessComponent__.ts +37 -36
- package/src/concepts/ProcessElement__.ts +86 -114
- package/src/concepts/ProcessOutcome__.ts +23 -22
- package/src/concepts/ProcessOutcomes__.ts +22 -20
- package/src/concepts/Process__.ts +63 -69
- package/src/concepts/QueryAggregateExpression__.ts +27 -28
- package/src/concepts/QueryFieldExpression__.ts +25 -26
- package/src/concepts/QueryFromExpression__.ts +28 -29
- package/src/concepts/QueryGroupByExpression__.ts +23 -22
- package/src/concepts/QueryJoinExpression__.ts +41 -62
- package/src/concepts/QueryLimitExpression__.ts +27 -27
- package/src/concepts/QueryOrderByExpression__.ts +27 -27
- package/src/concepts/QuerySelectExpression__.ts +54 -105
- package/src/concepts/Rect__.ts +24 -26
- package/src/concepts/Return__.ts +67 -42
- package/src/concepts/Role__.ts +25 -25
- package/src/concepts/SelectMembers__.ts +32 -30
- package/src/concepts/Slot__.ts +30 -32
- package/src/concepts/SqlQueryComponent__.ts +37 -41
- package/src/concepts/Start__.ts +22 -20
- package/src/concepts/StringInterpolation__.ts +45 -25
- package/src/concepts/StringLiteral__.ts +26 -19
- package/src/concepts/StructureProperty__.ts +47 -38
- package/src/concepts/Structure__.ts +58 -55
- package/src/concepts/SwitchCase__.ts +74 -40
- package/src/concepts/SwitchStatement__.ts +44 -29
- package/src/concepts/Theme__.ts +21 -18
- package/src/concepts/Transactional__.ts +31 -24
- package/src/concepts/TriggerEvent__.ts +29 -28
- package/src/concepts/TriggerLauncher__.ts +82 -32
- package/src/concepts/TypeAnnotation__.ts +98 -92
- package/src/concepts/TypeParam__.ts +28 -21
- package/src/concepts/UnaryExpression__.ts +45 -26
- package/src/concepts/Unparsed__.ts +25 -20
- package/src/concepts/UseComponent__.ts +22 -22
- package/src/concepts/ValidationRule__.ts +555 -539
- package/src/concepts/Variable__.ts +67 -43
- package/src/concepts/ViewBlock__.ts +25 -26
- package/src/concepts/ViewComponent__.ts +91 -87
- package/src/concepts/ViewElement__.ts +2437 -2696
- package/src/concepts/View__.ts +407 -345
- package/src/concepts/WhileStatement__.ts +59 -36
- package/src/concepts/index__.ts +1 -0
- package/src/concepts/types__.ts +124 -124
- package/src/decorators/index.ts +7 -11
- package/src/generator/genBundleFiles.ts +4 -14
- package/src/generator/genReleaseBody.ts +182 -198
- package/src/index.ts +1 -0
- package/src/natural/RequirementAnalyzer.ts +208 -0
- package/src/natural/RequirementExecutor.ts +685 -0
- package/src/natural/componentData.ts +81 -0
- package/src/natural/genNaturalTS.ts +90 -0
- package/src/natural/index.ts +4 -0
- package/src/natural/knowledgeMap.ts +39 -0
- package/src/natural/naslStdlibMap.ts +24 -0
- package/src/natural/transformTSCode.ts +834 -0
- package/src/sentry/index.ts +2 -2
- package/src/server/createUiTs.ts +1 -30
- package/src/server/extendBaseNode.ts +18 -18
- package/src/server/formatTsUtils.ts +11 -0
- package/src/server/getConnector.ts +27 -63
- package/src/server/getMemberIdentifier.ts +3 -2
- package/src/server/index.ts +1 -4
- package/src/server/naslServer.ts +212 -302
- package/src/server/translator.ts +3 -1
- package/src/service/creator/add.configs.js +1 -26
- package/src/service/creator/errHandles.js +4 -5
- package/src/service/creator/index.js +0 -12
- package/src/service/storage/init.ts +17 -0
- package/src/service/storage/jsoner.ts +1 -1
- package/src/templator/genCurdEditMultipleKeyBlock.ts +3 -3
- package/src/templator/genCurdMultipleKeyBlock.ts +3 -3
- package/src/templator/genTableBlock.ts +1 -1
- package/src/test/examples/app1.json +1406 -0
- package/src/test/fixtures/env.ts +19 -0
- package/src/test/integration/connect-create-file.ts +14 -0
- package/src/test/integration/connect-file.ts +24 -0
- package/src/test/integration/node-nasl-server.ts +14 -0
- package/src/test/units/baseTypes/Assignment.spec.ts +20 -0
- package/src/test/units/baseTypes/CallLogic.spec.ts +22 -0
- package/src/test/units/baseTypes/StringLiteral.spec.ts +60 -0
- package/src/test/units/baseTypes/new.spec.ts +13 -0
- package/src/test/units/common/Vertex.spec.ts +23 -0
- package/src/test/units/data/Entity.spec.ts +10 -0
- package/src/test/units/login.spec.ts +10 -0
- package/src/test/units/page/Block.spec.ts +15 -0
- package/src/test/units/page/Element.spec.ts +45 -0
- package/src/test/units/page/example.dashboard.html +46 -0
- package/src/test/units/page/example.view1.html +63 -0
- package/src/test/units/temp/temp.spec.ts +66 -0
- package/src/translator/index.ts +137 -3
- package/src/translator/lsp.ts +50 -0
- package/src/translator/tsp.ts +14 -0
- package/src/utils/index.ts +0 -2
- package/src/utils/logger.ts +0 -13
- package/src/utils/time-slicing.ts +1 -1
- package/test/concepts/call-interface/toEmbeddedTS.spec.ts +6 -6
- package/test/concepts/call-interface/toJS.spec.ts +6 -6
- package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -45
- package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +0 -102
- package/test/concepts/call-logic/toEmbeddedTS.spec.ts +6 -6
- package/test/concepts/call-logic/toJS.spec.ts +6 -6
- package/test/concepts/match/toEmbeddedTS.spec.ts +6 -6
- package/test/concepts/match/toJS.spec.ts +6 -6
- package/test/concepts/utils.ts +43 -46
- package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +6 -6
- package/test/concepts/validation-rule/toJS.spec.ts +6 -6
- package/test/concepts/validation-rule/validation-rule.spec.ts +8 -8
- package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -592
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +0 -308
- package/test/concepts/view-element/fixtures/default-not-found.json +313 -313
- package/test/concepts/view-element/toEmbeddedTS.spec.ts +6 -6
- package/test/concepts/view-element/toVue.spec.ts +6 -6
- package/ts-worker/package-lock.json +101 -6663
- package/ts-worker/webpack.config.js +1 -1
- package/out/translator/constant.d.ts +0 -6
- package/out/translator/constant.js +0 -10
- package/out/translator/constant.js.map +0 -1
- package/out/translator/types.d.ts +0 -32
- package/out/translator/types.js.map +0 -1
- package/out/translator/utils.d.ts +0 -17
- package/out/translator/utils.js +0 -102
- package/out/translator/utils.js.map +0 -1
- package/out/utils/cookie.d.ts +0 -9
- package/out/utils/cookie.js +0 -62
- package/out/utils/cookie.js.map +0 -1
- package/out/utils/types.d.ts +0 -1
- package/out/utils/types.js +0 -3
- package/out/utils/types.js.map +0 -1
- package/out/utils/window.d.ts +0 -7
- package/out/utils/window.js +0 -14
- package/out/utils/window.js.map +0 -1
- package/src/translator/constant.ts +0 -7
- package/src/translator/types.ts +0 -40
- package/src/translator/utils.ts +0 -104
- package/src/utils/cookie.ts +0 -60
- package/src/utils/types.ts +0 -1
- package/src/utils/window.ts +0 -9
- package/test/concepts/boolean-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -11
- package/test/concepts/boolean-literal/__snapshots__/toJS.spec.ts.snap +0 -11
- package/test/concepts/boolean-literal/__snapshots__/toVue.spec.ts.snap +0 -11
- package/test/concepts/boolean-literal/constant.ts +0 -5
- package/test/concepts/boolean-literal/fixtures/false.json +0 -4
- package/test/concepts/boolean-literal/fixtures/true.json +0 -4
- package/test/concepts/boolean-literal/toEmbeddedTS.spec.ts +0 -14
- package/test/concepts/boolean-literal/toJS.spec.ts +0 -14
- package/test/concepts/boolean-literal/toVue.spec.ts +0 -14
- package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +0 -106
- package/test/concepts/call-logic/fixtures/nested-call-logic.json +0 -860
- package/test/concepts/call-logic/getQuickInfoOffset.spec.ts +0 -23
- package/test/concepts/identifier/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -16
- package/test/concepts/identifier/__snapshots__/toJS.spec.ts.snap +0 -16
- package/test/concepts/identifier/__snapshots__/toVue.spec.ts.snap +0 -16
- package/test/concepts/identifier/constant.ts +0 -5
- package/test/concepts/identifier/fixtures/data-source.json +0 -5
- package/test/concepts/identifier/fixtures/no-namespace.json +0 -4
- package/test/concepts/identifier/fixtures/view-variable.json +0 -201
- package/test/concepts/identifier/toEmbeddedTS.spec.ts +0 -14
- package/test/concepts/identifier/toJS.spec.ts +0 -14
- package/test/concepts/identifier/toVue.spec.ts +0 -14
- package/test/concepts/member-expression/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -21
- package/test/concepts/member-expression/__snapshots__/toJS.spec.ts.snap +0 -21
- package/test/concepts/member-expression/__snapshots__/toVue.spec.ts.snap +0 -21
- package/test/concepts/member-expression/constant.ts +0 -5
- package/test/concepts/member-expression/fixtures/app.enums.UserStatusEnum.json +0 -13
- package/test/concepts/member-expression/fixtures/elements.table-view.data.json +0 -13
- package/test/concepts/member-expression/fixtures/entry.created-by.json +0 -18
- package/test/concepts/member-expression/fixtures/nasl.auth.userInfo.json +0 -19
- package/test/concepts/member-expression/toEmbeddedTS.spec.ts +0 -14
- package/test/concepts/member-expression/toJS.spec.ts +0 -14
- package/test/concepts/member-expression/toVue.spec.ts +0 -14
- package/test/concepts/null-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -6
- package/test/concepts/null-literal/__snapshots__/toJS.spec.ts.snap +0 -6
- package/test/concepts/null-literal/__snapshots__/toVue.spec.ts.snap +0 -6
- package/test/concepts/null-literal/constant.ts +0 -5
- package/test/concepts/null-literal/fixtures/null.json +0 -3
- package/test/concepts/null-literal/toEmbeddedTS.spec.ts +0 -14
- package/test/concepts/null-literal/toJS.spec.ts +0 -14
- package/test/concepts/null-literal/toVue.spec.ts +0 -14
- package/test/concepts/numeric-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -6
- package/test/concepts/numeric-literal/__snapshots__/toJS.spec.ts.snap +0 -6
- package/test/concepts/numeric-literal/__snapshots__/toVue.spec.ts.snap +0 -6
- package/test/concepts/numeric-literal/constant.ts +0 -5
- package/test/concepts/numeric-literal/fixtures/number.json +0 -10
- package/test/concepts/numeric-literal/toEmbeddedTS.spec.ts +0 -14
- package/test/concepts/numeric-literal/toJS.spec.ts +0 -14
- package/test/concepts/numeric-literal/toVue.spec.ts +0 -14
- package/test/concepts/string-literal/__snapshots__/toEmbeddedTS.spec.ts.snap +0 -16
- package/test/concepts/string-literal/__snapshots__/toJS.spec.ts.snap +0 -16
- package/test/concepts/string-literal/__snapshots__/toVue.spec.ts.snap +0 -16
- package/test/concepts/string-literal/constant.ts +0 -5
- package/test/concepts/string-literal/fixtures/escape.json +0 -4
- package/test/concepts/string-literal/fixtures/space.json +0 -4
- package/test/concepts/string-literal/fixtures/string.json +0 -4
- package/test/concepts/string-literal/toEmbeddedTS.spec.ts +0 -14
- package/test/concepts/string-literal/toJS.spec.ts +0 -14
- package/test/concepts/string-literal/toVue.spec.ts +0 -14
- package/test/concepts/view-element/fixtures/default-login.json +0 -333
- package/test/concepts/view-element/fixtures/with-role-auth.json +0 -148
- package/test/concepts/view-element/fixtures/with-table.json +0 -3473
package/src/server/naslServer.ts
CHANGED
|
@@ -4,11 +4,12 @@ import * as path from 'path';
|
|
|
4
4
|
import { Worker } from 'worker_threads';
|
|
5
5
|
/// #endif
|
|
6
6
|
|
|
7
|
+
import * as tsProtocol from 'typescript/lib/protocol';
|
|
8
|
+
import { Decimal } from 'decimal.js';
|
|
7
9
|
import { config } from '../config';
|
|
8
10
|
import { sentryMonitorNaslServer, sentryMonitorTSWorkerMessager } from '../sentry';
|
|
9
11
|
import Messager from '../common/Messager';
|
|
10
|
-
import
|
|
11
|
-
import { formatEnums } from '../server/getMemberIdentifier';
|
|
12
|
+
import { formatEnums } from "./getMemberIdentifier";
|
|
12
13
|
|
|
13
14
|
import {
|
|
14
15
|
Module,
|
|
@@ -84,8 +85,7 @@ import {
|
|
|
84
85
|
TriggerLauncher,
|
|
85
86
|
CallConnector,
|
|
86
87
|
} from '../concepts';
|
|
87
|
-
|
|
88
|
-
import { lsp2tspNumber, SourceMap, SourceMapItem, isSameRange } from '../translator';
|
|
88
|
+
import { lsp2tspNumber, SourceMap, SourceMapItem } from '../translator';
|
|
89
89
|
import axios from '../service/storage';
|
|
90
90
|
import { translateDiagnosticMessage, naslNodeTranslateMessage, MinRange, checkAStructure_ } from './translator';
|
|
91
91
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
@@ -101,7 +101,6 @@ import { EventEmitter } from '../common/EventEmitter';
|
|
|
101
101
|
import { traverse } from '../utils';
|
|
102
102
|
import { withQueueExecute } from '../decorators';
|
|
103
103
|
|
|
104
|
-
import { Decimal } from 'decimal.js';
|
|
105
104
|
import { getNodeByNodeCallee } from '../automate/engine/utils';
|
|
106
105
|
|
|
107
106
|
const EmbeddedTSFileLineMap: { [name: string]: number } = {
|
|
@@ -142,16 +141,17 @@ interface QuoteNode {
|
|
|
142
141
|
// 批量查找节点位置的节点信息类型
|
|
143
142
|
type QuickInfoNodes = Array<{ filePath: string; node: BaseNode; item: SourceMapItem }>;
|
|
144
143
|
|
|
145
|
-
let isChangeInterface = false;
|
|
144
|
+
let isChangeInterface = false; // 判断是否导入接口
|
|
146
145
|
type ActionNode = { target: Variable; typeannotation: TypeAnnotation };
|
|
147
|
-
let actionArr: Array<ActionNode> = [];
|
|
148
|
-
let timer: number
|
|
146
|
+
let actionArr: Array<ActionNode> = []; // 用于导入接口收集更改的节点
|
|
147
|
+
let timer: number = null; // 超时器用于收集导入接口相关
|
|
148
|
+
const __naslStdlibFileCacheMap: Map<tsProtocol.OpenRequestArgs['file'], tsProtocol.OpenRequestArgs> = new Map(); // naslStdlib文件缓存
|
|
149
149
|
|
|
150
150
|
// 联合类型切割取出类型
|
|
151
151
|
export function getDisplayString2Type(displayString: string) {
|
|
152
|
-
const targetString = displayString.match(/value:\s(\S+)\)/)?.[1];
|
|
153
|
-
let targetType:string
|
|
154
|
-
if (targetString
|
|
152
|
+
const targetString = displayString.match(/value:\s(\S+)\)/)?.[1] ?? '';
|
|
153
|
+
let targetType: string = null;
|
|
154
|
+
if (targetString.startsWith('nasl.core.')) {
|
|
155
155
|
targetType = targetString.slice(10);
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -161,20 +161,20 @@ export function getDisplayString2Type(displayString: string) {
|
|
|
161
161
|
displayString = displayString?.replace('T extends ', '') || '';
|
|
162
162
|
const types = reg.exec(displayString);
|
|
163
163
|
// 取出提示的类型,组成是数组
|
|
164
|
-
const typeList: string[] =
|
|
164
|
+
const typeList: string[] = types[1].split(' | ').map((item: string) => {
|
|
165
165
|
if (/<([^()]+)>/g.exec(item)) {
|
|
166
166
|
return item;
|
|
167
|
-
}
|
|
167
|
+
} if (item.includes(' ')) {
|
|
168
168
|
const strs = item.split(' ');
|
|
169
169
|
const type = strs[strs.length - 1];
|
|
170
170
|
return type;
|
|
171
|
-
}
|
|
171
|
+
} if (item.includes('.')) {
|
|
172
172
|
const strs = item.split('.');
|
|
173
173
|
const type = strs[strs.length - 1];
|
|
174
174
|
return type;
|
|
175
|
-
}
|
|
175
|
+
}
|
|
176
176
|
return item;
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
if (targetType) {
|
|
@@ -185,12 +185,11 @@ export function getDisplayString2Type(displayString: string) {
|
|
|
185
185
|
|
|
186
186
|
@sentryMonitorNaslServer
|
|
187
187
|
class NaslServer {
|
|
188
|
-
|
|
189
|
-
naslStdlibFileCacheMap: Map<tsProtocol.OpenRequestArgs['file'], tsProtocol.OpenRequestArgs> = new Map();
|
|
188
|
+
naslStdlibFileCacheMap = __naslStdlibFileCacheMap;
|
|
190
189
|
|
|
191
|
-
messager: Messager;
|
|
190
|
+
messager: Messager = undefined;
|
|
192
191
|
|
|
193
|
-
worker: Worker;
|
|
192
|
+
worker: Worker = undefined;
|
|
194
193
|
|
|
195
194
|
/**
|
|
196
195
|
* 按道理 fileSourceMap: new Map<string, SourceMap>() 比较合理,
|
|
@@ -199,22 +198,12 @@ class NaslServer {
|
|
|
199
198
|
*/
|
|
200
199
|
file2NodeMap: Map<string, BaseNode> = new Map<string, BaseNode>();
|
|
201
200
|
|
|
202
|
-
/** TS 翻译的源码 */
|
|
203
|
-
tsFiles = new Map<string, string>();
|
|
204
|
-
|
|
205
|
-
/// #if process.env.NODE_ENV === 'development'
|
|
206
|
-
/**
|
|
207
|
-
* 调试时是否储存 ts 文件
|
|
208
|
-
*/
|
|
209
|
-
openDebugEmbedded = true;
|
|
210
|
-
/// #endif
|
|
211
|
-
|
|
212
201
|
elementsLogic: { [elementLogicName: string]: Array<Logic> } = {};
|
|
213
202
|
|
|
214
203
|
// 错误日志收集
|
|
215
|
-
diagnosticManager: DiagnosticManager;
|
|
204
|
+
diagnosticManager: DiagnosticManager = undefined;
|
|
216
205
|
|
|
217
|
-
embeddedTSEmitter: EventEmitter;
|
|
206
|
+
embeddedTSEmitter: EventEmitter = undefined;
|
|
218
207
|
|
|
219
208
|
// 需要执行修改的文件
|
|
220
209
|
changeStackList: Array<EventPayload> = [];
|
|
@@ -261,6 +250,8 @@ class NaslServer {
|
|
|
261
250
|
// 结束诊断和标注
|
|
262
251
|
invokeCommand('naslServer:endWork');
|
|
263
252
|
invokeCommand('naslServer:nodeChange');
|
|
253
|
+
this.embeddedTSEmitter.emit('naslServer:endWork');
|
|
254
|
+
this.embeddedTSEmitter.emit('naslServer:nodeChange');
|
|
264
255
|
} catch (e) {
|
|
265
256
|
console.log('no "naslServer:nodeChange" event received');
|
|
266
257
|
}
|
|
@@ -289,7 +280,7 @@ class NaslServer {
|
|
|
289
280
|
// 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
|
|
290
281
|
// @ts-ignore
|
|
291
282
|
const findLastIndex = this.changeStackList.findLastIndex((changeStackItem: EventPayload) => {
|
|
292
|
-
const target = changeStackItem
|
|
283
|
+
const {target} = changeStackItem;
|
|
293
284
|
const { fileNode: targetFileNode } = this.getCurrentSource(target);
|
|
294
285
|
return targetFileNode === fileNode;
|
|
295
286
|
});
|
|
@@ -299,10 +290,10 @@ class NaslServer {
|
|
|
299
290
|
if (this.changeStackList[findLastIndex]?.field) {
|
|
300
291
|
// 如果当前列表里有,这个文件节点,最后一个是field的话,直接return掉,不用塞这个update了
|
|
301
292
|
return;
|
|
302
|
-
}
|
|
293
|
+
}
|
|
303
294
|
// 如果最后一项是普通的update的话,就可以去掉,后面那个会在塞过来
|
|
304
295
|
this.changeStackList.pop();
|
|
305
|
-
|
|
296
|
+
|
|
306
297
|
}
|
|
307
298
|
this.changeStackList.push(item.originEvent);
|
|
308
299
|
} catch (err) {
|
|
@@ -339,7 +330,7 @@ class NaslServer {
|
|
|
339
330
|
Object.keys(naslStdlibMap).forEach(async (libFileName: string) => {
|
|
340
331
|
await this.addFile(
|
|
341
332
|
{
|
|
342
|
-
file:
|
|
333
|
+
file: `/${ libFileName}`,
|
|
343
334
|
fileContent: naslStdlibMap[libFileName],
|
|
344
335
|
},
|
|
345
336
|
{ cache: true }
|
|
@@ -530,24 +521,6 @@ class NaslServer {
|
|
|
530
521
|
launcher.sourceMap = result.sourceMap;
|
|
531
522
|
this.file2NodeMap.set(result.filePath, launcher);
|
|
532
523
|
});
|
|
533
|
-
module.namespaces?.forEach?.((namespace) => {
|
|
534
|
-
namespace.logics.forEach((logic) => {
|
|
535
|
-
const result = logic.toEmbeddedTSFile();
|
|
536
|
-
results.push(result);
|
|
537
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
538
|
-
logic.sourceMap = result.sourceMap;
|
|
539
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
540
|
-
});
|
|
541
|
-
})
|
|
542
|
-
module?.authLogicsForCallInterface?.forEach?.((logic) => {
|
|
543
|
-
try {
|
|
544
|
-
if (!(logic instanceof Logic)) return;
|
|
545
|
-
const result = logic.toEmbeddedTSFile();
|
|
546
|
-
results.push(result);
|
|
547
|
-
logic.sourceMap = result.sourceMap;
|
|
548
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
549
|
-
} catch (err) {}
|
|
550
|
-
});
|
|
551
524
|
} catch (error) {
|
|
552
525
|
console.error(error);
|
|
553
526
|
}
|
|
@@ -627,7 +600,6 @@ class NaslServer {
|
|
|
627
600
|
// 其他模块的创建内容
|
|
628
601
|
app.dependencies.forEach((item) => this.contentToFile(item, results));
|
|
629
602
|
app.interfaceDependencies.forEach((item) => this.contentToFile(item, results));
|
|
630
|
-
app.integration?.connectors?.forEach((item) => this.contentToFile(item, results));
|
|
631
603
|
} catch (err) {
|
|
632
604
|
console.log(err);
|
|
633
605
|
}
|
|
@@ -671,17 +643,17 @@ class NaslServer {
|
|
|
671
643
|
cache && this.cacheFile(file);
|
|
672
644
|
return this.messager.requestCommand('addFile', file);
|
|
673
645
|
}
|
|
646
|
+
|
|
674
647
|
// 缓存添加过的文件
|
|
675
648
|
cacheFile(options: tsProtocol.OpenRequestArgs) {
|
|
676
|
-
|
|
649
|
+
__naslStdlibFileCacheMap.set(options.file, options);
|
|
677
650
|
}
|
|
678
651
|
|
|
679
|
-
/**u
|
|
652
|
+
/** u
|
|
680
653
|
* 只新增文件
|
|
681
654
|
* @param {*} files
|
|
682
655
|
*/
|
|
683
656
|
writeFiles(files: Array<tsProtocol.OpenRequestArgs>) {
|
|
684
|
-
files.forEach(({ file, fileContent }) => this.tsFiles.set(file, fileContent));
|
|
685
657
|
return this.messager.requestCommand('writeFiles', files);
|
|
686
658
|
}
|
|
687
659
|
|
|
@@ -691,7 +663,6 @@ class NaslServer {
|
|
|
691
663
|
* @param {*} args
|
|
692
664
|
*/
|
|
693
665
|
updateFiles(args: { outputFiles: Array<tsProtocol.OpenRequestArgs> }) {
|
|
694
|
-
args.outputFiles.forEach(({ file, fileContent }) => this.tsFiles.set(file, fileContent));
|
|
695
666
|
return this.messager.requestCommand('updateFiles', args);
|
|
696
667
|
}
|
|
697
668
|
|
|
@@ -699,37 +670,36 @@ class NaslServer {
|
|
|
699
670
|
* 清除一个目录下的所有文件
|
|
700
671
|
*/
|
|
701
672
|
deleteDirectoryFiles(args: { directoryName: string }) {
|
|
702
|
-
Array.from(this.tsFiles.keys())
|
|
703
|
-
.filter((key) => key.startsWith(args.directoryName))
|
|
704
|
-
.forEach((key) => this.tsFiles.delete(key));
|
|
705
|
-
|
|
706
673
|
return this.messager.requestCommand('deleteDirectoryFiles', args);
|
|
707
674
|
}
|
|
708
675
|
|
|
709
676
|
async _debugInFileStorage(node: BaseNode, openFiles: Array<tsProtocol.OpenRequestArgs>) {
|
|
710
677
|
let app = node;
|
|
678
|
+
let openDebugEmbedded = true;
|
|
711
679
|
if (node.concept !== 'App') {
|
|
712
680
|
app = (node as any).rootNode || (node as any).app;
|
|
713
681
|
}
|
|
714
682
|
/// #if process.env.NODE_ENV === 'development'
|
|
715
683
|
// 首次尝试请求
|
|
716
|
-
await axios.post(
|
|
717
|
-
|
|
684
|
+
await axios.post(`/api/App/debugEmbedded?id=${ app.id}`, openFiles[0]).catch(() => (openDebugEmbedded = false));
|
|
685
|
+
|
|
686
|
+
if (openDebugEmbedded && globalThis.window) {
|
|
718
687
|
// For TS build
|
|
719
688
|
try {
|
|
720
689
|
let canDebug = true;
|
|
721
|
-
await axios.post(
|
|
690
|
+
await axios.post(`/api/App/debugEmbedded?id=${ app.id}`, openFiles[0]).catch(() => (canDebug = false));
|
|
722
691
|
|
|
723
692
|
if (canDebug) {
|
|
724
693
|
await Promise.all(
|
|
725
694
|
openFiles.map(async (file) => {
|
|
726
|
-
const res = await axios.post(
|
|
695
|
+
const res = await axios.post(`/api/App/debugEmbedded?id=${ app.id}`, file);
|
|
727
696
|
return res.data;
|
|
728
697
|
})
|
|
729
698
|
);
|
|
730
699
|
}
|
|
731
700
|
} catch (e) {
|
|
732
|
-
//
|
|
701
|
+
// 出现错误之后不再调用
|
|
702
|
+
openDebugEmbedded = false;
|
|
733
703
|
}
|
|
734
704
|
}
|
|
735
705
|
/// #endif
|
|
@@ -768,15 +738,15 @@ class NaslServer {
|
|
|
768
738
|
return this._getValueSelectCompletion({
|
|
769
739
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
770
740
|
range: {
|
|
771
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
772
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
741
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
742
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
773
743
|
},
|
|
774
744
|
value,
|
|
775
745
|
noFilterList,
|
|
776
746
|
});
|
|
777
|
-
}
|
|
747
|
+
}
|
|
778
748
|
console.log('没找到节点', node, currentSource, fileNode);
|
|
779
|
-
|
|
749
|
+
|
|
780
750
|
}
|
|
781
751
|
|
|
782
752
|
_getValueSelectCompletion(args: any) {
|
|
@@ -803,8 +773,8 @@ class NaslServer {
|
|
|
803
773
|
try {
|
|
804
774
|
const quickInfo = await this._getTypeQuickinfo({
|
|
805
775
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
806
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
807
|
-
offset: lsp2tspNumber(currentSource.start.character) + `nasl.util.C`.length,
|
|
776
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
777
|
+
offset: lsp2tspNumber(currentSource.range.start.character) + `nasl.util.C`.length,
|
|
808
778
|
});
|
|
809
779
|
if (quickInfo.responseRequired) {
|
|
810
780
|
const displayString = quickInfo?.response?.displayString || '';
|
|
@@ -820,9 +790,9 @@ class NaslServer {
|
|
|
820
790
|
});
|
|
821
791
|
if (!res.length) {
|
|
822
792
|
return [];
|
|
823
|
-
}
|
|
793
|
+
}
|
|
824
794
|
return [{ title: '基础类型', children: res }];
|
|
825
|
-
|
|
795
|
+
|
|
826
796
|
}
|
|
827
797
|
} catch (err) {
|
|
828
798
|
console.log(err);
|
|
@@ -849,8 +819,8 @@ class NaslServer {
|
|
|
849
819
|
}
|
|
850
820
|
const quickInfo = await this._getTypeQuickinfo({
|
|
851
821
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
852
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
853
|
-
offset: lsp2tspNumber(currentSource.start.character) + `new nasl.ui.`.length,
|
|
822
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
823
|
+
offset: lsp2tspNumber(currentSource.range.start.character) + `new nasl.ui.`.length,
|
|
854
824
|
});
|
|
855
825
|
if (quickInfo.responseRequired) {
|
|
856
826
|
const displayString = quickInfo?.response?.displayString || '';
|
|
@@ -866,7 +836,7 @@ class NaslServer {
|
|
|
866
836
|
.replaceAll('\n', '')
|
|
867
837
|
.replace(/__name:"AStructure_\w{8}";/g, '')
|
|
868
838
|
.replace(/dataSources.([^.]+).entities.([^;]+)/g, ($1, $2, $3) => `${$3}(${$2})`);
|
|
869
|
-
}
|
|
839
|
+
} if (typeStr.startsWith('{') && typeStr.endsWith('}')) {
|
|
870
840
|
/**
|
|
871
841
|
* {
|
|
872
842
|
text: nasl.core.String;
|
|
@@ -898,6 +868,7 @@ class NaslServer {
|
|
|
898
868
|
}
|
|
899
869
|
return '';
|
|
900
870
|
}
|
|
871
|
+
|
|
901
872
|
async getDataSchemaStructureOrTypeAnnotation(node: ViewElement) {
|
|
902
873
|
if (!(node instanceof ViewElement)) return;
|
|
903
874
|
|
|
@@ -907,8 +878,8 @@ class NaslServer {
|
|
|
907
878
|
}
|
|
908
879
|
const quickInfo = await this._getTypeQuickinfo({
|
|
909
880
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
910
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
911
|
-
offset: lsp2tspNumber(currentSource.start.character) + `new nasl.ui.`.length,
|
|
881
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
882
|
+
offset: lsp2tspNumber(currentSource.range.start.character) + `new nasl.ui.`.length,
|
|
912
883
|
});
|
|
913
884
|
if (quickInfo.responseRequired) {
|
|
914
885
|
const displayString = quickInfo?.response?.displayString || '';
|
|
@@ -917,7 +888,7 @@ class NaslServer {
|
|
|
917
888
|
|
|
918
889
|
const types = /<([^()]+)>/g.exec(displayString);
|
|
919
890
|
const typeStr = types && types[1];
|
|
920
|
-
const app = node
|
|
891
|
+
const {app} = node;
|
|
921
892
|
if (typeStr.includes('__name: "AStructure_')) {
|
|
922
893
|
const properties: StructureProperty[] = [];
|
|
923
894
|
typeStr.replace(/([^:\s]+):\s+([^;]+);/g, ($1, name, typeKey) => {
|
|
@@ -940,7 +911,7 @@ class NaslServer {
|
|
|
940
911
|
return '';
|
|
941
912
|
});
|
|
942
913
|
return TypeAnnotation.createTypeAnonymousStructure(properties);
|
|
943
|
-
}
|
|
914
|
+
} if (typeStr.startsWith('structures')) return app.findNodeByCompleteName(`app.${typeStr}`);
|
|
944
915
|
}
|
|
945
916
|
}
|
|
946
917
|
|
|
@@ -1002,14 +973,14 @@ class NaslServer {
|
|
|
1002
973
|
return this._getSelectNextCompletion({
|
|
1003
974
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
1004
975
|
range: {
|
|
1005
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
1006
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
976
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
977
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
1007
978
|
},
|
|
1008
979
|
noFilterList,
|
|
1009
980
|
});
|
|
1010
|
-
}
|
|
981
|
+
}
|
|
1011
982
|
console.log('没找到节点', currentSource, fileNode);
|
|
1012
|
-
|
|
983
|
+
|
|
1013
984
|
}
|
|
1014
985
|
|
|
1015
986
|
_getSelectNextCompletion(args: any) {
|
|
@@ -1028,6 +999,7 @@ class NaslServer {
|
|
|
1028
999
|
if (node.tsErrorDetail) return;
|
|
1029
1000
|
node.tsErrorDetail = tsErrorDetail;
|
|
1030
1001
|
}
|
|
1002
|
+
|
|
1031
1003
|
/**
|
|
1032
1004
|
* 处理诊断结果
|
|
1033
1005
|
* @param records 结果
|
|
@@ -1041,7 +1013,7 @@ class NaslServer {
|
|
|
1041
1013
|
}
|
|
1042
1014
|
await Promise.all(
|
|
1043
1015
|
records.map(async (record) => {
|
|
1044
|
-
const node = record
|
|
1016
|
+
const {node} = record;
|
|
1045
1017
|
if (!node) return;
|
|
1046
1018
|
|
|
1047
1019
|
// 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
|
|
@@ -1049,7 +1021,7 @@ class NaslServer {
|
|
|
1049
1021
|
|
|
1050
1022
|
oldRecord?.semanticDiagnostics.forEach((item) => {
|
|
1051
1023
|
if (item.node) {
|
|
1052
|
-
|
|
1024
|
+
item.node.tsErrorDetail = undefined;
|
|
1053
1025
|
// 如果logic中有报错就把标识置为true
|
|
1054
1026
|
if ((item.node as any)?.logic?.haveError) {
|
|
1055
1027
|
(item.node as any).logic.haveError = false;
|
|
@@ -1060,7 +1032,7 @@ class NaslServer {
|
|
|
1060
1032
|
// 清空一些状态
|
|
1061
1033
|
oldRecord?.suggestionDiagnostics.forEach((item) => {
|
|
1062
1034
|
if (item.node) {
|
|
1063
|
-
|
|
1035
|
+
item.node.tsErrorDetail = undefined;
|
|
1064
1036
|
if (item.node && item.node instanceof Logic) {
|
|
1065
1037
|
item.node.isSmpty = false;
|
|
1066
1038
|
}
|
|
@@ -1076,7 +1048,7 @@ class NaslServer {
|
|
|
1076
1048
|
if (record.node instanceof Logic) {
|
|
1077
1049
|
record?.syntaxDiagnostics.forEach((item) => {
|
|
1078
1050
|
const minRange = this._findMinRange(item as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode);
|
|
1079
|
-
if (minRange
|
|
1051
|
+
if (minRange.node instanceof OqlQueryComponent) {
|
|
1080
1052
|
if (item.text === 'Invalid character.') {
|
|
1081
1053
|
record.semanticDiagnostics.push(item);
|
|
1082
1054
|
}
|
|
@@ -1101,7 +1073,7 @@ class NaslServer {
|
|
|
1101
1073
|
if (diagnostic.severity === 'warning') {
|
|
1102
1074
|
record.suggestionDiagnostics.push(diagnostic);
|
|
1103
1075
|
return null;
|
|
1104
|
-
}
|
|
1076
|
+
} if (currentNode.concept === 'OqlQueryComponent') {
|
|
1105
1077
|
// OQL别名错误降级为警告
|
|
1106
1078
|
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
1107
1079
|
// 重置 图标和错误等级
|
|
@@ -1146,7 +1118,7 @@ class NaslServer {
|
|
|
1146
1118
|
if (diag?.node) {
|
|
1147
1119
|
return diag;
|
|
1148
1120
|
// 一些已知警告的单独处理
|
|
1149
|
-
}
|
|
1121
|
+
} if (
|
|
1150
1122
|
[
|
|
1151
1123
|
`'__LogicEmpty' is declared but its value is never read.`,
|
|
1152
1124
|
`'__destinationEmpty__' is declared but its value is never read.`,
|
|
@@ -1156,7 +1128,7 @@ class NaslServer {
|
|
|
1156
1128
|
].includes(diag.text)
|
|
1157
1129
|
) {
|
|
1158
1130
|
return this._resolveDiagnostic(diag as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode, record);
|
|
1159
|
-
}
|
|
1131
|
+
} if (diag.text.includes(` is declared but its value is never read.`)) {
|
|
1160
1132
|
// 局部变量和输入变量未使用的警告
|
|
1161
1133
|
const fromModule = record.node.parentNode.concept === 'Module';
|
|
1162
1134
|
const fromConnector = record.node.parentNode.concept === 'Connector';
|
|
@@ -1185,7 +1157,7 @@ class NaslServer {
|
|
|
1185
1157
|
message: `未使用的输入参数${minRange.node.name}`,
|
|
1186
1158
|
};
|
|
1187
1159
|
return diagnostic;
|
|
1188
|
-
}
|
|
1160
|
+
} if (minRange.node instanceof Variable) {
|
|
1189
1161
|
const diagnostic = {
|
|
1190
1162
|
node: minRange.node,
|
|
1191
1163
|
severity: 'warning',
|
|
@@ -1369,7 +1341,7 @@ class NaslServer {
|
|
|
1369
1341
|
const typeAnnotation = item.__TypeAnnotation;
|
|
1370
1342
|
// 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
|
|
1371
1343
|
if (typeAnnotation) {
|
|
1372
|
-
const sortedTypeKey = typeAnnotation
|
|
1344
|
+
const {sortedTypeKey} = typeAnnotation;
|
|
1373
1345
|
if (!typeAnnotationMap[sortedTypeKey]) {
|
|
1374
1346
|
typeAnnotationMap[sortedTypeKey] = {
|
|
1375
1347
|
typeAnnotation,
|
|
@@ -1421,7 +1393,7 @@ class NaslServer {
|
|
|
1421
1393
|
const typeAnnotation = value.__TypeAnnotation;
|
|
1422
1394
|
// 仅处理有类型的情况,返回类型为void的情况由其他地方处理成报错
|
|
1423
1395
|
if (typeAnnotation) {
|
|
1424
|
-
const sortedTypeKey = typeAnnotation
|
|
1396
|
+
const {sortedTypeKey} = typeAnnotation;
|
|
1425
1397
|
if (!typeAnnotationMap[sortedTypeKey]) {
|
|
1426
1398
|
typeAnnotationMap[sortedTypeKey] = {
|
|
1427
1399
|
typeAnnotation,
|
|
@@ -1519,14 +1491,6 @@ class NaslServer {
|
|
|
1519
1491
|
};
|
|
1520
1492
|
this.baseNodeAssignmentTsError(variable, diagnostic);
|
|
1521
1493
|
diagnostics.push(diagnostic);
|
|
1522
|
-
} else if (variable.__TypeAnnotation?.hasSystemType(node.app)) {
|
|
1523
|
-
const diagnostic = {
|
|
1524
|
-
node,
|
|
1525
|
-
severity: 'warning',
|
|
1526
|
-
message: `数据查询中不可以使用或包含系统类型!当前类型:${variable.__TypeAnnotation?.typeChineseTitle}。`,
|
|
1527
|
-
};
|
|
1528
|
-
this.baseNodeAssignmentTsError(variable, diagnostic);
|
|
1529
|
-
diagnostics.push(diagnostic);
|
|
1530
1494
|
}
|
|
1531
1495
|
});
|
|
1532
1496
|
}
|
|
@@ -1752,17 +1716,17 @@ class NaslServer {
|
|
|
1752
1716
|
if (Array.isArray(node.bindExpressions)) {
|
|
1753
1717
|
const exp = node.bindExpressions.find((bindExpression) => this.hasComponentLogics(bindExpression));
|
|
1754
1718
|
if (exp) {
|
|
1755
|
-
//const element: any = node.getAncestor('ViewElement');
|
|
1756
|
-
//const api = config.allNodesAPI[element?.tag];
|
|
1757
|
-
//const attr = api?.attrs?.find?.((attr) => {
|
|
1719
|
+
// const element: any = node.getAncestor('ViewElement');
|
|
1720
|
+
// const api = config.allNodesAPI[element?.tag];
|
|
1721
|
+
// const attr = api?.attrs?.find?.((attr) => {
|
|
1758
1722
|
// return attr.name === node.name;
|
|
1759
|
-
//});
|
|
1723
|
+
// });
|
|
1760
1724
|
const map = {
|
|
1761
1725
|
BindAttribute: '属性',
|
|
1762
1726
|
BindDirective: '指令',
|
|
1763
1727
|
BindStyle: '样式属性',
|
|
1764
1728
|
};
|
|
1765
|
-
|
|
1729
|
+
// “${attr?.title || node.title || node.name}”
|
|
1766
1730
|
const diagnostic = {
|
|
1767
1731
|
node,
|
|
1768
1732
|
severity: 'error',
|
|
@@ -1785,19 +1749,6 @@ class NaslServer {
|
|
|
1785
1749
|
diagnostics.push(diagnostic);
|
|
1786
1750
|
node.tsErrorDetail = diagnostic;
|
|
1787
1751
|
}
|
|
1788
|
-
} else if (node instanceof Identifier) {
|
|
1789
|
-
// 变量如果选到了页面,因为ts会找到兄弟的同名变量,所以需要新增报错,通过类型来判断加不加
|
|
1790
|
-
// https://projectmanage.netease-official.lcap.163yun.com/dashboard/BugDetail?id=2696136968961024
|
|
1791
|
-
if (node.name && node.__TypeAnnotation?.typeKind === 'reference' && node.__TypeAnnotation?.typeNamespace?.endsWith('views')) {
|
|
1792
|
-
const errorMsg = `找不到 ${node.name}。`;
|
|
1793
|
-
const diagnostic = {
|
|
1794
|
-
node,
|
|
1795
|
-
severity: 'error',
|
|
1796
|
-
message: errorMsg,
|
|
1797
|
-
};
|
|
1798
|
-
diagnostics.push(diagnostic);
|
|
1799
|
-
node.tsErrorDetail = diagnostic;
|
|
1800
|
-
}
|
|
1801
1752
|
} else {
|
|
1802
1753
|
this.checkNodeError(node, diagnostics);
|
|
1803
1754
|
}
|
|
@@ -1937,7 +1888,7 @@ class NaslServer {
|
|
|
1937
1888
|
const { default: defaultVal } = precisionOption || {};
|
|
1938
1889
|
const precision = databaseTypeAnnotation ? (databaseTypeAnnotation.arguments as any)?.precision : defaultVal;
|
|
1939
1890
|
const ruleScale = (typeAnnotation?.ruleMap as any)?.scale;
|
|
1940
|
-
const scale = ruleScale !== undefined ? ruleScale
|
|
1891
|
+
const scale = ruleScale !== undefined ? `${ruleScale }` : '';
|
|
1941
1892
|
let ensureScale = true;
|
|
1942
1893
|
switch (typeName) {
|
|
1943
1894
|
case 'String': {
|
|
@@ -1966,16 +1917,6 @@ class NaslServer {
|
|
|
1966
1917
|
typeAnnotationErrorDetail.errorPos[key] = errorMsg;
|
|
1967
1918
|
}
|
|
1968
1919
|
});
|
|
1969
|
-
} else if (rulesMap?.maxLength && +dataBaseTyp?.max && +rulesMap.maxLength > +dataBaseTyp.max) {
|
|
1970
|
-
// 判断当前 最大长度 是不是比 数据库类型的最大长度 长,超过就报错
|
|
1971
|
-
const errorMsg = `最大长度超出存储长度`;
|
|
1972
|
-
const diag: any = {
|
|
1973
|
-
node: property,
|
|
1974
|
-
severity: 'warning',
|
|
1975
|
-
message: errorMsg,
|
|
1976
|
-
};
|
|
1977
|
-
diagnostics.push(diag);
|
|
1978
|
-
typeAnnotationErrorDetail.errorPos.maxLength = errorMsg;
|
|
1979
1920
|
}
|
|
1980
1921
|
}
|
|
1981
1922
|
case 'Long': {
|
|
@@ -2046,7 +1987,7 @@ class NaslServer {
|
|
|
2046
1987
|
// 储存小数部分
|
|
2047
1988
|
const memoryScaleStr = memoryStr.slice(0, +(scale || '0'));
|
|
2048
1989
|
// 储存绝对值
|
|
2049
|
-
const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ?
|
|
1990
|
+
const memoryAbsVal = memoryIntAbsStr + (memoryScaleStr ? `.${ memoryScaleStr}` : '');
|
|
2050
1991
|
const decimalMemoryAbsVal = new Decimal(memoryAbsVal);
|
|
2051
1992
|
[
|
|
2052
1993
|
{
|
|
@@ -2114,7 +2055,7 @@ class NaslServer {
|
|
|
2114
2055
|
diagnostics.push(diagnostic);
|
|
2115
2056
|
}
|
|
2116
2057
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
2117
|
-
//OQL支持返回复合类型数据了
|
|
2058
|
+
// OQL支持返回复合类型数据了
|
|
2118
2059
|
// SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
|
|
2119
2060
|
// if ((node instanceof OqlQueryComponent || node instanceof SqlQueryComponent) && (node as SqlQueryComponent).getTypeBanError()) {
|
|
2120
2061
|
// const diagnostic = {
|
|
@@ -2130,7 +2071,7 @@ class NaslServer {
|
|
|
2130
2071
|
const typeAnnotation = type2TypeAnnotation((node as any).__nodeType);
|
|
2131
2072
|
if (!node.typeAnnotation && typeAnnotation) {
|
|
2132
2073
|
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
2133
|
-
const typeArguments = typeAnnotation
|
|
2074
|
+
const {typeArguments} = typeAnnotation;
|
|
2134
2075
|
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
2135
2076
|
const diagnostic = {
|
|
2136
2077
|
node,
|
|
@@ -2178,7 +2119,7 @@ class NaslServer {
|
|
|
2178
2119
|
node.tsErrorDetail = diagnostic;
|
|
2179
2120
|
diagnostics.push(diagnostic);
|
|
2180
2121
|
} else {
|
|
2181
|
-
|
|
2122
|
+
node.tsErrorDetail = undefined;
|
|
2182
2123
|
}
|
|
2183
2124
|
}
|
|
2184
2125
|
this.checkNodeError(node, diagnostics);
|
|
@@ -2418,7 +2359,7 @@ class NaslServer {
|
|
|
2418
2359
|
// 先特殊处理等 类型合并后就可以去掉了
|
|
2419
2360
|
if (excludeList.includes(leftType.sortedTypeKey) && excludeList.includes(rightType.sortedTypeKey)) {
|
|
2420
2361
|
return null;
|
|
2421
|
-
}
|
|
2362
|
+
} if (excludeList2.includes(leftType.sortedTypeKey) || excludeList2.includes(rightType.sortedTypeKey)) {
|
|
2422
2363
|
return null;
|
|
2423
2364
|
}
|
|
2424
2365
|
const diagnostic = {
|
|
@@ -2458,7 +2399,7 @@ class NaslServer {
|
|
|
2458
2399
|
if (typeKeyArr[0] === 'apis') {
|
|
2459
2400
|
const structureName = typeKeyArr[3];
|
|
2460
2401
|
const moduleName = typeKeyArr[1];
|
|
2461
|
-
const app = (typeAnnotation.upperNode as Variable)
|
|
2402
|
+
const {app} = (typeAnnotation.upperNode as Variable);
|
|
2462
2403
|
if (!app) {
|
|
2463
2404
|
return null;
|
|
2464
2405
|
}
|
|
@@ -2474,14 +2415,14 @@ class NaslServer {
|
|
|
2474
2415
|
}
|
|
2475
2416
|
}
|
|
2476
2417
|
return null;
|
|
2477
|
-
}
|
|
2418
|
+
}
|
|
2478
2419
|
return diag;
|
|
2479
|
-
|
|
2420
|
+
|
|
2480
2421
|
});
|
|
2481
2422
|
if (actionArr.length) {
|
|
2482
2423
|
if (timer) return;
|
|
2483
2424
|
timer = window.setTimeout(() => {
|
|
2484
|
-
const app = actionArr[0].target
|
|
2425
|
+
const {app} = actionArr[0].target;
|
|
2485
2426
|
app.emit('collect:start', {
|
|
2486
2427
|
actionMsg: '设置导入接口数据类型错误',
|
|
2487
2428
|
});
|
|
@@ -2545,7 +2486,7 @@ class NaslServer {
|
|
|
2545
2486
|
*/
|
|
2546
2487
|
_findMinRange(diagnostic: tsProtocol.DiagnosticWithFileName | tsProtocol.ReferencesResponseItem, fileNode: FileNode) {
|
|
2547
2488
|
let minRange: MinRange;
|
|
2548
|
-
const sourceMap
|
|
2489
|
+
const {sourceMap} = fileNode;
|
|
2549
2490
|
// 是否找到了行内准确的,是的话,就不走多行的
|
|
2550
2491
|
let haveLineNode = false;
|
|
2551
2492
|
for (const [node, item] of sourceMap.entries()) {
|
|
@@ -2553,19 +2494,19 @@ class NaslServer {
|
|
|
2553
2494
|
* 当前内容的开始行 <= 诊断开始的行 &&
|
|
2554
2495
|
* 当前内容的结束行 >= 诊断结束的行
|
|
2555
2496
|
*/
|
|
2556
|
-
if (lsp2tspNumber(item.start.line) <= diagnostic.start.line && lsp2tspNumber(item.end.line) >= diagnostic.end.line) {
|
|
2497
|
+
if (lsp2tspNumber(item.range.start.line) <= diagnostic.start.line && lsp2tspNumber(item.range.end.line) >= diagnostic.end.line) {
|
|
2557
2498
|
// 如果找到某一行
|
|
2558
|
-
if (lsp2tspNumber(item.start.line) === diagnostic.start.line && lsp2tspNumber(item.end.line) === diagnostic.end.line) {
|
|
2499
|
+
if (lsp2tspNumber(item.range.start.line) === diagnostic.start.line && lsp2tspNumber(item.range.end.line) === diagnostic.end.line) {
|
|
2559
2500
|
// 在行的范围但是又不在列的范围,不用给默认值,给了反而不对,
|
|
2560
2501
|
// 需要在列的范围内
|
|
2561
2502
|
if (
|
|
2562
|
-
lsp2tspNumber(item.start.character) <= diagnostic.start.offset &&
|
|
2563
|
-
lsp2tspNumber(item.end.character) >= diagnostic.end.offset
|
|
2503
|
+
lsp2tspNumber(item.range.start.character) <= diagnostic.start.offset &&
|
|
2504
|
+
lsp2tspNumber(item.range.end.character) >= diagnostic.end.offset
|
|
2564
2505
|
) {
|
|
2565
2506
|
// 比列更靠近 ,满足条件且长度更短
|
|
2566
2507
|
// 如果先走到下面有一个默认值了就像在if for里面有个表达式
|
|
2567
2508
|
// if for的内容也是包括当前的所以会重新赋值
|
|
2568
|
-
if (!minRange ||
|
|
2509
|
+
if (!minRange || item.code.length < minRange.item.code.length) {
|
|
2569
2510
|
minRange = { item, node };
|
|
2570
2511
|
haveLineNode = true;
|
|
2571
2512
|
}
|
|
@@ -2577,24 +2518,22 @@ class NaslServer {
|
|
|
2577
2518
|
minRange = { node, item };
|
|
2578
2519
|
} else if (!haveLineNode) {
|
|
2579
2520
|
if (
|
|
2580
|
-
lsp2tspNumber(item.start.line) === diagnostic.start.line &&
|
|
2581
|
-
diagnostic.start.offset >= lsp2tspNumber(item.start.character)
|
|
2521
|
+
lsp2tspNumber(item.range.start.line) === diagnostic.start.line &&
|
|
2522
|
+
diagnostic.start.offset >= lsp2tspNumber(item.range.start.character)
|
|
2582
2523
|
) {
|
|
2583
2524
|
// 如果当前遍历的内容的行和列都 小于之前的, 而且是有效的
|
|
2584
2525
|
// 如果两个内容位置行数是一样的,就比较下找到内容的位置信息
|
|
2585
2526
|
// 找到的内容的开始位置, 要大于申明内容开始的位置,要不就不包含在内了
|
|
2586
|
-
if (diagnostic.start.offset - item.start.character <= diagnostic.start.offset - minRange.item.start.character) {
|
|
2527
|
+
if (diagnostic.start.offset - item.range.start.character <= diagnostic.start.offset - minRange.item.range.start.character) {
|
|
2587
2528
|
minRange = { node, item };
|
|
2588
|
-
} else {
|
|
2589
|
-
if (diagnostic.start.offset < lsp2tspNumber(minRange.item.start.character)) {
|
|
2529
|
+
} else if (diagnostic.start.offset < lsp2tspNumber(minRange.item.range.start.character)) {
|
|
2590
2530
|
minRange = { node, item };
|
|
2591
2531
|
}
|
|
2592
|
-
|
|
2593
|
-
} else if (item.end.line - item.start.line <= minRange.item.end.line - minRange.item.start.line) {
|
|
2532
|
+
} else if (item.range.end.line - item.range.start.line <= minRange.item.range.end.line - minRange.item.range.start.line) {
|
|
2594
2533
|
// 行都一致 ,比较列
|
|
2595
|
-
if (minRange.item.start.line === item.start.line && minRange.item.end.line === item.end.line) {
|
|
2534
|
+
if (minRange.item.range.start.line === item.range.start.line && minRange.item.range.end.line === item.range.end.line) {
|
|
2596
2535
|
// 如果两个起始和结束的行都一样,那么就比较开始列, 要比原来大,说明更精准
|
|
2597
|
-
if (item.start.character > minRange.item.start.character) {
|
|
2536
|
+
if (item.range.start.character > minRange.item.range.start.character) {
|
|
2598
2537
|
minRange = { node, item };
|
|
2599
2538
|
}
|
|
2600
2539
|
} else {
|
|
@@ -2628,12 +2567,11 @@ class NaslServer {
|
|
|
2628
2567
|
if (currentSource) {
|
|
2629
2568
|
const newRefs = await this.references({
|
|
2630
2569
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2631
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2632
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
2570
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2571
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
2633
2572
|
});
|
|
2634
2573
|
refsList = [...newRefs.refs];
|
|
2635
|
-
} else {
|
|
2636
|
-
if (node instanceof Module) {
|
|
2574
|
+
} else if (node instanceof Module) {
|
|
2637
2575
|
const lists = node.logics || node.structures || node.enums;
|
|
2638
2576
|
const moduleName = (fileNode as FileNode).getEmbeddedFilePath();
|
|
2639
2577
|
if (lists.length) {
|
|
@@ -2643,7 +2581,7 @@ class NaslServer {
|
|
|
2643
2581
|
const newRefs = await this.references({
|
|
2644
2582
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2645
2583
|
line: 1,
|
|
2646
|
-
offset: 22,
|
|
2584
|
+
offset: 22, // 固定的位置,module的位置信息
|
|
2647
2585
|
});
|
|
2648
2586
|
refsList = newRefs.refs.filter((item) => !item.file.startsWith(moduleName));
|
|
2649
2587
|
// 多塞一个 ,删除的时候就有值了, 上面过滤了之后可能是空的
|
|
@@ -2651,7 +2589,6 @@ class NaslServer {
|
|
|
2651
2589
|
}
|
|
2652
2590
|
}
|
|
2653
2591
|
}
|
|
2654
|
-
}
|
|
2655
2592
|
|
|
2656
2593
|
// 如果是DataSource就需要在单独,查一边来修改名字
|
|
2657
2594
|
if (node instanceof DataSource) {
|
|
@@ -2672,7 +2609,7 @@ class NaslServer {
|
|
|
2672
2609
|
const entity = this.file2NodeMap.get(item.file);
|
|
2673
2610
|
const { currentSource } = this.getCurrentSource(entity);
|
|
2674
2611
|
// 42 11个函数的总行数
|
|
2675
|
-
if (item.end.line < currentSource.end.line - 42 && item.start.line > 1) {
|
|
2612
|
+
if (item.end.line < currentSource.range.end.line - 42 && item.start.line > 1) {
|
|
2676
2613
|
flag = true;
|
|
2677
2614
|
}
|
|
2678
2615
|
}
|
|
@@ -2701,8 +2638,8 @@ class NaslServer {
|
|
|
2701
2638
|
callQueryComponentTypeAnnotation = key;
|
|
2702
2639
|
}
|
|
2703
2640
|
});
|
|
2704
|
-
const { currentSource: qcTypeAnnotationCurrentSource, fileNode
|
|
2705
|
-
const { currentSource: logicCurrentSource
|
|
2641
|
+
const { currentSource: qcTypeAnnotationCurrentSource, fileNode } = callQueryComponentTypeAnnotation.getCurrentSource();
|
|
2642
|
+
const { currentSource: logicCurrentSource } = fileNode.getCurrentSource();
|
|
2706
2643
|
const aggregateLength = callQueryComponent.select.selectAggregateElements.filter(
|
|
2707
2644
|
(item: any) => item.aggregateName && item.asName
|
|
2708
2645
|
).length;
|
|
@@ -2711,25 +2648,22 @@ class NaslServer {
|
|
|
2711
2648
|
).length;
|
|
2712
2649
|
if (!groupByLength && !aggregateLength && callQueryComponentTypeAnnotation.typeKind === 'anonymousStructure') {
|
|
2713
2650
|
// 拿到 List 的泛型(匿名数据结构)的所有属性
|
|
2714
|
-
const properties = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0]
|
|
2651
|
+
const {properties} = callQueryComponentTypeAnnotation.properties[0].typeAnnotation.typeArguments[0];
|
|
2715
2652
|
const targetProperty = properties.find((p) => p.name === utils.firstLowerCase(node.name));
|
|
2716
2653
|
if (!targetProperty) {
|
|
2717
2654
|
continue;
|
|
2718
2655
|
}
|
|
2719
2656
|
const { currentSource: propertyTypeCurrentSource } = targetProperty.typeAnnotation.getCurrentSource();
|
|
2720
2657
|
// 减去 ": " 2个字符、减去属性名长度
|
|
2721
|
-
const propertyCharacter = propertyTypeCurrentSource.start.character - 2 - targetProperty.name.length;
|
|
2722
|
-
const propertyOffset = propertyCharacter - qcTypeAnnotationCurrentSource.start.character;
|
|
2723
|
-
const
|
|
2724
|
-
const
|
|
2725
|
-
const logicCurrentCode = this.getNodeCode(qcTypeCurrentFileNode, logicCurrentSource);
|
|
2726
|
-
const qcTypeAnnotationOffset = logicCurrentCode.indexOf(qcTypeAnnotationCurrentCode);
|
|
2727
|
-
const declarationCodeArr = logicCurrentCode.slice(0, qcTypeAnnotationOffset).split('\n');
|
|
2658
|
+
const propertyCharacter = propertyTypeCurrentSource.range.start.character - 2 - targetProperty.name.length;
|
|
2659
|
+
const propertyOffset = propertyCharacter - qcTypeAnnotationCurrentSource.range.start.character;
|
|
2660
|
+
const qcTypeAnnotationOffset = logicCurrentSource.code.indexOf(qcTypeAnnotationCurrentSource.code);
|
|
2661
|
+
const declarationCodeArr = logicCurrentSource.code.slice(0, qcTypeAnnotationOffset).split('\n');
|
|
2728
2662
|
const line = declarationCodeArr.length - 1;
|
|
2729
2663
|
const character = declarationCodeArr[declarationCodeArr.length - 1].length;
|
|
2730
2664
|
// eslint-disable-next-line no-await-in-loop
|
|
2731
2665
|
const newRefs = await this.references({
|
|
2732
|
-
file:
|
|
2666
|
+
file: (fileNode as any).getEmbeddedFilePath(),
|
|
2733
2667
|
line: line + 2,
|
|
2734
2668
|
offset: character + 1 + propertyOffset,
|
|
2735
2669
|
});
|
|
@@ -2756,8 +2690,8 @@ class NaslServer {
|
|
|
2756
2690
|
const { currentSource } = this.getCurrentSource(logicNode);
|
|
2757
2691
|
const parentRefs = await this.references({
|
|
2758
2692
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2759
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2760
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
2693
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2694
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
2761
2695
|
});
|
|
2762
2696
|
refsList = [...refsList, ...parentRefs.refs];
|
|
2763
2697
|
}
|
|
@@ -2765,13 +2699,13 @@ class NaslServer {
|
|
|
2765
2699
|
// 如果是参数修改, 就需要把logic的引用 都查找出来就需要把他的父级的引用全部查找出来
|
|
2766
2700
|
if (node instanceof Param && (node.parentNode instanceof View || node.parentNode instanceof Process)) {
|
|
2767
2701
|
const viewNode = node.parentNode;
|
|
2768
|
-
const { currentSource
|
|
2769
|
-
const code =
|
|
2702
|
+
const { currentSource } = this.getCurrentSource(viewNode);
|
|
2703
|
+
const {code} = currentSource;
|
|
2770
2704
|
const viewIndex = code.indexOf(' {');
|
|
2771
2705
|
const viewRefs = await this.references({
|
|
2772
2706
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2773
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2774
|
-
offset: lsp2tspNumber(currentSource.start.character + viewIndex),
|
|
2707
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2708
|
+
offset: lsp2tspNumber(currentSource.range.start.character + viewIndex),
|
|
2775
2709
|
});
|
|
2776
2710
|
let filterViewRefs = [];
|
|
2777
2711
|
if (node.parentNode instanceof View) {
|
|
@@ -2794,8 +2728,8 @@ class NaslServer {
|
|
|
2794
2728
|
// const viewIndex = code.indexOf(' {');
|
|
2795
2729
|
// const viewRefs = await naslServer.references({
|
|
2796
2730
|
// file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2797
|
-
// line: lsp2tspNumber(currentSource.start.line),
|
|
2798
|
-
// offset: lsp2tspNumber(currentSource.start.character + viewIndex),
|
|
2731
|
+
// line: lsp2tspNumber(currentSource.range.start.line),
|
|
2732
|
+
// offset: lsp2tspNumber(currentSource.range.start.character + viewIndex),
|
|
2799
2733
|
// });
|
|
2800
2734
|
// refsList = [...viewRefs.refs];
|
|
2801
2735
|
// }
|
|
@@ -2804,14 +2738,14 @@ class NaslServer {
|
|
|
2804
2738
|
*/
|
|
2805
2739
|
if (node instanceof ViewElement) {
|
|
2806
2740
|
if (currentSource) {
|
|
2807
|
-
const code =
|
|
2741
|
+
const {code} = currentSource;
|
|
2808
2742
|
const prefix = '__elements.';
|
|
2809
2743
|
const prefixIndex = code.indexOf(prefix) !== -1 ? code.indexOf(prefix) : 0;
|
|
2810
2744
|
const methodsNameIndex = prefixIndex + prefix.length;
|
|
2811
2745
|
const methods = await this.references({
|
|
2812
2746
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2813
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2814
|
-
offset: lsp2tspNumber(currentSource.start.character + methodsNameIndex),
|
|
2747
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2748
|
+
offset: lsp2tspNumber(currentSource.range.start.character + methodsNameIndex),
|
|
2815
2749
|
});
|
|
2816
2750
|
const methodRefs: tsProtocol.ReferencesResponseItem[] = [];
|
|
2817
2751
|
methods.refs.forEach((item) => {
|
|
@@ -2830,7 +2764,7 @@ class NaslServer {
|
|
|
2830
2764
|
}
|
|
2831
2765
|
if (node instanceof Process) {
|
|
2832
2766
|
if (currentSource) {
|
|
2833
|
-
const code =
|
|
2767
|
+
const {code} = currentSource;
|
|
2834
2768
|
const prefix = '__ProcessIdentification__';
|
|
2835
2769
|
let positions = [];
|
|
2836
2770
|
let pos = code.indexOf(prefix);
|
|
@@ -2844,8 +2778,8 @@ class NaslServer {
|
|
|
2844
2778
|
const promises = positions.map((item) =>
|
|
2845
2779
|
this.references({
|
|
2846
2780
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2847
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2848
|
-
offset: lsp2tspNumber(currentSource.start.character + item),
|
|
2781
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2782
|
+
offset: lsp2tspNumber(currentSource.range.start.character + item),
|
|
2849
2783
|
})
|
|
2850
2784
|
);
|
|
2851
2785
|
const results = await Promise.all(promises);
|
|
@@ -2855,9 +2789,9 @@ class NaslServer {
|
|
|
2855
2789
|
}
|
|
2856
2790
|
}
|
|
2857
2791
|
if ((node instanceof Param || node instanceof Return) && node.parentNode instanceof Process) {
|
|
2858
|
-
const { currentSource
|
|
2792
|
+
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2859
2793
|
if (currentSource) {
|
|
2860
|
-
const code =
|
|
2794
|
+
const {code} = currentSource;
|
|
2861
2795
|
const prefix = '__ProcessIdentification__';
|
|
2862
2796
|
const positions = [];
|
|
2863
2797
|
let pos = code.indexOf(prefix);
|
|
@@ -2875,8 +2809,8 @@ class NaslServer {
|
|
|
2875
2809
|
const promises = positions.map((item) =>
|
|
2876
2810
|
this.references({
|
|
2877
2811
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2878
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2879
|
-
offset: lsp2tspNumber(currentSource.start.character + item),
|
|
2812
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2813
|
+
offset: lsp2tspNumber(currentSource.range.start.character + item),
|
|
2880
2814
|
})
|
|
2881
2815
|
);
|
|
2882
2816
|
const results = await Promise.all(promises);
|
|
@@ -2887,7 +2821,7 @@ class NaslServer {
|
|
|
2887
2821
|
}
|
|
2888
2822
|
if (node instanceof ProcessElement) {
|
|
2889
2823
|
if (currentSource) {
|
|
2890
|
-
const code =
|
|
2824
|
+
const {code} = currentSource;
|
|
2891
2825
|
const prefix = '__ProcessIdentification__';
|
|
2892
2826
|
let positions = [];
|
|
2893
2827
|
let pos = code.indexOf(prefix);
|
|
@@ -2900,8 +2834,8 @@ class NaslServer {
|
|
|
2900
2834
|
const promises = positions.map((item) =>
|
|
2901
2835
|
this.references({
|
|
2902
2836
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2903
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2904
|
-
offset: lsp2tspNumber(currentSource.start.character + item),
|
|
2837
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2838
|
+
offset: lsp2tspNumber(currentSource.range.start.character + item),
|
|
2905
2839
|
})
|
|
2906
2840
|
);
|
|
2907
2841
|
const results = await Promise.all(promises);
|
|
@@ -2911,9 +2845,9 @@ class NaslServer {
|
|
|
2911
2845
|
}
|
|
2912
2846
|
}
|
|
2913
2847
|
if (node instanceof Return && node.parentNode instanceof ProcessElement) {
|
|
2914
|
-
const { currentSource
|
|
2848
|
+
const { currentSource } = this.getCurrentSource(node.parentNode);
|
|
2915
2849
|
if (currentSource) {
|
|
2916
|
-
const code =
|
|
2850
|
+
const {code} = currentSource;
|
|
2917
2851
|
const prefix = '__ProcessIdentification__';
|
|
2918
2852
|
const positions = [];
|
|
2919
2853
|
let pos = code.indexOf(prefix);
|
|
@@ -2934,8 +2868,8 @@ class NaslServer {
|
|
|
2934
2868
|
const promises = positions.map((item) =>
|
|
2935
2869
|
this.references({
|
|
2936
2870
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
2937
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
2938
|
-
offset: lsp2tspNumber(currentSource.start.character + item),
|
|
2871
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
2872
|
+
offset: lsp2tspNumber(currentSource.range.start.character + item),
|
|
2939
2873
|
})
|
|
2940
2874
|
);
|
|
2941
2875
|
const results = await Promise.all(promises);
|
|
@@ -2988,7 +2922,7 @@ class NaslServer {
|
|
|
2988
2922
|
}
|
|
2989
2923
|
if (minRange.node instanceof CallLogic && node instanceof ViewElement) {
|
|
2990
2924
|
minRange.setTypeMethods = 'setCalleeNamespace';
|
|
2991
|
-
minRange.newValue =
|
|
2925
|
+
minRange.newValue = `elements.${ newValue }.logics`;
|
|
2992
2926
|
}
|
|
2993
2927
|
// 如果节点是实体修改引发calllogic修改
|
|
2994
2928
|
if (
|
|
@@ -3007,9 +2941,9 @@ class NaslServer {
|
|
|
3007
2941
|
* 3.然后把namespace中的 $替换成 ''
|
|
3008
2942
|
*
|
|
3009
2943
|
*/
|
|
3010
|
-
const tsCalleeNamespace = minRange.node
|
|
2944
|
+
const {tsCalleeNamespace} = minRange.node;
|
|
3011
2945
|
// 先看下标位置
|
|
3012
|
-
const lineText = record
|
|
2946
|
+
const {lineText} = record;
|
|
3013
2947
|
const index = lineText.indexOf(tsCalleeNamespace);
|
|
3014
2948
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3015
2949
|
const start = record.start.offset - index - 1;
|
|
@@ -3044,12 +2978,12 @@ class NaslServer {
|
|
|
3044
2978
|
if (minRange.node instanceof Identifier) {
|
|
3045
2979
|
// 匹配到的内容,当前这一行的内容;
|
|
3046
2980
|
// 因为要用下面的点位信息
|
|
3047
|
-
const name = minRange.node
|
|
2981
|
+
const {name} = minRange.node;
|
|
3048
2982
|
// 如果name不改,那就是要改命名空间
|
|
3049
2983
|
if (node instanceof Frontend || newValue === name) {
|
|
3050
|
-
const namespace = minRange.node
|
|
2984
|
+
const {namespace} = minRange.node;
|
|
3051
2985
|
// 先看下标位置
|
|
3052
|
-
const lineText = record
|
|
2986
|
+
const {lineText} = record;
|
|
3053
2987
|
const index = lineText.indexOf(namespace);
|
|
3054
2988
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3055
2989
|
const start = record.start.offset - index - 1;
|
|
@@ -3080,7 +3014,7 @@ class NaslServer {
|
|
|
3080
3014
|
// 枚举key的特殊性,因为它不是原来的key+value形式的
|
|
3081
3015
|
// 是加了中括号啥的,所以直接赋值新值
|
|
3082
3016
|
if (node instanceof EnumItem) {
|
|
3083
|
-
const newTextValue = node.parentNode.name
|
|
3017
|
+
const newTextValue = `${node.parentNode.name }.${ newValue}`;
|
|
3084
3018
|
minRange.newValue = newTextValue;
|
|
3085
3019
|
} else {
|
|
3086
3020
|
// 匹配到的内容,当前这一行的内容;
|
|
@@ -3115,7 +3049,7 @@ class NaslServer {
|
|
|
3115
3049
|
minRange.setTypeMethods = 'setEntityNameAndEffect';
|
|
3116
3050
|
} else if (minRange.node instanceof BindAttribute && minRange.node.name === 'url') {
|
|
3117
3051
|
// 如果是查找到 上传地址的链接引用
|
|
3118
|
-
let newName = newValue.replace(/[A-Z]/g, (item) =>
|
|
3052
|
+
let newName = newValue.replace(/[A-Z]/g, (item) => `-${ item.toLowerCase()}`);
|
|
3119
3053
|
newName = newName[0] === '-' ? newName.slice(1) : newName;
|
|
3120
3054
|
const newTextValue = node.parentNode.name === 'defaultDS' ? `/api/${newName}/import` : `/api/${node.parentNode.name}/${newName}/import`;
|
|
3121
3055
|
minRange.setTypeMethods = 'setUrlValue';
|
|
@@ -3157,11 +3091,11 @@ class NaslServer {
|
|
|
3157
3091
|
* 3.然后把namespace中的 $替换成 ''
|
|
3158
3092
|
*
|
|
3159
3093
|
*/
|
|
3160
|
-
const tsCalleeNamespace = minRange.node
|
|
3161
|
-
const tsName = minRange.node
|
|
3162
|
-
const oldValue = tsCalleeNamespace
|
|
3094
|
+
const {tsCalleeNamespace} = minRange.node;
|
|
3095
|
+
const {tsName} = minRange.node;
|
|
3096
|
+
const oldValue = `${tsCalleeNamespace }.${ tsName}`;
|
|
3163
3097
|
// 先看下标位置
|
|
3164
|
-
const lineText = record
|
|
3098
|
+
const {lineText} = record;
|
|
3165
3099
|
const index = lineText.indexOf(oldValue);
|
|
3166
3100
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3167
3101
|
const start = record.start.offset - index - 1;
|
|
@@ -3178,11 +3112,11 @@ class NaslServer {
|
|
|
3178
3112
|
}
|
|
3179
3113
|
}
|
|
3180
3114
|
if (node instanceof Frontend && minRange.node instanceof Destination) {
|
|
3181
|
-
const tsCalleeNamespace = minRange.node
|
|
3182
|
-
const tsName = minRange.node
|
|
3183
|
-
const oldValue = tsCalleeNamespace
|
|
3115
|
+
const {tsCalleeNamespace} = minRange.node;
|
|
3116
|
+
const {tsName} = minRange.node;
|
|
3117
|
+
const oldValue = `${tsCalleeNamespace }.${ tsName}`;
|
|
3184
3118
|
// 先看下标位置
|
|
3185
|
-
const lineText = record
|
|
3119
|
+
const {lineText} = record;
|
|
3186
3120
|
const index = lineText.indexOf(oldValue);
|
|
3187
3121
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3188
3122
|
const start = record.start.offset - index - 1;
|
|
@@ -3202,7 +3136,7 @@ class NaslServer {
|
|
|
3202
3136
|
// 页面逻辑直接赋值就可以, 因为是相对路径
|
|
3203
3137
|
if (node instanceof ViewElement) {
|
|
3204
3138
|
minRange.setTypeMethods = 'setCalleeNamespace';
|
|
3205
|
-
minRange.newValue =
|
|
3139
|
+
minRange.newValue = `elements.${ newValue }.logics`;
|
|
3206
3140
|
} else {
|
|
3207
3141
|
/**
|
|
3208
3142
|
* 如果namespce是 'app.views.Student.views.404.views.505.views.update'
|
|
@@ -3213,11 +3147,11 @@ class NaslServer {
|
|
|
3213
3147
|
* 2.在匹配到的内容中取转后的namespace的位置
|
|
3214
3148
|
* 3.然后把namespace中的 $替换成 ''
|
|
3215
3149
|
*/
|
|
3216
|
-
const tsCalleeNamespace = minRange.node
|
|
3150
|
+
const {tsCalleeNamespace} = minRange.node;
|
|
3217
3151
|
const oldValue = tsCalleeNamespace;
|
|
3218
3152
|
|
|
3219
3153
|
// 先看下标位置
|
|
3220
|
-
const lineText = record
|
|
3154
|
+
const {lineText} = record;
|
|
3221
3155
|
const index = lineText.indexOf(oldValue);
|
|
3222
3156
|
|
|
3223
3157
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
@@ -3280,7 +3214,7 @@ class NaslServer {
|
|
|
3280
3214
|
if (node instanceof DataSource) {
|
|
3281
3215
|
const setTypeNamespace = (typeNamespace: string, record: any) => {
|
|
3282
3216
|
// 先看下标位置
|
|
3283
|
-
const lineText = record
|
|
3217
|
+
const {lineText} = record;
|
|
3284
3218
|
const index = lineText.indexOf(typeNamespace);
|
|
3285
3219
|
// 在把开始结束位置的-开始位置,来知道是哪里要替换
|
|
3286
3220
|
const start = record.start.offset - index - 1;
|
|
@@ -3405,7 +3339,7 @@ class NaslServer {
|
|
|
3405
3339
|
.sort((a, b) => {
|
|
3406
3340
|
if (a.node.concept === 'QueryFieldExpression') {
|
|
3407
3341
|
return 1;
|
|
3408
|
-
}
|
|
3342
|
+
} if (b.node.concept === 'QueryFieldExpression') {
|
|
3409
3343
|
return -1;
|
|
3410
3344
|
}
|
|
3411
3345
|
return 0;
|
|
@@ -3647,7 +3581,7 @@ class NaslServer {
|
|
|
3647
3581
|
*/
|
|
3648
3582
|
getCurrentSource(node: BaseNode) {
|
|
3649
3583
|
if (node instanceof App || node instanceof Theme) return { fileNode: null };
|
|
3650
|
-
let sourceMap = node
|
|
3584
|
+
let {sourceMap} = node;
|
|
3651
3585
|
let fileNode = node;
|
|
3652
3586
|
// 如果没有sourceMap,就继续向上找 ,或者到module结束
|
|
3653
3587
|
// 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
|
|
@@ -3679,8 +3613,8 @@ class NaslServer {
|
|
|
3679
3613
|
handlingCurrentSourceException(currentSource: SourceMapItem, node: BaseNode) {
|
|
3680
3614
|
// 如果有前面的一些注解,元素在最后一行输出的值就给最后一行
|
|
3681
3615
|
if (node instanceof EntityProperty) {
|
|
3682
|
-
if (currentSource.start.line !== currentSource.end.line) {
|
|
3683
|
-
currentSource.start = { ...currentSource.start, line: currentSource.end.line };
|
|
3616
|
+
if (currentSource.range.start.line !== currentSource.range.end.line) {
|
|
3617
|
+
currentSource.range.start = { ...currentSource.range.start, line: currentSource.range.end.line };
|
|
3684
3618
|
}
|
|
3685
3619
|
}
|
|
3686
3620
|
}
|
|
@@ -3690,26 +3624,26 @@ class NaslServer {
|
|
|
3690
3624
|
const { currentSource, fileNode } = this.getCurrentSource(node);
|
|
3691
3625
|
if (currentSource && fileNode) {
|
|
3692
3626
|
const range = {
|
|
3693
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
3694
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
3627
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
3628
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
3695
3629
|
};
|
|
3696
3630
|
// foreach 在最后一行自动补全
|
|
3697
3631
|
if (node.concept === 'ForEachStatement') {
|
|
3698
|
-
range.line = currentSource.end.line;
|
|
3632
|
+
range.line = currentSource.range.end.line;
|
|
3699
3633
|
range.offset = 0;
|
|
3700
3634
|
} else if (node.concept === 'BindAttribute') {
|
|
3701
|
-
range.offset
|
|
3635
|
+
range.offset += 7;
|
|
3702
3636
|
} else if (node.concept === 'BindDirective') {
|
|
3703
|
-
range.offset
|
|
3637
|
+
range.offset += 5;
|
|
3704
3638
|
}
|
|
3705
3639
|
return this._getFieldKeySelectCompletion({
|
|
3706
3640
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
3707
3641
|
range,
|
|
3708
3642
|
getFieldKey: fieldKey,
|
|
3709
3643
|
});
|
|
3710
|
-
}
|
|
3644
|
+
}
|
|
3711
3645
|
console.log('没找到节点', currentSource, fileNode);
|
|
3712
|
-
|
|
3646
|
+
|
|
3713
3647
|
}
|
|
3714
3648
|
|
|
3715
3649
|
_getFieldKeySelectCompletion(args: any) {
|
|
@@ -3759,7 +3693,7 @@ class NaslServer {
|
|
|
3759
3693
|
return [...fileNodes];
|
|
3760
3694
|
}
|
|
3761
3695
|
|
|
3762
|
-
|
|
3696
|
+
/** 获取当前节点的已知类型
|
|
3763
3697
|
* @param node 当前要获取类型的节点
|
|
3764
3698
|
* @returns 不需要去查就可以返回类型的节点
|
|
3765
3699
|
*/
|
|
@@ -3862,7 +3796,7 @@ class NaslServer {
|
|
|
3862
3796
|
}
|
|
3863
3797
|
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
3864
3798
|
// 只有虚拟节点的入参,才没有类型
|
|
3865
|
-
if (node.concept === 'Param' &&
|
|
3799
|
+
if (node.concept === 'Param' && node.parentKey !== 'virtualParams' && node.parentKey !== 'item') {
|
|
3866
3800
|
return;
|
|
3867
3801
|
}
|
|
3868
3802
|
if (
|
|
@@ -3897,76 +3831,69 @@ class NaslServer {
|
|
|
3897
3831
|
newQuickInfoNodes.push(itemDetail);
|
|
3898
3832
|
const fileDetail = {
|
|
3899
3833
|
file: filePath,
|
|
3900
|
-
line: lsp2tspNumber(item.start.line),
|
|
3901
|
-
offset: lsp2tspNumber(item.start.character),
|
|
3902
|
-
};
|
|
3903
|
-
|
|
3904
|
-
const getCode = (range: SourceMapItem) => {
|
|
3905
|
-
return this.tsFiles.get(filePath)?.slice(range.start.offset, range.end.offset) ?? '';
|
|
3834
|
+
line: lsp2tspNumber(item.range.start.line),
|
|
3835
|
+
offset: lsp2tspNumber(item.range.start.character),
|
|
3906
3836
|
};
|
|
3907
3837
|
|
|
3908
3838
|
// 位置计算偏移
|
|
3909
3839
|
if ('getQuickInfoOffset' in node) {
|
|
3910
|
-
Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail,
|
|
3840
|
+
Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail, item.code));
|
|
3911
3841
|
}
|
|
3912
3842
|
|
|
3913
3843
|
// 位置计算偏移2
|
|
3914
3844
|
// TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
|
|
3915
3845
|
if (
|
|
3916
3846
|
node.concept === 'BinaryExpression' ||
|
|
3847
|
+
node.concept === 'CallLogic' ||
|
|
3917
3848
|
node.concept === 'CallFunction' ||
|
|
3918
3849
|
node.concept === 'CallInterface'
|
|
3919
3850
|
) {
|
|
3920
|
-
const code = getCode(item);
|
|
3921
3851
|
// 如果没有括号 ,括号就在外面,就 -1
|
|
3922
3852
|
// 有括号就找到括号的位置 然后 -1
|
|
3923
3853
|
let indexOf = 0;
|
|
3924
|
-
if (!code.includes('(')) {
|
|
3854
|
+
if (!item.code.includes('(')) {
|
|
3925
3855
|
indexOf = -1;
|
|
3926
3856
|
} else {
|
|
3927
3857
|
// 如果有泛型先往前找一找
|
|
3928
|
-
if (code.includes('<')) {
|
|
3929
|
-
indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
|
|
3858
|
+
if (item.code.includes('<')) {
|
|
3859
|
+
indexOf = Math.min(item.code.indexOf('<'), item.code.indexOf('('));
|
|
3930
3860
|
} else {
|
|
3931
|
-
indexOf = code.indexOf('(');
|
|
3861
|
+
indexOf = item.code.indexOf('(');
|
|
3932
3862
|
}
|
|
3933
|
-
const subStr = code.substring(0, indexOf);
|
|
3863
|
+
const subStr = item.code.substring(0, indexOf);
|
|
3934
3864
|
const codeArr = subStr?.split('.');
|
|
3935
3865
|
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
3936
3866
|
indexOf = subStr.length - lastLen;
|
|
3937
3867
|
}
|
|
3938
|
-
fileDetail.offset
|
|
3868
|
+
fileDetail.offset += indexOf;
|
|
3939
3869
|
} else if (
|
|
3940
3870
|
node.concept === 'MemberExpression' ||
|
|
3941
3871
|
node.concept === 'Identifier' ||
|
|
3942
3872
|
node.concept === 'QueryFieldExpression' ||
|
|
3943
3873
|
node.concept === 'QueryGroupByExpression'
|
|
3944
3874
|
) {
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
const codeArr = code?.split('.');
|
|
3875
|
+
if (item.code.includes('.')) {
|
|
3876
|
+
const codeArr = item.code?.split('.');
|
|
3948
3877
|
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
3949
3878
|
// MemberExpression取最后一位当做类型
|
|
3950
|
-
const indexOf = code.length - lastLen;
|
|
3951
|
-
fileDetail.offset
|
|
3879
|
+
const indexOf = item.code.length - lastLen;
|
|
3880
|
+
fileDetail.offset += indexOf;
|
|
3952
3881
|
}
|
|
3953
3882
|
} else if (node.concept === 'Match') {
|
|
3954
|
-
const code = getCode(item);
|
|
3955
3883
|
// 去查return 后面的返回值,变成函数调用
|
|
3956
|
-
if (code?.endsWith(';\n')) {
|
|
3957
|
-
fileDetail.line = item.end.line - 1;
|
|
3884
|
+
if (item.code?.endsWith(';\n')) {
|
|
3885
|
+
fileDetail.line = item.range.end.line - 1;
|
|
3958
3886
|
} else {
|
|
3959
|
-
fileDetail.line = item.end.line;
|
|
3887
|
+
fileDetail.line = item.range.end.line;
|
|
3960
3888
|
}
|
|
3961
|
-
const indexOf = code.indexOf('return __MatchExpressionFuntion');
|
|
3962
|
-
let newCode = code.substring(0, indexOf);
|
|
3889
|
+
const indexOf = item.code.indexOf('return __MatchExpressionFuntion');
|
|
3890
|
+
let newCode = item.code.substring(0, indexOf);
|
|
3963
3891
|
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
3964
3892
|
fileDetail.offset = newCode.length + 'return '.length;
|
|
3965
3893
|
} else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
let newCode = code.substring(0, indexOf);
|
|
3894
|
+
fileDetail.line = item.range.end.line;
|
|
3895
|
+
const indexOf = item.code.indexOf('return __newComposite');
|
|
3896
|
+
let newCode = item.code.substring(0, indexOf);
|
|
3970
3897
|
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
3971
3898
|
fileDetail.offset = newCode.length + 'return '.length;
|
|
3972
3899
|
} else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
@@ -3982,17 +3909,11 @@ class NaslServer {
|
|
|
3982
3909
|
const item = (resultMap as any)?.[file]?.[line]?.[offset];
|
|
3983
3910
|
const itemType = item?.[0]?.nodeType;
|
|
3984
3911
|
const nodeTypeAnnotation = type2TypeAnnotation(itemType);
|
|
3985
|
-
const node = newQuickInfoNodes[index]
|
|
3912
|
+
const {node} = newQuickInfoNodes[index];
|
|
3986
3913
|
|
|
3987
3914
|
types.set(node, Object.freeze(nodeTypeAnnotation) as TypeAnnotation);
|
|
3988
3915
|
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
if (type) {
|
|
3992
|
-
(node as any).__nodeType = type;
|
|
3993
|
-
} else {
|
|
3994
|
-
delete (node as any).__nodeType;
|
|
3995
|
-
}
|
|
3916
|
+
(node as any).__nodeType = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
|
|
3996
3917
|
});
|
|
3997
3918
|
|
|
3998
3919
|
await utils.timeSlicing(Array.from(getFromOthers.entries()), ([node]) => {
|
|
@@ -4025,9 +3946,9 @@ class NaslServer {
|
|
|
4025
3946
|
const typeAnnotation = value as TypeAnnotation;
|
|
4026
3947
|
if (!node.typeAnnotation && typeAnnotation) {
|
|
4027
3948
|
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
4028
|
-
const typeArguments = typeAnnotation
|
|
3949
|
+
const {typeArguments} = typeAnnotation;
|
|
4029
3950
|
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
4030
|
-
|
|
3951
|
+
node.__TypeAnnotation = null;
|
|
4031
3952
|
return;
|
|
4032
3953
|
}
|
|
4033
3954
|
}
|
|
@@ -4040,12 +3961,12 @@ class NaslServer {
|
|
|
4040
3961
|
}
|
|
4041
3962
|
} else {
|
|
4042
3963
|
// 清空原来已经赋值上去的类型,可能原来有现在没有了
|
|
4043
|
-
|
|
3964
|
+
node.__TypeAnnotation = null;
|
|
4044
3965
|
}
|
|
4045
3966
|
} catch (err) {
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
3967
|
+
if (globalThis.window) {
|
|
3968
|
+
// console.log(err);
|
|
3969
|
+
}
|
|
4049
3970
|
}
|
|
4050
3971
|
});
|
|
4051
3972
|
return types;
|
|
@@ -4199,7 +4120,7 @@ class NaslServer {
|
|
|
4199
4120
|
) {
|
|
4200
4121
|
const { currentSource, fileNode } = matchExpression?.getCurrentSource();
|
|
4201
4122
|
fileNode.sourceMap.forEach((item, itemNode) => {
|
|
4202
|
-
if (itemNode.concept === matchExpression.concept &&
|
|
4123
|
+
if (itemNode.concept === matchExpression.concept && item.code === currentSource.code) {
|
|
4203
4124
|
const jsonNode = jsoner.queryNodeByPath(json, itemNode.getNodePath(false));
|
|
4204
4125
|
jsonNode.typeAnnotation = matchExpression.__TypeAnnotation;
|
|
4205
4126
|
}
|
|
@@ -4260,7 +4181,7 @@ class NaslServer {
|
|
|
4260
4181
|
}
|
|
4261
4182
|
}
|
|
4262
4183
|
// 用户自己声明的用用户的
|
|
4263
|
-
const callObj = App.findNodeByCompleteName(parent.calleeNamespace
|
|
4184
|
+
const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace }.${ parent.calleeName}`);
|
|
4264
4185
|
const index = parent.arguments.indexOf(node);
|
|
4265
4186
|
const param = callObj?.params?.[index] || {};
|
|
4266
4187
|
// 取出参数的类型
|
|
@@ -4508,8 +4429,8 @@ class NaslServer {
|
|
|
4508
4429
|
*/
|
|
4509
4430
|
const oldRefs = await this.references({
|
|
4510
4431
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
4511
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
4512
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
4432
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
4433
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
4513
4434
|
});
|
|
4514
4435
|
oldRefs.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
4515
4436
|
// 更新文件之后
|
|
@@ -4517,8 +4438,8 @@ class NaslServer {
|
|
|
4517
4438
|
|
|
4518
4439
|
const newRefs2 = await this.references({
|
|
4519
4440
|
file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
4520
|
-
line: lsp2tspNumber(currentSource.start.line),
|
|
4521
|
-
offset: lsp2tspNumber(currentSource.start.character),
|
|
4441
|
+
line: lsp2tspNumber(currentSource.range.start.line),
|
|
4442
|
+
offset: lsp2tspNumber(currentSource.range.start.character),
|
|
4522
4443
|
});
|
|
4523
4444
|
newRefs2.refs.forEach((ref) => this.filesToCheck.add(ref.file));
|
|
4524
4445
|
}
|
|
@@ -4536,7 +4457,7 @@ class NaslServer {
|
|
|
4536
4457
|
*/
|
|
4537
4458
|
async incidentalAction(action: string, fileNode: BaseNode, targetNode: BaseNode, oldpath?: string) {
|
|
4538
4459
|
if ((action === 'create' || action === 'delete' || (action === 'update' && oldpath)) && fileNode === targetNode) {
|
|
4539
|
-
|
|
4460
|
+
// 删除、更改、新增端
|
|
4540
4461
|
if (fileNode instanceof Frontend && (fileNode.views?.length || fileNode.variables?.length)) {
|
|
4541
4462
|
const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
|
|
4542
4463
|
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
@@ -4552,7 +4473,7 @@ class NaslServer {
|
|
|
4552
4473
|
} else if (action === 'update' && oldpath) {
|
|
4553
4474
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4554
4475
|
const foldName = fileNodeItem.concept === 'View' ? 'views' : 'variables';
|
|
4555
|
-
const currentOldPath = parentPath + foldName
|
|
4476
|
+
const currentOldPath = `${parentPath + foldName }/${ fileNodeItem.name }.ts`;
|
|
4556
4477
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4557
4478
|
await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
|
|
4558
4479
|
await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
|
|
@@ -4574,7 +4495,7 @@ class NaslServer {
|
|
|
4574
4495
|
await this.incidentalAction(action, fileNodeItem, fileNodeItem);
|
|
4575
4496
|
} else if (action === 'update' && oldpath) {
|
|
4576
4497
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4577
|
-
const currentOldPath = parentPath + fileNodeItem.name
|
|
4498
|
+
const currentOldPath = `${parentPath + fileNodeItem.name }.ts`;
|
|
4578
4499
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4579
4500
|
await this.handleRename(fileNodeItem, fileNodeItem, result, currentOldPath);
|
|
4580
4501
|
await this.incidentalAction(action, fileNodeItem, fileNodeItem, currentOldPath);
|
|
@@ -4618,7 +4539,7 @@ class NaslServer {
|
|
|
4618
4539
|
try {
|
|
4619
4540
|
const result = entity.toEmbeddedTSFile();
|
|
4620
4541
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4621
|
-
const currentOldPath = parentPath
|
|
4542
|
+
const currentOldPath = `${parentPath }/entities/${ entity.name }.ts`;
|
|
4622
4543
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
4623
4544
|
await this.handleRename(entity, entity, result, currentOldPath);
|
|
4624
4545
|
} catch (err) {
|
|
@@ -4632,7 +4553,7 @@ class NaslServer {
|
|
|
4632
4553
|
async receiveHandleChange($event: EventPayload) {
|
|
4633
4554
|
this.singleFileChangeIng = true;
|
|
4634
4555
|
// 行为
|
|
4635
|
-
const action = $event
|
|
4556
|
+
const {action} = $event;
|
|
4636
4557
|
const targetNode = $event.target;
|
|
4637
4558
|
// Connection 相关配置的更新不需要写入文件
|
|
4638
4559
|
if (targetNode?.parentNode instanceof Connection) {
|
|
@@ -4653,14 +4574,9 @@ class NaslServer {
|
|
|
4653
4574
|
return;
|
|
4654
4575
|
}
|
|
4655
4576
|
|
|
4656
|
-
|
|
4657
|
-
console.time('重新生成 TS 文件');
|
|
4658
|
-
}
|
|
4577
|
+
console.time('重新生成 TS 文件');
|
|
4659
4578
|
const result = (fileNode as FileNode).toEmbeddedTSFile();
|
|
4660
|
-
|
|
4661
|
-
console.timeEnd('重新生成 TS 文件');
|
|
4662
|
-
console.log('重新生成 TS 文件', (fileNode as FileNode).getEmbeddedFilePath());
|
|
4663
|
-
}
|
|
4579
|
+
console.timeEnd('重新生成 TS 文件');
|
|
4664
4580
|
|
|
4665
4581
|
// 当前操作的节点
|
|
4666
4582
|
// 如果当前没有生成tsFile
|
|
@@ -4707,19 +4623,13 @@ class NaslServer {
|
|
|
4707
4623
|
if (this.changeStackList.length) {
|
|
4708
4624
|
this.changeFileNext();
|
|
4709
4625
|
} else {
|
|
4710
|
-
|
|
4711
|
-
console.info('校验以下文件', Array.from(this.filesToCheck));
|
|
4712
|
-
}
|
|
4626
|
+
console.info(Array.from(this.filesToCheck));
|
|
4713
4627
|
await this.getDiagnosticRecordsAndPushAll(Array.from(this.filesToCheck));
|
|
4714
4628
|
this.filesToCheck.clear();
|
|
4715
4629
|
}
|
|
4716
4630
|
});
|
|
4717
4631
|
}
|
|
4718
4632
|
}
|
|
4719
|
-
|
|
4720
|
-
private getNodeCode(fileNode: BaseNode, range: SourceMapItem) {
|
|
4721
|
-
return (this.tsFiles.get((fileNode as any).getEmbeddedFilePath()) ?? '').slice(range.start.offset, range.end.offset)
|
|
4722
|
-
}
|
|
4723
4633
|
}
|
|
4724
4634
|
|
|
4725
4635
|
export { NaslServer };
|