@lcap/nasl 3.3.3-beta.2 → 3.3.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/template/myProcess.d.ts +1 -1
- package/out/automate/template/myProcess.js +3 -2
- package/out/automate/template/myProcess.js.map +1 -1
- package/out/common/BaseNode.d.ts +26 -16
- package/out/common/BaseNode.js +35 -11
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Anchor__.js +2 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js +6 -3
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/Argument__.js +4 -3
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignment__.js +3 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +2 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +3 -2
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +4 -3
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +7 -5
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +7 -7
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +9 -14
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +2 -1
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +5 -3
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +2 -1
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.js +5 -2
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallFunction__.js +6 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.js +14 -9
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +10 -5
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +8 -15
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +2 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +3 -2
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +3 -2
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +3 -2
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.js +3 -2
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Connector__.js +15 -10
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.js +2 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.js +3 -2
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +2 -1
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +6 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +6 -4
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +2 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +3 -2
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js +2 -1
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +4 -2
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/Frontend__.js +14 -9
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +11 -6
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/Identifier__.js +3 -0
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -1
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +2 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +6 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/JSBlock__.js +5 -5
- package/out/concepts/JSBlock__.js.map +1 -1
- package/out/concepts/Logic__.js +25 -19
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +6 -4
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +2 -1
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +2 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.d.ts +1 -1
- package/out/concepts/MetadataType__.js +8 -6
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.js +3 -2
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.js +3 -2
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.js +33 -22
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js +38 -18
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +5 -3
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +5 -3
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +2 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +4 -3
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.js +13 -7
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.js +4 -3
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +6 -4
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +22 -14
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcome__.d.ts +1 -2
- package/out/concepts/ProcessOutcome__.js +16 -1
- package/out/concepts/ProcessOutcome__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.d.ts +1 -2
- package/out/concepts/ProcessOutcomes__.js +16 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +15 -10
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +2 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js +2 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +3 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +2 -1
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +2 -1
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +3 -2
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.js +4 -3
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +3 -2
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js +2 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +2 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +5 -2
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +2 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +6 -4
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +2 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +2 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerEvent__.js +3 -2
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +9 -4
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +2 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +2 -1
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +4 -3
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +26 -5
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +9 -4
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +2 -1
- package/out/concepts/WhileStatement__.js.map +1 -1
- package/out/concepts/types__.d.ts +2 -3
- package/out/decorators/index.d.ts +3 -3
- package/out/generator/genBundleFiles.js +4 -4
- package/out/generator/genMetaData.js +4 -4
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/genReleaseBody.js +7 -5
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/generator/icestark.d.ts +1 -1
- package/out/generator/icestark.js +4 -2
- package/out/generator/icestark.js.map +1 -1
- package/out/generator/qiankun.d.ts +1 -1
- package/out/generator/qiankun.js +3 -1
- package/out/generator/qiankun.js.map +1 -1
- 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/server/translator.js +11 -0
- package/out/server/translator.js.map +1 -1
- package/out/service/storage/jsoner.js +20 -1
- package/out/service/storage/jsoner.js.map +1 -1
- package/out/translator/utils.d.ts +1 -0
- package/out/translator/utils.js +16 -2
- package/out/translator/utils.js.map +1 -1
- package/package.json +1 -1
- package/sandbox/stdlib/nasl.oql.ts +6 -1
- package/sandbox/stdlib/nasl.util.ts +142 -142
- package/src/automate/template/myProcess.js +3 -2
- package/src/common/BaseNode.ts +64 -33
- package/src/concepts/Anchor__.ts +2 -1
- package/src/concepts/AnonymousFunction__.ts +6 -3
- package/src/concepts/Argument__.ts +7 -6
- package/src/concepts/Assignment__.ts +17 -17
- package/src/concepts/Attribute__.ts +2 -1
- package/src/concepts/AuthLogicForCallInterface__.ts +3 -2
- package/src/concepts/BackendVariable__.ts +7 -6
- package/src/concepts/BatchAssignment__.ts +7 -5
- package/src/concepts/BinaryExpression__.ts +10 -12
- package/src/concepts/BindAttribute__.ts +18 -15
- package/src/concepts/BindDirective__.ts +15 -14
- package/src/concepts/BindEvent__.ts +5 -3
- package/src/concepts/BindStyle__.ts +2 -1
- package/src/concepts/CallAuthInterface__.ts +5 -2
- package/src/concepts/CallFunction__.ts +17 -5
- package/src/concepts/CallInterface__.ts +18 -13
- package/src/concepts/CallLogic__.ts +22 -9
- package/src/concepts/CallQueryComponent__.ts +8 -14
- package/src/concepts/CompletionProperty__.ts +2 -1
- package/src/concepts/ConfigGroup__.ts +3 -2
- package/src/concepts/ConfigProperty__.ts +3 -2
- package/src/concepts/Configuration__.ts +3 -2
- package/src/concepts/Connection__.ts +3 -2
- package/src/concepts/Connector__.ts +15 -10
- package/src/concepts/Constant__.ts +2 -1
- package/src/concepts/DataSource__.ts +3 -2
- package/src/concepts/Destination__.ts +2 -1
- package/src/concepts/EntityProperty__.ts +7 -3
- package/src/concepts/Entity__.ts +6 -4
- package/src/concepts/Enum__.ts +2 -1
- package/src/concepts/Event__.ts +3 -2
- package/src/concepts/ExternalDestination__.ts +2 -1
- package/src/concepts/ForEachStatement__.ts +4 -2
- package/src/concepts/Frontend__.ts +14 -9
- package/src/concepts/Function__.ts +11 -6
- package/src/concepts/Identifier__.ts +7 -4
- package/src/concepts/IfStatement__.ts +2 -1
- package/src/concepts/InterfaceParam__.ts +2 -1
- package/src/concepts/Interface__.ts +6 -3
- package/src/concepts/JSBlock__.ts +24 -25
- package/src/concepts/Logic__.ts +26 -20
- package/src/concepts/MatchCase__.ts +6 -4
- package/src/concepts/Match__.ts +2 -1
- package/src/concepts/MemberExpression__.ts +2 -1
- package/src/concepts/MetadataType__.ts +18 -17
- package/src/concepts/MsgTriggerEvent__.ts +3 -2
- package/src/concepts/MsgTriggerLauncher__.ts +3 -2
- package/src/concepts/Namespace__.ts +33 -22
- package/src/concepts/NewComposite__.ts +37 -18
- package/src/concepts/NewList__.ts +13 -11
- package/src/concepts/NewMap__.ts +11 -9
- package/src/concepts/NumericLiteral__.ts +2 -1
- package/src/concepts/OqlQueryComponent__.ts +9 -8
- package/src/concepts/OverriddenLogic__.ts +13 -7
- package/src/concepts/Param__.ts +15 -14
- package/src/concepts/ProcessComponent__.ts +6 -4
- package/src/concepts/ProcessElement__.ts +22 -14
- package/src/concepts/ProcessOutcome__.ts +17 -2
- package/src/concepts/ProcessOutcomes__.ts +17 -2
- package/src/concepts/Process__.ts +15 -10
- package/src/concepts/QueryAggregateExpression__.ts +2 -1
- package/src/concepts/QueryFromExpression__.ts +2 -1
- package/src/concepts/QueryGroupByExpression__.ts +2 -1
- package/src/concepts/QueryJoinExpression__.ts +3 -2
- package/src/concepts/QueryLimitExpression__.ts +2 -1
- package/src/concepts/QueryOrderByExpression__.ts +2 -1
- package/src/concepts/QuerySelectExpression__.ts +3 -2
- package/src/concepts/Return__.ts +7 -6
- package/src/concepts/SelectMembers__.ts +3 -2
- package/src/concepts/Slot__.ts +2 -1
- package/src/concepts/SqlQueryComponent__.ts +2 -1
- package/src/concepts/StringInterpolation__.ts +13 -3
- package/src/concepts/StructureProperty__.ts +2 -1
- package/src/concepts/Structure__.ts +6 -4
- package/src/concepts/SwitchCase__.ts +2 -1
- package/src/concepts/SwitchStatement__.ts +2 -1
- package/src/concepts/TriggerEvent__.ts +3 -2
- package/src/concepts/TypeAnnotation__.ts +35 -28
- package/src/concepts/UnaryExpression__.ts +2 -1
- package/src/concepts/ValidationRule__.ts +2 -1
- package/src/concepts/Variable__.ts +7 -6
- package/src/concepts/ViewElement__.ts +27 -8
- package/src/concepts/View__.ts +12 -7
- package/src/concepts/WhileStatement__.ts +2 -1
- package/src/concepts/types__.ts +2 -4
- package/src/decorators/index.ts +4 -4
- package/src/generator/genBundleFiles.ts +4 -4
- package/src/generator/genMetaData.ts +4 -4
- package/src/generator/genReleaseBody.ts +8 -4
- package/src/generator/icestark.ts +4 -2
- package/src/generator/qiankun.ts +3 -1
- package/src/server/formatTsUtils.ts +8 -8
- package/src/server/getMemberIdentifier.ts +6 -6
- package/src/server/naslServer.ts +4 -4
- package/src/server/translator.ts +10 -1
- package/src/service/storage/init.ts +2 -2
- package/src/service/storage/jsoner.ts +24 -3
- package/src/translator/utils.ts +15 -1
|
@@ -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
|
}
|
package/src/server/translator.ts
CHANGED
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
CallInterface,
|
|
34
34
|
Return,
|
|
35
35
|
ProcessElement,
|
|
36
|
-
NullLiteral,
|
|
37
36
|
SwitchCase,
|
|
38
37
|
WhileStatement,
|
|
39
38
|
IfStatement,
|
|
@@ -41,6 +40,7 @@ import {
|
|
|
41
40
|
ForEachStatement,
|
|
42
41
|
CallFunction,
|
|
43
42
|
ProcessOutcome,
|
|
43
|
+
ProcessOutcomes,
|
|
44
44
|
Function,
|
|
45
45
|
Anchor,
|
|
46
46
|
BatchAssignment,
|
|
@@ -573,6 +573,15 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
573
573
|
}
|
|
574
574
|
} else if (node.parentNode instanceof NewList && text.includes(`parameter of type 'never'`)) {
|
|
575
575
|
tsErrorDetail.message = '自动推导不出类型!newList中有未知类型';
|
|
576
|
+
} else if (node instanceof ProcessOutcome || node instanceof ProcessOutcomes) {
|
|
577
|
+
const cap = /Argument of type '(.+?)' is not assignable to parameter of type '(.+?)'/.exec(text);
|
|
578
|
+
const selectComes = cap[1].split(' | ');
|
|
579
|
+
const currentComes = cap[2].split(' | ');
|
|
580
|
+
if (node instanceof ProcessOutcome) {
|
|
581
|
+
tsErrorDetail.message = `流向出口不存在,${selectComes.map((item) => item).join(',')}出口流不属于[${currentComes.map((item) => item).join(',')}]当中的某个流`
|
|
582
|
+
} else {
|
|
583
|
+
tsErrorDetail.message = `流向出口不存在,${selectComes.map((item) => item).join(',')}有错误的出口流`
|
|
584
|
+
}
|
|
576
585
|
}
|
|
577
586
|
}
|
|
578
587
|
if (node instanceof Argument || node instanceof Anchor) {
|
|
@@ -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))) {
|
|
@@ -28,6 +28,27 @@ function excludeProperties(node: any, excludes: string[]) {
|
|
|
28
28
|
return newNode;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
// "app.configuration.groups[name=system].properties[name=system.custom.log.level]"
|
|
32
|
+
function splitPath(path: string) {
|
|
33
|
+
path = path || '';
|
|
34
|
+
const res = [];
|
|
35
|
+
let prevDot = -1;
|
|
36
|
+
let countLeftBracket = 0;
|
|
37
|
+
for(let i=0;i<path.length;i+=1) {
|
|
38
|
+
if(path[i] === '[')
|
|
39
|
+
countLeftBracket += 1;
|
|
40
|
+
else if(path[i] === ']')
|
|
41
|
+
countLeftBracket -= 1;
|
|
42
|
+
|
|
43
|
+
if(path[i] === '.' && countLeftBracket === 0) {
|
|
44
|
+
res.push(path.slice(prevDot+1, i));
|
|
45
|
+
prevDot = i;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
res.push(path.slice(prevDot+1));
|
|
49
|
+
return res;
|
|
50
|
+
}
|
|
51
|
+
|
|
31
52
|
/**
|
|
32
53
|
* 通过路径查找节点
|
|
33
54
|
* @param json 根节点
|
|
@@ -35,7 +56,7 @@ function excludeProperties(node: any, excludes: string[]) {
|
|
|
35
56
|
* @returns
|
|
36
57
|
*/
|
|
37
58
|
export function queryNodeByPath(json: any, path: string): any {
|
|
38
|
-
const pathArr = path
|
|
59
|
+
const pathArr = splitPath(path);
|
|
39
60
|
let pathItem = pathArr.shift();
|
|
40
61
|
let node: any = json;
|
|
41
62
|
while (pathItem) {
|
|
@@ -69,9 +90,9 @@ export async function batchQuery(json: any, queryList: Array<Query>) {
|
|
|
69
90
|
if (node) {
|
|
70
91
|
if (Array.isArray(node)) {
|
|
71
92
|
return node.map((nodeItem) => excludeProperties(nodeItem, excludes));
|
|
72
|
-
}
|
|
93
|
+
}
|
|
73
94
|
return excludeProperties(node, excludes);
|
|
74
|
-
|
|
95
|
+
|
|
75
96
|
}
|
|
76
97
|
return null;
|
|
77
98
|
});
|
package/src/translator/utils.ts
CHANGED
|
@@ -121,7 +121,7 @@ export function withSourceMap() {
|
|
|
121
121
|
export function transfromMetadataType(expTypeAnnotation: TypeAnnotation, app: App) {
|
|
122
122
|
let { sortedTypeKey, typeKind, typeNamespace, typeName } = expTypeAnnotation || {};
|
|
123
123
|
if (expTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
|
|
124
|
-
const referenceNode = app
|
|
124
|
+
const referenceNode = app?.findNodeByCompleteName(expTypeAnnotation.typeNamespace + '.' + expTypeAnnotation.typeName) || {}
|
|
125
125
|
const typeAn = referenceNode.typeAnnotation || {};
|
|
126
126
|
typeKind = typeAn.typeKind;
|
|
127
127
|
typeNamespace = typeAn.typeNamespace;
|
|
@@ -134,4 +134,18 @@ export function transfromMetadataType(expTypeAnnotation: TypeAnnotation, app: Ap
|
|
|
134
134
|
typeName,
|
|
135
135
|
sortedTypeKey
|
|
136
136
|
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function transfromUnionTypeAnnotation(expTypeAnnotation: TypeAnnotation, app: App) {
|
|
140
|
+
// 针对union类型,typeAnntatation拿不到app数据,暂时先在这里处理
|
|
141
|
+
if (expTypeAnnotation?.typeKind === 'union' && expTypeAnnotation?.typeArguments?.length) {
|
|
142
|
+
expTypeAnnotation?.typeArguments?.forEach((typeArg: any) => {
|
|
143
|
+
if (typeArg.typeNamespace?.endsWith('.metadataTypes')) {
|
|
144
|
+
const referenceNode = app?.findNodeByCompleteName(typeArg.typeNamespace + '.' + typeArg.typeName)?.typeAnnotation || {};
|
|
145
|
+
typeArg.typeName = referenceNode.typeName
|
|
146
|
+
typeArg.typeKind = referenceNode.typeKind
|
|
147
|
+
typeArg.typeNamespace = referenceNode.typeNamespace
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
}
|
|
137
151
|
}
|