@lcap/nasl 2.21.0-beta.2 → 2.21.0-beta.3
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/engine/operators.d.ts +2 -2
- package/out/automate/engine/operators.js +14 -5
- package/out/automate/engine/operators.js.map +1 -1
- package/out/common/BaseNode.d.ts +6 -0
- package/out/common/BaseNode.js +45 -8
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/Abort__.d.ts +1 -1
- package/out/concepts/Abort__.js +3 -3
- package/out/concepts/Abort__.js.map +1 -1
- package/out/concepts/App__.d.ts +0 -2
- package/out/concepts/App__.js +0 -42
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BindAttribute__.js +18 -0
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +21 -22
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.js +16 -16
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/ConfigPropertyValue__.js.map +1 -1
- package/out/concepts/DataSource__.d.ts +0 -1
- package/out/concepts/DataSource__.js +0 -3
- package/out/concepts/DataSource__.js.map +1 -1
- package/out/concepts/EntityProperty__.d.ts +0 -23
- package/out/concepts/EntityProperty__.js +0 -121
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/InterfaceParam__.d.ts +0 -3
- package/out/concepts/InterfaceParam__.js +0 -64
- package/out/concepts/InterfaceParam__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +0 -3
- package/out/concepts/Interface__.js +4 -8
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -1
- package/out/concepts/Logic__.js +22 -42
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/MemberExpression__.js +1 -1
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/Module__.d.ts +0 -12
- package/out/concepts/Module__.js +0 -7
- package/out/concepts/Module__.js.map +1 -1
- package/out/concepts/NewMap__.js +5 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/NumericLiteral__.js +9 -3
- package/out/concepts/NumericLiteral__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.d.ts +0 -1
- package/out/concepts/OqlQueryComponent__.js +0 -46
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/Param__.d.ts +0 -3
- package/out/concepts/Param__.js +1 -67
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/Rect__.js.map +1 -1
- package/out/concepts/Return__.d.ts +0 -3
- package/out/concepts/Return__.js +1 -67
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/SqlQueryComponent__.d.ts +0 -1
- package/out/concepts/SqlQueryComponent__.js +0 -46
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +0 -3
- package/out/concepts/StructureProperty__.js +0 -65
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +1 -3
- package/out/concepts/TypeAnnotation__.js +12 -31
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +0 -3
- package/out/concepts/Variable__.js +1 -67
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewComponent__.d.ts +7 -0
- package/out/concepts/ViewComponent__.js +7 -0
- package/out/concepts/ViewComponent__.js.map +1 -1
- package/out/concepts/ViewElement__.js +1 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.collection.js +2 -2
- package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.core.js +3 -3
- package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js +1 -1
- package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.js +6 -6
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +43 -43
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +19 -46
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +13 -13
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/concepts/basics/types/coreTypeList.js +5 -1
- package/out/concepts/basics/types/coreTypeList.js.map +1 -1
- package/out/concepts/index__.d.ts +0 -1
- package/out/concepts/index__.js +0 -1
- package/out/concepts/index__.js.map +1 -1
- package/out/generator/genReleaseBody.js +0 -3
- package/out/generator/genReleaseBody.js.map +1 -1
- package/out/sentry/index.d.ts +28 -0
- package/out/sentry/index.js +104 -0
- package/out/sentry/index.js.map +1 -0
- package/out/server/entity2LogicNamespace.js +1 -1
- package/out/server/entity2LogicNamespace.js.map +1 -1
- package/out/server/extendBaseNode.js +65 -0
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/formatTsUtils.js +5 -5
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +9 -7
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.d.ts +2 -2
- package/out/server/naslServer.js +120 -51
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +3 -2
- package/out/server/translator.js.map +1 -1
- package/out/service/creator/errHandles.js +5 -0
- package/out/service/creator/errHandles.js.map +1 -1
- package/out/service/storage/init.js +6 -8
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genQueryComponent.js +2 -2
- package/out/templator/genQueryComponent.js.map +1 -1
- package/out/templator/genSelectBlock.js +9 -1
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/utils.d.ts +32 -0
- package/out/templator/utils.js +7 -7
- package/out/templator/utils.js.map +1 -1
- package/package.json +2 -2
- package/sandbox/stdlib/nasl.auth.ts +3 -1
- package/sandbox/stdlib/nasl.browser.ts +1 -1
- package/sandbox/stdlib/nasl.collection.ts +9 -9
- package/sandbox/stdlib/nasl.core.ts +100 -38
- package/sandbox/stdlib/nasl.interface.ts +1 -1
- package/sandbox/stdlib/nasl.langUtil.ts +4 -4
- package/sandbox/stdlib/nasl.oql.ts +156 -156
- package/sandbox/stdlib/nasl.process.ts +6 -6
- package/sandbox/stdlib/nasl.ui.ts +42 -42
- package/sandbox/stdlib/nasl.util.ts +45 -44
- package/sandbox/stdlib/nasl.validation.ts +8 -8
- package/src/automate/engine/operators.js +13 -5
- package/src/automate/upgrader/2.20.js +1 -0
- package/src/common/BaseNode.ts +32 -1
- package/src/concepts/Abort__.ts +4 -3
- package/src/concepts/App__.ts +2 -38
- package/src/concepts/BindAttribute__.ts +17 -1
- package/src/concepts/BindEvent__.ts +21 -21
- package/src/concepts/CallFunction__.ts +0 -1
- package/src/concepts/CallQueryComponent__.ts +16 -74
- package/src/concepts/ConfigPropertyValue__.ts +0 -4
- package/src/concepts/DataSource__.ts +0 -4
- package/src/concepts/EntityProperty__.ts +0 -129
- package/src/concepts/InterfaceParam__.ts +0 -55
- package/src/concepts/Interface__.ts +4 -4
- package/src/concepts/Logic__.ts +31 -47
- package/src/concepts/MatchCase__.ts +1 -1
- package/src/concepts/MemberExpression__.ts +1 -1
- package/src/concepts/Module__.ts +0 -6
- package/src/concepts/NewMap__.ts +5 -1
- package/src/concepts/NumericLiteral__.ts +9 -4
- package/src/concepts/OqlQueryComponent__.ts +0 -40
- package/src/concepts/Param__.ts +3 -59
- package/src/concepts/Rect__.ts +0 -8
- package/src/concepts/Return__.ts +1 -58
- package/src/concepts/SqlQueryComponent__.ts +0 -40
- package/src/concepts/StructureProperty__.ts +0 -57
- package/src/concepts/TypeAnnotation__.ts +12 -72
- package/src/concepts/Variable__.ts +1 -58
- package/src/concepts/ViewComponent__.ts +6 -0
- package/src/concepts/ViewElement__.ts +7 -7
- package/src/concepts/basics/stdlib/nasl.collection.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.core.ts +3 -3
- package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.process.ts +6 -6
- package/src/concepts/basics/stdlib/nasl.ui.ts +43 -43
- package/src/concepts/basics/stdlib/nasl.util.ts +19 -46
- package/src/concepts/basics/stdlib/nasl.validation.ts +13 -13
- package/src/concepts/basics/types/coreTypeList.ts +5 -1
- package/src/concepts/index__.ts +0 -1
- package/src/generator/genReleaseBody.ts +0 -2
- package/src/sentry/index.ts +134 -0
- package/src/server/entity2LogicNamespace.ts +1 -1
- package/src/server/extendBaseNode.ts +61 -1
- package/src/server/formatTsUtils.ts +5 -5
- package/src/server/getLogics.ts +8 -7
- package/src/server/naslServer.ts +120 -53
- package/src/server/translator.ts +3 -2
- package/src/service/creator/errHandles.js +6 -0
- package/src/service/storage/init.ts +6 -8
- package/src/templator/genQueryComponent.ts +5 -5
- package/src/templator/genSelectBlock.ts +9 -1
- package/src/templator/utils.ts +7 -7
- package/ts-worker/lib/Messager.js +0 -3
- package/ts-worker/src/index.js +0 -1
- package/src/concepts/DatabaseTypeAnnotation__.ts +0 -88
package/src/concepts/Logic__.ts
CHANGED
|
@@ -1688,12 +1688,14 @@ export class Logic extends BaseNode {
|
|
|
1688
1688
|
Promise.all(needGetSourceMapOqlList).then(() => {
|
|
1689
1689
|
// 触发一下更新重新生成代码
|
|
1690
1690
|
(this.app as any)?.naslServer?.embeddedTSEmitter.emit('change', {
|
|
1691
|
-
value: [
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1691
|
+
value: [
|
|
1692
|
+
{
|
|
1693
|
+
originEvent: {
|
|
1694
|
+
action: 'update',
|
|
1695
|
+
target: this,
|
|
1696
|
+
},
|
|
1695
1697
|
},
|
|
1696
|
-
|
|
1698
|
+
],
|
|
1697
1699
|
});
|
|
1698
1700
|
});
|
|
1699
1701
|
}
|
|
@@ -1705,11 +1707,13 @@ export class Logic extends BaseNode {
|
|
|
1705
1707
|
code += '{\n';
|
|
1706
1708
|
|
|
1707
1709
|
// 用于虚拟节点的查找引用
|
|
1708
|
-
this.virtualParams
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1710
|
+
this.virtualParams
|
|
1711
|
+
&& Array.isArray(this.virtualParams)
|
|
1712
|
+
&& this.virtualParams.forEach((param) => {
|
|
1713
|
+
code += indent((state?.tabSize || 0) + 1);
|
|
1714
|
+
code += param.toEmbeddedNameTS(shiftState(state, code, { inline: true }));
|
|
1715
|
+
code += '\n';
|
|
1716
|
+
});
|
|
1713
1717
|
|
|
1714
1718
|
this.variables.forEach((variable) => {
|
|
1715
1719
|
if (!advanceMap.get(variable)) {
|
|
@@ -1733,12 +1737,12 @@ export class Logic extends BaseNode {
|
|
|
1733
1737
|
code += node.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1734
1738
|
if (assignment instanceof BatchAssignment) {
|
|
1735
1739
|
assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
|
|
1736
|
-
const leftCode
|
|
1740
|
+
const leftCode
|
|
1741
|
+
= leftIndex.length === 1 ? assignment.left.expression.toEmbeddedTS(shiftState(state, code, { inline: true })) : assignment.left.members[leftIndex[1]]?.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
1737
1742
|
if (leftCode === node.name) {
|
|
1738
1743
|
const rightNode: any = rightIndex.length === 1 ? assignment.rights[rightIndex[0]]?.expression : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
|
|
1739
1744
|
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1740
|
-
if (rightNode?.typeAnnotation
|
|
1741
|
-
&& !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1745
|
+
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1742
1746
|
code += ': ';
|
|
1743
1747
|
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1744
1748
|
} else {
|
|
@@ -1759,8 +1763,7 @@ export class Logic extends BaseNode {
|
|
|
1759
1763
|
} else {
|
|
1760
1764
|
const rightNode: any = assignment.right;
|
|
1761
1765
|
// 当右边有明确类型时,直接使用其类型。旧版本数据查询不能直接使用其 typeAnnotation
|
|
1762
|
-
if (rightNode?.typeAnnotation
|
|
1763
|
-
&& !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1766
|
+
if (rightNode?.typeAnnotation && !(rightNode instanceof CallQueryComponent && rightNode.ideVersion !== '2.11')) {
|
|
1764
1767
|
code += ': ';
|
|
1765
1768
|
code += rightNode.typeAnnotation?.toEmbeddedTS(shiftState(state, code, { inline: true })) || 'null';
|
|
1766
1769
|
} else {
|
|
@@ -1770,7 +1773,7 @@ export class Logic extends BaseNode {
|
|
|
1770
1773
|
if (rightNode && rightNode instanceof Identifier && rightNode.namespace && rightNode.namespace.endsWith('enums')) {
|
|
1771
1774
|
rightCode += 'new ';
|
|
1772
1775
|
}
|
|
1773
|
-
rightCode +=
|
|
1776
|
+
rightCode += rightNode && rightNode.toEmbeddedTS ? rightNode.toEmbeddedTS(shiftState(state, code, { inline: true })) : '__RIGHT__';
|
|
1774
1777
|
code += this.getRightCode(rightCode, assignment, rightNode);
|
|
1775
1778
|
}
|
|
1776
1779
|
}
|
|
@@ -1871,7 +1874,7 @@ export class Logic extends BaseNode {
|
|
|
1871
1874
|
code = this.handleReplaceCode(code, item.name, eachTSCode === '__IDENTIFIER__' ? eachTSCode : `${eachTSCode}.__get(0)`);
|
|
1872
1875
|
}
|
|
1873
1876
|
if (code.includes(index.name))
|
|
1874
|
-
code = this.handleReplaceCode(code, index.name, 'new nasl.core.
|
|
1877
|
+
code = this.handleReplaceCode(code, index.name, 'new nasl.core.Integer(0)');
|
|
1875
1878
|
|
|
1876
1879
|
const parentForEachStatement = forEachStatement.getAncestor('ForEachStatement') as ForEachStatement;
|
|
1877
1880
|
if (parentForEachStatement) {
|
|
@@ -1915,7 +1918,10 @@ export class Logic extends BaseNode {
|
|
|
1915
1918
|
arr.push(parentName);
|
|
1916
1919
|
}
|
|
1917
1920
|
let namespace = arr.join('.');
|
|
1918
|
-
if (
|
|
1921
|
+
if (
|
|
1922
|
+
!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1923
|
+
&& !namespace.includes('.logics')
|
|
1924
|
+
) {
|
|
1919
1925
|
namespace = `${namespace}.logics`;
|
|
1920
1926
|
}
|
|
1921
1927
|
return namespace;
|
|
@@ -1932,7 +1938,10 @@ export class Logic extends BaseNode {
|
|
|
1932
1938
|
arr.push(parentName);
|
|
1933
1939
|
}
|
|
1934
1940
|
let namespace = arr.join('.');
|
|
1935
|
-
if (
|
|
1941
|
+
if (
|
|
1942
|
+
!['nasl.ui', 'nasl.utils', 'nasl.util', 'nasl.browser', 'nasl.auth', 'nasl.configuration', 'nasl.process', 'nasl.logging', 'nasl.io'].includes(namespace)
|
|
1943
|
+
&& !namespace.includes('.logics')
|
|
1944
|
+
) {
|
|
1936
1945
|
namespace = `${namespace}.logics`;
|
|
1937
1946
|
}
|
|
1938
1947
|
return namespace;
|
|
@@ -2075,34 +2084,9 @@ export class Logic extends BaseNode {
|
|
|
2075
2084
|
// 虚拟输入参数列表
|
|
2076
2085
|
virtualParams: Array<Param> = [];
|
|
2077
2086
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
name: 'param5',
|
|
2082
|
-
typeAnnotation: TypeAnnotation.from({
|
|
2083
|
-
typeKind: 'function',
|
|
2084
|
-
typeName: 'String',
|
|
2085
|
-
typeNamespace: 'nasl.core',
|
|
2086
|
-
returnType: [TypeAnnotation.from({
|
|
2087
|
-
typeKind: 'primitive',
|
|
2088
|
-
typeName: 'Boolean',
|
|
2089
|
-
typeNamespace: 'nasl.core',
|
|
2090
|
-
})],
|
|
2091
|
-
typeArguments: [
|
|
2092
|
-
TypeAnnotation.from({
|
|
2093
|
-
typeKind: 'primitive',
|
|
2094
|
-
typeName: 'String',
|
|
2095
|
-
typeNamespace: 'nasl.core',
|
|
2096
|
-
}),
|
|
2097
|
-
TypeAnnotation.from({
|
|
2098
|
-
typeKind: 'primitive',
|
|
2099
|
-
typeName: 'Boolean',
|
|
2100
|
-
typeNamespace: 'nasl.core',
|
|
2101
|
-
}),
|
|
2102
|
-
],
|
|
2103
|
-
}),
|
|
2104
|
-
|
|
2105
|
-
});
|
|
2087
|
+
get getLogicBelongTo() {
|
|
2088
|
+
const [, belongTo] = this.calleewholeKey.split('.');
|
|
2089
|
+
return belongTo;
|
|
2106
2090
|
}
|
|
2107
2091
|
|
|
2108
2092
|
// 校验logic的返回值是不是有error类型
|
|
@@ -716,7 +716,7 @@ export class MatchCase extends LogicItem {
|
|
|
716
716
|
}
|
|
717
717
|
if (Array.isArray(this.body)) {
|
|
718
718
|
this.body.forEach((logicItem, bodyIndex) => {
|
|
719
|
-
if (this.parentNode.isExpression && bodyIndex === this.body.length - 1) {
|
|
719
|
+
if (this.parentNode.isExpression && bodyIndex === this.body.length - 1 && logicItem.concept !== 'Abort') {
|
|
720
720
|
code += `return `;
|
|
721
721
|
}
|
|
722
722
|
code += logicItem.toJS() + '\n';
|
package/src/concepts/Module__.ts
CHANGED
|
@@ -81,12 +81,6 @@ export class Module extends BaseNode {
|
|
|
81
81
|
@property()
|
|
82
82
|
externalDependencyMap: { maven?: Array<{ groupId: string, artifactId: string, version: string }> } = undefined;
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* 外部语言依赖
|
|
86
|
-
*/
|
|
87
|
-
@property()
|
|
88
|
-
compilerInfoMap: { java?: Array<{ packageName: string,className:string,naslName: string, type: string,javaTypes:any }> } = undefined;
|
|
89
|
-
|
|
90
84
|
/**
|
|
91
85
|
* 数据源列表
|
|
92
86
|
*/
|
package/src/concepts/NewMap__.ts
CHANGED
|
@@ -633,8 +633,12 @@ export class NewMap extends LogicItem {
|
|
|
633
633
|
code += key.toEmbeddedTS(shiftState(state, code, { inline: true }));
|
|
634
634
|
code += ');\n';
|
|
635
635
|
});
|
|
636
|
+
if (keyIndex !== -1) {
|
|
637
|
+
code += `nasl.util.ValidMapKey(`;
|
|
638
|
+
code += `${this.keys[keyIndex].toEmbeddedTS(shiftState(state, code, { inline: true }))});\n`;
|
|
639
|
+
}
|
|
636
640
|
code += `return nasl.util.NewMap(`;
|
|
637
|
-
code += `${keyIndex === -1 ? 'null' :
|
|
641
|
+
code += `${keyIndex === -1 ? 'null' : keyTs}, ...[`;
|
|
638
642
|
valueTsArr.forEach((ts: any, index: number) => {
|
|
639
643
|
code += ['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts) ? null : ts;
|
|
640
644
|
if (index + 1 < this.values.length)
|
|
@@ -131,7 +131,7 @@ export class NumericLiteral extends LogicItem {
|
|
|
131
131
|
return code;
|
|
132
132
|
}
|
|
133
133
|
toBrief(): string {
|
|
134
|
-
return `${this.value}
|
|
134
|
+
return `${this.value}`
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
@withSourceMap()
|
|
@@ -143,9 +143,14 @@ export class NumericLiteral extends LogicItem {
|
|
|
143
143
|
|
|
144
144
|
changeType(value: string | number) {
|
|
145
145
|
const newValue = value.toString();
|
|
146
|
-
let typeName = '
|
|
146
|
+
let typeName = 'Integer';
|
|
147
|
+
if (newValue.length > 8) {
|
|
148
|
+
typeName = 'Long';
|
|
149
|
+
} else {
|
|
150
|
+
typeName = 'Integer';
|
|
151
|
+
}
|
|
147
152
|
if (newValue.includes('.')) {
|
|
148
|
-
typeName = '
|
|
153
|
+
typeName = 'Double';
|
|
149
154
|
}
|
|
150
155
|
return typeName;
|
|
151
156
|
}
|
|
@@ -178,7 +183,7 @@ export class NumericLiteral extends LogicItem {
|
|
|
178
183
|
value: '0',
|
|
179
184
|
typeAnnotation: new TypeAnnotation({
|
|
180
185
|
typeNamespace: 'nasl.core',
|
|
181
|
-
typeName: '
|
|
186
|
+
typeName: 'Integer',
|
|
182
187
|
typeKind: 'primitive',
|
|
183
188
|
}),
|
|
184
189
|
};
|
|
@@ -232,46 +232,6 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
232
232
|
return sqlTypeBan;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
getSelectRef(newTypeAnnotation: TypeAnnotation) {
|
|
236
|
-
try {
|
|
237
|
-
const { typeName, typeKind, typeNamespace } = newTypeAnnotation || this.typeAnnotation;
|
|
238
|
-
let completionChildren;
|
|
239
|
-
if (typeKind === 'reference') {
|
|
240
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process') {
|
|
241
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
242
|
-
const properties = (node as Structure)?.properties || [];
|
|
243
|
-
completionChildren = properties;
|
|
244
|
-
} else if (typeNamespace.endsWith('.enums')) {
|
|
245
|
-
completionChildren = [];
|
|
246
|
-
} else {
|
|
247
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
248
|
-
const properties = node?.properties || [];
|
|
249
|
-
completionChildren = properties;
|
|
250
|
-
}
|
|
251
|
-
} else if (typeKind === 'generic') {
|
|
252
|
-
// if (typeNamespace === 'nasl.collection' || typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.interface') {
|
|
253
|
-
// }
|
|
254
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
255
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
256
|
-
for (let i = 0; i < properties.length; i++) {
|
|
257
|
-
const item = properties[i];
|
|
258
|
-
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
259
|
-
const newItem = StructureProperty.from(item.toJSON());
|
|
260
|
-
newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
|
|
261
|
-
newItem.parentNode = this;
|
|
262
|
-
properties[i] = newItem;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
completionChildren = properties;
|
|
266
|
-
} else {
|
|
267
|
-
completionChildren = [];
|
|
268
|
-
}
|
|
269
|
-
return completionChildren;
|
|
270
|
-
} catch (err) {
|
|
271
|
-
console.log(err);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
235
|
@withSourceMap()
|
|
276
236
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
277
237
|
let code: string;
|
package/src/concepts/Param__.ts
CHANGED
|
@@ -4,7 +4,6 @@ import LogicItem from './LogicItem__';
|
|
|
4
4
|
import EntityProperty from './EntityProperty__';
|
|
5
5
|
import Structure from './Structure__';
|
|
6
6
|
import StructureProperty from './StructureProperty__';
|
|
7
|
-
import { getNodeByNodeCallee, getNaslNodeByNodeCallee } from '../automate/engine/utils';
|
|
8
7
|
import Function from './Function__';
|
|
9
8
|
import AnonymousFunction from './AnonymousFunction__';
|
|
10
9
|
|
|
@@ -396,7 +395,7 @@ export class Param extends BaseNode {
|
|
|
396
395
|
object.defaultValue = '';
|
|
397
396
|
}
|
|
398
397
|
try {
|
|
399
|
-
this.completionChildren = this.getSelectRef(typeAnnotation);
|
|
398
|
+
this.completionChildren = this.getSelectRef(typeAnnotation, true);
|
|
400
399
|
} catch (err) {
|
|
401
400
|
this.completionChildren = [];
|
|
402
401
|
console.log(err);
|
|
@@ -431,63 +430,8 @@ export class Param extends BaseNode {
|
|
|
431
430
|
set readonly(val) {
|
|
432
431
|
this._readonly = val;
|
|
433
432
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
437
|
-
if (typeNamespace.endsWith('.enums'))
|
|
438
|
-
return null;
|
|
439
|
-
return [{}];
|
|
440
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
441
|
-
return [{}];
|
|
442
|
-
}
|
|
443
|
-
return null;
|
|
444
|
-
}
|
|
445
|
-
get isTreeLeaf() {
|
|
446
|
-
return !this.hasChildren;
|
|
447
|
-
}
|
|
448
|
-
getSelectRef(newTypeAnnotation: TypeAnnotation) {
|
|
449
|
-
try {
|
|
450
|
-
const { typeName, typeKind, typeNamespace, sortedTypeKey } = newTypeAnnotation || this.typeAnnotation;
|
|
451
|
-
let completionChildren;
|
|
452
|
-
if (typeKind === 'reference') {
|
|
453
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
454
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
455
|
-
const properties = (node as Structure)?.properties || [];
|
|
456
|
-
completionChildren = properties;
|
|
457
|
-
} else if (typeNamespace.endsWith('.enums')) {
|
|
458
|
-
completionChildren = [];
|
|
459
|
-
} else {
|
|
460
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
461
|
-
const properties = node?.properties || [];
|
|
462
|
-
completionChildren = properties;
|
|
463
|
-
}
|
|
464
|
-
} else if (typeKind === 'generic') {
|
|
465
|
-
// if (typeNamespace === 'nasl.collection' || typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.interface') {
|
|
466
|
-
// }
|
|
467
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
468
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
469
|
-
for (let i = 0; i < properties.length; i++) {
|
|
470
|
-
const item = properties[i];
|
|
471
|
-
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
472
|
-
const newItem = StructureProperty.from(item.toJSON());
|
|
473
|
-
newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
|
|
474
|
-
newItem.parentNode = this;
|
|
475
|
-
properties[i] = newItem;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
completionChildren = properties;
|
|
479
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
480
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
481
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
482
|
-
completionChildren = properties;
|
|
483
|
-
} else {
|
|
484
|
-
completionChildren = [];
|
|
485
|
-
}
|
|
486
|
-
return completionChildren;
|
|
487
|
-
} catch (err) {
|
|
488
|
-
console.log(err);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
433
|
+
|
|
434
|
+
|
|
491
435
|
|
|
492
436
|
setnNewTypeAnnotation(oldTypeAnnotation: TypeAnnotation) {
|
|
493
437
|
const json = oldTypeAnnotation.toJSON();
|
package/src/concepts/Rect__.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
10
10
|
import BaseNode from '../common/BaseNode';
|
|
11
11
|
import classMap from '../common/classMap';
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* 矩形信息
|
|
16
15
|
*/
|
|
@@ -46,8 +45,6 @@ export class Rect extends BaseNode {
|
|
|
46
45
|
@property()
|
|
47
46
|
height: number = undefined;
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
48
|
/**
|
|
52
49
|
* @param source 需要合并的部分参数
|
|
53
50
|
*/
|
|
@@ -75,11 +72,6 @@ export class Rect extends BaseNode {
|
|
|
75
72
|
}
|
|
76
73
|
return params;
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
75
|
|
|
84
76
|
//================================================================================
|
|
85
77
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
package/src/concepts/Return__.ts
CHANGED
|
@@ -343,7 +343,7 @@ export class Return extends BaseNode {
|
|
|
343
343
|
}
|
|
344
344
|
// 处理下拉属性
|
|
345
345
|
try {
|
|
346
|
-
this.completionChildren = this.getSelectRef(typeAnnotation);
|
|
346
|
+
this.completionChildren = this.getSelectRef(typeAnnotation, true);
|
|
347
347
|
} catch (err) {
|
|
348
348
|
this.completionChildren = [];
|
|
349
349
|
console.log(err);
|
|
@@ -374,63 +374,6 @@ export class Return extends BaseNode {
|
|
|
374
374
|
get readonly() {
|
|
375
375
|
return !!this.module;
|
|
376
376
|
}
|
|
377
|
-
get hasChildren() {
|
|
378
|
-
if (!this.typeAnnotation)
|
|
379
|
-
return null;
|
|
380
|
-
const { typeKind, typeNamespace, typeName } = this.typeAnnotation;
|
|
381
|
-
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
382
|
-
if (typeNamespace.endsWith('.enums'))
|
|
383
|
-
return null;
|
|
384
|
-
return [{}];
|
|
385
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
386
|
-
return [{}];
|
|
387
|
-
}
|
|
388
|
-
return null;
|
|
389
|
-
}
|
|
390
|
-
get isTreeLeaf() {
|
|
391
|
-
return !this.hasChildren;
|
|
392
|
-
}
|
|
393
|
-
getSelectRef(newTypeAnnotation: TypeAnnotation) {
|
|
394
|
-
try {
|
|
395
|
-
const { typeName, typeKind, typeNamespace, sortedTypeKey } = newTypeAnnotation || this.typeAnnotation;
|
|
396
|
-
let completionChildren;
|
|
397
|
-
if (typeKind === 'reference') {
|
|
398
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
399
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
400
|
-
const properties = (node as Structure)?.properties || [];
|
|
401
|
-
completionChildren = properties;
|
|
402
|
-
} else if (typeNamespace.endsWith('.enums')) {
|
|
403
|
-
completionChildren = [];
|
|
404
|
-
} else {
|
|
405
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
406
|
-
const properties = node?.properties || [];
|
|
407
|
-
completionChildren = properties;
|
|
408
|
-
}
|
|
409
|
-
} else if (typeKind === 'generic') {
|
|
410
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
411
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
412
|
-
for (let i = 0; i < properties.length; i++) {
|
|
413
|
-
const item = properties[i];
|
|
414
|
-
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
415
|
-
const newItem = StructureProperty.from(item.toJSON());
|
|
416
|
-
newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
|
|
417
|
-
newItem.parentNode = this;
|
|
418
|
-
properties[i] = newItem;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
completionChildren = properties;
|
|
422
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
423
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
424
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
425
|
-
completionChildren = properties;
|
|
426
|
-
} else {
|
|
427
|
-
completionChildren = [];
|
|
428
|
-
}
|
|
429
|
-
return completionChildren;
|
|
430
|
-
} catch (err) {
|
|
431
|
-
console.log(err);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
377
|
//================================================================================
|
|
435
378
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
436
379
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -232,46 +232,6 @@ export class SqlQueryComponent extends LogicItem {
|
|
|
232
232
|
return sqlTypeBan;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
getSelectRef(newTypeAnnotation: TypeAnnotation) {
|
|
236
|
-
try {
|
|
237
|
-
const { typeName, typeKind, typeNamespace } = newTypeAnnotation || this.typeAnnotation;
|
|
238
|
-
let completionChildren;
|
|
239
|
-
if (typeKind === 'reference') {
|
|
240
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process') {
|
|
241
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
242
|
-
const properties = (node as Structure)?.properties || [];
|
|
243
|
-
completionChildren = properties;
|
|
244
|
-
} else if (typeNamespace.endsWith('.enums')) {
|
|
245
|
-
completionChildren = [];
|
|
246
|
-
} else {
|
|
247
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
248
|
-
const properties = node?.properties || [];
|
|
249
|
-
completionChildren = properties;
|
|
250
|
-
}
|
|
251
|
-
} else if (typeKind === 'generic') {
|
|
252
|
-
// if (typeNamespace === 'nasl.collection' || typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.interface') {
|
|
253
|
-
// }
|
|
254
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
255
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
256
|
-
for (let i = 0; i < properties.length; i++) {
|
|
257
|
-
const item = properties[i];
|
|
258
|
-
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
259
|
-
const newItem = StructureProperty.from(item.toJSON());
|
|
260
|
-
newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
|
|
261
|
-
newItem.parentNode = this;
|
|
262
|
-
properties[i] = newItem;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
completionChildren = properties;
|
|
266
|
-
} else {
|
|
267
|
-
completionChildren = [];
|
|
268
|
-
}
|
|
269
|
-
return completionChildren;
|
|
270
|
-
} catch (err) {
|
|
271
|
-
console.log(err);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
235
|
@withSourceMap()
|
|
276
236
|
toEmbeddedTS(state?: TranslatorState): string {
|
|
277
237
|
let code: string;
|
|
@@ -246,69 +246,12 @@ export class StructureProperty extends BaseNode {
|
|
|
246
246
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
247
247
|
//================================================================================
|
|
248
248
|
|
|
249
|
-
get hasChildren() {
|
|
250
|
-
const { typeKind, typeName, typeNamespace } = this.typeAnnotation;
|
|
251
|
-
if (typeKind === 'reference' || typeKind === 'generic') {
|
|
252
|
-
if (typeNamespace.endsWith('.enums'))
|
|
253
|
-
return null;
|
|
254
|
-
return [{}];
|
|
255
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
256
|
-
return [{}];
|
|
257
|
-
}
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
get isTreeLeaf() {
|
|
261
|
-
return !this.hasChildren;
|
|
262
|
-
}
|
|
263
249
|
/**
|
|
264
250
|
* 是否展开
|
|
265
251
|
*/
|
|
266
252
|
@property()
|
|
267
253
|
isLeaf: boolean = true;
|
|
268
254
|
|
|
269
|
-
getSelectRef() {
|
|
270
|
-
try {
|
|
271
|
-
const { typeName, typeKind, typeNamespace } = this.typeAnnotation;
|
|
272
|
-
let completionChildren;
|
|
273
|
-
if (typeKind === 'reference') {
|
|
274
|
-
if (typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.process' || typeNamespace === 'nasl.auth') {
|
|
275
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
276
|
-
const properties = (node as Structure)?.properties || [];
|
|
277
|
-
completionChildren = properties;
|
|
278
|
-
} else if (typeNamespace.endsWith('.enums')) {
|
|
279
|
-
completionChildren = [];
|
|
280
|
-
} else {
|
|
281
|
-
const node = getNodeByNodeCallee(this.app, typeNamespace + '.' + typeName);
|
|
282
|
-
const properties = node?.properties || [];
|
|
283
|
-
completionChildren = properties;
|
|
284
|
-
}
|
|
285
|
-
} else if (typeKind === 'generic') {
|
|
286
|
-
// if (typeNamespace === 'nasl.collection' || typeNamespace === 'nasl.ui' || typeNamespace === 'nasl.interface') {
|
|
287
|
-
// }
|
|
288
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
289
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
290
|
-
for (let i = 0; i < properties.length; i++) {
|
|
291
|
-
const item = properties[i];
|
|
292
|
-
if (item?.typeAnnotation?.typeKind === 'typeParam') {
|
|
293
|
-
const newItem = StructureProperty.from(item.toJSON());
|
|
294
|
-
newItem.typeAnnotation = this?.typeAnnotation?.typeArguments[0];
|
|
295
|
-
newItem.parentNode = this;
|
|
296
|
-
properties[i] = newItem;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
completionChildren = properties;
|
|
300
|
-
} else if (typeNamespace === 'nasl.core' && ['String', 'Text', 'Email'].includes(typeName)) {
|
|
301
|
-
const node = getNaslNodeByNodeCallee(typeNamespace, typeName);
|
|
302
|
-
const properties = ((node as Structure)?.properties && [...(node as Structure)?.properties]) || [];
|
|
303
|
-
completionChildren = properties;
|
|
304
|
-
} else {
|
|
305
|
-
completionChildren = [];
|
|
306
|
-
}
|
|
307
|
-
return completionChildren;
|
|
308
|
-
} catch (err) {
|
|
309
|
-
console.log(err);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
255
|
|
|
313
256
|
@withSourceMap()
|
|
314
257
|
toEmbeddedTS(state?: TranslatorState): string {
|