@lcap/nasl 3.3.3-beta.3 → 3.3.3-beta.5
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/f2d14ce8-876a-4dc0-9aaf-e51d08d081ca.json +1 -0
- package/.nyc_output/processinfo/f2d14ce8-876a-4dc0-9aaf-e51d08d081ca.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 +446 -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 +619 -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 +1243 -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 +430 -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 +1225 -0
- package/coverage/src/breakpoint/shared/utils.ts.html +961 -0
- package/coverage/src/breakpoint/store/core.ts.html +1600 -0
- package/coverage/src/breakpoint/store/dock.ts.html +583 -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 +3868 -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 +191 -0
- package/coverage/src/common/index.ts.html +94 -0
- package/coverage/src/concepts/Abort__.ts.html +328 -0
- package/coverage/src/concepts/Anchor__.ts.html +604 -0
- package/coverage/src/concepts/AnonymousFunction__.ts.html +1951 -0
- package/coverage/src/concepts/App__.ts.html +13252 -0
- package/coverage/src/concepts/Argument__.ts.html +910 -0
- package/coverage/src/concepts/Assignee__.ts.html +2236 -0
- package/coverage/src/concepts/AssignmentLine__.ts.html +409 -0
- package/coverage/src/concepts/Assignment__.ts.html +1078 -0
- package/coverage/src/concepts/Attribute__.ts.html +733 -0
- package/coverage/src/concepts/AuthInterface__.ts.html +367 -0
- package/coverage/src/concepts/AuthLogicForCallInterface__.ts.html +1984 -0
- package/coverage/src/concepts/AuthLogic__.ts.html +781 -0
- package/coverage/src/concepts/BackendVariable__.ts.html +1483 -0
- package/coverage/src/concepts/Backend__.ts.html +1165 -0
- package/coverage/src/concepts/BatchAssignment__.ts.html +3250 -0
- package/coverage/src/concepts/BinaryExpression__.ts.html +1336 -0
- package/coverage/src/concepts/BindAttribute__.ts.html +3679 -0
- package/coverage/src/concepts/BindDirective__.ts.html +1921 -0
- package/coverage/src/concepts/BindEvent__.ts.html +3232 -0
- package/coverage/src/concepts/BindStyle__.ts.html +1612 -0
- package/coverage/src/concepts/BooleanLiteral__.ts.html +403 -0
- package/coverage/src/concepts/CallAuthInterface__.ts.html +1615 -0
- package/coverage/src/concepts/CallConnector__.ts.html +868 -0
- package/coverage/src/concepts/CallFunction__.ts.html +1966 -0
- package/coverage/src/concepts/CallInterface__.ts.html +2614 -0
- package/coverage/src/concepts/CallLogic__.ts.html +4420 -0
- package/coverage/src/concepts/CallQueryComponent__.ts.html +5308 -0
- package/coverage/src/concepts/Comment__.ts.html +376 -0
- package/coverage/src/concepts/CompletionProperty__.ts.html +925 -0
- package/coverage/src/concepts/ConfigGroup__.ts.html +1105 -0
- package/coverage/src/concepts/ConfigPropertyValue__.ts.html +424 -0
- package/coverage/src/concepts/ConfigProperty__.ts.html +1348 -0
- package/coverage/src/concepts/Configuration__.ts.html +1027 -0
- package/coverage/src/concepts/Connection__.ts.html +1360 -0
- package/coverage/src/concepts/ConnectorTrigger__.ts.html +595 -0
- package/coverage/src/concepts/Connector__.ts.html +4255 -0
- package/coverage/src/concepts/Constant__.ts.html +913 -0
- package/coverage/src/concepts/DataSource__.ts.html +1771 -0
- package/coverage/src/concepts/DatabaseTypeAnnotation__.ts.html +331 -0
- package/coverage/src/concepts/Destination__.ts.html +2563 -0
- package/coverage/src/concepts/End__.ts.html +433 -0
- package/coverage/src/concepts/EntityIndex__.ts.html +787 -0
- package/coverage/src/concepts/EntityProperty__.ts.html +2620 -0
- package/coverage/src/concepts/Entity__.ts.html +2872 -0
- package/coverage/src/concepts/EnumItem__.ts.html +535 -0
- package/coverage/src/concepts/Enum__.ts.html +1192 -0
- package/coverage/src/concepts/Event__.ts.html +1084 -0
- package/coverage/src/concepts/ExternalDestination__.ts.html +1033 -0
- package/coverage/src/concepts/ForEachStatement__.ts.html +1819 -0
- package/coverage/src/concepts/FrontendLibrary__.ts.html +1711 -0
- package/coverage/src/concepts/FrontendVariable__.ts.html +292 -0
- package/coverage/src/concepts/Frontend__.ts.html +3961 -0
- package/coverage/src/concepts/Function__.ts.html +3514 -0
- package/coverage/src/concepts/Identifier__.ts.html +1057 -0
- package/coverage/src/concepts/IfStatement__.ts.html +1486 -0
- package/coverage/src/concepts/Integration__.ts.html +1228 -0
- package/coverage/src/concepts/InterfaceParam__.ts.html +1087 -0
- package/coverage/src/concepts/Interface__.ts.html +3394 -0
- package/coverage/src/concepts/JSBlock__.ts.html +406 -0
- package/coverage/src/concepts/JavaLogic__.ts.html +460 -0
- package/coverage/src/concepts/LogicItem__.ts.html +1144 -0
- package/coverage/src/concepts/Logic__.ts.html +7078 -0
- package/coverage/src/concepts/MatchCase__.ts.html +2641 -0
- package/coverage/src/concepts/Match__.ts.html +2323 -0
- package/coverage/src/concepts/MemberExpression__.ts.html +1666 -0
- package/coverage/src/concepts/MicroApp__.ts.html +436 -0
- package/coverage/src/concepts/Module__.ts.html +9220 -0
- package/coverage/src/concepts/MsgTriggerEvent__.ts.html +1045 -0
- package/coverage/src/concepts/MsgTriggerLauncher__.ts.html +1018 -0
- package/coverage/src/concepts/Namespace__.ts.html +7942 -0
- package/coverage/src/concepts/NewComposite__.ts.html +4684 -0
- package/coverage/src/concepts/NewList__.ts.html +1567 -0
- package/coverage/src/concepts/NewMap__.ts.html +2275 -0
- package/coverage/src/concepts/New__.ts.html +289 -0
- package/coverage/src/concepts/NullLiteral__.ts.html +349 -0
- package/coverage/src/concepts/NumericLiteral__.ts.html +661 -0
- package/coverage/src/concepts/OqlQueryComponent__.ts.html +1123 -0
- package/coverage/src/concepts/OverriddenLogic__.ts.html +6817 -0
- package/coverage/src/concepts/Param__.ts.html +1609 -0
- package/coverage/src/concepts/Point__.ts.html +331 -0
- package/coverage/src/concepts/ProcessComponent__.ts.html +1666 -0
- package/coverage/src/concepts/ProcessElement__.ts.html +5884 -0
- package/coverage/src/concepts/ProcessOutcome__.ts.html +352 -0
- package/coverage/src/concepts/ProcessOutcomes__.ts.html +343 -0
- package/coverage/src/concepts/Process__.ts.html +4768 -0
- package/coverage/src/concepts/QueryAggregateExpression__.ts.html +568 -0
- package/coverage/src/concepts/QueryFieldExpression__.ts.html +583 -0
- package/coverage/src/concepts/QueryFromExpression__.ts.html +910 -0
- package/coverage/src/concepts/QueryGroupByExpression__.ts.html +559 -0
- package/coverage/src/concepts/QueryJoinExpression__.ts.html +1567 -0
- package/coverage/src/concepts/QueryLimitExpression__.ts.html +637 -0
- package/coverage/src/concepts/QueryOrderByExpression__.ts.html +679 -0
- package/coverage/src/concepts/QuerySelectExpression__.ts.html +1714 -0
- package/coverage/src/concepts/Rect__.ts.html +373 -0
- package/coverage/src/concepts/Return__.ts.html +1258 -0
- package/coverage/src/concepts/Role__.ts.html +601 -0
- package/coverage/src/concepts/SelectMembers__.ts.html +1246 -0
- package/coverage/src/concepts/Slot__.ts.html +628 -0
- package/coverage/src/concepts/SqlQueryComponent__.ts.html +964 -0
- package/coverage/src/concepts/Start__.ts.html +304 -0
- package/coverage/src/concepts/StringInterpolation__.ts.html +1078 -0
- package/coverage/src/concepts/StringLiteral__.ts.html +490 -0
- package/coverage/src/concepts/StructureProperty__.ts.html +1102 -0
- package/coverage/src/concepts/Structure__.ts.html +2053 -0
- package/coverage/src/concepts/SwitchCase__.ts.html +1063 -0
- package/coverage/src/concepts/SwitchStatement__.ts.html +826 -0
- package/coverage/src/concepts/Theme__.ts.html +358 -0
- package/coverage/src/concepts/Transactional__.ts.html +628 -0
- package/coverage/src/concepts/TriggerEvent__.ts.html +1012 -0
- package/coverage/src/concepts/TriggerLauncher__.ts.html +775 -0
- package/coverage/src/concepts/TypeAnnotation__.ts.html +3583 -0
- package/coverage/src/concepts/TypeParam__.ts.html +301 -0
- package/coverage/src/concepts/UnaryExpression__.ts.html +640 -0
- package/coverage/src/concepts/Unparsed__.ts.html +382 -0
- package/coverage/src/concepts/UseComponent__.ts.html +331 -0
- package/coverage/src/concepts/ValidationRule__.ts.html +1840 -0
- package/coverage/src/concepts/Variable__.ts.html +1435 -0
- package/coverage/src/concepts/ViewBlock__.ts.html +352 -0
- package/coverage/src/concepts/ViewComponent__.ts.html +4180 -0
- package/coverage/src/concepts/ViewElement__.ts.html +8557 -0
- package/coverage/src/concepts/View__.ts.html +8278 -0
- package/coverage/src/concepts/WhileStatement__.ts.html +991 -0
- package/coverage/src/concepts/basics/stdlib/index.html +341 -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 +6787 -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/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 +1961 -0
- package/coverage/src/concepts/index.ts.html +103 -0
- package/coverage/src/concepts/index__.ts.html +451 -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 +1828 -0
- package/coverage/src/generator/genHash.ts.html +124 -0
- package/coverage/src/generator/genMetaData.ts.html +1042 -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 +121 -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/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 +14290 -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 +379 -0
- package/coverage/src/service/creator/errHandles.js.html +322 -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 +2710 -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 +955 -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 +910 -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 +397 -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 +655 -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 +412 -0
- package/coverage/src/utils/traverse.ts.html +568 -0
- package/coverage/src/utils/window.ts.html +112 -0
- package/out/common/BaseNode.d.ts +22 -11
- package/out/common/BaseNode.js +20 -0
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/CallLogic__.js +1 -1
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +4 -13
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +21 -0
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +7 -2
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/types__.d.ts +2 -3
- package/out/decorators/index.d.ts +3 -3
- package/out/enums/KEYWORDS.js +2 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genMetaData.js +4 -4
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.js +2 -2
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/permission.js +1 -1
- package/out/generator/permission.js.map +1 -1
- package/out/natural/transformTSCode.d.ts +2 -2
- package/out/server/formatTsUtils.d.ts +3 -3
- package/out/server/getMemberIdentifier.d.ts +4 -4
- package/out/server/getMemberIdentifier.js +2 -2
- package/out/server/getMemberIdentifier.js.map +1 -1
- package/out/server/naslServer.js +2 -2
- package/out/server/naslServer.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +2 -1
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/translator/utils.js +2 -2
- package/out/translator/utils.js.map +1 -1
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.util.ts +142 -142
- package/src/common/BaseNode.ts +45 -23
- package/src/concepts/BinaryExpression__.ts +1 -1
- package/src/concepts/CallLogic__.ts +1 -1
- package/src/concepts/CallQueryComponent__.ts +4 -12
- package/src/concepts/ViewElement__.ts +19 -0
- package/src/concepts/View__.ts +7 -2
- package/src/concepts/types__.ts +2 -4
- package/src/decorators/index.ts +4 -4
- package/src/enums/KEYWORDS.ts +2 -0
- package/src/generator/genMetaData.ts +4 -4
- package/src/generator/genReleaseBody.ts +2 -2
- package/src/generator/permission.ts +4 -4
- package/src/server/formatTsUtils.ts +8 -8
- package/src/server/getMemberIdentifier.ts +6 -6
- package/src/server/naslServer.ts +4 -4
- package/src/service/storage/init.ts +2 -2
- package/src/templator/genCurdMultipleKeyBlock.ts +2 -1
- package/src/translator/utils.ts +5 -6
package/src/common/BaseNode.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Diagnostic } from '../manager/diagnostic';
|
|
|
11
11
|
|
|
12
12
|
import { sentryMonitorNaslNode } from '../sentry';
|
|
13
13
|
import operations from '../breakpoint/shared/operations';
|
|
14
|
-
import type {
|
|
14
|
+
import type { SyntaxNode, SyntaxNodeConcept, ViewElement, TypeAnnotation, App, Namespace } from '../concepts';
|
|
15
15
|
import eventBus from '../eventBus';
|
|
16
16
|
|
|
17
17
|
let actionable = true;
|
|
@@ -139,7 +139,7 @@ export class BaseNode extends EventEmitter {
|
|
|
139
139
|
* 父节点
|
|
140
140
|
*/
|
|
141
141
|
@circular()
|
|
142
|
-
parentNode:
|
|
142
|
+
parentNode: SyntaxNode = null;
|
|
143
143
|
|
|
144
144
|
parentKey: string = '';
|
|
145
145
|
|
|
@@ -408,14 +408,14 @@ export class BaseNode extends EventEmitter {
|
|
|
408
408
|
this.parentNode?.emit('node:Editing', $event);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
-
createNode({ parentNode, parentKey, index }: { parentNode:
|
|
411
|
+
createNode({ parentNode, parentKey, index }: { parentNode: SyntaxNode; parentKey: string; index: number }) {
|
|
412
412
|
if(!actionable) {
|
|
413
413
|
eventBus.emit('NotActionable')
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
if (parentNode) {
|
|
418
|
-
const property = parentNode[parentKey as keyof
|
|
418
|
+
const property = parentNode[parentKey as keyof SyntaxNode];
|
|
419
419
|
if (Array.isArray(property) && index !== -1) {
|
|
420
420
|
property.splice(index, 0, this);
|
|
421
421
|
} else {
|
|
@@ -738,13 +738,13 @@ export class BaseNode extends EventEmitter {
|
|
|
738
738
|
/**
|
|
739
739
|
* 上层节点
|
|
740
740
|
*/
|
|
741
|
-
get upperNode():
|
|
741
|
+
get upperNode(): SyntaxNode {
|
|
742
742
|
// eslint-disable-next-line consistent-this
|
|
743
743
|
let _upperNode: BaseNode = this;
|
|
744
744
|
while (!!_upperNode && _upperNode.concept === this.concept) {
|
|
745
745
|
_upperNode = _upperNode.parentNode;
|
|
746
746
|
}
|
|
747
|
-
return _upperNode as
|
|
747
|
+
return _upperNode as SyntaxNode;
|
|
748
748
|
}
|
|
749
749
|
|
|
750
750
|
/**
|
|
@@ -757,9 +757,9 @@ export class BaseNode extends EventEmitter {
|
|
|
757
757
|
/**
|
|
758
758
|
* 获取祖先节点
|
|
759
759
|
*/
|
|
760
|
-
getAncestor(concept:
|
|
761
|
-
getAncestor<Node extends
|
|
762
|
-
getAncestor<Node extends
|
|
760
|
+
getAncestor(concept: SyntaxNode['concept']): SyntaxNode;
|
|
761
|
+
getAncestor<Node extends SyntaxNode>(concept: Node['concept']): Node;
|
|
762
|
+
getAncestor<Node extends SyntaxNode = SyntaxNode>(concept: SyntaxNode['concept']): Node {
|
|
763
763
|
let { upperNode } = this;
|
|
764
764
|
while (upperNode && upperNode.concept && upperNode.concept !== concept) {
|
|
765
765
|
upperNode = upperNode.upperNode;
|
|
@@ -835,7 +835,7 @@ export class BaseNode extends EventEmitter {
|
|
|
835
835
|
instantiate(source: any, parentNode: BaseNode, parentKey: string) {
|
|
836
836
|
if (source instanceof BaseNode) {
|
|
837
837
|
if (!source.parentNode || !source.parentKey) {
|
|
838
|
-
source.parentNode = parentNode as
|
|
838
|
+
source.parentNode = parentNode as SyntaxNode;
|
|
839
839
|
source.parentKey = parentKey;
|
|
840
840
|
}
|
|
841
841
|
return source;
|
|
@@ -1168,8 +1168,13 @@ export class BaseNode extends EventEmitter {
|
|
|
1168
1168
|
return {};
|
|
1169
1169
|
}
|
|
1170
1170
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1171
|
+
/**
|
|
1172
|
+
* 迭代所有属性
|
|
1173
|
+
*
|
|
1174
|
+
* @description 是所有属性!!不是所有子节点!!
|
|
1175
|
+
*/
|
|
1176
|
+
traverseChildren(cb: (el: any) => void): void {
|
|
1177
|
+
function traverse(node: any) {
|
|
1173
1178
|
cb(node);
|
|
1174
1179
|
|
|
1175
1180
|
const propertyMap = getConceptPropertyMap(node?.concept);
|
|
@@ -1178,12 +1183,29 @@ export class BaseNode extends EventEmitter {
|
|
|
1178
1183
|
for (const property of propertyMap.keys()) {
|
|
1179
1184
|
const child = node[property as keyof BaseNode];
|
|
1180
1185
|
if (!child) continue;
|
|
1181
|
-
else if (Array.isArray(child)) child.forEach((node:
|
|
1186
|
+
else if (Array.isArray(child)) child.forEach((node: SyntaxNode) => traverse(node));
|
|
1182
1187
|
else traverse(child);
|
|
1183
1188
|
}
|
|
1184
1189
|
}
|
|
1185
1190
|
|
|
1186
|
-
traverse(this as unknown as
|
|
1191
|
+
traverse(this as unknown as SyntaxNode);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* 迭代所有子节点
|
|
1196
|
+
*
|
|
1197
|
+
* @description 严格迭代所有子节点!排除属性!
|
|
1198
|
+
*/
|
|
1199
|
+
traverseStrictChildren(cb: (el: SyntaxNode) => void): void {
|
|
1200
|
+
const isNode = (node: unknown): node is SyntaxNode => {
|
|
1201
|
+
return Boolean(node) && typeof node === 'object' && ('concept' in node) && typeof (node as any).concept === 'string';
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1204
|
+
this.traverseChildren((el) => {
|
|
1205
|
+
if (isNode(el)) {
|
|
1206
|
+
cb(el);
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1187
1209
|
}
|
|
1188
1210
|
|
|
1189
1211
|
/**
|
|
@@ -1278,7 +1300,7 @@ export class BaseNode extends EventEmitter {
|
|
|
1278
1300
|
/**
|
|
1279
1301
|
* 使用新的 concept 在当前节点生成新的数据
|
|
1280
1302
|
*/
|
|
1281
|
-
changeConceptNode(concept:
|
|
1303
|
+
changeConceptNode(concept: SyntaxNodeConcept) {
|
|
1282
1304
|
return new Proxy(this, {
|
|
1283
1305
|
get(target, p: keyof BaseNode, receiver) {
|
|
1284
1306
|
if (p === 'concept') {
|
|
@@ -1291,20 +1313,20 @@ export class BaseNode extends EventEmitter {
|
|
|
1291
1313
|
}
|
|
1292
1314
|
|
|
1293
1315
|
/** 收集所有节点 */
|
|
1294
|
-
collectNodes():
|
|
1316
|
+
collectNodes(): SyntaxNode[];
|
|
1295
1317
|
/** 收集特定类型的子节点 */
|
|
1296
|
-
collectNodes(concept:
|
|
1318
|
+
collectNodes(concept: SyntaxNodeConcept): SyntaxNode[];
|
|
1297
1319
|
/** 收集断言返回`true`的子节点 */
|
|
1298
|
-
collectNodes(pre: (node?:
|
|
1299
|
-
collectNodes(input?:
|
|
1320
|
+
collectNodes(pre: (node?: SyntaxNode) => boolean): SyntaxNode[];
|
|
1321
|
+
collectNodes(input?: SyntaxNodeConcept | ((node?: SyntaxNode) => boolean)) {
|
|
1300
1322
|
const pre =
|
|
1301
1323
|
typeof input === 'undefined'
|
|
1302
|
-
? (node:
|
|
1324
|
+
? (node: SyntaxNode) => node && typeof node.concept === 'string'
|
|
1303
1325
|
: typeof input === 'string'
|
|
1304
|
-
? (node:
|
|
1326
|
+
? (node: SyntaxNode) => node?.concept === input
|
|
1305
1327
|
: input;
|
|
1306
|
-
const nodes:
|
|
1307
|
-
const self = this as unknown as
|
|
1328
|
+
const nodes: SyntaxNode[] = [];
|
|
1329
|
+
const self = this as unknown as SyntaxNode;
|
|
1308
1330
|
|
|
1309
1331
|
if (pre(self)) {
|
|
1310
1332
|
nodes.push(self);
|
|
@@ -346,7 +346,7 @@ export class BinaryExpression extends LogicItem {
|
|
|
346
346
|
// return code
|
|
347
347
|
return getOperatorCode(code);
|
|
348
348
|
}
|
|
349
|
-
if (['>', '>=', '<', '<='].includes(this.operator)) {
|
|
349
|
+
if (['>', '>=', '<', '<=', '=='].includes(this.operator)) {
|
|
350
350
|
const leftType = this.left?.getCurrentAnnotatedJSON();
|
|
351
351
|
const rightType = this.right?.getCurrentAnnotatedJSON();
|
|
352
352
|
// 如果两边类型一致可以做一些特殊比较
|
|
@@ -1216,20 +1216,12 @@ export class CallQueryComponent extends LogicItem {
|
|
|
1216
1216
|
if (['COUNT', 'COUNTD'].includes(item.aggregateName)) {
|
|
1217
1217
|
typeName = 'Long';
|
|
1218
1218
|
} else if (['AVG'].includes(item.aggregateName)) {
|
|
1219
|
-
|
|
1220
|
-
const entity = entities.find((item: Entity) => item.name === entityAsName);
|
|
1221
|
-
const property = entity?.properties.find((item: any) => item.name === propertyName);
|
|
1222
|
-
const propertyTypeName = property?.typeAnnotation?.typeName;
|
|
1223
|
-
if (propertyTypeName === 'Decimal') {
|
|
1224
|
-
typeName = 'Decimal';
|
|
1225
|
-
} else {
|
|
1226
|
-
typeName = 'Decimal';
|
|
1227
|
-
}
|
|
1219
|
+
typeName = 'Decimal';
|
|
1228
1220
|
} else {
|
|
1229
1221
|
const { entityAsName, propertyName } = item.aggregateParam;
|
|
1230
|
-
const entity = entities.find((
|
|
1231
|
-
const
|
|
1232
|
-
typeName =
|
|
1222
|
+
const entity = entities.find((e: Entity) => e.name === entityAsName);
|
|
1223
|
+
const prop = entity?.properties.find((p) => p.name === propertyName);
|
|
1224
|
+
typeName = prop?.typeAnnotation?.typeName;
|
|
1233
1225
|
}
|
|
1234
1226
|
return {
|
|
1235
1227
|
concept: 'StructureProperty',
|
|
@@ -141,6 +141,25 @@ function transAstNodeToNaslNode(astNode: any, namespace?: string): any {
|
|
|
141
141
|
label: '原子项',
|
|
142
142
|
code: astNode.value,
|
|
143
143
|
};
|
|
144
|
+
} else if (astNode.type === 'TemplateLiteral') { // 模板字符串翻译成字符串插值
|
|
145
|
+
const { expressions, quasis } = astNode;
|
|
146
|
+
node = {
|
|
147
|
+
concept: 'StringInterpolation',
|
|
148
|
+
kind: 'Expression',
|
|
149
|
+
name: '',
|
|
150
|
+
expressions: [...(quasis || []), ...(expressions || [])].sort((node1, node2) => {
|
|
151
|
+
return node1.start - node2.start;
|
|
152
|
+
}).map((node) => {
|
|
153
|
+
return transAstNodeToNaslNode(node);
|
|
154
|
+
}),
|
|
155
|
+
};
|
|
156
|
+
} else if (astNode.type === 'TemplateElement') {
|
|
157
|
+
node = {
|
|
158
|
+
concept: 'StringLiteral',
|
|
159
|
+
kind: 'Expression',
|
|
160
|
+
name: '',
|
|
161
|
+
value: astNode.value?.raw,
|
|
162
|
+
};
|
|
144
163
|
} else if (astNode.type === 'StringLiteral') {
|
|
145
164
|
// 单独特殊处理枚举因为他不是MemberExpression,而是Identifier_
|
|
146
165
|
if (astNode?.value?.startsWith('__enumTypeAnnotation_')) {
|
package/src/concepts/View__.ts
CHANGED
|
@@ -1733,8 +1733,6 @@ export class View extends BaseNode {
|
|
|
1733
1733
|
);
|
|
1734
1734
|
this.addBindEvent(event);
|
|
1735
1735
|
} else {
|
|
1736
|
-
const index = bindEvent.logics.length;
|
|
1737
|
-
newLogic.name += index;
|
|
1738
1736
|
bindEvent.addLogic(newLogic);
|
|
1739
1737
|
}
|
|
1740
1738
|
});
|
|
@@ -1758,6 +1756,13 @@ export class View extends BaseNode {
|
|
|
1758
1756
|
if (Array.isArray(this.logics)) {
|
|
1759
1757
|
varList.push(...this.logics);
|
|
1760
1758
|
}
|
|
1759
|
+
if (Array.isArray(this.bindEvents)) {
|
|
1760
|
+
this.bindEvents.forEach((bindEvent) => {
|
|
1761
|
+
if (Array.isArray(bindEvent.logics)) {
|
|
1762
|
+
varList.push(...bindEvent.logics);
|
|
1763
|
+
}
|
|
1764
|
+
})
|
|
1765
|
+
}
|
|
1761
1766
|
return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
1762
1767
|
}
|
|
1763
1768
|
|
package/src/concepts/types__.ts
CHANGED
|
@@ -38,7 +38,6 @@ import type { Variable } from './Variable__';
|
|
|
38
38
|
import type { BackendVariable } from './BackendVariable__';
|
|
39
39
|
import type { FrontendVariable } from './FrontendVariable__';
|
|
40
40
|
import type { Constant } from './Constant__';
|
|
41
|
-
import type { LogicItem } from './LogicItem__';
|
|
42
41
|
import type { Function } from './Function__';
|
|
43
42
|
import type { AnonymousFunction } from './AnonymousFunction__';
|
|
44
43
|
import type { Interface } from './Interface__';
|
|
@@ -122,7 +121,7 @@ import type { Connector } from './Connector__';
|
|
|
122
121
|
import type { CallConnector } from './CallConnector__';
|
|
123
122
|
import type { Connection } from './Connection__';
|
|
124
123
|
|
|
125
|
-
export type
|
|
124
|
+
export type SyntaxNode =
|
|
126
125
|
| App
|
|
127
126
|
| Module
|
|
128
127
|
| Namespace
|
|
@@ -163,7 +162,6 @@ export type SynatxNode =
|
|
|
163
162
|
| BackendVariable
|
|
164
163
|
| FrontendVariable
|
|
165
164
|
| Constant
|
|
166
|
-
| LogicItem
|
|
167
165
|
| Function
|
|
168
166
|
| AnonymousFunction
|
|
169
167
|
| Interface
|
|
@@ -247,4 +245,4 @@ export type SynatxNode =
|
|
|
247
245
|
| CallConnector
|
|
248
246
|
| Connection;
|
|
249
247
|
|
|
250
|
-
export type
|
|
248
|
+
export type SyntaxNodeConcept = SyntaxNode['concept'];
|
package/src/decorators/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseNode from '../common/BaseNode';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SyntaxNode, SyntaxNodeConcept } from '../concepts';
|
|
3
3
|
|
|
4
4
|
export * from './promise';
|
|
5
5
|
|
|
@@ -73,7 +73,7 @@ export function concept(nodeTitle: string) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export function property(objectRef?: string) {
|
|
76
|
-
return function handle(target:
|
|
76
|
+
return function handle(target: SyntaxNode | BaseNode, key: string) {
|
|
77
77
|
const metaMap = getConceptPropertyMap(target.concept ?? target.constructor.name);
|
|
78
78
|
const prototypeTarget = Object.getPrototypeOf(target);
|
|
79
79
|
const prototypeConstructor = prototypeTarget.constructor;
|
|
@@ -90,10 +90,10 @@ export function property(objectRef?: string) {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
export function ancestor(concept:
|
|
93
|
+
export function ancestor(concept: SyntaxNodeConcept) {
|
|
94
94
|
return function handle(target: any, key: string, descriptor: PropertyDescriptor) {
|
|
95
95
|
descriptor.get = function () {
|
|
96
|
-
return (this as
|
|
96
|
+
return (this as SyntaxNode).getAncestor(concept);
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
}
|
package/src/enums/KEYWORDS.ts
CHANGED
|
@@ -176,12 +176,12 @@ export function genMetaData(app: App, frontend: Frontend) {
|
|
|
176
176
|
const app = node.getAncestor('App') as App
|
|
177
177
|
nodeJson.properties.forEach((property: any) => {
|
|
178
178
|
const { typeAnnotation = {} } = property;
|
|
179
|
-
if (typeAnnotation?.typeNamespace
|
|
179
|
+
if (typeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
|
|
180
180
|
let originType = {} as TypeAnnotation
|
|
181
181
|
if (typeAnnotation.typeNamespace === 'app.metadataTypes') {
|
|
182
|
-
originType = app.metadataTypes
|
|
183
|
-
} else if (typeAnnotation.typeNamespace
|
|
184
|
-
const dependencyName = typeAnnotation.typeNamespace
|
|
182
|
+
originType = app.metadataTypes?.find((metadataType: MetadataType) => metadataType.name === typeAnnotation.typeName)?.typeAnnotation;
|
|
183
|
+
} else if (typeAnnotation.typeNamespace?.startsWith('extensions.') && typeAnnotation.typeNamespace?.endsWith('.metadataTypes')) {
|
|
184
|
+
const dependencyName = typeAnnotation.typeNamespace?.replace('extensions.', '').replace('.metadataTypes', '')
|
|
185
185
|
originType = app.dependencies?.find((dependency: Module) => dependency.name === dependencyName)?.metadataTypes?.find((ele: MetadataType) => ele.name === typeAnnotation.typeName)?.typeAnnotation ?? {} as TypeAnnotation
|
|
186
186
|
}
|
|
187
187
|
typeAnnotation.typeKind = 'primitive'
|
|
@@ -107,7 +107,7 @@ async function getCalllogicData(app: App, releaseData: ReleaseData) {
|
|
|
107
107
|
return {};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
nasl.
|
|
110
|
+
nasl.traverseStrictChildren((node) => {
|
|
111
111
|
if (
|
|
112
112
|
node.concept === 'CallLogic' &&
|
|
113
113
|
'uuid' in node &&
|
|
@@ -157,7 +157,7 @@ async function getCalllogicData(app: App, releaseData: ReleaseData) {
|
|
|
157
157
|
];
|
|
158
158
|
|
|
159
159
|
// 获取所有调用加密函数的调用节点 uuid
|
|
160
|
-
nasl.
|
|
160
|
+
nasl.traverseStrictChildren((node) => {
|
|
161
161
|
if (node.concept !== 'CallLogic' || !('uuid' in node)) {
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
@@ -85,14 +85,14 @@ async function findUIReferences(logic: Logic) {
|
|
|
85
85
|
if (node instanceof Frontend) usages.push(usage);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
const res: Array<View | ViewElement> = [];
|
|
88
|
+
const res: Array<View | ViewElement | Frontend> = [];
|
|
89
89
|
function dfs(usage: Usage, parent: Usage = null) {
|
|
90
90
|
if (
|
|
91
91
|
(usage.node instanceof BindEvent ||
|
|
92
92
|
usage.node instanceof BindAttribute ||
|
|
93
93
|
usage.node instanceof BindStyle ||
|
|
94
94
|
usage.node instanceof BindDirective) &&
|
|
95
|
-
(parent.node instanceof View || parent.node instanceof ViewElement)
|
|
95
|
+
(parent.node instanceof View || parent.node instanceof ViewElement || parent.node instanceof Frontend)
|
|
96
96
|
)
|
|
97
97
|
res.push(parent.node);
|
|
98
98
|
|
|
@@ -107,7 +107,7 @@ async function findUIReferences(logic: Logic) {
|
|
|
107
107
|
return res;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
function findResourcesOfUI(view: View | ViewElement) {
|
|
110
|
+
function findResourcesOfUI(view: View | ViewElement | Frontend) {
|
|
111
111
|
const res: ResourceNode[] = [];
|
|
112
112
|
let node: BaseNode = view;
|
|
113
113
|
while (node) {
|
|
@@ -159,7 +159,7 @@ async function findResourcesOfLogic(logic: Logic, uploaders: Map<string, ViewEle
|
|
|
159
159
|
const logics = await findViewLogicReferences(logic);
|
|
160
160
|
logics.push(logic);
|
|
161
161
|
|
|
162
|
-
let UIs: Array<View | ViewElement> = [];
|
|
162
|
+
let UIs: Array<View | ViewElement | Frontend> = [];
|
|
163
163
|
for (const logic of logics) {
|
|
164
164
|
UIs = UIs.concat(await findUIReferences(logic));
|
|
165
165
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Logic,
|
|
13
13
|
ConfigProperty,
|
|
14
14
|
App,
|
|
15
|
-
|
|
15
|
+
SyntaxNode,
|
|
16
16
|
BindAttribute,
|
|
17
17
|
Interface,
|
|
18
18
|
CallLogic,
|
|
@@ -278,7 +278,7 @@ function findNode(typeKey: string, node: BaseNode) {
|
|
|
278
278
|
* @param item 当前节点的内容
|
|
279
279
|
* @param node 获取变量框的位置
|
|
280
280
|
*/
|
|
281
|
-
export function nextFindTypeChild(typeKey: string, item: any, node:
|
|
281
|
+
export function nextFindTypeChild(typeKey: string, item: any, node: SyntaxNode) {
|
|
282
282
|
const newType = findNode(typeKey, node);
|
|
283
283
|
if ((newType as Structure)?.properties && (newType as Structure).properties.length) {
|
|
284
284
|
// 处理泛型的内容要取到值
|
|
@@ -312,7 +312,7 @@ export function nextFindTypeChild(typeKey: string, item: any, node: SynatxNode)
|
|
|
312
312
|
lCAPRolePerMapping: dataSources.defaultDS.entities.LCAPRolePerMapping;
|
|
313
313
|
}>`
|
|
314
314
|
*/
|
|
315
|
-
function getAStructureScopeType(type: string, parent: any, node:
|
|
315
|
+
function getAStructureScopeType(type: string, parent: any, node: SyntaxNode) {
|
|
316
316
|
let newType = type
|
|
317
317
|
.replaceAll(' ', '')
|
|
318
318
|
.replaceAll('\n', '')
|
|
@@ -412,7 +412,7 @@ function getAStructureScopeType(type: string, parent: any, node: SynatxNode) {
|
|
|
412
412
|
total: nasl.core.Long;
|
|
413
413
|
}`
|
|
414
414
|
*/
|
|
415
|
-
function getAStructureObjectStringType(type: string, parent: any, node:
|
|
415
|
+
function getAStructureObjectStringType(type: string, parent: any, node: SyntaxNode) {
|
|
416
416
|
let newType = type
|
|
417
417
|
.replaceAll(' ', '')
|
|
418
418
|
.replaceAll('\n', '')
|
|
@@ -467,7 +467,7 @@ function getAStructureObjectStringType(type: string, parent: any, node: SynatxNo
|
|
|
467
467
|
completionProperty.icon = getNodeiconFromLogic(completionProperty, node);
|
|
468
468
|
return completionProperty;
|
|
469
469
|
}
|
|
470
|
-
function nextObjectTypeChild(typeKey: string, item: any, node:
|
|
470
|
+
function nextObjectTypeChild(typeKey: string, item: any, node: SyntaxNode) {
|
|
471
471
|
const newType = findNode(typeKey, node);
|
|
472
472
|
if ((newType as Structure)?.properties && (newType as Structure).properties.length) {
|
|
473
473
|
// 处理泛型的内容要取到值
|
|
@@ -492,7 +492,7 @@ function nextObjectTypeChild(typeKey: string, item: any, node: SynatxNode) {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
function getNodeTypeVariableData(nodeType: any, item: any, node:
|
|
495
|
+
function getNodeTypeVariableData(nodeType: any, item: any, node: SyntaxNode) {
|
|
496
496
|
item.value = item.text;
|
|
497
497
|
item.name = item.text;
|
|
498
498
|
const parentExpression = new Identifier({ name: item.text });
|
|
@@ -589,7 +589,7 @@ function getNextFlag(typeKey: string, typeKeyMap: Map<string, number>) {
|
|
|
589
589
|
return true;
|
|
590
590
|
}
|
|
591
591
|
// 格式化变量数据
|
|
592
|
-
export function formatVariableData(data: unknown | variableItem[], node:
|
|
592
|
+
export function formatVariableData(data: unknown | variableItem[], node: SyntaxNode, parent?: any) {
|
|
593
593
|
if (Array.isArray(data)) {
|
|
594
594
|
let result = data.map((item) => {
|
|
595
595
|
item.children = [];
|
|
@@ -688,7 +688,7 @@ export function formatVariableData(data: unknown | variableItem[], node: SynatxN
|
|
|
688
688
|
}
|
|
689
689
|
|
|
690
690
|
// 从logic获取节点的icon
|
|
691
|
-
function getNodeiconFromLogic(completionProperty: CompletionProperty, node:
|
|
691
|
+
function getNodeiconFromLogic(completionProperty: CompletionProperty, node: SyntaxNode): string {
|
|
692
692
|
const { name: propName } = completionProperty;
|
|
693
693
|
const { view } = node as Param;
|
|
694
694
|
const logic = (node as Param).logic || (node as Param).OverriddenLogic || (node as Param).AuthLogic || (node as Param).AuthLogicForCallInterface;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
LogicItem,
|
|
12
12
|
Frontend,
|
|
13
13
|
View,
|
|
14
|
-
|
|
14
|
+
SyntaxNode,
|
|
15
15
|
ViewElement,
|
|
16
16
|
PAGE_COMPONENT_INCLUDE_TAG_MAP,
|
|
17
17
|
} from '..';
|
|
@@ -173,10 +173,10 @@ function getCurrentLogic(
|
|
|
173
173
|
) {
|
|
174
174
|
// 只有data-source check-file可以
|
|
175
175
|
if (
|
|
176
|
-
(node instanceof BindAttribute && (node.name === 'data-source' || node.name === 'check-file')) ||
|
|
176
|
+
(node instanceof BindAttribute && (node.name === 'data-source' || node.name === 'check-file' || node.name === 'can-dragable-handler' || node.name === 'can-dropin-handler')) ||
|
|
177
177
|
(node instanceof Identifier &&
|
|
178
178
|
node.parentNode instanceof BindAttribute &&
|
|
179
|
-
(node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file'))
|
|
179
|
+
(node.parentNode.name === 'data-source' || node.parentNode.name === 'check-file' || node.parentNode.name === 'can-dragable-handler' || node.parentNode.name === 'can-dropin-handler'))
|
|
180
180
|
) {
|
|
181
181
|
const { view } = node;
|
|
182
182
|
const viewLogics = view.logics;
|
|
@@ -194,7 +194,7 @@ function getCurrentLogic(
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
export async function getMemberIdentifier(node:
|
|
197
|
+
export async function getMemberIdentifier(node: SyntaxNode) {
|
|
198
198
|
if (node) {
|
|
199
199
|
// 获取字面量
|
|
200
200
|
const literals = getLiteralsIdentifier();
|
|
@@ -278,7 +278,7 @@ export function getBackendVariablesIdentifier(node: BaseNode): CompletionPropert
|
|
|
278
278
|
return newvariables;
|
|
279
279
|
}
|
|
280
280
|
// 获取变量
|
|
281
|
-
export async function getVariableIdentifier(node:
|
|
281
|
+
export async function getVariableIdentifier(node: SyntaxNode): Promise<CompletionProperty[]> {
|
|
282
282
|
let completionData: CompletionProperty[] = [new CompletionProperty({})];
|
|
283
283
|
// 只获取第一层内容
|
|
284
284
|
const app = node.getAncestor('App');
|
|
@@ -474,7 +474,7 @@ function flatElements(elements: ViewElement[], componentList: CompletionProperty
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
// 获取页面组件
|
|
477
|
-
export function getPageComponentsIdentifier(node:
|
|
477
|
+
export function getPageComponentsIdentifier(node: SyntaxNode): CompletionProperty[] {
|
|
478
478
|
const { fileNode } = node.getCurrentSource();
|
|
479
479
|
const stashElements = (fileNode as View).elements;
|
|
480
480
|
const componentList: CompletionProperty[] = []
|
package/src/server/naslServer.ts
CHANGED
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
AuthLogicForCallInterface,
|
|
81
81
|
Connector,
|
|
82
82
|
AuthInterface,
|
|
83
|
-
|
|
83
|
+
SyntaxNode,
|
|
84
84
|
Connection,
|
|
85
85
|
TriggerLauncher,
|
|
86
86
|
CallConnector,
|
|
@@ -2197,7 +2197,7 @@ class NaslServer {
|
|
|
2197
2197
|
}
|
|
2198
2198
|
}
|
|
2199
2199
|
}
|
|
2200
|
-
|
|
2200
|
+
|
|
2201
2201
|
if (node instanceof Return || node instanceof Variable) {
|
|
2202
2202
|
const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
|
|
2203
2203
|
if (!node.typeAnnotation && !node.__TypeAnnotation) {
|
|
@@ -2320,11 +2320,11 @@ class NaslServer {
|
|
|
2320
2320
|
|
|
2321
2321
|
_treeMetadataType2CoreType(type: TypeAnnotation, app: App) {
|
|
2322
2322
|
type.typeArguments?.forEach((item: TypeAnnotation) => {
|
|
2323
|
-
if (item.typeNamespace
|
|
2323
|
+
if (item.typeNamespace?.endsWith('.metadataTypes')) {
|
|
2324
2324
|
let originType = {} as TypeAnnotation
|
|
2325
2325
|
if (item.typeNamespace === 'app.metadataTypes') {
|
|
2326
2326
|
originType = app.metadataTypes?.find((metadataType) => metadataType.name === item.typeName)?.typeAnnotation;
|
|
2327
|
-
} else if (item.typeNamespace
|
|
2327
|
+
} else if (item.typeNamespace?.startsWith('extensions.') && item.typeNamespace?.endsWith('.metadataTypes')) {
|
|
2328
2328
|
const dependencyName = item.typeNamespace.replace('extensions.', '').replace('.metadataTypes', '')
|
|
2329
2329
|
originType = app.dependencies?.find((dependency) => dependency.name === dependencyName)?.metadataTypes?.find((ele) => ele.name === item.typeName)?.typeAnnotation ?? {} as TypeAnnotation
|
|
2330
2330
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash';
|
|
2
|
-
import { App, LogicItem, Logic, Module, View, ViewElement, Argument, SelectMembers,
|
|
2
|
+
import { App, LogicItem, Logic, Module, View, ViewElement, Argument, SelectMembers, SyntaxNode, BindDirective, CallLogic } from '../../concepts';
|
|
3
3
|
import { addBreakpointNodesFromApp } from '../../breakpoint';
|
|
4
4
|
import { getConceptConstructor } from '../../decorators';
|
|
5
5
|
import { config } from '../../config';
|
|
@@ -454,7 +454,7 @@ async function doAction(app: any, actionItem: any) {
|
|
|
454
454
|
try {
|
|
455
455
|
if (Array.isArray(list)) {
|
|
456
456
|
list.forEach((event) => {
|
|
457
|
-
const emitTarget = event?.originEvent?.target as
|
|
457
|
+
const emitTarget = event?.originEvent?.target as SyntaxNode;
|
|
458
458
|
const _path: string = event.originEvent.path;
|
|
459
459
|
const _root = _path.split('.')?.[1] || '';
|
|
460
460
|
if (['backend', 'overriddenLogics', 'dataSources', 'processes', 'roles', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies', 'authLogics', 'authLogicsForCallInterface', 'triggerLaunchers', 'connections'].some((item) => _root.startsWith(item))) {
|
|
@@ -58,8 +58,9 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
|
|
|
58
58
|
// 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
|
|
59
59
|
const key = [property.name, relationEntity.name].join('-');
|
|
60
60
|
const selectNameGroup = selectNameGroupMap.get(key);
|
|
61
|
+
let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
|
|
61
62
|
formItem += `
|
|
62
|
-
<u-select clearable placeholder="请选择${label}" :data-source="${
|
|
63
|
+
<u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
|
|
63
64
|
text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
|
|
64
65
|
</u-select>
|
|
65
66
|
`;
|
package/src/translator/utils.ts
CHANGED
|
@@ -72,7 +72,7 @@ export function withSourceMap() {
|
|
|
72
72
|
if (!state) {
|
|
73
73
|
// 没有状态不生成 SourceMap
|
|
74
74
|
return oldMethod.call(this, state, ...args);
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
76
|
// state = Object.freeze(Object.assign({
|
|
77
77
|
// position: { line: 0, character: 0, offset: 0 },
|
|
78
78
|
// tabSize: 0,
|
|
@@ -99,19 +99,18 @@ export function withSourceMap() {
|
|
|
99
99
|
before += beforeComment;
|
|
100
100
|
state = shiftState(state, beforeComment);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
// 调用真实方法, 可能有剩余参数
|
|
106
105
|
const code = oldMethod.call(this, state, ...args);
|
|
107
106
|
|
|
108
|
-
state.sourceMap?.set(this,
|
|
107
|
+
state.sourceMap?.set(this, {
|
|
109
108
|
start: state.position,
|
|
110
109
|
end: shiftPosition(state.position, code),
|
|
111
|
-
})
|
|
110
|
+
});
|
|
112
111
|
|
|
113
112
|
return before + code;
|
|
114
|
-
|
|
113
|
+
|
|
115
114
|
};
|
|
116
115
|
|
|
117
116
|
return descriptor;
|
|
@@ -148,4 +147,4 @@ export function transfromUnionTypeAnnotation(expTypeAnnotation: TypeAnnotation,
|
|
|
148
147
|
}
|
|
149
148
|
})
|
|
150
149
|
}
|
|
151
|
-
}
|
|
150
|
+
}
|