@lcap/nasl 3.4.0-beta.8 → 3.4.0-beta.9
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/559608df-ab15-4969-acf0-5239dacd6111.json +1 -0
- package/.nyc_output/processinfo/559608df-ab15-4969-acf0-5239dacd6111.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 +476 -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 +718 -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 +1282 -0
- package/coverage/src/breakpoint/generator/CallbackNode.ts.html +196 -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 +4303 -0
- package/coverage/src/common/Command.ts.html +310 -0
- package/coverage/src/common/EventEmitter.ts.html +370 -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 +206 -0
- package/coverage/src/common/index.ts.html +97 -0
- package/coverage/src/common/utils.ts.html +136 -0
- package/coverage/src/concepts/Abort__.ts.html +358 -0
- package/coverage/src/concepts/AbstractInterface__.ts.html +280 -0
- package/coverage/src/concepts/Anchor__.ts.html +703 -0
- package/coverage/src/concepts/AnonymousFunction__.ts.html +2122 -0
- package/coverage/src/concepts/App__.ts.html +14305 -0
- package/coverage/src/concepts/Argument__.ts.html +1033 -0
- package/coverage/src/concepts/Assignee__.ts.html +2326 -0
- package/coverage/src/concepts/AssignmentLine__.ts.html +442 -0
- package/coverage/src/concepts/Assignment__.ts.html +1201 -0
- package/coverage/src/concepts/Attribute__.ts.html +760 -0
- package/coverage/src/concepts/AuthInterface__.ts.html +370 -0
- package/coverage/src/concepts/AuthLogicForCallInterface__.ts.html +1948 -0
- package/coverage/src/concepts/AuthLogic__.ts.html +793 -0
- package/coverage/src/concepts/BackendVariable__.ts.html +1567 -0
- package/coverage/src/concepts/Backend__.ts.html +1243 -0
- package/coverage/src/concepts/BatchAssignment__.ts.html +3406 -0
- package/coverage/src/concepts/BinaryExpression__.ts.html +1519 -0
- package/coverage/src/concepts/BindAttribute__.ts.html +3955 -0
- package/coverage/src/concepts/BindDirective__.ts.html +2026 -0
- package/coverage/src/concepts/BindEvent__.ts.html +3502 -0
- package/coverage/src/concepts/BindStyle__.ts.html +1669 -0
- package/coverage/src/concepts/Block__.ts.html +910 -0
- package/coverage/src/concepts/BooleanLiteral__.ts.html +445 -0
- package/coverage/src/concepts/CallAuthInterface__.ts.html +1672 -0
- package/coverage/src/concepts/CallConnector__.ts.html +949 -0
- package/coverage/src/concepts/CallFunction__.ts.html +2290 -0
- package/coverage/src/concepts/CallInterface__.ts.html +2752 -0
- package/coverage/src/concepts/CallLogic__.ts.html +4924 -0
- package/coverage/src/concepts/CallQueryComponent__.ts.html +5341 -0
- package/coverage/src/concepts/Comment__.ts.html +427 -0
- package/coverage/src/concepts/CompletionProperty__.ts.html +952 -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 +1405 -0
- package/coverage/src/concepts/Configuration__.ts.html +1054 -0
- package/coverage/src/concepts/Connection__.ts.html +1435 -0
- package/coverage/src/concepts/ConnectorTrigger__.ts.html +598 -0
- package/coverage/src/concepts/Connector__.ts.html +4378 -0
- package/coverage/src/concepts/Constant__.ts.html +973 -0
- package/coverage/src/concepts/CountersignPolicy__.ts.html +316 -0
- package/coverage/src/concepts/DataSource__.ts.html +1825 -0
- package/coverage/src/concepts/DatabaseTypeAnnotation__.ts.html +334 -0
- package/coverage/src/concepts/DefaultValue__.ts.html +1000 -0
- package/coverage/src/concepts/Destination__.ts.html +2773 -0
- package/coverage/src/concepts/End__.ts.html +463 -0
- package/coverage/src/concepts/EntityIndex__.ts.html +817 -0
- package/coverage/src/concepts/EntityProperty__.ts.html +2776 -0
- package/coverage/src/concepts/Entity__.ts.html +3028 -0
- package/coverage/src/concepts/EnumItem__.ts.html +580 -0
- package/coverage/src/concepts/Enum__.ts.html +1291 -0
- package/coverage/src/concepts/Event__.ts.html +1111 -0
- package/coverage/src/concepts/ExternalDestination__.ts.html +1087 -0
- package/coverage/src/concepts/ForEachStatement__.ts.html +2005 -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 +4117 -0
- package/coverage/src/concepts/Function__.ts.html +3751 -0
- package/coverage/src/concepts/I18nInfo__.ts.html +436 -0
- package/coverage/src/concepts/Identifier__.ts.html +1087 -0
- package/coverage/src/concepts/IfStatement__.ts.html +1657 -0
- package/coverage/src/concepts/ImportedInterface__.ts.html +268 -0
- package/coverage/src/concepts/Integration__.ts.html +1279 -0
- package/coverage/src/concepts/InterfaceParam__.ts.html +1144 -0
- package/coverage/src/concepts/Interface__.ts.html +3496 -0
- package/coverage/src/concepts/JSBlock__.ts.html +451 -0
- package/coverage/src/concepts/JavaLogic__.ts.html +493 -0
- package/coverage/src/concepts/LogicItem__.ts.html +1201 -0
- package/coverage/src/concepts/Logic__.ts.html +7495 -0
- package/coverage/src/concepts/MatchCase__.ts.html +3013 -0
- package/coverage/src/concepts/Match__.ts.html +2527 -0
- package/coverage/src/concepts/MemberExpression__.ts.html +1783 -0
- package/coverage/src/concepts/MetadataType__.ts.html +2053 -0
- package/coverage/src/concepts/MicroApp__.ts.html +439 -0
- package/coverage/src/concepts/Module__.ts.html +9874 -0
- package/coverage/src/concepts/MsgTriggerEvent__.ts.html +1072 -0
- package/coverage/src/concepts/MsgTriggerLauncher__.ts.html +1045 -0
- package/coverage/src/concepts/MultiApprovalPolicy__.ts.html +292 -0
- package/coverage/src/concepts/Namespace__.ts.html +8209 -0
- package/coverage/src/concepts/NewComposite__.ts.html +4909 -0
- package/coverage/src/concepts/NewList__.ts.html +1756 -0
- package/coverage/src/concepts/NewMap__.ts.html +2431 -0
- package/coverage/src/concepts/New__.ts.html +319 -0
- package/coverage/src/concepts/NullLiteral__.ts.html +376 -0
- package/coverage/src/concepts/NumericLiteral__.ts.html +730 -0
- package/coverage/src/concepts/OqlQueryComponent__.ts.html +1267 -0
- package/coverage/src/concepts/OverriddenLogic__.ts.html +6940 -0
- package/coverage/src/concepts/Param__.ts.html +1801 -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 +6292 -0
- package/coverage/src/concepts/ProcessOutcome__.ts.html +424 -0
- package/coverage/src/concepts/ProcessOutcomes__.ts.html +415 -0
- package/coverage/src/concepts/Process__.ts.html +4915 -0
- package/coverage/src/concepts/QueryAggregateExpression__.ts.html +619 -0
- package/coverage/src/concepts/QueryFieldExpression__.ts.html +613 -0
- package/coverage/src/concepts/QueryFromExpression__.ts.html +970 -0
- package/coverage/src/concepts/QueryGroupByExpression__.ts.html +610 -0
- package/coverage/src/concepts/QueryJoinExpression__.ts.html +1627 -0
- package/coverage/src/concepts/QueryLimitExpression__.ts.html +694 -0
- package/coverage/src/concepts/QueryOrderByExpression__.ts.html +739 -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 +1393 -0
- package/coverage/src/concepts/Role__.ts.html +631 -0
- package/coverage/src/concepts/SelectMembers__.ts.html +1303 -0
- package/coverage/src/concepts/SequentialPolicy__.ts.html +259 -0
- package/coverage/src/concepts/Slot__.ts.html +655 -0
- package/coverage/src/concepts/SqlQueryComponent__.ts.html +1042 -0
- package/coverage/src/concepts/Start__.ts.html +331 -0
- package/coverage/src/concepts/StaticString__.ts.html +403 -0
- package/coverage/src/concepts/StringInterpolation__.ts.html +1210 -0
- package/coverage/src/concepts/StringLiteral__.ts.html +535 -0
- package/coverage/src/concepts/StructureProperty__.ts.html +1189 -0
- package/coverage/src/concepts/Structure__.ts.html +2176 -0
- package/coverage/src/concepts/SwitchCase__.ts.html +1225 -0
- package/coverage/src/concepts/SwitchStatement__.ts.html +934 -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 +808 -0
- package/coverage/src/concepts/TypeAnnotation__.ts.html +3949 -0
- package/coverage/src/concepts/TypeParam__.ts.html +349 -0
- package/coverage/src/concepts/UnaryExpression__.ts.html +775 -0
- package/coverage/src/concepts/Unparsed__.ts.html +418 -0
- package/coverage/src/concepts/UseComponent__.ts.html +334 -0
- package/coverage/src/concepts/ValidationRule__.ts.html +1879 -0
- package/coverage/src/concepts/Variable__.ts.html +1570 -0
- package/coverage/src/concepts/ViewBlock__.ts.html +355 -0
- package/coverage/src/concepts/ViewComponent__.ts.html +4255 -0
- package/coverage/src/concepts/ViewElement__.ts.html +9013 -0
- package/coverage/src/concepts/View__.ts.html +8932 -0
- package/coverage/src/concepts/WhileStatement__.ts.html +1126 -0
- package/coverage/src/concepts/basics/constants.ts.html +88 -0
- package/coverage/src/concepts/basics/index.html +116 -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 +6844 -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 +2021 -0
- package/coverage/src/concepts/index.ts.html +103 -0
- package/coverage/src/concepts/index__.ts.html +463 -0
- package/coverage/src/concepts/utils/asserts.ts.html +27967 -0
- package/coverage/src/concepts/utils/index.html +116 -0
- package/coverage/src/config.ts.html +325 -0
- package/coverage/src/decorators/index.html +131 -0
- package/coverage/src/decorators/index.ts.html +574 -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 +1822 -0
- package/coverage/src/generator/genHash.ts.html +124 -0
- package/coverage/src/generator/genMetaData.ts.html +1129 -0
- package/coverage/src/generator/genReleaseBody.ts.html +1282 -0
- package/coverage/src/generator/icestark.ts.html +226 -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 +1108 -0
- package/coverage/src/generator/qiankun.ts.html +238 -0
- package/coverage/src/generator/styleReplacer.ts.html +199 -0
- package/coverage/src/index.html +146 -0
- package/coverage/src/index.ts.html +121 -0
- package/coverage/src/manager/diagnostic.ts.html +439 -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 +682 -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 +1792 -0
- package/coverage/src/server/formatTsUtils.ts.html +2692 -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 +1375 -0
- package/coverage/src/server/getMemberIdentifier.ts.html +1672 -0
- package/coverage/src/server/getProcessComponents.ts.html +112 -0
- package/coverage/src/server/getProcesses.ts.html +2173 -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 +232 -0
- package/coverage/src/server/naslServer.ts.html +14659 -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 +2611 -0
- package/coverage/src/service/creator/add.configs.js.html +397 -0
- package/coverage/src/service/creator/errHandles.js.html +313 -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 +3694 -0
- package/coverage/src/service/storage/jsoner.ts.html +565 -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 +1072 -0
- package/coverage/src/templator/genCurdEditMultipleKeyBlock.ts.html +1609 -0
- package/coverage/src/templator/genCurdMultipleKeyBlock.ts.html +2236 -0
- package/coverage/src/templator/genEditTableBlock.ts.html +1018 -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 +1195 -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 +1924 -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 +757 -0
- package/coverage/src/utils/cookie.ts.html +265 -0
- package/coverage/src/utils/env.ts.html +91 -0
- package/coverage/src/utils/i18nInfo.ts.html +166 -0
- package/coverage/src/utils/index.html +221 -0
- package/coverage/src/utils/index.ts.html +748 -0
- package/coverage/src/utils/logger.ts.html +145 -0
- package/coverage/src/utils/sortTsString.ts.html +202 -0
- package/coverage/src/utils/string.ts.html +502 -0
- package/coverage/src/utils/time-slicing/constant.ts.html +196 -0
- package/coverage/src/utils/time-slicing/controller.ts.html +1144 -0
- package/coverage/src/utils/time-slicing/index.html +236 -0
- package/coverage/src/utils/time-slicing/index.ts.html +103 -0
- package/coverage/src/utils/time-slicing/page-state.ts.html +121 -0
- package/coverage/src/utils/time-slicing/performance.ts.html +253 -0
- package/coverage/src/utils/time-slicing/runner.ts.html +241 -0
- package/coverage/src/utils/time-slicing/tool.ts.html +220 -0
- package/coverage/src/utils/time-slicing/utils.ts.html +355 -0
- package/coverage/src/utils/time-slicing/wrapper.ts.html +259 -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/concepts/BackendVariable__.js +10 -2
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BinaryExpression__.d.ts +2 -0
- package/out/concepts/BinaryExpression__.js +4 -0
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +2 -0
- package/out/concepts/CallFunction__.js +14 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -0
- package/out/concepts/CallInterface__.js +5 -1
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +3 -2
- package/out/concepts/CallLogic__.js +15 -26
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Logic__.js +0 -1
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts +1 -1
- package/out/concepts/MemberExpression__.js +3 -3
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts +2 -0
- package/out/concepts/NewComposite__.js +4 -0
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.d.ts +2 -0
- package/out/concepts/NewList__.js +4 -0
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.d.ts +2 -0
- package/out/concepts/NewMap__.js +4 -0
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/Param__.js +11 -3
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Return__.js +10 -2
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/Variable__.js +10 -2
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/utils/quick-info.d.ts +13 -0
- package/out/concepts/utils/quick-info.js +51 -0
- package/out/concepts/utils/quick-info.js.map +1 -0
- package/out/server/naslServer.js +2 -48
- package/out/server/naslServer.js.map +1 -1
- package/out/translator/utils.d.ts +2 -2
- package/package.json +1 -1
- package/src/concepts/BackendVariable__.ts +10 -2
- package/src/concepts/BinaryExpression__.ts +5 -1
- package/src/concepts/CallFunction__.ts +15 -2
- package/src/concepts/CallInterface__.ts +6 -1
- package/src/concepts/CallLogic__.ts +15 -30
- package/src/concepts/Logic__.ts +0 -1
- package/src/concepts/MemberExpression__.ts +3 -3
- package/src/concepts/NewComposite__.ts +5 -5
- package/src/concepts/NewList__.ts +6 -2
- package/src/concepts/NewMap__.ts +6 -3
- package/src/concepts/Param__.ts +11 -3
- package/src/concepts/Return__.ts +10 -2
- package/src/concepts/Variable__.ts +10 -2
- package/src/concepts/utils/quick-info.ts +64 -0
- package/src/server/naslServer.ts +1 -45
- package/src/translator/utils.ts +2 -2
- package/test/concepts/binary-expression/__snapshots__/getQuickInfoOffset.spec.ts.snap +25 -0
- package/test/concepts/binary-expression/getQuickInfoOffset.spec.ts +19 -0
- package/test/concepts/call-function/__snapshots__/getQuickInfoOffset.spec.ts.snap +41 -0
- package/test/concepts/call-function/getQuickInfoOffset.spec.ts +19 -0
- package/test/concepts/call-interface/__snapshots__/getQuickInfoOffset.spec.ts.snap +86 -0
- package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
- package/test/concepts/call-interface/getQuickInfoOffset.spec.ts +19 -0
- package/test/concepts/call-logic/getQuickInfoOffset.spec.ts +2 -7
- package/test/concepts/new-composite/__snapshots__/getQuickInfoOffset.spec.ts.snap +104 -0
- package/test/concepts/new-composite/__snapshots__/toEmbeddedTS.spec.ts.snap +97 -0
- package/test/concepts/new-composite/__snapshots__/toJS.spec.ts.snap +43 -0
- package/test/concepts/new-composite/constant.ts +5 -0
- package/test/concepts/new-composite/fixtures/nested-transform.json +241 -0
- package/test/concepts/new-composite/fixtures/nested.json +146 -0
- package/test/concepts/new-composite/fixtures/normal.json +63 -0
- package/test/concepts/new-composite/getQuickInfoOffset.spec.ts +19 -0
- package/test/concepts/new-composite/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/new-composite/toJS.spec.ts +14 -0
- package/test/concepts/new-list/__snapshots__/getQuickInfoOffset.spec.ts.snap +165 -0
- package/test/concepts/new-list/__snapshots__/toEmbeddedTS.spec.ts.snap +207 -0
- package/test/concepts/new-list/__snapshots__/toJS.spec.ts.snap +63 -0
- package/test/concepts/new-list/constant.ts +5 -0
- package/test/concepts/new-list/fixtures/nested-map.json +117 -0
- package/test/concepts/new-list/fixtures/nested-tranform.json +140 -0
- package/test/concepts/new-list/fixtures/nested.json +107 -0
- package/test/concepts/new-list/fixtures/normal.json +95 -0
- package/test/concepts/new-list/getQuickInfoOffset.spec.ts +19 -0
- package/test/concepts/new-list/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/new-list/toJS.spec.ts +14 -0
- package/test/concepts/new-map/__snapshots__/getQuickInfoOffset.spec.ts.snap +115 -0
- package/test/concepts/new-map/__snapshots__/toEmbeddedTS.spec.ts.snap +192 -0
- package/test/concepts/new-map/__snapshots__/toJS.spec.ts.snap +54 -0
- package/test/concepts/new-map/constant.ts +5 -0
- package/test/concepts/new-map/fixtures/nested-transform.json +169 -0
- package/test/concepts/new-map/fixtures/nested.json +141 -0
- package/test/concepts/new-map/fixtures/normal.json +101 -0
- package/test/concepts/new-map/getQuickInfoOffset.spec.ts +19 -0
- package/test/concepts/new-map/toEmbeddedTS.spec.ts +15 -0
- package/test/concepts/new-map/toJS.spec.ts +14 -0
- package/test/concepts/utils.ts +17 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Position, Range, TranslatorState } from './types';
|
|
2
|
-
import TypeAnnotation from '../concepts/TypeAnnotation__';
|
|
3
|
-
import App from '../concepts/App__';
|
|
2
|
+
import type TypeAnnotation from '../concepts/TypeAnnotation__';
|
|
3
|
+
import type App from '../concepts/App__';
|
|
4
4
|
export declare function lsp2tspNumber(num: number): number;
|
|
5
5
|
export declare const indent: (tabSize: number) => string;
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -321,12 +321,20 @@ export class BackendVariable extends BaseNode {
|
|
|
321
321
|
toJS(state?: TranslatorState): string {
|
|
322
322
|
const context = this.view ? 'this' : 'Vue.prototype';
|
|
323
323
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
324
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
325
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
326
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
327
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
328
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
329
|
+
typeKind = typeAn.typeKind;
|
|
330
|
+
typeName = typeAn.typeName;
|
|
331
|
+
}
|
|
324
332
|
const needGenInitFromSchema =
|
|
325
333
|
typeAnnotation &&
|
|
326
|
-
(!['primitive', 'union'].includes(
|
|
334
|
+
(!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
327
335
|
let code = `${this.name} =`;
|
|
328
336
|
if (needGenInitFromSchema) {
|
|
329
|
-
code += `${context}.$genInitFromSchema('${
|
|
337
|
+
code += `${context}.$genInitFromSchema('${sortedTypeKey}',`;
|
|
330
338
|
}
|
|
331
339
|
|
|
332
340
|
if (this.defaultValue?.expression) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
1
|
import {
|
|
3
2
|
TranslatorState,
|
|
4
3
|
shiftState,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
TranslatorGenerator,
|
|
10
9
|
} from '../translator';
|
|
11
10
|
import { ElementToVueOptions } from './ViewElement__';
|
|
11
|
+
import { getCallExpressionQuickInfo, Range, GetCode } from './utils/quick-info';
|
|
12
12
|
|
|
13
13
|
const operatorMap = {
|
|
14
14
|
'&&': 'and',
|
|
@@ -475,6 +475,10 @@ export class BinaryExpression extends LogicItem {
|
|
|
475
475
|
return code;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
479
|
+
return getCallExpressionQuickInfo(range, getCode);
|
|
480
|
+
}
|
|
481
|
+
|
|
478
482
|
//================================================================================
|
|
479
483
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
480
484
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
withGenerator,
|
|
12
12
|
TranslatorGenerator,
|
|
13
13
|
} from '../translator';
|
|
14
|
+
import { getCallExpressionQuickInfo, Range, GetCode } from './utils/quick-info';
|
|
14
15
|
import type Function from './Function__';
|
|
15
16
|
import { ElementToVueOptions } from './ViewElement__';
|
|
16
17
|
import type Identifier from './Identifier__';
|
|
@@ -526,10 +527,18 @@ export class CallFunction extends LogicItem {
|
|
|
526
527
|
|
|
527
528
|
code += ')';
|
|
528
529
|
const tyAnno = (this as any).typeAnnotation || this.__TypeAnnotation;
|
|
530
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = tyAnno || {};
|
|
531
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
532
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
533
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
534
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
535
|
+
typeKind = typeAn.typeKind;
|
|
536
|
+
typeName = typeAn.typeName;
|
|
537
|
+
}
|
|
529
538
|
const needGenInitFromSchema =
|
|
530
|
-
tyAnno && (!['primitive', 'union'].includes(
|
|
539
|
+
tyAnno && (!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
531
540
|
if (needGenInitFromSchema) {
|
|
532
|
-
code = `this.$genInitFromSchema('${
|
|
541
|
+
code = `this.$genInitFromSchema('${sortedTypeKey}', ${code})`;
|
|
533
542
|
}
|
|
534
543
|
return code;
|
|
535
544
|
}
|
|
@@ -721,6 +730,10 @@ export class CallFunction extends LogicItem {
|
|
|
721
730
|
fn.checkParamName();
|
|
722
731
|
});
|
|
723
732
|
}
|
|
733
|
+
|
|
734
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
735
|
+
return getCallExpressionQuickInfo(range, getCode);
|
|
736
|
+
}
|
|
724
737
|
//================================================================================
|
|
725
738
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
726
739
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -19,6 +19,7 @@ import type { MemberExpression } from './MemberExpression__';
|
|
|
19
19
|
import type Frontend from './Frontend__';
|
|
20
20
|
import type Connector from './Connector__';
|
|
21
21
|
import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
|
|
22
|
+
import { getCallExpressionQuickInfo, Range, GetCode } from './utils/quick-info';
|
|
22
23
|
|
|
23
24
|
//================================================================================
|
|
24
25
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -722,7 +723,7 @@ export class CallInterface extends LogicItem {
|
|
|
722
723
|
const idx = logicParam.findIndex((params) => arg.keyword === params.name);
|
|
723
724
|
const param = logicParam[idx];
|
|
724
725
|
|
|
725
|
-
arg.paramRequired =
|
|
726
|
+
arg.paramRequired = param?.required;
|
|
726
727
|
arg.paramTypeAnnotation = undefined;
|
|
727
728
|
arg.paramDefaultValue = undefined;
|
|
728
729
|
// 取到是不是必填放入参数中
|
|
@@ -897,6 +898,10 @@ export class CallInterface extends LogicItem {
|
|
|
897
898
|
get integration() {
|
|
898
899
|
return this.getAncestor('Integration');
|
|
899
900
|
}
|
|
901
|
+
|
|
902
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
903
|
+
return getCallExpressionQuickInfo(range, getCode);
|
|
904
|
+
}
|
|
900
905
|
//================================================================================
|
|
901
906
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
902
907
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -15,8 +15,7 @@ import type Param from './Param__';
|
|
|
15
15
|
import type View from './View__';
|
|
16
16
|
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
17
17
|
import { findConceptKeyWordIndexFromNamespace } from '../utils';
|
|
18
|
-
import {
|
|
19
|
-
import type Identifier from './Identifier__';
|
|
18
|
+
import { getCallExpressionQuickInfo, GetCode, Range } from './utils/quick-info';
|
|
20
19
|
import type { ViewElement, ElementToVueOptions } from './ViewElement__';
|
|
21
20
|
import type { MemberExpression } from './MemberExpression__';
|
|
22
21
|
|
|
@@ -1194,11 +1193,17 @@ export class CallLogic extends LogicItem {
|
|
|
1194
1193
|
};
|
|
1195
1194
|
}
|
|
1196
1195
|
const typeAnnotation = (this as any).typeAnnotation || this.__TypeAnnotation;
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
(
|
|
1196
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
1197
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
1198
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
1199
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
1200
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
1201
|
+
typeKind = typeAn.typeKind;
|
|
1202
|
+
typeName = typeAn.typeName;
|
|
1203
|
+
}
|
|
1204
|
+
const needGenInitFromSchema = typeAnnotation && (!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
1200
1205
|
if (needGenInitFromSchema) {
|
|
1201
|
-
code = `this.$genInitFromSchema('${
|
|
1206
|
+
code = `this.$genInitFromSchema('${sortedTypeKey}', ${code})`;
|
|
1202
1207
|
}
|
|
1203
1208
|
code += ')';
|
|
1204
1209
|
return code;
|
|
@@ -1515,41 +1520,21 @@ export class CallLogic extends LogicItem {
|
|
|
1515
1520
|
}
|
|
1516
1521
|
|
|
1517
1522
|
/** 获取类型标注时的偏移量 */
|
|
1518
|
-
getQuickInfoOffset(
|
|
1523
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
1519
1524
|
if (this.useIife) {
|
|
1520
1525
|
const characterOffset = 8;
|
|
1526
|
+
const code = getCode();
|
|
1521
1527
|
const lines = code.split('\n');
|
|
1522
1528
|
const lineOffset = lines.findIndex((item) => item.startsWith('return wrapper'));
|
|
1523
1529
|
|
|
1524
1530
|
return {
|
|
1525
|
-
line:
|
|
1531
|
+
line: range.start.line + lineOffset + 1,
|
|
1526
1532
|
offset: characterOffset,
|
|
1527
1533
|
};
|
|
1528
1534
|
}
|
|
1529
|
-
let indexOf = 0;
|
|
1530
|
-
|
|
1531
|
-
// 没有括号,表示括号在外面
|
|
1532
|
-
if (!code.includes('(')) {
|
|
1533
|
-
indexOf = -1;
|
|
1534
|
-
}
|
|
1535
|
-
// 有括号就找到括号的位置
|
|
1536
1535
|
else {
|
|
1537
|
-
|
|
1538
|
-
if (code.includes('<')) {
|
|
1539
|
-
indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
|
|
1540
|
-
} else {
|
|
1541
|
-
indexOf = code.indexOf('(');
|
|
1542
|
-
}
|
|
1543
|
-
const subStr = code.substring(0, indexOf);
|
|
1544
|
-
const codeArr = subStr?.split('.');
|
|
1545
|
-
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
1546
|
-
indexOf = subStr.length - lastLen;
|
|
1536
|
+
return getCallExpressionQuickInfo(range, getCode);
|
|
1547
1537
|
}
|
|
1548
|
-
|
|
1549
|
-
return {
|
|
1550
|
-
...detail,
|
|
1551
|
-
offset: detail.offset + indexOf,
|
|
1552
|
-
};
|
|
1553
1538
|
}
|
|
1554
1539
|
|
|
1555
1540
|
/**
|
package/src/concepts/Logic__.ts
CHANGED
|
@@ -1787,7 +1787,6 @@ export class Logic extends BaseNode {
|
|
|
1787
1787
|
|
|
1788
1788
|
get tsName() {
|
|
1789
1789
|
// 来自集成中心,且是连接内部的逻辑,则认为是编辑态的,需要加上后缀
|
|
1790
|
-
console.log(this.connector && this.integration)
|
|
1791
1790
|
if (this.connector && this.integration) {
|
|
1792
1791
|
return `${this.name}${CUSTOM_CONNECTOR_EDITABLE_SUFFIX}`;
|
|
1793
1792
|
}
|
|
@@ -276,7 +276,7 @@ export class MemberExpression extends LogicItem {
|
|
|
276
276
|
(this.object as Identifier)?.isEnum() &&
|
|
277
277
|
this.property?.concept === 'Identifier'
|
|
278
278
|
) {
|
|
279
|
-
return this.isDefaultValueExpression() ? this.property?.name : `"${this.property?.name}"`;
|
|
279
|
+
return this.isDefaultValueExpression(!!state?.getVuePrototype) ? this.property?.name : `"${this.property?.name}"`;
|
|
280
280
|
}
|
|
281
281
|
if (
|
|
282
282
|
this.object?.__TypeAnnotation?.sortedTypeKey?.startsWith('nasl.collection.Map') &&
|
|
@@ -379,8 +379,8 @@ export class MemberExpression extends LogicItem {
|
|
|
379
379
|
return (this.object as Identifier)?.isEnum?.();
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
isDefaultValueExpression() {
|
|
383
|
-
return this.parentNode instanceof DefaultValue;
|
|
382
|
+
isDefaultValueExpression(getVuePrototype: boolean) {
|
|
383
|
+
return this.parentNode instanceof DefaultValue && getVuePrototype;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
// 方便快速取值,遍历获取value
|
|
@@ -9,13 +9,9 @@ import {
|
|
|
9
9
|
withGenerator,
|
|
10
10
|
TranslatorGenerator,
|
|
11
11
|
} from '../translator';
|
|
12
|
-
import { ElementToVueOptions } from './ViewElement__';
|
|
13
12
|
import type MemberExpression from './MemberExpression__';
|
|
14
|
-
import type StructureProperty from './StructureProperty__';
|
|
15
|
-
import type App from './App__';
|
|
16
|
-
import { genHash } from '../generator';
|
|
17
13
|
import type ForEachStatement from './ForEachStatement__';
|
|
18
|
-
import
|
|
14
|
+
import { getNewCompositeQuickInfo, GetCode, Range } from './utils/quick-info';
|
|
19
15
|
//================================================================================
|
|
20
16
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
21
17
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -1607,6 +1603,10 @@ export class NewComposite extends LogicItem {
|
|
|
1607
1603
|
}
|
|
1608
1604
|
return code;
|
|
1609
1605
|
}
|
|
1606
|
+
|
|
1607
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
1608
|
+
return getNewCompositeQuickInfo(this.concept, range, getCode);
|
|
1609
|
+
}
|
|
1610
1610
|
//================================================================================
|
|
1611
1611
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1612
1612
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { wrapForEachToGenerator as wrapForEach
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
2
|
import {
|
|
3
3
|
TranslatorState,
|
|
4
4
|
shiftState,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
TranslatorGenerator,
|
|
11
11
|
} from '../translator';
|
|
12
12
|
import type ForEachStatement from './ForEachStatement__';
|
|
13
|
-
import
|
|
13
|
+
import { getNewCompositeQuickInfo, GetCode, Range } from './utils/quick-info';
|
|
14
14
|
//================================================================================
|
|
15
15
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
16
16
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -558,6 +558,10 @@ export class NewList extends LogicItem {
|
|
|
558
558
|
}
|
|
559
559
|
return code;
|
|
560
560
|
}
|
|
561
|
+
|
|
562
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
563
|
+
return getNewCompositeQuickInfo(this.concept, range, getCode);
|
|
564
|
+
}
|
|
561
565
|
//================================================================================
|
|
562
566
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
563
567
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
package/src/concepts/NewMap__.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { wrapForEachToGenerator as wrapForEach
|
|
1
|
+
import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
|
|
2
2
|
import {
|
|
3
3
|
TranslatorState,
|
|
4
4
|
shiftState,
|
|
@@ -9,9 +9,8 @@ import {
|
|
|
9
9
|
withGenerator,
|
|
10
10
|
TranslatorGenerator,
|
|
11
11
|
} from '../translator';
|
|
12
|
-
import { ElementToVueOptions } from './ViewElement__';
|
|
13
12
|
import type ForEachStatement from './ForEachStatement__';
|
|
14
|
-
import
|
|
13
|
+
import { getNewCompositeQuickInfo, GetCode, Range } from './utils/quick-info';
|
|
15
14
|
//================================================================================
|
|
16
15
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
17
16
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -802,6 +801,10 @@ export class NewMap extends LogicItem {
|
|
|
802
801
|
}
|
|
803
802
|
return code;
|
|
804
803
|
}
|
|
804
|
+
|
|
805
|
+
getQuickInfoOffset(range: Range, getCode: GetCode) {
|
|
806
|
+
return getNewCompositeQuickInfo(this.concept, range, getCode);
|
|
807
|
+
}
|
|
805
808
|
//================================================================================
|
|
806
809
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
807
810
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
package/src/concepts/Param__.ts
CHANGED
|
@@ -361,17 +361,25 @@ export class Param extends BaseNode {
|
|
|
361
361
|
toJS(state?: TranslatorState): string {
|
|
362
362
|
if (this.view) {
|
|
363
363
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
364
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
365
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
366
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
367
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
368
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
369
|
+
typeKind = typeAn.typeKind;
|
|
370
|
+
typeName = typeAn.typeName;
|
|
371
|
+
}
|
|
364
372
|
const needGenInitFromSchema =
|
|
365
373
|
typeAnnotation &&
|
|
366
|
-
(!['primitive', 'union'].includes(
|
|
374
|
+
(!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
367
375
|
let code = `${this.name} = `;
|
|
368
376
|
if (needGenInitFromSchema) {
|
|
369
|
-
code += `this.$genInitFromSchema('${
|
|
377
|
+
code += `this.$genInitFromSchema('${sortedTypeKey}',`;
|
|
370
378
|
}
|
|
371
379
|
|
|
372
380
|
const expressionJS = this.defaultValue?.toJS?.();
|
|
373
381
|
|
|
374
|
-
code += `${this.name} || (this.$route.query.hasOwnProperty('${this.name}') ? this.$genInitFromSchema('${
|
|
382
|
+
code += `${this.name} || (this.$route.query.hasOwnProperty('${this.name}') ? this.$genInitFromSchema('${sortedTypeKey}', this.$route.query.${this.name}) : ${expressionJS})`;
|
|
375
383
|
if (needGenInitFromSchema) {
|
|
376
384
|
code += `)`;
|
|
377
385
|
}
|
package/src/concepts/Return__.ts
CHANGED
|
@@ -322,12 +322,20 @@ export class Return extends BaseNode {
|
|
|
322
322
|
toJS(state?: TranslatorState): string {
|
|
323
323
|
const context = this.view ? 'this' : 'Vue.prototype';
|
|
324
324
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
325
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
326
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
327
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
328
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
329
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
330
|
+
typeKind = typeAn.typeKind;
|
|
331
|
+
typeName = typeAn.typeName;
|
|
332
|
+
}
|
|
325
333
|
const needGenInitFromSchema =
|
|
326
334
|
typeAnnotation &&
|
|
327
|
-
(!['primitive', 'union'].includes(
|
|
335
|
+
(!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
328
336
|
let code = `${this.name} = `;
|
|
329
337
|
if (needGenInitFromSchema) {
|
|
330
|
-
code += `${context}.$genInitFromSchema('${
|
|
338
|
+
code += `${context}.$genInitFromSchema('${sortedTypeKey}',`;
|
|
331
339
|
}
|
|
332
340
|
|
|
333
341
|
if (this.defaultValue?.expression) {
|
|
@@ -342,12 +342,20 @@ export class Variable extends BaseNode {
|
|
|
342
342
|
toJS(state?: TranslatorState): string {
|
|
343
343
|
const context = this.view ? 'this' : 'Vue.prototype';
|
|
344
344
|
const typeAnnotation = this.typeAnnotation || this.__TypeAnnotation;
|
|
345
|
+
let { sortedTypeKey, typeKind, typeName, typeNamespace } = typeAnnotation || {};
|
|
346
|
+
if (typeNamespace?.endsWith('.metadataTypes')) {
|
|
347
|
+
const referenceNode = this.app.findNodeByCompleteName(typeNamespace + '.' + typeName) || {};
|
|
348
|
+
const typeAn = referenceNode.typeAnnotation || {};
|
|
349
|
+
sortedTypeKey = `${typeAn.typeNamespace}.${typeAn.typeName}`;
|
|
350
|
+
typeKind = typeAn.typeKind;
|
|
351
|
+
typeName = typeAn.typeName;
|
|
352
|
+
}
|
|
345
353
|
const needGenInitFromSchema =
|
|
346
354
|
typeAnnotation &&
|
|
347
|
-
(!['primitive', 'union'].includes(
|
|
355
|
+
(!['primitive', 'union'].includes(typeKind) || typeName === 'DateTime');
|
|
348
356
|
let code = `${this.name} = `;
|
|
349
357
|
if (needGenInitFromSchema) {
|
|
350
|
-
code += `${context}.$genInitFromSchema('${
|
|
358
|
+
code += `${context}.$genInitFromSchema('${sortedTypeKey}',`;
|
|
351
359
|
}
|
|
352
360
|
|
|
353
361
|
if (this.defaultValue?.expression) {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Range } from '../../translator';
|
|
2
|
+
|
|
3
|
+
export { Range } from '../../translator';
|
|
4
|
+
|
|
5
|
+
/** 获取当前代码 */
|
|
6
|
+
export type GetCode = () => string;
|
|
7
|
+
|
|
8
|
+
export interface QuickInfoData {
|
|
9
|
+
/** 行 */
|
|
10
|
+
line: number;
|
|
11
|
+
/** 列 */
|
|
12
|
+
offset: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GetQuickInfoOffset = (range: Range, getCode: GetCode) => QuickInfoData;
|
|
16
|
+
|
|
17
|
+
export function getCallExpressionQuickInfo(range: Range, getCode: GetCode) {
|
|
18
|
+
const code = getCode();
|
|
19
|
+
const data: QuickInfoData = {
|
|
20
|
+
line: range.start.line + 1,
|
|
21
|
+
offset: range.start.character + 1,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// 如果没有括号 ,括号就在外面,就 -1
|
|
25
|
+
// 有括号就找到括号的位置 然后 -1
|
|
26
|
+
let indexOf = 0;
|
|
27
|
+
if (!code.includes('(')) {
|
|
28
|
+
indexOf = -1;
|
|
29
|
+
}
|
|
30
|
+
// 如果有泛型先往前找一找
|
|
31
|
+
else {
|
|
32
|
+
if (code.includes('<')) {
|
|
33
|
+
indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
|
|
34
|
+
} else {
|
|
35
|
+
indexOf = code.indexOf('(');
|
|
36
|
+
}
|
|
37
|
+
const subStr = code.substring(0, indexOf);
|
|
38
|
+
const codeArr = subStr?.split('.');
|
|
39
|
+
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
40
|
+
indexOf = subStr.length - lastLen;
|
|
41
|
+
}
|
|
42
|
+
data.offset += indexOf;
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getNewCompositeQuickInfo(concept: 'NewComposite' | 'NewList' | 'NewMap', range: Range, getCode: GetCode): QuickInfoData {
|
|
47
|
+
const type = {
|
|
48
|
+
'NewComposite': '__newComposite',
|
|
49
|
+
'NewList': '__newList',
|
|
50
|
+
'NewMap': '__newMap',
|
|
51
|
+
}[concept];
|
|
52
|
+
const code = getCode();
|
|
53
|
+
const data: QuickInfoData = {
|
|
54
|
+
line: range.end.line,
|
|
55
|
+
offset: range.end.character,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const indexOf = code.lastIndexOf(`return ${type}`);
|
|
59
|
+
let newCode = code.substring(0, indexOf);
|
|
60
|
+
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
61
|
+
data.offset = newCode.length + 'return '.length;
|
|
62
|
+
|
|
63
|
+
return data;
|
|
64
|
+
}
|
package/src/server/naslServer.ts
CHANGED
|
@@ -4090,7 +4090,7 @@ class NaslServer {
|
|
|
4090
4090
|
|
|
4091
4091
|
// 位置计算偏移
|
|
4092
4092
|
if ('getQuickInfoOffset' in node) {
|
|
4093
|
-
Object.assign(fileDetail, (node as any).getQuickInfoOffset(
|
|
4093
|
+
Object.assign(fileDetail, (node as any).getQuickInfoOffset(item, () => getCode(item)));
|
|
4094
4094
|
}
|
|
4095
4095
|
|
|
4096
4096
|
yield;
|
|
@@ -4098,30 +4098,6 @@ class NaslServer {
|
|
|
4098
4098
|
// 位置计算偏移2
|
|
4099
4099
|
// TODO: 之后考虑把这些偏移量计算全都挪到节点内部去
|
|
4100
4100
|
if (
|
|
4101
|
-
node.concept === 'BinaryExpression' ||
|
|
4102
|
-
node.concept === 'CallFunction' ||
|
|
4103
|
-
node.concept === 'CallInterface'
|
|
4104
|
-
) {
|
|
4105
|
-
const code = getCode(item);
|
|
4106
|
-
// 如果没有括号 ,括号就在外面,就 -1
|
|
4107
|
-
// 有括号就找到括号的位置 然后 -1
|
|
4108
|
-
let indexOf = 0;
|
|
4109
|
-
if (!code.includes('(')) {
|
|
4110
|
-
indexOf = -1;
|
|
4111
|
-
} else {
|
|
4112
|
-
// 如果有泛型先往前找一找
|
|
4113
|
-
if (code.includes('<')) {
|
|
4114
|
-
indexOf = Math.min(code.indexOf('<'), code.indexOf('('));
|
|
4115
|
-
} else {
|
|
4116
|
-
indexOf = code.indexOf('(');
|
|
4117
|
-
}
|
|
4118
|
-
const subStr = code.substring(0, indexOf);
|
|
4119
|
-
const codeArr = subStr?.split('.');
|
|
4120
|
-
const lastLen = codeArr?.[codeArr.length - 1]?.length;
|
|
4121
|
-
indexOf = subStr.length - lastLen;
|
|
4122
|
-
}
|
|
4123
|
-
fileDetail.offset += indexOf;
|
|
4124
|
-
} else if (
|
|
4125
4101
|
node.concept === 'MemberExpression' ||
|
|
4126
4102
|
node.concept === 'Identifier' ||
|
|
4127
4103
|
node.concept === 'QueryFieldExpression' ||
|
|
@@ -4147,26 +4123,6 @@ class NaslServer {
|
|
|
4147
4123
|
let newCode = code.substring(0, indexOf);
|
|
4148
4124
|
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4149
4125
|
fileDetail.offset = newCode.length + 'return '.length;
|
|
4150
|
-
} else if (['NewComposite', 'NewList', 'NewMap'].includes(node.concept)) {
|
|
4151
|
-
let type;
|
|
4152
|
-
switch (node.concept) {
|
|
4153
|
-
case 'NewComposite':
|
|
4154
|
-
type = '__newComposite';
|
|
4155
|
-
break;
|
|
4156
|
-
case 'NewList':
|
|
4157
|
-
type = '__newList';
|
|
4158
|
-
break;
|
|
4159
|
-
case 'NewMap':
|
|
4160
|
-
type = '__newMap';
|
|
4161
|
-
break;
|
|
4162
|
-
default:
|
|
4163
|
-
}
|
|
4164
|
-
const code = getCode(item);
|
|
4165
|
-
fileDetail.line = item.end.line;
|
|
4166
|
-
const indexOf = code.indexOf(`return ${type}`);
|
|
4167
|
-
let newCode = code.substring(0, indexOf);
|
|
4168
|
-
newCode = newCode.substring(newCode.lastIndexOf('\n'), indexOf);
|
|
4169
|
-
fileDetail.offset = newCode.length + 'return '.length;
|
|
4170
4126
|
} else if (['OqlQueryComponent'].includes(node.concept)) {
|
|
4171
4127
|
fileDetail.offset += 10;
|
|
4172
4128
|
}
|
package/src/translator/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SourceMapItem, Position, Range, TranslatorMethod, TranslatorState } from './types';
|
|
2
2
|
import type { BaseNode } from '../concepts';
|
|
3
|
-
import TypeAnnotation from '../concepts/TypeAnnotation__';
|
|
4
|
-
import App from '../concepts/App__';
|
|
3
|
+
import type TypeAnnotation from '../concepts/TypeAnnotation__';
|
|
4
|
+
import type App from '../concepts/App__';
|
|
5
5
|
|
|
6
6
|
export function lsp2tspNumber(num: number) {
|
|
7
7
|
return num + 1;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`binary-expression:getQuickInfoOffset constant-nested 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"code": "nasl.core.and(nasl.core.isEqual(new nasl.core.String('StringLiteral').length,new nasl.core.Long(3)),new nasl.core.Boolean(false))",
|
|
6
|
+
"line": 1,
|
|
7
|
+
"offset": 11,
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`binary-expression:getQuickInfoOffset constant-simple 1`] = `
|
|
12
|
+
Object {
|
|
13
|
+
"code": "nasl.core.and(new nasl.core.Boolean(true),new nasl.core.Boolean(false))",
|
|
14
|
+
"line": 1,
|
|
15
|
+
"offset": 11,
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`binary-expression:getQuickInfoOffset variable-nested 1`] = `
|
|
20
|
+
Object {
|
|
21
|
+
"code": "nasl.core.or(nasl.core.isEqual(param1.length,new nasl.core.Long(3)),nasl.core.isNotEqual(param3.updatedBy.length,new nasl.core.Long(0)))",
|
|
22
|
+
"line": 1,
|
|
23
|
+
"offset": 11,
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import type { BinaryExpression } from '../../../src';
|
|
3
|
+
import { runGeneratorSync as runSync } from '../../../src/utils';
|
|
4
|
+
import { getNodeByData, readFixture, getCodeRange } from '../utils';
|
|
5
|
+
import { ConceptName, cases } from './constant';
|
|
6
|
+
|
|
7
|
+
describe(`${ConceptName}:getQuickInfoOffset`, () => {
|
|
8
|
+
cases.forEach((name) => {
|
|
9
|
+
it(name, () => {
|
|
10
|
+
const data = readFixture(ConceptName, name);
|
|
11
|
+
const node = getNodeByData<BinaryExpression>(data);
|
|
12
|
+
const tsCode = runSync(node.toEmbeddedTS());
|
|
13
|
+
expect({
|
|
14
|
+
code: tsCode,
|
|
15
|
+
...node.getQuickInfoOffset(getCodeRange(tsCode), () => tsCode),
|
|
16
|
+
}).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`call-function:getQuickInfoOffset from-string 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"code": "nasl.util.FromString(str)<nasl.core.Boolean>()",
|
|
6
|
+
"line": 1,
|
|
7
|
+
"offset": 11,
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`call-function:getQuickInfoOffset to-string-global-tz 1`] = `
|
|
12
|
+
Object {
|
|
13
|
+
"code": "nasl.util.ToString(dt, new nasl.core.String('StringLiteral'))",
|
|
14
|
+
"line": 1,
|
|
15
|
+
"offset": 11,
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`call-function:getQuickInfoOffset to-string-no-tz 1`] = `
|
|
20
|
+
Object {
|
|
21
|
+
"code": "nasl.util.ToString(str)",
|
|
22
|
+
"line": 1,
|
|
23
|
+
"offset": 11,
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
exports[`call-function:getQuickInfoOffset to-string-user-tz 1`] = `
|
|
28
|
+
Object {
|
|
29
|
+
"code": "nasl.util.ToString(dt, new nasl.core.String('StringLiteral'))",
|
|
30
|
+
"line": 1,
|
|
31
|
+
"offset": 11,
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
exports[`call-function:getQuickInfoOffset to-string-utc-tz 1`] = `
|
|
36
|
+
Object {
|
|
37
|
+
"code": "nasl.util.ToString(dt, new nasl.core.String('StringLiteral'))",
|
|
38
|
+
"line": 1,
|
|
39
|
+
"offset": 11,
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import type { CallFunction } from '../../../src';
|
|
3
|
+
import { runGeneratorSync as runSync } from '../../../src/utils';
|
|
4
|
+
import { getNodeByData, readFixture, getCodeRange } from '../utils';
|
|
5
|
+
import { ConceptName, cases } from './constant';
|
|
6
|
+
|
|
7
|
+
describe(`${ConceptName}:getQuickInfoOffset`, () => {
|
|
8
|
+
cases.forEach((name) => {
|
|
9
|
+
it(name, () => {
|
|
10
|
+
const data = readFixture(ConceptName, name);
|
|
11
|
+
const node = getNodeByData<CallFunction>(data);
|
|
12
|
+
const tsCode = runSync(node.toEmbeddedTS());
|
|
13
|
+
expect({
|
|
14
|
+
code: tsCode,
|
|
15
|
+
...node.getQuickInfoOffset(getCodeRange(tsCode), () => tsCode),
|
|
16
|
+
}).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|