@lcap/nasl 3.2.0-beta.4 → 3.3.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/upgrader/2.20.js +1 -1
- package/out/automate/upgrader/2.20.js.map +1 -1
- package/out/bak/translator.js +11 -15
- package/out/bak/translator.js.map +1 -1
- package/out/breakpoint/generator/AfterStartNode.js +3 -1
- package/out/breakpoint/generator/AfterStartNode.js.map +1 -1
- package/out/breakpoint/generator/BeforeEndNode.js.map +1 -1
- package/out/breakpoint/generator/BreakpointNode.d.ts +1 -0
- package/out/breakpoint/generator/BreakpointNode.js +48 -15
- package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
- package/out/breakpoint/generator/CallbackNode.d.ts +4 -0
- package/out/breakpoint/generator/CallbackNode.js +22 -0
- package/out/breakpoint/generator/CallbackNode.js.map +1 -0
- package/out/breakpoint/generator/FragmentNode.d.ts +4 -0
- package/out/breakpoint/generator/FragmentNode.js +18 -0
- package/out/breakpoint/generator/FragmentNode.js.map +1 -0
- package/out/breakpoint/generator/index.js +25 -4
- package/out/breakpoint/generator/index.js.map +1 -1
- package/out/breakpoint/shared/constants.d.ts +3 -0
- package/out/breakpoint/shared/constants.js +6 -1
- package/out/breakpoint/shared/constants.js.map +1 -1
- package/out/breakpoint/shared/operations.js.map +1 -1
- package/out/breakpoint/shared/socket.d.ts +1 -1
- package/out/breakpoint/shared/socket.js +36 -7
- package/out/breakpoint/shared/socket.js.map +1 -1
- package/out/breakpoint/shared/utils.d.ts +2 -0
- package/out/breakpoint/shared/utils.js +15 -2
- package/out/breakpoint/shared/utils.js.map +1 -1
- package/out/breakpoint/store/core.d.ts +48 -2
- package/out/breakpoint/store/core.js +58 -32
- package/out/breakpoint/store/core.js.map +1 -1
- package/out/breakpoint/store/dock.js +1 -1
- package/out/breakpoint/store/dock.js.map +1 -1
- package/out/common/BaseNode.d.ts +1 -1
- package/out/common/BaseNode.js +105 -51
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/Command.d.ts +13 -2
- package/out/common/Command.js +37 -9
- package/out/common/Command.js.map +1 -1
- package/out/common/EventEmitter.js.map +1 -1
- package/out/common/Messager.d.ts +3 -3
- package/out/common/Messager.js +6 -7
- package/out/common/Messager.js.map +1 -1
- package/out/common/asyncFuncMap.js.map +1 -1
- package/out/concepts/Abort__.js +6 -5
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.d.ts +4 -3
- package/out/concepts/Anchor__.js +24 -7
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +22 -21
- package/out/concepts/AnonymousFunction__.js +48 -22
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.d.ts +421 -247
- package/out/concepts/App__.js +286 -54
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +4 -3
- package/out/concepts/Argument__.js +42 -11
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +45 -45
- package/out/concepts/Assignee__.js +15 -15
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +6 -5
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +7 -6
- package/out/concepts/Assignment__.js +40 -22
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.d.ts +3 -3
- package/out/concepts/Attribute__.js +8 -7
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthInterface__.js +4 -3
- package/out/concepts/AuthInterface__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.d.ts +15 -15
- package/out/concepts/AuthLogicForCallInterface__.js +46 -27
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.js +27 -13
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +5 -5
- package/out/concepts/BackendVariable__.js +23 -26
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.d.ts +18 -18
- package/out/concepts/Backend__.js +13 -13
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +34 -33
- package/out/concepts/BatchAssignment__.js +83 -43
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +7 -6
- package/out/concepts/BinaryExpression__.js +60 -24
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +37 -37
- package/out/concepts/BindAttribute__.js +101 -48
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +13 -13
- package/out/concepts/BindDirective__.js +23 -21
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +28 -28
- package/out/concepts/BindEvent__.js +99 -48
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +14 -15
- package/out/concepts/BindStyle__.js +16 -16
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +1 -0
- package/out/concepts/BooleanLiteral__.js +12 -5
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +15 -15
- package/out/concepts/CallAuthInterface__.js +23 -22
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +11 -9
- package/out/concepts/CallConnector__.js +79 -36
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +17 -16
- package/out/concepts/CallFunction__.js +95 -63
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +9 -8
- package/out/concepts/CallInterface__.js +71 -30
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +20 -19
- package/out/concepts/CallLogic__.js +155 -52
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +51 -51
- package/out/concepts/CallQueryComponent__.js +66 -63
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +1 -0
- package/out/concepts/Comment__.js +13 -6
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/CompletionProperty__.d.ts +3 -3
- package/out/concepts/CompletionProperty__.js +8 -7
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.d.ts +15 -15
- package/out/concepts/ConfigGroup__.js +9 -9
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js +4 -3
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +15 -15
- package/out/concepts/ConfigProperty__.js +10 -10
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.d.ts +15 -15
- package/out/concepts/Configuration__.js +9 -9
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +166 -0
- package/out/concepts/Connection__.js +332 -0
- package/out/concepts/Connection__.js.map +1 -0
- package/out/concepts/ConnectorTrigger__.js +4 -3
- package/out/concepts/ConnectorTrigger__.js.map +1 -1
- package/out/concepts/Connector__.d.ts +66 -66
- package/out/concepts/Connector__.js +16 -15
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +3 -3
- package/out/concepts/Constant__.js +8 -7
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataElement__.d.ts +3 -3
- package/out/concepts/DataElement__.js +6 -5
- package/out/concepts/DataElement__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +15 -15
- package/out/concepts/DataSource__.js +55 -39
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.js +4 -3
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +12 -11
- package/out/concepts/Destination__.js +93 -36
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.js +15 -13
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +1 -1
- package/out/concepts/EntityIndex__.js +6 -5
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +8 -7
- package/out/concepts/EntityProperty__.js +39 -24
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +31 -30
- package/out/concepts/Entity__.js +40 -16
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +1 -0
- package/out/concepts/EnumItem__.js +12 -5
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +9 -8
- package/out/concepts/Enum__.js +24 -11
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.d.ts +15 -15
- package/out/concepts/Event__.js +6 -5
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +6 -6
- package/out/concepts/ExternalDestination__.js +12 -11
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +25 -24
- package/out/concepts/ForEachStatement__.js +101 -36
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +30 -30
- package/out/concepts/FrontendLibrary__.js +12 -13
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/FrontendVariable__.js +4 -3
- package/out/concepts/FrontendVariable__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +64 -65
- package/out/concepts/Frontend__.js +23 -27
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.d.ts +64 -63
- package/out/concepts/Function__.js +49 -21
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +37 -31
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +20 -19
- package/out/concepts/IfStatement__.js +64 -34
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.d.ts +3 -3
- package/out/concepts/Integration__.js +8 -7
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +3 -3
- package/out/concepts/InterfaceParam__.js +7 -6
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +33 -33
- package/out/concepts/Interface__.js +19 -20
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +1 -0
- package/out/concepts/JSBlock__.js +12 -5
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.js +10 -9
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +6 -0
- package/out/concepts/LogicItem__.js +14 -5
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +80 -79
- package/out/concepts/Logic__.js +204 -58
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +39 -38
- package/out/concepts/MatchCase__.js +122 -37
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +13 -11
- package/out/concepts/Match__.js +128 -60
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +7 -6
- package/out/concepts/MemberExpression__.js +52 -22
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MicroApp__.js +4 -3
- package/out/concepts/MicroApp__.js.map +1 -1
- package/out/concepts/Module__.d.ts +239 -155
- package/out/concepts/Module__.js +139 -33
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.d.ts +15 -15
- package/out/concepts/MsgTriggerEvent__.js +6 -5
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.d.ts +23 -15
- package/out/concepts/MsgTriggerLauncher__.js +24 -5
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.d.ts +180 -180
- package/out/concepts/Namespace__.js +33 -34
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +49 -48
- package/out/concepts/NewComposite__.js +164 -49
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +19 -18
- package/out/concepts/NewList__.js +29 -12
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +34 -33
- package/out/concepts/NewMap__.js +81 -72
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.js +6 -5
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.js +6 -5
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +4 -3
- package/out/concepts/NumericLiteral__.js +15 -8
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +4 -3
- package/out/concepts/OqlQueryComponent__.js +25 -16
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +79 -79
- package/out/concepts/OverriddenLogic__.js +79 -58
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.d.ts +6 -5
- package/out/concepts/Param__.js +66 -29
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Point__.js +4 -3
- package/out/concepts/Point__.js.map +1 -1
- package/out/concepts/ProcessComponent__.d.ts +30 -30
- package/out/concepts/ProcessComponent__.js +8 -7
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +96 -96
- package/out/concepts/ProcessElement__.js +34 -34
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.js +6 -5
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +6 -5
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +75 -75
- package/out/concepts/Process__.js +33 -30
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +3 -3
- package/out/concepts/QueryAggregateExpression__.js +8 -7
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.js +7 -6
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +8 -8
- package/out/concepts/QueryFromExpression__.js +8 -7
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +3 -3
- package/out/concepts/QueryGroupByExpression__.js +9 -10
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +23 -23
- package/out/concepts/QueryJoinExpression__.js +11 -10
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +6 -6
- package/out/concepts/QueryLimitExpression__.js +9 -8
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +6 -6
- package/out/concepts/QueryOrderByExpression__.js +9 -8
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.d.ts +30 -30
- package/out/concepts/QuerySelectExpression__.js +9 -8
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Rect__.js +4 -3
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +4 -3
- package/out/concepts/Return__.js +37 -18
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.js +9 -9
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +18 -18
- package/out/concepts/SelectMembers__.js +10 -9
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.d.ts +3 -3
- package/out/concepts/Slot__.js +6 -5
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +4 -3
- package/out/concepts/SqlQueryComponent__.js +21 -12
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.js +6 -5
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +16 -15
- package/out/concepts/StringInterpolation__.js +37 -14
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +1 -0
- package/out/concepts/StringLiteral__.js +13 -8
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +4 -3
- package/out/concepts/StructureProperty__.js +22 -9
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +31 -30
- package/out/concepts/Structure__.js +27 -15
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +12 -11
- package/out/concepts/SwitchCase__.js +69 -31
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +9 -8
- package/out/concepts/SwitchStatement__.js +27 -7
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/Theme__.js +4 -3
- package/out/concepts/Theme__.js.map +1 -1
- package/out/concepts/Transactional__.js +4 -3
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TriggerEvent__.d.ts +15 -15
- package/out/concepts/TriggerEvent__.js +6 -5
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.d.ts +15 -10
- package/out/concepts/TriggerLauncher__.js +54 -32
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +28 -27
- package/out/concepts/TypeAnnotation__.js +144 -124
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -0
- package/out/concepts/TypeParam__.js +12 -5
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +4 -3
- package/out/concepts/UnaryExpression__.js +31 -20
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +1 -0
- package/out/concepts/Unparsed__.js +12 -5
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/UseComponent__.js +4 -3
- package/out/concepts/UseComponent__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +14 -14
- package/out/concepts/ValidationRule__.js +19 -17
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +4 -3
- package/out/concepts/Variable__.js +39 -23
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewBlock__.js +4 -3
- package/out/concepts/ViewBlock__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +90 -90
- package/out/concepts/ViewComponent__.js +16 -15
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +91 -86
- package/out/concepts/ViewElement__.js +218 -146
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +92 -92
- package/out/concepts/View__.js +135 -60
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +12 -11
- package/out/concepts/WhileStatement__.js +46 -23
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/index__.d.ts +2 -1
- package/out/concepts/index__.js +2 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/types__.d.ts +2 -1
- package/out/decorators/index.d.ts +1 -1
- package/out/decorators/index.js +20 -7
- package/out/decorators/index.js.map +1 -1
- package/out/decorators/promise.d.ts +7 -0
- package/out/decorators/promise.js +28 -0
- package/out/decorators/promise.js.map +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/enums/LEVEL_NAME_MAP.js.map +1 -1
- package/out/generator/compileComponent.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +4 -1
- package/out/generator/genBundleFiles.js +15 -11
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genHash.js.map +1 -1
- package/out/generator/genMetaData.js +12 -8
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.js +33 -35
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/microApp.js +2 -1
- package/out/generator/microApp.js.map +1 -1
- package/out/generator/permission.js +16 -14
- package/out/generator/permission.js.map +1 -1
- package/out/generator/styleReplacer.js +4 -7
- package/out/generator/styleReplacer.js.map +1 -1
- package/out/index.d.ts +0 -2
- package/out/index.js +0 -3
- package/out/index.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/manager/diagnostic.js.map +1 -1
- package/out/manager/stepRecorder.js +13 -9
- package/out/manager/stepRecorder.js.map +1 -1
- package/out/natural/RequirementAnalyzer.d.ts +22 -0
- package/out/natural/RequirementAnalyzer.js +196 -0
- package/out/natural/RequirementAnalyzer.js.map +1 -0
- package/out/natural/RequirementExecutor.d.ts +51 -0
- package/out/natural/RequirementExecutor.js +692 -0
- package/out/natural/RequirementExecutor.js.map +1 -0
- package/out/natural/componentData.d.ts +31 -0
- package/out/natural/componentData.js +85 -0
- package/out/natural/componentData.js.map +1 -0
- package/out/natural/genNaturalTS.d.ts +3 -0
- package/out/natural/genNaturalTS.js +76 -0
- package/out/natural/genNaturalTS.js.map +1 -0
- package/out/natural/index.d.ts +4 -0
- package/out/natural/index.js +21 -0
- package/out/natural/index.js.map +1 -0
- package/out/natural/knowledgeMap.d.ts +4 -0
- package/out/natural/knowledgeMap.js +40 -0
- package/out/natural/knowledgeMap.js.map +1 -0
- package/out/natural/naslStdlibMap.d.ts +2 -0
- package/out/natural/naslStdlibMap.js +26 -0
- package/out/natural/naslStdlibMap.js.map +1 -0
- package/out/natural/transformTSCode.d.ts +7 -0
- package/out/natural/transformTSCode.js +760 -0
- package/out/natural/transformTSCode.js.map +1 -0
- package/out/sentry/index.d.ts +2 -1
- package/out/sentry/index.js.map +1 -1
- package/out/server/createUiTs.js +28 -16
- package/out/server/createUiTs.js.map +1 -1
- package/out/server/entity2LogicNamespace.js +24 -22
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/event.js.map +1 -1
- package/out/server/extendBaseNode.js +55 -70
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +46 -50
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getConnector.d.ts +3 -3
- package/out/server/getConnector.js +7 -8
- package/out/server/getConnector.js.map +1 -1
- package/out/server/getExtensionModules.js +2 -2
- package/out/server/getExtensionModules.js.map +1 -1
- package/out/server/getFunctions.js.map +1 -1
- package/out/server/getInterfaces.js.map +1 -1
- package/out/server/getLogging.js.map +1 -1
- package/out/server/getLogics.d.ts +1 -1
- package/out/server/getLogics.js +34 -16
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getMemberIdentifier.js +13 -10
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/getProcessComponents.js.map +1 -1
- package/out/server/getProcesses.js +21 -29
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/getScope.js.map +1 -1
- package/out/server/getValidates.js.map +1 -1
- package/out/server/index.js +0 -1
- package/out/server/index.js.map +1 -1
- package/out/server/naslServer.d.ts +99 -94
- package/out/server/naslServer.js +485 -465
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +4 -2
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.d.ts +1 -1
- package/out/server/translator.js +52 -47
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/init.d.ts +15 -1
- package/out/service/storage/init.js +65 -56
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCallComponentLogic.js +1 -2
- package/out/templator/genCallComponentLogic.js.map +1 -1
- package/out/templator/genCreateBlock.js +13 -8
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +19 -10
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +22 -26
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +11 -12
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genEnumSelectBlock.js +1 -1
- package/out/templator/genEnumSelectBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +2 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genGridViewBlock.js +10 -14
- package/out/templator/genGridViewBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +4 -7
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genQueryComponent.js +22 -15
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +12 -33
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +8 -10
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +12 -7
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/index.d.ts +4 -2
- package/out/templator/index.js +2 -2
- package/out/templator/index.js.map +1 -1
- package/out/templator/utils.d.ts +2 -2
- package/out/templator/utils.js +21 -22
- package/out/templator/utils.js.map +1 -1
- package/out/translator/index.js +27 -28
- package/out/translator/index.js.map +1 -1
- package/out/utils/index.d.ts +2 -1
- package/out/utils/index.js +8 -14
- package/out/utils/index.js.map +1 -1
- package/out/utils/logger.js.map +1 -1
- package/out/utils/sortTsString.js +3 -1
- package/out/utils/sortTsString.js.map +1 -1
- package/out/utils/string.js +8 -11
- package/out/utils/string.js.map +1 -1
- package/out/utils/time-slicing.d.ts +41 -0
- package/out/utils/time-slicing.js +81 -0
- package/out/utils/time-slicing.js.map +1 -0
- package/out/utils/traverse.js +4 -6
- package/out/utils/traverse.js.map +1 -1
- package/package.json +11 -7
- package/sandbox/stdlib/nasl.auth.ts +49 -46
- package/sandbox/stdlib/nasl.http.ts +29 -31
- package/sandbox/stdlib/nasl.ui.definition.ts +13 -1
- package/sandbox-natural/stdlib/nasl.core.ts +36 -0
- package/sandbox-natural/stdlib/nasl.oql.ts +8 -0
- package/sandbox-natural/stdlib/nasl.ui.ts +56 -0
- package/sandbox-natural/stdlib/nasl.util.ts +26 -0
- package/sandbox-natural/tsconfig.json +12 -0
- package/src/automate/upgrader/2.20.js +1 -1
- package/src/bak/translator.js +92 -99
- package/src/breakpoint/generator/AfterStartNode.ts +19 -17
- package/src/breakpoint/generator/BeforeEndNode.ts +17 -17
- package/src/breakpoint/generator/BreakpointNode.ts +243 -195
- package/src/breakpoint/generator/CallbackNode.ts +20 -0
- package/src/breakpoint/generator/FragmentNode.ts +14 -0
- package/src/breakpoint/generator/index.ts +107 -80
- package/src/breakpoint/shared/constants.ts +59 -53
- package/src/breakpoint/shared/operations.ts +6 -6
- package/src/breakpoint/shared/socket.ts +277 -223
- package/src/breakpoint/shared/utils.ts +166 -146
- package/src/breakpoint/store/core.ts +326 -297
- package/src/breakpoint/store/dock.ts +103 -103
- package/src/breakpoint/types/index.d.ts +11 -11
- package/src/common/BaseNode.ts +1102 -1024
- package/src/common/Command.ts +46 -16
- package/src/common/ComponentAPI.ts +72 -72
- package/src/common/EventEmitter.ts +80 -76
- package/src/common/Messager.ts +223 -224
- package/src/common/asyncFuncMap.ts +12 -12
- package/src/concepts/Abort__.ts +53 -60
- package/src/concepts/Anchor__.ts +158 -149
- package/src/concepts/AnonymousFunction__.ts +584 -551
- package/src/concepts/App__.ts +4278 -3671
- package/src/concepts/Argument__.ts +234 -210
- package/src/concepts/Assignee__.ts +680 -656
- package/src/concepts/AssignmentLine__.ts +80 -84
- package/src/concepts/Assignment__.ts +275 -264
- package/src/concepts/Attribute__.ts +183 -184
- package/src/concepts/AuthInterface__.ts +61 -63
- package/src/concepts/AuthLogicForCallInterface__.ts +540 -511
- package/src/concepts/AuthLogic__.ts +210 -194
- package/src/concepts/BackendVariable__.ts +414 -415
- package/src/concepts/Backend__.ts +317 -303
- package/src/concepts/BatchAssignment__.ts +987 -939
- package/src/concepts/BinaryExpression__.ts +370 -341
- package/src/concepts/BindAttribute__.ts +1057 -1007
- package/src/concepts/BindDirective__.ts +540 -542
- package/src/concepts/BindEvent__.ts +992 -911
- package/src/concepts/BindStyle__.ts +442 -451
- package/src/concepts/BooleanLiteral__.ts +89 -90
- package/src/concepts/CallAuthInterface__.ts +458 -433
- package/src/concepts/CallConnector__.ts +209 -164
- package/src/concepts/CallFunction__.ts +600 -600
- package/src/concepts/CallInterface__.ts +752 -721
- package/src/concepts/CallLogic__.ts +1324 -1200
- package/src/concepts/CallQueryComponent__.ts +1580 -1501
- package/src/concepts/Comment__.ts +69 -68
- package/src/concepts/CompletionProperty__.ts +250 -255
- package/src/concepts/ConfigGroup__.ts +312 -296
- package/src/concepts/ConfigPropertyValue__.ts +92 -93
- package/src/concepts/ConfigProperty__.ts +374 -357
- package/src/concepts/Configuration__.ts +288 -276
- package/src/concepts/Connection__.ts +426 -0
- package/src/concepts/ConnectorTrigger__.ts +146 -142
- package/src/concepts/Connector__.ts +1090 -1048
- package/src/concepts/Constant__.ts +226 -219
- package/src/concepts/DataElement__.ts +108 -115
- package/src/concepts/DataSource__.ts +508 -472
- package/src/concepts/DatabaseTypeAnnotation__.ts +53 -59
- package/src/concepts/Destination__.ts +808 -746
- package/src/concepts/End__.ts +85 -89
- package/src/concepts/EntityIndex__.ts +206 -202
- package/src/concepts/EntityProperty__.ts +825 -791
- package/src/concepts/Entity__.ts +921 -864
- package/src/concepts/EnumItem__.ts +133 -125
- package/src/concepts/Enum__.ts +347 -337
- package/src/concepts/Event__.ts +305 -292
- package/src/concepts/ExternalDestination__.ts +269 -280
- package/src/concepts/ForEachStatement__.ts +583 -531
- package/src/concepts/FrontendLibrary__.ts +507 -485
- package/src/concepts/FrontendVariable__.ts +44 -49
- package/src/concepts/Frontend__.ts +1239 -1187
- package/src/concepts/Function__.ts +1110 -1045
- package/src/concepts/Identifier__.ts +276 -272
- package/src/concepts/IfStatement__.ts +467 -436
- package/src/concepts/Integration__.ts +136 -137
- package/src/concepts/InterfaceParam__.ts +239 -238
- package/src/concepts/Interface__.ts +969 -948
- package/src/concepts/JSBlock__.ts +83 -83
- package/src/concepts/JavaLogic__.ts +101 -106
- package/src/concepts/LogicItem__.ts +307 -237
- package/src/concepts/Logic__.ts +2301 -2088
- package/src/concepts/MatchCase__.ts +886 -779
- package/src/concepts/Match__.ts +728 -659
- package/src/concepts/MemberExpression__.ts +330 -311
- package/src/concepts/MicroApp__.ts +91 -97
- package/src/concepts/Module__.ts +2590 -2278
- package/src/concepts/MsgTriggerEvent__.ts +297 -281
- package/src/concepts/MsgTriggerLauncher__.ts +286 -256
- package/src/concepts/Namespace__.ts +2579 -2466
- package/src/concepts/NewComposite__.ts +1487 -1350
- package/src/concepts/NewList__.ts +464 -450
- package/src/concepts/NewMap__.ts +691 -674
- package/src/concepts/New__.ts +42 -49
- package/src/concepts/NullLiteral__.ts +66 -72
- package/src/concepts/NumericLiteral__.ts +169 -169
- package/src/concepts/OqlQueryComponent__.ts +282 -279
- package/src/concepts/OverriddenLogic__.ts +2142 -2097
- package/src/concepts/Param__.ts +500 -442
- package/src/concepts/Point__.ts +53 -59
- package/src/concepts/ProcessComponent__.ts +497 -475
- package/src/concepts/ProcessElement__.ts +1852 -1780
- package/src/concepts/ProcessOutcome__.ts +59 -64
- package/src/concepts/ProcessOutcomes__.ts +59 -64
- package/src/concepts/Process__.ts +1491 -1428
- package/src/concepts/QueryAggregateExpression__.ts +135 -142
- package/src/concepts/QueryFieldExpression__.ts +138 -142
- package/src/concepts/QueryFromExpression__.ts +246 -254
- package/src/concepts/QueryGroupByExpression__.ts +130 -136
- package/src/concepts/QueryJoinExpression__.ts +441 -438
- package/src/concepts/QueryLimitExpression__.ts +159 -166
- package/src/concepts/QueryOrderByExpression__.ts +173 -180
- package/src/concepts/QuerySelectExpression__.ts +464 -439
- package/src/concepts/Rect__.ts +73 -79
- package/src/concepts/Return__.ts +366 -345
- package/src/concepts/Role__.ts +146 -147
- package/src/concepts/SelectMembers__.ts +358 -350
- package/src/concepts/Slot__.ts +152 -153
- package/src/concepts/SqlQueryComponent__.ts +230 -228
- package/src/concepts/Start__.ts +45 -52
- package/src/concepts/StringInterpolation__.ts +323 -296
- package/src/concepts/StringLiteral__.ts +113 -115
- package/src/concepts/StructureProperty__.ts +306 -295
- package/src/concepts/Structure__.ts +615 -578
- package/src/concepts/SwitchCase__.ts +326 -290
- package/src/concepts/SwitchStatement__.ts +236 -229
- package/src/concepts/Theme__.ts +64 -68
- package/src/concepts/Transactional__.ts +159 -153
- package/src/concepts/TriggerEvent__.ts +285 -274
- package/src/concepts/TriggerLauncher__.ts +232 -196
- package/src/concepts/TypeAnnotation__.ts +1049 -1011
- package/src/concepts/TypeParam__.ts +48 -50
- package/src/concepts/UnaryExpression__.ts +163 -153
- package/src/concepts/Unparsed__.ts +81 -82
- package/src/concepts/UseComponent__.ts +53 -59
- package/src/concepts/ValidationRule__.ts +524 -544
- package/src/concepts/Variable__.ts +419 -397
- package/src/concepts/ViewBlock__.ts +58 -64
- package/src/concepts/ViewComponent__.ts +1323 -1261
- package/src/concepts/ViewElement__.ts +2538 -2350
- package/src/concepts/View__.ts +2447 -2268
- package/src/concepts/WhileStatement__.ts +293 -272
- package/src/concepts/index__.ts +2 -1
- package/src/concepts/types__.ts +123 -121
- package/src/decorators/index.ts +75 -77
- package/src/decorators/promise.ts +28 -0
- package/src/enums/KEYWORDS.ts +1228 -1228
- package/src/enums/LEVEL_NAME_MAP.ts +24 -24
- package/src/generator/compileComponent.ts +10 -10
- package/src/generator/genBundleFiles.ts +300 -291
- package/src/generator/genHash.ts +2 -2
- package/src/generator/genMetaData.ts +280 -261
- package/src/generator/genReleaseBody.ts +312 -291
- package/src/generator/icestark.ts +1 -1
- package/src/generator/microApp.ts +17 -20
- package/src/generator/permission.ts +227 -218
- package/src/generator/qiankun.ts +1 -1
- package/src/generator/styleReplacer.ts +28 -31
- package/src/index.ts +0 -3
- package/src/manager/diagnostic.ts +84 -82
- package/src/manager/stepRecorder.ts +106 -94
- package/src/natural/RequirementAnalyzer.ts +208 -0
- package/src/natural/RequirementExecutor.ts +685 -0
- package/src/natural/componentData.ts +81 -0
- package/src/natural/genNaturalTS.ts +77 -0
- package/src/natural/index.ts +4 -0
- package/src/natural/knowledgeMap.ts +39 -0
- package/src/natural/naslStdlibMap.ts +24 -0
- package/src/natural/transformTSCode.ts +692 -0
- package/src/sentry/index.ts +109 -104
- package/src/server/createUiTs.ts +190 -184
- package/src/server/entity2LogicNamespace.ts +379 -359
- package/src/server/event.js +145 -145
- package/src/server/extendBaseNode.ts +461 -456
- package/src/server/formatTsUtils.ts +712 -713
- package/src/server/getConnector.ts +33 -33
- package/src/server/getExtensionModules.ts +23 -22
- package/src/server/getFunctions.ts +6 -6
- package/src/server/getInterfaces.ts +38 -37
- package/src/server/getLogging.ts +1 -1
- package/src/server/getLogics.ts +390 -344
- package/src/server/getMemberIdentifier.ts +286 -281
- package/src/server/getProcessComponents.ts +2 -2
- package/src/server/getProcesses.ts +548 -534
- package/src/server/getScope.ts +51 -51
- package/src/server/getValidates.ts +3 -3
- package/src/server/index.ts +29 -30
- package/src/server/naslServer.ts +4302 -4225
- package/src/server/naslStdlibMap.ts +43 -41
- package/src/server/process2LogicNamespace.ts +97 -97
- package/src/server/translator.ts +740 -746
- package/src/service/storage/init.ts +761 -728
- package/src/templator/genCallComponentLogic.ts +14 -15
- package/src/templator/genCreateBlock.ts +257 -229
- package/src/templator/genCurdEditMultipleKeyBlock.ts +332 -316
- package/src/templator/genCurdMultipleKeyBlock.ts +501 -473
- package/src/templator/genEditTableBlock.ts +192 -182
- package/src/templator/genEnumSelectBlock.ts +13 -7
- package/src/templator/genGetBlock.ts +57 -55
- package/src/templator/genGridViewBlock.ts +191 -201
- package/src/templator/genListViewBlock.ts +59 -64
- package/src/templator/genQueryComponent.ts +337 -287
- package/src/templator/genSelectBlock.ts +276 -285
- package/src/templator/genTableBlock.ts +157 -160
- package/src/templator/genUpdateBlock.ts +269 -255
- package/src/templator/index.ts +4 -4
- package/src/templator/utils.ts +490 -464
- package/src/translator/index.ts +84 -84
- package/src/translator/lsp.ts +22 -22
- package/src/translator/tsp.ts +6 -6
- package/src/utils/index.ts +115 -117
- package/src/utils/logger.ts +3 -4
- package/src/utils/sortTsString.ts +34 -32
- package/src/utils/string.ts +47 -48
- package/src/utils/time-slicing.ts +109 -0
- package/src/utils/traverse.ts +114 -126
- package/test/concepts/match/__snapshots__/toEmbeddedTS.spec.ts.snap +66 -0
- package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +40 -0
- package/test/concepts/match/constant.ts +5 -0
- package/test/concepts/match/fixtures/isExpression.json +259 -0
- package/test/concepts/match/fixtures/lastBodyIf.json +268 -0
- package/test/concepts/match/fixtures/noExpression.json +176 -0
- package/test/concepts/match/toEmbeddedTS.spec.ts +14 -0
- package/test/concepts/match/toJS.spec.ts +14 -0
- package/test/setup.ts +2 -1
- package/ts-worker/src/index.js +0 -2
- package/tsconfig.json +21 -21
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
1
2
|
import { FrontendLibrary } from './FrontendLibrary__';
|
|
2
3
|
import { TranslatorState, shiftState, withSourceMap, indent, createCompilerState, embeddedTSEmitter } from '../translator';
|
|
3
4
|
import Namespace from './Namespace__';
|
|
@@ -15,15 +16,14 @@ import CallInterface from './CallInterface__';
|
|
|
15
16
|
import CallLogic from './CallLogic__';
|
|
16
17
|
import Logic from './Logic__';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
//= ===============================================================================
|
|
19
20
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
20
21
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
21
|
-
|
|
22
|
+
//= ===============================================================================
|
|
22
23
|
import { EventPayload, Params } from '../common/EventEmitter';
|
|
23
24
|
import { concept, excludedInJSON, property } from '../decorators';
|
|
24
25
|
|
|
25
26
|
import * as utils from '../utils';
|
|
26
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
27
27
|
import BaseNode from '../common/BaseNode';
|
|
28
28
|
import classMap from '../common/classMap';
|
|
29
29
|
import Transactional from './Transactional__';
|
|
@@ -44,2122 +44,2167 @@ import Process from './Process__';
|
|
|
44
44
|
*/
|
|
45
45
|
@concept('逻辑')
|
|
46
46
|
export class OverriddenLogic extends BaseNode {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
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
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
47
|
+
/**
|
|
48
|
+
* 产品概念
|
|
49
|
+
*/
|
|
50
|
+
@property()
|
|
51
|
+
concept: 'OverriddenLogic' = 'OverriddenLogic';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* overriddenModule
|
|
55
|
+
*/
|
|
56
|
+
@property()
|
|
57
|
+
overriddenModule: string = undefined;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 逻辑名称
|
|
61
|
+
*/
|
|
62
|
+
@property()
|
|
63
|
+
name: string = undefined;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 逻辑描述
|
|
67
|
+
*/
|
|
68
|
+
@property()
|
|
69
|
+
description: string = undefined;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* triggerType
|
|
73
|
+
*/
|
|
74
|
+
@property()
|
|
75
|
+
triggerType: string = undefined;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* cron
|
|
79
|
+
*/
|
|
80
|
+
@property()
|
|
81
|
+
cron: string = undefined;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 事务
|
|
85
|
+
*/
|
|
86
|
+
@property('Transactional')
|
|
87
|
+
transactional: Transactional = undefined;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 编译器信息
|
|
91
|
+
*/
|
|
92
|
+
@property()
|
|
93
|
+
compilerInfoMap: { java?: { packageName: string; className: string } } = undefined;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 类型参数列表
|
|
97
|
+
*/
|
|
98
|
+
@property('TypeParam')
|
|
99
|
+
typeParams: Array<TypeParam> = null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 输入参数列表
|
|
103
|
+
*/
|
|
104
|
+
@property('Param')
|
|
105
|
+
params: Array<Param> = [];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 输出参数列表
|
|
109
|
+
*/
|
|
110
|
+
@property('Return')
|
|
111
|
+
returns: Array<Return> = [];
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* 变量列表
|
|
115
|
+
*/
|
|
116
|
+
@property('Variable')
|
|
117
|
+
variables: Array<Variable> = [];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 逻辑项列表
|
|
121
|
+
*/
|
|
122
|
+
@property('LogicItem')
|
|
123
|
+
body: Array<LogicItem> = [];
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 逻辑项列表
|
|
127
|
+
*/
|
|
128
|
+
@property('LogicItem')
|
|
129
|
+
playground: Array<LogicItem> = [];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 祖先 Module
|
|
133
|
+
*/
|
|
134
|
+
get module() {
|
|
135
|
+
return this.getAncestor('Module') as Module;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 祖先 App
|
|
140
|
+
*/
|
|
141
|
+
get app() {
|
|
142
|
+
return this.getAncestor('App') as App;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 祖先 View
|
|
147
|
+
*/
|
|
148
|
+
get view() {
|
|
149
|
+
return this.getAncestor('View') as View;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 祖先 Frontend
|
|
154
|
+
*/
|
|
155
|
+
get frontend() {
|
|
156
|
+
return this.getAncestor('Frontend') as Frontend;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 祖先 ProcessElement
|
|
161
|
+
*/
|
|
162
|
+
get processElement() {
|
|
163
|
+
return this.getAncestor('ProcessElement') as ProcessElement;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 祖先 Process
|
|
168
|
+
*/
|
|
169
|
+
get process() {
|
|
170
|
+
return this.getAncestor('Process') as Process;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @param source 需要合并的部分参数
|
|
175
|
+
*/
|
|
176
|
+
constructor(source?: Partial<OverriddenLogic>) {
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
source = { ...OverriddenLogic.getDefaultOptions(), ...source };
|
|
179
|
+
super(source);
|
|
180
|
+
super.subConstructor(source);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
getClassName() {
|
|
184
|
+
return 'OverriddenLogic';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
static from(source: any, parentNode?: any, parentKey?: string): OverriddenLogic {
|
|
188
|
+
return super.from(source, parentNode, parentKey) as OverriddenLogic;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* 从父级删除该节点
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
_delete() {
|
|
196
|
+
let params: Params = null;
|
|
197
|
+
if (this.parentNode) {
|
|
198
|
+
params = (this.parentNode as any)?.__removeOverriddenLogic?.(this);
|
|
199
|
+
}
|
|
200
|
+
return params;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* 设置overriddenModule
|
|
205
|
+
*/
|
|
206
|
+
setOverriddenModule(overriddenModule: string) {
|
|
207
|
+
const object = {
|
|
208
|
+
overriddenModule,
|
|
209
|
+
};
|
|
210
|
+
this.update({
|
|
211
|
+
...object,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 设置逻辑名称
|
|
217
|
+
*/
|
|
218
|
+
setName(name: string) {
|
|
219
|
+
const object = {
|
|
220
|
+
name,
|
|
221
|
+
};
|
|
222
|
+
this.update({
|
|
223
|
+
...object,
|
|
224
|
+
field: 'name',
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 设置逻辑描述
|
|
230
|
+
*/
|
|
231
|
+
setDescription(description: string) {
|
|
232
|
+
const object = {
|
|
233
|
+
description,
|
|
234
|
+
};
|
|
235
|
+
this.update({
|
|
236
|
+
...object,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* 设置triggerType
|
|
242
|
+
*/
|
|
243
|
+
setTriggerType(triggerType: string) {
|
|
244
|
+
const object = {
|
|
245
|
+
triggerType,
|
|
246
|
+
};
|
|
247
|
+
this.update({
|
|
248
|
+
...object,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* 设置cron
|
|
254
|
+
*/
|
|
255
|
+
setCron(cron: string) {
|
|
256
|
+
const object = {
|
|
257
|
+
cron,
|
|
258
|
+
};
|
|
259
|
+
this.update({
|
|
260
|
+
...object,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* 设置事务
|
|
266
|
+
*/
|
|
267
|
+
setTransactional(transactional: Transactional) {
|
|
268
|
+
transactional._delete();
|
|
269
|
+
const relationOptions = { parentNode: this, parentKey: 'transactional' };
|
|
270
|
+
Object.assign(transactional, relationOptions);
|
|
271
|
+
const object = {
|
|
272
|
+
transactional,
|
|
273
|
+
};
|
|
274
|
+
this.update({
|
|
275
|
+
...object,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
getTypeParamExistingNames(excludedList: Array<TypeParam> = []) {
|
|
280
|
+
const excludedSet = new Set(excludedList);
|
|
281
|
+
return ((this.typeParams as TypeParam[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
getTypeParamUniqueName(name = 'typeParam1') {
|
|
285
|
+
return utils.unique(name, this.getTypeParamExistingNames(), undefined, false);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 插入类型参数
|
|
290
|
+
* @internal
|
|
291
|
+
* @param name 类型参数名称,如果不填会自动生成一个唯一名称
|
|
292
|
+
*/
|
|
293
|
+
_insertTypeParamAt(name: string, index: number): TypeParam;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* 插入类型参数
|
|
297
|
+
* @internal
|
|
298
|
+
* @param typeParamOptions 类型参数参数
|
|
299
|
+
*/
|
|
300
|
+
_insertTypeParamAt(typeParamOptions: Partial<TypeParam>, index: number): TypeParam;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* 插入类型参数
|
|
304
|
+
* @internal
|
|
305
|
+
* @param typeParam 已有的类型参数实例
|
|
306
|
+
*/
|
|
307
|
+
_insertTypeParamAt(typeParam: TypeParam, index: number): TypeParam;
|
|
308
|
+
|
|
309
|
+
_insertTypeParamAt(options: string | Partial<TypeParam> | TypeParam, index: number) {
|
|
310
|
+
const typeParamOptions: any = {};
|
|
311
|
+
const relationOptions = { parentNode: this, parentKey: 'typeParams' };
|
|
312
|
+
let typeParam: TypeParam;
|
|
313
|
+
if (!options) {
|
|
314
|
+
typeParam = TypeParam.from(
|
|
315
|
+
{
|
|
316
|
+
...typeParamOptions,
|
|
317
|
+
name: this.getTypeParamUniqueName(),
|
|
318
|
+
},
|
|
319
|
+
this,
|
|
320
|
+
'typeParams'
|
|
321
|
+
);
|
|
322
|
+
} else if (typeof options === 'string') {
|
|
323
|
+
typeParam = TypeParam.from(
|
|
324
|
+
{
|
|
325
|
+
...typeParamOptions,
|
|
326
|
+
name: options,
|
|
327
|
+
},
|
|
328
|
+
this,
|
|
329
|
+
'typeParams'
|
|
330
|
+
);
|
|
331
|
+
} else if (options instanceof TypeParam) {
|
|
332
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
333
|
+
typeParam = options;
|
|
334
|
+
Object.assign(typeParam, relationOptions);
|
|
335
|
+
} else {
|
|
336
|
+
typeParam = TypeParam.from(
|
|
337
|
+
{
|
|
338
|
+
...typeParamOptions,
|
|
339
|
+
...options,
|
|
340
|
+
},
|
|
341
|
+
this,
|
|
342
|
+
'typeParams'
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
this.typeParams.splice(index, 0, typeParam);
|
|
346
|
+
return typeParam;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 插入类型参数
|
|
351
|
+
* @param name 类型参数名称,如果不填会自动生成一个唯一名称
|
|
352
|
+
*/
|
|
353
|
+
insertTypeParamAt(name: string, index: number): TypeParam;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* 插入类型参数
|
|
357
|
+
* @param typeParamOptions 类型参数参数
|
|
358
|
+
*/
|
|
359
|
+
insertTypeParamAt(typeParamOptions: Partial<TypeParam>, index: number): TypeParam;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* 插入类型参数
|
|
363
|
+
* @param typeParam 已有的类型参数实例
|
|
364
|
+
*/
|
|
365
|
+
insertTypeParamAt(typeParam: TypeParam, index: number): TypeParam;
|
|
366
|
+
|
|
367
|
+
insertTypeParamAt(options: string | Partial<TypeParam> | TypeParam, index: number) {
|
|
368
|
+
const node = this._insertTypeParamAt(options as any, index);
|
|
369
|
+
node.create({
|
|
370
|
+
index,
|
|
371
|
+
parentNode: this,
|
|
372
|
+
parentKey: 'typeParams',
|
|
373
|
+
});
|
|
374
|
+
return node;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* 添加类型参数
|
|
379
|
+
* @internal
|
|
380
|
+
* @param name 类型参数名称,如果不填会自动生成一个唯一名称
|
|
381
|
+
*/
|
|
382
|
+
_addTypeParam(name?: string): TypeParam;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* 添加类型参数
|
|
386
|
+
* @internal
|
|
387
|
+
* @param typeParamOptions 类型参数参数
|
|
388
|
+
*/
|
|
389
|
+
_addTypeParam(typeParamOptions: Partial<TypeParam>): TypeParam;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* 添加类型参数
|
|
393
|
+
* @internal
|
|
394
|
+
* @param typeParam 已有的类型参数实例
|
|
395
|
+
*/
|
|
396
|
+
_addTypeParam(typeParam: TypeParam): TypeParam;
|
|
397
|
+
|
|
398
|
+
_addTypeParam(options?: string | Partial<TypeParam> | TypeParam) {
|
|
399
|
+
const index = this.typeParams.length;
|
|
400
|
+
return this._insertTypeParamAt(options as any, index);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* 添加类型参数
|
|
405
|
+
* @internal
|
|
406
|
+
* @param name 类型参数名称,如果不填会自动生成一个唯一名称
|
|
407
|
+
*/
|
|
408
|
+
addTypeParam(name?: string): TypeParam;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* 添加类型参数
|
|
412
|
+
* @param typeParamOptions 类型参数参数
|
|
413
|
+
*/
|
|
414
|
+
addTypeParam(typeParamOptions: Partial<TypeParam>): TypeParam;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* 添加类型参数
|
|
418
|
+
* @param typeParam 已有的类型参数实例
|
|
419
|
+
*/
|
|
420
|
+
addTypeParam(typeParam: TypeParam): TypeParam;
|
|
421
|
+
|
|
422
|
+
addTypeParam(options?: string | Partial<TypeParam> | TypeParam) {
|
|
423
|
+
const node = this._addTypeParam(options as any);
|
|
424
|
+
const index = this.typeParams.indexOf(node);
|
|
425
|
+
node.create({
|
|
426
|
+
index,
|
|
427
|
+
parentNode: this,
|
|
428
|
+
parentKey: 'typeParams',
|
|
429
|
+
});
|
|
430
|
+
return node;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
getParamUniqueName(name = 'param1') {
|
|
434
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* 插入输入参数
|
|
439
|
+
* @internal
|
|
440
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
441
|
+
*/
|
|
442
|
+
_insertParamAt(name: string, index: number): Param;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* 插入输入参数
|
|
446
|
+
* @internal
|
|
447
|
+
* @param paramOptions 输入参数参数
|
|
448
|
+
*/
|
|
449
|
+
_insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* 插入输入参数
|
|
453
|
+
* @internal
|
|
454
|
+
* @param param 已有的输入参数实例
|
|
455
|
+
*/
|
|
456
|
+
_insertParamAt(param: Param, index: number): Param;
|
|
457
|
+
|
|
458
|
+
_insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
459
|
+
const paramOptions: any = {};
|
|
460
|
+
const relationOptions = { parentNode: this, parentKey: 'params' };
|
|
461
|
+
let param: Param;
|
|
462
|
+
if (!options) {
|
|
463
|
+
param = Param.from(
|
|
464
|
+
{
|
|
465
|
+
...paramOptions,
|
|
466
|
+
name: this.getParamUniqueName(),
|
|
467
|
+
},
|
|
468
|
+
this,
|
|
469
|
+
'params'
|
|
470
|
+
);
|
|
471
|
+
} else if (typeof options === 'string') {
|
|
472
|
+
param = Param.from(
|
|
473
|
+
{
|
|
474
|
+
...paramOptions,
|
|
475
|
+
name: options,
|
|
476
|
+
},
|
|
477
|
+
this,
|
|
478
|
+
'params'
|
|
479
|
+
);
|
|
480
|
+
} else if (options instanceof Param) {
|
|
481
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
482
|
+
param = options;
|
|
483
|
+
Object.assign(param, relationOptions);
|
|
484
|
+
} else {
|
|
485
|
+
param = Param.from(
|
|
486
|
+
{
|
|
487
|
+
...paramOptions,
|
|
488
|
+
...options,
|
|
489
|
+
},
|
|
490
|
+
this,
|
|
491
|
+
'params'
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
this.params.splice(index, 0, param);
|
|
495
|
+
return param;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* 插入输入参数
|
|
500
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
501
|
+
*/
|
|
502
|
+
insertParamAt(name: string, index: number): Param;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* 插入输入参数
|
|
506
|
+
* @param paramOptions 输入参数参数
|
|
507
|
+
*/
|
|
508
|
+
insertParamAt(paramOptions: Partial<Param>, index: number): Param;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* 插入输入参数
|
|
512
|
+
* @param param 已有的输入参数实例
|
|
513
|
+
*/
|
|
514
|
+
insertParamAt(param: Param, index: number): Param;
|
|
515
|
+
|
|
516
|
+
insertParamAt(options: string | Partial<Param> | Param, index: number) {
|
|
517
|
+
const node = this._insertParamAt(options as any, index);
|
|
518
|
+
node.create({
|
|
519
|
+
index,
|
|
520
|
+
parentNode: this,
|
|
521
|
+
parentKey: 'params',
|
|
522
|
+
});
|
|
523
|
+
return node;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* 添加输入参数
|
|
528
|
+
* @internal
|
|
529
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
530
|
+
*/
|
|
531
|
+
_addParam(name?: string): Param;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* 添加输入参数
|
|
535
|
+
* @internal
|
|
536
|
+
* @param paramOptions 输入参数参数
|
|
537
|
+
*/
|
|
538
|
+
_addParam(paramOptions: Partial<Param>): Param;
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* 添加输入参数
|
|
542
|
+
* @internal
|
|
543
|
+
* @param param 已有的输入参数实例
|
|
544
|
+
*/
|
|
545
|
+
_addParam(param: Param): Param;
|
|
546
|
+
|
|
547
|
+
_addParam(options?: string | Partial<Param> | Param) {
|
|
548
|
+
const index = this.params.length;
|
|
549
|
+
return this._insertParamAt(options as any, index);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* 添加输入参数
|
|
554
|
+
* @internal
|
|
555
|
+
* @param name 输入参数名称,如果不填会自动生成一个唯一名称
|
|
556
|
+
*/
|
|
557
|
+
addParam(name?: string): Param;
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* 添加输入参数
|
|
561
|
+
* @param paramOptions 输入参数参数
|
|
562
|
+
*/
|
|
563
|
+
addParam(paramOptions: Partial<Param>): Param;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* 添加输入参数
|
|
567
|
+
* @param param 已有的输入参数实例
|
|
568
|
+
*/
|
|
569
|
+
addParam(param: Param): Param;
|
|
570
|
+
|
|
571
|
+
addParam(options?: string | Partial<Param> | Param) {
|
|
572
|
+
const node = this._addParam(options as any);
|
|
573
|
+
const index = this.params.indexOf(node);
|
|
574
|
+
node.create({
|
|
575
|
+
index,
|
|
576
|
+
parentNode: this,
|
|
577
|
+
parentKey: 'params',
|
|
578
|
+
});
|
|
579
|
+
return node;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
getReturnUniqueName(name = 'result') {
|
|
583
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* 插入输出参数
|
|
588
|
+
* @internal
|
|
589
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
590
|
+
*/
|
|
591
|
+
_insertReturnAt(name: string, index: number): Return;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* 插入输出参数
|
|
595
|
+
* @internal
|
|
596
|
+
* @param retOptions 输出参数参数
|
|
597
|
+
*/
|
|
598
|
+
_insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* 插入输出参数
|
|
602
|
+
* @internal
|
|
603
|
+
* @param ret 已有的输出参数实例
|
|
604
|
+
*/
|
|
605
|
+
_insertReturnAt(ret: Return, index: number): Return;
|
|
606
|
+
|
|
607
|
+
_insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
608
|
+
const retOptions: any = {};
|
|
609
|
+
const relationOptions = { parentNode: this, parentKey: 'returns' };
|
|
610
|
+
let ret: Return;
|
|
611
|
+
if (!options) {
|
|
612
|
+
ret = Return.from(
|
|
613
|
+
{
|
|
614
|
+
...retOptions,
|
|
615
|
+
name: this.getReturnUniqueName(),
|
|
616
|
+
},
|
|
617
|
+
this,
|
|
618
|
+
'returns'
|
|
619
|
+
);
|
|
620
|
+
} else if (typeof options === 'string') {
|
|
621
|
+
ret = Return.from(
|
|
622
|
+
{
|
|
623
|
+
...retOptions,
|
|
624
|
+
name: options,
|
|
625
|
+
},
|
|
626
|
+
this,
|
|
627
|
+
'returns'
|
|
628
|
+
);
|
|
629
|
+
} else if (options instanceof Return) {
|
|
630
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
631
|
+
ret = options;
|
|
632
|
+
Object.assign(ret, relationOptions);
|
|
633
|
+
} else {
|
|
634
|
+
ret = Return.from(
|
|
635
|
+
{
|
|
636
|
+
...retOptions,
|
|
637
|
+
...options,
|
|
638
|
+
},
|
|
639
|
+
this,
|
|
640
|
+
'returns'
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
this.returns.splice(index, 0, ret);
|
|
644
|
+
return ret;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* 插入输出参数
|
|
649
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
650
|
+
*/
|
|
651
|
+
insertReturnAt(name: string, index: number): Return;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* 插入输出参数
|
|
655
|
+
* @param retOptions 输出参数参数
|
|
656
|
+
*/
|
|
657
|
+
insertReturnAt(retOptions: Partial<Return>, index: number): Return;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* 插入输出参数
|
|
661
|
+
* @param ret 已有的输出参数实例
|
|
662
|
+
*/
|
|
663
|
+
insertReturnAt(ret: Return, index: number): Return;
|
|
664
|
+
|
|
665
|
+
insertReturnAt(options: string | Partial<Return> | Return, index: number) {
|
|
666
|
+
const node = this._insertReturnAt(options as any, index);
|
|
667
|
+
node.create({
|
|
668
|
+
index,
|
|
669
|
+
parentNode: this,
|
|
670
|
+
parentKey: 'returns',
|
|
671
|
+
});
|
|
672
|
+
return node;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* 添加输出参数
|
|
677
|
+
* @internal
|
|
678
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
679
|
+
*/
|
|
680
|
+
_addReturn(name?: string): Return;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* 添加输出参数
|
|
684
|
+
* @internal
|
|
685
|
+
* @param retOptions 输出参数参数
|
|
686
|
+
*/
|
|
687
|
+
_addReturn(retOptions: Partial<Return>): Return;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* 添加输出参数
|
|
691
|
+
* @internal
|
|
692
|
+
* @param ret 已有的输出参数实例
|
|
693
|
+
*/
|
|
694
|
+
_addReturn(ret: Return): Return;
|
|
695
|
+
|
|
696
|
+
_addReturn(options?: string | Partial<Return> | Return) {
|
|
697
|
+
const index = this.returns.length;
|
|
698
|
+
return this._insertReturnAt(options as any, index);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* 添加输出参数
|
|
703
|
+
* @internal
|
|
704
|
+
* @param name 输出参数名称,如果不填会自动生成一个唯一名称
|
|
705
|
+
*/
|
|
706
|
+
addReturn(name?: string): Return;
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* 添加输出参数
|
|
710
|
+
* @param retOptions 输出参数参数
|
|
711
|
+
*/
|
|
712
|
+
addReturn(retOptions: Partial<Return>): Return;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* 添加输出参数
|
|
716
|
+
* @param ret 已有的输出参数实例
|
|
717
|
+
*/
|
|
718
|
+
addReturn(ret: Return): Return;
|
|
719
|
+
|
|
720
|
+
addReturn(options?: string | Partial<Return> | Return) {
|
|
721
|
+
const node = this._addReturn(options as any);
|
|
722
|
+
const index = this.returns.indexOf(node);
|
|
723
|
+
node.create({
|
|
724
|
+
index,
|
|
725
|
+
parentNode: this,
|
|
726
|
+
parentKey: 'returns',
|
|
727
|
+
});
|
|
728
|
+
return node;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
getVariableUniqueName(name = 'variable1') {
|
|
732
|
+
return utils.unique(name, this.getVarExistingNames(), undefined, false);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* 插入变量
|
|
737
|
+
* @internal
|
|
738
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
739
|
+
*/
|
|
740
|
+
_insertVariableAt(name: string, index: number): Variable;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* 插入变量
|
|
744
|
+
* @internal
|
|
745
|
+
* @param variableOptions 变量参数
|
|
746
|
+
*/
|
|
747
|
+
_insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* 插入变量
|
|
751
|
+
* @internal
|
|
752
|
+
* @param variable 已有的变量实例
|
|
753
|
+
*/
|
|
754
|
+
_insertVariableAt(variable: Variable, index: number): Variable;
|
|
755
|
+
|
|
756
|
+
_insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
757
|
+
const variableOptions: any = {};
|
|
758
|
+
const relationOptions = { parentNode: this, parentKey: 'variables' };
|
|
759
|
+
let variable: Variable;
|
|
760
|
+
if (!options) {
|
|
761
|
+
variable = Variable.from(
|
|
762
|
+
{
|
|
763
|
+
...variableOptions,
|
|
764
|
+
name: this.getVariableUniqueName(),
|
|
765
|
+
},
|
|
766
|
+
this,
|
|
767
|
+
'variables'
|
|
768
|
+
);
|
|
769
|
+
} else if (typeof options === 'string') {
|
|
770
|
+
variable = Variable.from(
|
|
771
|
+
{
|
|
772
|
+
...variableOptions,
|
|
773
|
+
name: options,
|
|
774
|
+
},
|
|
775
|
+
this,
|
|
776
|
+
'variables'
|
|
777
|
+
);
|
|
778
|
+
} else if (options instanceof Variable) {
|
|
779
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
780
|
+
variable = options;
|
|
781
|
+
Object.assign(variable, relationOptions);
|
|
782
|
+
} else {
|
|
783
|
+
variable = Variable.from(
|
|
784
|
+
{
|
|
785
|
+
...variableOptions,
|
|
786
|
+
...options,
|
|
787
|
+
},
|
|
788
|
+
this,
|
|
789
|
+
'variables'
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
this.variables.splice(index, 0, variable);
|
|
793
|
+
return variable;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* 插入变量
|
|
798
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
799
|
+
*/
|
|
800
|
+
insertVariableAt(name: string, index: number): Variable;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* 插入变量
|
|
804
|
+
* @param variableOptions 变量参数
|
|
805
|
+
*/
|
|
806
|
+
insertVariableAt(variableOptions: Partial<Variable>, index: number): Variable;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* 插入变量
|
|
810
|
+
* @param variable 已有的变量实例
|
|
811
|
+
*/
|
|
812
|
+
insertVariableAt(variable: Variable, index: number): Variable;
|
|
813
|
+
|
|
814
|
+
insertVariableAt(options: string | Partial<Variable> | Variable, index: number) {
|
|
815
|
+
const node = this._insertVariableAt(options as any, index);
|
|
816
|
+
node.create({
|
|
817
|
+
index,
|
|
818
|
+
parentNode: this,
|
|
819
|
+
parentKey: 'variables',
|
|
820
|
+
});
|
|
821
|
+
return node;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* 添加变量
|
|
826
|
+
* @internal
|
|
827
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
828
|
+
*/
|
|
829
|
+
_addVariable(name?: string): Variable;
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* 添加变量
|
|
833
|
+
* @internal
|
|
834
|
+
* @param variableOptions 变量参数
|
|
835
|
+
*/
|
|
836
|
+
_addVariable(variableOptions: Partial<Variable>): Variable;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* 添加变量
|
|
840
|
+
* @internal
|
|
841
|
+
* @param variable 已有的变量实例
|
|
842
|
+
*/
|
|
843
|
+
_addVariable(variable: Variable): Variable;
|
|
844
|
+
|
|
845
|
+
_addVariable(options?: string | Partial<Variable> | Variable) {
|
|
846
|
+
const index = this.variables.length;
|
|
847
|
+
return this._insertVariableAt(options as any, index);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* 添加变量
|
|
852
|
+
* @internal
|
|
853
|
+
* @param name 变量名称,如果不填会自动生成一个唯一名称
|
|
854
|
+
*/
|
|
855
|
+
addVariable(name?: string): Variable;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* 添加变量
|
|
859
|
+
* @param variableOptions 变量参数
|
|
860
|
+
*/
|
|
861
|
+
addVariable(variableOptions: Partial<Variable>): Variable;
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* 添加变量
|
|
865
|
+
* @param variable 已有的变量实例
|
|
866
|
+
*/
|
|
867
|
+
addVariable(variable: Variable): Variable;
|
|
868
|
+
|
|
869
|
+
addVariable(options?: string | Partial<Variable> | Variable) {
|
|
870
|
+
const node = this._addVariable(options as any);
|
|
871
|
+
const index = this.variables.indexOf(node);
|
|
872
|
+
node.create({
|
|
873
|
+
index,
|
|
874
|
+
parentNode: this,
|
|
875
|
+
parentKey: 'variables',
|
|
876
|
+
});
|
|
877
|
+
return node;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* 插入逻辑项
|
|
882
|
+
* @internal
|
|
883
|
+
* @param logicItemOptions 逻辑项参数
|
|
884
|
+
*/
|
|
885
|
+
_insertItemInBodyAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* 插入逻辑项
|
|
889
|
+
* @internal
|
|
890
|
+
* @param logicItem 已有的逻辑项实例
|
|
891
|
+
*/
|
|
892
|
+
_insertItemInBodyAt(logicItem: LogicItem, index: number): LogicItem;
|
|
893
|
+
|
|
894
|
+
_insertItemInBodyAt(options: Partial<LogicItem> | LogicItem, index: number) {
|
|
895
|
+
const logicItemOptions: any = {};
|
|
896
|
+
const relationOptions = { parentNode: this, parentKey: 'body' };
|
|
897
|
+
let logicItem: LogicItem;
|
|
898
|
+
if (options instanceof LogicItem) {
|
|
899
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
900
|
+
logicItem = options;
|
|
901
|
+
Object.assign(logicItem, relationOptions);
|
|
902
|
+
} else {
|
|
903
|
+
logicItem = LogicItem.from(
|
|
904
|
+
{
|
|
905
|
+
...logicItemOptions,
|
|
906
|
+
...options,
|
|
907
|
+
},
|
|
908
|
+
this,
|
|
909
|
+
'body'
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
this.body.splice(index, 0, logicItem);
|
|
913
|
+
return logicItem;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* 插入逻辑项
|
|
918
|
+
* @param logicItemOptions 逻辑项参数
|
|
919
|
+
*/
|
|
920
|
+
insertItemInBodyAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* 插入逻辑项
|
|
924
|
+
* @param logicItem 已有的逻辑项实例
|
|
925
|
+
*/
|
|
926
|
+
insertItemInBodyAt(logicItem: LogicItem, index: number): LogicItem;
|
|
927
|
+
|
|
928
|
+
insertItemInBodyAt(options: Partial<LogicItem> | LogicItem, index: number) {
|
|
929
|
+
const node = this._insertItemInBodyAt(options as any, index);
|
|
930
|
+
node.create({
|
|
931
|
+
index,
|
|
932
|
+
parentNode: this,
|
|
933
|
+
parentKey: 'body',
|
|
934
|
+
});
|
|
935
|
+
return node;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* 添加逻辑项
|
|
940
|
+
* @internal
|
|
941
|
+
* @param logicItemOptions 逻辑项参数
|
|
942
|
+
*/
|
|
943
|
+
_addItemInBody(logicItemOptions: Partial<LogicItem>): LogicItem;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* 添加逻辑项
|
|
947
|
+
* @internal
|
|
948
|
+
* @param logicItem 已有的逻辑项实例
|
|
949
|
+
*/
|
|
950
|
+
_addItemInBody(logicItem: LogicItem): LogicItem;
|
|
951
|
+
|
|
952
|
+
_addItemInBody(options?: Partial<LogicItem> | LogicItem) {
|
|
953
|
+
const index = this.body.length;
|
|
954
|
+
return this._insertItemInBodyAt(options as any, index);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* 添加逻辑项
|
|
959
|
+
* @param logicItemOptions 逻辑项参数
|
|
960
|
+
*/
|
|
961
|
+
addItemInBody(logicItemOptions: Partial<LogicItem>): LogicItem;
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* 添加逻辑项
|
|
965
|
+
* @param logicItem 已有的逻辑项实例
|
|
966
|
+
*/
|
|
967
|
+
addItemInBody(logicItem: LogicItem): LogicItem;
|
|
968
|
+
|
|
969
|
+
addItemInBody(options?: Partial<LogicItem> | LogicItem) {
|
|
970
|
+
const node = this._addItemInBody(options as any);
|
|
971
|
+
const index = this.body.indexOf(node);
|
|
972
|
+
node.create({
|
|
973
|
+
index,
|
|
974
|
+
parentNode: this,
|
|
975
|
+
parentKey: 'body',
|
|
976
|
+
});
|
|
977
|
+
return node;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* 插入逻辑项
|
|
982
|
+
* @internal
|
|
983
|
+
* @param logicItemOptions 逻辑项参数
|
|
984
|
+
*/
|
|
985
|
+
_insertItemInPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* 插入逻辑项
|
|
989
|
+
* @internal
|
|
990
|
+
* @param logicItem 已有的逻辑项实例
|
|
991
|
+
*/
|
|
992
|
+
_insertItemInPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
|
|
993
|
+
|
|
994
|
+
_insertItemInPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
|
|
995
|
+
const logicItemOptions: any = {};
|
|
996
|
+
const relationOptions = { parentNode: this, parentKey: 'playground' };
|
|
997
|
+
let logicItem: LogicItem;
|
|
998
|
+
if (options instanceof LogicItem) {
|
|
999
|
+
options.ensureDelete(); // 同一实例不支持多处存在
|
|
1000
|
+
logicItem = options;
|
|
1001
|
+
Object.assign(logicItem, relationOptions);
|
|
1002
|
+
} else {
|
|
1003
|
+
logicItem = LogicItem.from(
|
|
1004
|
+
{
|
|
1005
|
+
...logicItemOptions,
|
|
1006
|
+
...options,
|
|
1007
|
+
},
|
|
1008
|
+
this,
|
|
1009
|
+
'playground'
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
this.playground.splice(index, 0, logicItem);
|
|
1013
|
+
return logicItem;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* 插入逻辑项
|
|
1018
|
+
* @param logicItemOptions 逻辑项参数
|
|
1019
|
+
*/
|
|
1020
|
+
insertItemInPlaygroundAt(logicItemOptions: Partial<LogicItem>, index: number): LogicItem;
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* 插入逻辑项
|
|
1024
|
+
* @param logicItem 已有的逻辑项实例
|
|
1025
|
+
*/
|
|
1026
|
+
insertItemInPlaygroundAt(logicItem: LogicItem, index: number): LogicItem;
|
|
1027
|
+
|
|
1028
|
+
insertItemInPlaygroundAt(options: Partial<LogicItem> | LogicItem, index: number) {
|
|
1029
|
+
const node = this._insertItemInPlaygroundAt(options as any, index);
|
|
1030
|
+
node.create({
|
|
1031
|
+
index,
|
|
1032
|
+
parentNode: this,
|
|
1033
|
+
parentKey: 'playground',
|
|
1034
|
+
});
|
|
1035
|
+
return node;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* 添加逻辑项
|
|
1040
|
+
* @internal
|
|
1041
|
+
* @param logicItemOptions 逻辑项参数
|
|
1042
|
+
*/
|
|
1043
|
+
_addItemInPlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* 添加逻辑项
|
|
1047
|
+
* @internal
|
|
1048
|
+
* @param logicItem 已有的逻辑项实例
|
|
1049
|
+
*/
|
|
1050
|
+
_addItemInPlayground(logicItem: LogicItem): LogicItem;
|
|
1051
|
+
|
|
1052
|
+
_addItemInPlayground(options?: Partial<LogicItem> | LogicItem) {
|
|
1053
|
+
const index = this.playground.length;
|
|
1054
|
+
return this._insertItemInPlaygroundAt(options as any, index);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* 添加逻辑项
|
|
1059
|
+
* @param logicItemOptions 逻辑项参数
|
|
1060
|
+
*/
|
|
1061
|
+
addItemInPlayground(logicItemOptions: Partial<LogicItem>): LogicItem;
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* 添加逻辑项
|
|
1065
|
+
* @param logicItem 已有的逻辑项实例
|
|
1066
|
+
*/
|
|
1067
|
+
addItemInPlayground(logicItem: LogicItem): LogicItem;
|
|
1068
|
+
|
|
1069
|
+
addItemInPlayground(options?: Partial<LogicItem> | LogicItem) {
|
|
1070
|
+
const node = this._addItemInPlayground(options as any);
|
|
1071
|
+
const index = this.playground.indexOf(node);
|
|
1072
|
+
node.create({
|
|
1073
|
+
index,
|
|
1074
|
+
parentNode: this,
|
|
1075
|
+
parentKey: 'playground',
|
|
1076
|
+
});
|
|
1077
|
+
return node;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* 删除事务
|
|
1082
|
+
* @param name 事务名称
|
|
1083
|
+
*/
|
|
1084
|
+
removeTransactional(name: string): void;
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* 删除事务
|
|
1088
|
+
* @param transactional 已有的事务实例
|
|
1089
|
+
*/
|
|
1090
|
+
removeTransactional(transactional: Transactional): void;
|
|
1091
|
+
|
|
1092
|
+
removeTransactional(options: string | Transactional) {
|
|
1093
|
+
let transactional: Transactional;
|
|
1094
|
+
if (typeof options === 'string') {
|
|
1095
|
+
transactional = this.transactional;
|
|
1096
|
+
if (!transactional) {
|
|
1097
|
+
throw new Error(`找不到事务 ${options}`);
|
|
1098
|
+
}
|
|
1099
|
+
} else {
|
|
1100
|
+
transactional = options;
|
|
1101
|
+
}
|
|
1102
|
+
return transactional.delete();
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
__removeTransactional(transactional: Transactional) {
|
|
1106
|
+
const { parentKey } = transactional;
|
|
1107
|
+
const params: Params = {
|
|
1108
|
+
parentNode: this,
|
|
1109
|
+
parentKey,
|
|
1110
|
+
index: -1,
|
|
1111
|
+
object: null,
|
|
1112
|
+
oldObject: transactional,
|
|
1113
|
+
};
|
|
1114
|
+
if (parentKey) {
|
|
1115
|
+
params.parentKey = parentKey;
|
|
1116
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1117
|
+
const index = (this as any)[parentKey].indexOf(transactional);
|
|
1118
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1119
|
+
params.index = index;
|
|
1120
|
+
} else if ((this as any)[parentKey] === transactional) {
|
|
1121
|
+
params.index = 0;
|
|
1122
|
+
(this as any)[parentKey] = undefined;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return params;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* 删除类型参数
|
|
1130
|
+
* @param name 类型参数名称
|
|
1131
|
+
*/
|
|
1132
|
+
removeTypeParam(name: string): void;
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* 删除类型参数
|
|
1136
|
+
* @param typeParam 已有的类型参数实例
|
|
1137
|
+
*/
|
|
1138
|
+
removeTypeParam(typeParam: TypeParam): void;
|
|
1139
|
+
|
|
1140
|
+
removeTypeParam(options: string | TypeParam) {
|
|
1141
|
+
let typeParam: TypeParam;
|
|
1142
|
+
if (typeof options === 'string') {
|
|
1143
|
+
typeParam = (this.typeParams as TypeParam[]).find((item) => item.name === options);
|
|
1144
|
+
if (!typeParam) {
|
|
1145
|
+
throw new Error(`找不到类型参数 ${options}`);
|
|
1146
|
+
}
|
|
1147
|
+
} else {
|
|
1148
|
+
typeParam = options;
|
|
1149
|
+
}
|
|
1150
|
+
return typeParam.delete();
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
__removeTypeParam(typeParam: TypeParam) {
|
|
1154
|
+
const { parentKey } = typeParam;
|
|
1155
|
+
const params: Params = {
|
|
1156
|
+
parentNode: this,
|
|
1157
|
+
parentKey,
|
|
1158
|
+
index: -1,
|
|
1159
|
+
object: null,
|
|
1160
|
+
oldObject: typeParam,
|
|
1161
|
+
};
|
|
1162
|
+
if (parentKey) {
|
|
1163
|
+
params.parentKey = parentKey;
|
|
1164
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1165
|
+
const index = (this as any)[parentKey].indexOf(typeParam);
|
|
1166
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1167
|
+
params.index = index;
|
|
1168
|
+
} else if ((this as any)[parentKey] === typeParam) {
|
|
1169
|
+
params.index = 0;
|
|
1170
|
+
(this as any)[parentKey] = undefined;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return params;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* 删除输入参数
|
|
1178
|
+
* @param name 输入参数名称
|
|
1179
|
+
*/
|
|
1180
|
+
removeParam(name: string): void;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* 删除输入参数
|
|
1184
|
+
* @param param 已有的输入参数实例
|
|
1185
|
+
*/
|
|
1186
|
+
removeParam(param: Param): void;
|
|
1187
|
+
|
|
1188
|
+
removeParam(options: string | Param) {
|
|
1189
|
+
let param: Param;
|
|
1190
|
+
if (typeof options === 'string') {
|
|
1191
|
+
param = (this.params as Param[]).find((item) => item.name === options);
|
|
1192
|
+
if (!param) {
|
|
1193
|
+
throw new Error(`找不到输入参数 ${options}`);
|
|
1194
|
+
}
|
|
1195
|
+
} else {
|
|
1196
|
+
param = options;
|
|
1197
|
+
}
|
|
1198
|
+
return param.delete();
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
__removeParam(param: Param) {
|
|
1202
|
+
const { parentKey } = param;
|
|
1203
|
+
const params: Params = {
|
|
1204
|
+
parentNode: this,
|
|
1205
|
+
parentKey,
|
|
1206
|
+
index: -1,
|
|
1207
|
+
object: null,
|
|
1208
|
+
oldObject: param,
|
|
1209
|
+
};
|
|
1210
|
+
if (parentKey) {
|
|
1211
|
+
params.parentKey = parentKey;
|
|
1212
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1213
|
+
const index = (this as any)[parentKey].indexOf(param);
|
|
1214
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1215
|
+
params.index = index;
|
|
1216
|
+
} else if ((this as any)[parentKey] === param) {
|
|
1217
|
+
params.index = 0;
|
|
1218
|
+
(this as any)[parentKey] = undefined;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
return params;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* 删除输出参数
|
|
1226
|
+
* @param name 输出参数名称
|
|
1227
|
+
*/
|
|
1228
|
+
removeReturn(name: string): void;
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* 删除输出参数
|
|
1232
|
+
* @param ret 已有的输出参数实例
|
|
1233
|
+
*/
|
|
1234
|
+
removeReturn(ret: Return): void;
|
|
1235
|
+
|
|
1236
|
+
removeReturn(options: string | Return) {
|
|
1237
|
+
let ret: Return;
|
|
1238
|
+
if (typeof options === 'string') {
|
|
1239
|
+
ret = (this.returns as Return[]).find((item) => item.name === options);
|
|
1240
|
+
if (!ret) {
|
|
1241
|
+
throw new Error(`找不到输出参数 ${options}`);
|
|
1242
|
+
}
|
|
1243
|
+
} else {
|
|
1244
|
+
ret = options;
|
|
1245
|
+
}
|
|
1246
|
+
return ret.delete();
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
__removeReturn(ret: Return) {
|
|
1250
|
+
const { parentKey } = ret;
|
|
1251
|
+
const params: Params = {
|
|
1252
|
+
parentNode: this,
|
|
1253
|
+
parentKey,
|
|
1254
|
+
index: -1,
|
|
1255
|
+
object: null,
|
|
1256
|
+
oldObject: ret,
|
|
1257
|
+
};
|
|
1258
|
+
if (parentKey) {
|
|
1259
|
+
params.parentKey = parentKey;
|
|
1260
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1261
|
+
const index = (this as any)[parentKey].indexOf(ret);
|
|
1262
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1263
|
+
params.index = index;
|
|
1264
|
+
} else if ((this as any)[parentKey] === ret) {
|
|
1265
|
+
params.index = 0;
|
|
1266
|
+
(this as any)[parentKey] = undefined;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
return params;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
/**
|
|
1273
|
+
* 删除变量
|
|
1274
|
+
* @param name 变量名称
|
|
1275
|
+
*/
|
|
1276
|
+
removeVariable(name: string): void;
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* 删除变量
|
|
1280
|
+
* @param variable 已有的变量实例
|
|
1281
|
+
*/
|
|
1282
|
+
removeVariable(variable: Variable): void;
|
|
1283
|
+
|
|
1284
|
+
removeVariable(options: string | Variable) {
|
|
1285
|
+
let variable: Variable;
|
|
1286
|
+
if (typeof options === 'string') {
|
|
1287
|
+
variable = (this.variables as Variable[]).find((item) => item.name === options);
|
|
1288
|
+
if (!variable) {
|
|
1289
|
+
throw new Error(`找不到变量 ${options}`);
|
|
1290
|
+
}
|
|
1291
|
+
} else {
|
|
1292
|
+
variable = options;
|
|
1293
|
+
}
|
|
1294
|
+
return variable.delete();
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
__removeVariable(variable: Variable) {
|
|
1298
|
+
const { parentKey } = variable;
|
|
1299
|
+
const params: Params = {
|
|
1300
|
+
parentNode: this,
|
|
1301
|
+
parentKey,
|
|
1302
|
+
index: -1,
|
|
1303
|
+
object: null,
|
|
1304
|
+
oldObject: variable,
|
|
1305
|
+
};
|
|
1306
|
+
if (parentKey) {
|
|
1307
|
+
params.parentKey = parentKey;
|
|
1308
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1309
|
+
const index = (this as any)[parentKey].indexOf(variable);
|
|
1310
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1311
|
+
params.index = index;
|
|
1312
|
+
} else if ((this as any)[parentKey] === variable) {
|
|
1313
|
+
params.index = 0;
|
|
1314
|
+
(this as any)[parentKey] = undefined;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
return params;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* 删除逻辑项
|
|
1322
|
+
* @param logicItem 已有的逻辑项实例
|
|
1323
|
+
*/
|
|
1324
|
+
removeItemInBody(logicItem: LogicItem): void;
|
|
1325
|
+
|
|
1326
|
+
removeItemInBody(options: LogicItem) {
|
|
1327
|
+
const logicItem: LogicItem = options;
|
|
1328
|
+
return logicItem.delete();
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* 删除逻辑项
|
|
1333
|
+
* @param logicItem 已有的逻辑项实例
|
|
1334
|
+
*/
|
|
1335
|
+
removeItemInPlayground(logicItem: LogicItem): void;
|
|
1336
|
+
|
|
1337
|
+
removeItemInPlayground(options: LogicItem) {
|
|
1338
|
+
const logicItem: LogicItem = options;
|
|
1339
|
+
return logicItem.delete();
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
__removeLogicItem(logicItem: LogicItem) {
|
|
1343
|
+
const { parentKey } = logicItem;
|
|
1344
|
+
const params: Params = {
|
|
1345
|
+
parentNode: this,
|
|
1346
|
+
parentKey,
|
|
1347
|
+
index: -1,
|
|
1348
|
+
object: null,
|
|
1349
|
+
oldObject: logicItem,
|
|
1350
|
+
};
|
|
1351
|
+
if (parentKey) {
|
|
1352
|
+
params.parentKey = parentKey;
|
|
1353
|
+
if (Array.isArray((this as any)[parentKey])) {
|
|
1354
|
+
const index = (this as any)[parentKey].indexOf(logicItem);
|
|
1355
|
+
~index && (this as any)[parentKey].splice(index, 1);
|
|
1356
|
+
params.index = index;
|
|
1357
|
+
} else if ((this as any)[parentKey] === logicItem) {
|
|
1358
|
+
params.index = 0;
|
|
1359
|
+
(this as any)[parentKey] = undefined;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
return params;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
//= ===============================================================================
|
|
1366
|
+
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
1367
|
+
// 自动生成的代码已结束。下面可以手动编写。
|
|
1368
|
+
//= ===============================================================================
|
|
1369
|
+
// 用于calllogic树中定位是那个logic,回显
|
|
1370
|
+
get calleewholeKey() {
|
|
1371
|
+
return `${this.getNamespace()}.${this.name}`;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// 设置定时任务
|
|
1375
|
+
setCronAndTriggerType(cron: string, triggerType: string) {
|
|
1376
|
+
const object = {
|
|
1377
|
+
cron,
|
|
1378
|
+
triggerType,
|
|
1379
|
+
};
|
|
1380
|
+
this.update({
|
|
1381
|
+
...object,
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* 创建的时候 打开事务 通过开关设置数据库事务
|
|
1387
|
+
*/
|
|
1388
|
+
openTransactional(flag: boolean) {
|
|
1389
|
+
if (flag) {
|
|
1390
|
+
const transactional = new Transactional({
|
|
1391
|
+
enabled: flag,
|
|
1392
|
+
});
|
|
1393
|
+
transactional._delete();
|
|
1394
|
+
const relationOptions = { parentNode: this, parentKey: 'transactional' };
|
|
1395
|
+
Object.assign(transactional, relationOptions);
|
|
1396
|
+
this.transactional = transactional;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
findLogicItemByConcept(concept: string) {
|
|
1401
|
+
let result: any;
|
|
1402
|
+
|
|
1403
|
+
utils.traverse(
|
|
1404
|
+
(current) => {
|
|
1405
|
+
if ((current.node as any).concept === concept) return (result = current.node);
|
|
1406
|
+
},
|
|
1407
|
+
{ node: this },
|
|
1408
|
+
{
|
|
1409
|
+
mode: 'anyObject',
|
|
1410
|
+
excludedKeySet: this.JSON_EXCLUDED_KEYS,
|
|
1411
|
+
}
|
|
1412
|
+
);
|
|
1413
|
+
|
|
1414
|
+
return result as LogicItem;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
onChange($event?: EventPayload): void {
|
|
1418
|
+
this.emit('change', $event);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
getVarExistingNames(excludedList: Array<Param | Return | Variable> = []) {
|
|
1422
|
+
const excludedSet = new Set(excludedList);
|
|
1423
|
+
const varList: any[] = [];
|
|
1424
|
+
if (Array.isArray(this.params)) {
|
|
1425
|
+
varList.push(...this.params);
|
|
1426
|
+
}
|
|
1427
|
+
if (Array.isArray(this.returns)) {
|
|
1428
|
+
varList.push(...this.returns);
|
|
1429
|
+
}
|
|
1430
|
+
if (Array.isArray(this.variables)) {
|
|
1431
|
+
varList.push(...this.variables);
|
|
1432
|
+
}
|
|
1433
|
+
if (this.view) {
|
|
1434
|
+
if (Array.isArray(this.view.params)) {
|
|
1435
|
+
varList.push(...this.view.params);
|
|
1436
|
+
}
|
|
1437
|
+
if (Array.isArray(this.view.variables)) {
|
|
1438
|
+
varList.push(...this.view.variables);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
this.traverseChildren((el) => {
|
|
1443
|
+
if (el?.concept === 'ForEachStatement') {
|
|
1444
|
+
if ((el as ForEachStatement)?.item) {
|
|
1445
|
+
varList.push((el as ForEachStatement)?.item);
|
|
1393
1446
|
}
|
|
1394
|
-
if (
|
|
1395
|
-
|
|
1447
|
+
if ((el as ForEachStatement)?.index) {
|
|
1448
|
+
varList.push((el as ForEachStatement)?.index);
|
|
1396
1449
|
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
return varList.filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
toJSContent(code: string, state?: TranslatorState): string {
|
|
1456
|
+
// params
|
|
1457
|
+
if (Array.isArray(this.params)) {
|
|
1458
|
+
this.params.forEach((param) => {
|
|
1459
|
+
code += `${indent((state?.tabSize || 0) + 1)}`;
|
|
1460
|
+
code += param.toJS(shiftState(state, code, { inline: true }));
|
|
1461
|
+
code += ';\n';
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
// variables
|
|
1465
|
+
if (Array.isArray(this.variables)) {
|
|
1466
|
+
this.variables.forEach((variable) => {
|
|
1467
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1468
|
+
code += variable.toJS(shiftState(state, code, { inline: true }));
|
|
1469
|
+
code += ';\n';
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
// returns
|
|
1474
|
+
if (Array.isArray(this.returns)) {
|
|
1475
|
+
this.returns.forEach((ret) => {
|
|
1476
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1477
|
+
code += ret.toJS(shiftState(state, code, { inline: true }));
|
|
1478
|
+
code += ';\n';
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
if (Array.isArray(this.body)) {
|
|
1482
|
+
this.body.forEach((item) => {
|
|
1483
|
+
code += item.toJS && item.toJS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1484
|
+
code += '\n';
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
return code;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
toJS(state?: TranslatorState, type?: string): string {
|
|
1492
|
+
let code = '';
|
|
1493
|
+
if (type === 'IIFE') {
|
|
1494
|
+
code += `await (async () => {\n`;
|
|
1495
|
+
code = this.toJSContent(code, state);
|
|
1496
|
+
code += `${indent(state?.tabSize || 0)}})();\n`;
|
|
1497
|
+
return code;
|
|
1498
|
+
}
|
|
1499
|
+
code += `async ${this.name} (`;
|
|
1500
|
+
|
|
1501
|
+
if (this.params?.length) {
|
|
1502
|
+
this.params.forEach((param, index) => {
|
|
1503
|
+
code += param.name;
|
|
1504
|
+
if (index !== this.params.length - 1) code += ', ';
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
code += ') {\n';
|
|
1508
|
+
|
|
1509
|
+
code = this.toJSContent(code, state);
|
|
1510
|
+
code += `${indent(state?.tabSize || 0)}}\n`;
|
|
1511
|
+
return code;
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
toProcessService() {
|
|
1515
|
+
return {
|
|
1516
|
+
config: {
|
|
1517
|
+
serviceType: 'micro',
|
|
1518
|
+
},
|
|
1519
|
+
url: {
|
|
1520
|
+
method: 'POST',
|
|
1521
|
+
path: this.getPath(),
|
|
1522
|
+
},
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
toService() {
|
|
1527
|
+
const { parentNode } = this;
|
|
1528
|
+
const { concept, name: entityName } = parentNode || {};
|
|
1529
|
+
const logicName = this.name;
|
|
1530
|
+
let serviceType = 'micro';
|
|
1531
|
+
let method = 'POST';
|
|
1532
|
+
// let path = `/api/${logicName}`;
|
|
1533
|
+
const map: Record<string, string> = {
|
|
1534
|
+
GetUser: 'LCAPAuth',
|
|
1535
|
+
Logout: 'LCAPAuth',
|
|
1536
|
+
CheckPermission: 'LCAPPermission',
|
|
1537
|
+
GetUserResources: 'LCAPPermission',
|
|
1538
|
+
UploadPermission: 'LCAPPermission',
|
|
1539
|
+
GetUserList: 'LCAPUserManage',
|
|
1540
|
+
GetRoleList: 'LCAPUserManage',
|
|
1541
|
+
};
|
|
1542
|
+
let path = `/api/${map[logicName]}/overridden/${logicName}`;
|
|
1543
|
+
if (concept === 'Module') {
|
|
1544
|
+
path = `/api/${entityName.replace('-', '_')}/${logicName}`;
|
|
1545
|
+
} else if (concept === 'Namespace') {
|
|
1546
|
+
serviceType = 'entity';
|
|
1547
|
+
let entityPath = entityName.replace(/[A-Z]/g, (char, index) => {
|
|
1548
|
+
const lowerChar = char.toLowerCase();
|
|
1549
|
+
return index === 0 ? lowerChar : `-${lowerChar}`;
|
|
1550
|
+
});
|
|
1551
|
+
const dataSource = parentNode.getAncestor('DataSource');
|
|
1552
|
+
// 默认数据源不动,其他数据源需要拼接数据源信息
|
|
1553
|
+
if (dataSource && dataSource.name !== 'defaultDS') {
|
|
1554
|
+
entityPath = `${dataSource.name}/${entityPath}`;
|
|
1555
|
+
}
|
|
1556
|
+
path = `/api/${entityPath}`;
|
|
1557
|
+
switch (this.name) {
|
|
1558
|
+
case 'get':
|
|
1559
|
+
method = 'GET';
|
|
1560
|
+
path = `/api/${entityPath}`;
|
|
1561
|
+
break;
|
|
1562
|
+
case 'create':
|
|
1563
|
+
method = 'POST';
|
|
1564
|
+
break;
|
|
1565
|
+
case 'update':
|
|
1566
|
+
method = 'PUT';
|
|
1567
|
+
break;
|
|
1568
|
+
case 'delete':
|
|
1569
|
+
method = 'DELETE';
|
|
1570
|
+
path = `/api/${entityPath}`;
|
|
1571
|
+
break;
|
|
1572
|
+
case 'createOrUpdate':
|
|
1573
|
+
method = 'POST';
|
|
1574
|
+
path = `/api/${entityPath}/createOrUpdate`;
|
|
1575
|
+
break;
|
|
1576
|
+
case 'updateBy':
|
|
1577
|
+
method = 'PUT';
|
|
1578
|
+
path = `/api/${entityPath}/by`;
|
|
1579
|
+
break;
|
|
1580
|
+
case 'deleteBy':
|
|
1581
|
+
method = 'DELETE';
|
|
1582
|
+
path = `/api/${entityPath}/by`;
|
|
1583
|
+
break;
|
|
1584
|
+
case 'batchCreate':
|
|
1585
|
+
method = 'POST';
|
|
1586
|
+
path = `/api/${entityPath}/batch`;
|
|
1587
|
+
break;
|
|
1588
|
+
case 'batchUpdate':
|
|
1589
|
+
method = 'PUT';
|
|
1590
|
+
path = `/api/${entityPath}/batch`;
|
|
1591
|
+
break;
|
|
1592
|
+
case 'batchDelete':
|
|
1593
|
+
method = 'DELETE';
|
|
1594
|
+
path = `/api/${entityPath}/batch`;
|
|
1595
|
+
break;
|
|
1596
|
+
case 'import':
|
|
1597
|
+
method = 'POST';
|
|
1598
|
+
path = `/api/${entityPath}/import`;
|
|
1599
|
+
break;
|
|
1600
|
+
default:
|
|
1601
|
+
break;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
return {
|
|
1606
|
+
config: {
|
|
1607
|
+
serviceType,
|
|
1608
|
+
},
|
|
1609
|
+
url: {
|
|
1610
|
+
method,
|
|
1611
|
+
path,
|
|
1612
|
+
},
|
|
1613
|
+
};
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
@withSourceMap()
|
|
1617
|
+
toEmbeddedTSInProcess(state?: TranslatorState, prependCode?: string, noName?: boolean, prefix?: boolean): string {
|
|
1618
|
+
let code = '';
|
|
1619
|
+
if (!prefix) code += `${noName ? '' : `${this.name}:`} function(`;
|
|
1620
|
+
else code += `function ${this.name}(`; // 加空格会导致无法查询到引用
|
|
1621
|
+
this.params.forEach((param, index) => {
|
|
1622
|
+
code += param.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1623
|
+
if (index !== this.params.length - 1) code += ', ';
|
|
1624
|
+
});
|
|
1625
|
+
code += `) {\n`;
|
|
1626
|
+
code += prependCode || '';
|
|
1627
|
+
code += '\n';
|
|
1628
|
+
this.variables.forEach((variable) => {
|
|
1629
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1630
|
+
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1631
|
+
code += ';\n';
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
this.returns.forEach((ret) => {
|
|
1635
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1636
|
+
code += ret.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1637
|
+
code += ';\n';
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
if (!this.body.length && this.returns.length) {
|
|
1641
|
+
code += `${indent((state?.tabSize || 0) + 1)}return ${this.returns[0].name};\n`;
|
|
1642
|
+
} else {
|
|
1643
|
+
if ((this.parentNode as any).type === 'ExclusiveGateway') {
|
|
1644
|
+
if (this.body.length <= 1) {
|
|
1645
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1646
|
+
code += 'const __LogicEmpty: any = null;';
|
|
1399
1647
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1648
|
+
} else if (this.body.length <= 2 && !(this.parentNode instanceof Namespace) && !(this.parentNode instanceof Process)) {
|
|
1649
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1650
|
+
code += `${indent(state?.tabSize || 0 + 4)}const __LogicEmpty: any = null;`;
|
|
1651
|
+
}
|
|
1652
|
+
this.body.forEach((item) => {
|
|
1653
|
+
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1654
|
+
code += ';\n';
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
// 在body渲染完成之后把其余的节点放到下面
|
|
1659
|
+
this.playground.forEach((item) => {
|
|
1660
|
+
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1661
|
+
code += '\n';
|
|
1662
|
+
});
|
|
1663
|
+
|
|
1664
|
+
code += `${indent(state?.tabSize || 0 + 4)}}`;
|
|
1665
|
+
code += '\n';
|
|
1666
|
+
return code;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
toEmbeddedTSNoExport(state?: TranslatorState): string {
|
|
1670
|
+
return this.toEmbeddedTS(state, 'noExport');
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
@withSourceMap()
|
|
1674
|
+
toEmbeddedTS(state?: TranslatorState, prefix?: string): string {
|
|
1675
|
+
// 如果传了不要前缀那就为空, 要不用传进来的,要是都没有就默认导出
|
|
1676
|
+
let code = '';
|
|
1677
|
+
if (!prefix) {
|
|
1678
|
+
code += `export function ${this.name}`;
|
|
1679
|
+
} else if (prefix === 'noExport') {
|
|
1680
|
+
code += `function ${this.name}`;
|
|
1681
|
+
} else if (prefix === 'inObject') {
|
|
1682
|
+
code += `${this.name}`;
|
|
1683
|
+
}
|
|
1684
|
+
if (this.typeParams?.length) {
|
|
1685
|
+
code += '<';
|
|
1686
|
+
this.typeParams.forEach((typeParam, typeParamIndex) => {
|
|
1687
|
+
code += typeParam.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1688
|
+
if (typeParamIndex !== this.typeParams.length - 1) code += ', ';
|
|
1689
|
+
});
|
|
1690
|
+
code += '>';
|
|
1691
|
+
}
|
|
1692
|
+
// 有参数长度
|
|
1693
|
+
if (this.params.length) {
|
|
1694
|
+
code += '(';
|
|
1695
|
+
this.params.forEach((param, index) => {
|
|
1696
|
+
code += param.toEmbeddedTS(shiftState(state, code));
|
|
1697
|
+
if (index !== this.params.length - 1) code += ', ';
|
|
1698
|
+
});
|
|
1699
|
+
code += ')';
|
|
1700
|
+
} else {
|
|
1701
|
+
// 没有参数的
|
|
1702
|
+
code += '()';
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
// 需要类型推导的局部变量/返回值需要调整申明顺序
|
|
1706
|
+
const advanceMap: Map<Return | Variable, Assignment | BatchAssignment> = new Map();
|
|
1707
|
+
const needGetSourceMapOqlList: Promise<any>[] = [];
|
|
1708
|
+
this.traverseChildren((el) => {
|
|
1709
|
+
if (el && (el instanceof BatchAssignment || (el instanceof Assignment && el.left?.name))) {
|
|
1710
|
+
if (el instanceof Assignment) {
|
|
1711
|
+
const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && el.left?.name === variable.name);
|
|
1712
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1713
|
+
advanceMap.set(advanceVar, el);
|
|
1714
|
+
}
|
|
1715
|
+
const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && el.left?.name === ret.name);
|
|
1716
|
+
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1717
|
+
advanceMap.set(advanceRn, el);
|
|
1718
|
+
}
|
|
1719
|
+
} else if (el instanceof BatchAssignment) {
|
|
1720
|
+
el.assignmentLines.forEach(({ leftIndex }) => {
|
|
1721
|
+
const leftCode =
|
|
1722
|
+
leftIndex.length === 1
|
|
1723
|
+
? el.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true }))
|
|
1724
|
+
: el.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1725
|
+
const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && leftCode === variable.name);
|
|
1726
|
+
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1727
|
+
advanceMap.set(advanceVar, el);
|
|
1403
1728
|
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1729
|
+
const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && leftCode === ret.name);
|
|
1730
|
+
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1731
|
+
advanceMap.set(advanceRn, el);
|
|
1406
1732
|
}
|
|
1733
|
+
});
|
|
1407
1734
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1414
|
-
if ((el as ForEachStatement)?.index) {
|
|
1415
|
-
varList.push((el as ForEachStatement)?.index);
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
});
|
|
1419
|
-
return varList.filter((item) => !excludedSet.has(item)).map((item) => item?.name);
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
toJSContent(code: string, state?: TranslatorState): string {
|
|
1423
|
-
// params
|
|
1424
|
-
if (Array.isArray(this.params)) {
|
|
1425
|
-
this.params.forEach((param) => {
|
|
1426
|
-
code += indent((state?.tabSize || 0) + 1) + '';
|
|
1427
|
-
code += param.toJS(shiftState(state, code, { inline: true }));
|
|
1428
|
-
code += ';\n';
|
|
1429
|
-
});
|
|
1430
|
-
}
|
|
1431
|
-
// variables
|
|
1432
|
-
if (Array.isArray(this.variables)) {
|
|
1433
|
-
this.variables.forEach((variable) => {
|
|
1434
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1435
|
-
code += variable.toJS(shiftState(state, code, { inline: true }));
|
|
1436
|
-
code += ';\n';
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
// returns
|
|
1441
|
-
if (Array.isArray(this.returns)) {
|
|
1442
|
-
this.returns.forEach((ret) => {
|
|
1443
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1444
|
-
code += ret.toJS(shiftState(state, code, { inline: true }));
|
|
1445
|
-
code += ';\n';
|
|
1446
|
-
});
|
|
1447
|
-
}
|
|
1448
|
-
if (Array.isArray(this.body)) {
|
|
1449
|
-
this.body.forEach((item) => {
|
|
1450
|
-
code += item.toJS && item.toJS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1451
|
-
code += '\n';
|
|
1452
|
-
});
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
return code;
|
|
1456
|
-
}
|
|
1457
|
-
toJS(state?: TranslatorState, type?: string): string {
|
|
1458
|
-
let code = '';
|
|
1459
|
-
if (type === 'IIFE') {
|
|
1460
|
-
code += `await (async () => {\n`;
|
|
1461
|
-
code = this.toJSContent(code, state);
|
|
1462
|
-
code += indent(state?.tabSize || 0) + '})();\n';
|
|
1463
|
-
return code;
|
|
1464
|
-
}
|
|
1465
|
-
code += `async ${this.name} (`;
|
|
1466
|
-
|
|
1467
|
-
if (this.params?.length) {
|
|
1468
|
-
this.params.forEach((param, index) => {
|
|
1469
|
-
code += param.name;
|
|
1470
|
-
if (index !== this.params.length - 1)
|
|
1471
|
-
code += ', ';
|
|
1472
|
-
});
|
|
1473
|
-
}
|
|
1474
|
-
code += ') {\n';
|
|
1475
|
-
|
|
1476
|
-
code = this.toJSContent(code, state);
|
|
1477
|
-
code += indent(state?.tabSize || 0) + '}\n';
|
|
1478
|
-
return code;
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
toProcessService() {
|
|
1482
|
-
return {
|
|
1483
|
-
config: {
|
|
1484
|
-
serviceType: 'micro',
|
|
1485
|
-
},
|
|
1486
|
-
url: {
|
|
1487
|
-
method: 'POST',
|
|
1488
|
-
path: this.getPath(),
|
|
1489
|
-
},
|
|
1490
|
-
};
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
toService() {
|
|
1494
|
-
const parentNode = this.parentNode;
|
|
1495
|
-
const { concept, name: entityName } = parentNode || {};
|
|
1496
|
-
const logicName = this.name;
|
|
1497
|
-
let serviceType = 'micro';
|
|
1498
|
-
let method = 'POST';
|
|
1499
|
-
// let path = `/api/${logicName}`;
|
|
1500
|
-
const map: Record<string, string> = {
|
|
1501
|
-
GetUser: 'LCAPAuth',
|
|
1502
|
-
Logout: 'LCAPAuth',
|
|
1503
|
-
CheckPermission: 'LCAPPermission',
|
|
1504
|
-
GetUserResources: 'LCAPPermission',
|
|
1505
|
-
UploadPermission: 'LCAPPermission',
|
|
1506
|
-
GetUserList: 'LCAPUserManage',
|
|
1507
|
-
GetRoleList: 'LCAPUserManage',
|
|
1508
|
-
};
|
|
1509
|
-
let path = `/api/${map[logicName]}/overridden/${logicName}`;
|
|
1510
|
-
if (concept === 'Module') {
|
|
1511
|
-
path = `/api/${entityName.replace('-', '_')}/${logicName}`;
|
|
1512
|
-
} else if (concept === 'Namespace') {
|
|
1513
|
-
serviceType = 'entity';
|
|
1514
|
-
let entityPath = entityName.replace(/[A-Z]/g, (char, index) => {
|
|
1515
|
-
const lowerChar = char.toLowerCase();
|
|
1516
|
-
return index === 0 ? lowerChar : `-${lowerChar}`;
|
|
1517
|
-
});
|
|
1518
|
-
const dataSource = parentNode.getAncestor('DataSource');
|
|
1519
|
-
// 默认数据源不动,其他数据源需要拼接数据源信息
|
|
1520
|
-
if (dataSource && dataSource.name !== 'defaultDS') {
|
|
1521
|
-
entityPath = dataSource.name + '/' + entityPath;
|
|
1522
|
-
}
|
|
1523
|
-
path = `/api/${entityPath}`;
|
|
1524
|
-
switch (this.name) {
|
|
1525
|
-
case 'get':
|
|
1526
|
-
method = 'GET';
|
|
1527
|
-
path = `/api/${entityPath}`;
|
|
1528
|
-
break;
|
|
1529
|
-
case 'create':
|
|
1530
|
-
method = 'POST';
|
|
1531
|
-
break;
|
|
1532
|
-
case 'update':
|
|
1533
|
-
method = 'PUT';
|
|
1534
|
-
break;
|
|
1535
|
-
case 'delete':
|
|
1536
|
-
method = 'DELETE';
|
|
1537
|
-
path = `/api/${entityPath}`;
|
|
1538
|
-
break;
|
|
1539
|
-
case 'createOrUpdate':
|
|
1540
|
-
method = 'POST';
|
|
1541
|
-
path = `/api/${entityPath}/createOrUpdate`;
|
|
1542
|
-
break;
|
|
1543
|
-
case 'updateBy':
|
|
1544
|
-
method = 'PUT';
|
|
1545
|
-
path = `/api/${entityPath}/by`;
|
|
1546
|
-
break;
|
|
1547
|
-
case 'deleteBy':
|
|
1548
|
-
method = 'DELETE';
|
|
1549
|
-
path = `/api/${entityPath}/by`;
|
|
1550
|
-
break;
|
|
1551
|
-
case 'batchCreate':
|
|
1552
|
-
method = 'POST';
|
|
1553
|
-
path = `/api/${entityPath}/batch`;
|
|
1554
|
-
break;
|
|
1555
|
-
case 'batchUpdate':
|
|
1556
|
-
method = 'PUT';
|
|
1557
|
-
path = `/api/${entityPath}/batch`;
|
|
1558
|
-
break;
|
|
1559
|
-
case 'batchDelete':
|
|
1560
|
-
method = 'DELETE';
|
|
1561
|
-
path = `/api/${entityPath}/batch`;
|
|
1562
|
-
break;
|
|
1563
|
-
case 'import':
|
|
1564
|
-
method = 'POST';
|
|
1565
|
-
path = `/api/${entityPath}/import`;
|
|
1566
|
-
break;
|
|
1567
|
-
default:
|
|
1568
|
-
break;
|
|
1569
|
-
}
|
|
1735
|
+
}
|
|
1736
|
+
// 如果有sql查询组件就需要把他们存起来
|
|
1737
|
+
if (el instanceof OqlQueryComponent) {
|
|
1738
|
+
if (!el.codeSourceMap) {
|
|
1739
|
+
needGetSourceMapOqlList.push(el.requestEmbeddedTS());
|
|
1570
1740
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1741
|
+
}
|
|
1742
|
+
});
|
|
1743
|
+
|
|
1744
|
+
if (needGetSourceMapOqlList.length) {
|
|
1745
|
+
Promise.all(needGetSourceMapOqlList).then(() => {
|
|
1746
|
+
// 触发一下更新重新生成代码
|
|
1747
|
+
(this.app as any)?.naslServer?.embeddedTSEmitter.emit('change', {
|
|
1748
|
+
value: [
|
|
1749
|
+
{
|
|
1750
|
+
originEvent: {
|
|
1751
|
+
action: 'update',
|
|
1752
|
+
target: this,
|
|
1753
|
+
},
|
|
1579
1754
|
},
|
|
1580
|
-
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
@withSourceMap()
|
|
1584
|
-
toEmbeddedTSInProcess(state?: TranslatorState, prependCode?: string, noName?: boolean, prefix?: boolean): string {
|
|
1585
|
-
let code = '';
|
|
1586
|
-
if (!prefix)
|
|
1587
|
-
code += `${noName ? '' : `${this.name}:`} function(`;
|
|
1588
|
-
else
|
|
1589
|
-
code += `function ${this.name}(`; //加空格会导致无法查询到引用
|
|
1590
|
-
this.params.forEach((param, index) => {
|
|
1591
|
-
code += param.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1592
|
-
if (index !== this.params.length - 1)
|
|
1593
|
-
code += ', ';
|
|
1755
|
+
],
|
|
1594
1756
|
});
|
|
1595
|
-
|
|
1596
|
-
code += prependCode || '';
|
|
1597
|
-
code += '\n';
|
|
1598
|
-
this.variables.forEach((variable) => {
|
|
1599
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1600
|
-
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1601
|
-
code += ';\n';
|
|
1602
|
-
});
|
|
1603
|
-
|
|
1604
|
-
this.returns.forEach((ret) => {
|
|
1605
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1606
|
-
code += ret.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1607
|
-
code += ';\n';
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
if (!this.body.length && this.returns.length) {
|
|
1611
|
-
code += indent((state?.tabSize || 0) + 1) + `return ${this.returns[0].name};\n`;
|
|
1612
|
-
} else {
|
|
1613
|
-
if ((this.parentNode as any).type === 'ExclusiveGateway') {
|
|
1614
|
-
if (this.body.length <= 1) {
|
|
1615
|
-
code += indent((state?.tabSize || 0) + 1);
|
|
1616
|
-
code += 'const __LogicEmpty: any = null;';
|
|
1617
|
-
}
|
|
1618
|
-
} else if (this.body.length <= 2 && !(this.parentNode instanceof Namespace) && !(this.parentNode instanceof Process)) {
|
|
1619
|
-
code += indent((state?.tabSize || 0) + 1);
|
|
1620
|
-
code += indent(state?.tabSize || 0 + 4) + 'const __LogicEmpty: any = null;';
|
|
1621
|
-
}
|
|
1622
|
-
this.body.forEach((item) => {
|
|
1623
|
-
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1624
|
-
code += ';\n';
|
|
1625
|
-
});
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
// 在body渲染完成之后把其余的节点放到下面
|
|
1629
|
-
this.playground.forEach((item) => {
|
|
1630
|
-
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1631
|
-
code += '\n';
|
|
1632
|
-
});
|
|
1633
|
-
|
|
1634
|
-
code += indent(state?.tabSize || 0 + 4) + '}';
|
|
1635
|
-
code += '\n';
|
|
1636
|
-
return code;
|
|
1757
|
+
});
|
|
1637
1758
|
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1759
|
+
// 兼容 return 没有类型情况
|
|
1760
|
+
if (this.returns.length && this.returns[0].typeAnnotation) {
|
|
1761
|
+
code += ': ';
|
|
1762
|
+
code += this.returns[0].typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1641
1763
|
}
|
|
1764
|
+
code += '{\n';
|
|
1642
1765
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
advanceMap.set(advanceVar, el);
|
|
1686
|
-
}
|
|
1687
|
-
const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && el.left?.name === ret.name);
|
|
1688
|
-
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1689
|
-
advanceMap.set(advanceRn, el);
|
|
1690
|
-
}
|
|
1691
|
-
} else if (el instanceof BatchAssignment) {
|
|
1692
|
-
el.assignmentLines.forEach(({ leftIndex }) => {
|
|
1693
|
-
const leftCode
|
|
1694
|
-
= leftIndex.length === 1 ? el.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true })) : el.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1695
|
-
const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && (leftCode === variable.name));
|
|
1696
|
-
if (advanceVar && !advanceMap.get(advanceVar)) {
|
|
1697
|
-
advanceMap.set(advanceVar, el);
|
|
1698
|
-
}
|
|
1699
|
-
const advanceRn = this.returns?.find((ret) => !ret.typeAnnotation && leftCode === ret.name);
|
|
1700
|
-
if (advanceRn && !advanceMap.get(advanceRn)) {
|
|
1701
|
-
advanceMap.set(advanceRn, el);
|
|
1702
|
-
}
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
// 如果有sql查询组件就需要把他们存起来
|
|
1707
|
-
if (el instanceof OqlQueryComponent) {
|
|
1708
|
-
if (!el.codeSourceMap) {
|
|
1709
|
-
needGetSourceMapOqlList.push(el.requestEmbeddedTS());
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
});
|
|
1713
|
-
|
|
1714
|
-
if (needGetSourceMapOqlList.length) {
|
|
1715
|
-
Promise.all(needGetSourceMapOqlList).then(() => {
|
|
1716
|
-
// 触发一下更新重新生成代码
|
|
1717
|
-
(this.app as any)?.naslServer?.embeddedTSEmitter.emit('change', {
|
|
1718
|
-
value: [
|
|
1719
|
-
{
|
|
1720
|
-
originEvent: {
|
|
1721
|
-
action: 'update',
|
|
1722
|
-
target: this,
|
|
1723
|
-
},
|
|
1724
|
-
},
|
|
1725
|
-
],
|
|
1726
|
-
});
|
|
1727
|
-
});
|
|
1728
|
-
}
|
|
1729
|
-
// 兼容 return 没有类型情况
|
|
1730
|
-
if (this.returns.length && this.returns[0].typeAnnotation) {
|
|
1731
|
-
code += ': ';
|
|
1732
|
-
code += this.returns[0].typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1733
|
-
}
|
|
1734
|
-
code += '{\n';
|
|
1735
|
-
|
|
1736
|
-
// 用于虚拟节点的查找引用
|
|
1737
|
-
this.virtualParams
|
|
1738
|
-
&& Array.isArray(this.virtualParams)
|
|
1739
|
-
&& this.virtualParams.forEach((param) => {
|
|
1740
|
-
code += indent((state?.tabSize || 0) + 1);
|
|
1741
|
-
code += param.toEmbeddedNameTS(shiftState(state, code, { inline: true }));
|
|
1742
|
-
code += '\n';
|
|
1743
|
-
});
|
|
1744
|
-
|
|
1745
|
-
this.variables.forEach((variable) => {
|
|
1746
|
-
if (!advanceMap.get(variable)) {
|
|
1747
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1748
|
-
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1749
|
-
code += ';\n';
|
|
1750
|
-
}
|
|
1751
|
-
});
|
|
1752
|
-
|
|
1753
|
-
this.returns.forEach((ret) => {
|
|
1754
|
-
if (!advanceMap.get(ret)) {
|
|
1755
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1756
|
-
code += ret.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1757
|
-
code += ';\n';
|
|
1758
|
-
}
|
|
1759
|
-
});
|
|
1760
|
-
|
|
1761
|
-
advanceMap.forEach((assignment, node) => {
|
|
1762
|
-
code += indent((state?.tabSize || 0) + 1) + '// @ts-ignore\n';
|
|
1763
|
-
code += indent((state?.tabSize || 0) + 1) + 'let ';
|
|
1764
|
-
code += node.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1765
|
-
if (assignment instanceof BatchAssignment) {
|
|
1766
|
-
assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
|
|
1767
|
-
const leftCode
|
|
1768
|
-
= leftIndex.length === 1 ? assignment.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true })) : assignment.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1769
|
-
if (leftCode === node.name) {
|
|
1770
|
-
const rightNode: any = rightIndex.length === 1 ? assignment.rights[rightIndex[0]]?.expression : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
|
|
1771
|
-
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1772
|
-
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1773
|
-
code += ': ';
|
|
1774
|
-
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1775
|
-
} else {
|
|
1776
|
-
code += ' = ';
|
|
1777
|
-
const rightCode = rightNode?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1778
|
-
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
});
|
|
1782
|
-
} else if (['NewList', 'NewMap'].includes(assignment.right?.concept) && !(assignment.right as any)?.typeAnnotation) {
|
|
1783
|
-
const rightNode: any = assignment.right;
|
|
1784
|
-
code += ' = ';
|
|
1785
|
-
code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
|
|
1786
|
-
} else if (assignment.right?.concept === 'NewComposite' && (assignment.right as any)?.typeAnnotation?.typeKind === 'anonymousStructure') {
|
|
1787
|
-
const rightNode: any = assignment.right;
|
|
1788
|
-
code += ' = ';
|
|
1789
|
-
code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
|
|
1766
|
+
// 用于虚拟节点的查找引用
|
|
1767
|
+
this.virtualParams &&
|
|
1768
|
+
Array.isArray(this.virtualParams) &&
|
|
1769
|
+
this.virtualParams.forEach((param) => {
|
|
1770
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1771
|
+
code += param.toEmbeddedNameTS(shiftState(state, code, { inline: true }));
|
|
1772
|
+
code += '\n';
|
|
1773
|
+
});
|
|
1774
|
+
|
|
1775
|
+
this.variables.forEach((variable) => {
|
|
1776
|
+
if (!advanceMap.get(variable)) {
|
|
1777
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1778
|
+
code += variable.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1779
|
+
code += ';\n';
|
|
1780
|
+
}
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
this.returns.forEach((ret) => {
|
|
1784
|
+
if (!advanceMap.get(ret)) {
|
|
1785
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1786
|
+
code += ret.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1787
|
+
code += ';\n';
|
|
1788
|
+
}
|
|
1789
|
+
});
|
|
1790
|
+
|
|
1791
|
+
advanceMap.forEach((assignment, node) => {
|
|
1792
|
+
code += `${indent((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
|
|
1793
|
+
code += `${indent((state?.tabSize || 0) + 1)}let `;
|
|
1794
|
+
code += node.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1795
|
+
if (assignment instanceof BatchAssignment) {
|
|
1796
|
+
assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
|
|
1797
|
+
const leftCode =
|
|
1798
|
+
leftIndex.length === 1
|
|
1799
|
+
? assignment.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true }))
|
|
1800
|
+
: assignment.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1801
|
+
if (leftCode === node.name) {
|
|
1802
|
+
const rightNode: any =
|
|
1803
|
+
rightIndex.length === 1 ? assignment.rights[rightIndex[0]]?.expression : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
|
|
1804
|
+
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1805
|
+
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1806
|
+
code += ': ';
|
|
1807
|
+
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1790
1808
|
} else {
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
code += ': ';
|
|
1795
|
-
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1796
|
-
} else {
|
|
1797
|
-
code += ' = ';
|
|
1798
|
-
let rightCode = '';
|
|
1799
|
-
// 因为右侧枚举要赋值就得new 一下;
|
|
1800
|
-
if (rightNode && rightNode instanceof Identifier && rightNode.namespace && rightNode.namespace.endsWith('enums')) {
|
|
1801
|
-
rightCode += 'new ';
|
|
1802
|
-
}
|
|
1803
|
-
rightCode += rightNode && rightNode.toEmbeddedTS ? rightNode.toEmbeddedTS(shiftState(state, code, { inline: true })) : '__RIGHT__';
|
|
1804
|
-
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
1805
|
-
}
|
|
1809
|
+
code += ' = ';
|
|
1810
|
+
const rightCode = rightNode?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1811
|
+
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
1806
1812
|
}
|
|
1807
|
-
|
|
1813
|
+
}
|
|
1808
1814
|
});
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1815
|
+
} else if (['NewList', 'NewMap'].includes(assignment.right?.concept) && !(assignment.right as any)?.typeAnnotation) {
|
|
1816
|
+
const rightNode: any = assignment.right;
|
|
1817
|
+
code += ' = ';
|
|
1818
|
+
code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
|
|
1819
|
+
} else if (assignment.right?.concept === 'NewComposite' && (assignment.right as any)?.typeAnnotation?.typeKind === 'anonymousStructure') {
|
|
1820
|
+
const rightNode: any = assignment.right;
|
|
1821
|
+
code += ' = ';
|
|
1822
|
+
code += rightNode.getInitCode(shiftState(state, code, { inline: true }));
|
|
1823
|
+
} else {
|
|
1824
|
+
const rightNode: any = assignment.right;
|
|
1825
|
+
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1826
|
+
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1827
|
+
code += ': ';
|
|
1828
|
+
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1812
1829
|
} else {
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
});
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
// 在body渲染完成之后把其余的节点放到下面
|
|
1825
|
-
this.playground.forEach((item) => {
|
|
1826
|
-
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1827
|
-
code += ';\n';
|
|
1828
|
-
});
|
|
1829
|
-
|
|
1830
|
-
code += indent(state?.tabSize || 0) + '}';
|
|
1831
|
-
if (prefix === 'inObject') {
|
|
1832
|
-
code += `,`;
|
|
1833
|
-
}
|
|
1834
|
-
code += '\n';
|
|
1835
|
-
return code;
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
getRightCode(code: string, assignment: Assignment | BatchAssignment, rightNode: any): string {
|
|
1839
|
-
code = code.replaceAll('\n', ' ');
|
|
1840
|
-
if (assignment instanceof Assignment && !assignment.right)
|
|
1841
|
-
return code;
|
|
1842
|
-
|
|
1843
|
-
// 调用接口,参数替换成 null
|
|
1844
|
-
if (rightNode instanceof CallInterface) {
|
|
1845
|
-
const { _interface } = rightNode.getModuleInterface();
|
|
1846
|
-
return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
// 调用服务端逻辑,参数替换成 null
|
|
1850
|
-
if (rightNode instanceof CallLogic && rightNode.calleeNamespace === 'app.logics') {
|
|
1851
|
-
const calleeName = rightNode?.calleeName;
|
|
1852
|
-
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
1853
|
-
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
1857
|
-
const forEachStatement = assignment.getAncestor('ForEachStatement') as ForEachStatement;
|
|
1858
|
-
if (forEachStatement) {
|
|
1859
|
-
code = this.handleForEachCode(code, forEachStatement);
|
|
1860
|
-
}
|
|
1861
|
-
// Match 需要针对分支缩小类型范围
|
|
1862
|
-
const matchCase = assignment.getAncestor('MatchCase') as MatchCase;
|
|
1863
|
-
if (matchCase) {
|
|
1864
|
-
code = this.handleMatchCaseCode(code, matchCase);
|
|
1865
|
-
}
|
|
1866
|
-
return code;
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
handleReplaceCode(code: string, variable: string, replaceCode: string) {
|
|
1870
|
-
return code.replace(/\S+/g, ($1) => {
|
|
1871
|
-
if ($1 === `${variable},`)
|
|
1872
|
-
return `${replaceCode},`;
|
|
1873
|
-
if ($1 === variable)
|
|
1874
|
-
return replaceCode;
|
|
1875
|
-
|
|
1876
|
-
let fnCode = $1;
|
|
1877
|
-
if ($1.startsWith(`${variable}.`))
|
|
1878
|
-
fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
|
|
1879
|
-
if ($1.startsWith(`${variable},`))
|
|
1880
|
-
fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
|
|
1881
|
-
if ($1.includes(`(${variable},`))
|
|
1882
|
-
fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
|
|
1883
|
-
if ($1.includes(`(${variable}.`))
|
|
1884
|
-
fnCode = $1.replaceAll(`(${variable}.`, `(${replaceCode}.`);
|
|
1885
|
-
if ($1.includes(`(${variable})`))
|
|
1886
|
-
fnCode = $1.replaceAll(`(${variable})`, `(${replaceCode})`);
|
|
1887
|
-
if ($1.includes(`,${variable},`))
|
|
1888
|
-
fnCode = $1.replaceAll(`,${variable},`, `,${replaceCode},`);
|
|
1889
|
-
if ($1.includes(`,${variable}.`))
|
|
1890
|
-
fnCode = $1.replaceAll(`,${variable}.`, `,${replaceCode}.`);
|
|
1891
|
-
if ($1.includes(`,${variable})`))
|
|
1892
|
-
fnCode = $1.replaceAll(`,${variable})`, `,${replaceCode})`);
|
|
1893
|
-
return fnCode;
|
|
1894
|
-
});
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
handleForEachCode(code: string, forEachStatement: ForEachStatement): string {
|
|
1898
|
-
const { item, index, each } = forEachStatement;
|
|
1899
|
-
if (code.includes(item.name)) {
|
|
1900
|
-
const eachTSCode = each.toEmbeddedTS();
|
|
1901
|
-
code = this.handleReplaceCode(code, item.name, eachTSCode === '__IDENTIFIER__' ? eachTSCode : `${eachTSCode}.__get(0)`);
|
|
1902
|
-
}
|
|
1903
|
-
if (code.includes(index.name))
|
|
1904
|
-
code = this.handleReplaceCode(code, index.name, 'new nasl.core.Integer(0)');
|
|
1905
|
-
|
|
1906
|
-
const parentForEachStatement = forEachStatement.getAncestor('ForEachStatement') as ForEachStatement;
|
|
1907
|
-
if (parentForEachStatement) {
|
|
1908
|
-
this.handleForEachCode(code, parentForEachStatement);
|
|
1909
|
-
}
|
|
1910
|
-
return code;
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
handleMatchCaseCode(code: string, matchCase: MatchCase): string {
|
|
1914
|
-
const match = matchCase.getAncestor('Match') as Match;
|
|
1915
|
-
const expressionTsCode = match.expression.toEmbeddedTS();
|
|
1916
|
-
if (code.includes(expressionTsCode)) {
|
|
1917
|
-
let typeCode = '';
|
|
1918
|
-
matchCase.patterns.forEach((pattern, index) => {
|
|
1919
|
-
if (pattern instanceof TypeAnnotation) {
|
|
1920
|
-
if (index === 0) {
|
|
1921
|
-
typeCode += pattern.toEmbeddedTS();
|
|
1922
|
-
} else {
|
|
1923
|
-
typeCode += '|';
|
|
1924
|
-
typeCode += pattern.toEmbeddedTS();
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
});
|
|
1928
|
-
if (typeCode) {
|
|
1929
|
-
code = this.handleReplaceCode(code, expressionTsCode, `(${expressionTsCode} as ${typeCode})`);
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
const parentMatchCase = match.getAncestor('MatchCase') as MatchCase;
|
|
1933
|
-
if (parentMatchCase) {
|
|
1934
|
-
code = this.handleMatchCaseCode(code, parentMatchCase);
|
|
1935
|
-
}
|
|
1936
|
-
return code;
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
getNamespace(): string {
|
|
1940
|
-
if (this.parentNode) {
|
|
1941
|
-
const parentNamespace = (this.parentNode as any)?.getNamespace();
|
|
1942
|
-
const parentName = this.parentNode.name;
|
|
1943
|
-
const arr = [parentNamespace];
|
|
1944
|
-
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1945
|
-
arr.push(parentName);
|
|
1946
|
-
}
|
|
1947
|
-
let namespace = arr.join('.');
|
|
1948
|
-
if (
|
|
1949
|
-
!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1950
|
-
&& !namespace.includes('.overriddenLogics')
|
|
1951
|
-
) {
|
|
1952
|
-
namespace = `${namespace}.overriddenLogics`;
|
|
1953
|
-
}
|
|
1954
|
-
if (this.concept === 'OverriddenLogic') {
|
|
1955
|
-
namespace = `extensions.${this.overriddenModule}.logics`;
|
|
1956
|
-
}
|
|
1957
|
-
return namespace;
|
|
1958
|
-
} else
|
|
1959
|
-
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1960
|
-
}
|
|
1961
|
-
|
|
1962
|
-
getTsNamespace(): string {
|
|
1963
|
-
if (this.parentNode) {
|
|
1964
|
-
const parentNamespace = (this.parentNode as any)?.getTsNamespace();
|
|
1965
|
-
const parentName = this.parentNode.tsName || this.parentNode.name;
|
|
1966
|
-
const arr = [parentNamespace];
|
|
1967
|
-
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1968
|
-
arr.push(parentName);
|
|
1969
|
-
}
|
|
1970
|
-
let namespace = arr.join('.');
|
|
1971
|
-
if (
|
|
1972
|
-
!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1973
|
-
&& !namespace.includes('.overriddenLogics')
|
|
1974
|
-
) {
|
|
1975
|
-
namespace = `${namespace}.overriddenLogics`;
|
|
1976
|
-
}
|
|
1977
|
-
return namespace;
|
|
1978
|
-
} else
|
|
1979
|
-
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
/**
|
|
1983
|
-
* 生成宿主语言的文件路径
|
|
1984
|
-
* @param name 一般不用传,用于 rename
|
|
1985
|
-
*/
|
|
1986
|
-
getEmbeddedFilePath(name = this.name) {
|
|
1987
|
-
let _path = this.module ? `/${this.module.parentKey}/${this.module.name}` : '';
|
|
1988
|
-
if (this.parentNode instanceof FrontendLibrary) {
|
|
1989
|
-
_path += `/frontends/${this.parentNode.type}`;
|
|
1990
|
-
}
|
|
1991
|
-
return `/embedded/${this.app.name}${_path}/overriddenLogics/${name}.ts`;
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
toEmbeddedTSFile() {
|
|
1995
|
-
let code = `namespace ${this.getTsNamespace()} {\n`;
|
|
1996
|
-
|
|
1997
|
-
const state = createCompilerState(code, { tabSize: 1 });
|
|
1998
|
-
try {
|
|
1999
|
-
code += this.toEmbeddedTS(state);
|
|
2000
|
-
} catch (err) {
|
|
2001
|
-
console.log(err, '有问题翻译失败');
|
|
2002
|
-
code += '';
|
|
2003
|
-
console.log(err);
|
|
2004
|
-
}
|
|
2005
|
-
code += '}\n';
|
|
2006
|
-
return {
|
|
2007
|
-
code,
|
|
2008
|
-
filePath: this.getEmbeddedFilePath(),
|
|
2009
|
-
sourceMap: state.sourceMap,
|
|
2010
|
-
};
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
public static getDefaultOptions() {
|
|
2014
|
-
return {
|
|
2015
|
-
body: [
|
|
2016
|
-
{
|
|
2017
|
-
concept: 'Start',
|
|
2018
|
-
label: '开始',
|
|
2019
|
-
kind: 'Statement',
|
|
2020
|
-
type: 'Start',
|
|
2021
|
-
},
|
|
2022
|
-
{
|
|
2023
|
-
concept: 'End',
|
|
2024
|
-
label: '结束',
|
|
2025
|
-
kind: 'Statement',
|
|
2026
|
-
type: 'End',
|
|
2027
|
-
},
|
|
2028
|
-
],
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
async saveStructureOfCallQueryComponents(root?: BaseNode | Logic) {
|
|
2033
|
-
if (!root)
|
|
2034
|
-
root = this;
|
|
2035
|
-
const set = new Set();
|
|
2036
|
-
utils.traverse(({ node }) => {
|
|
2037
|
-
if (node instanceof CallQueryComponent) {
|
|
2038
|
-
set.add(node);
|
|
2039
|
-
}
|
|
2040
|
-
}, { node: root }, {
|
|
2041
|
-
mode: 'anyObject',
|
|
2042
|
-
excludedKeySet: new Set(['parentNode', '__assignment__']),
|
|
2043
|
-
});
|
|
2044
|
-
for (const node of set) {
|
|
2045
|
-
(<CallQueryComponent>node).saveStructure();
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
|
|
2049
|
-
// 通过开关设置数据库事务
|
|
2050
|
-
setTransactionEnabled(flag: boolean) {
|
|
2051
|
-
this.setTransactional(new Transactional({
|
|
2052
|
-
enabled: flag,
|
|
2053
|
-
}));
|
|
2054
|
-
}
|
|
2055
|
-
fake: boolean;
|
|
2056
|
-
|
|
2057
|
-
getPath: () => string;
|
|
2058
|
-
|
|
2059
|
-
delete() {
|
|
2060
|
-
let actionMsg = '删除逻辑项';
|
|
2061
|
-
if (this.name)
|
|
2062
|
-
actionMsg += `“${this.name}”`;
|
|
2063
|
-
this.app?.emit('collect:start', {
|
|
2064
|
-
actionMsg,
|
|
2065
|
-
});
|
|
2066
|
-
super.delete();
|
|
2067
|
-
this.traverseChildren((el) => {
|
|
2068
|
-
if (el?.concept === 'CallQueryComponent')
|
|
2069
|
-
(el as CallQueryComponent).removeStructure();
|
|
2070
|
-
});
|
|
2071
|
-
this.app?.emit('collect:end');
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
// 是不是内部有错误
|
|
2075
|
-
haveError: boolean = false;
|
|
2076
|
-
|
|
2077
|
-
// 是否body为空
|
|
2078
|
-
isSmpty: boolean = false;
|
|
2079
|
-
|
|
2080
|
-
get pathName() {
|
|
2081
|
-
if (this.view) {
|
|
2082
|
-
return this.getEventLogicName('chinese');
|
|
2083
|
-
}
|
|
2084
|
-
const nameMap = {
|
|
2085
|
-
OnProcessStart: '流程开始时',
|
|
2086
|
-
OnTasksCreate: '任务创建时',
|
|
2087
|
-
OnTasksOpen: '任务打开时',
|
|
2088
|
-
OnTasksClose: '任务关闭时',
|
|
2089
|
-
OnCreate: '用户任务创建时',
|
|
2090
|
-
OnOpen: '用户任务打开时',
|
|
2091
|
-
OnClose: '用户任务关闭时',
|
|
2092
|
-
};
|
|
2093
|
-
const pathName = [this.name];
|
|
2094
|
-
let parentNode = this.parentNode;
|
|
2095
|
-
while (parentNode && parentNode.concept !== 'Process') {
|
|
2096
|
-
const name = (nameMap as any)[parentNode.name] || parentNode.name;
|
|
2097
|
-
pathName.unshift(name);
|
|
2098
|
-
parentNode = parentNode.parentNode;
|
|
2099
|
-
}
|
|
2100
|
-
return pathName.join('-');
|
|
2101
|
-
}
|
|
2102
|
-
// 获取bindEvent下的logic的名称
|
|
2103
|
-
getEventLogicName(type?: string) {
|
|
2104
|
-
if (this.parentNode instanceof BindEvent) {
|
|
2105
|
-
if (type === 'chinese') {
|
|
2106
|
-
const bindEvent = this.parentNode;
|
|
2107
|
-
const bindChineseName = bindEvent.getPageViewEventChineseName();
|
|
2108
|
-
return `${bindChineseName}-${this.name}`;
|
|
2109
|
-
}
|
|
1830
|
+
code += ' = ';
|
|
1831
|
+
let rightCode = '';
|
|
1832
|
+
// 因为右侧枚举要赋值就得new 一下;
|
|
1833
|
+
if (rightNode && rightNode instanceof Identifier && rightNode.namespace && rightNode.namespace.endsWith('enums')) {
|
|
1834
|
+
rightCode += 'new ';
|
|
1835
|
+
}
|
|
1836
|
+
rightCode += rightNode && rightNode.toEmbeddedTS ? rightNode.toEmbeddedTS(shiftState(state, code, { inline: true })) : '__RIGHT__';
|
|
1837
|
+
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
2110
1838
|
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
1839
|
+
}
|
|
1840
|
+
code += ';\n';
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
if (!this.body.length && this.returns.length) {
|
|
1844
|
+
code += `${indent((state?.tabSize || 0) + 1)}return ${this.returns[0].name};\n`;
|
|
1845
|
+
} else {
|
|
1846
|
+
// 如果长度小于2 并且不是虚拟节点就 加 报错,
|
|
1847
|
+
if (this.body.length <= 2 && !(this.parentNode instanceof Namespace)) {
|
|
1848
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1849
|
+
code += 'const __LogicEmpty: any = null;';
|
|
1850
|
+
}
|
|
1851
|
+
this.body.forEach((item) => {
|
|
1852
|
+
code += item.toEmbeddedTS && item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1853
|
+
code += ';\n';
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
// 在body渲染完成之后把其余的节点放到下面
|
|
1858
|
+
this.playground.forEach((item) => {
|
|
1859
|
+
code += item.toEmbeddedTS(shiftState(state, code, { tabSize: (state?.tabSize || 0) + 1 }));
|
|
1860
|
+
code += ';\n';
|
|
1861
|
+
});
|
|
1862
|
+
|
|
1863
|
+
code += `${indent(state?.tabSize || 0)}}`;
|
|
1864
|
+
if (prefix === 'inObject') {
|
|
1865
|
+
code += `,`;
|
|
1866
|
+
}
|
|
1867
|
+
code += '\n';
|
|
1868
|
+
return code;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
getRightCode(code: string, assignment: Assignment | BatchAssignment, rightNode: any): string {
|
|
1872
|
+
code = code.replaceAll('\n', ' ');
|
|
1873
|
+
if (assignment instanceof Assignment && !assignment.right) return code;
|
|
1874
|
+
|
|
1875
|
+
// 调用接口,参数替换成 null
|
|
1876
|
+
if (rightNode instanceof CallInterface) {
|
|
1877
|
+
const { _interface } = rightNode.getModuleInterface();
|
|
1878
|
+
return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
// 调用服务端逻辑,参数替换成 null
|
|
1882
|
+
if (rightNode instanceof CallLogic && rightNode.calleeNamespace === 'app.logics') {
|
|
1883
|
+
const calleeName = rightNode?.calleeName;
|
|
1884
|
+
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
1885
|
+
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
1889
|
+
const forEachStatement = assignment.getAncestor('ForEachStatement') as ForEachStatement;
|
|
1890
|
+
if (forEachStatement) {
|
|
1891
|
+
code = this.handleForEachCode(code, forEachStatement);
|
|
1892
|
+
}
|
|
1893
|
+
// Match 需要针对分支缩小类型范围
|
|
1894
|
+
const matchCase = assignment.getAncestor('MatchCase') as MatchCase;
|
|
1895
|
+
if (matchCase) {
|
|
1896
|
+
code = this.handleMatchCaseCode(code, matchCase);
|
|
1897
|
+
}
|
|
1898
|
+
return code;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
handleReplaceCode(code: string, variable: string, replaceCode: string) {
|
|
1902
|
+
return code.replace(/\S+/g, ($1) => {
|
|
1903
|
+
if ($1 === `${variable},`) return `${replaceCode},`;
|
|
1904
|
+
if ($1 === variable) return replaceCode;
|
|
1905
|
+
|
|
1906
|
+
let fnCode = $1;
|
|
1907
|
+
if ($1.startsWith(`${variable}.`)) fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
|
|
1908
|
+
if ($1.startsWith(`${variable},`)) fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
|
|
1909
|
+
if ($1.includes(`(${variable},`)) fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
|
|
1910
|
+
if ($1.includes(`(${variable}.`)) fnCode = $1.replaceAll(`(${variable}.`, `(${replaceCode}.`);
|
|
1911
|
+
if ($1.includes(`(${variable})`)) fnCode = $1.replaceAll(`(${variable})`, `(${replaceCode})`);
|
|
1912
|
+
if ($1.includes(`,${variable},`)) fnCode = $1.replaceAll(`,${variable},`, `,${replaceCode},`);
|
|
1913
|
+
if ($1.includes(`,${variable}.`)) fnCode = $1.replaceAll(`,${variable}.`, `,${replaceCode}.`);
|
|
1914
|
+
if ($1.includes(`,${variable})`)) fnCode = $1.replaceAll(`,${variable})`, `,${replaceCode})`);
|
|
1915
|
+
return fnCode;
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
handleForEachCode(code: string, forEachStatement: ForEachStatement): string {
|
|
1920
|
+
const { item, index, each } = forEachStatement;
|
|
1921
|
+
if (code.includes(item.name)) {
|
|
1922
|
+
const eachTSCode = each.toEmbeddedTS();
|
|
1923
|
+
code = this.handleReplaceCode(code, item.name, eachTSCode === '__IDENTIFIER__' ? eachTSCode : `${eachTSCode}.__get(0)`);
|
|
1924
|
+
}
|
|
1925
|
+
if (code.includes(index.name)) code = this.handleReplaceCode(code, index.name, 'new nasl.core.Integer(0)');
|
|
1926
|
+
|
|
1927
|
+
const parentForEachStatement = forEachStatement.getAncestor('ForEachStatement') as ForEachStatement;
|
|
1928
|
+
if (parentForEachStatement) {
|
|
1929
|
+
this.handleForEachCode(code, parentForEachStatement);
|
|
1930
|
+
}
|
|
1931
|
+
return code;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
handleMatchCaseCode(code: string, matchCase: MatchCase): string {
|
|
1935
|
+
const match = matchCase.getAncestor('Match') as Match;
|
|
1936
|
+
const expressionTsCode = match.expression.toEmbeddedTS();
|
|
1937
|
+
if (code.includes(expressionTsCode)) {
|
|
1938
|
+
let typeCode = '';
|
|
1939
|
+
matchCase.patterns.forEach((pattern, index) => {
|
|
1940
|
+
if (pattern instanceof TypeAnnotation) {
|
|
1941
|
+
if (index === 0) {
|
|
1942
|
+
typeCode += pattern.toEmbeddedTS();
|
|
1943
|
+
} else {
|
|
1944
|
+
typeCode += '|';
|
|
1945
|
+
typeCode += pattern.toEmbeddedTS();
|
|
1946
|
+
}
|
|
2127
1947
|
}
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
1948
|
+
});
|
|
1949
|
+
if (typeCode) {
|
|
1950
|
+
code = this.handleReplaceCode(code, expressionTsCode, `(${expressionTsCode} as ${typeCode})`);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
const parentMatchCase = match.getAncestor('MatchCase') as MatchCase;
|
|
1954
|
+
if (parentMatchCase) {
|
|
1955
|
+
code = this.handleMatchCaseCode(code, parentMatchCase);
|
|
1956
|
+
}
|
|
1957
|
+
return code;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
getNamespace(): string {
|
|
1961
|
+
if (this.parentNode) {
|
|
1962
|
+
const parentNamespace = (this.parentNode as any)?.getNamespace();
|
|
1963
|
+
const parentName = this.parentNode.name;
|
|
1964
|
+
const arr = [parentNamespace];
|
|
1965
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1966
|
+
arr.push(parentName);
|
|
1967
|
+
}
|
|
1968
|
+
let namespace = arr.join('.');
|
|
1969
|
+
if (
|
|
1970
|
+
![
|
|
1971
|
+
'nasl.ui',
|
|
1972
|
+
'nasl.utils',
|
|
1973
|
+
'nasl.util',
|
|
1974
|
+
'nasl.browser',
|
|
1975
|
+
'nasl.auth',
|
|
1976
|
+
'nasl.configuration',
|
|
1977
|
+
'nasl.process',
|
|
1978
|
+
'nasl.logging',
|
|
1979
|
+
'nasl.io',
|
|
1980
|
+
].includes(namespace) &&
|
|
1981
|
+
!namespace.includes('.overriddenLogics')
|
|
1982
|
+
) {
|
|
1983
|
+
namespace = `${namespace}.overriddenLogics`;
|
|
1984
|
+
}
|
|
1985
|
+
if (this.concept === 'OverriddenLogic') {
|
|
1986
|
+
namespace = `extensions.${this.overriddenModule}.logics`;
|
|
1987
|
+
}
|
|
1988
|
+
return namespace;
|
|
1989
|
+
}
|
|
1990
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
getTsNamespace(): string {
|
|
1994
|
+
if (this.parentNode) {
|
|
1995
|
+
const parentNamespace = (this.parentNode as any)?.getTsNamespace();
|
|
1996
|
+
const parentName = this.parentNode.tsName || this.parentNode.name;
|
|
1997
|
+
const arr = [parentNamespace];
|
|
1998
|
+
if (this.parentNode.concept !== 'App' && parentName) {
|
|
1999
|
+
arr.push(parentName);
|
|
2000
|
+
}
|
|
2001
|
+
let namespace = arr.join('.');
|
|
2002
|
+
if (
|
|
2003
|
+
![
|
|
2004
|
+
'nasl.ui',
|
|
2005
|
+
'nasl.utils',
|
|
2006
|
+
'nasl.util',
|
|
2007
|
+
'nasl.browser',
|
|
2008
|
+
'nasl.auth',
|
|
2009
|
+
'nasl.configuration',
|
|
2010
|
+
'nasl.process',
|
|
2011
|
+
'nasl.logging',
|
|
2012
|
+
'nasl.io',
|
|
2013
|
+
].includes(namespace) &&
|
|
2014
|
+
!namespace.includes('.overriddenLogics')
|
|
2015
|
+
) {
|
|
2016
|
+
namespace = `${namespace}.overriddenLogics`;
|
|
2017
|
+
}
|
|
2018
|
+
return namespace;
|
|
2019
|
+
}
|
|
2020
|
+
throw new Error('无法获取命名空间,请设置 parentNode!');
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
/**
|
|
2024
|
+
* 生成宿主语言的文件路径
|
|
2025
|
+
* @param name 一般不用传,用于 rename
|
|
2026
|
+
*/
|
|
2027
|
+
getEmbeddedFilePath(name = this.name) {
|
|
2028
|
+
let _path = this.module ? `/${this.module.parentKey}/${this.module.name}` : '';
|
|
2029
|
+
if (this.parentNode instanceof FrontendLibrary) {
|
|
2030
|
+
_path += `/frontends/${this.parentNode.type}`;
|
|
2031
|
+
}
|
|
2032
|
+
return `/embedded/${this.app.name}${_path}/overriddenLogics/${name}.ts`;
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
toEmbeddedTSFile() {
|
|
2036
|
+
let code = `namespace ${this.getTsNamespace()} {\n`;
|
|
2037
|
+
|
|
2038
|
+
const state = createCompilerState(code, { tabSize: 1 });
|
|
2039
|
+
try {
|
|
2040
|
+
code += this.toEmbeddedTS(state);
|
|
2041
|
+
} catch (err) {
|
|
2042
|
+
console.log(err, '有问题翻译失败');
|
|
2043
|
+
code += '';
|
|
2044
|
+
console.log(err);
|
|
2045
|
+
}
|
|
2046
|
+
code += '}\n';
|
|
2047
|
+
return {
|
|
2048
|
+
code,
|
|
2049
|
+
filePath: this.getEmbeddedFilePath(),
|
|
2050
|
+
sourceMap: state.sourceMap,
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
public static getDefaultOptions() {
|
|
2055
|
+
return {
|
|
2056
|
+
body: [
|
|
2057
|
+
{
|
|
2058
|
+
concept: 'Start',
|
|
2059
|
+
label: '开始',
|
|
2060
|
+
kind: 'Statement',
|
|
2061
|
+
type: 'Start',
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
concept: 'End',
|
|
2065
|
+
label: '结束',
|
|
2066
|
+
kind: 'Statement',
|
|
2067
|
+
type: 'End',
|
|
2068
|
+
},
|
|
2069
|
+
],
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
async saveStructureOfCallQueryComponents(root?: BaseNode | Logic) {
|
|
2074
|
+
if (!root) root = this;
|
|
2075
|
+
const set = new Set();
|
|
2076
|
+
utils.traverse(
|
|
2077
|
+
({ node }) => {
|
|
2078
|
+
if (node instanceof CallQueryComponent) {
|
|
2079
|
+
set.add(node);
|
|
2139
2080
|
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2081
|
+
},
|
|
2082
|
+
{ node: root },
|
|
2083
|
+
{
|
|
2084
|
+
mode: 'anyObject',
|
|
2085
|
+
excludedKeySet: new Set(['parentNode', '__assignment__']),
|
|
2086
|
+
}
|
|
2087
|
+
);
|
|
2088
|
+
for (const node of set) {
|
|
2089
|
+
(<CallQueryComponent>node).saveStructure();
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
// 通过开关设置数据库事务
|
|
2094
|
+
setTransactionEnabled(flag: boolean) {
|
|
2095
|
+
this.setTransactional(
|
|
2096
|
+
new Transactional({
|
|
2097
|
+
enabled: flag,
|
|
2098
|
+
})
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
fake: boolean;
|
|
2103
|
+
|
|
2104
|
+
getPath: () => string;
|
|
2105
|
+
|
|
2106
|
+
delete() {
|
|
2107
|
+
let actionMsg = '删除逻辑项';
|
|
2108
|
+
if (this.name) actionMsg += `“${this.name}”`;
|
|
2109
|
+
this.app?.emit('collect:start', {
|
|
2110
|
+
actionMsg,
|
|
2111
|
+
});
|
|
2112
|
+
super.delete();
|
|
2113
|
+
this.traverseChildren((el) => {
|
|
2114
|
+
if (el?.concept === 'CallQueryComponent') (el as CallQueryComponent).removeStructure();
|
|
2115
|
+
});
|
|
2116
|
+
this.app?.emit('collect:end');
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
// 是不是内部有错误
|
|
2120
|
+
haveError: boolean = false;
|
|
2121
|
+
|
|
2122
|
+
// 是否body为空
|
|
2123
|
+
isSmpty: boolean = false;
|
|
2124
|
+
|
|
2125
|
+
get pathName() {
|
|
2126
|
+
if (this.view) {
|
|
2127
|
+
return this.getEventLogicName('chinese');
|
|
2128
|
+
}
|
|
2129
|
+
const nameMap = {
|
|
2130
|
+
OnProcessStart: '流程开始时',
|
|
2131
|
+
OnTasksCreate: '任务创建时',
|
|
2132
|
+
OnTasksOpen: '任务打开时',
|
|
2133
|
+
OnTasksClose: '任务关闭时',
|
|
2134
|
+
OnCreate: '用户任务创建时',
|
|
2135
|
+
OnOpen: '用户任务打开时',
|
|
2136
|
+
OnClose: '用户任务关闭时',
|
|
2137
|
+
};
|
|
2138
|
+
const pathName = [this.name];
|
|
2139
|
+
let { parentNode } = this;
|
|
2140
|
+
while (parentNode && parentNode.concept !== 'Process') {
|
|
2141
|
+
const name = (nameMap as any)[parentNode.name] || parentNode.name;
|
|
2142
|
+
pathName.unshift(name);
|
|
2143
|
+
parentNode = parentNode.parentNode;
|
|
2144
|
+
}
|
|
2145
|
+
return pathName.join('-');
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
// 获取bindEvent下的logic的名称
|
|
2149
|
+
getEventLogicName(type?: string) {
|
|
2150
|
+
if (this.parentNode instanceof BindEvent) {
|
|
2151
|
+
if (type === 'chinese') {
|
|
2152
|
+
const bindEvent = this.parentNode;
|
|
2153
|
+
const bindChineseName = bindEvent.getPageViewEventChineseName();
|
|
2154
|
+
return `${bindChineseName}-${this.name}`;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
return this.name;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
// 虚拟输入参数列表
|
|
2161
|
+
virtualParams: Array<Param> = [];
|
|
2162
|
+
|
|
2163
|
+
get getLogicBelongTo() {
|
|
2164
|
+
const [, belongTo] = this.calleewholeKey.split('.');
|
|
2165
|
+
return belongTo;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
// 校验logic的返回值是不是有error类型
|
|
2169
|
+
static checkLogicReturnTypeHasError(logic: Logic) {
|
|
2170
|
+
let findHasError = false;
|
|
2171
|
+
if (!logic) {
|
|
2172
|
+
return findHasError;
|
|
2173
|
+
}
|
|
2174
|
+
if (logic.returns?.length && logic.returns[0]?.typeAnnotation) {
|
|
2175
|
+
// 如果新导入的logic还有Error类型
|
|
2176
|
+
const logicType = logic.returns[0].typeAnnotation;
|
|
2177
|
+
if (logicType.typeNamespace === 'nasl.ui' && logicType.typeName === 'Error') {
|
|
2178
|
+
findHasError = true;
|
|
2179
|
+
} else if (logicType.typeNamespace === 'nasl.core' && logicType.typeKind === 'union') {
|
|
2180
|
+
// 如果 logic 有 returns 而且,也有typeArguments的长度
|
|
2181
|
+
findHasError = Boolean(logicType.typeArguments?.find((item) => item?.typeNamespace === 'nasl.ui' && item?.typeName === 'Error'));
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
return findHasError;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2187
|
+
get getIsEmptyLogic() {
|
|
2188
|
+
return this.body?.filter((node) => !['Start', 'End'].includes(node?.concept))?.length <= 0;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
getOverriddenDepLogic() {
|
|
2192
|
+
const dep = this.app.dependencies?.find((dep) => dep.name === this.overriddenModule);
|
|
2193
|
+
if (dep) {
|
|
2194
|
+
const depLogic = dep?.logics?.find((l) => l.name === this.name);
|
|
2195
|
+
return depLogic || null;
|
|
2196
|
+
}
|
|
2197
|
+
return null;
|
|
2198
|
+
}
|
|
2199
|
+
//= ===============================================================================
|
|
2200
|
+
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
2201
|
+
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
2202
|
+
//= ===============================================================================
|
|
2158
2203
|
}
|
|
2159
2204
|
|
|
2160
2205
|
classMap.OverriddenLogic = OverriddenLogic;
|
|
2161
2206
|
export default OverriddenLogic;
|
|
2162
|
-
|
|
2207
|
+
//= ===============================================================================
|
|
2163
2208
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
2164
2209
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
2165
|
-
|
|
2210
|
+
//= ===============================================================================
|