@lcap/nasl 3.3.3-beta.5 → 3.3.3-beta.7
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 +73 -15
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +11 -0
- package/out/common/BaseNode.js +51 -0
- package/out/common/BaseNode.js.map +1 -1
- 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/common/utils.d.ts +2 -0
- package/out/common/utils.js +18 -0
- package/out/common/utils.js.map +1 -0
- package/out/concepts/Abort__.d.ts +2 -2
- package/out/concepts/Abort__.js +6 -2
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.d.ts +2 -2
- package/out/concepts/Anchor__.js +11 -7
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +3 -3
- package/out/concepts/AnonymousFunction__.js +37 -23
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js +137 -69
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +2 -2
- package/out/concepts/Argument__.js +18 -13
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +2 -2
- package/out/concepts/Assignee__.js +33 -22
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +2 -2
- package/out/concepts/AssignmentLine__.js +3 -2
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +2 -2
- package/out/concepts/Assignment__.js +16 -12
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +6 -3
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.d.ts +2 -2
- package/out/concepts/AuthLogicForCallInterface__.js +62 -78
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +5 -8
- package/out/concepts/BackendVariable__.js +23 -18
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.d.ts +4 -7
- package/out/concepts/Backend__.js +16 -11
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +2 -2
- package/out/concepts/BatchAssignment__.js +30 -22
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +2 -2
- package/out/concepts/BinaryExpression__.js +30 -18
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +10 -4
- package/out/concepts/BindAttribute__.js +144 -43
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +2 -2
- package/out/concepts/BindDirective__.js +16 -11
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +4 -7
- package/out/concepts/BindEvent__.js +32 -24
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +2 -2
- package/out/concepts/BindStyle__.js +15 -10
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +2 -2
- package/out/concepts/BooleanLiteral__.js +2 -2
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +2 -2
- package/out/concepts/CallAuthInterface__.js +36 -31
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +2 -2
- package/out/concepts/CallConnector__.js +25 -23
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +2 -2
- package/out/concepts/CallFunction__.js +31 -22
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -2
- package/out/concepts/CallInterface__.js +16 -21
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -3
- package/out/concepts/CallLogic__.js +47 -50
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +4 -4
- package/out/concepts/CallQueryComponent__.js +50 -42
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +2 -2
- package/out/concepts/Comment__.js +3 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +6 -3
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +6 -3
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +4 -7
- package/out/concepts/ConfigProperty__.js +18 -13
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +6 -3
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +4 -7
- package/out/concepts/Connection__.js +12 -8
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Connector__.js +30 -15
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +3 -3
- package/out/concepts/Constant__.js +18 -13
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +4 -7
- package/out/concepts/DataSource__.js +13 -9
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +3 -3
- package/out/concepts/Destination__.js +35 -29
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.d.ts +2 -2
- package/out/concepts/End__.js +17 -13
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +2 -2
- package/out/concepts/EntityIndex__.js +4 -3
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +2 -2
- package/out/concepts/EntityProperty__.js +22 -15
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -7
- package/out/concepts/Entity__.js +29 -21
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +2 -2
- package/out/concepts/EnumItem__.js +4 -3
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -7
- package/out/concepts/Enum__.js +16 -11
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +6 -3
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +2 -2
- package/out/concepts/ExternalDestination__.js +13 -8
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +2 -2
- package/out/concepts/ForEachStatement__.js +26 -18
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.js +18 -10
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +4 -7
- package/out/concepts/Frontend__.js +37 -21
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.d.ts +3 -3
- package/out/concepts/Function__.js +52 -33
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -2
- package/out/concepts/Identifier__.js +23 -18
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +2 -2
- package/out/concepts/IfStatement__.js +18 -13
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.js +17 -9
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +2 -2
- package/out/concepts/InterfaceParam__.js +12 -8
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +4 -7
- package/out/concepts/Interface__.js +44 -33
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +2 -2
- package/out/concepts/JSBlock__.js +3 -2
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +2 -2
- package/out/concepts/JavaLogic__.js +6 -2
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -2
- package/out/concepts/LogicItem__.js +7 -3
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +8 -11
- package/out/concepts/Logic__.js +141 -136
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +35 -27
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +2 -2
- package/out/concepts/Match__.js +29 -24
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +2 -2
- package/out/concepts/MemberExpression__.js +34 -27
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.d.ts +4 -7
- package/out/concepts/MetadataType__.js +23 -15
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.js +6 -3
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.js +6 -3
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.js +66 -33
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +6 -6
- package/out/concepts/NewComposite__.js +95 -82
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +5 -5
- package/out/concepts/NewList__.js +42 -32
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +4 -4
- package/out/concepts/NewMap__.js +51 -41
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.d.ts +2 -2
- package/out/concepts/New__.js +3 -2
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +2 -2
- package/out/concepts/NullLiteral__.js +2 -2
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +2 -2
- package/out/concepts/NumericLiteral__.js +12 -7
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +2 -2
- package/out/concepts/OqlQueryComponent__.js +22 -17
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +8 -11
- package/out/concepts/OverriddenLogic__.js +135 -130
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.d.ts +3 -3
- package/out/concepts/Param__.js +29 -24
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +12 -6
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +2 -2
- package/out/concepts/ProcessElement__.js +92 -66
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +2 -1
- package/out/concepts/ProcessOutcome__.js +5 -4
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +2 -1
- package/out/concepts/ProcessOutcomes__.js +6 -5
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +4 -7
- package/out/concepts/Process__.js +51 -34
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +2 -2
- package/out/concepts/QueryAggregateExpression__.js +8 -5
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +2 -2
- package/out/concepts/QueryFieldExpression__.js +5 -4
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +2 -2
- package/out/concepts/QueryFromExpression__.js +14 -9
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +2 -1
- package/out/concepts/QueryGroupByExpression__.js +12 -8
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +2 -2
- package/out/concepts/QueryJoinExpression__.js +18 -13
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +2 -2
- package/out/concepts/QueryLimitExpression__.js +12 -8
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +2 -2
- package/out/concepts/QueryOrderByExpression__.js +12 -8
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +6 -3
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +3 -3
- package/out/concepts/Return__.js +21 -16
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +4 -7
- package/out/concepts/Role__.js +7 -6
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +2 -2
- package/out/concepts/SelectMembers__.js +9 -5
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js +6 -3
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +2 -2
- package/out/concepts/SqlQueryComponent__.js +18 -13
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.d.ts +2 -2
- package/out/concepts/Start__.js +2 -2
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +2 -2
- package/out/concepts/StringInterpolation__.js +13 -8
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +2 -2
- package/out/concepts/StringLiteral__.js +4 -3
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +2 -2
- package/out/concepts/StructureProperty__.js +14 -10
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +4 -7
- package/out/concepts/Structure__.js +22 -14
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +2 -2
- package/out/concepts/SwitchCase__.js +18 -13
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +2 -2
- package/out/concepts/SwitchStatement__.js +14 -9
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerEvent__.js +6 -3
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.d.ts +4 -7
- package/out/concepts/TriggerLauncher__.js +7 -6
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +2 -2
- package/out/concepts/TypeAnnotation__.js +61 -29
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +2 -2
- package/out/concepts/TypeParam__.js +4 -3
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +2 -2
- package/out/concepts/UnaryExpression__.js +18 -10
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +2 -1
- package/out/concepts/Unparsed__.js +2 -2
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +2 -2
- package/out/concepts/ValidationRule__.js +17 -12
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +5 -8
- package/out/concepts/Variable__.js +23 -18
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +7 -6
- package/out/concepts/ViewElement__.js +139 -101
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +8 -9
- package/out/concepts/View__.js +73 -62
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +2 -2
- package/out/concepts/WhileStatement__.js +9 -7
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/manager/diagnostic.js +2 -3
- package/out/manager/diagnostic.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +2 -2
- package/out/server/naslServer.d.ts +46 -55
- package/out/server/naslServer.js +302 -449
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +1 -1
- package/out/server/translator.js.map +1 -1
- package/out/templator/genCreateBlock.js +4 -4
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +6 -6
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -2
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +4 -4
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/translator/types.d.ts +16 -3
- package/out/translator/utils.d.ts +19 -1
- package/out/translator/utils.js +71 -2
- package/out/translator/utils.js.map +1 -1
- package/out/utils/time-slicing/constant.d.ts +35 -0
- package/out/utils/time-slicing/constant.js +40 -0
- package/out/utils/time-slicing/constant.js.map +1 -0
- package/out/utils/time-slicing/controller.d.ts +53 -0
- package/out/utils/time-slicing/controller.js +280 -0
- package/out/utils/time-slicing/controller.js.map +1 -0
- package/out/utils/time-slicing/index.d.ts +5 -0
- package/out/utils/time-slicing/index.js +26 -0
- package/out/utils/time-slicing/index.js.map +1 -0
- package/out/utils/time-slicing/page-state.d.ts +2 -0
- package/out/utils/time-slicing/page-state.js +14 -0
- package/out/utils/time-slicing/page-state.js.map +1 -0
- package/out/utils/time-slicing/performance.d.ts +11 -0
- package/out/utils/time-slicing/performance.js +51 -0
- package/out/utils/time-slicing/performance.js.map +1 -0
- package/out/utils/time-slicing/runner.d.ts +12 -0
- package/out/utils/time-slicing/runner.js +53 -0
- package/out/utils/time-slicing/runner.js.map +1 -0
- package/out/utils/time-slicing/tool.d.ts +24 -0
- package/out/utils/time-slicing/tool.js +47 -0
- package/out/utils/time-slicing/tool.js.map +1 -0
- package/out/utils/time-slicing/utils.d.ts +62 -0
- package/out/utils/time-slicing/utils.js +47 -0
- package/out/utils/time-slicing/utils.js.map +1 -0
- package/out/utils/time-slicing/wrapper.d.ts +18 -0
- package/out/utils/time-slicing/wrapper.js +55 -0
- package/out/utils/time-slicing/wrapper.js.map +1 -0
- package/out/utils/types.d.ts +7 -0
- package/package.json +1 -1
- package/src/bak/translator.js +75 -16
- package/src/common/BaseNode.ts +67 -6
- package/src/common/index.ts +1 -0
- package/src/common/utils.ts +17 -0
- package/src/concepts/Abort__.ts +12 -3
- package/src/concepts/Anchor__.ts +21 -8
- package/src/concepts/AnonymousFunction__.ts +45 -31
- package/src/concepts/App__.ts +137 -69
- package/src/concepts/Argument__.ts +31 -14
- package/src/concepts/Assignee__.ts +44 -23
- package/src/concepts/AssignmentLine__.ts +13 -3
- package/src/concepts/Assignment__.ts +26 -14
- package/src/concepts/Attribute__.ts +6 -3
- package/src/concepts/AuthLogicForCallInterface__.ts +69 -87
- package/src/concepts/BackendVariable__.ts +34 -19
- package/src/concepts/Backend__.ts +33 -12
- package/src/concepts/BatchAssignment__.ts +41 -23
- package/src/concepts/BinaryExpression__.ts +40 -20
- package/src/concepts/BindAttribute__.ts +151 -49
- package/src/concepts/BindDirective__.ts +25 -12
- package/src/concepts/BindEvent__.ts +43 -32
- package/src/concepts/BindStyle__.ts +24 -11
- package/src/concepts/BooleanLiteral__.ts +11 -3
- package/src/concepts/CallAuthInterface__.ts +45 -34
- package/src/concepts/CallConnector__.ts +34 -26
- package/src/concepts/CallFunction__.ts +34 -23
- package/src/concepts/CallInterface__.ts +25 -30
- package/src/concepts/CallLogic__.ts +60 -67
- package/src/concepts/CallQueryComponent__.ts +60 -52
- package/src/concepts/Comment__.ts +13 -3
- package/src/concepts/CompletionProperty__.ts +6 -3
- package/src/concepts/ConfigGroup__.ts +6 -3
- package/src/concepts/ConfigProperty__.ts +28 -15
- package/src/concepts/Configuration__.ts +6 -3
- package/src/concepts/Connection__.ts +28 -9
- package/src/concepts/Connector__.ts +30 -15
- package/src/concepts/Constant__.ts +28 -14
- package/src/concepts/DataSource__.ts +22 -10
- package/src/concepts/Destination__.ts +45 -36
- package/src/concepts/End__.ts +24 -15
- package/src/concepts/EntityIndex__.ts +13 -4
- package/src/concepts/EntityProperty__.ts +33 -17
- package/src/concepts/Entity__.ts +40 -25
- package/src/concepts/EnumItem__.ts +13 -4
- package/src/concepts/Enum__.ts +27 -13
- package/src/concepts/Event__.ts +6 -3
- package/src/concepts/ExternalDestination__.ts +22 -10
- package/src/concepts/ForEachStatement__.ts +36 -20
- package/src/concepts/FrontendLibrary__.ts +18 -10
- package/src/concepts/Frontend__.ts +48 -22
- package/src/concepts/Function__.ts +60 -36
- package/src/concepts/Identifier__.ts +32 -23
- package/src/concepts/IfStatement__.ts +28 -17
- package/src/concepts/Integration__.ts +17 -9
- package/src/concepts/InterfaceParam__.ts +22 -9
- package/src/concepts/Interface__.ts +55 -37
- package/src/concepts/JSBlock__.ts +12 -3
- package/src/concepts/JavaLogic__.ts +13 -3
- package/src/concepts/LogicItem__.ts +13 -4
- package/src/concepts/Logic__.ts +159 -149
- package/src/concepts/MatchCase__.ts +45 -32
- package/src/concepts/Match__.ts +39 -28
- package/src/concepts/MemberExpression__.ts +43 -28
- package/src/concepts/MetadataType__.ts +34 -16
- package/src/concepts/MsgTriggerEvent__.ts +6 -3
- package/src/concepts/MsgTriggerLauncher__.ts +6 -3
- package/src/concepts/Namespace__.ts +66 -33
- package/src/concepts/NewComposite__.ts +106 -87
- package/src/concepts/NewList__.ts +52 -38
- package/src/concepts/NewMap__.ts +61 -48
- package/src/concepts/New__.ts +13 -3
- package/src/concepts/NullLiteral__.ts +11 -3
- package/src/concepts/NumericLiteral__.ts +21 -8
- package/src/concepts/OqlQueryComponent__.ts +32 -21
- package/src/concepts/OverriddenLogic__.ts +153 -143
- package/src/concepts/Param__.ts +48 -34
- package/src/concepts/ProcessComponent__.ts +12 -6
- package/src/concepts/ProcessElement__.ts +102 -76
- package/src/concepts/ProcessOutcome__.ts +16 -8
- package/src/concepts/ProcessOutcomes__.ts +17 -9
- package/src/concepts/Process__.ts +62 -41
- package/src/concepts/QueryAggregateExpression__.ts +17 -6
- package/src/concepts/QueryFieldExpression__.ts +14 -5
- package/src/concepts/QueryFromExpression__.ts +24 -10
- package/src/concepts/QueryGroupByExpression__.ts +20 -9
- package/src/concepts/QueryJoinExpression__.ts +28 -14
- package/src/concepts/QueryLimitExpression__.ts +22 -9
- package/src/concepts/QueryOrderByExpression__.ts +23 -9
- package/src/concepts/QuerySelectExpression__.ts +6 -3
- package/src/concepts/Return__.ts +31 -17
- package/src/concepts/Role__.ts +17 -8
- package/src/concepts/SelectMembers__.ts +19 -6
- package/src/concepts/Slot__.ts +6 -3
- package/src/concepts/SqlQueryComponent__.ts +28 -14
- package/src/concepts/Start__.ts +11 -3
- package/src/concepts/StringInterpolation__.ts +16 -8
- package/src/concepts/StringLiteral__.ts +13 -4
- package/src/concepts/StructureProperty__.ts +24 -11
- package/src/concepts/Structure__.ts +33 -16
- package/src/concepts/SwitchCase__.ts +28 -17
- package/src/concepts/SwitchStatement__.ts +23 -10
- package/src/concepts/TriggerEvent__.ts +6 -3
- package/src/concepts/TriggerLauncher__.ts +17 -7
- package/src/concepts/TypeAnnotation__.ts +46 -30
- package/src/concepts/TypeParam__.ts +13 -4
- package/src/concepts/UnaryExpression__.ts +28 -12
- package/src/concepts/Unparsed__.ts +10 -3
- package/src/concepts/ValidationRule__.ts +27 -20
- package/src/concepts/Variable__.ts +34 -19
- package/src/concepts/ViewElement__.ts +165 -125
- package/src/concepts/View__.ts +108 -89
- package/src/concepts/WhileStatement__.ts +19 -10
- package/src/concepts/types__.ts +1 -1
- package/src/manager/diagnostic.ts +3 -4
- package/src/server/naslServer.ts +676 -729
- package/src/server/translator.ts +1 -1
- package/src/templator/genCreateBlock.ts +4 -4
- package/src/templator/genCurdEditMultipleKeyBlock.ts +6 -6
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
- package/src/templator/genEditTableBlock.ts +2 -2
- package/src/templator/genUpdateBlock.ts +4 -4
- package/src/translator/types.ts +20 -5
- package/src/translator/utils.ts +78 -4
- package/src/utils/time-slicing/constant.ts +37 -0
- package/src/utils/time-slicing/controller.ts +342 -0
- package/src/utils/time-slicing/index.ts +6 -0
- package/src/utils/time-slicing/page-state.ts +12 -0
- package/src/utils/time-slicing/performance.ts +56 -0
- package/src/utils/time-slicing/runner.ts +54 -0
- package/src/utils/time-slicing/tool.ts +45 -0
- package/src/utils/time-slicing/utils.ts +90 -0
- package/src/utils/time-slicing/wrapper.ts +58 -0
- package/src/utils/types.ts +9 -0
- package/test/concepts/anonymous-function/__snapshots__/toEmbeddedTS.spec.ts.snap +8 -0
- package/test/concepts/anonymous-function/__snapshots__/toJS.spec.ts.snap +3 -0
- package/test/concepts/anonymous-function/__snapshots__/toVue.spec.ts.snap +6 -0
- package/test/concepts/anonymous-function/constant.ts +5 -0
- package/test/concepts/anonymous-function/fixtures/simple.json +85 -0
- package/test/concepts/anonymous-function/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/anonymous-function/toJS.spec.ts +14 -0
- package/test/concepts/anonymous-function/toVue.spec.ts +14 -0
- package/test/concepts/assignment/__snapshots__/toEmbeddedTS.spec.ts.snap +21 -0
- package/test/concepts/assignment/__snapshots__/toJS.spec.ts.snap +9 -0
- package/test/concepts/assignment/__snapshots__/toVue.spec.ts.snap +21 -0
- package/test/concepts/assignment/constant.ts +5 -0
- package/test/concepts/assignment/fixtures/both-space.json +4 -0
- package/test/concepts/assignment/fixtures/left-space.json +14 -0
- package/test/concepts/assignment/fixtures/right-space.json +8 -0
- package/test/concepts/assignment/fixtures/simple.json +12 -0
- package/test/concepts/assignment/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/assignment/toJS.spec.ts +14 -0
- package/test/concepts/assignment/toVue.spec.ts +14 -0
- package/test/concepts/batch-assignment/__snapshots__/toEmbeddedTS.spec.ts.snap +28 -0
- package/test/concepts/batch-assignment/__snapshots__/toJS.spec.ts.snap +13 -0
- package/test/concepts/batch-assignment/__snapshots__/toVue.spec.ts.snap +14 -0
- package/test/concepts/batch-assignment/constant.ts +5 -0
- package/test/concepts/batch-assignment/fixtures/muli-var-muli-value.json +144 -0
- package/test/concepts/batch-assignment/fixtures/simple-var-simple-value.json +36 -0
- package/test/concepts/batch-assignment/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/batch-assignment/toJS.spec.ts +14 -0
- package/test/concepts/batch-assignment/toVue.spec.ts +14 -0
- package/test/concepts/binary-expression/__snapshots__/toEmbeddedTS.spec.ts.snap +25 -0
- package/test/concepts/binary-expression/__snapshots__/toJS.spec.ts.snap +17 -0
- package/test/concepts/binary-expression/__snapshots__/toVue.spec.ts.snap +19 -0
- package/test/concepts/binary-expression/constant.ts +5 -0
- package/test/concepts/binary-expression/fixtures/constant-nested.json +36 -0
- package/test/concepts/binary-expression/fixtures/constant-simple.json +12 -0
- package/test/concepts/binary-expression/fixtures/variable-nested.json +69 -0
- package/test/concepts/binary-expression/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/binary-expression/toJS.spec.ts +14 -0
- package/test/concepts/binary-expression/toVue.spec.ts +14 -0
- package/test/concepts/boolean-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/boolean-literal/toJS.spec.ts +2 -2
- package/test/concepts/boolean-literal/toVue.spec.ts +2 -2
- package/test/concepts/call-function/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +6 -3
- package/test/concepts/call-interface/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +3 -3
- package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
- package/test/concepts/call-logic/getQuickInfoOffset.spec.ts +2 -1
- package/test/concepts/call-logic/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/data-source/__snapshots__/toEmbeddedTS.spec.ts.snap +8 -0
- package/test/concepts/data-source/__snapshots__/toEmbeddedTSFile.spec.ts.snap +12 -0
- package/test/concepts/data-source/constant.ts +5 -0
- package/test/concepts/data-source/fixtures/normal.json +289 -0
- package/test/concepts/data-source/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/data-source/toEmbeddedTSFile.spec.ts +16 -0
- package/test/concepts/entity/__snapshots__/toEmbeddedTS.spec.ts.snap +74 -0
- package/test/concepts/entity/__snapshots__/toEmbeddedTSFile.spec.ts.snap +3 -0
- package/test/concepts/entity/constant.ts +5 -0
- package/test/concepts/entity/fixtures/normal.json +469 -0
- package/test/concepts/entity/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/entity/toEmbeddedTSFile.spec.ts +14 -0
- package/test/concepts/identifier/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/identifier/toJS.spec.ts +2 -2
- package/test/concepts/identifier/toVue.spec.ts +2 -2
- package/test/concepts/match/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/member-expression/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/member-expression/toVue.spec.ts +2 -2
- package/test/concepts/null-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/null-literal/toJS.spec.ts +2 -2
- package/test/concepts/null-literal/toVue.spec.ts +2 -2
- package/test/concepts/numeric-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/numeric-literal/toJS.spec.ts +2 -2
- package/test/concepts/numeric-literal/toVue.spec.ts +2 -2
- package/test/concepts/string-literal/toEmbeddedTS.spec.ts +4 -3
- package/test/concepts/string-literal/toJS.spec.ts +2 -2
- package/test/concepts/string-literal/toVue.spec.ts +2 -2
- package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/validation-rule/validation-rule.spec.ts +2 -1
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +0 -2
- package/test/concepts/view-element/toEmbeddedTS.spec.ts +2 -1
- package/test/time-slicing/runner.spec.ts +28 -0
- package/test/time-slicing/time-slicing-nodejs.spec.ts +27 -0
- package/test/time-slicing/utils.ts +7 -0
- package/test/time-slicing/wrapper.spec.ts +92 -0
- package/ts-worker/lib/tsserver.js +10 -1
- package/ts-worker/package.json +1 -0
- package/ts-worker/src/index.js +13 -12
- package/ts-worker/webpack.config.js +1 -1
- package/.nyc_output/f2d14ce8-876a-4dc0-9aaf-e51d08d081ca.json +0 -1
- package/.nyc_output/processinfo/f2d14ce8-876a-4dc0-9aaf-e51d08d081ca.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -446
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/src/automate/engine/index.html +0 -116
- package/coverage/src/automate/engine/utils.js.html +0 -1414
- package/coverage/src/bak/index.html +0 -116
- package/coverage/src/bak/translator.js.html +0 -619
- package/coverage/src/breakpoint/generator/AfterStartNode.ts.html +0 -175
- package/coverage/src/breakpoint/generator/BeforeEndNode.ts.html +0 -169
- package/coverage/src/breakpoint/generator/BreakpointNode.ts.html +0 -1243
- package/coverage/src/breakpoint/generator/CallbackNode.ts.html +0 -145
- package/coverage/src/breakpoint/generator/index.html +0 -176
- package/coverage/src/breakpoint/generator/index.ts.html +0 -508
- package/coverage/src/breakpoint/index.html +0 -116
- package/coverage/src/breakpoint/index.ts.html +0 -94
- package/coverage/src/breakpoint/shared/constants.ts.html +0 -430
- package/coverage/src/breakpoint/shared/index.html +0 -176
- package/coverage/src/breakpoint/shared/index.ts.html +0 -94
- package/coverage/src/breakpoint/shared/operations.ts.html +0 -160
- package/coverage/src/breakpoint/shared/socket.ts.html +0 -1225
- package/coverage/src/breakpoint/shared/utils.ts.html +0 -961
- package/coverage/src/breakpoint/store/core.ts.html +0 -1600
- package/coverage/src/breakpoint/store/dock.ts.html +0 -583
- package/coverage/src/breakpoint/store/index.html +0 -146
- package/coverage/src/breakpoint/store/index.ts.html +0 -91
- package/coverage/src/common/BaseNode.ts.html +0 -3868
- package/coverage/src/common/Command.ts.html +0 -310
- package/coverage/src/common/EventEmitter.ts.html +0 -370
- package/coverage/src/common/Messager.ts.html +0 -820
- package/coverage/src/common/asyncFuncMap.ts.html +0 -127
- package/coverage/src/common/index.html +0 -191
- package/coverage/src/common/index.ts.html +0 -94
- package/coverage/src/concepts/Abort__.ts.html +0 -328
- package/coverage/src/concepts/Anchor__.ts.html +0 -604
- package/coverage/src/concepts/AnonymousFunction__.ts.html +0 -1951
- package/coverage/src/concepts/App__.ts.html +0 -13252
- package/coverage/src/concepts/Argument__.ts.html +0 -910
- package/coverage/src/concepts/Assignee__.ts.html +0 -2236
- package/coverage/src/concepts/AssignmentLine__.ts.html +0 -409
- package/coverage/src/concepts/Assignment__.ts.html +0 -1078
- package/coverage/src/concepts/Attribute__.ts.html +0 -733
- package/coverage/src/concepts/AuthInterface__.ts.html +0 -367
- package/coverage/src/concepts/AuthLogicForCallInterface__.ts.html +0 -1984
- package/coverage/src/concepts/AuthLogic__.ts.html +0 -781
- package/coverage/src/concepts/BackendVariable__.ts.html +0 -1483
- package/coverage/src/concepts/Backend__.ts.html +0 -1165
- package/coverage/src/concepts/BatchAssignment__.ts.html +0 -3250
- package/coverage/src/concepts/BinaryExpression__.ts.html +0 -1336
- package/coverage/src/concepts/BindAttribute__.ts.html +0 -3679
- package/coverage/src/concepts/BindDirective__.ts.html +0 -1921
- package/coverage/src/concepts/BindEvent__.ts.html +0 -3232
- package/coverage/src/concepts/BindStyle__.ts.html +0 -1612
- package/coverage/src/concepts/BooleanLiteral__.ts.html +0 -403
- package/coverage/src/concepts/CallAuthInterface__.ts.html +0 -1615
- package/coverage/src/concepts/CallConnector__.ts.html +0 -868
- package/coverage/src/concepts/CallFunction__.ts.html +0 -1966
- package/coverage/src/concepts/CallInterface__.ts.html +0 -2614
- package/coverage/src/concepts/CallLogic__.ts.html +0 -4420
- package/coverage/src/concepts/CallQueryComponent__.ts.html +0 -5308
- package/coverage/src/concepts/Comment__.ts.html +0 -376
- package/coverage/src/concepts/CompletionProperty__.ts.html +0 -925
- package/coverage/src/concepts/ConfigGroup__.ts.html +0 -1105
- package/coverage/src/concepts/ConfigPropertyValue__.ts.html +0 -424
- package/coverage/src/concepts/ConfigProperty__.ts.html +0 -1348
- package/coverage/src/concepts/Configuration__.ts.html +0 -1027
- package/coverage/src/concepts/Connection__.ts.html +0 -1360
- package/coverage/src/concepts/ConnectorTrigger__.ts.html +0 -595
- package/coverage/src/concepts/Connector__.ts.html +0 -4255
- package/coverage/src/concepts/Constant__.ts.html +0 -913
- package/coverage/src/concepts/DataSource__.ts.html +0 -1771
- package/coverage/src/concepts/DatabaseTypeAnnotation__.ts.html +0 -331
- package/coverage/src/concepts/Destination__.ts.html +0 -2563
- package/coverage/src/concepts/End__.ts.html +0 -433
- package/coverage/src/concepts/EntityIndex__.ts.html +0 -787
- package/coverage/src/concepts/EntityProperty__.ts.html +0 -2620
- package/coverage/src/concepts/Entity__.ts.html +0 -2872
- package/coverage/src/concepts/EnumItem__.ts.html +0 -535
- package/coverage/src/concepts/Enum__.ts.html +0 -1192
- package/coverage/src/concepts/Event__.ts.html +0 -1084
- package/coverage/src/concepts/ExternalDestination__.ts.html +0 -1033
- package/coverage/src/concepts/ForEachStatement__.ts.html +0 -1819
- package/coverage/src/concepts/FrontendLibrary__.ts.html +0 -1711
- package/coverage/src/concepts/FrontendVariable__.ts.html +0 -292
- package/coverage/src/concepts/Frontend__.ts.html +0 -3961
- package/coverage/src/concepts/Function__.ts.html +0 -3514
- package/coverage/src/concepts/Identifier__.ts.html +0 -1057
- package/coverage/src/concepts/IfStatement__.ts.html +0 -1486
- package/coverage/src/concepts/Integration__.ts.html +0 -1228
- package/coverage/src/concepts/InterfaceParam__.ts.html +0 -1087
- package/coverage/src/concepts/Interface__.ts.html +0 -3394
- package/coverage/src/concepts/JSBlock__.ts.html +0 -406
- package/coverage/src/concepts/JavaLogic__.ts.html +0 -460
- package/coverage/src/concepts/LogicItem__.ts.html +0 -1144
- package/coverage/src/concepts/Logic__.ts.html +0 -7078
- package/coverage/src/concepts/MatchCase__.ts.html +0 -2641
- package/coverage/src/concepts/Match__.ts.html +0 -2323
- package/coverage/src/concepts/MemberExpression__.ts.html +0 -1666
- package/coverage/src/concepts/MicroApp__.ts.html +0 -436
- package/coverage/src/concepts/Module__.ts.html +0 -9220
- package/coverage/src/concepts/MsgTriggerEvent__.ts.html +0 -1045
- package/coverage/src/concepts/MsgTriggerLauncher__.ts.html +0 -1018
- package/coverage/src/concepts/Namespace__.ts.html +0 -7942
- package/coverage/src/concepts/NewComposite__.ts.html +0 -4684
- package/coverage/src/concepts/NewList__.ts.html +0 -1567
- package/coverage/src/concepts/NewMap__.ts.html +0 -2275
- package/coverage/src/concepts/New__.ts.html +0 -289
- package/coverage/src/concepts/NullLiteral__.ts.html +0 -349
- package/coverage/src/concepts/NumericLiteral__.ts.html +0 -661
- package/coverage/src/concepts/OqlQueryComponent__.ts.html +0 -1123
- package/coverage/src/concepts/OverriddenLogic__.ts.html +0 -6817
- package/coverage/src/concepts/Param__.ts.html +0 -1609
- package/coverage/src/concepts/Point__.ts.html +0 -331
- package/coverage/src/concepts/ProcessComponent__.ts.html +0 -1666
- package/coverage/src/concepts/ProcessElement__.ts.html +0 -5884
- package/coverage/src/concepts/ProcessOutcome__.ts.html +0 -352
- package/coverage/src/concepts/ProcessOutcomes__.ts.html +0 -343
- package/coverage/src/concepts/Process__.ts.html +0 -4768
- package/coverage/src/concepts/QueryAggregateExpression__.ts.html +0 -568
- package/coverage/src/concepts/QueryFieldExpression__.ts.html +0 -583
- package/coverage/src/concepts/QueryFromExpression__.ts.html +0 -910
- package/coverage/src/concepts/QueryGroupByExpression__.ts.html +0 -559
- package/coverage/src/concepts/QueryJoinExpression__.ts.html +0 -1567
- package/coverage/src/concepts/QueryLimitExpression__.ts.html +0 -637
- package/coverage/src/concepts/QueryOrderByExpression__.ts.html +0 -679
- package/coverage/src/concepts/QuerySelectExpression__.ts.html +0 -1714
- package/coverage/src/concepts/Rect__.ts.html +0 -373
- package/coverage/src/concepts/Return__.ts.html +0 -1258
- package/coverage/src/concepts/Role__.ts.html +0 -601
- package/coverage/src/concepts/SelectMembers__.ts.html +0 -1246
- package/coverage/src/concepts/Slot__.ts.html +0 -628
- package/coverage/src/concepts/SqlQueryComponent__.ts.html +0 -964
- package/coverage/src/concepts/Start__.ts.html +0 -304
- package/coverage/src/concepts/StringInterpolation__.ts.html +0 -1078
- package/coverage/src/concepts/StringLiteral__.ts.html +0 -490
- package/coverage/src/concepts/StructureProperty__.ts.html +0 -1102
- package/coverage/src/concepts/Structure__.ts.html +0 -2053
- package/coverage/src/concepts/SwitchCase__.ts.html +0 -1063
- package/coverage/src/concepts/SwitchStatement__.ts.html +0 -826
- package/coverage/src/concepts/Theme__.ts.html +0 -358
- package/coverage/src/concepts/Transactional__.ts.html +0 -628
- package/coverage/src/concepts/TriggerEvent__.ts.html +0 -1012
- package/coverage/src/concepts/TriggerLauncher__.ts.html +0 -775
- package/coverage/src/concepts/TypeAnnotation__.ts.html +0 -3583
- package/coverage/src/concepts/TypeParam__.ts.html +0 -301
- package/coverage/src/concepts/UnaryExpression__.ts.html +0 -640
- package/coverage/src/concepts/Unparsed__.ts.html +0 -382
- package/coverage/src/concepts/UseComponent__.ts.html +0 -331
- package/coverage/src/concepts/ValidationRule__.ts.html +0 -1840
- package/coverage/src/concepts/Variable__.ts.html +0 -1435
- package/coverage/src/concepts/ViewBlock__.ts.html +0 -352
- package/coverage/src/concepts/ViewComponent__.ts.html +0 -4180
- package/coverage/src/concepts/ViewElement__.ts.html +0 -8557
- package/coverage/src/concepts/View__.ts.html +0 -8278
- package/coverage/src/concepts/WhileStatement__.ts.html +0 -991
- package/coverage/src/concepts/basics/stdlib/index.html +0 -341
- package/coverage/src/concepts/basics/stdlib/index.ts.html +0 -208
- package/coverage/src/concepts/basics/stdlib/nasl.auth.ts.html +0 -565
- package/coverage/src/concepts/basics/stdlib/nasl.browser.ts.html +0 -517
- package/coverage/src/concepts/basics/stdlib/nasl.collection.ts.html +0 -226
- package/coverage/src/concepts/basics/stdlib/nasl.configuration.ts.html +0 -172
- package/coverage/src/concepts/basics/stdlib/nasl.core.ts.html +0 -214
- package/coverage/src/concepts/basics/stdlib/nasl.event.ts.html +0 -145
- package/coverage/src/concepts/basics/stdlib/nasl.http.ts.html +0 -589
- package/coverage/src/concepts/basics/stdlib/nasl.interface.ts.html +0 -214
- package/coverage/src/concepts/basics/stdlib/nasl.io.ts.html +0 -229
- package/coverage/src/concepts/basics/stdlib/nasl.logging.ts.html +0 -268
- package/coverage/src/concepts/basics/stdlib/nasl.process.ts.html +0 -1999
- package/coverage/src/concepts/basics/stdlib/nasl.ui.ts.html +0 -3259
- package/coverage/src/concepts/basics/stdlib/nasl.util.ts.html +0 -6787
- package/coverage/src/concepts/basics/stdlib/nasl.validation.ts.html +0 -1768
- package/coverage/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts.html +0 -163
- package/coverage/src/concepts/basics/types/coreTypeList.ts.html +0 -121
- package/coverage/src/concepts/basics/types/index.html +0 -131
- package/coverage/src/concepts/basics/types/index.ts.html +0 -160
- package/coverage/src/concepts/index.html +0 -1961
- package/coverage/src/concepts/index.ts.html +0 -103
- package/coverage/src/concepts/index__.ts.html +0 -451
- package/coverage/src/config.ts.html +0 -325
- package/coverage/src/decorators/index.html +0 -131
- package/coverage/src/decorators/index.ts.html +0 -574
- package/coverage/src/decorators/promise.ts.html +0 -169
- package/coverage/src/eventBus.ts.html +0 -100
- package/coverage/src/generator/compileComponent.ts.html +0 -142
- package/coverage/src/generator/genBundleFiles.ts.html +0 -1828
- package/coverage/src/generator/genHash.ts.html +0 -124
- package/coverage/src/generator/genMetaData.ts.html +0 -1042
- package/coverage/src/generator/genReleaseBody.ts.html +0 -1282
- package/coverage/src/generator/icestark.ts.html +0 -220
- package/coverage/src/generator/index.html +0 -266
- package/coverage/src/generator/index.ts.html +0 -106
- package/coverage/src/generator/microApp.ts.html +0 -172
- package/coverage/src/generator/permission.ts.html +0 -1036
- package/coverage/src/generator/qiankun.ts.html +0 -232
- package/coverage/src/generator/styleReplacer.ts.html +0 -199
- package/coverage/src/index.html +0 -146
- package/coverage/src/index.ts.html +0 -121
- package/coverage/src/manager/diagnostic.ts.html +0 -442
- package/coverage/src/manager/index.html +0 -131
- package/coverage/src/manager/stepRecorder.ts.html +0 -457
- package/coverage/src/sentry/index.html +0 -116
- package/coverage/src/sentry/index.ts.html +0 -676
- package/coverage/src/server/createUiTs.ts.html +0 -919
- package/coverage/src/server/entity2LogicNamespace.ts.html +0 -1294
- package/coverage/src/server/event.js.html +0 -526
- package/coverage/src/server/extendBaseNode.ts.html +0 -1762
- package/coverage/src/server/formatTsUtils.ts.html +0 -2689
- package/coverage/src/server/getConnector.ts.html +0 -316
- package/coverage/src/server/getExtensionModules.ts.html +0 -178
- package/coverage/src/server/getFunctions.ts.html +0 -133
- package/coverage/src/server/getInterfaces.ts.html +0 -229
- package/coverage/src/server/getLogging.ts.html +0 -100
- package/coverage/src/server/getLogics.ts.html +0 -1363
- package/coverage/src/server/getMemberIdentifier.ts.html +0 -1606
- package/coverage/src/server/getProcessComponents.ts.html +0 -112
- package/coverage/src/server/getProcesses.ts.html +0 -2023
- package/coverage/src/server/getValidates.ts.html +0 -115
- package/coverage/src/server/index.html +0 -401
- package/coverage/src/server/index.ts.html +0 -229
- package/coverage/src/server/naslServer.ts.html +0 -14290
- package/coverage/src/server/naslStdlibMap.ts.html +0 -241
- package/coverage/src/server/process2LogicNamespace.ts.html +0 -454
- package/coverage/src/server/translator.ts.html +0 -2566
- package/coverage/src/service/creator/add.configs.js.html +0 -379
- package/coverage/src/service/creator/errHandles.js.html +0 -322
- package/coverage/src/service/creator/index.html +0 -146
- package/coverage/src/service/creator/index.js.html +0 -352
- package/coverage/src/service/datasource/api.js.html +0 -118
- package/coverage/src/service/datasource/index.html +0 -131
- package/coverage/src/service/datasource/index.js.html +0 -103
- package/coverage/src/service/logic/api.js.html +0 -109
- package/coverage/src/service/logic/index.html +0 -131
- package/coverage/src/service/logic/index.js.html +0 -103
- package/coverage/src/service/storage/api.js.html +0 -202
- package/coverage/src/service/storage/index.html +0 -206
- package/coverage/src/service/storage/index.ts.html +0 -103
- package/coverage/src/service/storage/init.ts.html +0 -2710
- package/coverage/src/service/storage/jsoner.ts.html +0 -502
- package/coverage/src/service/storage/map.ts.html +0 -256
- package/coverage/src/service/storage/service.ts.html +0 -331
- package/coverage/src/service/storage/storagePoint.ts.html +0 -304
- package/coverage/src/templator/genCallComponentLogic.ts.html +0 -163
- package/coverage/src/templator/genCreateBlock.ts.html +0 -1093
- package/coverage/src/templator/genCurdEditMultipleKeyBlock.ts.html +0 -1609
- package/coverage/src/templator/genCurdMultipleKeyBlock.ts.html +0 -2254
- package/coverage/src/templator/genEditTableBlock.ts.html +0 -955
- package/coverage/src/templator/genEnumSelectBlock.ts.html +0 -178
- package/coverage/src/templator/genGetBlock.ts.html +0 -451
- package/coverage/src/templator/genGridViewBlock.ts.html +0 -1114
- package/coverage/src/templator/genListViewBlock.ts.html +0 -475
- package/coverage/src/templator/genQueryComponent.ts.html +0 -1207
- package/coverage/src/templator/genSelectBlock.ts.html +0 -1243
- package/coverage/src/templator/genTableBlock.ts.html +0 -910
- package/coverage/src/templator/genUpdateBlock.ts.html +0 -1192
- package/coverage/src/templator/index.html +0 -326
- package/coverage/src/templator/index.ts.html +0 -154
- package/coverage/src/templator/utils.ts.html +0 -1861
- package/coverage/src/translator/constant.ts.html +0 -106
- package/coverage/src/translator/index.html +0 -146
- package/coverage/src/translator/index.ts.html +0 -94
- package/coverage/src/translator/utils.ts.html +0 -397
- package/coverage/src/utils/cookie.ts.html +0 -265
- package/coverage/src/utils/env.ts.html +0 -91
- package/coverage/src/utils/index.html +0 -236
- package/coverage/src/utils/index.ts.html +0 -655
- package/coverage/src/utils/logger.ts.html +0 -145
- package/coverage/src/utils/sortTsString.ts.html +0 -187
- package/coverage/src/utils/string.ts.html +0 -400
- package/coverage/src/utils/time-slicing.ts.html +0 -412
- package/coverage/src/utils/traverse.ts.html +0 -568
- package/coverage/src/utils/window.ts.html +0 -112
- package/out/utils/time-slicing.d.ts +0 -41
- package/out/utils/time-slicing.js +0 -82
- package/out/utils/time-slicing.js.map +0 -1
- package/src/utils/time-slicing.ts +0 -111
package/src/server/naslServer.ts
CHANGED
|
@@ -80,14 +80,14 @@ import {
|
|
|
80
80
|
AuthLogicForCallInterface,
|
|
81
81
|
Connector,
|
|
82
82
|
AuthInterface,
|
|
83
|
-
SyntaxNode,
|
|
84
83
|
Connection,
|
|
85
84
|
TriggerLauncher,
|
|
86
85
|
CallConnector,
|
|
87
|
-
MetadataType
|
|
86
|
+
MetadataType,
|
|
87
|
+
SyntaxNode,
|
|
88
88
|
} from '../concepts';
|
|
89
89
|
|
|
90
|
-
import { lsp2tspNumber, SourceMap, SourceMapItem, isSameRange } from '../translator';
|
|
90
|
+
import { lsp2tspNumber, SourceMap, SourceMapItem, isSameRange, Range } from '../translator';
|
|
91
91
|
import axios from '../service/storage';
|
|
92
92
|
import { translateDiagnosticMessage, naslNodeTranslateMessage, MinRange, checkAStructure_ } from './translator';
|
|
93
93
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
@@ -102,7 +102,6 @@ import { EventEmitter } from '../common/EventEmitter';
|
|
|
102
102
|
|
|
103
103
|
import { traverse } from '../utils';
|
|
104
104
|
import { withQueueExecute } from '../decorators';
|
|
105
|
-
|
|
106
105
|
import { getNodeByNodeCallee } from '../automate/engine/utils';
|
|
107
106
|
|
|
108
107
|
const EmbeddedTSFileLineMap: { [name: string]: number } = {
|
|
@@ -121,11 +120,7 @@ const SentryMessager = sentryMonitorTSWorkerMessager(Messager);
|
|
|
121
120
|
|
|
122
121
|
export interface FileNode extends BaseNode {
|
|
123
122
|
getEmbeddedFilePath(name?: string): string;
|
|
124
|
-
toEmbeddedTSFile():
|
|
125
|
-
filePath: string;
|
|
126
|
-
code: string;
|
|
127
|
-
sourceMap: SourceMap;
|
|
128
|
-
};
|
|
123
|
+
toEmbeddedTSFile(): utils.EmbeddedTSFileGenerator;
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
interface RenameMinRange extends MinRange {
|
|
@@ -142,6 +137,7 @@ interface QuoteNode {
|
|
|
142
137
|
|
|
143
138
|
// 批量查找节点位置的节点信息类型
|
|
144
139
|
type QuickInfoNodes = Array<{ filePath: string; node: BaseNode; item: SourceMapItem }>;
|
|
140
|
+
type QuickInfoMap = Map<BaseNode, TypeAnnotation | { typeAnnotation: TypeAnnotation; option: any }>;
|
|
145
141
|
|
|
146
142
|
let isChangeInterface = false; // 判断是否导入接口
|
|
147
143
|
type ActionNode = { target: Variable; typeannotation: TypeAnnotation };
|
|
@@ -186,7 +182,6 @@ export function getDisplayString2Type(displayString: string) {
|
|
|
186
182
|
return typeList;
|
|
187
183
|
}
|
|
188
184
|
|
|
189
|
-
|
|
190
185
|
function isCoreDateTimeType(n : Argument): boolean {
|
|
191
186
|
return n?.expression?.__TypeAnnotation?.typeName === 'DateTime' &&
|
|
192
187
|
n?.expression?.__TypeAnnotation?.typeNamespace === 'nasl.core';
|
|
@@ -197,7 +192,6 @@ function isFunctionWithFixedTimeZoneParam(calleeName : string): boolean {
|
|
|
197
192
|
return fns.includes(calleeName);
|
|
198
193
|
}
|
|
199
194
|
|
|
200
|
-
|
|
201
195
|
const timeZoneArgumentIndexMap = new Map<string, number>([
|
|
202
196
|
['ToString', 1],
|
|
203
197
|
['CurrDateTime', 0],
|
|
@@ -282,7 +276,7 @@ class NaslServer {
|
|
|
282
276
|
handleMessage: async ({ data }: any) => {
|
|
283
277
|
if (data && data.event === 'publishDiagnostics') {
|
|
284
278
|
const records = await this._resolveDiagnosticRecords(data.records);
|
|
285
|
-
this.diagnosticManager.pushAll(records);
|
|
279
|
+
await this.diagnosticManager.pushAll(records);
|
|
286
280
|
try {
|
|
287
281
|
// 结束诊断和标注
|
|
288
282
|
invokeCommand('naslServer:endWork');
|
|
@@ -378,301 +372,145 @@ class NaslServer {
|
|
|
378
372
|
await this.getDiagnosticRecordsAndPushAll();
|
|
379
373
|
}
|
|
380
374
|
|
|
381
|
-
contentToFile(module: Module | App | Connector
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
return;
|
|
375
|
+
private *contentToFile(module: Module | App | Connector): Generator<any, utils.EmbeddedTSFileResult[], any> {
|
|
376
|
+
if (!module) {
|
|
377
|
+
return[];
|
|
385
378
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
this.file2NodeMap.set(result.filePath, structure);
|
|
393
|
-
} catch (err) {}
|
|
394
|
-
});
|
|
395
|
-
module.metadataTypes?.forEach((metadataType) => {
|
|
379
|
+
|
|
380
|
+
const self = this;
|
|
381
|
+
const results: utils.EmbeddedTSFileResult[] = [];
|
|
382
|
+
const getTsFile = function* getTsFile(node: FileNode, name: string, pre?: Function) {
|
|
383
|
+
const isContinue = pre ? (input: unknown) => input instanceof pre : () => true;
|
|
384
|
+
|
|
396
385
|
try {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
400
|
-
metadataType.sourceMap = result.sourceMap;
|
|
401
|
-
this.file2NodeMap.set(result.filePath, metadataType);
|
|
402
|
-
} catch (err) {}
|
|
403
|
-
});
|
|
404
|
-
if (module instanceof App) {
|
|
405
|
-
module.overriddenLogics?.forEach?.((logic) => {
|
|
406
|
-
try {
|
|
407
|
-
if (!(logic instanceof OverriddenLogic)) return;
|
|
408
|
-
const result = logic.toEmbeddedTSFile();
|
|
409
|
-
results.push(result);
|
|
410
|
-
logic.sourceMap = result.sourceMap;
|
|
411
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
412
|
-
} catch (err) {
|
|
413
|
-
console.error('err: ', err);
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
module?.backend?.variables?.forEach((backdndVariable) => {
|
|
417
|
-
try {
|
|
418
|
-
const result = backdndVariable.toEmbeddedTSFile();
|
|
419
|
-
results.push(result);
|
|
420
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
421
|
-
backdndVariable.sourceMap = result.sourceMap;
|
|
422
|
-
this.file2NodeMap.set(result.filePath, backdndVariable);
|
|
423
|
-
} catch (err) {
|
|
424
|
-
console.error(err);
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
module.frontends?.forEach((frontend) => {
|
|
428
|
-
try {
|
|
429
|
-
const result = frontend.toEmbeddedTSFile();
|
|
430
|
-
results.push(result);
|
|
431
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
432
|
-
frontend.sourceMap = result.sourceMap;
|
|
433
|
-
this.file2NodeMap.set(result.filePath, frontend);
|
|
434
|
-
} catch (err) {
|
|
435
|
-
console.log(err);
|
|
386
|
+
if (!isContinue(node)) {
|
|
387
|
+
return;
|
|
436
388
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
frontend.bindEvents?.forEach((bindEvent) => {
|
|
449
|
-
if (bindEvent?.logics && bindEvent?.logics?.length > 0) {
|
|
450
|
-
bindEvent.logics.forEach((logic: Logic) => {
|
|
451
|
-
try {
|
|
452
|
-
const result = logic.toEmbeddedTSFile();
|
|
453
|
-
results.push(result);
|
|
454
|
-
logic.sourceMap = result.sourceMap;
|
|
455
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
456
|
-
} catch (err) {
|
|
457
|
-
console.error('err: ', err);
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
// view的生成
|
|
463
|
-
if (!config.closeViews) {
|
|
464
|
-
this.view2TSFile(frontend.views, results);
|
|
389
|
+
|
|
390
|
+
const result = yield* node.toEmbeddedTSFile();
|
|
391
|
+
|
|
392
|
+
results.push(result);
|
|
393
|
+
node.sourceMap = result.sourceMap;
|
|
394
|
+
self.file2NodeMap.set(result.filePath, node);
|
|
395
|
+
} catch (err) {
|
|
396
|
+
if (process.env.NODE_ENV === 'development') {
|
|
397
|
+
console.warn(node.nodePath ? node.nodePath : name, '代码转换失败', err);
|
|
465
398
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
const getTsFiles = function* getTsFiles(nodes: FileNode[], name: string, pre?: Function) {
|
|
402
|
+
for (const node of nodes ?? []) {
|
|
403
|
+
yield* getTsFile(node, name, pre);
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
const concat = <T, K extends keyof T>(arr: T[], key: K): T[K] => {
|
|
407
|
+
return arr.reduce((ans, item) => ans.concat(item[key]), []) as any;
|
|
408
|
+
};
|
|
409
|
+
const view2TSFile = function* view2TSFile(views: View[]): Generator<void, void, any> {
|
|
410
|
+
if (!views || views.length === 0) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
for (const view of views) {
|
|
415
|
+
yield* getTsFile(view, 'view');
|
|
416
|
+
|
|
417
|
+
if (view.children) {
|
|
418
|
+
yield* view2TSFile(view.children);
|
|
480
419
|
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
420
|
+
}
|
|
421
|
+
};
|
|
483
422
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
results.push(result);
|
|
489
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
490
|
-
dataSource.sourceMap = result.sourceMap;
|
|
491
|
-
this.file2NodeMap.set(result.filePath, dataSource);
|
|
492
|
-
} catch (err) {}
|
|
493
|
-
dataSource.entities.forEach((entity) => {
|
|
494
|
-
try {
|
|
495
|
-
const result = entity.toEmbeddedTSFile();
|
|
496
|
-
results.push(result);
|
|
497
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
498
|
-
entity.sourceMap = result.sourceMap;
|
|
499
|
-
this.file2NodeMap.set(result.filePath, entity);
|
|
500
|
-
} catch (err) {}
|
|
501
|
-
});
|
|
502
|
-
});
|
|
423
|
+
// 禁用的依赖库不生成代码 区分 undefined 和 false
|
|
424
|
+
if (module instanceof Module && module.type === 'extension' && module.enable === false) {
|
|
425
|
+
return [];
|
|
426
|
+
}
|
|
503
427
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
} catch (err) {}
|
|
530
|
-
});
|
|
428
|
+
const {
|
|
429
|
+
structures = [],
|
|
430
|
+
metadataTypes = [],
|
|
431
|
+
frontends = [],
|
|
432
|
+
interfaces = [],
|
|
433
|
+
enums = [],
|
|
434
|
+
logics = [],
|
|
435
|
+
authLogics = [],
|
|
436
|
+
authLogicsForCallInterface = [],
|
|
437
|
+
processes = [],
|
|
438
|
+
dataSources = [],
|
|
439
|
+
triggerLaunchers = [],
|
|
440
|
+
connections = [],
|
|
441
|
+
roles = [],
|
|
442
|
+
overriddenLogics = [],
|
|
443
|
+
backend,
|
|
444
|
+
configuration,
|
|
445
|
+
} = module as App;
|
|
446
|
+
|
|
447
|
+
const {
|
|
448
|
+
namespaces = [],
|
|
449
|
+
} = module as Connector;
|
|
450
|
+
|
|
451
|
+
yield* getTsFiles(structures, 'structure');
|
|
452
|
+
yield* getTsFiles(metadataTypes, 'metadataType');
|
|
531
453
|
|
|
532
|
-
(module
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
const result = logic.toEmbeddedTSFile();
|
|
536
|
-
results.push(result);
|
|
537
|
-
logic.sourceMap = result.sourceMap;
|
|
538
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
539
|
-
} catch (err) {}
|
|
540
|
-
});
|
|
454
|
+
if (module instanceof App) {
|
|
455
|
+
yield* getTsFiles(overriddenLogics, 'overriddenLogic', OverriddenLogic);
|
|
456
|
+
yield* getTsFiles(backend?.variables ?? [], 'backend_variable');
|
|
541
457
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
results.push(result);
|
|
547
|
-
logic.sourceMap = result.sourceMap;
|
|
548
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
549
|
-
} catch (err) {}
|
|
550
|
-
});
|
|
458
|
+
for (const frontend of frontends) {
|
|
459
|
+
yield* getTsFile(frontend, 'frontend');
|
|
460
|
+
yield* getTsFiles(frontend.variables, 'frontend_variable');
|
|
461
|
+
yield* getTsFiles(concat(frontend.bindEvents, 'logics'), 'frontend_bindEvent_logic');
|
|
551
462
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
results.push(result);
|
|
556
|
-
process.sourceMap = result.sourceMap;
|
|
557
|
-
this.file2NodeMap.set(result.filePath, process);
|
|
558
|
-
} catch (err) {}
|
|
559
|
-
});
|
|
463
|
+
if (!config.closeViews) {
|
|
464
|
+
yield* view2TSFile(frontend.views);
|
|
465
|
+
}
|
|
560
466
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
const result = launcher.toEmbeddedTSFile();
|
|
565
|
-
results.push(result);
|
|
566
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
567
|
-
launcher.sourceMap = result.sourceMap;
|
|
568
|
-
this.file2NodeMap.set(result.filePath, launcher);
|
|
569
|
-
});
|
|
570
|
-
module.namespaces?.forEach?.((namespace) => {
|
|
571
|
-
namespace.logics.forEach((logic) => {
|
|
572
|
-
const result = logic.toEmbeddedTSFile();
|
|
573
|
-
results.push(result);
|
|
574
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
575
|
-
logic.sourceMap = result.sourceMap;
|
|
576
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
577
|
-
});
|
|
578
|
-
})
|
|
579
|
-
module?.authLogicsForCallInterface?.forEach?.((logic) => {
|
|
580
|
-
try {
|
|
581
|
-
if (!(logic instanceof Logic)) return;
|
|
582
|
-
const result = logic.toEmbeddedTSFile();
|
|
583
|
-
results.push(result);
|
|
584
|
-
logic.sourceMap = result.sourceMap;
|
|
585
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
586
|
-
} catch (err) {}
|
|
587
|
-
});
|
|
588
|
-
} catch (error) {
|
|
589
|
-
console.error(error);
|
|
467
|
+
for (const dep of frontend.componentDependencies) {
|
|
468
|
+
results.push(...(yield* self.contentToFile(dep)));
|
|
469
|
+
}
|
|
590
470
|
}
|
|
471
|
+
} else {
|
|
472
|
+
yield* getTsFiles(concat(frontends, 'logics' as any), 'frontend_logic');
|
|
591
473
|
}
|
|
592
474
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
475
|
+
yield* getTsFiles(dataSources, 'dataSource');
|
|
476
|
+
yield* getTsFiles(concat(dataSources, 'entities'), 'dataSource_entity');
|
|
477
|
+
yield* getTsFiles(interfaces, 'interface');
|
|
478
|
+
yield* getTsFiles(enums, 'enum');
|
|
479
|
+
yield* getTsFiles(logics, 'logic');
|
|
480
|
+
yield* getTsFiles(authLogics, 'authLogic', Logic);
|
|
481
|
+
yield* getTsFiles(authLogicsForCallInterface, 'authLogicForCallInterface', Logic);
|
|
482
|
+
yield* getTsFiles(processes, 'process');
|
|
483
|
+
|
|
484
|
+
if (module instanceof Connector) {
|
|
485
|
+
yield* getTsFiles(triggerLaunchers, 'triggerLauncher');
|
|
486
|
+
yield* getTsFiles(authLogicsForCallInterface, 'authLogicForCallInterface');
|
|
487
|
+
yield* getTsFiles(concat(namespaces, 'logics'), 'namespaces_logic');
|
|
603
488
|
}
|
|
604
489
|
|
|
605
490
|
if (module instanceof App) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
results.push(result);
|
|
610
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
611
|
-
connection.sourceMap = result.sourceMap;
|
|
612
|
-
this.file2NodeMap.set(result.filePath, connection);
|
|
613
|
-
} catch (err) {}
|
|
614
|
-
});
|
|
615
|
-
module.triggerLaunchers?.forEach?.((triggerLauncher) => {
|
|
616
|
-
try {
|
|
617
|
-
const result = triggerLauncher.toEmbeddedTSFile();
|
|
618
|
-
results.push(result);
|
|
619
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
620
|
-
triggerLauncher.sourceMap = result.sourceMap;
|
|
621
|
-
this.file2NodeMap.set(result.filePath, triggerLauncher);
|
|
622
|
-
} catch (err) {}
|
|
623
|
-
});
|
|
491
|
+
yield* getTsFiles(roles, 'role');
|
|
492
|
+
yield* getTsFiles(connections, 'connection');
|
|
493
|
+
yield* getTsFiles(triggerLaunchers, 'triggerLauncher');
|
|
624
494
|
}
|
|
625
495
|
|
|
626
|
-
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
try {
|
|
630
|
-
const result = _property.toEmbeddedTSFile();
|
|
631
|
-
results.push(result);
|
|
632
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
633
|
-
_property.sourceMap = result.sourceMap;
|
|
634
|
-
this.file2NodeMap.set(result.filePath, _property);
|
|
635
|
-
} catch (err) {}
|
|
636
|
-
});
|
|
496
|
+
for (const group of configuration?.groups ?? []) {
|
|
497
|
+
if (group.name === 'custom') {
|
|
498
|
+
yield* getTsFiles(group?.properties ?? [], 'configuration_group_property');
|
|
637
499
|
}
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
view2TSFile(viewsChildren: View[], results: Array<ReturnType<Structure['toEmbeddedTSFile']>>) {
|
|
642
|
-
// 如果有子页面
|
|
643
|
-
if (viewsChildren && viewsChildren.length) {
|
|
644
|
-
viewsChildren.forEach((view) => {
|
|
645
|
-
try {
|
|
646
|
-
const result = view.toEmbeddedTSFile();
|
|
647
|
-
results.push(result);
|
|
648
|
-
view.sourceMap = result.sourceMap;
|
|
649
|
-
this.file2NodeMap.set(result.filePath, view);
|
|
650
|
-
if (view.children.length) {
|
|
651
|
-
this.view2TSFile(view.children, results);
|
|
652
|
-
}
|
|
653
|
-
} catch (err) {}
|
|
654
|
-
});
|
|
655
500
|
}
|
|
501
|
+
|
|
502
|
+
return results;
|
|
656
503
|
}
|
|
657
504
|
|
|
658
505
|
async openApp(app: App) {
|
|
659
506
|
console.time('生成 TS 文件');
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
// app的创建内容
|
|
663
|
-
this.contentToFile(app, results);
|
|
664
|
-
// 其他模块的创建内容
|
|
665
|
-
app.integration?.connectors?.forEach((item) => this.contentToFile(item, results));
|
|
666
|
-
app.dependencies.forEach((item) => this.contentToFile(item, results));
|
|
667
|
-
app.interfaceDependencies.forEach((item) => this.contentToFile(item, results));
|
|
668
|
-
} catch (err) {
|
|
669
|
-
console.log(err);
|
|
670
|
-
}
|
|
671
|
-
|
|
507
|
+
const self = this;
|
|
508
|
+
const results = await utils.timeSlicingWithGenerator(getAllTsFiles());
|
|
672
509
|
const files = results.map((result) => ({
|
|
673
510
|
file: result.filePath,
|
|
674
511
|
fileContent: result.code,
|
|
675
512
|
}));
|
|
513
|
+
|
|
676
514
|
await this.writeFiles(files);
|
|
677
515
|
this._debugInFileStorage(app, files);
|
|
678
516
|
// 修改名称回调
|
|
@@ -684,6 +522,21 @@ class NaslServer {
|
|
|
684
522
|
callback();
|
|
685
523
|
});
|
|
686
524
|
console.timeEnd('生成 TS 文件');
|
|
525
|
+
|
|
526
|
+
function* getAllTsFiles() {
|
|
527
|
+
const files = yield* self.contentToFile(app);
|
|
528
|
+
const otherModules = [
|
|
529
|
+
...app.integration?.connectors ?? [],
|
|
530
|
+
...app.dependencies ?? [],
|
|
531
|
+
...app.interfaceDependencies ?? [],
|
|
532
|
+
];
|
|
533
|
+
|
|
534
|
+
for (const item of otherModules) {
|
|
535
|
+
files.push(...yield* self.contentToFile(item));
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
return files;
|
|
539
|
+
}
|
|
687
540
|
}
|
|
688
541
|
|
|
689
542
|
async refreshApp(app: App) {
|
|
@@ -714,13 +567,19 @@ class NaslServer {
|
|
|
714
567
|
__naslStdlibFileCacheMap.set(options.file, options);
|
|
715
568
|
}
|
|
716
569
|
|
|
717
|
-
/**
|
|
570
|
+
/**
|
|
718
571
|
* 只新增文件
|
|
719
572
|
* @param {*} files
|
|
720
573
|
*/
|
|
721
574
|
writeFiles(files: Array<tsProtocol.OpenRequestArgs>) {
|
|
722
575
|
files.forEach(({ file, fileContent }) => this.tsFiles.set(file, fileContent));
|
|
723
|
-
|
|
576
|
+
const noRepeatFiles = Array.from(this.tsFiles.entries()).map(([key, value]) => ({
|
|
577
|
+
file: key,
|
|
578
|
+
fileContent: value,
|
|
579
|
+
}));
|
|
580
|
+
// const newFiles = require('/Users/sufangzhou/dev/neteast/lcap-ide/packages/nasl/tmp/files-original.json');
|
|
581
|
+
// debugger;
|
|
582
|
+
return this.messager.requestCommand('writeFiles', noRepeatFiles);
|
|
724
583
|
}
|
|
725
584
|
|
|
726
585
|
/**
|
|
@@ -1068,26 +927,29 @@ class NaslServer {
|
|
|
1068
927
|
node.tsErrorDetail = tsErrorDetail;
|
|
1069
928
|
}
|
|
1070
929
|
|
|
1071
|
-
|
|
1072
|
-
* 处理诊断结果
|
|
1073
|
-
* @param records 结果
|
|
1074
|
-
* @returns 过滤或者转换后的诊断结果
|
|
1075
|
-
*/
|
|
1076
|
-
@withQueueExecute('diagnostic')
|
|
1077
|
-
async _resolveDiagnosticRecords(records: Array<DiagnosticRecord>) {
|
|
930
|
+
private *_resolveDiagnosticRecordsWithGenerator(records: Array<DiagnosticRecord>) {
|
|
1078
931
|
// 热更新类型标注
|
|
1079
932
|
if (records.length) {
|
|
1080
|
-
|
|
933
|
+
yield* this._incrementalAnnotationJSONWithGenerator(records);
|
|
1081
934
|
}
|
|
1082
|
-
await Promise.all(
|
|
1083
|
-
records.map(async (record) => {
|
|
1084
|
-
const {node} = record;
|
|
1085
|
-
if (!node) return;
|
|
1086
935
|
|
|
1087
|
-
|
|
1088
|
-
|
|
936
|
+
const self = this;
|
|
937
|
+
|
|
938
|
+
console.time('处理诊断数据');
|
|
1089
939
|
|
|
1090
|
-
|
|
940
|
+
yield* utils.wrapForEachToGenerator(records, function* resolveRecord(record) {
|
|
941
|
+
if (!record || !record.node) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
const { node } = record;
|
|
946
|
+
|
|
947
|
+
// 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
|
|
948
|
+
const oldRecord = self.diagnosticManager.getRecord?.(record.id);
|
|
949
|
+
|
|
950
|
+
// 处理旧数据
|
|
951
|
+
if (oldRecord) {
|
|
952
|
+
yield* utils.wrapForEachToGenerator(oldRecord.semanticDiagnostics, (item) => {
|
|
1091
953
|
if (item.node) {
|
|
1092
954
|
delete item.node.tsErrorDetail;
|
|
1093
955
|
// 如果logic中有报错就把标识置为true
|
|
@@ -1097,8 +959,7 @@ class NaslServer {
|
|
|
1097
959
|
}
|
|
1098
960
|
});
|
|
1099
961
|
|
|
1100
|
-
|
|
1101
|
-
oldRecord?.suggestionDiagnostics.forEach((item) => {
|
|
962
|
+
yield* utils.wrapForEachToGenerator(oldRecord.suggestionDiagnostics, (item) => {
|
|
1102
963
|
if (item.node) {
|
|
1103
964
|
delete item.node.tsErrorDetail;
|
|
1104
965
|
if (item.node && item.node instanceof Logic) {
|
|
@@ -1106,146 +967,173 @@ class NaslServer {
|
|
|
1106
967
|
}
|
|
1107
968
|
}
|
|
1108
969
|
});
|
|
970
|
+
}
|
|
1109
971
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
972
|
+
// 语义诊断
|
|
973
|
+
if (isChangeInterface) {
|
|
974
|
+
yield* self.existStructureFix(record.semanticDiagnostics, record.node as FileNode, self);
|
|
975
|
+
}
|
|
1114
976
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
977
|
+
// 单独处理 oql 语义错误提示
|
|
978
|
+
if (record.node instanceof Logic) {
|
|
979
|
+
yield* utils.wrapForEachToGenerator(record?.syntaxDiagnostics, function *test(item) {
|
|
980
|
+
const minRange = yield* self._findMinRangeWithGenerator(item as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode);
|
|
981
|
+
if (minRange?.node instanceof OqlQueryComponent) {
|
|
982
|
+
if (item.text === 'Invalid character.') {
|
|
983
|
+
record.semanticDiagnostics.push(item);
|
|
1123
984
|
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
// 记录结构体数据
|
|
990
|
+
yield* utils.wrapForEachToGenerator(record.semanticDiagnostics, (diag) => {
|
|
991
|
+
checkAStructure_(diag.text);
|
|
992
|
+
});
|
|
1126
993
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
994
|
+
record.semanticDiagnostics = (
|
|
995
|
+
yield*
|
|
996
|
+
utils.wrapMapToGenerator(record.semanticDiagnostics, function* (diag) {
|
|
997
|
+
return yield* self._resolveDiagnosticWithGenerator(
|
|
998
|
+
diag as unknown as tsProtocol.DiagnosticWithFileName,
|
|
999
|
+
record.node as FileNode,
|
|
1000
|
+
record
|
|
1001
|
+
);
|
|
1002
|
+
})
|
|
1003
|
+
).filter((diag) => !!diag);
|
|
1004
|
+
|
|
1005
|
+
record.semanticDiagnostics.push(...(yield* self._attachDiagnosticsWithGenerator(node)));
|
|
1006
|
+
|
|
1007
|
+
// 报错降级逻辑
|
|
1008
|
+
record.semanticDiagnostics = (
|
|
1009
|
+
yield*
|
|
1010
|
+
utils.wrapMapToGenerator(record.semanticDiagnostics, (diagnostic) => {
|
|
1011
|
+
// 错误降级如果属于草稿态的就降级
|
|
1012
|
+
if (diagnostic?.node) {
|
|
1013
|
+
let currentNode = diagnostic.node;
|
|
1014
|
+
if (diagnostic.severity === 'warning') {
|
|
1015
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
1016
|
+
return null;
|
|
1017
|
+
} if (currentNode.concept === 'OqlQueryComponent') {
|
|
1018
|
+
// OQL别名错误降级为警告
|
|
1019
|
+
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
1020
|
+
// 重置 图标和错误等级
|
|
1021
|
+
diagnostic.severity = 'warning';
|
|
1022
|
+
if (diagnostic.node?.tsErrorDetail) {
|
|
1023
|
+
// 重置组件节点上的错误信息
|
|
1024
|
+
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
1025
|
+
}
|
|
1142
1026
|
record.suggestionDiagnostics.push(diagnostic);
|
|
1143
1027
|
return null;
|
|
1144
|
-
} if (currentNode.concept === 'OqlQueryComponent') {
|
|
1145
|
-
// OQL别名错误降级为警告
|
|
1146
|
-
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
1147
|
-
// 重置 图标和错误等级
|
|
1148
|
-
diagnostic.severity = 'warning';
|
|
1149
|
-
if (diagnostic.node?.tsErrorDetail) {
|
|
1150
|
-
// 重置组件节点上的错误信息
|
|
1151
|
-
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
1152
|
-
}
|
|
1153
|
-
record.suggestionDiagnostics.push(diagnostic);
|
|
1154
|
-
return null;
|
|
1155
|
-
}
|
|
1156
1028
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
record.suggestionDiagnostics.push(diagnostic);
|
|
1167
|
-
return null;
|
|
1029
|
+
}
|
|
1030
|
+
while (currentNode && currentNode?.parentNode?.concept !== 'App') {
|
|
1031
|
+
if (currentNode.parentKey?.toLowerCase()?.includes('playground')) {
|
|
1032
|
+
// 草稿区降级
|
|
1033
|
+
// 重置 图标和错误等级
|
|
1034
|
+
diagnostic.severity = 'warning';
|
|
1035
|
+
if (diagnostic.node?.tsErrorDetail) {
|
|
1036
|
+
// 重置组件节点上的错误信息
|
|
1037
|
+
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
1168
1038
|
}
|
|
1169
|
-
|
|
1039
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
1040
|
+
return null;
|
|
1170
1041
|
}
|
|
1042
|
+
currentNode = currentNode.parentNode;
|
|
1043
|
+
}
|
|
1171
1044
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
}
|
|
1045
|
+
// 没有降级的继续遍历,如果在logic中,logic本身需要有error状态
|
|
1046
|
+
// 如果logic中有报错就把标识置为true
|
|
1047
|
+
if ((diagnostic.node as any)?.logic) {
|
|
1048
|
+
(diagnostic.node as any).logic.haveError = true;
|
|
1177
1049
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1050
|
+
}
|
|
1051
|
+
return diagnostic;
|
|
1052
|
+
})
|
|
1053
|
+
)
|
|
1054
|
+
.filter((diag) => !!diag);
|
|
1055
|
+
|
|
1056
|
+
// 处理后的警告异常提示信息
|
|
1057
|
+
record.suggestionDiagnostics = (
|
|
1058
|
+
yield*
|
|
1059
|
+
utils.wrapMapToGenerator(record.suggestionDiagnostics, function * resolveSuggestionDiagnostic(diag) {
|
|
1060
|
+
// 上面错误降级下来的
|
|
1061
|
+
if (diag?.node) {
|
|
1062
|
+
return diag;
|
|
1063
|
+
// 一些已知警告的单独处理
|
|
1064
|
+
} if (
|
|
1065
|
+
[
|
|
1066
|
+
`'__LogicEmpty' is declared but its value is never read.`,
|
|
1067
|
+
`'__destinationEmpty__' is declared but its value is never read.`,
|
|
1068
|
+
`'__devConfigValueEmpty' is declared but its value is never read.`,
|
|
1069
|
+
`'__onlineConfigValueEmpty' is declared but its value is never read.`,
|
|
1070
|
+
`'__UpdateNoProperty__' is declared but its value is never read.`,
|
|
1071
|
+
].includes(diag.text)
|
|
1072
|
+
) {
|
|
1073
|
+
return yield* self._resolveDiagnosticWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode, record);
|
|
1074
|
+
} if (diag.text.includes(` is declared but its value is never read.`)) {
|
|
1075
|
+
// 局部变量和输入变量未使用的警告
|
|
1076
|
+
const fromModule = record.node.parentNode.concept === 'Module';
|
|
1077
|
+
const fromConnector = record.node.parentNode.concept === 'Connector';
|
|
1078
|
+
if ((record.node.concept === 'View' || record.node.concept === 'Logic') && !(fromModule || fromConnector)) {
|
|
1079
|
+
/**
|
|
1080
|
+
* javalogic不用提示
|
|
1081
|
+
*/
|
|
1082
|
+
if (record.node.concept === 'Logic' && self._isJavalogic(record.node as Logic)) {
|
|
1083
|
+
return null;
|
|
1084
|
+
}
|
|
1085
|
+
const minRange = yield* self._findMinRangeWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode);
|
|
1086
|
+
if (minRange) {
|
|
1204
1087
|
/**
|
|
1205
|
-
*
|
|
1088
|
+
* 如果节点是入参类型
|
|
1089
|
+
* 而且不是foreach中
|
|
1090
|
+
* 而且不是事件逻辑的入参
|
|
1206
1091
|
*/
|
|
1207
|
-
if (
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
message: `未使用的输入参数${minRange.node.name}`,
|
|
1226
|
-
};
|
|
1227
|
-
return diagnostic;
|
|
1228
|
-
} if (minRange.node instanceof Variable) {
|
|
1229
|
-
const diagnostic = {
|
|
1230
|
-
node: minRange.node,
|
|
1231
|
-
severity: 'warning',
|
|
1232
|
-
message: `未使用的变量${minRange.node.name}`,
|
|
1233
|
-
};
|
|
1234
|
-
return diagnostic;
|
|
1235
|
-
}
|
|
1092
|
+
if (
|
|
1093
|
+
minRange.node instanceof Param &&
|
|
1094
|
+
minRange.node.parentNode.concept !== 'ForEachStatement' &&
|
|
1095
|
+
!minRange.node.getAncestor('BindEvent')
|
|
1096
|
+
) {
|
|
1097
|
+
const diagnostic = {
|
|
1098
|
+
node: minRange.node,
|
|
1099
|
+
severity: 'warning',
|
|
1100
|
+
message: `未使用的输入参数${minRange.node.name}`,
|
|
1101
|
+
};
|
|
1102
|
+
return diagnostic;
|
|
1103
|
+
} if (minRange.node instanceof Variable) {
|
|
1104
|
+
const diagnostic = {
|
|
1105
|
+
node: minRange.node,
|
|
1106
|
+
severity: 'warning',
|
|
1107
|
+
message: `未使用的变量${minRange.node.name}`,
|
|
1108
|
+
};
|
|
1109
|
+
return diagnostic;
|
|
1236
1110
|
}
|
|
1237
1111
|
}
|
|
1238
1112
|
}
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1113
|
+
}
|
|
1114
|
+
return null;
|
|
1115
|
+
})
|
|
1116
|
+
)
|
|
1117
|
+
.filter((diag) => !!diag);
|
|
1118
|
+
|
|
1119
|
+
record.suggestionDiagnostics.push(...yield* self._attachSuggestionDiagnosticsWithGenerator(node));
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
console.timeEnd('处理诊断数据');
|
|
1242
1123
|
|
|
1243
|
-
record.suggestionDiagnostics.push(...this._attachSuggestionDiagnostics(node));
|
|
1244
|
-
})
|
|
1245
|
-
);
|
|
1246
1124
|
return records;
|
|
1247
1125
|
}
|
|
1248
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* 处理诊断结果
|
|
1129
|
+
* @param records 结果
|
|
1130
|
+
* @returns 过滤或者转换后的诊断结果
|
|
1131
|
+
*/
|
|
1132
|
+
@withQueueExecute('diagnostic')
|
|
1133
|
+
private _resolveDiagnosticRecords(records: Array<DiagnosticRecord>) {
|
|
1134
|
+
return utils.timeSlicingWithGenerator(this._resolveDiagnosticRecordsWithGenerator(records));
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1249
1137
|
/**
|
|
1250
1138
|
* 判断是否是Javalogic
|
|
1251
1139
|
*/
|
|
@@ -1263,7 +1151,7 @@ class NaslServer {
|
|
|
1263
1151
|
* @param fileNode 文件级别的节点
|
|
1264
1152
|
* @returns 诊断结果
|
|
1265
1153
|
*/
|
|
1266
|
-
|
|
1154
|
+
private *_attachSuggestionDiagnosticsWithGenerator(fileNode: BaseNode) {
|
|
1267
1155
|
const diagnostics: Diagnostic[] = [];
|
|
1268
1156
|
if (fileNode instanceof Logic || fileNode instanceof View) {
|
|
1269
1157
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
@@ -1625,31 +1513,53 @@ class NaslServer {
|
|
|
1625
1513
|
}
|
|
1626
1514
|
|
|
1627
1515
|
/** 是否被 触发器依赖, 如果存在,返回第一个触发器对应的名称 */
|
|
1628
|
-
|
|
1516
|
+
isRefedByTriggerAndReturnFirstRef(fileNode: BaseNode): Promise<{
|
|
1629
1517
|
isRefedByTrigger: boolean;
|
|
1630
1518
|
fRefName: string;
|
|
1631
1519
|
}> {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1520
|
+
return this._isHaveRef(fileNode).then((refs) => {
|
|
1521
|
+
const basePath = TriggerLauncher.getEmbeddedFileBasePath(fileNode.rootNode as App);
|
|
1522
|
+
let flag = false;
|
|
1523
|
+
let fRefName = '';
|
|
1524
|
+
try {
|
|
1525
|
+
for (const ref of refs) {
|
|
1526
|
+
const { file } = ref;
|
|
1527
|
+
if (file.startsWith(basePath)) {
|
|
1528
|
+
flag = true;
|
|
1529
|
+
// file: /embedded/tttta/triggerLaunchers/订阅配置_asd.ts
|
|
1530
|
+
fRefName = file.split(basePath)[1].split('.')[0];
|
|
1531
|
+
break;
|
|
1532
|
+
}
|
|
1644
1533
|
}
|
|
1534
|
+
} catch (error) {
|
|
1535
|
+
console.error(error, refs);
|
|
1645
1536
|
}
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1537
|
+
return {
|
|
1538
|
+
isRefedByTrigger: flag,
|
|
1539
|
+
fRefName,
|
|
1540
|
+
};
|
|
1541
|
+
});
|
|
1542
|
+
// const refs = await this._isHaveRef(fileNode);
|
|
1543
|
+
// const basePath = TriggerLauncher.getEmbeddedFileBasePath(fileNode.rootNode as App);
|
|
1544
|
+
// let flag = false;
|
|
1545
|
+
// let fRefName = '';
|
|
1546
|
+
// try {
|
|
1547
|
+
// for (const ref of refs) {
|
|
1548
|
+
// const { file } = ref;
|
|
1549
|
+
// if (file.startsWith(basePath)) {
|
|
1550
|
+
// flag = true;
|
|
1551
|
+
// // file: /embedded/tttta/triggerLaunchers/订阅配置_asd.ts
|
|
1552
|
+
// fRefName = file.split(basePath)[1].split('.')[0];
|
|
1553
|
+
// break;
|
|
1554
|
+
// }
|
|
1555
|
+
// }
|
|
1556
|
+
// } catch (error) {
|
|
1557
|
+
// console.error(error, refs);
|
|
1558
|
+
// }
|
|
1559
|
+
// return {
|
|
1560
|
+
// isRefedByTrigger: flag,
|
|
1561
|
+
// fRefName,
|
|
1562
|
+
// };
|
|
1653
1563
|
}
|
|
1654
1564
|
|
|
1655
1565
|
/**
|
|
@@ -1680,15 +1590,18 @@ class NaslServer {
|
|
|
1680
1590
|
* @param fileNode 文件级别的节点
|
|
1681
1591
|
* @returns 诊断结果
|
|
1682
1592
|
*/
|
|
1683
|
-
|
|
1593
|
+
private *_attachDiagnosticsWithGenerator(fileNode: BaseNode) {
|
|
1684
1594
|
// 每次诊断前先清空这个Set
|
|
1685
1595
|
this.logicSetWithComponentLogic = new Set<string>();
|
|
1596
|
+
|
|
1597
|
+
const self = this;
|
|
1686
1598
|
const diagnostics: Diagnostic[] = [];
|
|
1599
|
+
|
|
1687
1600
|
if (fileNode instanceof View) {
|
|
1688
|
-
fileNode
|
|
1601
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), function* attachView([node, value]) {
|
|
1689
1602
|
if (node instanceof ViewElement && node.view === fileNode) {
|
|
1690
1603
|
if (node.tag) {
|
|
1691
|
-
node.bindAttrs
|
|
1604
|
+
yield* utils.wrapForEachToGenerator(node.bindAttrs, (bindAttr) => {
|
|
1692
1605
|
if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
|
|
1693
1606
|
const bindExpression = bindAttr.expression;
|
|
1694
1607
|
let diagnostic;
|
|
@@ -1731,7 +1644,7 @@ class NaslServer {
|
|
|
1731
1644
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
1732
1645
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
1733
1646
|
let msg;
|
|
1734
|
-
fileNode.
|
|
1647
|
+
yield* fileNode.traverseChildrenGenerator((nodeIn) => {
|
|
1735
1648
|
if (nodeIn && (nodeIn instanceof BatchAssignment || (nodeIn instanceof Assignment && nodeIn.left?.name))) {
|
|
1736
1649
|
// 子页面内部逻辑过滤
|
|
1737
1650
|
if (nodeIn.view !== fileNode) return;
|
|
@@ -1788,11 +1701,11 @@ class NaslServer {
|
|
|
1788
1701
|
node.tsErrorDetail = diagnostic;
|
|
1789
1702
|
diagnostics.push(diagnostic);
|
|
1790
1703
|
}
|
|
1791
|
-
const fileSourceCode =
|
|
1704
|
+
const fileSourceCode = self.getNodeCode(fileNode, value);
|
|
1792
1705
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
1793
1706
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
1794
|
-
|
|
1795
|
-
const isDuplicate =
|
|
1707
|
+
self._treeMetadataType2CoreType(typeAnnotation, (node.rootNode as App))
|
|
1708
|
+
const isDuplicate = self._isDuplicateCoreType(typeAnnotation)
|
|
1796
1709
|
if (isDuplicate) {
|
|
1797
1710
|
const diagnostic = {
|
|
1798
1711
|
node: node,
|
|
@@ -1804,7 +1717,7 @@ class NaslServer {
|
|
|
1804
1717
|
}
|
|
1805
1718
|
} else if (node instanceof BindAttribute || node instanceof BindDirective || node instanceof BindStyle) {
|
|
1806
1719
|
if (Array.isArray(node.bindExpressions)) {
|
|
1807
|
-
const exp = node.bindExpressions.find((bindExpression) =>
|
|
1720
|
+
const exp = node.bindExpressions.find((bindExpression) => self.hasComponentLogics(bindExpression));
|
|
1808
1721
|
if (exp) {
|
|
1809
1722
|
// const element: any = node.getAncestor('ViewElement');
|
|
1810
1723
|
// const api = config.allNodesAPI[element?.tag];
|
|
@@ -1827,7 +1740,7 @@ class NaslServer {
|
|
|
1827
1740
|
}
|
|
1828
1741
|
}
|
|
1829
1742
|
} else if (node instanceof CallInterface) {
|
|
1830
|
-
const isAuthInterface =
|
|
1743
|
+
const isAuthInterface = self.hasAuth(node);
|
|
1831
1744
|
const interfaceName = node.calleewholeKey.slice(node.calleewholeKey.lastIndexOf('.') + 1);
|
|
1832
1745
|
if (isAuthInterface) {
|
|
1833
1746
|
const errorMsg = `${interfaceName} 接口有鉴权方式,不支持在前端调用`;
|
|
@@ -1853,15 +1766,16 @@ class NaslServer {
|
|
|
1853
1766
|
node.tsErrorDetail = diagnostic;
|
|
1854
1767
|
}
|
|
1855
1768
|
} else {
|
|
1856
|
-
|
|
1769
|
+
self.checkNodeError(node, diagnostics);
|
|
1857
1770
|
}
|
|
1858
1771
|
});
|
|
1859
|
-
}
|
|
1772
|
+
}
|
|
1773
|
+
else if (fileNode instanceof DataSource) {
|
|
1860
1774
|
const dataSourceGroup = (fileNode.rootNode as App).configuration?.getGroup('dataSource');
|
|
1861
1775
|
if (dataSourceGroup) {
|
|
1862
1776
|
const property = dataSourceGroup.getProperty(fileNode.name);
|
|
1863
1777
|
if (property && property.values) {
|
|
1864
|
-
property.values
|
|
1778
|
+
yield* utils.wrapForEachToGenerator(property.values, (propertyValue) => {
|
|
1865
1779
|
if (!propertyValue.value && fileNode.name !== 'defaultDS') {
|
|
1866
1780
|
const diagnostic = {
|
|
1867
1781
|
node: fileNode,
|
|
@@ -2157,8 +2071,9 @@ class NaslServer {
|
|
|
2157
2071
|
});
|
|
2158
2072
|
}
|
|
2159
2073
|
}
|
|
2160
|
-
if (fileNode instanceof Logic || fileNode instanceof OverriddenLogic) {
|
|
2161
|
-
const { isRefedByTrigger, fRefName } =
|
|
2074
|
+
else if (fileNode instanceof Logic || fileNode instanceof OverriddenLogic) {
|
|
2075
|
+
const { isRefedByTrigger, fRefName } = yield this.isRefedByTriggerAndReturnFirstRef(fileNode);
|
|
2076
|
+
|
|
2162
2077
|
if (isRefedByTrigger && !this.isTriggerRule(fileNode)) {
|
|
2163
2078
|
const diagnostic = {
|
|
2164
2079
|
node: fileNode,
|
|
@@ -2167,18 +2082,8 @@ class NaslServer {
|
|
|
2167
2082
|
};
|
|
2168
2083
|
diagnostics.push(diagnostic);
|
|
2169
2084
|
}
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
// SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
|
|
2173
|
-
// if ((node instanceof OqlQueryComponent || node instanceof SqlQueryComponent) && (node as SqlQueryComponent).getTypeBanError()) {
|
|
2174
|
-
// const diagnostic = {
|
|
2175
|
-
// node,
|
|
2176
|
-
// severity: 'error',
|
|
2177
|
-
// message: 'SQL查询:返回类型内部,不支持复杂类型。',
|
|
2178
|
-
// };
|
|
2179
|
-
// node.tsErrorDetail = diagnostic;
|
|
2180
|
-
// diagnostics.push(diagnostic);
|
|
2181
|
-
// }
|
|
2085
|
+
|
|
2086
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), ([node, value]) => {
|
|
2182
2087
|
if (node instanceof OqlQueryComponent) {
|
|
2183
2088
|
// 自动推导情况
|
|
2184
2089
|
const typeAnnotation = type2TypeAnnotation((node as any).__nodeType);
|
|
@@ -2197,8 +2102,7 @@ class NaslServer {
|
|
|
2197
2102
|
}
|
|
2198
2103
|
}
|
|
2199
2104
|
}
|
|
2200
|
-
|
|
2201
|
-
if (node instanceof Return || node instanceof Variable) {
|
|
2105
|
+
else if (node instanceof Return || node instanceof Variable) {
|
|
2202
2106
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
2203
2107
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
2204
2108
|
let used = false;
|
|
@@ -2250,7 +2154,7 @@ class NaslServer {
|
|
|
2250
2154
|
}
|
|
2251
2155
|
}
|
|
2252
2156
|
}
|
|
2253
|
-
if (node instanceof Param) {
|
|
2157
|
+
else if (node instanceof Param) {
|
|
2254
2158
|
const fileSourceCode = this.getNodeCode(fileNode, value);
|
|
2255
2159
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
2256
2160
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
@@ -2268,11 +2172,13 @@ class NaslServer {
|
|
|
2268
2172
|
}
|
|
2269
2173
|
this.checkNodeError(node, diagnostics);
|
|
2270
2174
|
});
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2175
|
+
}
|
|
2176
|
+
else if (fileNode instanceof Process) {
|
|
2177
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), ([node, value]) => {
|
|
2273
2178
|
this.checkNodeError(node, diagnostics);
|
|
2274
2179
|
});
|
|
2275
|
-
}
|
|
2180
|
+
}
|
|
2181
|
+
else if (fileNode instanceof MetadataType) {
|
|
2276
2182
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
2277
2183
|
const rulesMap: any = {};
|
|
2278
2184
|
const { rules, typeAnnotation } = node as MetadataType;
|
|
@@ -2315,6 +2221,7 @@ class NaslServer {
|
|
|
2315
2221
|
}
|
|
2316
2222
|
})
|
|
2317
2223
|
}
|
|
2224
|
+
|
|
2318
2225
|
return diagnostics;
|
|
2319
2226
|
}
|
|
2320
2227
|
|
|
@@ -2609,9 +2516,10 @@ class NaslServer {
|
|
|
2609
2516
|
}
|
|
2610
2517
|
|
|
2611
2518
|
/* 接口导入查找 */
|
|
2612
|
-
existStructureFix(semanticDiagnostics: Diagnostic[], node: FileNode, that: any) {
|
|
2519
|
+
private *existStructureFix(semanticDiagnostics: Diagnostic[], node: FileNode, that: any) {
|
|
2613
2520
|
let module: Module;
|
|
2614
|
-
|
|
2521
|
+
|
|
2522
|
+
yield* utils.wrapForEachToGenerator(semanticDiagnostics, (diag) => {
|
|
2615
2523
|
const minRange = this._findMinRange(diag as unknown as tsProtocol.DiagnosticWithFileName, node);
|
|
2616
2524
|
if (diag.text?.includes('has no exported member named')) {
|
|
2617
2525
|
if (minRange.node instanceof Logic) {
|
|
@@ -2642,9 +2550,8 @@ class NaslServer {
|
|
|
2642
2550
|
}
|
|
2643
2551
|
return null;
|
|
2644
2552
|
}
|
|
2645
|
-
return diag;
|
|
2646
|
-
|
|
2647
2553
|
});
|
|
2554
|
+
|
|
2648
2555
|
if (actionArr.length) {
|
|
2649
2556
|
if (timer) return;
|
|
2650
2557
|
timer = window.setTimeout(() => {
|
|
@@ -2671,50 +2578,54 @@ class NaslServer {
|
|
|
2671
2578
|
* @param fileNode 页面节点
|
|
2672
2579
|
* @returns 处理后的结果
|
|
2673
2580
|
*/
|
|
2674
|
-
|
|
2581
|
+
private *_resolveDiagnosticWithGenerator(diagnostic: tsProtocol.DiagnosticWithFileName, fileNode: FileNode, record: DiagnosticRecord) {
|
|
2675
2582
|
// 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
|
|
2676
2583
|
if (((fileNode as any).module || (fileNode as any).connector) && !(fileNode instanceof ConfigProperty)) {
|
|
2677
2584
|
return;
|
|
2678
2585
|
}
|
|
2679
|
-
// 过滤掉java依赖库的报错
|
|
2680
|
-
// if ('compilerInfoMap' in fileNode && (fileNode as any).compilerInfoMap?.java) {
|
|
2681
|
-
// return;
|
|
2682
|
-
// }
|
|
2683
2586
|
if (fileNode.concept === 'OverriddenLogic' && diagnostic.text === `'__LogicEmpty' is declared but its value is never read.`) {
|
|
2684
2587
|
return;
|
|
2685
2588
|
}
|
|
2686
|
-
const minRange = this.
|
|
2589
|
+
const minRange = yield* this._findMinRangeWithGenerator(diagnostic, fileNode);
|
|
2687
2590
|
const tsErrorDetail = {
|
|
2688
2591
|
severity: diagnostic.category === 'error' ? 'error' : 'warning',
|
|
2689
2592
|
message: translateDiagnosticMessage(diagnostic.text),
|
|
2690
2593
|
// 保留原来的内容方便查询一些问题
|
|
2691
2594
|
originalDiagnostic: diagnostic,
|
|
2692
2595
|
};
|
|
2596
|
+
yield;
|
|
2693
2597
|
|
|
2694
2598
|
let result: Diagnostic;
|
|
2695
2599
|
if (minRange) {
|
|
2696
2600
|
// 节点的error要置为true
|
|
2697
2601
|
result = naslNodeTranslateMessage(minRange, tsErrorDetail);
|
|
2602
|
+
yield;
|
|
2698
2603
|
} else {
|
|
2699
2604
|
// 没找到节点, 先把问题暴露出来
|
|
2700
2605
|
result = tsErrorDetail;
|
|
2701
2606
|
}
|
|
2702
|
-
|
|
2607
|
+
|
|
2608
|
+
if (result) {
|
|
2703
2609
|
result.id = record.filePath + (result ? JSON.stringify({ start: result.originalDiagnostic.start, end: result.originalDiagnostic.end }) : '');
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2704
2612
|
return result;
|
|
2705
2613
|
}
|
|
2706
2614
|
|
|
2707
2615
|
/**
|
|
2708
|
-
*
|
|
2709
|
-
*
|
|
2710
|
-
* @
|
|
2711
|
-
* @returns 找到的节点
|
|
2616
|
+
* 查找节点
|
|
2617
|
+
*
|
|
2618
|
+
* @description 生成器原型函数
|
|
2712
2619
|
*/
|
|
2713
|
-
|
|
2620
|
+
private *_findMinRangeWithGenerator(
|
|
2621
|
+
diagnostic: tsProtocol.DiagnosticWithFileName | tsProtocol.ReferencesResponseItem,
|
|
2622
|
+
fileNode: FileNode
|
|
2623
|
+
): Generator<void, MinRange> {
|
|
2714
2624
|
let minRange: MinRange;
|
|
2715
|
-
const {sourceMap} = fileNode;
|
|
2625
|
+
const { sourceMap } = fileNode;
|
|
2716
2626
|
// 是否找到了行内准确的,是的话,就不走多行的
|
|
2717
2627
|
let haveLineNode = false;
|
|
2628
|
+
|
|
2718
2629
|
for (const [node, item] of sourceMap.entries()) {
|
|
2719
2630
|
/**
|
|
2720
2631
|
* 当前内容的开始行 <= 诊断开始的行 &&
|
|
@@ -2771,16 +2682,31 @@ class NaslServer {
|
|
|
2771
2682
|
}
|
|
2772
2683
|
}
|
|
2773
2684
|
}
|
|
2685
|
+
|
|
2686
|
+
yield;
|
|
2774
2687
|
}
|
|
2688
|
+
|
|
2775
2689
|
if (!minRange) {
|
|
2776
2690
|
if (fileNode instanceof View) {
|
|
2777
|
-
return { node: fileNode, item: sourceMap.get(fileNode) };
|
|
2691
|
+
return { node: fileNode, item: sourceMap.get(fileNode) } as MinRange;
|
|
2692
|
+
}
|
|
2693
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2694
|
+
console.log(minRange, '需要特殊看下,为什么没找到内容-------------');
|
|
2778
2695
|
}
|
|
2779
|
-
console.log(minRange, '需要特殊看下,为什么没找到内容-------------');
|
|
2780
2696
|
}
|
|
2697
|
+
|
|
2781
2698
|
return minRange;
|
|
2782
2699
|
}
|
|
2783
2700
|
|
|
2701
|
+
/**
|
|
2702
|
+
* 查找节点
|
|
2703
|
+
*
|
|
2704
|
+
* @description 同步模式
|
|
2705
|
+
*/
|
|
2706
|
+
_findMinRange(...args: Parameters<NaslServer['_findMinRangeWithGenerator']>) {
|
|
2707
|
+
return utils.runGeneratorSync(this._findMinRangeWithGenerator(...args));
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2784
2710
|
/**
|
|
2785
2711
|
* 查看当前节点是不是有引用
|
|
2786
2712
|
* @param node 节点
|
|
@@ -2924,6 +2850,7 @@ class NaslServer {
|
|
|
2924
2850
|
line: lsp2tspNumber(currentSource.start.line),
|
|
2925
2851
|
offset: lsp2tspNumber(currentSource.start.character),
|
|
2926
2852
|
});
|
|
2853
|
+
// console.log(parentRefs.refs)
|
|
2927
2854
|
refsList = [...refsList, ...parentRefs.refs];
|
|
2928
2855
|
}
|
|
2929
2856
|
|
|
@@ -3078,12 +3005,22 @@ class NaslServer {
|
|
|
3078
3005
|
if (node instanceof Return && node.parentNode instanceof ProcessElement) {
|
|
3079
3006
|
const { currentSource, fileNode } = this.getCurrentSource(node.parentNode);
|
|
3080
3007
|
if (currentSource) {
|
|
3008
|
+
// 流程任务出参查找引用需要查找到流程任务完成逻辑
|
|
3009
|
+
// const parentRefs = await this.references({
|
|
3010
|
+
// file: (fileNode as FileNode).getEmbeddedFilePath(),
|
|
3011
|
+
// line: lsp2tspNumber(currentSource.start.line),
|
|
3012
|
+
// offset: lsp2tspNumber(currentSource.start.character),
|
|
3013
|
+
// });
|
|
3014
|
+
// refsList = [...refsList, ...parentRefs.refs];
|
|
3015
|
+
// console.log(parentRefs.refs)
|
|
3016
|
+
|
|
3017
|
+
// 流程任务出参查找引用比较特殊,需要查找到 const process = {...} 的引用
|
|
3081
3018
|
const code = this.getNodeCode(fileNode, currentSource);
|
|
3082
3019
|
const prefix = '__ProcessIdentification__';
|
|
3083
3020
|
const positions = [];
|
|
3084
3021
|
let pos = code.indexOf(prefix);
|
|
3085
3022
|
// 需要再次定位到processelement对象上,避免process上存在同名参数
|
|
3086
|
-
pos = code.indexOf(node.parentNode.name, pos + prefix.length);
|
|
3023
|
+
pos = pos === -1 ? pos : code.indexOf(node.parentNode.name, pos + prefix.length);
|
|
3087
3024
|
pos = pos === -1 ? pos : code.indexOf(node.name, pos + prefix.length);
|
|
3088
3025
|
// pos === -1:两种情况:
|
|
3089
3026
|
// 1、找到最后一个节点了,继续找找不下去了。
|
|
@@ -3813,7 +3750,7 @@ class NaslServer {
|
|
|
3813
3750
|
getCurrentSource(node: BaseNode) {
|
|
3814
3751
|
if (node instanceof App || node instanceof Theme) return { fileNode: null };
|
|
3815
3752
|
let {sourceMap} = node;
|
|
3816
|
-
let fileNode = node;
|
|
3753
|
+
let fileNode = node as FileNode & SyntaxNode;
|
|
3817
3754
|
// 如果没有sourceMap,就继续向上找 ,或者到module结束
|
|
3818
3755
|
// 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
|
|
3819
3756
|
// 如果当前节点是view就不要向上查找了
|
|
@@ -3829,7 +3766,7 @@ class NaslServer {
|
|
|
3829
3766
|
!(fileNode instanceof View) &&
|
|
3830
3767
|
!(fileNode instanceof ConfigProperty)
|
|
3831
3768
|
) {
|
|
3832
|
-
fileNode = fileNode.parentNode;
|
|
3769
|
+
fileNode = fileNode.parentNode as FileNode & SyntaxNode;
|
|
3833
3770
|
sourceMap = fileNode?.sourceMap;
|
|
3834
3771
|
}
|
|
3835
3772
|
const currentSource = sourceMap && sourceMap.get(node);
|
|
@@ -3873,7 +3810,6 @@ class NaslServer {
|
|
|
3873
3810
|
getFieldKey: fieldKey,
|
|
3874
3811
|
});
|
|
3875
3812
|
}
|
|
3876
|
-
|
|
3877
3813
|
}
|
|
3878
3814
|
|
|
3879
3815
|
_getFieldKeySelectCompletion(args: any) {
|
|
@@ -3983,245 +3919,238 @@ class NaslServer {
|
|
|
3983
3919
|
}
|
|
3984
3920
|
|
|
3985
3921
|
/**
|
|
3986
|
-
* 获取传入节点的TypeAnnotation
|
|
3987
|
-
*
|
|
3988
|
-
* @
|
|
3989
|
-
* 普通的TypeAnnotation,额外的可能携带 option
|
|
3990
|
-
* 这里会处理callloigc callinterface 和 callfuntion 的 argment的参数一起携带回去,
|
|
3991
|
-
* 也就是说如果 只传入了这个也会一起返回argment的节点,所以返回map最好去get结果
|
|
3922
|
+
* 获取传入节点的 TypeAnnotation
|
|
3923
|
+
*
|
|
3924
|
+
* @description 生成器模式原型
|
|
3992
3925
|
*/
|
|
3993
|
-
|
|
3926
|
+
private *_getQuickInfoNodesTypeMapWithGenerator(nodes: QuickInfoNodes): Generator<any, QuickInfoMap, any> {
|
|
3994
3927
|
interface argDetail {
|
|
3995
3928
|
file: string;
|
|
3996
3929
|
line: number;
|
|
3997
3930
|
offset: number;
|
|
3998
3931
|
}
|
|
3932
|
+
|
|
3933
|
+
const self = this;
|
|
3999
3934
|
const args: Array<argDetail> = [];
|
|
4000
3935
|
// 要通过自己或者依赖关系拿的
|
|
4001
|
-
const getFromOthers:
|
|
3936
|
+
const getFromOthers: QuickInfoMap = new Map();
|
|
4002
3937
|
// 总共要返回出去的
|
|
4003
|
-
const types:
|
|
3938
|
+
const types: QuickInfoMap = new Map();
|
|
4004
3939
|
const newQuickInfoNodes: QuickInfoNodes = [];
|
|
4005
3940
|
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
// 先按照顺序占位
|
|
4011
|
-
types.set(node, null);
|
|
3941
|
+
yield* utils.wrapForEachToGenerator(nodes, function* getQuickInfoPosition(itemDetail, index) {
|
|
3942
|
+
const { node, filePath, item } = itemDetail;
|
|
3943
|
+
// 先按照顺序占位
|
|
3944
|
+
types.set(node, null);
|
|
4012
3945
|
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
types.set(node, nodeTypeAnnotation);
|
|
4017
|
-
return;
|
|
4018
|
-
}
|
|
4019
|
-
// 要通过自己或者依赖关系拿的,二次遍历
|
|
4020
|
-
if (['Argument', 'Assignment', 'MatchCase'].includes(node.concept)) {
|
|
4021
|
-
getFromOthers.set(node, null);
|
|
4022
|
-
}
|
|
4023
|
-
if (['Return', 'Variable'].includes(node.concept) && (node as Variable).typeAnnotation) {
|
|
4024
|
-
types.set(node, (node as Variable).typeAnnotation);
|
|
4025
|
-
return;
|
|
4026
|
-
}
|
|
4027
|
-
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
4028
|
-
// 只有虚拟节点的入参,才没有类型
|
|
4029
|
-
if (node.concept === 'Param' && (node.parentKey !== 'virtualParams' && node.parentKey !== 'item' && node.parentNode.concept !== 'AnonymousFunction')) {
|
|
4030
|
-
return;
|
|
4031
|
-
}
|
|
4032
|
-
if (
|
|
4033
|
-
![
|
|
4034
|
-
'Identifier',
|
|
4035
|
-
'UnaryExpression',
|
|
4036
|
-
'BinaryExpression',
|
|
4037
|
-
'CallLogic',
|
|
4038
|
-
'CallFunction',
|
|
4039
|
-
'CallInterface',
|
|
4040
|
-
'MemberExpression',
|
|
4041
|
-
'Return',
|
|
4042
|
-
'Variable',
|
|
4043
|
-
'Match',
|
|
4044
|
-
'NewComposite',
|
|
4045
|
-
'NewList',
|
|
4046
|
-
'NewMap',
|
|
4047
|
-
'OqlQueryComponent',
|
|
4048
|
-
'QueryFieldExpression',
|
|
4049
|
-
'QueryGroupByExpression',
|
|
4050
|
-
'Param',
|
|
4051
|
-
'BackendVariable',
|
|
4052
|
-
'CallAuthInterface',
|
|
4053
|
-
].includes(node.concept)
|
|
4054
|
-
)
|
|
4055
|
-
return;
|
|
3946
|
+
// 获取已知节点类型的类型
|
|
3947
|
+
const nodeTypeAnnotation = self.getCurrentNodeKnownTypeAnnotation(node);
|
|
3948
|
+
yield;
|
|
4056
3949
|
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
3950
|
+
if (nodeTypeAnnotation) {
|
|
3951
|
+
types.set(node, nodeTypeAnnotation);
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3954
|
+
// 要通过自己或者依赖关系拿的,二次遍历
|
|
3955
|
+
if (['Argument', 'Assignment', 'MatchCase'].includes(node.concept)) {
|
|
3956
|
+
getFromOthers.set(node, null);
|
|
3957
|
+
}
|
|
3958
|
+
if (['Return', 'Variable'].includes(node.concept) && (node as Variable).typeAnnotation) {
|
|
3959
|
+
types.set(node, (node as Variable).typeAnnotation);
|
|
3960
|
+
return;
|
|
3961
|
+
}
|
|
3962
|
+
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
3963
|
+
// 只有虚拟节点的入参,才没有类型
|
|
3964
|
+
if (node.concept === 'Param' && (node.parentKey !== 'virtualParams' && node.parentKey !== 'item' && node.parentNode.concept !== 'AnonymousFunction')) {
|
|
3965
|
+
return;
|
|
3966
|
+
}
|
|
3967
|
+
if (
|
|
3968
|
+
![
|
|
3969
|
+
'Identifier',
|
|
3970
|
+
'UnaryExpression',
|
|
3971
|
+
'BinaryExpression',
|
|
3972
|
+
'CallLogic',
|
|
3973
|
+
'CallFunction',
|
|
3974
|
+
'CallInterface',
|
|
3975
|
+
'MemberExpression',
|
|
3976
|
+
'Return',
|
|
3977
|
+
'Variable',
|
|
3978
|
+
'Match',
|
|
3979
|
+
'NewComposite',
|
|
3980
|
+
'NewList',
|
|
3981
|
+
'NewMap',
|
|
3982
|
+
'OqlQueryComponent',
|
|
3983
|
+
'QueryFieldExpression',
|
|
3984
|
+
'QueryGroupByExpression',
|
|
3985
|
+
'Param',
|
|
3986
|
+
'BackendVariable',
|
|
3987
|
+
'CallAuthInterface',
|
|
3988
|
+
].includes(node.concept)
|
|
3989
|
+
)
|
|
3990
|
+
return;
|
|
3991
|
+
|
|
3992
|
+
// 要去ls那边获取的
|
|
3993
|
+
newQuickInfoNodes.push(itemDetail);
|
|
3994
|
+
const fileDetail = {
|
|
3995
|
+
file: filePath,
|
|
3996
|
+
line: lsp2tspNumber(item.start.line),
|
|
3997
|
+
offset: lsp2tspNumber(item.start.character),
|
|
3998
|
+
};
|
|
4064
3999
|
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4000
|
+
const getCode = (range: SourceMapItem) => {
|
|
4001
|
+
return self.tsFiles.get(filePath)?.slice(range.start.offset, range.end.offset) ?? '';
|
|
4002
|
+
};
|
|
4068
4003
|
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4004
|
+
// 位置计算偏移
|
|
4005
|
+
if ('getQuickInfoOffset' in node) {
|
|
4006
|
+
Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail, getCode(item)));
|
|
4007
|
+
}
|
|
4073
4008
|
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
}
|
|
4094
|
-
const subStr = code.substring(0, indexOf);
|
|
4095
|
-
const codeArr = subStr?.split('.');
|
|
4096
|
-
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4097
|
-
indexOf = subStr.length - lastLen;
|
|
4098
|
-
}
|
|
4099
|
-
fileDetail.offset += indexOf;
|
|
4100
|
-
} else if (
|
|
4101
|
-
node.concept === 'MemberExpression' ||
|
|
4102
|
-
node.concept === 'Identifier' ||
|
|
4103
|
-
node.concept === 'QueryFieldExpression' ||
|
|
4104
|
-
node.concept === 'QueryGroupByExpression'
|
|
4105
|
-
) {
|
|
4106
|
-
const code = getCode(item);
|
|
4107
|
-
if (code.includes('.')) {
|
|
4108
|
-
const codeArr = code?.split('.');
|
|
4109
|
-
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4110
|
-
// MemberExpression取最后一位当做类型
|
|
4111
|
-
const indexOf = code.length - lastLen;
|
|
4112
|
-
fileDetail.offset = fileDetail.offset + indexOf;
|
|
4113
|
-
}
|
|
4114
|
-
} else if (node.concept === 'Match') {
|
|
4115
|
-
const code = getCode(item);
|
|
4116
|
-
// 去查return 后面的返回值,变成函数调用
|
|
4117
|
-
if (code?.endsWith(';\n')) {
|
|
4118
|
-
fileDetail.line = item.end.line - 1;
|
|
4009
|
+
yield;
|
|
4010
|
+
|
|
4011
|
+
// 位置计算偏移2
|
|
4012
|
+
// TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
|
|
4013
|
+
if (
|
|
4014
|
+
node.concept === 'BinaryExpression' ||
|
|
4015
|
+
node.concept === 'CallFunction' ||
|
|
4016
|
+
node.concept === 'CallInterface'
|
|
4017
|
+
) {
|
|
4018
|
+
const code = getCode(item);
|
|
4019
|
+
// 如果没有括号 ,括号就在外面,就 -1
|
|
4020
|
+
// 有括号就找到括号的位置 然后 -1
|
|
4021
|
+
let indexOf = 0;
|
|
4022
|
+
if (!code.includes('(')) {
|
|
4023
|
+
indexOf = -1;
|
|
4024
|
+
} else {
|
|
4025
|
+
// 如果有泛型先往前找一找
|
|
4026
|
+
if (code.includes('<')) {
|
|
4027
|
+
indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
|
|
4119
4028
|
} else {
|
|
4120
|
-
|
|
4029
|
+
indexOf = code.indexOf('(');
|
|
4121
4030
|
}
|
|
4122
|
-
const
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
} else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
|
|
4127
|
-
const code = getCode(item);
|
|
4128
|
-
fileDetail.line = item.end.line;
|
|
4129
|
-
const indexOf = code.indexOf('return __newComposite');
|
|
4130
|
-
let newCode = code.substring(0, indexOf);
|
|
4131
|
-
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4132
|
-
fileDetail.offset = newCode.length + 'return '.length;
|
|
4133
|
-
} else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
4134
|
-
fileDetail.offset += 10;
|
|
4031
|
+
const subStr = code.substring(0, indexOf);
|
|
4032
|
+
const codeArr = subStr?.split('.');
|
|
4033
|
+
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4034
|
+
indexOf = subStr.length - lastLen;
|
|
4135
4035
|
}
|
|
4136
|
-
|
|
4137
|
-
}
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
const
|
|
4153
|
-
|
|
4154
|
-
|
|
4036
|
+
fileDetail.offset += indexOf;
|
|
4037
|
+
} else if (
|
|
4038
|
+
node.concept === 'MemberExpression' ||
|
|
4039
|
+
node.concept === 'Identifier' ||
|
|
4040
|
+
node.concept === 'QueryFieldExpression' ||
|
|
4041
|
+
node.concept === 'QueryGroupByExpression'
|
|
4042
|
+
) {
|
|
4043
|
+
const code = getCode(item);
|
|
4044
|
+
if (code.includes('.')) {
|
|
4045
|
+
const codeArr = code?.split('.');
|
|
4046
|
+
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4047
|
+
// MemberExpression取最后一位当做类型
|
|
4048
|
+
const indexOf = code.length - lastLen;
|
|
4049
|
+
fileDetail.offset = fileDetail.offset + indexOf;
|
|
4050
|
+
}
|
|
4051
|
+
} else if (node.concept === 'Match') {
|
|
4052
|
+
const code = getCode(item);
|
|
4053
|
+
// 去查return 后面的返回值,变成函数调用
|
|
4054
|
+
if (code?.endsWith(';\n')) {
|
|
4055
|
+
fileDetail.line = item.end.line - 1;
|
|
4155
4056
|
} else {
|
|
4156
|
-
|
|
4057
|
+
fileDetail.line = item.end.line;
|
|
4157
4058
|
}
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4059
|
+
const indexOf = code.indexOf('return __MatchExpressionFuntion');
|
|
4060
|
+
let newCode = code.substring(0, indexOf);
|
|
4061
|
+
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4062
|
+
fileDetail.offset = newCode.length + 'return '.length;
|
|
4063
|
+
} else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
|
|
4064
|
+
const code = getCode(item);
|
|
4065
|
+
fileDetail.line = item.end.line;
|
|
4066
|
+
const indexOf = code.indexOf('return __newComposite');
|
|
4067
|
+
let newCode = code.substring(0, indexOf);
|
|
4068
|
+
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4069
|
+
fileDetail.offset = newCode.length + 'return '.length;
|
|
4070
|
+
} else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
4071
|
+
fileDetail.offset += 10;
|
|
4072
|
+
}
|
|
4073
|
+
args.push(fileDetail);
|
|
4074
|
+
});
|
|
4075
|
+
const resultMap: any = (yield this.getNaslNodeTypeFull(args))?.response;
|
|
4076
|
+
yield* utils.wrapForEachToGenerator(args, ({ file, line, offset }, index) => {
|
|
4077
|
+
const item = (resultMap as any)?.[file]?.[line]?.[offset];
|
|
4078
|
+
const itemType = item?.[0]?.nodeType;
|
|
4079
|
+
const nodeTypeAnnotation = type2TypeAnnotation(itemType);
|
|
4080
|
+
const {node} = newQuickInfoNodes[index];
|
|
4081
|
+
|
|
4082
|
+
types.set(node, Object.freeze(nodeTypeAnnotation) as TypeAnnotation);
|
|
4083
|
+
|
|
4084
|
+
const type = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
|
|
4085
|
+
if (type) {
|
|
4086
|
+
(node as any).__nodeType = type;
|
|
4087
|
+
} else {
|
|
4088
|
+
delete (node as any).__nodeType;
|
|
4089
|
+
}
|
|
4090
|
+
});
|
|
4091
|
+
yield* utils.wrapIteratorToGenerator(getFromOthers.entries(), function* ([node]) {
|
|
4092
|
+
if (node instanceof Assignment) {
|
|
4093
|
+
if (!types.get(node.left)) {
|
|
4094
|
+
types.set(node.left, types.get(node.right));
|
|
4095
|
+
}
|
|
4096
|
+
} else if (node instanceof Argument) {
|
|
4097
|
+
// 如果Argument,但是没可以用的类型,就用原来logic的参数类型
|
|
4098
|
+
const argType = yield* self.getArgumentTypeAnnotationWithGenerator(node, newQuickInfoNodes, types as any);
|
|
4099
|
+
types.set(node, argType);
|
|
4100
|
+
} else if (node instanceof MatchCase) {
|
|
4101
|
+
// matchCase的类型
|
|
4102
|
+
// 直接从最后一项的返回值取,有就有没有就没有
|
|
4103
|
+
if (node.body?.length) {
|
|
4104
|
+
const last = node.body[node.body.length - 1];
|
|
4105
|
+
if (types.get(last)) {
|
|
4106
|
+
types.set(node, types.get(last));
|
|
4180
4107
|
}
|
|
4181
4108
|
}
|
|
4182
|
-
}
|
|
4183
|
-
|
|
4184
|
-
)
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
if (node
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
4199
|
-
delete node.__TypeAnnotation;
|
|
4200
|
-
return;
|
|
4201
|
-
}
|
|
4109
|
+
}
|
|
4110
|
+
});
|
|
4111
|
+
yield* utils.wrapIteratorToGenerator(types.entries(), ([node, value]) => {
|
|
4112
|
+
try {
|
|
4113
|
+
// 因为node可能是经过处理的TypeAnnotation
|
|
4114
|
+
node.__isCorrectTypeAnnotation = true;
|
|
4115
|
+
if (value) {
|
|
4116
|
+
if (node instanceof OqlQueryComponent) {
|
|
4117
|
+
// 自动推导情况
|
|
4118
|
+
const typeAnnotation = value as TypeAnnotation;
|
|
4119
|
+
if (!node.typeAnnotation && typeAnnotation) {
|
|
4120
|
+
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
4121
|
+
const {typeArguments} = typeAnnotation;
|
|
4122
|
+
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
4123
|
+
delete node.__TypeAnnotation;
|
|
4124
|
+
return;
|
|
4202
4125
|
}
|
|
4203
4126
|
}
|
|
4204
4127
|
}
|
|
4205
|
-
if (value instanceof TypeAnnotation) {
|
|
4206
|
-
node.__TypeAnnotation = value;
|
|
4207
|
-
} else if (value.typeAnnotation) {
|
|
4208
|
-
node.__TypeAnnotation = value.typeAnnotation;
|
|
4209
|
-
}
|
|
4210
|
-
} else {
|
|
4211
|
-
// 清空原来已经赋值上去的类型,可能原来有现在没有了
|
|
4212
|
-
delete node.__TypeAnnotation;
|
|
4213
4128
|
}
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4129
|
+
if (value instanceof TypeAnnotation) {
|
|
4130
|
+
node.__TypeAnnotation = value;
|
|
4131
|
+
} else if (value.typeAnnotation) {
|
|
4132
|
+
node.__TypeAnnotation = value.typeAnnotation;
|
|
4133
|
+
}
|
|
4134
|
+
} else {
|
|
4135
|
+
// 清空原来已经赋值上去的类型,可能原来有现在没有了
|
|
4136
|
+
delete node.__TypeAnnotation;
|
|
4218
4137
|
}
|
|
4219
|
-
}
|
|
4220
|
-
|
|
4221
|
-
|
|
4138
|
+
} catch (err) {
|
|
4139
|
+
// if (globalThis.window) {
|
|
4140
|
+
// console.log(err);
|
|
4141
|
+
// }
|
|
4142
|
+
}
|
|
4143
|
+
});
|
|
4222
4144
|
return types;
|
|
4223
4145
|
}
|
|
4224
4146
|
|
|
4147
|
+
/**
|
|
4148
|
+
* 获取传入节点的 TypeAnnotation
|
|
4149
|
+
*/
|
|
4150
|
+
getQuickInfoNodesTypeMap(nodes: QuickInfoNodes, flag?: boolean) {
|
|
4151
|
+
return utils.runGeneratorAsync(this._getQuickInfoNodesTypeMapWithGenerator(nodes));
|
|
4152
|
+
}
|
|
4153
|
+
|
|
4225
4154
|
// 全量标注并且返回json
|
|
4226
4155
|
@withQueueExecute('annotation')
|
|
4227
4156
|
async getNaslAnnotatedJSON(app: App, releaseFlag: boolean) {
|
|
@@ -4256,28 +4185,35 @@ class NaslServer {
|
|
|
4256
4185
|
}
|
|
4257
4186
|
|
|
4258
4187
|
// 增量标注
|
|
4259
|
-
|
|
4260
|
-
async IncrementalAnnotationJSON(records: DiagnosticRecord[]) {
|
|
4188
|
+
private *_incrementalAnnotationJSONWithGenerator(records: DiagnosticRecord[]) {
|
|
4261
4189
|
console.time('增量标注');
|
|
4262
4190
|
const nodes: QuickInfoNodes = [];
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4191
|
+
const self = this;
|
|
4192
|
+
|
|
4193
|
+
yield* utils.wrapForEachToGenerator(records, function *findNodePosition (record) {
|
|
4194
|
+
const fileNode = self.file2NodeMap.get(record.filePath);
|
|
4195
|
+
|
|
4196
|
+
if (!fileNode) {
|
|
4197
|
+
return;
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4266
4200
|
record.id = fileNode.id;
|
|
4267
4201
|
record.node = fileNode;
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
nodes.push({
|
|
4272
|
-
filePath: record.filePath,
|
|
4273
|
-
node: nodeItem,
|
|
4274
|
-
item,
|
|
4275
|
-
});
|
|
4276
|
-
});
|
|
4202
|
+
|
|
4203
|
+
if (['Structure', 'DataSource', 'Entity', 'Enum', 'Role', 'MetadataType'].includes(fileNode.concept) || !fileNode.sourceMap) {
|
|
4204
|
+
return;
|
|
4277
4205
|
}
|
|
4206
|
+
|
|
4207
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), ([nodeItem, item]) => {
|
|
4208
|
+
nodes.push({
|
|
4209
|
+
filePath: record.filePath,
|
|
4210
|
+
node: nodeItem,
|
|
4211
|
+
item,
|
|
4212
|
+
});
|
|
4213
|
+
});
|
|
4278
4214
|
});
|
|
4279
4215
|
|
|
4280
|
-
|
|
4216
|
+
yield* this._getQuickInfoNodesTypeMapWithGenerator(nodes);
|
|
4281
4217
|
console.timeEnd('增量标注');
|
|
4282
4218
|
}
|
|
4283
4219
|
|
|
@@ -4410,7 +4346,11 @@ class NaslServer {
|
|
|
4410
4346
|
* 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
|
|
4411
4347
|
* 获取logic的默认值和原来Arg的类型和默认值对应
|
|
4412
4348
|
*/
|
|
4413
|
-
|
|
4349
|
+
*getArgumentTypeAnnotationWithGenerator(
|
|
4350
|
+
node: Argument,
|
|
4351
|
+
QuickInfoNodes: QuickInfoNodes,
|
|
4352
|
+
types: Map<BaseNode, TypeAnnotation>,
|
|
4353
|
+
): Generator<void, { typeAnnotation: TypeAnnotation; option: object }, void> {
|
|
4414
4354
|
// 直接复用内部expression的type类型
|
|
4415
4355
|
if (
|
|
4416
4356
|
node.parentNode instanceof CallLogic &&
|
|
@@ -4430,6 +4370,7 @@ class NaslServer {
|
|
|
4430
4370
|
};
|
|
4431
4371
|
}
|
|
4432
4372
|
}
|
|
4373
|
+
yield;
|
|
4433
4374
|
}
|
|
4434
4375
|
// 获取返回值结果里找到父级的callLogic || CallInterface的类型填充进去Argument
|
|
4435
4376
|
const App = node.app;
|
|
@@ -4444,7 +4385,8 @@ class NaslServer {
|
|
|
4444
4385
|
}
|
|
4445
4386
|
}
|
|
4446
4387
|
// 用户自己声明的用用户的
|
|
4447
|
-
const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace
|
|
4388
|
+
const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace}.${parent.calleeName}`);
|
|
4389
|
+
yield;
|
|
4448
4390
|
const index = parent.arguments.indexOf(node);
|
|
4449
4391
|
const param = callObj?.params?.[index] || {};
|
|
4450
4392
|
// 取出参数的类型
|
|
@@ -4536,7 +4478,7 @@ class NaslServer {
|
|
|
4536
4478
|
* @param targetNode 当前操作的节点
|
|
4537
4479
|
* @param result toTs生成的内容
|
|
4538
4480
|
*/
|
|
4539
|
-
async handleDelete(fileNode: BaseNode, targetNode: BaseNode, result:
|
|
4481
|
+
async handleDelete(fileNode: BaseNode, targetNode: BaseNode, result: utils.EmbeddedTSFileResult) {
|
|
4540
4482
|
const filePath = (fileNode as FileNode).getEmbeddedFilePath();
|
|
4541
4483
|
// 如果要删除,而且当前要删Logic就直接删除并且清除错误
|
|
4542
4484
|
/**
|
|
@@ -4576,7 +4518,7 @@ class NaslServer {
|
|
|
4576
4518
|
* @param targetNode 触发修改的节点
|
|
4577
4519
|
* @param result 生成代码的code 和位置信息
|
|
4578
4520
|
*/
|
|
4579
|
-
async handleChange(fileNode: BaseNode, targetNode: BaseNode, result:
|
|
4521
|
+
async handleChange(fileNode: BaseNode, targetNode: BaseNode, result: utils.EmbeddedTSFileResult, action: string) {
|
|
4580
4522
|
this.file2NodeMap.set(result.filePath, fileNode);
|
|
4581
4523
|
|
|
4582
4524
|
const outputFiles = [{ file: result.filePath, fileContent: result.code }];
|
|
@@ -4621,7 +4563,7 @@ class NaslServer {
|
|
|
4621
4563
|
* @param isRename 是不是修改名字
|
|
4622
4564
|
* @param oldFilePath 如果是改名,文件级别的才会有这个参数,用于文件新增替换
|
|
4623
4565
|
*/
|
|
4624
|
-
async handleRename(fileNode: BaseNode, targetNode: BaseNode, result:
|
|
4566
|
+
async handleRename(fileNode: BaseNode, targetNode: BaseNode, result: utils.EmbeddedTSFileResult, oldFilePath?: string) {
|
|
4625
4567
|
// rename 场景
|
|
4626
4568
|
const outputFiles = [{ file: result.filePath, fileContent: result.code }];
|
|
4627
4569
|
// 如果是要修改顶级文件名
|
|
@@ -4725,7 +4667,7 @@ class NaslServer {
|
|
|
4725
4667
|
const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
|
|
4726
4668
|
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
4727
4669
|
const fileNodeItem = fileNodeChildren[i];
|
|
4728
|
-
const result = (fileNodeItem as FileNode).toEmbeddedTSFile();
|
|
4670
|
+
const result = await utils.timeSlicingWithGenerator((fileNodeItem as FileNode).toEmbeddedTSFile());
|
|
4729
4671
|
fileNodeItem.sourceMap = result.sourceMap;
|
|
4730
4672
|
if (action === 'create') {
|
|
4731
4673
|
await this.handleChange(fileNodeItem, fileNodeItem, result, action);
|
|
@@ -4748,7 +4690,7 @@ class NaslServer {
|
|
|
4748
4690
|
const fileNodeChildren = fileNode.children;
|
|
4749
4691
|
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
4750
4692
|
const fileNodeItem = fileNodeChildren[i];
|
|
4751
|
-
const result = (fileNodeItem as FileNode).toEmbeddedTSFile();
|
|
4693
|
+
const result = await utils.timeSlicingWithGenerator((fileNodeItem as FileNode).toEmbeddedTSFile());
|
|
4752
4694
|
fileNodeItem.sourceMap = result.sourceMap;
|
|
4753
4695
|
if (action === 'create') {
|
|
4754
4696
|
await this.handleChange(fileNodeItem, fileNodeItem, result, action);
|
|
@@ -4772,8 +4714,7 @@ class NaslServer {
|
|
|
4772
4714
|
isChangeInterface = true;
|
|
4773
4715
|
}
|
|
4774
4716
|
const module: Module = targetNode as Module;
|
|
4775
|
-
const results
|
|
4776
|
-
this.contentToFile(module, results);
|
|
4717
|
+
const results = await utils.timeSlicingWithGenerator(this.contentToFile(module));
|
|
4777
4718
|
for (let i = 0; i < results.length; i++) {
|
|
4778
4719
|
const result = results[i];
|
|
4779
4720
|
const node = this.file2NodeMap.get(result.filePath);
|
|
@@ -4800,7 +4741,7 @@ class NaslServer {
|
|
|
4800
4741
|
if (fileNode instanceof DataSource) {
|
|
4801
4742
|
(fileNode as DataSource).entities.forEach(async (entity) => {
|
|
4802
4743
|
try {
|
|
4803
|
-
const result = entity.toEmbeddedTSFile();
|
|
4744
|
+
const result = await utils.timeSlicingWithGenerator(entity.toEmbeddedTSFile());
|
|
4804
4745
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4805
4746
|
const currentOldPath = `${parentPath }/entities/${ entity.name }.ts`;
|
|
4806
4747
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
@@ -4837,20 +4778,25 @@ class NaslServer {
|
|
|
4837
4778
|
return;
|
|
4838
4779
|
}
|
|
4839
4780
|
|
|
4781
|
+
// debugger;
|
|
4840
4782
|
if (process.env.NODE_ENV === 'development') {
|
|
4841
4783
|
console.time('重新生成 TS 文件');
|
|
4842
4784
|
}
|
|
4843
|
-
|
|
4785
|
+
|
|
4786
|
+
const fileTsPath = fileNode.getEmbeddedFilePath();
|
|
4787
|
+
const result = await utils.timeSlicingWithGenerator(fileNode.toEmbeddedTSFile());
|
|
4788
|
+
|
|
4844
4789
|
if (process.env.NODE_ENV === 'development') {
|
|
4845
4790
|
console.timeEnd('重新生成 TS 文件');
|
|
4846
|
-
console.log('重新生成 TS 文件',
|
|
4791
|
+
console.log('重新生成 TS 文件', fileTsPath);
|
|
4847
4792
|
}
|
|
4848
4793
|
|
|
4849
4794
|
// 当前操作的节点
|
|
4850
4795
|
// 如果当前没有生成tsFile
|
|
4851
|
-
if (!result) {
|
|
4796
|
+
if (!result.sourceMap) {
|
|
4852
4797
|
return;
|
|
4853
4798
|
}
|
|
4799
|
+
|
|
4854
4800
|
// 修改触发修改文件
|
|
4855
4801
|
this._debugInFileStorage(targetNode, [
|
|
4856
4802
|
{
|
|
@@ -4860,6 +4806,7 @@ class NaslServer {
|
|
|
4860
4806
|
]);
|
|
4861
4807
|
|
|
4862
4808
|
fileNode.sourceMap = result.sourceMap;
|
|
4809
|
+
|
|
4863
4810
|
if (action === 'update' || action === 'create') {
|
|
4864
4811
|
if ($event?.field !== 'name') {
|
|
4865
4812
|
await this.handleChange(fileNode, targetNode, result, action);
|