@lcap/nasl 3.3.3-beta.6 → 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 +31 -19
- 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 +20 -29
- 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 +19 -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 +5 -5
- 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/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 +42 -21
- 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 +33 -42
- 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 +28 -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/toEmbeddedTS.spec.ts +2 -1
- 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/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
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach, runGeneratorSync as runSync } from '../utils/time-slicing';
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
shiftState,
|
|
5
|
+
withSourceMap,
|
|
6
|
+
indent,
|
|
7
|
+
createCompilerState,
|
|
8
|
+
withSourceMapGenerator,
|
|
9
|
+
withGenerator,
|
|
10
|
+
TranslatorGenerator,
|
|
11
|
+
} from '../translator';
|
|
2
12
|
import ForEachStatement from './ForEachStatement__';
|
|
3
13
|
import Logic from './Logic__';
|
|
4
14
|
//================================================================================
|
|
@@ -282,9 +292,12 @@ export class NewList extends LogicItem {
|
|
|
282
292
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
283
293
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
284
294
|
params.index = index;
|
|
285
|
-
} else
|
|
286
|
-
|
|
287
|
-
(
|
|
295
|
+
} else {
|
|
296
|
+
const q = (t as any)[parentKey];
|
|
297
|
+
if ((q.__v_raw || q) === n) {
|
|
298
|
+
params.index = 0;
|
|
299
|
+
(this as any)[parentKey] = undefined;
|
|
300
|
+
}
|
|
288
301
|
}
|
|
289
302
|
}
|
|
290
303
|
return params;
|
|
@@ -335,9 +348,12 @@ export class NewList extends LogicItem {
|
|
|
335
348
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
336
349
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
337
350
|
params.index = index;
|
|
338
|
-
} else
|
|
339
|
-
|
|
340
|
-
(
|
|
351
|
+
} else {
|
|
352
|
+
const q = (t as any)[parentKey];
|
|
353
|
+
if ((q.__v_raw || q) === n) {
|
|
354
|
+
params.index = 0;
|
|
355
|
+
(this as any)[parentKey] = undefined;
|
|
356
|
+
}
|
|
341
357
|
}
|
|
342
358
|
}
|
|
343
359
|
return params;
|
|
@@ -398,44 +414,42 @@ export class NewList extends LogicItem {
|
|
|
398
414
|
return code;
|
|
399
415
|
}
|
|
400
416
|
|
|
401
|
-
@
|
|
402
|
-
toEmbeddedTS(state = createCompilerState()):
|
|
417
|
+
@withSourceMapGenerator
|
|
418
|
+
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
419
|
+
const self = this;
|
|
403
420
|
const indent0 = indent(state?.tabSize || 0);
|
|
404
421
|
const indent1 = indent((state?.tabSize || 0) + 1);
|
|
405
422
|
const indent2 = indent((state?.tabSize || 0) + 2);
|
|
406
|
-
|
|
407
|
-
const typeCode = (codestr: string) => {
|
|
423
|
+
const typeCode = function* typeCode(codestr: string) {
|
|
408
424
|
codestr += `nasl.util.New<`;
|
|
409
|
-
codestr += `${
|
|
425
|
+
codestr += `${yield * self.typeAnnotation.toEmbeddedTS(shiftState(state, codestr, { inline: true }))}`;
|
|
410
426
|
codestr += `>()`;
|
|
411
427
|
return codestr;
|
|
412
428
|
};
|
|
413
|
-
|
|
414
429
|
let code = '';
|
|
415
|
-
if (
|
|
430
|
+
if (self.typeAnnotation) {
|
|
416
431
|
code += `${indent0}(() => { \n`;
|
|
417
432
|
// ts报错检查
|
|
418
433
|
code += `${indent1}function __newComposite() {\n`;
|
|
419
|
-
|
|
434
|
+
yield* wrapForEach(self.items, function* warpForEachGenerator(item) {
|
|
420
435
|
code += `${indent2}nasl.util.Add(`;
|
|
421
|
-
code = `${typeCode(code)}, `;
|
|
422
|
-
code += item.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
436
|
+
code = `${yield* typeCode(code)}, `;
|
|
437
|
+
code += yield* item.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
423
438
|
code += ');';
|
|
424
439
|
code += '\n';
|
|
425
440
|
});
|
|
426
441
|
code += `${indent2}return `;
|
|
427
|
-
code = `${typeCode(code)};\n`;
|
|
442
|
+
code = `${yield* typeCode(code)};\n`;
|
|
428
443
|
code += `${indent1}};\n`;
|
|
429
|
-
|
|
430
444
|
code += `${indent1}return __newComposite();\n`;
|
|
431
445
|
code += `${indent0}})()`;
|
|
432
446
|
} else {
|
|
433
447
|
code += `${indent0}(() => { \n`;
|
|
434
448
|
const arr: any = [];
|
|
435
|
-
|
|
449
|
+
yield* wrapForEach(self.items, function* warpForEachGenerator(item, index) {
|
|
436
450
|
if (item.concept === 'Unparsed') return;
|
|
437
451
|
code += `${indent1}nasl.core.ensureVoid(`;
|
|
438
|
-
arr.push(item.toEmbeddedTS(shiftState(state, code, { inline: true })));
|
|
452
|
+
arr.push(yield* item.toEmbeddedTS(shiftState(state, code, { inline: true })));
|
|
439
453
|
code += arr[index];
|
|
440
454
|
code += '); ';
|
|
441
455
|
});
|
|
@@ -444,32 +458,32 @@ export class NewList extends LogicItem {
|
|
|
444
458
|
code += `${indent1}__IDENTIFIER__;\n`;
|
|
445
459
|
// ts报错检查
|
|
446
460
|
code += `${indent1}function __newComposite() {\n`;
|
|
447
|
-
if (
|
|
461
|
+
if (self.items.length === 0) {
|
|
448
462
|
code += `${indent2}return nasl.util.NewList();\n`;
|
|
449
463
|
} else {
|
|
450
464
|
code += `${indent2}let arr = [`;
|
|
451
|
-
|
|
465
|
+
yield* wrapForEach(self.items, function* warpForEachGenerator(item, index) {
|
|
452
466
|
code += ['__IDENTIFIER__', '__IDENTIFIER__()'].includes(arr[index]) ? null : arr[index];
|
|
453
|
-
if (index + 1 <
|
|
467
|
+
if (index + 1 < self.items.length) code += ', ';
|
|
454
468
|
});
|
|
455
469
|
code += ']\n';
|
|
456
470
|
code += `${indent2}return nasl.util.NewList(...arr);\n`;
|
|
457
471
|
}
|
|
458
472
|
code += `${indent1}};\n`;
|
|
459
|
-
|
|
460
473
|
code += `${indent1}return __newComposite();\n`;
|
|
461
474
|
code += `${indent0}})()`;
|
|
462
475
|
}
|
|
463
476
|
return code;
|
|
464
477
|
}
|
|
465
478
|
|
|
466
|
-
@
|
|
467
|
-
toEmbeddedIgnoreTS(state
|
|
479
|
+
@withSourceMapGenerator
|
|
480
|
+
*toEmbeddedIgnoreTS(state = createCompilerState()): TranslatorGenerator {
|
|
481
|
+
const self = this;
|
|
468
482
|
const indent0 = indent(state?.tabSize || 0);
|
|
469
483
|
let code = '';
|
|
470
484
|
code += `${indent0}nasl.util.NewList({items:[`;
|
|
471
|
-
|
|
472
|
-
code += item.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
485
|
+
yield* wrapForEach(self.items, function* warpForEachGenerator(item) {
|
|
486
|
+
code += yield* item.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
473
487
|
code += ', ';
|
|
474
488
|
});
|
|
475
489
|
code += ']})';
|
|
@@ -494,39 +508,39 @@ export class NewList extends LogicItem {
|
|
|
494
508
|
return code;
|
|
495
509
|
}
|
|
496
510
|
|
|
497
|
-
getInitCode(state?: TranslatorState)
|
|
511
|
+
*getInitCode(state?: TranslatorState) {
|
|
512
|
+
const self = this;
|
|
498
513
|
const indent1 = indent((state?.tabSize || 0) + 1);
|
|
499
514
|
const indent2 = indent((state?.tabSize || 0) + 2);
|
|
500
515
|
const indent3 = indent((state?.tabSize || 0) + 3);
|
|
501
516
|
let code = '';
|
|
502
517
|
code += '(() => { \n';
|
|
503
518
|
code += `${indent2}function __newComposite() {\n`;
|
|
504
|
-
if (
|
|
519
|
+
if (self.items.length === 0) {
|
|
505
520
|
code += `${indent3}return nasl.util.NewList();\n`;
|
|
506
521
|
} else {
|
|
507
522
|
code += `${indent3}let arr = [`;
|
|
508
|
-
|
|
509
|
-
let ts = item.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
510
|
-
ts =
|
|
523
|
+
yield* wrapForEach(self.items, function* wrapForEach(item, index) {
|
|
524
|
+
let ts = yield* item.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
525
|
+
ts = yield* self.getForeachCode(ts);
|
|
511
526
|
code += ['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts) ? null : ts;
|
|
512
|
-
if (index + 1 <
|
|
527
|
+
if (index + 1 < self.items.length) code += ', ';
|
|
513
528
|
});
|
|
514
529
|
code += ']\n';
|
|
515
530
|
code += `${indent3}return nasl.util.NewList(...arr);\n`;
|
|
516
531
|
}
|
|
517
532
|
code += `${indent2}};\n`;
|
|
518
|
-
|
|
519
533
|
code += `${indent2}return __newComposite();\n`;
|
|
520
534
|
code += `${indent1}})()`;
|
|
521
535
|
return code;
|
|
522
536
|
}
|
|
523
537
|
|
|
524
|
-
getForeachCode(code: string)
|
|
538
|
+
*getForeachCode(code: string) {
|
|
525
539
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
526
540
|
const forEachStatement = this.getAncestor('ForEachStatement') as ForEachStatement;
|
|
527
541
|
if (forEachStatement && code) {
|
|
528
542
|
code = code.replaceAll('\n', ' ');
|
|
529
|
-
code = new Logic().handleForEachCode(code, forEachStatement);
|
|
543
|
+
code = yield* new Logic().handleForEachCode(code, forEachStatement);
|
|
530
544
|
}
|
|
531
545
|
return code;
|
|
532
546
|
}
|
package/src/concepts/NewMap__.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach, runGeneratorSync as runSync } from '../utils/time-slicing';
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
shiftState,
|
|
5
|
+
withSourceMap,
|
|
6
|
+
indent,
|
|
7
|
+
createCompilerState,
|
|
8
|
+
withSourceMapGenerator,
|
|
9
|
+
withGenerator,
|
|
10
|
+
TranslatorGenerator,
|
|
11
|
+
} from '../translator';
|
|
2
12
|
import { ElementToVueOptions } from './ViewElement__';
|
|
3
13
|
import ForEachStatement from './ForEachStatement__';
|
|
4
14
|
import Logic from './Logic__';
|
|
@@ -446,9 +456,12 @@ export class NewMap extends LogicItem {
|
|
|
446
456
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
447
457
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
448
458
|
params.index = index;
|
|
449
|
-
} else
|
|
450
|
-
|
|
451
|
-
(
|
|
459
|
+
} else {
|
|
460
|
+
const q = (t as any)[parentKey];
|
|
461
|
+
if ((q.__v_raw || q) === n) {
|
|
462
|
+
params.index = 0;
|
|
463
|
+
(this as any)[parentKey] = undefined;
|
|
464
|
+
}
|
|
452
465
|
}
|
|
453
466
|
}
|
|
454
467
|
return params;
|
|
@@ -524,9 +537,12 @@ export class NewMap extends LogicItem {
|
|
|
524
537
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
525
538
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
526
539
|
params.index = index;
|
|
527
|
-
} else
|
|
528
|
-
|
|
529
|
-
(
|
|
540
|
+
} else {
|
|
541
|
+
const q = (t as any)[parentKey];
|
|
542
|
+
if ((q.__v_raw || q) === n) {
|
|
543
|
+
params.index = 0;
|
|
544
|
+
(this as any)[parentKey] = undefined;
|
|
545
|
+
}
|
|
530
546
|
}
|
|
531
547
|
}
|
|
532
548
|
return params;
|
|
@@ -595,65 +611,63 @@ export class NewMap extends LogicItem {
|
|
|
595
611
|
return code;
|
|
596
612
|
}
|
|
597
613
|
|
|
598
|
-
@
|
|
599
|
-
toEmbeddedTS(state = createCompilerState()):
|
|
614
|
+
@withSourceMapGenerator
|
|
615
|
+
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
616
|
+
const self = this;
|
|
600
617
|
const indent0 = indent(state?.tabSize || 0);
|
|
601
618
|
const indent1 = indent((state?.tabSize || 0) + 1);
|
|
602
619
|
const indent2 = indent((state?.tabSize || 0) + 2);
|
|
603
|
-
|
|
604
|
-
const typeCode = (codestr: string) => {
|
|
620
|
+
const typeCode = function* typeCode(codestr: string) {
|
|
605
621
|
codestr += `nasl.util.New<`;
|
|
606
|
-
codestr += `${
|
|
622
|
+
codestr += `${yield * self.typeAnnotation.toEmbeddedTS(shiftState(state, codestr, { inline: true }))}`;
|
|
607
623
|
codestr += `>()`;
|
|
608
624
|
return codestr;
|
|
609
625
|
};
|
|
610
|
-
|
|
611
626
|
let code = '';
|
|
612
|
-
if (
|
|
627
|
+
if (self.typeAnnotation) {
|
|
613
628
|
code += `${indent0}(() => { \n`;
|
|
614
629
|
// 方便ts报错检查
|
|
615
630
|
code += `${indent1}function __newComposite() {\n`;
|
|
616
|
-
|
|
631
|
+
yield* wrapForEach(self.keys, function* warpForEachGenerator(item, index) {
|
|
617
632
|
const key = item;
|
|
618
633
|
code += `${indent2}nasl.util.MapPut(`;
|
|
619
|
-
code = `${typeCode(code)}, `;
|
|
620
|
-
code += `${key ? key.toEmbeddedTS(shiftState(state, code, { inline: true })) : null}`;
|
|
634
|
+
code = `${yield* typeCode(code)}, `;
|
|
635
|
+
code += `${key ? yield* key.toEmbeddedTS(shiftState(state, code, { inline: true })) : null}`;
|
|
621
636
|
code += ', null)\n';
|
|
622
637
|
});
|
|
623
|
-
|
|
624
|
-
const value =
|
|
638
|
+
yield* wrapForEach(self.values, function* warpForEachGenerator(item, index) {
|
|
639
|
+
const value = self.values[index];
|
|
625
640
|
code += `${indent2}nasl.util.MapPut(`;
|
|
626
|
-
code = `${typeCode(code)}, null, `;
|
|
627
|
-
code += `${value ? value.toEmbeddedTS(shiftState(state, code, { inline: true })) : null}`;
|
|
641
|
+
code = `${yield* typeCode(code)}, null, `;
|
|
642
|
+
code += `${value ? yield* value.toEmbeddedTS(shiftState(state, code, { inline: true })) : null}`;
|
|
628
643
|
code += ')';
|
|
629
644
|
code += '\n';
|
|
630
645
|
});
|
|
631
646
|
code += `${indent2}return `;
|
|
632
|
-
code = `${typeCode(code)};\n`;
|
|
647
|
+
code = `${yield* typeCode(code)};\n`;
|
|
633
648
|
code += `${indent1}};\n`;
|
|
634
|
-
|
|
635
649
|
code += `${indent1}return __newComposite();\n`;
|
|
636
650
|
code += `${indent0}})()`;
|
|
637
|
-
} else if (
|
|
651
|
+
} else if (self.keys.some((key) => key) || self.values.some((value) => value)) {
|
|
638
652
|
code += `${indent0}(() => { \n`;
|
|
639
653
|
const valueTsArr: any = [];
|
|
640
654
|
let keyTs = 'null';
|
|
641
655
|
let valueTs = false;
|
|
642
656
|
let keyIndex = -1;
|
|
643
|
-
|
|
657
|
+
yield* wrapForEach(self.keys, function* warpForEachGenerator(key, index) {
|
|
644
658
|
if (key) {
|
|
645
|
-
const ts = key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
659
|
+
const ts = yield* key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
646
660
|
if (keyIndex === -1 && !['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts)) {
|
|
647
661
|
keyIndex = index;
|
|
648
662
|
keyTs = ts;
|
|
649
663
|
}
|
|
650
664
|
}
|
|
651
665
|
});
|
|
652
|
-
|
|
653
|
-
|
|
666
|
+
self.values.length && (code += indent1);
|
|
667
|
+
yield* wrapForEach(self.values, function* warpForEachGenerator(item, index) {
|
|
654
668
|
if (item) valueTs = true;
|
|
655
669
|
code += `nasl.core.ensureVoid(`;
|
|
656
|
-
const ts = item ? item.toEmbeddedTS(shiftState(state, code, { inline: true })) : null;
|
|
670
|
+
const ts = item ? yield* item.toEmbeddedTS(shiftState(state, code, { inline: true })) : null;
|
|
657
671
|
valueTsArr.push(ts);
|
|
658
672
|
code += valueTsArr[index];
|
|
659
673
|
code += '); ';
|
|
@@ -664,26 +678,24 @@ export class NewMap extends LogicItem {
|
|
|
664
678
|
}
|
|
665
679
|
// 方便ts报错检查
|
|
666
680
|
code += `${indent1}function __newComposite() {\n`;
|
|
667
|
-
|
|
681
|
+
yield* wrapForEach(self.keys, function* warpForEachGenerator(key: any) {
|
|
668
682
|
if (!key) return;
|
|
669
683
|
code += `${indent2}nasl.core.compareNew(${keyTs}, `;
|
|
670
|
-
code += key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
684
|
+
code += yield* key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
671
685
|
code += ');\n';
|
|
672
686
|
});
|
|
673
687
|
if (keyIndex !== -1) {
|
|
674
688
|
code += `${indent2}nasl.util.ValidMapKey(`;
|
|
675
|
-
code += `${
|
|
689
|
+
code += `${yield* self.keys[keyIndex].toEmbeddedTS(shiftState(state, code, { inline: true }))});\n`;
|
|
676
690
|
}
|
|
677
691
|
code += `${indent2}return nasl.util.NewMap(`;
|
|
678
692
|
code += `${keyIndex === -1 ? 'null' : keyTs}, ...[`;
|
|
679
|
-
valueTsArr
|
|
693
|
+
yield* wrapForEach(valueTsArr, function* warpForEachGenerator(ts: any, index: number) {
|
|
680
694
|
code += ['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts) ? null : ts;
|
|
681
|
-
if (index + 1 <
|
|
695
|
+
if (index + 1 < self.values.length) code += ', ';
|
|
682
696
|
});
|
|
683
697
|
code += ']);\n';
|
|
684
|
-
|
|
685
698
|
code += `${indent1}};\n`;
|
|
686
|
-
|
|
687
699
|
code += `${indent1}return __newComposite();\n`;
|
|
688
700
|
code += `${indent0}})()`;
|
|
689
701
|
} else {
|
|
@@ -692,7 +704,6 @@ export class NewMap extends LogicItem {
|
|
|
692
704
|
code += `${indent1}function __newComposite() {\n`;
|
|
693
705
|
code += `${indent2}return nasl.util.NewMap(${null}, ${null});\n`;
|
|
694
706
|
code += `${indent1}};\n`;
|
|
695
|
-
|
|
696
707
|
code += `${indent1}return __newComposite();\n`;
|
|
697
708
|
code += `${indent0}})()`;
|
|
698
709
|
}
|
|
@@ -717,28 +728,30 @@ export class NewMap extends LogicItem {
|
|
|
717
728
|
return code;
|
|
718
729
|
}
|
|
719
730
|
|
|
720
|
-
getInitCode(state?: TranslatorState)
|
|
731
|
+
*getInitCode(state?: TranslatorState) {
|
|
732
|
+
const self = this;
|
|
721
733
|
let code = '';
|
|
722
734
|
if (this.keys.some((key) => key) || this.values.some((value) => value)) {
|
|
723
735
|
let keyBol = false;
|
|
724
736
|
code += `nasl.util.NewMap(`;
|
|
725
|
-
this.keys
|
|
737
|
+
for (const key of this.keys) {
|
|
726
738
|
if (key && !keyBol) {
|
|
727
|
-
let ts = key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
728
|
-
ts = this.getForeachCode(ts);
|
|
739
|
+
let ts = yield* key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
740
|
+
ts = yield* this.getForeachCode(ts);
|
|
729
741
|
if (!['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts)) {
|
|
730
742
|
keyBol = true;
|
|
731
743
|
code += ts;
|
|
732
744
|
}
|
|
733
745
|
}
|
|
734
|
-
}
|
|
746
|
+
};
|
|
735
747
|
if (!keyBol) code += 'null';
|
|
736
748
|
code += `, ...[`;
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
ts =
|
|
749
|
+
|
|
750
|
+
yield* wrapForEach(this.values, function* wrapForEach(item, index) {
|
|
751
|
+
let ts = item ? yield* item.toEmbeddedTS(shiftState(state, code, { inline: true })) : null;
|
|
752
|
+
ts = yield* self.getForeachCode(ts);
|
|
740
753
|
code += ['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts) ? null : ts;
|
|
741
|
-
if (index + 1 <
|
|
754
|
+
if (index + 1 < self.values.length) code += ', ';
|
|
742
755
|
});
|
|
743
756
|
code += '])';
|
|
744
757
|
} else {
|
|
@@ -747,12 +760,12 @@ export class NewMap extends LogicItem {
|
|
|
747
760
|
return code;
|
|
748
761
|
}
|
|
749
762
|
|
|
750
|
-
getForeachCode(code: string)
|
|
763
|
+
*getForeachCode(code: string) {
|
|
751
764
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
752
765
|
const forEachStatement = this.getAncestor('ForEachStatement') as ForEachStatement;
|
|
753
766
|
if (forEachStatement && code) {
|
|
754
767
|
code = code.replaceAll('\n', ' ');
|
|
755
|
-
code = new Logic().handleForEachCode(code, forEachStatement);
|
|
768
|
+
code = yield* new Logic().handleForEachCode(code, forEachStatement);
|
|
756
769
|
}
|
|
757
770
|
return code;
|
|
758
771
|
}
|
package/src/concepts/New__.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
shiftState,
|
|
5
|
+
withSourceMap,
|
|
6
|
+
createCompilerState,
|
|
7
|
+
withSourceMapGenerator,
|
|
8
|
+
withGenerator,
|
|
9
|
+
TranslatorGenerator,
|
|
10
|
+
} from '../translator';
|
|
2
11
|
//================================================================================
|
|
3
12
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
4
13
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -50,8 +59,9 @@ export class New extends LogicItem {
|
|
|
50
59
|
return code;
|
|
51
60
|
}
|
|
52
61
|
|
|
53
|
-
@
|
|
54
|
-
toEmbeddedTS(state = createCompilerState()):
|
|
62
|
+
@withSourceMapGenerator
|
|
63
|
+
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
64
|
+
const self = this;
|
|
55
65
|
const code = '__IDENTIFIER__';
|
|
56
66
|
return code;
|
|
57
67
|
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
withSourceMap,
|
|
5
|
+
createCompilerState,
|
|
6
|
+
withSourceMapGenerator,
|
|
7
|
+
withGenerator,
|
|
8
|
+
TranslatorGenerator,
|
|
9
|
+
} from '../translator';
|
|
2
10
|
import { ElementToVueOptions } from './ViewElement__';
|
|
3
11
|
|
|
4
12
|
//================================================================================
|
|
@@ -63,8 +71,8 @@ export class NullLiteral extends LogicItem {
|
|
|
63
71
|
return 'null';
|
|
64
72
|
}
|
|
65
73
|
|
|
66
|
-
@
|
|
67
|
-
toEmbeddedTS(state = createCompilerState()) {
|
|
74
|
+
@withSourceMapGenerator
|
|
75
|
+
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
68
76
|
return 'null';
|
|
69
77
|
}
|
|
70
78
|
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
withSourceMap,
|
|
5
|
+
createCompilerState,
|
|
6
|
+
withSourceMapGenerator,
|
|
7
|
+
withGenerator,
|
|
8
|
+
TranslatorGenerator,
|
|
9
|
+
} from '../translator';
|
|
2
10
|
import { ElementToVueOptions } from './ViewElement__';
|
|
3
11
|
|
|
4
12
|
//================================================================================
|
|
@@ -103,9 +111,12 @@ export class NumericLiteral extends LogicItem {
|
|
|
103
111
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
104
112
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
105
113
|
params.index = index;
|
|
106
|
-
} else
|
|
107
|
-
|
|
108
|
-
(
|
|
114
|
+
} else {
|
|
115
|
+
const q = (t as any)[parentKey];
|
|
116
|
+
if ((q.__v_raw || q) === n) {
|
|
117
|
+
params.index = 0;
|
|
118
|
+
(this as any)[parentKey] = undefined;
|
|
119
|
+
}
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
return params;
|
|
@@ -127,6 +138,7 @@ export class NumericLiteral extends LogicItem {
|
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
toJS(): string {
|
|
141
|
+
// const code = this.value ? `new window.NaslDecimal("${String(this.value)}")` : '';
|
|
130
142
|
const code = this.value ? `"${String(this.value)}"` : '';
|
|
131
143
|
return code;
|
|
132
144
|
}
|
|
@@ -135,10 +147,11 @@ export class NumericLiteral extends LogicItem {
|
|
|
135
147
|
return `${this.value}`;
|
|
136
148
|
}
|
|
137
149
|
|
|
138
|
-
@
|
|
139
|
-
toEmbeddedTS(state = createCompilerState()):
|
|
140
|
-
const
|
|
141
|
-
const
|
|
150
|
+
@withSourceMapGenerator
|
|
151
|
+
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
152
|
+
const self = this;
|
|
153
|
+
const type = `${self.typeAnnotation.typeNamespace}.${self.typeAnnotation.typeName}`;
|
|
154
|
+
const code = self.value ? `new ${type}(${self.value})` : '__IDENTIFIER__';
|
|
142
155
|
return code;
|
|
143
156
|
}
|
|
144
157
|
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
|
+
import {
|
|
3
|
+
TranslatorState,
|
|
4
|
+
shiftState,
|
|
5
|
+
withSourceMap,
|
|
6
|
+
indent,
|
|
7
|
+
createCompilerState,
|
|
8
|
+
withSourceMapGenerator,
|
|
9
|
+
withGenerator,
|
|
10
|
+
TranslatorGenerator,
|
|
11
|
+
} from '../translator';
|
|
2
12
|
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
3
13
|
import StructureProperty from './StructureProperty__';
|
|
4
14
|
import Structure from './Structure__';
|
|
@@ -134,9 +144,12 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
134
144
|
const index = (t as any)[parentKey].findIndex((el) => (el.__v_raw || el) === n);
|
|
135
145
|
~index && (this as any)[parentKey].splice(index, 1);
|
|
136
146
|
params.index = index;
|
|
137
|
-
} else
|
|
138
|
-
|
|
139
|
-
(
|
|
147
|
+
} else {
|
|
148
|
+
const q = (t as any)[parentKey];
|
|
149
|
+
if ((q.__v_raw || q) === n) {
|
|
150
|
+
params.index = 0;
|
|
151
|
+
(this as any)[parentKey] = undefined;
|
|
152
|
+
}
|
|
140
153
|
}
|
|
141
154
|
}
|
|
142
155
|
return params;
|
|
@@ -242,29 +255,29 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
242
255
|
return sqlTypeBan;
|
|
243
256
|
}
|
|
244
257
|
|
|
245
|
-
@
|
|
246
|
-
toEmbeddedTS(state = createCompilerState()):
|
|
258
|
+
@withSourceMapGenerator
|
|
259
|
+
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
260
|
+
const self = this;
|
|
247
261
|
let code: string;
|
|
248
|
-
const { typeAnnotation } =
|
|
262
|
+
const { typeAnnotation } = self;
|
|
249
263
|
if (typeAnnotation) {
|
|
250
|
-
code = `(function(): ${typeAnnotation.toEmbeddedTS()} {\n`;
|
|
264
|
+
code = `(function(): ${yield* typeAnnotation.toEmbeddedTS()} {\n`;
|
|
251
265
|
} else {
|
|
252
|
-
code = `(function __oqlQueryFn${String(
|
|
266
|
+
code = `(function __oqlQueryFn${String(self.id).slice(0, 8)} () {\n`;
|
|
253
267
|
}
|
|
254
|
-
|
|
255
268
|
const indent1 = indent((state?.tabSize || 0) + 1);
|
|
256
269
|
// this.dataSource: 'app.dataSources.defaultDS';
|
|
257
|
-
if (
|
|
270
|
+
if (self.dataSource) {
|
|
258
271
|
code += indent1;
|
|
259
|
-
code += `const dataSource = ${
|
|
272
|
+
code += `const dataSource = ${self.dataSource || 'app.dataSources.defaultDS'};\n`;
|
|
260
273
|
}
|
|
261
|
-
const hasSyntaxErrors = !!
|
|
274
|
+
const hasSyntaxErrors = !!self.codeSourceMap?.oqlSyntaxError?.syntaxErrors?.length;
|
|
262
275
|
// 生成内部的ts内容
|
|
263
|
-
if (!
|
|
276
|
+
if (!self.code) {
|
|
264
277
|
// SQL 为空
|
|
265
278
|
code += `${indent1}__OQL_EMPTY_ERROR__;\n`;
|
|
266
279
|
} else if (hasSyntaxErrors) {
|
|
267
|
-
const syntaxErrors =
|
|
280
|
+
const syntaxErrors = self.codeSourceMap?.oqlSyntaxError?.syntaxErrors || [];
|
|
268
281
|
const warningList = syntaxErrors.filter((err: any) => err.errorMsg.includes('别名不符合规范'));
|
|
269
282
|
if (warningList.length === syntaxErrors.length) {
|
|
270
283
|
// SQL 别名警告
|
|
@@ -279,21 +292,19 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
279
292
|
}
|
|
280
293
|
}
|
|
281
294
|
// insert typescript code
|
|
282
|
-
const typescript =
|
|
295
|
+
const typescript = self.codeSourceMap?.typescript;
|
|
283
296
|
if (typescript) {
|
|
284
297
|
code += `${indent1}const __oqlQueryResult = ${typescript};`;
|
|
285
298
|
}
|
|
286
|
-
|
|
287
299
|
// 临时方案拼接字符串
|
|
288
|
-
|
|
300
|
+
self.getTextVariables();
|
|
289
301
|
// 翻译字段
|
|
290
302
|
code += '\n';
|
|
291
|
-
|
|
292
|
-
code += variable.toEmbeddedTS(shiftState(state, code));
|
|
303
|
+
yield* wrapForEach(self._TsVariables, function* warpForEachGenerator(variable) {
|
|
304
|
+
code += yield* variable.toEmbeddedTS(shiftState(state, code));
|
|
293
305
|
code += ';\n';
|
|
294
306
|
});
|
|
295
307
|
code += '\n';
|
|
296
|
-
|
|
297
308
|
if (typescript && !typeAnnotation) {
|
|
298
309
|
code += `${indent1}return __oqlQueryResult;\n`;
|
|
299
310
|
} else {
|