@lcap/nasl 3.4.0-beta.5 → 3.4.0-beta.6
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/.nyc_output/b920244d-8d01-4e76-be5a-95132217c5a1.json +1 -0
- package/.nyc_output/processinfo/b920244d-8d01-4e76-be5a-95132217c5a1.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +461 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/automate/engine/index.html +116 -0
- package/coverage/src/automate/engine/utils.js.html +1414 -0
- package/coverage/src/bak/index.html +116 -0
- package/coverage/src/bak/translator.js.html +631 -0
- package/coverage/src/breakpoint/generator/AfterStartNode.ts.html +175 -0
- package/coverage/src/breakpoint/generator/BeforeEndNode.ts.html +169 -0
- package/coverage/src/breakpoint/generator/BreakpointNode.ts.html +1246 -0
- package/coverage/src/breakpoint/generator/CallbackNode.ts.html +145 -0
- package/coverage/src/breakpoint/generator/index.html +176 -0
- package/coverage/src/breakpoint/generator/index.ts.html +508 -0
- package/coverage/src/breakpoint/index.html +116 -0
- package/coverage/src/breakpoint/index.ts.html +94 -0
- package/coverage/src/breakpoint/shared/constants.ts.html +436 -0
- package/coverage/src/breakpoint/shared/index.html +176 -0
- package/coverage/src/breakpoint/shared/index.ts.html +94 -0
- package/coverage/src/breakpoint/shared/operations.ts.html +160 -0
- package/coverage/src/breakpoint/shared/socket.ts.html +1297 -0
- package/coverage/src/breakpoint/shared/utils.ts.html +1087 -0
- package/coverage/src/breakpoint/store/core.ts.html +1600 -0
- package/coverage/src/breakpoint/store/dock.ts.html +733 -0
- package/coverage/src/breakpoint/store/index.html +146 -0
- package/coverage/src/breakpoint/store/index.ts.html +91 -0
- package/coverage/src/common/BaseNode.ts.html +4081 -0
- package/coverage/src/common/Command.ts.html +310 -0
- package/coverage/src/common/EventEmitter.ts.html +373 -0
- package/coverage/src/common/Messager.ts.html +820 -0
- package/coverage/src/common/asyncFuncMap.ts.html +127 -0
- package/coverage/src/common/index.html +191 -0
- package/coverage/src/common/index.ts.html +94 -0
- package/coverage/src/concepts/Abort__.ts.html +331 -0
- package/coverage/src/concepts/Anchor__.ts.html +667 -0
- package/coverage/src/concepts/AnonymousFunction__.ts.html +2092 -0
- package/coverage/src/concepts/App__.ts.html +13651 -0
- package/coverage/src/concepts/Argument__.ts.html +907 -0
- package/coverage/src/concepts/Assignee__.ts.html +2317 -0
- package/coverage/src/concepts/AssignmentLine__.ts.html +430 -0
- package/coverage/src/concepts/Assignment__.ts.html +1174 -0
- package/coverage/src/concepts/Attribute__.ts.html +919 -0
- package/coverage/src/concepts/AuthInterface__.ts.html +370 -0
- package/coverage/src/concepts/AuthLogicForCallInterface__.ts.html +2011 -0
- package/coverage/src/concepts/AuthLogic__.ts.html +793 -0
- package/coverage/src/concepts/BackendVariable__.ts.html +1690 -0
- package/coverage/src/concepts/Backend__.ts.html +1192 -0
- package/coverage/src/concepts/BatchAssignment__.ts.html +3376 -0
- package/coverage/src/concepts/BinaryExpression__.ts.html +1468 -0
- package/coverage/src/concepts/BindAttribute__.ts.html +3931 -0
- package/coverage/src/concepts/BindDirective__.ts.html +2002 -0
- package/coverage/src/concepts/BindEvent__.ts.html +3487 -0
- package/coverage/src/concepts/BindStyle__.ts.html +1645 -0
- package/coverage/src/concepts/BooleanLiteral__.ts.html +421 -0
- package/coverage/src/concepts/CallAuthInterface__.ts.html +1642 -0
- package/coverage/src/concepts/CallConnector__.ts.html +925 -0
- package/coverage/src/concepts/CallFunction__.ts.html +2164 -0
- package/coverage/src/concepts/CallInterface__.ts.html +2776 -0
- package/coverage/src/concepts/CallLogic__.ts.html +4693 -0
- package/coverage/src/concepts/CallQueryComponent__.ts.html +5419 -0
- package/coverage/src/concepts/Comment__.ts.html +397 -0
- package/coverage/src/concepts/CompletionProperty__.ts.html +946 -0
- package/coverage/src/concepts/ConfigGroup__.ts.html +1132 -0
- package/coverage/src/concepts/ConfigPropertyValue__.ts.html +427 -0
- package/coverage/src/concepts/ConfigProperty__.ts.html +1375 -0
- package/coverage/src/concepts/Configuration__.ts.html +1054 -0
- package/coverage/src/concepts/Connection__.ts.html +1387 -0
- package/coverage/src/concepts/ConnectorTrigger__.ts.html +598 -0
- package/coverage/src/concepts/Connector__.ts.html +4390 -0
- package/coverage/src/concepts/Constant__.ts.html +1123 -0
- package/coverage/src/concepts/DataSource__.ts.html +1798 -0
- package/coverage/src/concepts/DatabaseTypeAnnotation__.ts.html +334 -0
- package/coverage/src/concepts/DefaultValue__.ts.html +946 -0
- package/coverage/src/concepts/Destination__.ts.html +2761 -0
- package/coverage/src/concepts/End__.ts.html +436 -0
- package/coverage/src/concepts/EntityIndex__.ts.html +799 -0
- package/coverage/src/concepts/EntityProperty__.ts.html +2866 -0
- package/coverage/src/concepts/Entity__.ts.html +3070 -0
- package/coverage/src/concepts/EnumItem__.ts.html +553 -0
- package/coverage/src/concepts/Enum__.ts.html +1258 -0
- package/coverage/src/concepts/Event__.ts.html +1111 -0
- package/coverage/src/concepts/ExternalDestination__.ts.html +1060 -0
- package/coverage/src/concepts/ForEachStatement__.ts.html +2023 -0
- package/coverage/src/concepts/FrontendLibrary__.ts.html +1762 -0
- package/coverage/src/concepts/FrontendVariable__.ts.html +292 -0
- package/coverage/src/concepts/Frontend__.ts.html +4078 -0
- package/coverage/src/concepts/Function__.ts.html +3718 -0
- package/coverage/src/concepts/Identifier__.ts.html +1060 -0
- package/coverage/src/concepts/IfStatement__.ts.html +1636 -0
- package/coverage/src/concepts/Integration__.ts.html +1273 -0
- package/coverage/src/concepts/InterfaceParam__.ts.html +1258 -0
- package/coverage/src/concepts/Interface__.ts.html +3463 -0
- package/coverage/src/concepts/JSBlock__.ts.html +424 -0
- package/coverage/src/concepts/JavaLogic__.ts.html +463 -0
- package/coverage/src/concepts/LogicItem__.ts.html +1174 -0
- package/coverage/src/concepts/Logic__.ts.html +7732 -0
- package/coverage/src/concepts/MatchCase__.ts.html +2974 -0
- package/coverage/src/concepts/Match__.ts.html +2494 -0
- package/coverage/src/concepts/MemberExpression__.ts.html +1744 -0
- package/coverage/src/concepts/MicroApp__.ts.html +439 -0
- package/coverage/src/concepts/Module__.ts.html +9385 -0
- package/coverage/src/concepts/MsgTriggerEvent__.ts.html +1072 -0
- package/coverage/src/concepts/MsgTriggerLauncher__.ts.html +1045 -0
- package/coverage/src/concepts/Namespace__.ts.html +8221 -0
- package/coverage/src/concepts/NewComposite__.ts.html +4765 -0
- package/coverage/src/concepts/NewList__.ts.html +1702 -0
- package/coverage/src/concepts/NewMap__.ts.html +2470 -0
- package/coverage/src/concepts/New__.ts.html +289 -0
- package/coverage/src/concepts/NullLiteral__.ts.html +352 -0
- package/coverage/src/concepts/NumericLiteral__.ts.html +697 -0
- package/coverage/src/concepts/OqlQueryComponent__.ts.html +1237 -0
- package/coverage/src/concepts/OverriddenLogic__.ts.html +6970 -0
- package/coverage/src/concepts/Param__.ts.html +1798 -0
- package/coverage/src/concepts/Point__.ts.html +334 -0
- package/coverage/src/concepts/ProcessComponent__.ts.html +1717 -0
- package/coverage/src/concepts/ProcessElement__.ts.html +6187 -0
- package/coverage/src/concepts/ProcessOutcome__.ts.html +355 -0
- package/coverage/src/concepts/ProcessOutcomes__.ts.html +355 -0
- package/coverage/src/concepts/Process__.ts.html +5071 -0
- package/coverage/src/concepts/QueryAggregateExpression__.ts.html +589 -0
- package/coverage/src/concepts/QueryFieldExpression__.ts.html +586 -0
- package/coverage/src/concepts/QueryFromExpression__.ts.html +937 -0
- package/coverage/src/concepts/QueryGroupByExpression__.ts.html +580 -0
- package/coverage/src/concepts/QueryJoinExpression__.ts.html +1606 -0
- package/coverage/src/concepts/QueryLimitExpression__.ts.html +664 -0
- package/coverage/src/concepts/QueryOrderByExpression__.ts.html +706 -0
- package/coverage/src/concepts/QuerySelectExpression__.ts.html +1741 -0
- package/coverage/src/concepts/Rect__.ts.html +376 -0
- package/coverage/src/concepts/Return__.ts.html +1471 -0
- package/coverage/src/concepts/Role__.ts.html +604 -0
- package/coverage/src/concepts/SelectMembers__.ts.html +1279 -0
- package/coverage/src/concepts/Slot__.ts.html +649 -0
- package/coverage/src/concepts/SqlQueryComponent__.ts.html +1003 -0
- package/coverage/src/concepts/Start__.ts.html +307 -0
- package/coverage/src/concepts/StringInterpolation__.ts.html +1156 -0
- package/coverage/src/concepts/StringLiteral__.ts.html +508 -0
- package/coverage/src/concepts/StructureProperty__.ts.html +1300 -0
- package/coverage/src/concepts/Structure__.ts.html +2182 -0
- package/coverage/src/concepts/SwitchCase__.ts.html +1204 -0
- package/coverage/src/concepts/SwitchStatement__.ts.html +904 -0
- package/coverage/src/concepts/Theme__.ts.html +361 -0
- package/coverage/src/concepts/Transactional__.ts.html +631 -0
- package/coverage/src/concepts/TriggerEvent__.ts.html +1039 -0
- package/coverage/src/concepts/TriggerLauncher__.ts.html +778 -0
- package/coverage/src/concepts/TypeAnnotation__.ts.html +3832 -0
- package/coverage/src/concepts/TypeParam__.ts.html +322 -0
- package/coverage/src/concepts/UnaryExpression__.ts.html +730 -0
- package/coverage/src/concepts/Unparsed__.ts.html +397 -0
- package/coverage/src/concepts/UseComponent__.ts.html +334 -0
- package/coverage/src/concepts/ValidationRule__.ts.html +1876 -0
- package/coverage/src/concepts/Variable__.ts.html +1705 -0
- package/coverage/src/concepts/ViewBlock__.ts.html +355 -0
- package/coverage/src/concepts/ViewComponent__.ts.html +4327 -0
- package/coverage/src/concepts/ViewElement__.ts.html +8992 -0
- package/coverage/src/concepts/View__.ts.html +9019 -0
- package/coverage/src/concepts/WhileStatement__.ts.html +1105 -0
- package/coverage/src/concepts/basics/stdlib/index.html +356 -0
- package/coverage/src/concepts/basics/stdlib/index.ts.html +208 -0
- package/coverage/src/concepts/basics/stdlib/nasl.auth.ts.html +565 -0
- package/coverage/src/concepts/basics/stdlib/nasl.browser.ts.html +517 -0
- package/coverage/src/concepts/basics/stdlib/nasl.collection.ts.html +226 -0
- package/coverage/src/concepts/basics/stdlib/nasl.configuration.ts.html +172 -0
- package/coverage/src/concepts/basics/stdlib/nasl.core.ts.html +214 -0
- package/coverage/src/concepts/basics/stdlib/nasl.event.ts.html +145 -0
- package/coverage/src/concepts/basics/stdlib/nasl.http.ts.html +589 -0
- package/coverage/src/concepts/basics/stdlib/nasl.interface.ts.html +214 -0
- package/coverage/src/concepts/basics/stdlib/nasl.io.ts.html +229 -0
- package/coverage/src/concepts/basics/stdlib/nasl.logging.ts.html +268 -0
- package/coverage/src/concepts/basics/stdlib/nasl.process.ts.html +1999 -0
- package/coverage/src/concepts/basics/stdlib/nasl.ui.ts.html +3259 -0
- package/coverage/src/concepts/basics/stdlib/nasl.util.ts.html +6955 -0
- package/coverage/src/concepts/basics/stdlib/nasl.validation.ts.html +1768 -0
- package/coverage/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts.html +163 -0
- package/coverage/src/concepts/basics/stdlib/timeZone.ts.html +664 -0
- package/coverage/src/concepts/basics/types/coreTypeList.ts.html +121 -0
- package/coverage/src/concepts/basics/types/index.html +131 -0
- package/coverage/src/concepts/basics/types/index.ts.html +160 -0
- package/coverage/src/concepts/index.html +1976 -0
- package/coverage/src/concepts/index.ts.html +103 -0
- package/coverage/src/concepts/index__.ts.html +454 -0
- package/coverage/src/config.ts.html +325 -0
- package/coverage/src/decorators/index.html +131 -0
- package/coverage/src/decorators/index.ts.html +583 -0
- package/coverage/src/decorators/promise.ts.html +169 -0
- package/coverage/src/eventBus.ts.html +100 -0
- package/coverage/src/generator/compileComponent.ts.html +142 -0
- package/coverage/src/generator/genBundleFiles.ts.html +1828 -0
- package/coverage/src/generator/genHash.ts.html +124 -0
- package/coverage/src/generator/genMetaData.ts.html +1084 -0
- package/coverage/src/generator/genReleaseBody.ts.html +1282 -0
- package/coverage/src/generator/icestark.ts.html +220 -0
- package/coverage/src/generator/index.html +266 -0
- package/coverage/src/generator/index.ts.html +106 -0
- package/coverage/src/generator/microApp.ts.html +172 -0
- package/coverage/src/generator/permission.ts.html +1036 -0
- package/coverage/src/generator/qiankun.ts.html +232 -0
- package/coverage/src/generator/styleReplacer.ts.html +199 -0
- package/coverage/src/index.html +146 -0
- package/coverage/src/index.ts.html +124 -0
- package/coverage/src/manager/diagnostic.ts.html +442 -0
- package/coverage/src/manager/index.html +131 -0
- package/coverage/src/manager/stepRecorder.ts.html +457 -0
- package/coverage/src/natural/genNaturalTS.ts.html +355 -0
- package/coverage/src/natural/index.html +161 -0
- package/coverage/src/natural/index.ts.html +91 -0
- package/coverage/src/natural/naslStdlibMap.ts.html +157 -0
- package/coverage/src/natural/transformTSCode.ts.html +2707 -0
- package/coverage/src/sentry/index.html +116 -0
- package/coverage/src/sentry/index.ts.html +676 -0
- package/coverage/src/server/createUiTs.ts.html +919 -0
- package/coverage/src/server/entity2LogicNamespace.ts.html +1294 -0
- package/coverage/src/server/event.js.html +526 -0
- package/coverage/src/server/extendBaseNode.ts.html +1762 -0
- package/coverage/src/server/formatTsUtils.ts.html +2689 -0
- package/coverage/src/server/getConnector.ts.html +316 -0
- package/coverage/src/server/getExtensionModules.ts.html +178 -0
- package/coverage/src/server/getFunctions.ts.html +133 -0
- package/coverage/src/server/getInterfaces.ts.html +229 -0
- package/coverage/src/server/getLogging.ts.html +100 -0
- package/coverage/src/server/getLogics.ts.html +1363 -0
- package/coverage/src/server/getMemberIdentifier.ts.html +1606 -0
- package/coverage/src/server/getProcessComponents.ts.html +112 -0
- package/coverage/src/server/getProcesses.ts.html +2023 -0
- package/coverage/src/server/getValidates.ts.html +115 -0
- package/coverage/src/server/index.html +401 -0
- package/coverage/src/server/index.ts.html +229 -0
- package/coverage/src/server/naslServer.ts.html +14356 -0
- package/coverage/src/server/naslStdlibMap.ts.html +241 -0
- package/coverage/src/server/process2LogicNamespace.ts.html +454 -0
- package/coverage/src/server/translator.ts.html +2566 -0
- package/coverage/src/service/creator/add.configs.js.html +397 -0
- package/coverage/src/service/creator/errHandles.js.html +304 -0
- package/coverage/src/service/creator/index.html +146 -0
- package/coverage/src/service/creator/index.js.html +352 -0
- package/coverage/src/service/datasource/api.js.html +118 -0
- package/coverage/src/service/datasource/index.html +131 -0
- package/coverage/src/service/datasource/index.js.html +103 -0
- package/coverage/src/service/logic/api.js.html +109 -0
- package/coverage/src/service/logic/index.html +131 -0
- package/coverage/src/service/logic/index.js.html +103 -0
- package/coverage/src/service/storage/api.js.html +202 -0
- package/coverage/src/service/storage/index.html +206 -0
- package/coverage/src/service/storage/index.ts.html +103 -0
- package/coverage/src/service/storage/init.ts.html +3721 -0
- package/coverage/src/service/storage/jsoner.ts.html +502 -0
- package/coverage/src/service/storage/map.ts.html +256 -0
- package/coverage/src/service/storage/service.ts.html +331 -0
- package/coverage/src/service/storage/storagePoint.ts.html +304 -0
- package/coverage/src/templator/genCallComponentLogic.ts.html +163 -0
- package/coverage/src/templator/genCreateBlock.ts.html +1093 -0
- package/coverage/src/templator/genCurdEditMultipleKeyBlock.ts.html +1609 -0
- package/coverage/src/templator/genCurdMultipleKeyBlock.ts.html +2254 -0
- package/coverage/src/templator/genEditTableBlock.ts.html +1021 -0
- package/coverage/src/templator/genEnumSelectBlock.ts.html +178 -0
- package/coverage/src/templator/genGetBlock.ts.html +451 -0
- package/coverage/src/templator/genGridViewBlock.ts.html +1114 -0
- package/coverage/src/templator/genListViewBlock.ts.html +475 -0
- package/coverage/src/templator/genQueryComponent.ts.html +1207 -0
- package/coverage/src/templator/genSelectBlock.ts.html +1243 -0
- package/coverage/src/templator/genTableBlock.ts.html +973 -0
- package/coverage/src/templator/genUpdateBlock.ts.html +1192 -0
- package/coverage/src/templator/index.html +326 -0
- package/coverage/src/templator/index.ts.html +154 -0
- package/coverage/src/templator/utils.ts.html +1861 -0
- package/coverage/src/translator/constant.ts.html +106 -0
- package/coverage/src/translator/index.html +146 -0
- package/coverage/src/translator/index.ts.html +94 -0
- package/coverage/src/translator/utils.ts.html +436 -0
- package/coverage/src/utils/cookie.ts.html +265 -0
- package/coverage/src/utils/env.ts.html +91 -0
- package/coverage/src/utils/index.html +236 -0
- package/coverage/src/utils/index.ts.html +694 -0
- package/coverage/src/utils/logger.ts.html +145 -0
- package/coverage/src/utils/sortTsString.ts.html +187 -0
- package/coverage/src/utils/string.ts.html +400 -0
- package/coverage/src/utils/time-slicing.ts.html +418 -0
- package/coverage/src/utils/traverse.ts.html +568 -0
- package/coverage/src/utils/window.ts.html +112 -0
- package/out/bak/translator.js +2 -19
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.d.ts +11 -0
- package/out/common/BaseNode.js +57 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/common/index.d.ts +1 -0
- package/out/common/index.js +1 -0
- package/out/common/index.js.map +1 -1
- package/out/common/utils.d.ts +2 -0
- package/out/common/utils.js +18 -0
- package/out/common/utils.js.map +1 -0
- package/out/concepts/Abort__.d.ts +2 -2
- package/out/concepts/Abort__.js +6 -2
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/Anchor__.d.ts +2 -2
- package/out/concepts/Anchor__.js +5 -4
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +3 -3
- package/out/concepts/AnonymousFunction__.js +19 -15
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/Argument__.d.ts +2 -2
- package/out/concepts/Argument__.js +12 -13
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.d.ts +2 -2
- package/out/concepts/Assignee__.js +11 -9
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +2 -2
- package/out/concepts/AssignmentLine__.js +3 -2
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.d.ts +2 -2
- package/out/concepts/Assignment__.js +13 -29
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/AuthInterface__.js +1 -1
- package/out/concepts/AuthInterface__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.d.ts +2 -2
- package/out/concepts/AuthLogicForCallInterface__.js +56 -75
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts +5 -8
- package/out/concepts/BackendVariable__.js +47 -29
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.d.ts +4 -7
- package/out/concepts/Backend__.js +7 -6
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts +2 -2
- package/out/concepts/BatchAssignment__.js +19 -20
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +2 -2
- package/out/concepts/BinaryExpression__.js +37 -38
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +4 -4
- package/out/concepts/BindAttribute__.js +39 -32
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +2 -2
- package/out/concepts/BindDirective__.js +10 -8
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +4 -7
- package/out/concepts/BindEvent__.js +20 -18
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +2 -2
- package/out/concepts/BindStyle__.js +9 -7
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/Block__.d.ts +6 -2
- package/out/concepts/Block__.js +36 -5
- package/out/concepts/Block__.js.map +1 -1
- package/out/concepts/BooleanLiteral__.d.ts +2 -2
- package/out/concepts/BooleanLiteral__.js +2 -2
- package/out/concepts/BooleanLiteral__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.d.ts +3 -2
- package/out/concepts/CallAuthInterface__.js +46 -30
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallConnector__.d.ts +2 -2
- package/out/concepts/CallConnector__.js +25 -23
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +2 -2
- package/out/concepts/CallFunction__.js +19 -16
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +3 -2
- package/out/concepts/CallInterface__.js +16 -6
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +2 -3
- package/out/concepts/CallLogic__.js +26 -20
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +4 -4
- package/out/concepts/CallQueryComponent__.js +38 -36
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Comment__.d.ts +2 -2
- package/out/concepts/Comment__.js +3 -2
- package/out/concepts/Comment__.js.map +1 -1
- package/out/concepts/ConfigProperty__.d.ts +4 -7
- package/out/concepts/ConfigProperty__.js +12 -10
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +4 -7
- package/out/concepts/Connection__.js +6 -5
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.d.ts +3 -3
- package/out/concepts/Constant__.js +38 -13
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +4 -7
- package/out/concepts/DataSource__.js +7 -6
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/DefaultValue__.d.ts +6 -2
- package/out/concepts/DefaultValue__.js +11 -3
- package/out/concepts/DefaultValue__.js.map +1 -1
- package/out/concepts/Destination__.d.ts +3 -3
- package/out/concepts/Destination__.js +29 -26
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.d.ts +2 -2
- package/out/concepts/End__.js +17 -13
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityIndex__.d.ts +2 -2
- package/out/concepts/EntityIndex__.js +4 -3
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +2 -2
- package/out/concepts/EntityProperty__.js +9 -8
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +4 -7
- package/out/concepts/Entity__.js +22 -22
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +2 -2
- package/out/concepts/EnumItem__.js +4 -3
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +4 -7
- package/out/concepts/Enum__.js +10 -8
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ExternalDestination__.d.ts +2 -2
- package/out/concepts/ExternalDestination__.js +7 -5
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.d.ts +2 -2
- package/out/concepts/ForEachStatement__.js +14 -12
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts +4 -7
- package/out/concepts/Frontend__.js +7 -6
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.d.ts +3 -3
- package/out/concepts/Function__.js +22 -18
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -2
- package/out/concepts/Identifier__.js +19 -23
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.d.ts +2 -2
- package/out/concepts/IfStatement__.js +12 -10
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/ImportedInterface__.d.ts +20 -0
- package/out/concepts/ImportedInterface__.js +57 -0
- package/out/concepts/ImportedInterface__.js.map +1 -0
- package/out/concepts/InterfaceParam__.d.ts +2 -7
- package/out/concepts/InterfaceParam__.js +33 -14
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +7 -15
- package/out/concepts/Interface__.js +33 -43
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.d.ts +2 -2
- package/out/concepts/JSBlock__.js +3 -58
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/JavaLogic__.d.ts +2 -2
- package/out/concepts/JavaLogic__.js +6 -2
- package/out/concepts/JavaLogic__.js.map +1 -1
- package/out/concepts/LogicItem__.d.ts +2 -2
- package/out/concepts/LogicItem__.js +7 -13
- package/out/concepts/LogicItem__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +8 -11
- package/out/concepts/Logic__.js +124 -157
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +23 -22
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.d.ts +2 -2
- package/out/concepts/Match__.js +24 -22
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +2 -2
- package/out/concepts/MemberExpression__.js +28 -24
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.d.ts +4 -7
- package/out/concepts/MetadataType__.js +11 -9
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/Module__.d.ts +8 -179
- package/out/concepts/Module__.js +124 -265
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +5 -5
- package/out/concepts/NewComposite__.js +75 -76
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +5 -5
- package/out/concepts/NewList__.js +30 -26
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +4 -4
- package/out/concepts/NewMap__.js +39 -35
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/New__.d.ts +2 -2
- package/out/concepts/New__.js +3 -2
- package/out/concepts/New__.js.map +1 -1
- package/out/concepts/NullLiteral__.d.ts +2 -2
- package/out/concepts/NullLiteral__.js +2 -2
- package/out/concepts/NullLiteral__.js.map +1 -1
- package/out/concepts/NumericLiteral__.d.ts +2 -2
- package/out/concepts/NumericLiteral__.js +6 -5
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +2 -2
- package/out/concepts/OqlQueryComponent__.js +16 -14
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +8 -11
- package/out/concepts/OverriddenLogic__.js +99 -112
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.d.ts +3 -3
- package/out/concepts/Param__.js +24 -30
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +2 -2
- package/out/concepts/ProcessElement__.js +54 -68
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +2 -1
- package/out/concepts/ProcessOutcome__.js +5 -4
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +2 -1
- package/out/concepts/ProcessOutcomes__.js +6 -5
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.d.ts +4 -7
- package/out/concepts/Process__.js +35 -52
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.d.ts +2 -2
- package/out/concepts/QueryAggregateExpression__.js +2 -2
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFieldExpression__.d.ts +2 -2
- package/out/concepts/QueryFieldExpression__.js +5 -4
- package/out/concepts/QueryFieldExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.d.ts +2 -2
- package/out/concepts/QueryFromExpression__.js +8 -6
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.d.ts +2 -1
- package/out/concepts/QueryGroupByExpression__.js +6 -5
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.d.ts +2 -2
- package/out/concepts/QueryJoinExpression__.js +12 -10
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.d.ts +2 -2
- package/out/concepts/QueryLimitExpression__.js +6 -5
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.d.ts +2 -2
- package/out/concepts/QueryOrderByExpression__.js +6 -5
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +3 -3
- package/out/concepts/Return__.js +41 -24
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Role__.d.ts +4 -7
- package/out/concepts/Role__.js +7 -6
- package/out/concepts/Role__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +2 -2
- package/out/concepts/SelectMembers__.js +3 -2
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +2 -2
- package/out/concepts/SqlQueryComponent__.js +12 -10
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Start__.d.ts +2 -2
- package/out/concepts/Start__.js +2 -2
- package/out/concepts/Start__.js.map +1 -1
- package/out/concepts/StringInterpolation__.d.ts +2 -2
- package/out/concepts/StringInterpolation__.js +7 -5
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts +2 -2
- package/out/concepts/StringLiteral__.js +12 -6
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +2 -2
- package/out/concepts/StructureProperty__.js +6 -5
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +4 -7
- package/out/concepts/Structure__.js +15 -15
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.d.ts +2 -2
- package/out/concepts/SwitchCase__.js +12 -10
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.d.ts +2 -2
- package/out/concepts/SwitchStatement__.js +8 -6
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerLauncher__.d.ts +4 -7
- package/out/concepts/TriggerLauncher__.js +7 -6
- package/out/concepts/TriggerLauncher__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +2 -2
- package/out/concepts/TypeAnnotation__.js +51 -25
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +2 -2
- package/out/concepts/TypeParam__.js +4 -3
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/UnaryExpression__.d.ts +2 -2
- package/out/concepts/UnaryExpression__.js +12 -7
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/Unparsed__.d.ts +2 -2
- package/out/concepts/Unparsed__.js +2 -2
- package/out/concepts/Unparsed__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +2 -2
- package/out/concepts/ValidationRule__.js +11 -9
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +5 -8
- package/out/concepts/Variable__.js +49 -32
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +6 -6
- package/out/concepts/ViewElement__.js +110 -137
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +6 -9
- package/out/concepts/View__.js +76 -84
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.d.ts +2 -2
- package/out/concepts/WhileStatement__.js +9 -7
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/index__.d.ts +1 -1
- package/out/concepts/index__.js +1 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/concepts/types__.d.ts +1 -3
- package/out/decorators/index.js +10 -9
- package/out/decorators/index.js.map +1 -1
- package/out/generator/genMetaData.js +0 -7
- package/out/generator/genMetaData.js.map +1 -1
- package/out/manager/diagnostic.d.ts +1 -1
- package/out/manager/diagnostic.js +2 -3
- package/out/manager/diagnostic.js.map +1 -1
- package/out/server/extendBaseNode.js +7 -24
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getConnector.js +8 -3
- package/out/server/getConnector.js.map +1 -1
- package/out/server/getLogics.js +13 -3
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.d.ts +44 -46
- package/out/server/naslServer.js +333 -461
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +1 -1
- package/out/server/translator.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -9
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +12 -18
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +8 -10
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +2 -3
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +9 -12
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.js.map +1 -1
- package/out/translator/types.d.ts +16 -3
- package/out/translator/utils.d.ts +19 -1
- package/out/translator/utils.js +90 -2
- package/out/translator/utils.js.map +1 -1
- package/out/utils/time-slicing/constant.d.ts +35 -0
- package/out/utils/time-slicing/constant.js +40 -0
- package/out/utils/time-slicing/constant.js.map +1 -0
- package/out/utils/time-slicing/controller.d.ts +53 -0
- package/out/utils/time-slicing/controller.js +280 -0
- package/out/utils/time-slicing/controller.js.map +1 -0
- package/out/utils/time-slicing/index.d.ts +5 -0
- package/out/utils/time-slicing/index.js +26 -0
- package/out/utils/time-slicing/index.js.map +1 -0
- package/out/utils/time-slicing/page-state.d.ts +2 -0
- package/out/utils/time-slicing/page-state.js +14 -0
- package/out/utils/time-slicing/page-state.js.map +1 -0
- package/out/utils/time-slicing/performance.d.ts +11 -0
- package/out/utils/time-slicing/performance.js +51 -0
- package/out/utils/time-slicing/performance.js.map +1 -0
- package/out/utils/time-slicing/runner.d.ts +12 -0
- package/out/utils/time-slicing/runner.js +53 -0
- package/out/utils/time-slicing/runner.js.map +1 -0
- package/out/utils/time-slicing/tool.d.ts +24 -0
- package/out/utils/time-slicing/tool.js +47 -0
- package/out/utils/time-slicing/tool.js.map +1 -0
- package/out/utils/time-slicing/utils.d.ts +62 -0
- package/out/utils/time-slicing/utils.js +47 -0
- package/out/utils/time-slicing/utils.js.map +1 -0
- package/out/utils/time-slicing/wrapper.d.ts +18 -0
- package/out/utils/time-slicing/wrapper.js +55 -0
- package/out/utils/time-slicing/wrapper.js.map +1 -0
- package/out/utils/types.d.ts +7 -0
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.core.ts +0 -2
- package/sandbox/stdlib/nasl.util.ts +1 -1
- package/src/bak/translator.js +2 -17
- package/src/common/BaseNode.ts +73 -7
- package/src/common/index.ts +1 -0
- package/src/common/utils.ts +17 -0
- package/src/concepts/Abort__.ts +12 -3
- package/src/concepts/Anchor__.ts +15 -5
- package/src/concepts/AnonymousFunction__.ts +29 -23
- package/src/concepts/Argument__.ts +25 -14
- package/src/concepts/Assignee__.ts +21 -10
- package/src/concepts/AssignmentLine__.ts +13 -3
- package/src/concepts/Assignment__.ts +33 -42
- package/src/concepts/AuthInterface__.ts +3 -3
- package/src/concepts/AuthLogicForCallInterface__.ts +63 -84
- package/src/concepts/BackendVariable__.ts +35 -30
- package/src/concepts/Backend__.ts +24 -7
- package/src/concepts/BatchAssignment__.ts +30 -21
- package/src/concepts/BinaryExpression__.ts +47 -38
- package/src/concepts/BindAttribute__.ts +43 -39
- package/src/concepts/BindDirective__.ts +19 -9
- package/src/concepts/BindEvent__.ts +31 -26
- package/src/concepts/BindStyle__.ts +18 -8
- package/src/concepts/Block__.ts +22 -6
- package/src/concepts/BooleanLiteral__.ts +11 -3
- package/src/concepts/CallAuthInterface__.ts +58 -33
- package/src/concepts/CallConnector__.ts +34 -26
- package/src/concepts/CallFunction__.ts +22 -17
- package/src/concepts/CallInterface__.ts +30 -12
- package/src/concepts/CallLogic__.ts +46 -47
- package/src/concepts/CallQueryComponent__.ts +48 -46
- package/src/concepts/Comment__.ts +13 -3
- package/src/concepts/ConfigProperty__.ts +22 -12
- package/src/concepts/Connection__.ts +22 -6
- package/src/concepts/Connector__.ts +1 -1
- package/src/concepts/Constant__.ts +24 -14
- package/src/concepts/DataSource__.ts +16 -7
- package/src/concepts/DefaultValue__.ts +13 -4
- package/src/concepts/Destination__.ts +39 -33
- package/src/concepts/End__.ts +24 -15
- package/src/concepts/EntityIndex__.ts +13 -4
- package/src/concepts/EntityProperty__.ts +20 -10
- package/src/concepts/Entity__.ts +34 -27
- package/src/concepts/EnumItem__.ts +13 -4
- package/src/concepts/Enum__.ts +21 -10
- package/src/concepts/ExternalDestination__.ts +16 -7
- package/src/concepts/ForEachStatement__.ts +24 -14
- package/src/concepts/Frontend__.ts +18 -7
- package/src/concepts/Function__.ts +30 -21
- package/src/concepts/Identifier__.ts +32 -34
- package/src/concepts/IfStatement__.ts +22 -14
- package/src/concepts/ImportedInterface__.ts +61 -0
- package/src/concepts/InterfaceParam__.ts +19 -16
- package/src/concepts/Interface__.ts +45 -51
- package/src/concepts/JSBlock__.ts +12 -61
- package/src/concepts/JavaLogic__.ts +13 -3
- package/src/concepts/LogicItem__.ts +13 -14
- package/src/concepts/Logic__.ts +147 -172
- package/src/concepts/MatchCase__.ts +33 -27
- package/src/concepts/Match__.ts +34 -26
- package/src/concepts/MemberExpression__.ts +37 -25
- package/src/concepts/MetadataType__.ts +22 -10
- package/src/concepts/Module__.ts +177 -540
- package/src/concepts/NewComposite__.ts +86 -80
- package/src/concepts/NewList__.ts +40 -32
- package/src/concepts/NewMap__.ts +49 -42
- package/src/concepts/New__.ts +13 -3
- package/src/concepts/NullLiteral__.ts +11 -3
- package/src/concepts/NumericLiteral__.ts +15 -6
- package/src/concepts/OqlQueryComponent__.ts +26 -18
- package/src/concepts/OverriddenLogic__.ts +117 -125
- package/src/concepts/Param__.ts +42 -38
- package/src/concepts/ProcessElement__.ts +67 -79
- package/src/concepts/ProcessOutcome__.ts +14 -6
- package/src/concepts/ProcessOutcomes__.ts +15 -7
- package/src/concepts/Process__.ts +50 -61
- package/src/concepts/QueryAggregateExpression__.ts +11 -3
- package/src/concepts/QueryFieldExpression__.ts +14 -5
- package/src/concepts/QueryFromExpression__.ts +18 -7
- package/src/concepts/QueryGroupByExpression__.ts +14 -6
- package/src/concepts/QueryJoinExpression__.ts +22 -11
- package/src/concepts/QueryLimitExpression__.ts +16 -6
- package/src/concepts/QueryOrderByExpression__.ts +17 -6
- package/src/concepts/Return__.ts +27 -25
- package/src/concepts/Role__.ts +17 -8
- package/src/concepts/SelectMembers__.ts +13 -3
- package/src/concepts/SqlQueryComponent__.ts +22 -11
- package/src/concepts/Start__.ts +11 -3
- package/src/concepts/StringInterpolation__.ts +10 -5
- package/src/concepts/StringLiteral__.ts +20 -7
- package/src/concepts/StructureProperty__.ts +16 -6
- package/src/concepts/Structure__.ts +26 -18
- package/src/concepts/SwitchCase__.ts +22 -14
- package/src/concepts/SwitchStatement__.ts +17 -7
- package/src/concepts/TriggerLauncher__.ts +17 -7
- package/src/concepts/TypeAnnotation__.ts +36 -26
- package/src/concepts/TypeParam__.ts +13 -4
- package/src/concepts/UnaryExpression__.ts +22 -9
- package/src/concepts/Unparsed__.ts +11 -3
- package/src/concepts/ValidationRule__.ts +21 -17
- package/src/concepts/Variable__.ts +37 -33
- package/src/concepts/ViewElement__.ts +128 -156
- package/src/concepts/View__.ts +101 -101
- package/src/concepts/WhileStatement__.ts +19 -10
- package/src/concepts/index__.ts +1 -1
- package/src/concepts/types__.ts +1 -5
- package/src/decorators/index.ts +10 -9
- package/src/generator/genMetaData.ts +2 -12
- package/src/manager/diagnostic.ts +3 -4
- package/src/server/extendBaseNode.ts +8 -24
- package/src/server/getConnector.ts +8 -3
- package/src/server/getLogics.ts +15 -3
- package/src/server/naslServer.ts +717 -749
- package/src/server/translator.ts +1 -1
- package/src/templator/genCreateBlock.ts +5 -9
- package/src/templator/genCurdEditMultipleKeyBlock.ts +13 -19
- package/src/templator/genCurdMultipleKeyBlock.ts +11 -14
- package/src/templator/genEditTableBlock.ts +2 -4
- package/src/templator/genUpdateBlock.ts +12 -15
- package/src/templator/utils.ts +7 -8
- package/src/translator/types.ts +20 -5
- package/src/translator/utils.ts +100 -5
- package/src/utils/time-slicing/constant.ts +37 -0
- package/src/utils/time-slicing/controller.ts +342 -0
- package/src/utils/time-slicing/index.ts +6 -0
- package/src/utils/time-slicing/page-state.ts +12 -0
- package/src/utils/time-slicing/performance.ts +56 -0
- package/src/utils/time-slicing/runner.ts +54 -0
- package/src/utils/time-slicing/tool.ts +45 -0
- package/src/utils/time-slicing/utils.ts +90 -0
- package/src/utils/time-slicing/wrapper.ts +58 -0
- package/src/utils/types.ts +9 -0
- package/test/concepts/anonymous-function/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/assignment/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/batch-assignment/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/binary-expression/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
- package/test/concepts/binary-expression/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/boolean-literal/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-function/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-interface/__snapshots__/toJS.spec.ts.snap +3 -3
- package/test/concepts/call-interface/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/call-logic/__snapshots__/toJS.spec.ts.snap +5 -5
- package/test/concepts/call-logic/getQuickInfoOffset.spec.ts +2 -1
- package/test/concepts/call-logic/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/data-source/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/data-source/toEmbeddedTSFile.spec.ts +2 -1
- package/test/concepts/entity/__snapshots__/toEmbeddedTS.spec.ts.snap +19 -19
- package/test/concepts/entity/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/identifier/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/match/__snapshots__/toJS.spec.ts.snap +1 -1
- package/test/concepts/match/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/member-expression/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/null-literal/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/numeric-literal/__snapshots__/toJS.spec.ts.snap +1 -1
- package/test/concepts/numeric-literal/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/string-literal/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +3 -3
- package/test/concepts/validation-rule/toEmbeddedTS.spec.ts +2 -1
- package/test/concepts/validation-rule/validation-rule.spec.ts +2 -1
- package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
- package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +0 -4
- package/test/concepts/view-element/toEmbeddedTS.spec.ts +2 -1
- package/test/time-slicing/runner.spec.ts +28 -0
- package/test/time-slicing/time-slicing-nodejs.spec.ts +27 -0
- package/test/time-slicing/utils.ts +7 -0
- package/test/time-slicing/wrapper.spec.ts +92 -0
- package/ts-worker/lib/tsserver.js +10 -1
- package/ts-worker/package.json +1 -0
- package/ts-worker/src/index.js +13 -12
- package/ts-worker/webpack.config.js +1 -1
- package/out/concepts/InterfaceFromExample__.d.ts +0 -88
- package/out/concepts/InterfaceFromExample__.js +0 -183
- package/out/concepts/InterfaceFromExample__.js.map +0 -1
- package/out/utils/time-slicing.d.ts +0 -41
- package/out/utils/time-slicing.js +0 -82
- package/out/utils/time-slicing.js.map +0 -1
- package/src/concepts/InterfaceFromExample__.ts +0 -205
- package/src/utils/time-slicing.ts +0 -111
package/src/server/naslServer.ts
CHANGED
|
@@ -79,17 +79,17 @@ import {
|
|
|
79
79
|
CallAuthInterface,
|
|
80
80
|
Connector,
|
|
81
81
|
AuthInterface,
|
|
82
|
-
SyntaxNode,
|
|
83
82
|
Connection,
|
|
84
83
|
TriggerLauncher,
|
|
85
84
|
CallConnector,
|
|
86
85
|
DefaultValue,
|
|
87
86
|
I18nInfo,
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
MetadataType,
|
|
88
|
+
UnaryExpression,
|
|
89
|
+
SyntaxNode,
|
|
90
90
|
} from '../concepts';
|
|
91
91
|
|
|
92
|
-
import { lsp2tspNumber, SourceMap, SourceMapItem, isSameRange } from '../translator';
|
|
92
|
+
import { lsp2tspNumber, SourceMap, SourceMapItem, isSameRange, Range } from '../translator';
|
|
93
93
|
import axios from '../service/storage';
|
|
94
94
|
import { translateDiagnosticMessage, naslNodeTranslateMessage, MinRange, checkAStructure_ } from './translator';
|
|
95
95
|
import { EventPayload, invokeCommand, registerCommand } from '../common';
|
|
@@ -104,7 +104,6 @@ import { EventEmitter } from '../common/EventEmitter';
|
|
|
104
104
|
|
|
105
105
|
import { traverse } from '../utils';
|
|
106
106
|
import { withQueueExecute } from '../decorators';
|
|
107
|
-
|
|
108
107
|
import { getNodeByNodeCallee } from '../automate/engine/utils';
|
|
109
108
|
|
|
110
109
|
const EmbeddedTSFileLineMap: { [name: string]: number } = {
|
|
@@ -123,11 +122,7 @@ const SentryMessager = sentryMonitorTSWorkerMessager(Messager);
|
|
|
123
122
|
|
|
124
123
|
export interface FileNode extends BaseNode {
|
|
125
124
|
getEmbeddedFilePath(name?: string): string;
|
|
126
|
-
toEmbeddedTSFile():
|
|
127
|
-
filePath: string;
|
|
128
|
-
code: string;
|
|
129
|
-
sourceMap: SourceMap;
|
|
130
|
-
};
|
|
125
|
+
toEmbeddedTSFile(): utils.EmbeddedTSFileGenerator;
|
|
131
126
|
}
|
|
132
127
|
|
|
133
128
|
interface RenameMinRange extends MinRange {
|
|
@@ -144,6 +139,7 @@ interface QuoteNode {
|
|
|
144
139
|
|
|
145
140
|
// 批量查找节点位置的节点信息类型
|
|
146
141
|
type QuickInfoNodes = Array<{ filePath: string; node: BaseNode; item: SourceMapItem }>;
|
|
142
|
+
type QuickInfoMap = Map<BaseNode, TypeAnnotation | { typeAnnotation: TypeAnnotation; option: any }>;
|
|
147
143
|
|
|
148
144
|
let isChangeInterface = false; // 判断是否导入接口
|
|
149
145
|
type ActionNode = { target: Variable; typeannotation: TypeAnnotation };
|
|
@@ -188,7 +184,6 @@ export function getDisplayString2Type(displayString: string) {
|
|
|
188
184
|
return typeList;
|
|
189
185
|
}
|
|
190
186
|
|
|
191
|
-
|
|
192
187
|
function isCoreDateTimeType(n : Argument): boolean {
|
|
193
188
|
return n?.expression?.__TypeAnnotation?.typeName === 'DateTime' &&
|
|
194
189
|
n?.expression?.__TypeAnnotation?.typeNamespace === 'nasl.core';
|
|
@@ -199,7 +194,6 @@ function isFunctionWithFixedTimeZoneParam(calleeName : string): boolean {
|
|
|
199
194
|
return fns.includes(calleeName);
|
|
200
195
|
}
|
|
201
196
|
|
|
202
|
-
|
|
203
197
|
const timeZoneArgumentIndexMap = new Map<string, number>([
|
|
204
198
|
['ToString', 1],
|
|
205
199
|
['CurrDateTime', 0],
|
|
@@ -284,7 +278,7 @@ class NaslServer {
|
|
|
284
278
|
handleMessage: async ({ data }: any) => {
|
|
285
279
|
if (data && data.event === 'publishDiagnostics') {
|
|
286
280
|
const records = await this._resolveDiagnosticRecords(data.records);
|
|
287
|
-
this.diagnosticManager.pushAll(records);
|
|
281
|
+
await this.diagnosticManager.pushAll(records);
|
|
288
282
|
try {
|
|
289
283
|
// 结束诊断和标注
|
|
290
284
|
invokeCommand('naslServer:endWork');
|
|
@@ -380,308 +374,145 @@ class NaslServer {
|
|
|
380
374
|
await this.getDiagnosticRecordsAndPushAll();
|
|
381
375
|
}
|
|
382
376
|
|
|
383
|
-
contentToFile(module: Module | App | Connector
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
module.structures.forEach((structure) => {
|
|
389
|
-
try {
|
|
390
|
-
const result = structure.toEmbeddedTSFile();
|
|
391
|
-
results.push(result);
|
|
392
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
393
|
-
structure.sourceMap = result.sourceMap;
|
|
394
|
-
this.file2NodeMap.set(result.filePath, structure);
|
|
395
|
-
} catch (err) {}
|
|
396
|
-
});
|
|
397
|
-
module.metadataTypes?.forEach((metadataType) => {
|
|
398
|
-
try {
|
|
399
|
-
const result = metadataType.toEmbeddedTSFile();
|
|
400
|
-
results.push(result);
|
|
401
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
402
|
-
metadataType.sourceMap = result.sourceMap;
|
|
403
|
-
this.file2NodeMap.set(result.filePath, metadataType);
|
|
404
|
-
} catch (err) {}
|
|
405
|
-
});
|
|
406
|
-
if (module instanceof App) {
|
|
407
|
-
module.overriddenLogics?.forEach?.((logic) => {
|
|
408
|
-
try {
|
|
409
|
-
if (!(logic instanceof OverriddenLogic)) return;
|
|
410
|
-
const result = logic.toEmbeddedTSFile();
|
|
411
|
-
results.push(result);
|
|
412
|
-
logic.sourceMap = result.sourceMap;
|
|
413
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
414
|
-
} catch (err) {
|
|
415
|
-
console.error('err: ', err);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
module?.backend?.variables?.forEach((backdndVariable) => {
|
|
419
|
-
try {
|
|
420
|
-
const result = backdndVariable.toEmbeddedTSFile();
|
|
421
|
-
results.push(result);
|
|
422
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
423
|
-
backdndVariable.sourceMap = result.sourceMap;
|
|
424
|
-
this.file2NodeMap.set(result.filePath, backdndVariable);
|
|
425
|
-
} catch (err) {
|
|
426
|
-
console.error(err);
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
module.frontends?.forEach((frontend) => {
|
|
430
|
-
try {
|
|
431
|
-
const result = frontend.toEmbeddedTSFile();
|
|
432
|
-
results.push(result);
|
|
433
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
434
|
-
frontend.sourceMap = result.sourceMap;
|
|
435
|
-
this.file2NodeMap.set(result.filePath, frontend);
|
|
436
|
-
} catch (err) {
|
|
437
|
-
console.log(err);
|
|
438
|
-
}
|
|
439
|
-
frontend.variables?.forEach((frontendVariable) => {
|
|
440
|
-
try {
|
|
441
|
-
const result = frontendVariable.toEmbeddedTSFile();
|
|
442
|
-
results.push(result);
|
|
443
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
444
|
-
frontendVariable.sourceMap = result.sourceMap;
|
|
445
|
-
this.file2NodeMap.set(result.filePath, frontendVariable);
|
|
446
|
-
} catch (err) {
|
|
447
|
-
console.log(err);
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
frontend.bindEvents?.forEach((bindEvent) => {
|
|
451
|
-
if (bindEvent?.logics && bindEvent?.logics?.length > 0) {
|
|
452
|
-
bindEvent.logics.forEach((logic: Logic) => {
|
|
453
|
-
try {
|
|
454
|
-
const result = logic.toEmbeddedTSFile();
|
|
455
|
-
results.push(result);
|
|
456
|
-
logic.sourceMap = result.sourceMap;
|
|
457
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
458
|
-
} catch (err) {
|
|
459
|
-
console.error('err: ', err);
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
// view的生成
|
|
465
|
-
if (!config.closeViews) {
|
|
466
|
-
this.view2TSFile(frontend.views, results);
|
|
467
|
-
}
|
|
468
|
-
frontend.componentDependencies?.forEach((item) => this.contentToFile(item, results));
|
|
469
|
-
});
|
|
470
|
-
} else {
|
|
471
|
-
module.frontends?.forEach((frontend) => {
|
|
472
|
-
try {
|
|
473
|
-
frontend.logics.forEach((logic) => {
|
|
474
|
-
const result = logic.toEmbeddedTSFile();
|
|
475
|
-
results.push(result);
|
|
476
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
477
|
-
logic.sourceMap = result.sourceMap;
|
|
478
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
479
|
-
});
|
|
480
|
-
} catch (err) {
|
|
481
|
-
console.log(err);
|
|
482
|
-
}
|
|
483
|
-
});
|
|
377
|
+
private *contentToFile(module: Module | App | Connector): Generator<any, utils.EmbeddedTSFileResult[], any> {
|
|
378
|
+
if (!module) {
|
|
379
|
+
return[];
|
|
484
380
|
}
|
|
485
381
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
results.push(result);
|
|
491
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
492
|
-
dataSource.sourceMap = result.sourceMap;
|
|
493
|
-
this.file2NodeMap.set(result.filePath, dataSource);
|
|
494
|
-
} catch (err) {}
|
|
495
|
-
dataSource.entities.forEach((entity) => {
|
|
496
|
-
try {
|
|
497
|
-
const result = entity.toEmbeddedTSFile();
|
|
498
|
-
results.push(result);
|
|
499
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
500
|
-
entity.sourceMap = result.sourceMap;
|
|
501
|
-
this.file2NodeMap.set(result.filePath, entity);
|
|
502
|
-
} catch (err) {}
|
|
503
|
-
});
|
|
504
|
-
});
|
|
382
|
+
const self = this;
|
|
383
|
+
const results: utils.EmbeddedTSFileResult[] = [];
|
|
384
|
+
const getTsFile = function* getTsFile(node: FileNode, name: string, pre?: Function) {
|
|
385
|
+
const isContinue = pre ? (input: unknown) => input instanceof pre : () => true;
|
|
505
386
|
|
|
506
|
-
module?.interfaces?.forEach((_itf) => {
|
|
507
387
|
try {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
if (_itf instanceof InterfaceFromExample) {
|
|
511
|
-
_interface = _itf.inter as Interface;
|
|
512
|
-
} else {
|
|
513
|
-
_interface = _itf as Interface;
|
|
388
|
+
if (!isContinue(node)) {
|
|
389
|
+
return;
|
|
514
390
|
}
|
|
515
|
-
const result = _interface.toEmbeddedTSFile();
|
|
516
|
-
results.push(result);
|
|
517
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
518
|
-
_interface.sourceMap = result.sourceMap;
|
|
519
|
-
this.file2NodeMap.set(result.filePath, _interface);
|
|
520
|
-
} catch (err) {}
|
|
521
|
-
});
|
|
522
|
-
module?.enums?.forEach((_enum) => {
|
|
523
|
-
try {
|
|
524
|
-
const result = _enum.toEmbeddedTSFile();
|
|
525
|
-
results.push(result);
|
|
526
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
527
|
-
_enum.sourceMap = result.sourceMap;
|
|
528
|
-
this.file2NodeMap.set(result.filePath, _enum);
|
|
529
|
-
} catch (err) {}
|
|
530
|
-
});
|
|
531
|
-
module?.logics?.forEach((logic) => {
|
|
532
|
-
try {
|
|
533
|
-
if (!(logic instanceof Logic)) return;
|
|
534
|
-
const result = logic.toEmbeddedTSFile();
|
|
535
|
-
results.push(result);
|
|
536
|
-
logic.sourceMap = result.sourceMap;
|
|
537
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
538
|
-
} catch (err) {}
|
|
539
|
-
});
|
|
540
391
|
|
|
541
|
-
|
|
542
|
-
try {
|
|
543
|
-
if (!(logic instanceof Logic)) return;
|
|
544
|
-
const result = logic.toEmbeddedTSFile();
|
|
545
|
-
results.push(result);
|
|
546
|
-
logic.sourceMap = result.sourceMap;
|
|
547
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
548
|
-
} catch (err) {}
|
|
549
|
-
});
|
|
392
|
+
const result = yield* node.toEmbeddedTSFile();
|
|
550
393
|
|
|
551
|
-
(module as App)?.authLogicsForCallInterface?.forEach?.((logic) => {
|
|
552
|
-
try {
|
|
553
|
-
if (!(logic instanceof Logic)) return;
|
|
554
|
-
const result = logic.toEmbeddedTSFile();
|
|
555
394
|
results.push(result);
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
} catch (err) {
|
|
559
|
-
|
|
395
|
+
node.sourceMap = result.sourceMap;
|
|
396
|
+
self.file2NodeMap.set(result.filePath, node);
|
|
397
|
+
} catch (err) {
|
|
398
|
+
if (process.env.NODE_ENV === 'development') {
|
|
399
|
+
console.warn(node.nodePath ? node.nodePath : name, '代码转换失败', err);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
const getTsFiles = function* getTsFiles(nodes: FileNode[], name: string, pre?: Function) {
|
|
404
|
+
for (const node of nodes ?? []) {
|
|
405
|
+
yield* getTsFile(node, name, pre);
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const concat = <T, K extends keyof T>(arr: T[], key: K): T[K] => {
|
|
409
|
+
return arr.reduce((ans, item) => ans.concat(item[key]), []) as any;
|
|
410
|
+
};
|
|
411
|
+
const view2TSFile = function* view2TSFile(views: View[]): Generator<void, void, any> {
|
|
412
|
+
if (!views || views.length === 0) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
560
415
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
const result = process.toEmbeddedTSFile();
|
|
564
|
-
results.push(result);
|
|
565
|
-
process.sourceMap = result.sourceMap;
|
|
566
|
-
this.file2NodeMap.set(result.filePath, process);
|
|
567
|
-
} catch (err) {}
|
|
568
|
-
});
|
|
416
|
+
for (const view of views) {
|
|
417
|
+
yield* getTsFile(view, 'view');
|
|
569
418
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const result = launcher.toEmbeddedTSFile();
|
|
574
|
-
results.push(result);
|
|
575
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
576
|
-
launcher.sourceMap = result.sourceMap;
|
|
577
|
-
this.file2NodeMap.set(result.filePath, launcher);
|
|
578
|
-
});
|
|
579
|
-
module.namespaces?.forEach?.((namespace) => {
|
|
580
|
-
namespace.logics.forEach((logic) => {
|
|
581
|
-
const result = logic.toEmbeddedTSFile();
|
|
582
|
-
results.push(result);
|
|
583
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
584
|
-
logic.sourceMap = result.sourceMap;
|
|
585
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
586
|
-
});
|
|
587
|
-
})
|
|
588
|
-
module?.authLogicsForCallInterface?.forEach?.((logic) => {
|
|
589
|
-
try {
|
|
590
|
-
if (!(logic instanceof Logic)) return;
|
|
591
|
-
const result = logic.toEmbeddedTSFile();
|
|
592
|
-
results.push(result);
|
|
593
|
-
logic.sourceMap = result.sourceMap;
|
|
594
|
-
this.file2NodeMap.set(result.filePath, logic);
|
|
595
|
-
} catch (err) {}
|
|
596
|
-
});
|
|
597
|
-
} catch (error) {
|
|
598
|
-
console.error(error);
|
|
419
|
+
if (view.children) {
|
|
420
|
+
yield* view2TSFile(view.children);
|
|
421
|
+
}
|
|
599
422
|
}
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// 禁用的依赖库不生成代码 区分 undefined 和 false
|
|
426
|
+
if (module instanceof Module && module.type === 'extension' && module.enable === false) {
|
|
427
|
+
return [];
|
|
600
428
|
}
|
|
601
429
|
|
|
430
|
+
const {
|
|
431
|
+
structures = [],
|
|
432
|
+
metadataTypes = [],
|
|
433
|
+
frontends = [],
|
|
434
|
+
interfaces = [],
|
|
435
|
+
enums = [],
|
|
436
|
+
logics = [],
|
|
437
|
+
authLogics = [],
|
|
438
|
+
authLogicsForCallInterface = [],
|
|
439
|
+
processes = [],
|
|
440
|
+
dataSources = [],
|
|
441
|
+
triggerLaunchers = [],
|
|
442
|
+
connections = [],
|
|
443
|
+
roles = [],
|
|
444
|
+
overriddenLogics = [],
|
|
445
|
+
backend,
|
|
446
|
+
configuration,
|
|
447
|
+
} = module as App;
|
|
448
|
+
|
|
449
|
+
const {
|
|
450
|
+
namespaces = [],
|
|
451
|
+
} = module as Connector;
|
|
452
|
+
|
|
453
|
+
yield* getTsFiles(structures, 'structure');
|
|
454
|
+
yield* getTsFiles(metadataTypes, 'metadataType');
|
|
455
|
+
|
|
602
456
|
if (module instanceof App) {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
457
|
+
yield* getTsFiles(overriddenLogics, 'overriddenLogic', OverriddenLogic);
|
|
458
|
+
yield* getTsFiles(backend?.variables ?? [], 'backend_variable');
|
|
459
|
+
|
|
460
|
+
for (const frontend of frontends) {
|
|
461
|
+
yield* getTsFile(frontend, 'frontend');
|
|
462
|
+
yield* getTsFiles(frontend.variables, 'frontend_variable');
|
|
463
|
+
yield* getTsFiles(concat(frontend.bindEvents, 'logics'), 'frontend_bindEvent_logic');
|
|
464
|
+
|
|
465
|
+
if (!config.closeViews) {
|
|
466
|
+
yield* view2TSFile(frontend.views);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
for (const dep of frontend.componentDependencies) {
|
|
470
|
+
results.push(...(yield* self.contentToFile(dep)));
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
yield* getTsFiles(concat(frontends, 'logics' as any), 'frontend_logic');
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
yield* getTsFiles(dataSources, 'dataSource');
|
|
478
|
+
yield* getTsFiles(concat(dataSources, 'entities'), 'dataSource_entity');
|
|
479
|
+
yield* getTsFiles(interfaces as FileNode[], 'interface');
|
|
480
|
+
yield* getTsFiles(enums, 'enum');
|
|
481
|
+
yield* getTsFiles(logics, 'logic');
|
|
482
|
+
yield* getTsFiles(authLogics, 'authLogic', Logic);
|
|
483
|
+
yield* getTsFiles(authLogicsForCallInterface, 'authLogicForCallInterface', Logic);
|
|
484
|
+
yield* getTsFiles(processes, 'process');
|
|
485
|
+
|
|
486
|
+
if (module instanceof Connector) {
|
|
487
|
+
yield* getTsFiles(triggerLaunchers, 'triggerLauncher');
|
|
488
|
+
yield* getTsFiles(authLogicsForCallInterface, 'authLogicForCallInterface');
|
|
489
|
+
yield* getTsFiles(concat(namespaces, 'logics'), 'namespaces_logic');
|
|
612
490
|
}
|
|
613
491
|
|
|
614
492
|
if (module instanceof App) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
results.push(result);
|
|
619
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
620
|
-
connection.sourceMap = result.sourceMap;
|
|
621
|
-
this.file2NodeMap.set(result.filePath, connection);
|
|
622
|
-
} catch (err) {}
|
|
623
|
-
});
|
|
624
|
-
module.triggerLaunchers?.forEach?.((triggerLauncher) => {
|
|
625
|
-
try {
|
|
626
|
-
const result = triggerLauncher.toEmbeddedTSFile();
|
|
627
|
-
results.push(result);
|
|
628
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
629
|
-
triggerLauncher.sourceMap = result.sourceMap;
|
|
630
|
-
this.file2NodeMap.set(result.filePath, triggerLauncher);
|
|
631
|
-
} catch (err) {}
|
|
632
|
-
});
|
|
493
|
+
yield* getTsFiles(roles, 'role');
|
|
494
|
+
yield* getTsFiles(connections, 'connection');
|
|
495
|
+
yield* getTsFiles(triggerLaunchers, 'triggerLauncher');
|
|
633
496
|
}
|
|
634
497
|
|
|
635
|
-
|
|
636
|
-
if (
|
|
637
|
-
|
|
638
|
-
try {
|
|
639
|
-
const result = _property.toEmbeddedTSFile();
|
|
640
|
-
results.push(result);
|
|
641
|
-
// sourceMap都存在目录级别内容下,在页面层级下去找
|
|
642
|
-
_property.sourceMap = result.sourceMap;
|
|
643
|
-
this.file2NodeMap.set(result.filePath, _property);
|
|
644
|
-
} catch (err) {}
|
|
645
|
-
});
|
|
498
|
+
for (const group of configuration?.groups ?? []) {
|
|
499
|
+
if (group.name === 'custom') {
|
|
500
|
+
yield* getTsFiles(group?.properties ?? [], 'configuration_group_property');
|
|
646
501
|
}
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
view2TSFile(viewsChildren: View[], results: Array<ReturnType<Structure['toEmbeddedTSFile']>>) {
|
|
651
|
-
// 如果有子页面
|
|
652
|
-
if (viewsChildren && viewsChildren.length) {
|
|
653
|
-
viewsChildren.forEach((view) => {
|
|
654
|
-
try {
|
|
655
|
-
const result = view.toEmbeddedTSFile();
|
|
656
|
-
results.push(result);
|
|
657
|
-
view.sourceMap = result.sourceMap;
|
|
658
|
-
this.file2NodeMap.set(result.filePath, view);
|
|
659
|
-
if (view.children.length) {
|
|
660
|
-
this.view2TSFile(view.children, results);
|
|
661
|
-
}
|
|
662
|
-
} catch (err) {}
|
|
663
|
-
});
|
|
664
502
|
}
|
|
503
|
+
|
|
504
|
+
return results;
|
|
665
505
|
}
|
|
666
506
|
|
|
667
507
|
async openApp(app: App) {
|
|
668
508
|
console.time('生成 TS 文件');
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
// app的创建内容
|
|
672
|
-
this.contentToFile(app, results);
|
|
673
|
-
// 其他模块的创建内容
|
|
674
|
-
app.integration?.connectors?.forEach((item) => this.contentToFile(item, results));
|
|
675
|
-
app.dependencies.forEach((item) => this.contentToFile(item, results));
|
|
676
|
-
app.interfaceDependencies.forEach((item) => this.contentToFile(item, results));
|
|
677
|
-
} catch (err) {
|
|
678
|
-
console.log(err);
|
|
679
|
-
}
|
|
680
|
-
|
|
509
|
+
const self = this;
|
|
510
|
+
const results = await utils.timeSlicingWithGenerator(getAllTsFiles());
|
|
681
511
|
const files = results.map((result) => ({
|
|
682
512
|
file: result.filePath,
|
|
683
513
|
fileContent: result.code,
|
|
684
514
|
}));
|
|
515
|
+
|
|
685
516
|
await this.writeFiles(files);
|
|
686
517
|
this._debugInFileStorage(app, files);
|
|
687
518
|
// 修改名称回调
|
|
@@ -693,6 +524,21 @@ class NaslServer {
|
|
|
693
524
|
callback();
|
|
694
525
|
});
|
|
695
526
|
console.timeEnd('生成 TS 文件');
|
|
527
|
+
|
|
528
|
+
function* getAllTsFiles() {
|
|
529
|
+
const files = yield* self.contentToFile(app);
|
|
530
|
+
const otherModules = [
|
|
531
|
+
...app.integration?.connectors ?? [],
|
|
532
|
+
...app.dependencies ?? [],
|
|
533
|
+
...app.interfaceDependencies ?? [],
|
|
534
|
+
];
|
|
535
|
+
|
|
536
|
+
for (const item of otherModules) {
|
|
537
|
+
files.push(...yield* self.contentToFile(item));
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return files;
|
|
541
|
+
}
|
|
696
542
|
}
|
|
697
543
|
|
|
698
544
|
async refreshApp(app: App) {
|
|
@@ -723,13 +569,19 @@ class NaslServer {
|
|
|
723
569
|
__naslStdlibFileCacheMap.set(options.file, options);
|
|
724
570
|
}
|
|
725
571
|
|
|
726
|
-
/**
|
|
572
|
+
/**
|
|
727
573
|
* 只新增文件
|
|
728
574
|
* @param {*} files
|
|
729
575
|
*/
|
|
730
576
|
writeFiles(files: Array<tsProtocol.OpenRequestArgs>) {
|
|
731
577
|
files.forEach(({ file, fileContent }) => this.tsFiles.set(file, fileContent));
|
|
732
|
-
|
|
578
|
+
const noRepeatFiles = Array.from(this.tsFiles.entries()).map(([key, value]) => ({
|
|
579
|
+
file: key,
|
|
580
|
+
fileContent: value,
|
|
581
|
+
}));
|
|
582
|
+
// const newFiles = require('/Users/sufangzhou/dev/neteast/lcap-ide/packages/nasl/tmp/files-original.json');
|
|
583
|
+
// debugger;
|
|
584
|
+
return this.messager.requestCommand('writeFiles', noRepeatFiles);
|
|
733
585
|
}
|
|
734
586
|
|
|
735
587
|
/**
|
|
@@ -837,7 +689,7 @@ class NaslServer {
|
|
|
837
689
|
*/
|
|
838
690
|
async getConvertTypeInfo(node: BaseNode) {
|
|
839
691
|
if (node && node instanceof BaseNode) {
|
|
840
|
-
const callFunction = node.parentNode.parentNode;
|
|
692
|
+
const callFunction = node.parentNode.parentNode as BaseNode;
|
|
841
693
|
/**
|
|
842
694
|
* currentSource callFunction 的节点,要去到当前节点的位置
|
|
843
695
|
* nasl.util.Convert(xxx),所以取到的位置要 + `nasl.util.C` 的长度
|
|
@@ -1077,26 +929,29 @@ class NaslServer {
|
|
|
1077
929
|
node.tsErrorDetail = tsErrorDetail;
|
|
1078
930
|
}
|
|
1079
931
|
|
|
1080
|
-
|
|
1081
|
-
* 处理诊断结果
|
|
1082
|
-
* @param records 结果
|
|
1083
|
-
* @returns 过滤或者转换后的诊断结果
|
|
1084
|
-
*/
|
|
1085
|
-
@withQueueExecute('diagnostic')
|
|
1086
|
-
async _resolveDiagnosticRecords(records: Array<DiagnosticRecord>) {
|
|
932
|
+
private *_resolveDiagnosticRecordsWithGenerator(records: Array<DiagnosticRecord>) {
|
|
1087
933
|
// 热更新类型标注
|
|
1088
934
|
if (records.length) {
|
|
1089
|
-
|
|
935
|
+
yield* this._incrementalAnnotationJSONWithGenerator(records);
|
|
1090
936
|
}
|
|
1091
|
-
await Promise.all(
|
|
1092
|
-
records.map(async (record) => {
|
|
1093
|
-
const {node} = record;
|
|
1094
|
-
if (!node) return;
|
|
1095
937
|
|
|
1096
|
-
|
|
1097
|
-
const oldRecord = this.diagnosticManager.getRecord?.(record.id);
|
|
938
|
+
const self = this;
|
|
1098
939
|
|
|
1099
|
-
|
|
940
|
+
console.time('处理诊断数据');
|
|
941
|
+
|
|
942
|
+
yield* utils.wrapForEachToGenerator(records, function* resolveRecord(record) {
|
|
943
|
+
if (!record || !record.node) {
|
|
944
|
+
return;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
const { node } = record;
|
|
948
|
+
|
|
949
|
+
// 先获取原来的节点先清除一下之前有异常的节点,下面重新赋值
|
|
950
|
+
const oldRecord = self.diagnosticManager.getRecord?.(record.id);
|
|
951
|
+
|
|
952
|
+
// 处理旧数据
|
|
953
|
+
if (oldRecord) {
|
|
954
|
+
yield* utils.wrapForEachToGenerator(oldRecord.semanticDiagnostics, (item) => {
|
|
1100
955
|
if (item.node) {
|
|
1101
956
|
delete item.node.tsErrorDetail;
|
|
1102
957
|
// 如果logic中有报错就把标识置为true
|
|
@@ -1106,8 +961,7 @@ class NaslServer {
|
|
|
1106
961
|
}
|
|
1107
962
|
});
|
|
1108
963
|
|
|
1109
|
-
|
|
1110
|
-
oldRecord?.suggestionDiagnostics.forEach((item) => {
|
|
964
|
+
yield* utils.wrapForEachToGenerator(oldRecord.suggestionDiagnostics, (item) => {
|
|
1111
965
|
if (item.node) {
|
|
1112
966
|
delete item.node.tsErrorDetail;
|
|
1113
967
|
if (item.node && item.node instanceof Logic) {
|
|
@@ -1115,146 +969,173 @@ class NaslServer {
|
|
|
1115
969
|
}
|
|
1116
970
|
}
|
|
1117
971
|
});
|
|
972
|
+
}
|
|
1118
973
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
974
|
+
// 语义诊断
|
|
975
|
+
if (isChangeInterface) {
|
|
976
|
+
yield* self.existStructureFix(record.semanticDiagnostics, record.node as FileNode, self);
|
|
977
|
+
}
|
|
1123
978
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
}
|
|
979
|
+
// 单独处理 oql 语义错误提示
|
|
980
|
+
if (record.node instanceof Logic) {
|
|
981
|
+
yield* utils.wrapForEachToGenerator(record?.syntaxDiagnostics, function *test(item) {
|
|
982
|
+
const minRange = yield* self._findMinRangeWithGenerator(item as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode);
|
|
983
|
+
if (minRange?.node instanceof OqlQueryComponent) {
|
|
984
|
+
if (item.text === 'Invalid character.') {
|
|
985
|
+
record.semanticDiagnostics.push(item);
|
|
1132
986
|
}
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// 记录结构体数据
|
|
992
|
+
yield* utils.wrapForEachToGenerator(record.semanticDiagnostics, (diag) => {
|
|
993
|
+
checkAStructure_(diag.text);
|
|
994
|
+
});
|
|
1135
995
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
996
|
+
record.semanticDiagnostics = (
|
|
997
|
+
yield*
|
|
998
|
+
utils.wrapMapToGenerator(record.semanticDiagnostics, function* (diag) {
|
|
999
|
+
return yield* self._resolveDiagnosticWithGenerator(
|
|
1000
|
+
diag as unknown as tsProtocol.DiagnosticWithFileName,
|
|
1001
|
+
record.node as FileNode,
|
|
1002
|
+
record
|
|
1003
|
+
);
|
|
1004
|
+
})
|
|
1005
|
+
).filter((diag) => !!diag);
|
|
1006
|
+
|
|
1007
|
+
record.semanticDiagnostics.push(...(yield* self._attachDiagnosticsWithGenerator(node)));
|
|
1008
|
+
|
|
1009
|
+
// 报错降级逻辑
|
|
1010
|
+
record.semanticDiagnostics = (
|
|
1011
|
+
yield*
|
|
1012
|
+
utils.wrapMapToGenerator(record.semanticDiagnostics, (diagnostic) => {
|
|
1013
|
+
// 错误降级如果属于草稿态的就降级
|
|
1014
|
+
if (diagnostic?.node) {
|
|
1015
|
+
let currentNode = diagnostic.node;
|
|
1016
|
+
if (diagnostic.severity === 'warning') {
|
|
1017
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
1018
|
+
return null;
|
|
1019
|
+
} if (currentNode.concept === 'OqlQueryComponent') {
|
|
1020
|
+
// OQL别名错误降级为警告
|
|
1021
|
+
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
1022
|
+
// 重置 图标和错误等级
|
|
1023
|
+
diagnostic.severity = 'warning';
|
|
1024
|
+
if (diagnostic.node?.tsErrorDetail) {
|
|
1025
|
+
// 重置组件节点上的错误信息
|
|
1026
|
+
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
1027
|
+
}
|
|
1151
1028
|
record.suggestionDiagnostics.push(diagnostic);
|
|
1152
1029
|
return null;
|
|
1153
|
-
} if (currentNode.concept === 'OqlQueryComponent') {
|
|
1154
|
-
// OQL别名错误降级为警告
|
|
1155
|
-
if (diagnostic.originalDiagnostic && diagnostic.originalDiagnostic?.text.includes('__OQL_ALIAS_WARNING__')) {
|
|
1156
|
-
// 重置 图标和错误等级
|
|
1157
|
-
diagnostic.severity = 'warning';
|
|
1158
|
-
if (diagnostic.node?.tsErrorDetail) {
|
|
1159
|
-
// 重置组件节点上的错误信息
|
|
1160
|
-
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
1161
|
-
}
|
|
1162
|
-
record.suggestionDiagnostics.push(diagnostic);
|
|
1163
|
-
return null;
|
|
1164
|
-
}
|
|
1165
1030
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
record.suggestionDiagnostics.push(diagnostic);
|
|
1176
|
-
return null;
|
|
1031
|
+
}
|
|
1032
|
+
while (currentNode && currentNode?.parentNode?.concept !== 'App') {
|
|
1033
|
+
if (currentNode.parentKey?.toLowerCase()?.includes('playground')) {
|
|
1034
|
+
// 草稿区降级
|
|
1035
|
+
// 重置 图标和错误等级
|
|
1036
|
+
diagnostic.severity = 'warning';
|
|
1037
|
+
if (diagnostic.node?.tsErrorDetail) {
|
|
1038
|
+
// 重置组件节点上的错误信息
|
|
1039
|
+
diagnostic.node.tsErrorDetail.severity = 'warning';
|
|
1177
1040
|
}
|
|
1178
|
-
|
|
1041
|
+
record.suggestionDiagnostics.push(diagnostic);
|
|
1042
|
+
return null;
|
|
1179
1043
|
}
|
|
1044
|
+
currentNode = currentNode.parentNode as BaseNode;
|
|
1045
|
+
}
|
|
1180
1046
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
}
|
|
1047
|
+
// 没有降级的继续遍历,如果在logic中,logic本身需要有error状态
|
|
1048
|
+
// 如果logic中有报错就把标识置为true
|
|
1049
|
+
if ((diagnostic.node as any)?.logic) {
|
|
1050
|
+
(diagnostic.node as any).logic.haveError = true;
|
|
1186
1051
|
}
|
|
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
|
-
|
|
1052
|
+
}
|
|
1053
|
+
return diagnostic;
|
|
1054
|
+
})
|
|
1055
|
+
)
|
|
1056
|
+
.filter((diag) => !!diag);
|
|
1057
|
+
|
|
1058
|
+
// 处理后的警告异常提示信息
|
|
1059
|
+
record.suggestionDiagnostics = (
|
|
1060
|
+
yield*
|
|
1061
|
+
utils.wrapMapToGenerator(record.suggestionDiagnostics, function * resolveSuggestionDiagnostic(diag) {
|
|
1062
|
+
// 上面错误降级下来的
|
|
1063
|
+
if (diag?.node) {
|
|
1064
|
+
return diag;
|
|
1065
|
+
// 一些已知警告的单独处理
|
|
1066
|
+
} if (
|
|
1067
|
+
[
|
|
1068
|
+
`'__LogicEmpty' is declared but its value is never read.`,
|
|
1069
|
+
`'__destinationEmpty__' is declared but its value is never read.`,
|
|
1070
|
+
`'__devConfigValueEmpty' is declared but its value is never read.`,
|
|
1071
|
+
`'__onlineConfigValueEmpty' is declared but its value is never read.`,
|
|
1072
|
+
`'__UpdateNoProperty__' is declared but its value is never read.`,
|
|
1073
|
+
].includes(diag.text)
|
|
1074
|
+
) {
|
|
1075
|
+
return yield* self._resolveDiagnosticWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode, record);
|
|
1076
|
+
} if (diag.text.includes(` is declared but its value is never read.`)) {
|
|
1077
|
+
// 局部变量和输入变量未使用的警告
|
|
1078
|
+
const fromModule = record.node.parentNode.concept === 'Module';
|
|
1079
|
+
const fromConnector = record.node.parentNode.concept === 'Connector';
|
|
1080
|
+
if ((record.node.concept === 'View' || record.node.concept === 'Logic') && !(fromModule || fromConnector)) {
|
|
1081
|
+
/**
|
|
1082
|
+
* javalogic不用提示
|
|
1083
|
+
*/
|
|
1084
|
+
if (record.node.concept === 'Logic' && self._isJavalogic(record.node as Logic)) {
|
|
1085
|
+
return null;
|
|
1086
|
+
}
|
|
1087
|
+
const minRange = yield* self._findMinRangeWithGenerator(diag as unknown as tsProtocol.DiagnosticWithFileName, record.node as FileNode);
|
|
1088
|
+
if (minRange) {
|
|
1213
1089
|
/**
|
|
1214
|
-
*
|
|
1090
|
+
* 如果节点是入参类型
|
|
1091
|
+
* 而且不是foreach中
|
|
1092
|
+
* 而且不是事件逻辑的入参
|
|
1215
1093
|
*/
|
|
1216
|
-
if (
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
message: `未使用的输入参数${minRange.node.name}`,
|
|
1235
|
-
};
|
|
1236
|
-
return diagnostic;
|
|
1237
|
-
} if (minRange.node instanceof Variable) {
|
|
1238
|
-
const diagnostic = {
|
|
1239
|
-
node: minRange.node,
|
|
1240
|
-
severity: 'warning',
|
|
1241
|
-
message: `未使用的变量${minRange.node.name}`,
|
|
1242
|
-
};
|
|
1243
|
-
return diagnostic;
|
|
1244
|
-
}
|
|
1094
|
+
if (
|
|
1095
|
+
minRange.node instanceof Param &&
|
|
1096
|
+
minRange.node.parentNode.concept !== 'ForEachStatement' &&
|
|
1097
|
+
!minRange.node.getAncestor('BindEvent')
|
|
1098
|
+
) {
|
|
1099
|
+
const diagnostic = {
|
|
1100
|
+
node: minRange.node,
|
|
1101
|
+
severity: 'warning',
|
|
1102
|
+
message: `未使用的输入参数${minRange.node.name}`,
|
|
1103
|
+
};
|
|
1104
|
+
return diagnostic;
|
|
1105
|
+
} if (minRange.node instanceof Variable) {
|
|
1106
|
+
const diagnostic = {
|
|
1107
|
+
node: minRange.node,
|
|
1108
|
+
severity: 'warning',
|
|
1109
|
+
message: `未使用的变量${minRange.node.name}`,
|
|
1110
|
+
};
|
|
1111
|
+
return diagnostic;
|
|
1245
1112
|
}
|
|
1246
1113
|
}
|
|
1247
1114
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1115
|
+
}
|
|
1116
|
+
return null;
|
|
1117
|
+
})
|
|
1118
|
+
)
|
|
1119
|
+
.filter((diag) => !!diag);
|
|
1120
|
+
|
|
1121
|
+
record.suggestionDiagnostics.push(...yield* self._attachSuggestionDiagnosticsWithGenerator(node));
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
console.timeEnd('处理诊断数据');
|
|
1251
1125
|
|
|
1252
|
-
record.suggestionDiagnostics.push(...this._attachSuggestionDiagnostics(node));
|
|
1253
|
-
})
|
|
1254
|
-
);
|
|
1255
1126
|
return records;
|
|
1256
1127
|
}
|
|
1257
1128
|
|
|
1129
|
+
/**
|
|
1130
|
+
* 处理诊断结果
|
|
1131
|
+
* @param records 结果
|
|
1132
|
+
* @returns 过滤或者转换后的诊断结果
|
|
1133
|
+
*/
|
|
1134
|
+
@withQueueExecute('diagnostic')
|
|
1135
|
+
private _resolveDiagnosticRecords(records: Array<DiagnosticRecord>) {
|
|
1136
|
+
return utils.timeSlicingWithGenerator(this._resolveDiagnosticRecordsWithGenerator(records));
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1258
1139
|
/**
|
|
1259
1140
|
* 判断是否是Javalogic
|
|
1260
1141
|
*/
|
|
@@ -1272,7 +1153,7 @@ class NaslServer {
|
|
|
1272
1153
|
* @param fileNode 文件级别的节点
|
|
1273
1154
|
* @returns 诊断结果
|
|
1274
1155
|
*/
|
|
1275
|
-
|
|
1156
|
+
private *_attachSuggestionDiagnosticsWithGenerator(fileNode: BaseNode) {
|
|
1276
1157
|
const diagnostics: Diagnostic[] = [];
|
|
1277
1158
|
if (fileNode instanceof Logic || fileNode instanceof View) {
|
|
1278
1159
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
@@ -1634,31 +1515,53 @@ class NaslServer {
|
|
|
1634
1515
|
}
|
|
1635
1516
|
|
|
1636
1517
|
/** 是否被 触发器依赖, 如果存在,返回第一个触发器对应的名称 */
|
|
1637
|
-
|
|
1518
|
+
isRefedByTriggerAndReturnFirstRef(fileNode: BaseNode): Promise<{
|
|
1638
1519
|
isRefedByTrigger: boolean;
|
|
1639
1520
|
fRefName: string;
|
|
1640
1521
|
}> {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1522
|
+
return this._isHaveRef(fileNode).then((refs) => {
|
|
1523
|
+
const basePath = TriggerLauncher.getEmbeddedFileBasePath(fileNode.rootNode as App);
|
|
1524
|
+
let flag = false;
|
|
1525
|
+
let fRefName = '';
|
|
1526
|
+
try {
|
|
1527
|
+
for (const ref of refs) {
|
|
1528
|
+
const { file } = ref;
|
|
1529
|
+
if (file.startsWith(basePath)) {
|
|
1530
|
+
flag = true;
|
|
1531
|
+
// file: /embedded/tttta/triggerLaunchers/订阅配置_asd.ts
|
|
1532
|
+
fRefName = file.split(basePath)[1].split('.')[0];
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1653
1535
|
}
|
|
1536
|
+
} catch (error) {
|
|
1537
|
+
console.error(error, refs);
|
|
1654
1538
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1539
|
+
return {
|
|
1540
|
+
isRefedByTrigger: flag,
|
|
1541
|
+
fRefName,
|
|
1542
|
+
};
|
|
1543
|
+
});
|
|
1544
|
+
// const refs = await this._isHaveRef(fileNode);
|
|
1545
|
+
// const basePath = TriggerLauncher.getEmbeddedFileBasePath(fileNode.rootNode as App);
|
|
1546
|
+
// let flag = false;
|
|
1547
|
+
// let fRefName = '';
|
|
1548
|
+
// try {
|
|
1549
|
+
// for (const ref of refs) {
|
|
1550
|
+
// const { file } = ref;
|
|
1551
|
+
// if (file.startsWith(basePath)) {
|
|
1552
|
+
// flag = true;
|
|
1553
|
+
// // file: /embedded/tttta/triggerLaunchers/订阅配置_asd.ts
|
|
1554
|
+
// fRefName = file.split(basePath)[1].split('.')[0];
|
|
1555
|
+
// break;
|
|
1556
|
+
// }
|
|
1557
|
+
// }
|
|
1558
|
+
// } catch (error) {
|
|
1559
|
+
// console.error(error, refs);
|
|
1560
|
+
// }
|
|
1561
|
+
// return {
|
|
1562
|
+
// isRefedByTrigger: flag,
|
|
1563
|
+
// fRefName,
|
|
1564
|
+
// };
|
|
1662
1565
|
}
|
|
1663
1566
|
|
|
1664
1567
|
/**
|
|
@@ -1689,15 +1592,18 @@ class NaslServer {
|
|
|
1689
1592
|
* @param fileNode 文件级别的节点
|
|
1690
1593
|
* @returns 诊断结果
|
|
1691
1594
|
*/
|
|
1692
|
-
|
|
1595
|
+
private *_attachDiagnosticsWithGenerator(fileNode: BaseNode) {
|
|
1693
1596
|
// 每次诊断前先清空这个Set
|
|
1694
1597
|
this.logicSetWithComponentLogic = new Set<string>();
|
|
1598
|
+
|
|
1599
|
+
const self = this;
|
|
1695
1600
|
const diagnostics: Diagnostic[] = [];
|
|
1601
|
+
|
|
1696
1602
|
if (fileNode instanceof View) {
|
|
1697
|
-
fileNode
|
|
1603
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), function* attachView([node, value]) {
|
|
1698
1604
|
if (node instanceof ViewElement && node.view === fileNode) {
|
|
1699
1605
|
if (node.tag) {
|
|
1700
|
-
node.bindAttrs
|
|
1606
|
+
yield* utils.wrapForEachToGenerator(node.bindAttrs, (bindAttr) => {
|
|
1701
1607
|
if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
|
|
1702
1608
|
const bindExpression = bindAttr.expression;
|
|
1703
1609
|
let diagnostic;
|
|
@@ -1740,7 +1646,7 @@ class NaslServer {
|
|
|
1740
1646
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
1741
1647
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
1742
1648
|
let msg;
|
|
1743
|
-
fileNode.
|
|
1649
|
+
yield* fileNode.traverseChildrenGenerator((nodeIn) => {
|
|
1744
1650
|
if (nodeIn && (nodeIn instanceof BatchAssignment || (nodeIn instanceof Assignment && nodeIn.left?.name))) {
|
|
1745
1651
|
// 子页面内部逻辑过滤
|
|
1746
1652
|
if (nodeIn.view !== fileNode) return;
|
|
@@ -1797,11 +1703,11 @@ class NaslServer {
|
|
|
1797
1703
|
node.tsErrorDetail = diagnostic;
|
|
1798
1704
|
diagnostics.push(diagnostic);
|
|
1799
1705
|
}
|
|
1800
|
-
const fileSourceCode =
|
|
1706
|
+
const fileSourceCode = self.getNodeCode(fileNode, value);
|
|
1801
1707
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
1802
1708
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
1803
|
-
|
|
1804
|
-
const isDuplicate =
|
|
1709
|
+
self._treeMetadataType2CoreType(typeAnnotation, (node.rootNode as App))
|
|
1710
|
+
const isDuplicate = self._isDuplicateCoreType(typeAnnotation)
|
|
1805
1711
|
if (isDuplicate) {
|
|
1806
1712
|
const diagnostic = {
|
|
1807
1713
|
node: node,
|
|
@@ -1813,7 +1719,7 @@ class NaslServer {
|
|
|
1813
1719
|
}
|
|
1814
1720
|
} else if (node instanceof BindAttribute || node instanceof BindDirective || node instanceof BindStyle) {
|
|
1815
1721
|
if (Array.isArray(node.bindExpressions)) {
|
|
1816
|
-
const exp = node.bindExpressions.find((bindExpression) =>
|
|
1722
|
+
const exp = node.bindExpressions.find((bindExpression) => self.hasComponentLogics(bindExpression));
|
|
1817
1723
|
if (exp) {
|
|
1818
1724
|
// const element: any = node.getAncestor('ViewElement');
|
|
1819
1725
|
// const api = config.allNodesAPI[element?.tag];
|
|
@@ -1836,7 +1742,7 @@ class NaslServer {
|
|
|
1836
1742
|
}
|
|
1837
1743
|
}
|
|
1838
1744
|
} else if (node instanceof CallInterface) {
|
|
1839
|
-
const isAuthInterface =
|
|
1745
|
+
const isAuthInterface = self.hasAuth(node);
|
|
1840
1746
|
const interfaceName = node.calleewholeKey.slice(node.calleewholeKey.lastIndexOf('.') + 1);
|
|
1841
1747
|
if (isAuthInterface) {
|
|
1842
1748
|
const errorMsg = `${interfaceName} 接口有鉴权方式,不支持在前端调用`;
|
|
@@ -1862,15 +1768,16 @@ class NaslServer {
|
|
|
1862
1768
|
node.tsErrorDetail = diagnostic;
|
|
1863
1769
|
}
|
|
1864
1770
|
} else {
|
|
1865
|
-
|
|
1771
|
+
self.checkNodeError(node, diagnostics);
|
|
1866
1772
|
}
|
|
1867
1773
|
});
|
|
1868
|
-
}
|
|
1774
|
+
}
|
|
1775
|
+
else if (fileNode instanceof DataSource) {
|
|
1869
1776
|
const dataSourceGroup = (fileNode.rootNode as App).configuration?.getGroup('dataSource');
|
|
1870
1777
|
if (dataSourceGroup) {
|
|
1871
1778
|
const property = dataSourceGroup.getProperty(fileNode.name);
|
|
1872
1779
|
if (property && property.values) {
|
|
1873
|
-
property.values
|
|
1780
|
+
yield* utils.wrapForEachToGenerator(property.values, (propertyValue) => {
|
|
1874
1781
|
if (!propertyValue.value && fileNode.name !== 'defaultDS') {
|
|
1875
1782
|
const diagnostic = {
|
|
1876
1783
|
node: fileNode,
|
|
@@ -2166,8 +2073,9 @@ class NaslServer {
|
|
|
2166
2073
|
});
|
|
2167
2074
|
}
|
|
2168
2075
|
}
|
|
2169
|
-
if (fileNode instanceof Logic || fileNode instanceof OverriddenLogic) {
|
|
2170
|
-
const { isRefedByTrigger, fRefName } =
|
|
2076
|
+
else if (fileNode instanceof Logic || fileNode instanceof OverriddenLogic) {
|
|
2077
|
+
const { isRefedByTrigger, fRefName } = yield this.isRefedByTriggerAndReturnFirstRef(fileNode);
|
|
2078
|
+
|
|
2171
2079
|
if (isRefedByTrigger && !this.isTriggerRule(fileNode)) {
|
|
2172
2080
|
const diagnostic = {
|
|
2173
2081
|
node: fileNode,
|
|
@@ -2176,18 +2084,8 @@ class NaslServer {
|
|
|
2176
2084
|
};
|
|
2177
2085
|
diagnostics.push(diagnostic);
|
|
2178
2086
|
}
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
// SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
|
|
2182
|
-
// if ((node instanceof OqlQueryComponent || node instanceof SqlQueryComponent) && (node as SqlQueryComponent).getTypeBanError()) {
|
|
2183
|
-
// const diagnostic = {
|
|
2184
|
-
// node,
|
|
2185
|
-
// severity: 'error',
|
|
2186
|
-
// message: 'SQL查询:返回类型内部,不支持复杂类型。',
|
|
2187
|
-
// };
|
|
2188
|
-
// node.tsErrorDetail = diagnostic;
|
|
2189
|
-
// diagnostics.push(diagnostic);
|
|
2190
|
-
// }
|
|
2087
|
+
|
|
2088
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), ([node, value]) => {
|
|
2191
2089
|
if (node instanceof OqlQueryComponent) {
|
|
2192
2090
|
// 自动推导情况
|
|
2193
2091
|
const typeAnnotation = type2TypeAnnotation((node as any).__nodeType);
|
|
@@ -2206,8 +2104,7 @@ class NaslServer {
|
|
|
2206
2104
|
}
|
|
2207
2105
|
}
|
|
2208
2106
|
}
|
|
2209
|
-
|
|
2210
|
-
if (node instanceof Return || node instanceof Variable) {
|
|
2107
|
+
else if (node instanceof Return || node instanceof Variable) {
|
|
2211
2108
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
2212
2109
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
2213
2110
|
let used = false;
|
|
@@ -2259,7 +2156,7 @@ class NaslServer {
|
|
|
2259
2156
|
}
|
|
2260
2157
|
}
|
|
2261
2158
|
}
|
|
2262
|
-
if (node instanceof Param) {
|
|
2159
|
+
else if (node instanceof Param) {
|
|
2263
2160
|
const fileSourceCode = this.getNodeCode(fileNode, value);
|
|
2264
2161
|
if (fileSourceCode.includes('|') && fileSourceCode.includes('.metadataTypes.')) {
|
|
2265
2162
|
const typeAnnotation = node.typeAnnotation.toJSON()
|
|
@@ -2277,8 +2174,9 @@ class NaslServer {
|
|
|
2277
2174
|
}
|
|
2278
2175
|
this.checkNodeError(node, diagnostics);
|
|
2279
2176
|
});
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2177
|
+
}
|
|
2178
|
+
else if (fileNode instanceof Process) {
|
|
2179
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), ([node, value]) => {
|
|
2282
2180
|
this.checkNodeError(node, diagnostics);
|
|
2283
2181
|
});
|
|
2284
2182
|
} else if (fileNode instanceof Connection) {
|
|
@@ -2315,7 +2213,7 @@ class NaslServer {
|
|
|
2315
2213
|
} else if (hasEmptyConfig(fileNode)) {
|
|
2316
2214
|
diagnostics.push(diagnostic);
|
|
2317
2215
|
}
|
|
2318
|
-
|
|
2216
|
+
|
|
2319
2217
|
} else if (fileNode instanceof MetadataType) {
|
|
2320
2218
|
fileNode?.sourceMap.forEach((value, node) => {
|
|
2321
2219
|
const rulesMap: any = {};
|
|
@@ -2359,6 +2257,7 @@ class NaslServer {
|
|
|
2359
2257
|
}
|
|
2360
2258
|
})
|
|
2361
2259
|
}
|
|
2260
|
+
|
|
2362
2261
|
return diagnostics;
|
|
2363
2262
|
}
|
|
2364
2263
|
|
|
@@ -2653,9 +2552,10 @@ class NaslServer {
|
|
|
2653
2552
|
}
|
|
2654
2553
|
|
|
2655
2554
|
/* 接口导入查找 */
|
|
2656
|
-
existStructureFix(semanticDiagnostics: Diagnostic[], node: FileNode, that: any) {
|
|
2555
|
+
private *existStructureFix(semanticDiagnostics: Diagnostic[], node: FileNode, that: any) {
|
|
2657
2556
|
let module: Module;
|
|
2658
|
-
|
|
2557
|
+
|
|
2558
|
+
yield* utils.wrapForEachToGenerator(semanticDiagnostics, (diag) => {
|
|
2659
2559
|
const minRange = this._findMinRange(diag as unknown as tsProtocol.DiagnosticWithFileName, node);
|
|
2660
2560
|
if (diag.text?.includes('has no exported member named')) {
|
|
2661
2561
|
if (minRange.node instanceof Logic) {
|
|
@@ -2686,9 +2586,8 @@ class NaslServer {
|
|
|
2686
2586
|
}
|
|
2687
2587
|
return null;
|
|
2688
2588
|
}
|
|
2689
|
-
return diag;
|
|
2690
|
-
|
|
2691
2589
|
});
|
|
2590
|
+
|
|
2692
2591
|
if (actionArr.length) {
|
|
2693
2592
|
if (timer) return;
|
|
2694
2593
|
timer = window.setTimeout(() => {
|
|
@@ -2715,50 +2614,54 @@ class NaslServer {
|
|
|
2715
2614
|
* @param fileNode 页面节点
|
|
2716
2615
|
* @returns 处理后的结果
|
|
2717
2616
|
*/
|
|
2718
|
-
|
|
2617
|
+
private *_resolveDiagnosticWithGenerator(diagnostic: tsProtocol.DiagnosticWithFileName, fileNode: FileNode, record: DiagnosticRecord) {
|
|
2719
2618
|
// 拓展模块中的翻译先过滤掉,因为有错用户也不能修改
|
|
2720
2619
|
if (((fileNode as any).module || (fileNode as any).connector) && !(fileNode instanceof ConfigProperty)) {
|
|
2721
2620
|
return;
|
|
2722
2621
|
}
|
|
2723
|
-
// 过滤掉java依赖库的报错
|
|
2724
|
-
// if ('compilerInfoMap' in fileNode && (fileNode as any).compilerInfoMap?.java) {
|
|
2725
|
-
// return;
|
|
2726
|
-
// }
|
|
2727
2622
|
if (fileNode.concept === 'OverriddenLogic' && diagnostic.text === `'__LogicEmpty' is declared but its value is never read.`) {
|
|
2728
2623
|
return;
|
|
2729
2624
|
}
|
|
2730
|
-
const minRange = this.
|
|
2625
|
+
const minRange = yield* this._findMinRangeWithGenerator(diagnostic, fileNode);
|
|
2731
2626
|
const tsErrorDetail = {
|
|
2732
2627
|
severity: diagnostic.category === 'error' ? 'error' : 'warning',
|
|
2733
2628
|
message: translateDiagnosticMessage(diagnostic.text),
|
|
2734
2629
|
// 保留原来的内容方便查询一些问题
|
|
2735
2630
|
originalDiagnostic: diagnostic,
|
|
2736
2631
|
};
|
|
2632
|
+
yield;
|
|
2737
2633
|
|
|
2738
2634
|
let result: Diagnostic;
|
|
2739
2635
|
if (minRange) {
|
|
2740
2636
|
// 节点的error要置为true
|
|
2741
2637
|
result = naslNodeTranslateMessage(minRange, tsErrorDetail);
|
|
2638
|
+
yield;
|
|
2742
2639
|
} else {
|
|
2743
2640
|
// 没找到节点, 先把问题暴露出来
|
|
2744
2641
|
result = tsErrorDetail;
|
|
2745
2642
|
}
|
|
2746
|
-
|
|
2643
|
+
|
|
2644
|
+
if (result) {
|
|
2747
2645
|
result.id = record.filePath + (result ? JSON.stringify({ start: result.originalDiagnostic.start, end: result.originalDiagnostic.end }) : '');
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2748
2648
|
return result;
|
|
2749
2649
|
}
|
|
2750
2650
|
|
|
2751
2651
|
/**
|
|
2752
|
-
*
|
|
2753
|
-
*
|
|
2754
|
-
* @
|
|
2755
|
-
* @returns 找到的节点
|
|
2652
|
+
* 查找节点
|
|
2653
|
+
*
|
|
2654
|
+
* @description 生成器原型函数
|
|
2756
2655
|
*/
|
|
2757
|
-
|
|
2656
|
+
private *_findMinRangeWithGenerator(
|
|
2657
|
+
diagnostic: tsProtocol.DiagnosticWithFileName | tsProtocol.ReferencesResponseItem,
|
|
2658
|
+
fileNode: FileNode
|
|
2659
|
+
): Generator<void, MinRange> {
|
|
2758
2660
|
let minRange: MinRange;
|
|
2759
|
-
const {sourceMap} = fileNode;
|
|
2661
|
+
const { sourceMap } = fileNode;
|
|
2760
2662
|
// 是否找到了行内准确的,是的话,就不走多行的
|
|
2761
2663
|
let haveLineNode = false;
|
|
2664
|
+
|
|
2762
2665
|
for (const [node, item] of sourceMap.entries()) {
|
|
2763
2666
|
/**
|
|
2764
2667
|
* 当前内容的开始行 <= 诊断开始的行 &&
|
|
@@ -2815,16 +2718,31 @@ class NaslServer {
|
|
|
2815
2718
|
}
|
|
2816
2719
|
}
|
|
2817
2720
|
}
|
|
2721
|
+
|
|
2722
|
+
yield;
|
|
2818
2723
|
}
|
|
2724
|
+
|
|
2819
2725
|
if (!minRange) {
|
|
2820
2726
|
if (fileNode instanceof View) {
|
|
2821
|
-
return { node: fileNode, item: sourceMap.get(fileNode) };
|
|
2727
|
+
return { node: fileNode, item: sourceMap.get(fileNode) } as MinRange;
|
|
2728
|
+
}
|
|
2729
|
+
if (process.env.NODE_ENV === 'development') {
|
|
2730
|
+
console.log(minRange, '需要特殊看下,为什么没找到内容-------------');
|
|
2822
2731
|
}
|
|
2823
|
-
console.log(minRange, '需要特殊看下,为什么没找到内容-------------');
|
|
2824
2732
|
}
|
|
2733
|
+
|
|
2825
2734
|
return minRange;
|
|
2826
2735
|
}
|
|
2827
2736
|
|
|
2737
|
+
/**
|
|
2738
|
+
* 查找节点
|
|
2739
|
+
*
|
|
2740
|
+
* @description 同步模式
|
|
2741
|
+
*/
|
|
2742
|
+
_findMinRange(...args: Parameters<NaslServer['_findMinRangeWithGenerator']>) {
|
|
2743
|
+
return utils.runGeneratorSync(this._findMinRangeWithGenerator(...args));
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2828
2746
|
/**
|
|
2829
2747
|
* 查看当前节点是不是有引用
|
|
2830
2748
|
* @param node 节点
|
|
@@ -2860,11 +2778,11 @@ class NaslServer {
|
|
|
2860
2778
|
refsList.unshift(newRefs.refs[0]);
|
|
2861
2779
|
}
|
|
2862
2780
|
}
|
|
2863
|
-
} else if (node instanceof Connector) {
|
|
2781
|
+
} else if (node instanceof Connector) {
|
|
2864
2782
|
// Conenctor 虽为 Module 的子类,但是具体引用逻辑与Module 并不一致,因此这边单独处理
|
|
2865
2783
|
// 由于 在与后端定义 Connector Namespace 前缀时, Logics 相关定义为 connector,
|
|
2866
2784
|
// 其余定义为 extension, 因此这边查找引用时,需要分别查找并去重复
|
|
2867
|
-
// 这里选择 logic 与 interface 作为 查找源,因为一个 Connector 必定至少含有一个 logic 和 interface
|
|
2785
|
+
// 这里选择 logic 与 interface 作为 查找源,因为一个 Connector 必定至少含有一个 logic 和 interface
|
|
2868
2786
|
const logicList = node.namespaces.find((ns) => ns.logics.length > 0)?.logics || [];
|
|
2869
2787
|
const interfaceList = node.interfaces;
|
|
2870
2788
|
const moduleName = (fileNode as FileNode).getEmbeddedFilePath();
|
|
@@ -3177,7 +3095,7 @@ class NaslServer {
|
|
|
3177
3095
|
// });
|
|
3178
3096
|
// refsList = [...refsList, ...parentRefs.refs];
|
|
3179
3097
|
// console.log(parentRefs.refs)
|
|
3180
|
-
|
|
3098
|
+
|
|
3181
3099
|
// 流程任务出参查找引用比较特殊,需要查找到 const process = {...} 的引用
|
|
3182
3100
|
const code = this.getNodeCode(fileNode, currentSource);
|
|
3183
3101
|
const prefix = '__ProcessIdentification__';
|
|
@@ -3805,7 +3723,7 @@ class NaslServer {
|
|
|
3805
3723
|
while (parantNode && !(parantNode instanceof App)) {
|
|
3806
3724
|
// 找到上一级 在map对象中构造出他的子集
|
|
3807
3725
|
currentNode = parantNode;
|
|
3808
|
-
parantNode = parantNode.parentNode;
|
|
3726
|
+
parantNode = parantNode.parentNode as BaseNode;
|
|
3809
3727
|
// 如果第一次就塞入子集和父节点,以后就只用父节点了
|
|
3810
3728
|
// 因为部分节点没有name,先过滤掉
|
|
3811
3729
|
// if (currentNode.name) {
|
|
@@ -3914,7 +3832,9 @@ class NaslServer {
|
|
|
3914
3832
|
getCurrentSource(node: BaseNode) {
|
|
3915
3833
|
if (node instanceof App || node instanceof Theme) return { fileNode: null };
|
|
3916
3834
|
let {sourceMap} = node;
|
|
3917
|
-
let fileNode = node;
|
|
3835
|
+
let fileNode = node as FileNode & SyntaxNode;
|
|
3836
|
+
// 连接器 操作,上层结构是 Namespace, Namespace 并无含义,因此需要过滤掉
|
|
3837
|
+
const isConnectorLogic = node.getAncestor('Connector') && node.concept === 'Logic' && node.parentNode instanceof Namespace;
|
|
3918
3838
|
// 如果没有sourceMap,就继续向上找 ,或者到module结束
|
|
3919
3839
|
// 如果 节点找到 app 或者module 停止 或者entity找到DataSource为止
|
|
3920
3840
|
// 如果当前节点是view就不要向上查找了
|
|
@@ -3928,11 +3848,11 @@ class NaslServer {
|
|
|
3928
3848
|
!(fileNode.parentNode instanceof DataSource) &&
|
|
3929
3849
|
!(fileNode.parentNode instanceof Frontend) &&
|
|
3930
3850
|
!(fileNode.parentNode instanceof Backend) &&
|
|
3931
|
-
!
|
|
3851
|
+
!isConnectorLogic &&
|
|
3932
3852
|
!(fileNode instanceof View) &&
|
|
3933
3853
|
!(fileNode instanceof ConfigProperty)
|
|
3934
3854
|
) {
|
|
3935
|
-
fileNode = fileNode.parentNode;
|
|
3855
|
+
fileNode = fileNode.parentNode as FileNode & SyntaxNode;
|
|
3936
3856
|
sourceMap = fileNode?.sourceMap;
|
|
3937
3857
|
}
|
|
3938
3858
|
const currentSource = sourceMap && sourceMap.get(node);
|
|
@@ -3976,7 +3896,6 @@ class NaslServer {
|
|
|
3976
3896
|
getFieldKey: fieldKey,
|
|
3977
3897
|
});
|
|
3978
3898
|
}
|
|
3979
|
-
|
|
3980
3899
|
}
|
|
3981
3900
|
|
|
3982
3901
|
_getFieldKeySelectCompletion(args: any) {
|
|
@@ -4048,6 +3967,10 @@ class NaslServer {
|
|
|
4048
3967
|
}
|
|
4049
3968
|
return TypeAnnotation.createPrimitive(type);
|
|
4050
3969
|
}
|
|
3970
|
+
// 如果是一元表达式,那么就是布尔值
|
|
3971
|
+
if (node instanceof UnaryExpression) {
|
|
3972
|
+
return TypeAnnotation.createPrimitive('Boolean');
|
|
3973
|
+
}
|
|
4051
3974
|
// 这些原有类型的 比较的 返回值肯定就是布尔值,就不去调用ls
|
|
4052
3975
|
if (node instanceof BinaryExpression && ['==', '!=', '>', '<', '>=', '<='].includes(node.operator)) {
|
|
4053
3976
|
return TypeAnnotation.createPrimitive('Boolean');
|
|
@@ -4086,256 +4009,251 @@ class NaslServer {
|
|
|
4086
4009
|
}
|
|
4087
4010
|
|
|
4088
4011
|
/**
|
|
4089
|
-
* 获取传入节点的TypeAnnotation
|
|
4090
|
-
*
|
|
4091
|
-
* @
|
|
4092
|
-
* 普通的TypeAnnotation,额外的可能携带 option
|
|
4093
|
-
* 这里会处理callloigc callinterface 和 callfuntion 的 argment的参数一起携带回去,
|
|
4094
|
-
* 也就是说如果 只传入了这个也会一起返回argment的节点,所以返回map最好去get结果
|
|
4012
|
+
* 获取传入节点的 TypeAnnotation
|
|
4013
|
+
*
|
|
4014
|
+
* @description 生成器模式原型
|
|
4095
4015
|
*/
|
|
4096
|
-
|
|
4016
|
+
private *_getQuickInfoNodesTypeMapWithGenerator(nodes: QuickInfoNodes): Generator<any, QuickInfoMap, any> {
|
|
4097
4017
|
interface argDetail {
|
|
4098
4018
|
file: string;
|
|
4099
4019
|
line: number;
|
|
4100
4020
|
offset: number;
|
|
4101
4021
|
}
|
|
4022
|
+
|
|
4023
|
+
const self = this;
|
|
4102
4024
|
const args: Array<argDetail> = [];
|
|
4103
4025
|
// 要通过自己或者依赖关系拿的
|
|
4104
|
-
const getFromOthers:
|
|
4026
|
+
const getFromOthers: QuickInfoMap = new Map();
|
|
4105
4027
|
// 总共要返回出去的
|
|
4106
|
-
const types:
|
|
4028
|
+
const types: QuickInfoMap = new Map();
|
|
4107
4029
|
const newQuickInfoNodes: QuickInfoNodes = [];
|
|
4108
4030
|
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
// 先按照顺序占位
|
|
4114
|
-
types.set(node, null);
|
|
4031
|
+
yield* utils.wrapForEachToGenerator(nodes, function* getQuickInfoPosition(itemDetail, index) {
|
|
4032
|
+
const { node, filePath, item } = itemDetail;
|
|
4033
|
+
// 先按照顺序占位
|
|
4034
|
+
types.set(node, null);
|
|
4115
4035
|
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
if (nodeTypeAnnotation) {
|
|
4119
|
-
types.set(node, nodeTypeAnnotation);
|
|
4120
|
-
return;
|
|
4121
|
-
}
|
|
4122
|
-
// 要通过自己或者依赖关系拿的,二次遍历
|
|
4123
|
-
if (['Argument', 'Assignment', 'MatchCase'].includes(node.concept)) {
|
|
4124
|
-
getFromOthers.set(node, null);
|
|
4125
|
-
}
|
|
4126
|
-
if (['Return', 'Variable'].includes(node.concept) && (node as Variable).typeAnnotation) {
|
|
4127
|
-
types.set(node, (node as Variable).typeAnnotation);
|
|
4128
|
-
return;
|
|
4129
|
-
}
|
|
4130
|
-
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
4131
|
-
// 只有虚拟节点的入参,才没有类型
|
|
4132
|
-
if (node.concept === 'Param' && (node.parentKey !== 'virtualParams' && node.parentKey !== 'item' && node.parentNode.concept !== 'AnonymousFunction')) {
|
|
4133
|
-
return;
|
|
4134
|
-
}
|
|
4135
|
-
if (
|
|
4136
|
-
![
|
|
4137
|
-
'Identifier',
|
|
4138
|
-
'UnaryExpression',
|
|
4139
|
-
'BinaryExpression',
|
|
4140
|
-
'CallLogic',
|
|
4141
|
-
'CallFunction',
|
|
4142
|
-
'CallInterface',
|
|
4143
|
-
'MemberExpression',
|
|
4144
|
-
'Return',
|
|
4145
|
-
'Variable',
|
|
4146
|
-
'Match',
|
|
4147
|
-
'NewComposite',
|
|
4148
|
-
'NewList',
|
|
4149
|
-
'NewMap',
|
|
4150
|
-
'OqlQueryComponent',
|
|
4151
|
-
'QueryFieldExpression',
|
|
4152
|
-
'QueryGroupByExpression',
|
|
4153
|
-
'Param',
|
|
4154
|
-
'BackendVariable',
|
|
4155
|
-
'CallAuthInterface',
|
|
4156
|
-
].includes(node.concept)
|
|
4157
|
-
)
|
|
4158
|
-
return;
|
|
4036
|
+
// 获取已知节点类型的类型
|
|
4037
|
+
const nodeTypeAnnotation = self.getCurrentNodeKnownTypeAnnotation(node);
|
|
4159
4038
|
|
|
4160
|
-
|
|
4161
|
-
newQuickInfoNodes.push(itemDetail);
|
|
4162
|
-
const fileDetail = {
|
|
4163
|
-
file: filePath,
|
|
4164
|
-
line: lsp2tspNumber(item.start.line),
|
|
4165
|
-
offset: lsp2tspNumber(item.start.character),
|
|
4166
|
-
};
|
|
4039
|
+
yield;
|
|
4167
4040
|
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4041
|
+
if (nodeTypeAnnotation) {
|
|
4042
|
+
types.set(node, nodeTypeAnnotation);
|
|
4043
|
+
return;
|
|
4044
|
+
}
|
|
4045
|
+
// 要通过自己或者依赖关系拿的,二次遍历
|
|
4046
|
+
if (['Argument', 'Assignment', 'MatchCase'].includes(node.concept)) {
|
|
4047
|
+
getFromOthers.set(node, null);
|
|
4048
|
+
}
|
|
4049
|
+
if (['Return', 'Variable'].includes(node.concept) && (node as Variable).typeAnnotation) {
|
|
4050
|
+
types.set(node, (node as Variable).typeAnnotation);
|
|
4051
|
+
return;
|
|
4052
|
+
}
|
|
4053
|
+
// 如果 入参不是虚拟节点的,就不去请求类型
|
|
4054
|
+
// 只有虚拟节点的入参,才没有类型
|
|
4055
|
+
if (node.concept === 'Param' && (node.parentKey !== 'virtualParams' && node.parentKey !== 'item' && node.parentNode.concept !== 'AnonymousFunction')) {
|
|
4056
|
+
return;
|
|
4057
|
+
}
|
|
4058
|
+
if (
|
|
4059
|
+
![
|
|
4060
|
+
'Identifier',
|
|
4061
|
+
'BinaryExpression',
|
|
4062
|
+
'CallLogic',
|
|
4063
|
+
'CallFunction',
|
|
4064
|
+
'CallInterface',
|
|
4065
|
+
'MemberExpression',
|
|
4066
|
+
'Return',
|
|
4067
|
+
'Variable',
|
|
4068
|
+
'Match',
|
|
4069
|
+
'NewComposite',
|
|
4070
|
+
'NewList',
|
|
4071
|
+
'NewMap',
|
|
4072
|
+
'OqlQueryComponent',
|
|
4073
|
+
'QueryFieldExpression',
|
|
4074
|
+
'QueryGroupByExpression',
|
|
4075
|
+
'Param',
|
|
4076
|
+
'BackendVariable',
|
|
4077
|
+
'CallAuthInterface',
|
|
4078
|
+
].includes(node.concept)
|
|
4079
|
+
)
|
|
4080
|
+
return;
|
|
4081
|
+
|
|
4082
|
+
// 要去ls那边获取的
|
|
4083
|
+
newQuickInfoNodes.push(itemDetail);
|
|
4084
|
+
const fileDetail = {
|
|
4085
|
+
file: filePath,
|
|
4086
|
+
line: lsp2tspNumber(item.start.line),
|
|
4087
|
+
offset: lsp2tspNumber(item.start.character),
|
|
4088
|
+
};
|
|
4171
4089
|
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
}
|
|
4090
|
+
const getCode = (range: SourceMapItem) => {
|
|
4091
|
+
return self.tsFiles.get(filePath)?.slice(range.start.offset, range.end.offset) ?? '';
|
|
4092
|
+
};
|
|
4176
4093
|
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
indexOf =
|
|
4201
|
-
}
|
|
4202
|
-
fileDetail.offset += indexOf;
|
|
4203
|
-
} else if (
|
|
4204
|
-
node.concept === 'MemberExpression' ||
|
|
4205
|
-
node.concept === 'Identifier' ||
|
|
4206
|
-
node.concept === 'QueryFieldExpression' ||
|
|
4207
|
-
node.concept === 'QueryGroupByExpression'
|
|
4208
|
-
) {
|
|
4209
|
-
const code = getCode(item);
|
|
4210
|
-
if (code.includes('.')) {
|
|
4211
|
-
const codeArr = code?.split('.');
|
|
4212
|
-
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4213
|
-
// MemberExpression取最后一位当做类型
|
|
4214
|
-
const indexOf = code.length - lastLen;
|
|
4215
|
-
fileDetail.offset = fileDetail.offset + indexOf;
|
|
4216
|
-
}
|
|
4217
|
-
} else if (node.concept === 'Match') {
|
|
4218
|
-
const code = getCode(item);
|
|
4219
|
-
// 去查return 后面的返回值,变成函数调用
|
|
4220
|
-
if (code?.endsWith(';\n')) {
|
|
4221
|
-
fileDetail.line = item.end.line - 1;
|
|
4094
|
+
// 位置计算偏移
|
|
4095
|
+
if ('getQuickInfoOffset' in node) {
|
|
4096
|
+
Object.assign(fileDetail, (node as any).getQuickInfoOffset(fileDetail, getCode(item)));
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
yield;
|
|
4100
|
+
|
|
4101
|
+
// 位置计算偏移2
|
|
4102
|
+
// TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
|
|
4103
|
+
if (
|
|
4104
|
+
node.concept === 'BinaryExpression' ||
|
|
4105
|
+
node.concept === 'CallFunction' ||
|
|
4106
|
+
node.concept === 'CallInterface'
|
|
4107
|
+
) {
|
|
4108
|
+
const code = getCode(item);
|
|
4109
|
+
// 如果没有括号 ,括号就在外面,就 -1
|
|
4110
|
+
// 有括号就找到括号的位置 然后 -1
|
|
4111
|
+
let indexOf = 0;
|
|
4112
|
+
if (!code.includes('(')) {
|
|
4113
|
+
indexOf = -1;
|
|
4114
|
+
} else {
|
|
4115
|
+
// 如果有泛型先往前找一找
|
|
4116
|
+
if (code.includes('<')) {
|
|
4117
|
+
indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
|
|
4222
4118
|
} else {
|
|
4223
|
-
|
|
4224
|
-
}
|
|
4225
|
-
const indexOf = code.indexOf('return __MatchExpressionFuntion');
|
|
4226
|
-
let newCode = code.substring(0, indexOf);
|
|
4227
|
-
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4228
|
-
fileDetail.offset = newCode.length + 'return '.length;
|
|
4229
|
-
} else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
|
|
4230
|
-
let type;
|
|
4231
|
-
switch (node.concept) {
|
|
4232
|
-
case 'NewComposite':
|
|
4233
|
-
type = '__newComposite';
|
|
4234
|
-
break;
|
|
4235
|
-
case 'NewList':
|
|
4236
|
-
type = '__newList';
|
|
4237
|
-
break;
|
|
4238
|
-
case 'NewMap':
|
|
4239
|
-
type = '__newMap';
|
|
4240
|
-
break;
|
|
4241
|
-
default:
|
|
4119
|
+
indexOf = code.indexOf('(');
|
|
4242
4120
|
}
|
|
4243
|
-
const
|
|
4121
|
+
const subStr = code.substring(0, indexOf);
|
|
4122
|
+
const codeArr = subStr?.split('.');
|
|
4123
|
+
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4124
|
+
indexOf = subStr.length - lastLen;
|
|
4125
|
+
}
|
|
4126
|
+
fileDetail.offset += indexOf;
|
|
4127
|
+
} else if (
|
|
4128
|
+
node.concept === 'MemberExpression' ||
|
|
4129
|
+
node.concept === 'Identifier' ||
|
|
4130
|
+
node.concept === 'QueryFieldExpression' ||
|
|
4131
|
+
node.concept === 'QueryGroupByExpression'
|
|
4132
|
+
) {
|
|
4133
|
+
const code = getCode(item);
|
|
4134
|
+
if (code.includes('.')) {
|
|
4135
|
+
const codeArr = code?.split('.');
|
|
4136
|
+
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4137
|
+
// MemberExpression取最后一位当做类型
|
|
4138
|
+
const indexOf = code.length - lastLen;
|
|
4139
|
+
fileDetail.offset = fileDetail.offset + indexOf;
|
|
4140
|
+
}
|
|
4141
|
+
} else if (node.concept === 'Match') {
|
|
4142
|
+
const code = getCode(item);
|
|
4143
|
+
// 去查return 后面的返回值,变成函数调用
|
|
4144
|
+
if (code?.endsWith(';\n')) {
|
|
4145
|
+
fileDetail.line = item.end.line - 1;
|
|
4146
|
+
} else {
|
|
4244
4147
|
fileDetail.line = item.end.line;
|
|
4245
|
-
const indexOf = code.indexOf(`return ${type}`);
|
|
4246
|
-
let newCode = code.substring(0, indexOf);
|
|
4247
|
-
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4248
|
-
fileDetail.offset = newCode.length + 'return '.length;
|
|
4249
|
-
} else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
4250
|
-
fileDetail.offset += 10;
|
|
4251
4148
|
}
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4149
|
+
const indexOf = code.indexOf('return __MatchExpressionFuntion');
|
|
4150
|
+
let newCode = code.substring(0, indexOf);
|
|
4151
|
+
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4152
|
+
fileDetail.offset = newCode.length + 'return '.length;
|
|
4153
|
+
} else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
|
|
4154
|
+
let type;
|
|
4155
|
+
switch (node.concept) {
|
|
4156
|
+
case 'NewComposite':
|
|
4157
|
+
type = '__newComposite';
|
|
4158
|
+
break;
|
|
4159
|
+
case 'NewList':
|
|
4160
|
+
type = '__newList';
|
|
4161
|
+
break;
|
|
4162
|
+
case 'NewMap':
|
|
4163
|
+
type = '__newMap';
|
|
4164
|
+
break;
|
|
4165
|
+
default:
|
|
4166
|
+
}
|
|
4167
|
+
const code = getCode(item);
|
|
4168
|
+
fileDetail.line = item.end.line;
|
|
4169
|
+
const indexOf = code.indexOf(`return ${type}`);
|
|
4170
|
+
let newCode = code.substring(0, indexOf);
|
|
4171
|
+
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4172
|
+
fileDetail.offset = newCode.length + 'return '.length;
|
|
4173
|
+
} else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
4174
|
+
fileDetail.offset += 10;
|
|
4175
|
+
}
|
|
4176
|
+
args.push(fileDetail);
|
|
4177
|
+
});
|
|
4178
|
+
const resultMap: any = (yield this.getNaslNodeTypeFull(args))?.response;
|
|
4179
|
+
yield* utils.wrapForEachToGenerator(args, ({ file, line, offset }, index) => {
|
|
4259
4180
|
const item = (resultMap as any)?.[file]?.[line]?.[offset];
|
|
4260
4181
|
const itemType = item?.[0]?.nodeType;
|
|
4261
4182
|
const nodeTypeAnnotation = type2TypeAnnotation(itemType);
|
|
4262
4183
|
const {node} = newQuickInfoNodes[index];
|
|
4263
4184
|
|
|
4264
|
-
|
|
4185
|
+
types.set(node, Object.freeze(nodeTypeAnnotation) as TypeAnnotation);
|
|
4265
4186
|
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4187
|
+
const type = itemType ? (Object.isFrozen(itemType) ? itemType : Object.freeze(itemType)) : null;
|
|
4188
|
+
if (type) {
|
|
4189
|
+
(node as any).__nodeType = type;
|
|
4190
|
+
} else {
|
|
4191
|
+
delete (node as any).__nodeType;
|
|
4192
|
+
}
|
|
4193
|
+
});
|
|
4194
|
+
yield* utils.wrapIteratorToGenerator(getFromOthers.entries(), function* ([node]) {
|
|
4195
|
+
if (node instanceof Assignment) {
|
|
4196
|
+
if (!types.get(node.left)) {
|
|
4197
|
+
types.set(node.left, types.get(node.right));
|
|
4271
4198
|
}
|
|
4272
|
-
}
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
// 如果Argument,但是没可以用的类型,就用原来logic的参数类型
|
|
4284
|
-
const argType = this.getArgumentTypeAnnotation(node, newQuickInfoNodes, types as any);
|
|
4285
|
-
types.set(node, argType);
|
|
4286
|
-
} else if (node instanceof MatchCase) {
|
|
4287
|
-
// matchCase的类型
|
|
4288
|
-
// 直接从最后一项的返回值取,有就有没有就没有
|
|
4289
|
-
if (node.body?.length) {
|
|
4290
|
-
const last = node.body[node.body.length - 1];
|
|
4291
|
-
if (types.get(last)) {
|
|
4292
|
-
types.set(node, types.get(last));
|
|
4293
|
-
}
|
|
4199
|
+
} else if (node instanceof Argument) {
|
|
4200
|
+
// 如果Argument,但是没可以用的类型,就用原来logic的参数类型
|
|
4201
|
+
const argType = yield* self.getArgumentTypeAnnotationWithGenerator(node, newQuickInfoNodes, types as any);
|
|
4202
|
+
types.set(node, argType);
|
|
4203
|
+
} else if (node instanceof MatchCase) {
|
|
4204
|
+
// matchCase的类型
|
|
4205
|
+
// 直接从最后一项的返回值取,有就有没有就没有
|
|
4206
|
+
if (node.body?.length) {
|
|
4207
|
+
const last = node.body[node.body.length - 1];
|
|
4208
|
+
if (types.get(last)) {
|
|
4209
|
+
types.set(node, types.get(last));
|
|
4294
4210
|
}
|
|
4295
4211
|
}
|
|
4296
|
-
}
|
|
4297
|
-
|
|
4298
|
-
)
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
if (node
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
4313
|
-
delete node.__TypeAnnotation;
|
|
4314
|
-
return;
|
|
4315
|
-
}
|
|
4212
|
+
}
|
|
4213
|
+
});
|
|
4214
|
+
yield* utils.wrapIteratorToGenerator(types.entries(), ([node, value]) => {
|
|
4215
|
+
try {
|
|
4216
|
+
// 因为node可能是经过处理的TypeAnnotation
|
|
4217
|
+
node.__isCorrectTypeAnnotation = true;
|
|
4218
|
+
if (value) {
|
|
4219
|
+
if (node instanceof OqlQueryComponent) {
|
|
4220
|
+
// 自动推导情况
|
|
4221
|
+
const typeAnnotation = value as TypeAnnotation;
|
|
4222
|
+
if (!node.typeAnnotation && typeAnnotation) {
|
|
4223
|
+
if (typeAnnotation.typeName === 'List' && typeAnnotation.typeKind === 'generic') {
|
|
4224
|
+
const {typeArguments} = typeAnnotation;
|
|
4225
|
+
if (typeArguments.length && typeArguments[0].isComplexType()) {
|
|
4226
|
+
delete node.__TypeAnnotation;
|
|
4227
|
+
return;
|
|
4316
4228
|
}
|
|
4317
4229
|
}
|
|
4318
4230
|
}
|
|
4319
|
-
if (value instanceof TypeAnnotation) {
|
|
4320
|
-
node.__TypeAnnotation = value;
|
|
4321
|
-
} else if (value.typeAnnotation) {
|
|
4322
|
-
node.__TypeAnnotation = value.typeAnnotation;
|
|
4323
|
-
}
|
|
4324
|
-
} else {
|
|
4325
|
-
// 清空原来已经赋值上去的类型,可能原来有现在没有了
|
|
4326
|
-
delete node.__TypeAnnotation;
|
|
4327
4231
|
}
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4232
|
+
if (value instanceof TypeAnnotation) {
|
|
4233
|
+
node.__TypeAnnotation = value;
|
|
4234
|
+
} else if (value.typeAnnotation) {
|
|
4235
|
+
node.__TypeAnnotation = value.typeAnnotation;
|
|
4236
|
+
}
|
|
4237
|
+
} else {
|
|
4238
|
+
// 清空原来已经赋值上去的类型,可能原来有现在没有了
|
|
4239
|
+
delete node.__TypeAnnotation;
|
|
4332
4240
|
}
|
|
4333
|
-
}
|
|
4334
|
-
|
|
4335
|
-
|
|
4241
|
+
} catch (err) {
|
|
4242
|
+
// if (globalThis.window) {
|
|
4243
|
+
// console.log(err);
|
|
4244
|
+
// }
|
|
4245
|
+
}
|
|
4246
|
+
});
|
|
4336
4247
|
return types;
|
|
4337
4248
|
}
|
|
4338
4249
|
|
|
4250
|
+
/**
|
|
4251
|
+
* 获取传入节点的 TypeAnnotation
|
|
4252
|
+
*/
|
|
4253
|
+
getQuickInfoNodesTypeMap(nodes: QuickInfoNodes, flag?: boolean) {
|
|
4254
|
+
return utils.runGeneratorAsync(this._getQuickInfoNodesTypeMapWithGenerator(nodes));
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4339
4257
|
// 全量标注并且返回json
|
|
4340
4258
|
@withQueueExecute('annotation')
|
|
4341
4259
|
async getNaslAnnotatedJSON(app: App, releaseFlag: boolean) {
|
|
@@ -4360,6 +4278,7 @@ class NaslServer {
|
|
|
4360
4278
|
console.timeEnd('全量标注');
|
|
4361
4279
|
|
|
4362
4280
|
const json = app.toJSON();
|
|
4281
|
+
console.log(json)
|
|
4363
4282
|
|
|
4364
4283
|
if (releaseFlag) {
|
|
4365
4284
|
// 全量标注后对json进行一些修改,为了服务端翻译处理
|
|
@@ -4370,28 +4289,35 @@ class NaslServer {
|
|
|
4370
4289
|
}
|
|
4371
4290
|
|
|
4372
4291
|
// 增量标注
|
|
4373
|
-
|
|
4374
|
-
async IncrementalAnnotationJSON(records: DiagnosticRecord[]) {
|
|
4292
|
+
private *_incrementalAnnotationJSONWithGenerator(records: DiagnosticRecord[]) {
|
|
4375
4293
|
console.time('增量标注');
|
|
4376
4294
|
const nodes: QuickInfoNodes = [];
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4295
|
+
const self = this;
|
|
4296
|
+
|
|
4297
|
+
yield* utils.wrapForEachToGenerator(records, function *findNodePosition (record) {
|
|
4298
|
+
const fileNode = self.file2NodeMap.get(record.filePath);
|
|
4299
|
+
|
|
4300
|
+
if (!fileNode) {
|
|
4301
|
+
return;
|
|
4302
|
+
}
|
|
4303
|
+
|
|
4380
4304
|
record.id = fileNode.id;
|
|
4381
4305
|
record.node = fileNode;
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
nodes.push({
|
|
4386
|
-
filePath: record.filePath,
|
|
4387
|
-
node: nodeItem,
|
|
4388
|
-
item,
|
|
4389
|
-
});
|
|
4390
|
-
});
|
|
4306
|
+
|
|
4307
|
+
if (['Structure', 'DataSource', 'Entity', 'Enum', 'Role', 'MetadataType'].includes(fileNode.concept) || !fileNode.sourceMap) {
|
|
4308
|
+
return;
|
|
4391
4309
|
}
|
|
4310
|
+
|
|
4311
|
+
yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), ([nodeItem, item]) => {
|
|
4312
|
+
nodes.push({
|
|
4313
|
+
filePath: record.filePath,
|
|
4314
|
+
node: nodeItem,
|
|
4315
|
+
item,
|
|
4316
|
+
});
|
|
4317
|
+
});
|
|
4392
4318
|
});
|
|
4393
4319
|
|
|
4394
|
-
|
|
4320
|
+
yield* this._getQuickInfoNodesTypeMapWithGenerator(nodes);
|
|
4395
4321
|
console.timeEnd('增量标注');
|
|
4396
4322
|
}
|
|
4397
4323
|
|
|
@@ -4410,6 +4336,12 @@ class NaslServer {
|
|
|
4410
4336
|
// 如果节点本身有类型就不去在塞一遍了
|
|
4411
4337
|
// 有值而且没有类型再去设置
|
|
4412
4338
|
// 但是Identifier 和 MemberExpression 都用标注出来的因为本身是变量,有类型也需要覆盖一下
|
|
4339
|
+
if (value && (node instanceof Argument ) && node.getAncestor('Connector')?.concept === 'Connector') {
|
|
4340
|
+
const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
|
|
4341
|
+
if (jsonNode) {
|
|
4342
|
+
jsonNode.typeAnnotation = (value as TypeAnnotation)?.toJSON();
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4413
4345
|
if (value && (!(node as any).typeAnnotation || node instanceof Identifier || node instanceof MemberExpression)) {
|
|
4414
4346
|
const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
|
|
4415
4347
|
if (jsonNode) {
|
|
@@ -4528,7 +4460,11 @@ class NaslServer {
|
|
|
4528
4460
|
* 如果内部表达式的,就用表达式的,如果没有就试试用默认值的
|
|
4529
4461
|
* 获取logic的默认值和原来Arg的类型和默认值对应
|
|
4530
4462
|
*/
|
|
4531
|
-
|
|
4463
|
+
*getArgumentTypeAnnotationWithGenerator(
|
|
4464
|
+
node: Argument,
|
|
4465
|
+
QuickInfoNodes: QuickInfoNodes,
|
|
4466
|
+
types: Map<BaseNode, TypeAnnotation>,
|
|
4467
|
+
): Generator<void, TypeAnnotation, void> {
|
|
4532
4468
|
// 直接复用内部expression的type类型
|
|
4533
4469
|
if (
|
|
4534
4470
|
node.parentNode instanceof CallLogic &&
|
|
@@ -4545,6 +4481,7 @@ class NaslServer {
|
|
|
4545
4481
|
return nodeTypeAnnotation
|
|
4546
4482
|
}
|
|
4547
4483
|
}
|
|
4484
|
+
yield;
|
|
4548
4485
|
}
|
|
4549
4486
|
// 获取返回值结果里找到父级的callLogic || CallInterface的类型填充进去Argument
|
|
4550
4487
|
const App = node.app;
|
|
@@ -4556,7 +4493,8 @@ class NaslServer {
|
|
|
4556
4493
|
}
|
|
4557
4494
|
}
|
|
4558
4495
|
// 用户自己声明的用用户的
|
|
4559
|
-
const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace
|
|
4496
|
+
const callObj = App.findNodeByCompleteName(`${parent.calleeNamespace}.${parent.calleeName}`);
|
|
4497
|
+
yield;
|
|
4560
4498
|
const index = parent.arguments.indexOf(node);
|
|
4561
4499
|
const param = callObj?.params?.[index] || {};
|
|
4562
4500
|
// 取出参数的类型
|
|
@@ -4644,7 +4582,7 @@ class NaslServer {
|
|
|
4644
4582
|
* @param targetNode 当前操作的节点
|
|
4645
4583
|
* @param result toTs生成的内容
|
|
4646
4584
|
*/
|
|
4647
|
-
async handleDelete(fileNode: BaseNode, targetNode: BaseNode, result:
|
|
4585
|
+
async handleDelete(fileNode: BaseNode, targetNode: BaseNode, result: utils.EmbeddedTSFileResult) {
|
|
4648
4586
|
const filePath = (fileNode as FileNode).getEmbeddedFilePath();
|
|
4649
4587
|
// 如果要删除,而且当前要删Logic就直接删除并且清除错误
|
|
4650
4588
|
/**
|
|
@@ -4684,7 +4622,7 @@ class NaslServer {
|
|
|
4684
4622
|
* @param targetNode 触发修改的节点
|
|
4685
4623
|
* @param result 生成代码的code 和位置信息
|
|
4686
4624
|
*/
|
|
4687
|
-
async handleChange(fileNode: BaseNode, targetNode: BaseNode, result:
|
|
4625
|
+
async handleChange(fileNode: BaseNode, targetNode: BaseNode, result: utils.EmbeddedTSFileResult, action: string) {
|
|
4688
4626
|
this.file2NodeMap.set(result.filePath, fileNode);
|
|
4689
4627
|
|
|
4690
4628
|
const outputFiles = [{ file: result.filePath, fileContent: result.code }];
|
|
@@ -4729,7 +4667,7 @@ class NaslServer {
|
|
|
4729
4667
|
* @param isRename 是不是修改名字
|
|
4730
4668
|
* @param oldFilePath 如果是改名,文件级别的才会有这个参数,用于文件新增替换
|
|
4731
4669
|
*/
|
|
4732
|
-
async handleRename(fileNode: BaseNode, targetNode: BaseNode, result:
|
|
4670
|
+
async handleRename(fileNode: BaseNode, targetNode: BaseNode, result: utils.EmbeddedTSFileResult, oldFilePath?: string) {
|
|
4733
4671
|
// rename 场景
|
|
4734
4672
|
const outputFiles = [{ file: result.filePath, fileContent: result.code }];
|
|
4735
4673
|
// 如果是要修改顶级文件名
|
|
@@ -4833,7 +4771,7 @@ class NaslServer {
|
|
|
4833
4771
|
const fileNodeChildren = [...fileNode.views, ...fileNode.variables];
|
|
4834
4772
|
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
4835
4773
|
const fileNodeItem = fileNodeChildren[i];
|
|
4836
|
-
const result = (fileNodeItem as FileNode).toEmbeddedTSFile();
|
|
4774
|
+
const result = await utils.timeSlicingWithGenerator((fileNodeItem as FileNode).toEmbeddedTSFile());
|
|
4837
4775
|
fileNodeItem.sourceMap = result.sourceMap;
|
|
4838
4776
|
if (action === 'create') {
|
|
4839
4777
|
await this.handleChange(fileNodeItem, fileNodeItem, result, action);
|
|
@@ -4856,7 +4794,7 @@ class NaslServer {
|
|
|
4856
4794
|
const fileNodeChildren = fileNode.children;
|
|
4857
4795
|
for (let i = 0; i < fileNodeChildren.length; i++) {
|
|
4858
4796
|
const fileNodeItem = fileNodeChildren[i];
|
|
4859
|
-
const result = (fileNodeItem as FileNode).toEmbeddedTSFile();
|
|
4797
|
+
const result = await utils.timeSlicingWithGenerator((fileNodeItem as FileNode).toEmbeddedTSFile());
|
|
4860
4798
|
fileNodeItem.sourceMap = result.sourceMap;
|
|
4861
4799
|
if (action === 'create') {
|
|
4862
4800
|
await this.handleChange(fileNodeItem, fileNodeItem, result, action);
|
|
@@ -4880,8 +4818,7 @@ class NaslServer {
|
|
|
4880
4818
|
isChangeInterface = true;
|
|
4881
4819
|
}
|
|
4882
4820
|
const module: Module = targetNode as Module;
|
|
4883
|
-
const results
|
|
4884
|
-
this.contentToFile(module, results);
|
|
4821
|
+
const results = await utils.timeSlicingWithGenerator(this.contentToFile(module));
|
|
4885
4822
|
for (let i = 0; i < results.length; i++) {
|
|
4886
4823
|
const result = results[i];
|
|
4887
4824
|
const node = this.file2NodeMap.get(result.filePath);
|
|
@@ -4908,7 +4845,7 @@ class NaslServer {
|
|
|
4908
4845
|
if (fileNode instanceof DataSource) {
|
|
4909
4846
|
(fileNode as DataSource).entities.forEach(async (entity) => {
|
|
4910
4847
|
try {
|
|
4911
|
-
const result = entity.toEmbeddedTSFile();
|
|
4848
|
+
const result = await utils.timeSlicingWithGenerator(entity.toEmbeddedTSFile());
|
|
4912
4849
|
const parentPath = oldpath.replace('.ts', '/');
|
|
4913
4850
|
const currentOldPath = `${parentPath }/entities/${ entity.name }.ts`;
|
|
4914
4851
|
// 因为重命名这里只有当前修改父级的 旧名称, 所以他的子集也要根据旧名称去查依赖 更新内容
|
|
@@ -4924,9 +4861,35 @@ class NaslServer {
|
|
|
4924
4861
|
async receiveHandleChange($event: EventPayload) {
|
|
4925
4862
|
this.singleFileChangeIng = true;
|
|
4926
4863
|
// 行为
|
|
4927
|
-
const {action} = $event;
|
|
4864
|
+
const { action, oldObject = {}, object = {} } = $event;
|
|
4865
|
+
|
|
4866
|
+
// 根据行为跳过更新文件
|
|
4867
|
+
// 如果更新国际化key,不需要修改ts文件
|
|
4868
|
+
if (Object.keys(object || {}).length === 1 && Object.keys(oldObject).length === 1) {
|
|
4869
|
+
if (object.i18nKey && !oldObject.i18nKey) {
|
|
4870
|
+
return;
|
|
4871
|
+
} else if (object.i18nInfo && !oldObject.i18nInfo) {
|
|
4872
|
+
return;
|
|
4873
|
+
} else if (!object.i18nKey && oldObject.i18nKey) {
|
|
4874
|
+
// 撤销重做 也跳过更新
|
|
4875
|
+
return;
|
|
4876
|
+
} else if (!object.i18nInfo && oldObject.i18nInfo) {
|
|
4877
|
+
// 撤销重做 也跳过更新
|
|
4878
|
+
return;
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
|
|
4928
4882
|
const targetNode = $event.target;
|
|
4929
4883
|
console.log(targetNode, 'targetNode')
|
|
4884
|
+
// 连接器namespace 没有真实文件,不需要走删除
|
|
4885
|
+
if (targetNode instanceof Namespace && targetNode.parentNode instanceof Connector) {
|
|
4886
|
+
return;
|
|
4887
|
+
}
|
|
4888
|
+
// 连接器本身没有真实文件,也不需要删除
|
|
4889
|
+
if (targetNode instanceof Connector) {
|
|
4890
|
+
return;
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4930
4893
|
// Connection 相关配置的更新不需要写入文件
|
|
4931
4894
|
// i18nInfo 更新不需要写入文件
|
|
4932
4895
|
if (targetNode?.parentNode instanceof Connection || targetNode instanceof I18nInfo) {
|
|
@@ -4947,21 +4910,25 @@ class NaslServer {
|
|
|
4947
4910
|
return;
|
|
4948
4911
|
}
|
|
4949
4912
|
|
|
4913
|
+
// debugger;
|
|
4950
4914
|
if (process.env.NODE_ENV === 'development') {
|
|
4951
4915
|
console.time('重新生成 TS 文件');
|
|
4952
4916
|
}
|
|
4953
|
-
|
|
4954
|
-
const
|
|
4917
|
+
|
|
4918
|
+
const fileTsPath = fileNode.getEmbeddedFilePath();
|
|
4919
|
+
const result = await utils.timeSlicingWithGenerator(fileNode.toEmbeddedTSFile());
|
|
4920
|
+
|
|
4955
4921
|
if (process.env.NODE_ENV === 'development') {
|
|
4956
4922
|
console.timeEnd('重新生成 TS 文件');
|
|
4957
|
-
console.log('重新生成 TS 文件',
|
|
4923
|
+
console.log('重新生成 TS 文件', fileTsPath);
|
|
4958
4924
|
}
|
|
4959
4925
|
|
|
4960
4926
|
// 当前操作的节点
|
|
4961
4927
|
// 如果当前没有生成tsFile
|
|
4962
|
-
if (!result) {
|
|
4928
|
+
if (!result.sourceMap) {
|
|
4963
4929
|
return;
|
|
4964
4930
|
}
|
|
4931
|
+
|
|
4965
4932
|
// 修改触发修改文件
|
|
4966
4933
|
this._debugInFileStorage(targetNode, [
|
|
4967
4934
|
{
|
|
@@ -4971,6 +4938,7 @@ class NaslServer {
|
|
|
4971
4938
|
]);
|
|
4972
4939
|
|
|
4973
4940
|
fileNode.sourceMap = result.sourceMap;
|
|
4941
|
+
|
|
4974
4942
|
if (action === 'update' || action === 'create') {
|
|
4975
4943
|
if ($event?.field !== 'name') {
|
|
4976
4944
|
await this.handleChange(fileNode, targetNode, result, action);
|