@lcap/nasl 3.8.0-beta.3 → 3.8.0-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/out/automate/engine/utils.js +1 -2
- package/out/automate/engine/utils.js.map +1 -1
- package/out/bak/translator.js +1 -1
- package/out/bak/translator.js.map +1 -1
- package/out/common/BaseNode.js +7 -2
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.js +6 -1
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Argument__.js +11 -5
- package/out/concepts/Argument__.js.map +1 -1
- package/out/concepts/AuthLogicForCallInterface__.js +3 -0
- package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +49 -2
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +4 -3
- package/out/concepts/BindAttribute__.js +121 -42
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +5 -42
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BusinessComponent__.d.ts +1 -0
- package/out/concepts/BusinessComponent__.js +16 -0
- package/out/concepts/BusinessComponent__.js.map +1 -1
- package/out/concepts/BusinessLogic__.js +3 -0
- package/out/concepts/BusinessLogic__.js.map +1 -1
- package/out/concepts/CallConnector__.js +1 -1
- package/out/concepts/CallConnector__.js.map +1 -1
- package/out/concepts/CallFunction__.js +1 -1
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts +6 -1
- package/out/concepts/CallLogic__.js +58 -17
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/Connection__.d.ts +4 -0
- package/out/concepts/Connection__.js +15 -0
- package/out/concepts/Connection__.js.map +1 -1
- package/out/concepts/DatabaseTypeAnnotation__.d.ts +2 -0
- package/out/concepts/DatabaseTypeAnnotation__.js +20 -0
- package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
- package/out/concepts/End__.js +5 -1
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/EntityProperty__.js +2 -0
- package/out/concepts/EntityProperty__.js.map +1 -1
- package/out/concepts/Entity__.d.ts +1 -0
- package/out/concepts/Entity__.js +24 -1
- package/out/concepts/Entity__.js.map +1 -1
- package/out/concepts/EnumItem__.d.ts +12 -0
- package/out/concepts/EnumItem__.js +49 -5
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Enum__.js +4 -1
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/ForEachStatement__.js +1 -1
- package/out/concepts/ForEachStatement__.js.map +1 -1
- package/out/concepts/FrontendLibrary__.d.ts +46 -46
- package/out/concepts/FrontendLibrary__.js +34 -36
- package/out/concepts/FrontendLibrary__.js.map +1 -1
- package/out/concepts/I18nInfo__.d.ts +1 -0
- package/out/concepts/I18nInfo__.js +7 -0
- package/out/concepts/I18nInfo__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.js +4 -1
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +2 -3
- package/out/concepts/Logic__.js +33 -8
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +2 -2
- package/out/concepts/MatchCase__.js +7 -7
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/NewComposite__.js +2 -1
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/NewList__.js +2 -1
- package/out/concepts/NewList__.js.map +1 -1
- package/out/concepts/NewMap__.js +2 -1
- package/out/concepts/NewMap__.js.map +1 -1
- package/out/concepts/OqlQueryComponent__.js +3 -11
- package/out/concepts/OqlQueryComponent__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.js +7 -0
- package/out/concepts/OverriddenLogic__.js.map +1 -1
- package/out/concepts/Param__.js +2 -1
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessElementV2__.d.ts +4 -5
- package/out/concepts/ProcessElementV2__.js +12 -17
- package/out/concepts/ProcessElementV2__.js.map +1 -1
- package/out/concepts/ProcessElement__.d.ts +3 -4
- package/out/concepts/ProcessElement__.js +44 -46
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/ProcessV2__.d.ts +5 -0
- package/out/concepts/ProcessV2__.js +30 -2
- package/out/concepts/ProcessV2__.js.map +1 -1
- package/out/concepts/Process__.d.ts +5 -0
- package/out/concepts/Process__.js +28 -0
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/QueryFromExpression__.js +2 -2
- package/out/concepts/QueryFromExpression__.js.map +1 -1
- package/out/concepts/QueryJoinExpression__.js +2 -2
- package/out/concepts/QueryJoinExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -1
- package/out/concepts/Return__.js +2 -1
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StaticString__.d.ts +4 -0
- package/out/concepts/StaticString__.js +11 -0
- package/out/concepts/StaticString__.js.map +1 -1
- package/out/concepts/StructureProperty__.js +5 -2
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.js +9 -3
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SubLogic__.d.ts +1 -3
- package/out/concepts/SubLogic__.js +14 -8
- package/out/concepts/SubLogic__.js.map +1 -1
- package/out/concepts/Transactional__.d.ts +1 -0
- package/out/concepts/Transactional__.js +7 -0
- package/out/concepts/Transactional__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +4 -0
- package/out/concepts/TypeParam__.js +3 -0
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/ValidationRule__.d.ts +1 -6
- package/out/concepts/ValidationRule__.js +9 -6
- package/out/concepts/ValidationRule__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -1
- package/out/concepts/Variable__.js +7 -2
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +2 -0
- package/out/concepts/ViewElement__.js +130 -47
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +8 -0
- package/out/concepts/View__.js +123 -7
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.processV2.js +2 -2
- package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +110 -4
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +2 -0
- package/out/generator/genBundleFiles.js +51 -37
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/generator/genMetaData.js +20 -26
- package/out/generator/genMetaData.js.map +1 -1
- package/out/generator/release-body/body.js +8 -6
- package/out/generator/release-body/body.js.map +1 -1
- package/out/generator/release-body/index.d.ts +1 -0
- package/out/generator/release-body/index.js +1 -0
- package/out/generator/release-body/index.js.map +1 -1
- package/out/generator/release-body/utils.js +1 -1
- package/out/generator/release-body/utils.js.map +1 -1
- package/out/natural/genNaturalTS.d.ts +56 -24
- package/out/natural/genNaturalTS.js +182 -112
- package/out/natural/genNaturalTS.js.map +1 -1
- package/out/natural/getContext/getUILib.js +4 -2
- package/out/natural/getContext/getUILib.js.map +1 -1
- package/out/natural/getContext/index.d.ts +34 -25
- package/out/natural/getContext/index.js +304 -157
- package/out/natural/getContext/index.js.map +1 -1
- package/out/natural/index.d.ts +1 -0
- package/out/natural/index.js +1 -0
- package/out/natural/index.js.map +1 -1
- package/out/natural/tools.d.ts +11 -0
- package/out/natural/tools.js +155 -0
- package/out/natural/tools.js.map +1 -0
- package/out/natural/transformTS2UI.js +84 -22
- package/out/natural/transformTS2UI.js.map +1 -1
- package/out/natural/transformTSCode.js +83 -22
- package/out/natural/transformTSCode.js.map +1 -1
- package/out/server/formatTsUtils.js +17 -1
- package/out/server/formatTsUtils.js.map +1 -1
- package/out/server/getLogics.js +1 -4
- package/out/server/getLogics.js.map +1 -1
- package/out/server/naslServer.js +285 -32
- package/out/server/naslServer.js.map +1 -1
- package/out/server/translator.js +5 -1
- package/out/server/translator.js.map +1 -1
- package/out/templator/genCreateBlock.js +5 -18
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +11 -32
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +1 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genListViewBlock.js +6 -4
- package/out/templator/genListViewBlock.js.map +1 -1
- package/out/templator/genSelectBlock.js +82 -59
- package/out/templator/genSelectBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +4 -4
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +2 -15
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/utils.d.ts +1 -1
- package/out/templator/utils.js +1 -1
- package/out/templator/utils.js.map +1 -1
- package/out/translator/types.d.ts +4 -0
- package/out/translator/utils.d.ts +1 -0
- package/out/translator/utils.js +6 -1
- package/out/translator/utils.js.map +1 -1
- package/out/utils/env.d.ts +4 -0
- package/out/utils/env.js +6 -3
- package/out/utils/env.js.map +1 -1
- package/out/utils/index.d.ts +19 -0
- package/out/utils/index.js +61 -1
- package/out/utils/index.js.map +1 -1
- package/out/utils/language-cache/constant.d.ts +18 -0
- package/out/utils/language-cache/constant.js +35 -0
- package/out/utils/language-cache/constant.js.map +1 -0
- package/out/utils/language-cache/index.d.ts +2 -0
- package/out/utils/language-cache/index.js +19 -0
- package/out/utils/language-cache/index.js.map +1 -0
- package/out/utils/language-cache/nasl.d.ts +10 -0
- package/out/utils/language-cache/nasl.js +98 -0
- package/out/utils/language-cache/nasl.js.map +1 -0
- package/out/utils/language-cache/types.d.ts +44 -0
- package/out/utils/language-cache/types.js +4 -0
- package/out/utils/language-cache/types.js.map +1 -0
- package/out/utils/time-slicing/controller.js.map +1 -1
- package/out/utils/types.d.ts +17 -0
- package/package.json +3 -2
- package/sandbox/stdlib/nasl.core.ts +15 -11
- package/sandbox/stdlib/nasl.oql.ts +5 -1
- package/sandbox/stdlib/nasl.processV2.ts +5 -4
- package/sandbox/stdlib/nasl.ui.components.pc.ts +225 -225
- package/sandbox/stdlib/nasl.ui.ts +10 -0
- package/sandbox/stdlib/nasl.util.ts +11 -0
- package/sandbox/stdlib/nasl.validation.ts +3 -2
- package/sandbox-natural/stdlib/nasl.ui.pre.d.ts +1 -1
- package/sandbox-natural/stdlib/nasl.ui.ts +2 -2
- package/sandbox-natural/stdlib/nasl.util.ts +2 -2
- package/src/automate/engine/utils.js +1 -2
- package/src/bak/translator.js +1 -1
- package/src/common/BaseNode.ts +7 -3
- package/src/concepts/App__.ts +9 -1
- package/src/concepts/Argument__.ts +10 -5
- package/src/concepts/AuthLogicForCallInterface__.ts +3 -0
- package/src/concepts/BinaryExpression__.ts +46 -2
- package/src/concepts/BindAttribute__.ts +144 -46
- package/src/concepts/BindEvent__.ts +8 -47
- package/src/concepts/BusinessComponent__.ts +17 -0
- package/src/concepts/BusinessLogic__.ts +3 -0
- package/src/concepts/CallConnector__.ts +1 -1
- package/src/concepts/CallFunction__.ts +1 -1
- package/src/concepts/CallLogic__.ts +63 -17
- package/src/concepts/Connection__.ts +16 -0
- package/src/concepts/DatabaseTypeAnnotation__.ts +11 -0
- package/src/concepts/End__.ts +5 -1
- package/src/concepts/EntityProperty__.ts +5 -0
- package/src/concepts/Entity__.ts +29 -1
- package/src/concepts/EnumItem__.ts +64 -1
- package/src/concepts/Enum__.ts +6 -1
- package/src/concepts/ForEachStatement__.ts +1 -1
- package/src/concepts/FrontendLibrary__.ts +78 -80
- package/src/concepts/I18nInfo__.ts +5 -0
- package/src/concepts/IfStatement__.ts +2 -2
- package/src/concepts/Interface__.ts +6 -1
- package/src/concepts/Logic__.ts +39 -10
- package/src/concepts/MatchCase__.ts +8 -9
- package/src/concepts/NewComposite__.ts +2 -1
- package/src/concepts/NewList__.ts +2 -1
- package/src/concepts/NewMap__.ts +2 -1
- package/src/concepts/OqlQueryComponent__.ts +3 -11
- package/src/concepts/OverriddenLogic__.ts +7 -0
- package/src/concepts/Param__.ts +1 -0
- package/src/concepts/ProcessElementV2__.ts +14 -16
- package/src/concepts/ProcessElement__.ts +16 -16
- package/src/concepts/ProcessV2__.ts +39 -3
- package/src/concepts/Process__.ts +36 -0
- package/src/concepts/QueryFromExpression__.ts +2 -2
- package/src/concepts/QueryJoinExpression__.ts +2 -2
- package/src/concepts/Return__.ts +2 -1
- package/src/concepts/StaticString__.ts +12 -0
- package/src/concepts/StructureProperty__.ts +7 -2
- package/src/concepts/Structure__.ts +11 -3
- package/src/concepts/SubLogic__.ts +15 -9
- package/src/concepts/Transactional__.ts +5 -0
- package/src/concepts/TypeParam__.ts +6 -0
- package/src/concepts/ValidationRule__.ts +7 -6
- package/src/concepts/Variable__.ts +7 -2
- package/src/concepts/ViewElement__.ts +130 -47
- package/src/concepts/View__.ts +157 -8
- package/src/concepts/basics/stdlib/nasl.processV2.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.ui.ts +1 -1
- package/src/concepts/basics/stdlib/nasl.validation.ts +111 -4
- package/src/generator/genBundleFiles.ts +53 -39
- package/src/generator/genMetaData.ts +21 -26
- package/src/generator/release-body/body.ts +9 -6
- package/src/generator/release-body/index.ts +1 -0
- package/src/generator/release-body/utils.ts +4 -2
- package/src/natural/genNaturalTS.ts +327 -141
- package/src/natural/getContext/getUILib.ts +4 -2
- package/src/natural/getContext/index.ts +348 -171
- package/src/natural/index.ts +1 -0
- package/src/natural/tools.ts +130 -0
- package/src/natural/transformTS2UI.ts +84 -22
- package/src/natural/transformTSCode.ts +83 -22
- package/src/server/formatTsUtils.ts +21 -1
- package/src/server/getLogics.ts +1 -4
- package/src/server/naslServer.ts +302 -33
- package/src/server/translator.ts +5 -1
- package/src/templator/genCreateBlock.ts +5 -18
- package/src/templator/genCurdMultipleKeyBlock.ts +14 -32
- package/src/templator/genGetBlock.ts +2 -4
- package/src/templator/genListViewBlock.ts +6 -4
- package/src/templator/genSelectBlock.ts +88 -61
- package/src/templator/genTableBlock.ts +4 -4
- package/src/templator/genUpdateBlock.ts +2 -15
- package/src/templator/utils.ts +1 -1
- package/src/translator/types.ts +4 -0
- package/src/translator/utils.ts +6 -0
- package/src/utils/env.ts +5 -4
- package/src/utils/index.ts +50 -1
- package/src/utils/language-cache/constant.ts +37 -0
- package/src/utils/language-cache/index.ts +2 -0
- package/src/utils/language-cache/nasl.ts +83 -0
- package/src/utils/language-cache/types.ts +48 -0
- package/src/utils/time-slicing/controller.ts +0 -1
- package/src/utils/types.ts +20 -0
- package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +13 -13
- package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +12 -12
- package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +1 -2
- package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +221 -217
- package/ts-worker/bundle.js +1 -1
- package/ts-worker/src/index.js +0 -1
- package/out/utils/delay/index.d.ts +0 -0
- package/out/utils/delay/index.js +0 -1
- package/out/utils/delay/index.js.map +0 -1
- package/src/utils/delay/index.ts +0 -0
|
@@ -21,6 +21,7 @@ import type Namespace from './Namespace__';
|
|
|
21
21
|
import type View from './View__';
|
|
22
22
|
import Process from './Process__';
|
|
23
23
|
import Module from './Module__';
|
|
24
|
+
import type SubLogic from './SubLogic__';
|
|
24
25
|
//================================================================================
|
|
25
26
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
26
27
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -1476,6 +1477,9 @@ export class ProcessElement extends BaseNode {
|
|
|
1476
1477
|
@withSourceMapGenerator
|
|
1477
1478
|
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
1478
1479
|
const self = this;
|
|
1480
|
+
// 获取所有子节点用于树上填充
|
|
1481
|
+
self.getSubLogics();
|
|
1482
|
+
|
|
1479
1483
|
// this.syncLogic();
|
|
1480
1484
|
const tab0 = indent(state?.tabSize || 0);
|
|
1481
1485
|
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
@@ -1723,22 +1727,18 @@ export class ProcessElement extends BaseNode {
|
|
|
1723
1727
|
// });
|
|
1724
1728
|
// this.app.emit('collect:end');
|
|
1725
1729
|
// }
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
genActionListener($event: EventPayload): void {
|
|
1740
|
-
super.genActionListener($event);
|
|
1741
|
-
invokeCommand('logic.update', this);
|
|
1730
|
+
subLogics: Array<SubLogic> = [];
|
|
1731
|
+
|
|
1732
|
+
getSubLogics() {
|
|
1733
|
+
// 只有 AutoTask 才需要在他的节点下找子逻辑
|
|
1734
|
+
// 其他直接在 BindEvent 下找
|
|
1735
|
+
if (this.type !== 'AutoTask') return [] as SubLogic[];
|
|
1736
|
+
const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
|
|
1737
|
+
if (asserts.isSubLogic(node)) {
|
|
1738
|
+
return true;
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
this.subLogics = subLogics as Array<SubLogic>;
|
|
1742
1742
|
}
|
|
1743
1743
|
//================================================================================
|
|
1744
1744
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -8,6 +8,10 @@ import Logic from './Logic__';
|
|
|
8
8
|
import Entity from './Entity__';
|
|
9
9
|
import { genLaunchProcess, genProcessOperate } from '../server/getProcessesV2';
|
|
10
10
|
import { createUniqueKey } from '../utils/create';
|
|
11
|
+
import type SubLogic from './SubLogic__';
|
|
12
|
+
import type Param from './Param__';
|
|
13
|
+
|
|
14
|
+
|
|
11
15
|
//================================================================================
|
|
12
16
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
13
17
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -24,7 +28,6 @@ import ProcessElementV2 from './ProcessElementV2__';
|
|
|
24
28
|
import HistoryProcessV2 from './HistoryProcessV2__';
|
|
25
29
|
import ProcessBindV2 from './ProcessBindV2__';
|
|
26
30
|
import BindEvent from './BindEvent__';
|
|
27
|
-
|
|
28
31
|
/**
|
|
29
32
|
* 流程
|
|
30
33
|
*/
|
|
@@ -820,6 +823,8 @@ export class ProcessV2 extends BaseNode {
|
|
|
820
823
|
// 获取虚拟logic的参数和内容
|
|
821
824
|
// 用作展示和tots查找引用
|
|
822
825
|
self.getElementLogicRoot();
|
|
826
|
+
// 获取所有子节点用于树上填充
|
|
827
|
+
self.getSubLogics();
|
|
823
828
|
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
824
829
|
let code = `export namespace ${self.uniqueKey} {\n`;
|
|
825
830
|
const bind = self.bind;
|
|
@@ -960,7 +965,7 @@ export class ProcessV2 extends BaseNode {
|
|
|
960
965
|
bounds: {
|
|
961
966
|
concept: 'Rect',
|
|
962
967
|
x: 0,
|
|
963
|
-
y:
|
|
968
|
+
y: 200,
|
|
964
969
|
},
|
|
965
970
|
bindAttrs: [
|
|
966
971
|
{
|
|
@@ -1019,7 +1024,7 @@ export class ProcessV2 extends BaseNode {
|
|
|
1019
1024
|
bounds: {
|
|
1020
1025
|
concept: 'Rect',
|
|
1021
1026
|
x: 0,
|
|
1022
|
-
y:
|
|
1027
|
+
y: 400,
|
|
1023
1028
|
},
|
|
1024
1029
|
},
|
|
1025
1030
|
{
|
|
@@ -1037,6 +1042,37 @@ export class ProcessV2 extends BaseNode {
|
|
|
1037
1042
|
};
|
|
1038
1043
|
}
|
|
1039
1044
|
|
|
1045
|
+
// TODO need reset when process support hoc & spread param & type annotation
|
|
1046
|
+
subLogics: Array<SubLogic> = [];
|
|
1047
|
+
|
|
1048
|
+
getSubLogics() {
|
|
1049
|
+
const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
|
|
1050
|
+
if (asserts.isSubLogic(node)) {
|
|
1051
|
+
return true;
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
this.subLogics = subLogics as Array<SubLogic>;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
get includeSpreadCallLogic() {
|
|
1059
|
+
return !!this.findNode((node) => {
|
|
1060
|
+
if (asserts.isCallLogic(node)) {
|
|
1061
|
+
const logic = node.getCallNode();
|
|
1062
|
+
const args = logic?.params || [];
|
|
1063
|
+
return args.some((arg: Param) => arg.spread);
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
get includeTypeArgs() {
|
|
1069
|
+
return !!this.findNode((node) => {
|
|
1070
|
+
if (asserts.isCallLogic(node)) {
|
|
1071
|
+
return (node?.needCompleteTypeArguments?.length || 0) > 0;
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1040
1076
|
//================================================================================
|
|
1041
1077
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1042
1078
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -17,6 +17,8 @@ import type Logic from './Logic__';
|
|
|
17
17
|
import type Variable from './Variable__';
|
|
18
18
|
import type Identifier from './Identifier__';
|
|
19
19
|
import Module from './Module__';
|
|
20
|
+
import type SubLogic from './SubLogic__';
|
|
21
|
+
|
|
20
22
|
//================================================================================
|
|
21
23
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
22
24
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -1220,6 +1222,9 @@ export class Process extends BaseNode {
|
|
|
1220
1222
|
// 获取虚拟logic的参数和内容
|
|
1221
1223
|
// 用作展示和tots查找引用
|
|
1222
1224
|
self.getElementLogicRoot();
|
|
1225
|
+
// 获取所有子节点用于树上填充
|
|
1226
|
+
self.getSubLogics();
|
|
1227
|
+
|
|
1223
1228
|
let code = `export namespace ${self.name} {\n`;
|
|
1224
1229
|
const tab0 = indent(state?.tabSize || 0);
|
|
1225
1230
|
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
@@ -1487,6 +1492,37 @@ export class Process extends BaseNode {
|
|
|
1487
1492
|
],
|
|
1488
1493
|
};
|
|
1489
1494
|
}
|
|
1495
|
+
|
|
1496
|
+
// TODO need reset when process support hoc & spread param & type annotation
|
|
1497
|
+
subLogics: Array<SubLogic> = [];
|
|
1498
|
+
|
|
1499
|
+
getSubLogics() {
|
|
1500
|
+
const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
|
|
1501
|
+
if (asserts.isSubLogic(node)) {
|
|
1502
|
+
return true;
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
this.subLogics = subLogics as Array<SubLogic>;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
get includeSpreadCallLogic() {
|
|
1510
|
+
return !!this.findNode((node) => {
|
|
1511
|
+
if (asserts.isCallLogic(node)) {
|
|
1512
|
+
const logic = node.getCallNode();
|
|
1513
|
+
const args = logic?.params || [];
|
|
1514
|
+
return args.some((arg: Param) => arg.spread);
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
get includeTypeArgs() {
|
|
1520
|
+
return !!this.findNode((node) => {
|
|
1521
|
+
if (asserts.isCallLogic(node)) {
|
|
1522
|
+
return (node?.needCompleteTypeArguments?.length || 0) > 0;
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1490
1526
|
//================================================================================
|
|
1491
1527
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
1492
1528
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -262,12 +262,12 @@ export class QueryFromExpression extends LogicItem {
|
|
|
262
262
|
|
|
263
263
|
@withSourceMap()
|
|
264
264
|
toNaturalTS(state = createCompilerState()): string {
|
|
265
|
-
const simpleEntityKey = this.
|
|
265
|
+
const simpleEntityKey = this.entityKey + 'Entity';
|
|
266
266
|
let code = `FROM(${simpleEntityKey}, ${this.asName || this.entityName} => $`;
|
|
267
267
|
|
|
268
268
|
if (this.joinParts.length) {
|
|
269
269
|
this.joinParts.forEach((joinPart) => {
|
|
270
|
-
code +=
|
|
270
|
+
code += `\n${indent(state.tabSize)}`;
|
|
271
271
|
code += joinPart.toNaturalTS(state);
|
|
272
272
|
});
|
|
273
273
|
}
|
|
@@ -466,7 +466,7 @@ export class QueryJoinExpression extends LogicItem {
|
|
|
466
466
|
|
|
467
467
|
@withSourceMap()
|
|
468
468
|
toNaturalTS(state = createCompilerState()): string {
|
|
469
|
-
const simpleEntityKey = this.
|
|
469
|
+
const simpleEntityKey = this.entityKey + 'Entity';
|
|
470
470
|
let code = `.${this.joinType}_JOIN(${simpleEntityKey}, ${this.asName || this.entityName} => ON(() => `;
|
|
471
471
|
this.onExpressions.forEach((on) => {
|
|
472
472
|
code += on.toNaturalTS(shiftState(state, code, { inline: true }));
|
|
@@ -475,7 +475,7 @@ export class QueryJoinExpression extends LogicItem {
|
|
|
475
475
|
|
|
476
476
|
if (this.joinParts.length) {
|
|
477
477
|
this.joinParts.forEach((joinPart) => {
|
|
478
|
-
code +=
|
|
478
|
+
code += `\n${indent(state.tabSize)}`;
|
|
479
479
|
code += joinPart.toNaturalTS(state);
|
|
480
480
|
});
|
|
481
481
|
}
|
package/src/concepts/Return__.ts
CHANGED
|
@@ -372,7 +372,8 @@ export class Return extends BaseNode {
|
|
|
372
372
|
get __isVirtual() {
|
|
373
373
|
const processV2 = this.getAncestor('ProcessV2') as ProcessV2;
|
|
374
374
|
const process = this.getAncestor('Process') as Process;
|
|
375
|
-
|
|
375
|
+
const isDisabled = !!this.getAncestor('HistoryProcessV2') || ['enabled', 'history'].includes(processV2?.status)
|
|
376
|
+
return isDisabled || process?.__isVirtual || false;
|
|
376
377
|
}
|
|
377
378
|
//================================================================================
|
|
378
379
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
@@ -65,6 +65,18 @@ export class StaticString extends BaseNode {
|
|
|
65
65
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
66
66
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
67
67
|
//================================================================================
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 设置字符串的值
|
|
71
|
+
*/
|
|
72
|
+
setValue(value: string) {
|
|
73
|
+
const object = {
|
|
74
|
+
value,
|
|
75
|
+
};
|
|
76
|
+
this.update({
|
|
77
|
+
...object,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
68
80
|
/**
|
|
69
81
|
* 祖先 View
|
|
70
82
|
*/
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
TranslatorGenerator,
|
|
10
10
|
indent,
|
|
11
11
|
createDecoratorCode,
|
|
12
|
+
createDescriptionComment,
|
|
12
13
|
} from '../translator';
|
|
13
14
|
import type Namespace from './Namespace__';
|
|
14
15
|
|
|
@@ -203,7 +204,11 @@ export class StructureProperty extends BaseNode {
|
|
|
203
204
|
|
|
204
205
|
@withSourceMap()
|
|
205
206
|
toNaturalTS(state = createCompilerState()): string {
|
|
206
|
-
let code =
|
|
207
|
+
let code = '';
|
|
208
|
+
if (state.descriptionComment)
|
|
209
|
+
code += createDescriptionComment(state, this, ['label', 'description']);
|
|
210
|
+
|
|
211
|
+
code += this.name;
|
|
207
212
|
if (this.typeAnnotation) {
|
|
208
213
|
code += ': ';
|
|
209
214
|
code += this.typeAnnotation.toNaturalTS(shiftState(state, code, { inline: true }));
|
|
@@ -300,7 +305,7 @@ export class StructureProperty extends BaseNode {
|
|
|
300
305
|
* 是否可编辑
|
|
301
306
|
* */
|
|
302
307
|
get readonly() {
|
|
303
|
-
return !!this.module ||
|
|
308
|
+
return !!this.module || this.isConnector;
|
|
304
309
|
}
|
|
305
310
|
|
|
306
311
|
//================================================================================
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
withGenerator,
|
|
11
11
|
TranslatorGenerator,
|
|
12
12
|
createDecoratorCode,
|
|
13
|
+
createDescriptionComment,
|
|
13
14
|
} from '../translator';
|
|
14
15
|
import type Namespace from './Namespace__';
|
|
15
16
|
import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
|
|
@@ -523,7 +524,7 @@ export class Structure extends BaseNode {
|
|
|
523
524
|
* 是否可编辑
|
|
524
525
|
* */
|
|
525
526
|
get readonly() {
|
|
526
|
-
return !!this.module || this.
|
|
527
|
+
return !!this.module || this.isConnector;
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
/* 删除空数据模块 */
|
|
@@ -561,7 +562,10 @@ export class Structure extends BaseNode {
|
|
|
561
562
|
|
|
562
563
|
@withSourceMap()
|
|
563
564
|
toNaturalTS(state = createCompilerState()): string {
|
|
564
|
-
let code =
|
|
565
|
+
let code = '';
|
|
566
|
+
if (state.descriptionComment)
|
|
567
|
+
code += createDescriptionComment(state, this, ['description']);
|
|
568
|
+
code = `class ${this.name}`;
|
|
565
569
|
|
|
566
570
|
if (this.typeParams?.length) {
|
|
567
571
|
code += `<${this.typeParams
|
|
@@ -569,7 +573,11 @@ export class Structure extends BaseNode {
|
|
|
569
573
|
.join(', ')}>`;
|
|
570
574
|
}
|
|
571
575
|
|
|
572
|
-
code += ` {
|
|
576
|
+
code += ` {`;
|
|
577
|
+
if (state.descriptionComment && this.description)
|
|
578
|
+
code += `/* ${this.description} */`;
|
|
579
|
+
code += '\n';
|
|
580
|
+
|
|
573
581
|
// code += `${indent(state.tabSize + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
|
|
574
582
|
this.properties.forEach((property) => {
|
|
575
583
|
code += indent(state.tabSize + 1);
|
|
@@ -923,9 +923,9 @@ export class SubLogic extends LogicItem {
|
|
|
923
923
|
|
|
924
924
|
completionChildren: Array<SubLogic> = [];
|
|
925
925
|
|
|
926
|
-
getVarExistingNames(excludedList: Array<Param> = []) {
|
|
926
|
+
getVarExistingNames(excludedList: Array<Param | Variable | Return> = []) {
|
|
927
927
|
const excludedSet = new Set(excludedList);
|
|
928
|
-
return [...this.params].filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
928
|
+
return [...this.params, ...this.variables, ...this.returns].filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
929
929
|
}
|
|
930
930
|
|
|
931
931
|
toJSContent(code: string, state?: TranslatorState): string {
|
|
@@ -1030,6 +1030,10 @@ export class SubLogic extends LogicItem {
|
|
|
1030
1030
|
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
1031
1031
|
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
1032
1032
|
}
|
|
1033
|
+
// 调用依赖库逻辑可能会有子逻辑,子逻辑拼接可能有ts忽略先去掉
|
|
1034
|
+
if (asserts.isCallLogic(rightNode) && rightNode.calleeNamespace?.startsWith('extensions.')) {
|
|
1035
|
+
code = code.replaceAll('// @ts-ignore', '');
|
|
1036
|
+
}
|
|
1033
1037
|
|
|
1034
1038
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
1035
1039
|
const forEachStatement = assignment.getAncestor('ForEachStatement') as ForEachStatement;
|
|
@@ -1040,7 +1044,9 @@ export class SubLogic extends LogicItem {
|
|
|
1040
1044
|
const callFunction = assignment.getAncestor('CallFunction') as CallFunction;
|
|
1041
1045
|
if (callFunction && callFunction.isLoopCollection) {
|
|
1042
1046
|
const anonymousFunction = assignment.getAncestor('AnonymousFunction') as AnonymousFunction;
|
|
1043
|
-
|
|
1047
|
+
if (anonymousFunction) {
|
|
1048
|
+
code = yield* this.handleCollectionCode(code, anonymousFunction, callFunction);
|
|
1049
|
+
}
|
|
1044
1050
|
}
|
|
1045
1051
|
// Match 需要针对分支缩小类型范围
|
|
1046
1052
|
const matchCase = assignment.getAncestor('MatchCase') as MatchCase;
|
|
@@ -1099,7 +1105,9 @@ export class SubLogic extends LogicItem {
|
|
|
1099
1105
|
const parentCallFunction = callFunction.getAncestor('CallFunction') as CallFunction;
|
|
1100
1106
|
if (parentCallFunction?.isLoopCollection) {
|
|
1101
1107
|
const parentAnonymousFunction = callFunction.getAncestor('AnonymousFunction') as AnonymousFunction;
|
|
1102
|
-
|
|
1108
|
+
if (parentAnonymousFunction) {
|
|
1109
|
+
code = yield* this.handleCollectionCode(code, parentAnonymousFunction, parentCallFunction);
|
|
1110
|
+
}
|
|
1103
1111
|
}
|
|
1104
1112
|
return code;
|
|
1105
1113
|
}
|
|
@@ -1183,6 +1191,9 @@ export class SubLogic extends LogicItem {
|
|
|
1183
1191
|
// 内置函数对集合类型的推导
|
|
1184
1192
|
(asserts.isCallFunction(el) && el.derivablecollection?.name))
|
|
1185
1193
|
) {
|
|
1194
|
+
if (el?.getAncestor('SubLogic') !== self) {
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1186
1197
|
if (asserts.isAssignment(el)) {
|
|
1187
1198
|
const advanceVar = self.variables?.find(
|
|
1188
1199
|
(variable) => !variable.typeAnnotation && el.left?.name === variable.name,
|
|
@@ -1493,11 +1504,6 @@ export class SubLogic extends LogicItem {
|
|
|
1493
1504
|
this.subLogics = subLogics as SubLogic[];
|
|
1494
1505
|
}
|
|
1495
1506
|
|
|
1496
|
-
genActionListener($event: EventPayload): void {
|
|
1497
|
-
super.genActionListener($event);
|
|
1498
|
-
invokeCommand('logic.update', this);
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
1507
|
// 用于展示的名称
|
|
1502
1508
|
get __name__() {
|
|
1503
1509
|
const callLogic = this.getAncestor('CallLogic') as CallLogic;
|
|
@@ -111,6 +111,11 @@ export class Transactional extends BaseNode {
|
|
|
111
111
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
112
112
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
113
113
|
//================================================================================
|
|
114
|
+
@withSourceMap()
|
|
115
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
|
|
114
119
|
/**
|
|
115
120
|
* 祖先 Logic
|
|
116
121
|
*/
|
|
@@ -270,12 +270,7 @@ export class ValidationRule extends LogicItem {
|
|
|
270
270
|
//================================================================================
|
|
271
271
|
|
|
272
272
|
public static getDefaultOptions() {
|
|
273
|
-
return {
|
|
274
|
-
target: {
|
|
275
|
-
concept: 'Identifier',
|
|
276
|
-
name: '',
|
|
277
|
-
},
|
|
278
|
-
};
|
|
273
|
+
return {};
|
|
279
274
|
}
|
|
280
275
|
|
|
281
276
|
toInViewMethod() {
|
|
@@ -287,6 +282,8 @@ export class ValidationRule extends LogicItem {
|
|
|
287
282
|
code += `validate: 'excluded',`;
|
|
288
283
|
} else if (this.calleeName === 'confirmed') {
|
|
289
284
|
code += `validate: 'is',`;
|
|
285
|
+
} else if (this.calleeName === 'object') {
|
|
286
|
+
code += `validate: 'plainObject',`;
|
|
290
287
|
} else {
|
|
291
288
|
code += `validate: '${this.calleeName}',`;
|
|
292
289
|
}
|
|
@@ -337,6 +334,8 @@ export class ValidationRule extends LogicItem {
|
|
|
337
334
|
code += `validate: 'excluded',`;
|
|
338
335
|
} else if (this.calleeName === 'confirmed') {
|
|
339
336
|
code += `validate: 'is',`;
|
|
337
|
+
} else if (this.calleeName === 'object') {
|
|
338
|
+
code += `validate: 'plainObject',`;
|
|
340
339
|
} else {
|
|
341
340
|
code += `validate: '${this.calleeName}',`;
|
|
342
341
|
}
|
|
@@ -547,6 +546,8 @@ export class ValidationRule extends LogicItem {
|
|
|
547
546
|
const argument = Argument.from(
|
|
548
547
|
{
|
|
549
548
|
keyword: param.name,
|
|
549
|
+
expression: param.defaultValue?.expression,
|
|
550
|
+
required: param.required,
|
|
550
551
|
},
|
|
551
552
|
this,
|
|
552
553
|
);
|
|
@@ -208,7 +208,8 @@ export class Variable extends BaseNode {
|
|
|
208
208
|
get __isVirtual() {
|
|
209
209
|
const processV2 = this.getAncestor('ProcessV2') as ProcessV2;
|
|
210
210
|
const process = this.getAncestor('Process') as Process;
|
|
211
|
-
|
|
211
|
+
const isDisabled = !!this.getAncestor('HistoryProcessV2') || ['enabled', 'history'].includes(processV2?.status)
|
|
212
|
+
return isDisabled || process?.__isVirtual || false;
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
toVue(options?: ElementToVueOptions): string {
|
|
@@ -465,7 +466,11 @@ export class Variable extends BaseNode {
|
|
|
465
466
|
* 是否可编辑
|
|
466
467
|
* */
|
|
467
468
|
get readonly() {
|
|
468
|
-
|
|
469
|
+
// 不在可编辑态的连接器下
|
|
470
|
+
const isInConnector = this.connector;
|
|
471
|
+
const isInIntegration = this.getAncestor('Integration');
|
|
472
|
+
const isInEditableConnector = isInIntegration && isInConnector;
|
|
473
|
+
return !!(this.module && !isInEditableConnector);
|
|
469
474
|
}
|
|
470
475
|
|
|
471
476
|
//================================================================================
|