@lcap/nasl 3.4.0-alpha.2 → 3.4.0-beta.1
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/common/BaseNode.d.ts +14 -11
- package/out/common/BaseNode.js +72 -52
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Anchor__.js +3 -1
- package/out/concepts/Anchor__.js.map +1 -1
- package/out/concepts/AnonymousFunction__.js +10 -3
- package/out/concepts/AnonymousFunction__.js.map +1 -1
- package/out/concepts/App__.js +69 -18
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +3 -1
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/Assignee__.js +18 -5
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.js +6 -2
- package/out/concepts/AssignmentLine__.js.map +1 -1
- package/out/concepts/Assignment__.js +6 -2
- package/out/concepts/Assignment__.js.map +1 -1
- package/out/concepts/Attribute__.js +3 -1
- package/out/concepts/Attribute__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +4 -1
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/AuthLogic__.js.map +1 -1
- package/out/concepts/BackendVariable__.js +3 -1
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/Backend__.js +4 -1
- package/out/concepts/Backend__.js.map +1 -1
- package/out/concepts/BatchAssignment__.js +11 -3
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +6 -2
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +20 -6
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.js +7 -2
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.js +8 -2
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.js +7 -2
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/CallAuthInterface__.js +4 -1
- package/out/concepts/CallAuthInterface__.js.map +1 -1
- package/out/concepts/CallFunction__.js +8 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts +2 -1
- package/out/concepts/CallInterface__.js +51 -13
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.js +11 -3
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +34 -10
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/CompletionProperty__.js +3 -1
- package/out/concepts/CompletionProperty__.js.map +1 -1
- package/out/concepts/ConfigGroup__.js +4 -1
- package/out/concepts/ConfigGroup__.js.map +1 -1
- package/out/concepts/ConfigProperty__.js +4 -1
- package/out/concepts/ConfigProperty__.js.map +1 -1
- package/out/concepts/Configuration__.js +4 -1
- package/out/concepts/Configuration__.js.map +1 -1
- package/out/concepts/Connection__.js +4 -1
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/Connector__.js +26 -7
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Constant__.js +3 -1
- package/out/concepts/Constant__.js.map +1 -1
- package/out/concepts/DataSource__.js +4 -1
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/Destination__.js +7 -2
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/EntityIndex__.js +3 -1
- package/out/concepts/EntityIndex__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +9 -3
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.js +8 -2
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/Enum__.js +4 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Event__.js +4 -1
- package/out/concepts/Event__.js.map +1 -1
- package/out/concepts/ExternalDestination__.js +6 -2
- package/out/concepts/ExternalDestination__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +19 -6
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.js +8 -2
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/Frontend__.js +19 -5
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Function__.js +19 -5
- package/out/concepts/Function__.js.map +1 -1
- package/out/concepts/IfStatement__.js +11 -3
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Integration__.js +7 -2
- package/out/concepts/Integration__.js.map +1 -1
- package/out/concepts/InterfaceParam__.js +3 -1
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.js +11 -3
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.js +46 -46
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +8 -2
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/Match__.js +7 -2
- package/out/concepts/Match__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +6 -2
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.js +55 -14
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/MsgTriggerEvent__.js +4 -1
- package/out/concepts/MsgTriggerEvent__.js.map +1 -1
- package/out/concepts/MsgTriggerLauncher__.js +4 -1
- package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
- package/out/concepts/Namespace__.js +48 -12
- package/out/concepts/Namespace__.js.map +1 -1
- package/out/concepts/NewComposite__.js +15 -4
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +7 -2
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +11 -3
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +3 -1
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +3 -1
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.js +28 -8
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.js +3 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessComponent__.js +8 -2
- package/out/concepts/ProcessComponent__.js.map +1 -1
- package/out/concepts/ProcessElement__.js +30 -8
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessOutcomes__.js +3 -1
- package/out/concepts/ProcessOutcomes__.js.map +1 -1
- package/out/concepts/Process__.js +20 -5
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryAggregateExpression__.js +3 -1
- package/out/concepts/QueryAggregateExpression__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +4 -1
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryGroupByExpression__.js +3 -1
- package/out/concepts/QueryGroupByExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +8 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/QueryLimitExpression__.js +6 -2
- package/out/concepts/QueryLimitExpression__.js.map +1 -1
- package/out/concepts/QueryOrderByExpression__.js +6 -2
- package/out/concepts/QueryOrderByExpression__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +4 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.js +3 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SelectMembers__.js +7 -2
- package/out/concepts/SelectMembers__.js.map +1 -1
- package/out/concepts/Slot__.js +3 -1
- package/out/concepts/Slot__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.js +3 -1
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StringInterpolation__.js +4 -1
- package/out/concepts/StringInterpolation__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +3 -1
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +8 -2
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +7 -2
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/SwitchStatement__.js +4 -1
- package/out/concepts/SwitchStatement__.js.map +1 -1
- package/out/concepts/TriggerEvent__.js +4 -1
- package/out/concepts/TriggerEvent__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.js +12 -3
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/UnaryExpression__.js +3 -1
- package/out/concepts/UnaryExpression__.js.map +1 -1
- package/out/concepts/ValidationRule__.js +10 -3
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.js +3 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.js +24 -6
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +24 -7
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +27 -7
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/WhileStatement__.js +7 -2
- 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/decorators/index.js +3 -1
- package/out/decorators/index.js.map +1 -1
- package/out/natural/genNaturalTS.js +1 -1
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/server/formatTsUtils.d.ts +3 -3
- package/out/server/getMemberIdentifier.d.ts +4 -4
- package/out/server/naslServer.d.ts +1 -1
- package/out/server/naslServer.js +4 -2
- package/out/server/naslServer.js.map +1 -1
- package/out/translator/utils.js +24 -28
- package/out/translator/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/common/BaseNode.ts +92 -68
- package/src/concepts/Anchor__.ts +3 -1
- package/src/concepts/AnonymousFunction__.ts +10 -3
- package/src/concepts/App__.ts +69 -18
- package/src/concepts/Argument__.ts +3 -1
- package/src/concepts/Assignee__.ts +18 -5
- package/src/concepts/AssignmentLine__.ts +6 -2
- package/src/concepts/Assignment__.ts +6 -2
- package/src/concepts/Attribute__.ts +3 -1
- package/src/concepts/AuthLogicForCallInterface__.ts +4 -1
- package/src/concepts/AuthLogic__.ts +3 -0
- package/src/concepts/BackendVariable__.ts +3 -1
- package/src/concepts/Backend__.ts +4 -1
- package/src/concepts/BatchAssignment__.ts +11 -3
- package/src/concepts/BinaryExpression__.ts +6 -2
- package/src/concepts/BindAttribute__.ts +20 -7
- package/src/concepts/BindDirective__.ts +7 -2
- package/src/concepts/BindEvent__.ts +8 -2
- package/src/concepts/BindStyle__.ts +7 -2
- package/src/concepts/CallAuthInterface__.ts +4 -1
- package/src/concepts/CallFunction__.ts +8 -2
- package/src/concepts/CallInterface__.ts +49 -14
- package/src/concepts/CallLogic__.ts +11 -3
- package/src/concepts/CallQueryComponent__.ts +34 -10
- package/src/concepts/CompletionProperty__.ts +3 -1
- package/src/concepts/ConfigGroup__.ts +4 -1
- package/src/concepts/ConfigProperty__.ts +4 -1
- package/src/concepts/Configuration__.ts +4 -1
- package/src/concepts/Connection__.ts +4 -1
- package/src/concepts/Connector__.ts +26 -7
- package/src/concepts/Constant__.ts +3 -1
- package/src/concepts/DataSource__.ts +4 -1
- package/src/concepts/Destination__.ts +7 -2
- package/src/concepts/EntityIndex__.ts +3 -1
- package/src/concepts/EntityProperty__.ts +9 -3
- package/src/concepts/Entity__.ts +8 -2
- package/src/concepts/Enum__.ts +4 -1
- package/src/concepts/Event__.ts +4 -1
- package/src/concepts/ExternalDestination__.ts +6 -2
- package/src/concepts/ForEachStatement__.ts +19 -6
- package/src/concepts/FrontendLibrary__.ts +8 -2
- package/src/concepts/Frontend__.ts +19 -5
- package/src/concepts/Function__.ts +19 -5
- package/src/concepts/IfStatement__.ts +11 -3
- package/src/concepts/Integration__.ts +7 -2
- package/src/concepts/InterfaceParam__.ts +3 -1
- package/src/concepts/Interface__.ts +11 -3
- package/src/concepts/Logic__.ts +62 -57
- package/src/concepts/MatchCase__.ts +8 -2
- package/src/concepts/Match__.ts +7 -2
- package/src/concepts/MemberExpression__.ts +6 -2
- package/src/concepts/Module__.ts +55 -14
- package/src/concepts/MsgTriggerEvent__.ts +4 -1
- package/src/concepts/MsgTriggerLauncher__.ts +4 -1
- package/src/concepts/Namespace__.ts +48 -12
- package/src/concepts/NewComposite__.ts +15 -4
- package/src/concepts/NewList__.ts +7 -2
- package/src/concepts/NewMap__.ts +11 -3
- package/src/concepts/NumericLiteral__.ts +3 -1
- package/src/concepts/OqlQueryComponent__.ts +3 -1
- package/src/concepts/OverriddenLogic__.ts +28 -8
- package/src/concepts/Param__.ts +3 -1
- package/src/concepts/ProcessComponent__.ts +8 -2
- package/src/concepts/ProcessElement__.ts +30 -8
- package/src/concepts/ProcessOutcomes__.ts +3 -1
- package/src/concepts/Process__.ts +20 -5
- package/src/concepts/QueryAggregateExpression__.ts +3 -1
- package/src/concepts/QueryFromExpression__.ts +4 -1
- package/src/concepts/QueryGroupByExpression__.ts +3 -1
- package/src/concepts/QueryJoinExpression__.ts +8 -2
- package/src/concepts/QueryLimitExpression__.ts +6 -2
- package/src/concepts/QueryOrderByExpression__.ts +6 -2
- package/src/concepts/QuerySelectExpression__.ts +4 -1
- package/src/concepts/Return__.ts +3 -1
- package/src/concepts/SelectMembers__.ts +7 -2
- package/src/concepts/Slot__.ts +3 -1
- package/src/concepts/SqlQueryComponent__.ts +3 -1
- package/src/concepts/StringInterpolation__.ts +4 -1
- package/src/concepts/StructureProperty__.ts +3 -1
- package/src/concepts/Structure__.ts +8 -2
- package/src/concepts/SwitchCase__.ts +7 -2
- package/src/concepts/SwitchStatement__.ts +4 -1
- package/src/concepts/TriggerEvent__.ts +4 -1
- package/src/concepts/TypeAnnotation__.ts +13 -4
- package/src/concepts/UnaryExpression__.ts +3 -1
- package/src/concepts/ValidationRule__.ts +10 -3
- package/src/concepts/Variable__.ts +3 -1
- package/src/concepts/ViewComponent__.ts +24 -6
- package/src/concepts/ViewElement__.ts +92 -72
- package/src/concepts/View__.ts +27 -7
- package/src/concepts/WhileStatement__.ts +7 -2
- package/src/concepts/types__.ts +2 -4
- package/src/decorators/index.ts +7 -5
- package/src/natural/genNaturalTS.ts +1 -1
- package/src/server/formatTsUtils.ts +8 -8
- package/src/server/getMemberIdentifier.ts +4 -4
- package/src/server/naslServer.ts +4 -4
- package/src/service/storage/init.ts +2 -2
- package/src/translator/utils.ts +7 -9
|
@@ -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 '..';
|
|
@@ -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');
|
|
@@ -458,7 +458,7 @@ function flatElements(elements: ViewElement[], componentList: CompletionProperty
|
|
|
458
458
|
})
|
|
459
459
|
}
|
|
460
460
|
// 获取页面组件
|
|
461
|
-
export function getPageComponentsIdentifier(node:
|
|
461
|
+
export function getPageComponentsIdentifier(node: SyntaxNode): CompletionProperty[] {
|
|
462
462
|
const { fileNode } = node.getCurrentSource();
|
|
463
463
|
const stashElements = (fileNode as View).elements;
|
|
464
464
|
const componentList: CompletionProperty[] = []
|
package/src/server/naslServer.ts
CHANGED
|
@@ -77,10 +77,8 @@ import {
|
|
|
77
77
|
Integration,
|
|
78
78
|
Backend,
|
|
79
79
|
CallAuthInterface,
|
|
80
|
-
AuthLogicForCallInterface,
|
|
81
80
|
Connector,
|
|
82
81
|
AuthInterface,
|
|
83
|
-
SynatxNode,
|
|
84
82
|
Connection,
|
|
85
83
|
TriggerLauncher,
|
|
86
84
|
CallConnector,
|
|
@@ -146,6 +144,8 @@ let isChangeInterface = false; // 判断是否导入接口
|
|
|
146
144
|
type ActionNode = { target: Variable; typeannotation: TypeAnnotation };
|
|
147
145
|
let actionArr: Array<ActionNode> = []; //用于导入接口收集更改的节点
|
|
148
146
|
let timer: number | null = null; //超时器用于收集导入接口相关
|
|
147
|
+
// naslStdlib文件缓存;作为全局变量给多实例用复用
|
|
148
|
+
const __naslStdlibFileCacheMap: Map<tsProtocol.OpenRequestArgs['file'], tsProtocol.OpenRequestArgs> = new Map();
|
|
149
149
|
|
|
150
150
|
// 联合类型切割取出类型
|
|
151
151
|
export function getDisplayString2Type(displayString: string) {
|
|
@@ -186,7 +186,7 @@ export function getDisplayString2Type(displayString: string) {
|
|
|
186
186
|
@sentryMonitorNaslServer
|
|
187
187
|
class NaslServer {
|
|
188
188
|
/** naslStdlib文件缓存 */
|
|
189
|
-
naslStdlibFileCacheMap
|
|
189
|
+
naslStdlibFileCacheMap = __naslStdlibFileCacheMap;
|
|
190
190
|
|
|
191
191
|
messager: Messager;
|
|
192
192
|
|
|
@@ -676,7 +676,7 @@ class NaslServer {
|
|
|
676
676
|
|
|
677
677
|
// 缓存添加过的文件
|
|
678
678
|
cacheFile(options: tsProtocol.OpenRequestArgs) {
|
|
679
|
-
|
|
679
|
+
__naslStdlibFileCacheMap.set(options.file, options);
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
/** u
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { App, LogicItem, Logic, Module, View, ViewElement, Argument, SelectMembers,
|
|
1
|
+
import { App, LogicItem, Logic, Module, View, ViewElement, Argument, SelectMembers, SyntaxNode, BindDirective, CallLogic } from '../../concepts';
|
|
2
2
|
import { addBreakpointNodesFromApp } from '../../breakpoint';
|
|
3
3
|
import { getConceptConstructor } from '../../decorators';
|
|
4
4
|
import { config } from '../../config';
|
|
@@ -206,7 +206,7 @@ async function doAction(app: any, actionItem: any) {
|
|
|
206
206
|
try {
|
|
207
207
|
if (Array.isArray(list)) {
|
|
208
208
|
list.forEach((event) => {
|
|
209
|
-
const emitTarget = event?.originEvent?.target as
|
|
209
|
+
const emitTarget = event?.originEvent?.target as SyntaxNode;
|
|
210
210
|
const _path: string = event.originEvent.path;
|
|
211
211
|
const _root = _path.split('.')?.[1] || '';
|
|
212
212
|
if (['backend', 'overriddenLogics', 'dataSources', 'processes', 'roles', 'logics', 'enums', 'structures', 'interfaces', 'interfaceDependencies', 'configuration', 'dependencies', 'authLogics', 'authLogicsForCallInterface', 'triggerLaunchers', 'connections'].some((item) => _root.startsWith(item))) {
|
package/src/translator/utils.ts
CHANGED
|
@@ -11,14 +11,12 @@ export const indent = (tabSize: number) => ' '.repeat(tabSize * 4);
|
|
|
11
11
|
* 创建编译器状态
|
|
12
12
|
*/
|
|
13
13
|
export function createCompilerState(startCode: string = '', options?: Partial<TranslatorState>) {
|
|
14
|
-
const state: TranslatorState =
|
|
15
|
-
position: {
|
|
14
|
+
const state: TranslatorState = {position: {
|
|
16
15
|
line: 0,
|
|
17
16
|
character: 0,
|
|
18
17
|
offset: 0,
|
|
19
18
|
},
|
|
20
|
-
tabSize: 0,
|
|
21
|
-
}, options);
|
|
19
|
+
tabSize: 0, ...options};
|
|
22
20
|
if (!state.sourceMap)
|
|
23
21
|
state.sourceMap = new Map<BaseNode, SourceMapItem>();
|
|
24
22
|
|
|
@@ -29,7 +27,7 @@ export function createCompilerState(startCode: string = '', options?: Partial<Tr
|
|
|
29
27
|
* 根据代码移动位置
|
|
30
28
|
*/
|
|
31
29
|
export function shiftPosition(pos: Position, code: string = ''): Position {
|
|
32
|
-
const res =
|
|
30
|
+
const res = { ...pos};
|
|
33
31
|
if (code) {
|
|
34
32
|
const arr = code.split('\n');
|
|
35
33
|
res.offset += code.length;
|
|
@@ -48,7 +46,7 @@ export function shiftPosition(pos: Position, code: string = ''): Position {
|
|
|
48
46
|
* 根据代码移动状态
|
|
49
47
|
*/
|
|
50
48
|
export function shiftState(state: TranslatorState, code?: string, options?: Partial<TranslatorState>): TranslatorState {
|
|
51
|
-
state =
|
|
49
|
+
state = { ...state};
|
|
52
50
|
state.position = shiftPosition(state.position, code);
|
|
53
51
|
Object.assign(state, options); // 优先 options
|
|
54
52
|
return Object.freeze(state);
|
|
@@ -70,8 +68,8 @@ export function withSourceMap() {
|
|
|
70
68
|
} catch (err) {}
|
|
71
69
|
if (!state) {
|
|
72
70
|
// 没有状态不生成 SourceMap
|
|
73
|
-
return oldMethod.call(this);
|
|
74
|
-
}
|
|
71
|
+
return oldMethod.call(this, state, ...args);
|
|
72
|
+
}
|
|
75
73
|
// state = Object.freeze(Object.assign({
|
|
76
74
|
// position: { line: 0, character: 0, offset: 0 },
|
|
77
75
|
// tabSize: 0,
|
|
@@ -96,7 +94,7 @@ export function withSourceMap() {
|
|
|
96
94
|
}));
|
|
97
95
|
|
|
98
96
|
return before + code;
|
|
99
|
-
|
|
97
|
+
|
|
100
98
|
};
|
|
101
99
|
|
|
102
100
|
return descriptor;
|