@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
|
@@ -13,7 +13,7 @@ import { createUUID } from '../utils/create';
|
|
|
13
13
|
import * as types from './utils/types';
|
|
14
14
|
import * as asserts from './utils/asserts';
|
|
15
15
|
import BaseNode from '../common/BaseNode';
|
|
16
|
-
import
|
|
16
|
+
import Logic from './Logic__';
|
|
17
17
|
import ViewComponentDeclaration from './ViewComponentDeclaration__';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -59,11 +59,11 @@ export class FrontendLibrary extends BaseNode {
|
|
|
59
59
|
* 依赖库逻辑声明列表
|
|
60
60
|
*/
|
|
61
61
|
@property({
|
|
62
|
-
objectRef: '
|
|
62
|
+
objectRef: 'Logic',
|
|
63
63
|
isArray: true,
|
|
64
64
|
defaultValue: [],
|
|
65
65
|
})
|
|
66
|
-
logics: Array<
|
|
66
|
+
logics: Array<Logic> = [];
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* 依赖库组件声明列表
|
|
@@ -88,98 +88,96 @@ export class FrontendLibrary extends BaseNode {
|
|
|
88
88
|
return super.from(source, parentNode, parentKey) as FrontendLibrary;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
getLogicExistingNames(excludedList: Array<Logic> = []) {
|
|
92
92
|
const excludedSet = new Set(excludedList);
|
|
93
|
-
return ((this.logics as
|
|
94
|
-
.filter((item) => !excludedSet.has(item))
|
|
95
|
-
.map((item) => item.name);
|
|
93
|
+
return ((this.logics as Logic[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
96
94
|
}
|
|
97
|
-
|
|
98
|
-
return utils.unique(name, this.
|
|
95
|
+
getLogicUniqueName(name = 'logic1') {
|
|
96
|
+
return utils.unique(name, this.getLogicExistingNames(), undefined, true);
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
/**
|
|
102
|
-
*
|
|
100
|
+
* 插入逻辑
|
|
103
101
|
* @internal
|
|
104
|
-
* @param name
|
|
102
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
105
103
|
*/
|
|
106
|
-
|
|
104
|
+
_insertLogicAt(name: string, index: number): Logic;
|
|
107
105
|
|
|
108
106
|
/**
|
|
109
|
-
*
|
|
107
|
+
* 插入逻辑
|
|
110
108
|
* @internal
|
|
111
|
-
* @param
|
|
109
|
+
* @param logicOptions 逻辑参数
|
|
112
110
|
*/
|
|
113
|
-
|
|
111
|
+
_insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
|
|
114
112
|
|
|
115
113
|
/**
|
|
116
|
-
*
|
|
114
|
+
* 插入逻辑
|
|
117
115
|
* @internal
|
|
118
|
-
* @param
|
|
116
|
+
* @param logic 已有的逻辑实例
|
|
119
117
|
*/
|
|
120
|
-
|
|
118
|
+
_insertLogicAt(logic: Logic, index: number): Logic;
|
|
121
119
|
|
|
122
|
-
|
|
123
|
-
const
|
|
120
|
+
_insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
|
|
121
|
+
const logicOptions: any = {};
|
|
124
122
|
const relationOptions = { parentNode: this, parentKey: 'logics' };
|
|
125
|
-
const
|
|
126
|
-
let
|
|
123
|
+
const Logic = getConceptConstructor('Logic');
|
|
124
|
+
let logic: Logic;
|
|
127
125
|
if (!options) {
|
|
128
|
-
|
|
126
|
+
logic = Logic.from(
|
|
129
127
|
{
|
|
130
|
-
...
|
|
131
|
-
name: this.
|
|
128
|
+
...logicOptions,
|
|
129
|
+
name: this.getLogicUniqueName(),
|
|
132
130
|
},
|
|
133
131
|
this,
|
|
134
132
|
'logics',
|
|
135
133
|
);
|
|
136
134
|
} else if (typeof options === 'string') {
|
|
137
|
-
|
|
135
|
+
logic = Logic.from(
|
|
138
136
|
{
|
|
139
|
-
...
|
|
137
|
+
...logicOptions,
|
|
140
138
|
name: options,
|
|
141
139
|
},
|
|
142
140
|
this,
|
|
143
141
|
'logics',
|
|
144
142
|
);
|
|
145
|
-
} else if (asserts.
|
|
143
|
+
} else if (asserts.isLogic(options)) {
|
|
146
144
|
options.ensureDelete(); // 同一实例不支持多处存在
|
|
147
|
-
|
|
148
|
-
Object.assign(
|
|
145
|
+
logic = options;
|
|
146
|
+
Object.assign(logic, relationOptions);
|
|
149
147
|
} else {
|
|
150
|
-
|
|
148
|
+
logic = Logic.from(
|
|
151
149
|
{
|
|
152
|
-
...
|
|
150
|
+
...logicOptions,
|
|
153
151
|
...options,
|
|
154
152
|
},
|
|
155
153
|
this,
|
|
156
154
|
'logics',
|
|
157
155
|
);
|
|
158
156
|
}
|
|
159
|
-
this.logics.splice(index, 0,
|
|
160
|
-
return
|
|
157
|
+
this.logics.splice(index, 0, logic);
|
|
158
|
+
return logic;
|
|
161
159
|
}
|
|
162
160
|
|
|
163
161
|
/**
|
|
164
|
-
*
|
|
165
|
-
* @param name
|
|
162
|
+
* 插入逻辑
|
|
163
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
166
164
|
*/
|
|
167
|
-
|
|
165
|
+
insertLogicAt(name: string, index: number): Logic;
|
|
168
166
|
|
|
169
167
|
/**
|
|
170
|
-
*
|
|
171
|
-
* @param
|
|
168
|
+
* 插入逻辑
|
|
169
|
+
* @param logicOptions 逻辑参数
|
|
172
170
|
*/
|
|
173
|
-
|
|
171
|
+
insertLogicAt(logicOptions: Partial<Logic>, index: number): Logic;
|
|
174
172
|
|
|
175
173
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @param
|
|
174
|
+
* 插入逻辑
|
|
175
|
+
* @param logic 已有的逻辑实例
|
|
178
176
|
*/
|
|
179
|
-
|
|
177
|
+
insertLogicAt(logic: Logic, index: number): Logic;
|
|
180
178
|
|
|
181
|
-
|
|
182
|
-
const node = this.
|
|
179
|
+
insertLogicAt(options: string | Partial<Logic> | Logic, index: number) {
|
|
180
|
+
const node = this._insertLogicAt(options as any, index);
|
|
183
181
|
node.create({
|
|
184
182
|
index,
|
|
185
183
|
parentNode: this,
|
|
@@ -189,52 +187,52 @@ export class FrontendLibrary extends BaseNode {
|
|
|
189
187
|
}
|
|
190
188
|
|
|
191
189
|
/**
|
|
192
|
-
*
|
|
190
|
+
* 添加逻辑
|
|
193
191
|
* @internal
|
|
194
|
-
* @param name
|
|
192
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
195
193
|
*/
|
|
196
|
-
|
|
194
|
+
_addLogic(name?: string): Logic;
|
|
197
195
|
|
|
198
196
|
/**
|
|
199
|
-
*
|
|
197
|
+
* 添加逻辑
|
|
200
198
|
* @internal
|
|
201
|
-
* @param
|
|
199
|
+
* @param logicOptions 逻辑参数
|
|
202
200
|
*/
|
|
203
|
-
|
|
201
|
+
_addLogic(logicOptions: Partial<Logic>): Logic;
|
|
204
202
|
|
|
205
203
|
/**
|
|
206
|
-
*
|
|
204
|
+
* 添加逻辑
|
|
207
205
|
* @internal
|
|
208
|
-
* @param
|
|
206
|
+
* @param logic 已有的逻辑实例
|
|
209
207
|
*/
|
|
210
|
-
|
|
208
|
+
_addLogic(logic: Logic): Logic;
|
|
211
209
|
|
|
212
|
-
|
|
210
|
+
_addLogic(options?: string | Partial<Logic> | Logic) {
|
|
213
211
|
const index = this.logics.length;
|
|
214
|
-
return this.
|
|
212
|
+
return this._insertLogicAt(options as any, index);
|
|
215
213
|
}
|
|
216
214
|
|
|
217
215
|
/**
|
|
218
|
-
*
|
|
216
|
+
* 添加逻辑
|
|
219
217
|
* @internal
|
|
220
|
-
* @param name
|
|
218
|
+
* @param name 逻辑名称,如果不填会自动生成一个唯一名称
|
|
221
219
|
*/
|
|
222
|
-
|
|
220
|
+
addLogic(name?: string): Logic;
|
|
223
221
|
|
|
224
222
|
/**
|
|
225
|
-
*
|
|
226
|
-
* @param
|
|
223
|
+
* 添加逻辑
|
|
224
|
+
* @param logicOptions 逻辑参数
|
|
227
225
|
*/
|
|
228
|
-
|
|
226
|
+
addLogic(logicOptions: Partial<Logic>): Logic;
|
|
229
227
|
|
|
230
228
|
/**
|
|
231
|
-
*
|
|
232
|
-
* @param
|
|
229
|
+
* 添加逻辑
|
|
230
|
+
* @param logic 已有的逻辑实例
|
|
233
231
|
*/
|
|
234
|
-
|
|
232
|
+
addLogic(logic: Logic): Logic;
|
|
235
233
|
|
|
236
|
-
|
|
237
|
-
const node = this.
|
|
234
|
+
addLogic(options?: string | Partial<Logic> | Logic) {
|
|
235
|
+
const node = this._addLogic(options as any);
|
|
238
236
|
const index = this.logics.indexOf(node);
|
|
239
237
|
node.create({
|
|
240
238
|
index,
|
|
@@ -423,28 +421,28 @@ export class FrontendLibrary extends BaseNode {
|
|
|
423
421
|
}
|
|
424
422
|
|
|
425
423
|
/**
|
|
426
|
-
*
|
|
427
|
-
* @param name
|
|
424
|
+
* 删除逻辑
|
|
425
|
+
* @param name 逻辑名称
|
|
428
426
|
*/
|
|
429
|
-
|
|
427
|
+
removeLogic(name: string): void;
|
|
430
428
|
|
|
431
429
|
/**
|
|
432
|
-
*
|
|
433
|
-
* @param
|
|
430
|
+
* 删除逻辑
|
|
431
|
+
* @param logic 已有的逻辑实例
|
|
434
432
|
*/
|
|
435
|
-
|
|
433
|
+
removeLogic(logic: Logic): void;
|
|
436
434
|
|
|
437
|
-
|
|
438
|
-
let
|
|
435
|
+
removeLogic(options: string | Logic) {
|
|
436
|
+
let logic: Logic;
|
|
439
437
|
if (typeof options === 'string') {
|
|
440
|
-
|
|
441
|
-
if (!
|
|
442
|
-
throw new Error('
|
|
438
|
+
logic = (this.logics as Logic[]).find((item) => item.name === options);
|
|
439
|
+
if (!logic) {
|
|
440
|
+
throw new Error('找不到逻辑 ' + options);
|
|
443
441
|
}
|
|
444
442
|
} else {
|
|
445
|
-
|
|
443
|
+
logic = options;
|
|
446
444
|
}
|
|
447
|
-
return
|
|
445
|
+
return logic.delete();
|
|
448
446
|
}
|
|
449
447
|
|
|
450
448
|
/**
|
|
@@ -92,6 +92,11 @@ export class I18nInfo extends BaseNode {
|
|
|
92
92
|
// ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
|
|
93
93
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
94
94
|
//================================================================================
|
|
95
|
+
@withSourceMap()
|
|
96
|
+
toNaturalTS(state = createCompilerState()): string {
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
|
|
95
100
|
get messagesLanguageList() {
|
|
96
101
|
return Object.keys(this.messageMap || {});
|
|
97
102
|
}
|
|
@@ -468,7 +468,7 @@ export class IfStatement extends LogicItem {
|
|
|
468
468
|
});
|
|
469
469
|
if (state.focusedNodePath === `${this.nodePath}.alternate[${this.alternate.length}]`)
|
|
470
470
|
code += `${indent((state?.tabSize || 0) + 1)}/* 当前位置 */\n`;
|
|
471
|
-
code += `${indent(state?.tabSize || 0)}}
|
|
471
|
+
code += `${indent(state?.tabSize || 0)}}`;
|
|
472
472
|
return code;
|
|
473
473
|
}
|
|
474
474
|
|
|
@@ -506,7 +506,7 @@ export class IfStatement extends LogicItem {
|
|
|
506
506
|
});
|
|
507
507
|
if (state.focusedNodePath === `${this.nodePath}.alternate[${this.alternate.length}]`)
|
|
508
508
|
code += `${indent((state?.tabSize || 0) + 1)}/* 当前位置 */\n`;
|
|
509
|
-
code += `${indent(state?.tabSize || 0)}}
|
|
509
|
+
code += `${indent(state?.tabSize || 0)}}`;
|
|
510
510
|
return code;
|
|
511
511
|
}
|
|
512
512
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
withSourceMapGenerator,
|
|
10
10
|
withGenerator,
|
|
11
11
|
TranslatorGenerator,
|
|
12
|
+
createDescriptionComment,
|
|
12
13
|
} from '../translator';
|
|
13
14
|
import type Namespace from './Namespace__';
|
|
14
15
|
import type TypeAnnotation from './TypeAnnotation__';
|
|
@@ -978,7 +979,11 @@ export class Interface extends ImportedInterface {
|
|
|
978
979
|
@withSourceMap()
|
|
979
980
|
toNaturalTS(state = createCompilerState(), interfaceName: string): string {
|
|
980
981
|
const { name, params, returns } = this || {};
|
|
981
|
-
|
|
982
|
+
|
|
983
|
+
let code = '';
|
|
984
|
+
if (state.descriptionComment)
|
|
985
|
+
code += createDescriptionComment(state, this, ['description']);
|
|
986
|
+
code = `declare function ${interfaceName || name}(`;
|
|
982
987
|
if (params?.length) {
|
|
983
988
|
code += '{';
|
|
984
989
|
params?.forEach((param, index) => {
|
package/src/concepts/Logic__.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
withSourceMapGenerator,
|
|
18
18
|
withGenerator,
|
|
19
19
|
TranslatorGenerator,
|
|
20
|
+
createDescriptionComment,
|
|
20
21
|
} from '../translator';
|
|
21
22
|
import type App from './App__';
|
|
22
23
|
import type Namespace from './Namespace__';
|
|
@@ -1274,7 +1275,8 @@ export class Logic extends Annotatable {
|
|
|
1274
1275
|
}
|
|
1275
1276
|
|
|
1276
1277
|
get __isVirtual() {
|
|
1277
|
-
|
|
1278
|
+
const isDisabled = !!this.getAncestor('HistoryProcessV2') || ['enabled', 'history'].includes(this.processV2?.status)
|
|
1279
|
+
return isDisabled || this.process?.__isVirtual || false;
|
|
1278
1280
|
}
|
|
1279
1281
|
|
|
1280
1282
|
// 用于calllogic树中定位是那个logic,回显
|
|
@@ -1577,6 +1579,9 @@ export class Logic extends Annotatable {
|
|
|
1577
1579
|
// 内置函数对集合类型的推导
|
|
1578
1580
|
(asserts.isCallFunction(el) && el.derivablecollection?.name))
|
|
1579
1581
|
) {
|
|
1582
|
+
if (el?.getAncestor('SubLogic')) {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1580
1585
|
if (asserts.isAssignment(el)) {
|
|
1581
1586
|
const advanceVar = self.variables?.find(
|
|
1582
1587
|
(variable) => !variable.typeAnnotation && el.left?.name === variable.name,
|
|
@@ -1772,11 +1777,26 @@ export class Logic extends Annotatable {
|
|
|
1772
1777
|
toEmbeddedTSNoExport(state?: TranslatorState): string {
|
|
1773
1778
|
return runSync(this.toEmbeddedTS(state, 'noExport'));
|
|
1774
1779
|
}
|
|
1775
|
-
get tsName() {
|
|
1780
|
+
get tsName(): string {
|
|
1781
|
+
const { parentNode: parent, connector, integration, view, name } = this;
|
|
1782
|
+
|
|
1783
|
+
if (!view || parent.concept !== 'BindEvent') {
|
|
1784
|
+
return this.name;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1776
1787
|
// 来自集成中心,且是连接内部的逻辑,则认为是编辑态的,需要加上后缀
|
|
1777
|
-
if (
|
|
1788
|
+
if (connector && integration) {
|
|
1778
1789
|
return `${this.name}${CUSTOM_CONNECTOR_EDITABLE_SUFFIX}`;
|
|
1779
1790
|
}
|
|
1791
|
+
|
|
1792
|
+
const { parentNode: grandPar } = parent;
|
|
1793
|
+
|
|
1794
|
+
if (grandPar.concept === 'View') {
|
|
1795
|
+
return `$$_view_${parent.parentNode.name}_bind_event_${name}`;
|
|
1796
|
+
}
|
|
1797
|
+
else if (grandPar.concept === 'ViewElement') {
|
|
1798
|
+
return `$$_view_element_${parent.parentNode.name}_bind_event_${name}`;
|
|
1799
|
+
}
|
|
1780
1800
|
// 由于Logic name 已经是符合函数预期的,因此不再需要做格式化
|
|
1781
1801
|
return this.name;
|
|
1782
1802
|
}
|
|
@@ -1883,6 +1903,9 @@ export class Logic extends Annotatable {
|
|
|
1883
1903
|
// 内置函数对集合类型的推导
|
|
1884
1904
|
(asserts.isCallFunction(el) && el.derivablecollection?.name))
|
|
1885
1905
|
) {
|
|
1906
|
+
if (el?.getAncestor('SubLogic')) {
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1886
1909
|
if (asserts.isAssignment(el)) {
|
|
1887
1910
|
const advanceVar = self.variables?.find(
|
|
1888
1911
|
(variable) => !variable.typeAnnotation && el.left?.name === variable.name,
|
|
@@ -2214,6 +2237,8 @@ export class Logic extends Annotatable {
|
|
|
2214
2237
|
@withSourceMap()
|
|
2215
2238
|
toNaturalTS(state = createCompilerState()): string {
|
|
2216
2239
|
let code = '';
|
|
2240
|
+
if (state.descriptionComment)
|
|
2241
|
+
code += createDescriptionComment(state, this, ['description']);
|
|
2217
2242
|
|
|
2218
2243
|
let logicName = this.name;
|
|
2219
2244
|
if (state.autoPrefixName) {
|
|
@@ -2380,6 +2405,10 @@ export class Logic extends Annotatable {
|
|
|
2380
2405
|
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
2381
2406
|
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
2382
2407
|
}
|
|
2408
|
+
// 调用依赖库逻辑可能会有子逻辑,子逻辑拼接可能有ts忽略先去掉
|
|
2409
|
+
if (asserts.isCallLogic(rightNode) && rightNode.calleeNamespace?.startsWith('extensions.')) {
|
|
2410
|
+
code = code.replaceAll('// @ts-ignore', '');
|
|
2411
|
+
}
|
|
2383
2412
|
|
|
2384
2413
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
2385
2414
|
const forEachStatement = assignment.getAncestor('ForEachStatement') as ForEachStatement;
|
|
@@ -2689,6 +2718,11 @@ export class Logic extends Annotatable {
|
|
|
2689
2718
|
actionMsg,
|
|
2690
2719
|
});
|
|
2691
2720
|
super.delete();
|
|
2721
|
+
this.body.forEach((el) => {
|
|
2722
|
+
if (asserts.isCallInterface(el)) {
|
|
2723
|
+
el.deleteCallNode()
|
|
2724
|
+
}
|
|
2725
|
+
})
|
|
2692
2726
|
this.traverseChildren(async (el) => {
|
|
2693
2727
|
if (el?.concept === 'CallQueryComponent') (el as CallQueryComponent).removeStructure();
|
|
2694
2728
|
// 仅仅针对 自定义连接器下的 Loigc,其他需要界定边界
|
|
@@ -2855,18 +2889,13 @@ export class Logic extends Annotatable {
|
|
|
2855
2889
|
return Array.from(this.existingSubLogic);
|
|
2856
2890
|
}
|
|
2857
2891
|
|
|
2858
|
-
getSubLogicUniqueName(name = 'subLogic1') {
|
|
2892
|
+
getSubLogicUniqueName(name = 'subLogic1', excludedNames: Array<string> = []) {
|
|
2859
2893
|
const existingNames = this.getSubLogicExistingNames();
|
|
2860
|
-
const uniqueName = utils.unique(name, existingNames, undefined, false);
|
|
2894
|
+
const uniqueName = utils.unique(name, existingNames.concat(excludedNames), undefined, false);
|
|
2861
2895
|
this.existingSubLogic.add(uniqueName);
|
|
2862
2896
|
return uniqueName;
|
|
2863
2897
|
}
|
|
2864
2898
|
|
|
2865
|
-
genActionListener($event: EventPayload): void {
|
|
2866
|
-
super.genActionListener($event);
|
|
2867
|
-
invokeCommand('logic.update', this);
|
|
2868
|
-
}
|
|
2869
|
-
|
|
2870
2899
|
/**
|
|
2871
2900
|
* 完成的泛型参数
|
|
2872
2901
|
* 先指支持依赖库的泛型参数
|
|
@@ -150,15 +150,6 @@ export class MatchCase extends LogicItem {
|
|
|
150
150
|
return logicItem;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
getLogicItemExistingNames(excludedList: Array<LogicItem> = []) {
|
|
154
|
-
const excludedSet = new Set(excludedList);
|
|
155
|
-
return ((this.patterns as LogicItem[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
getLogicItemUniqueName(name = 'logicItem1') {
|
|
159
|
-
return utils.unique(name, this.getLogicItemExistingNames(), undefined, false);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
153
|
/**
|
|
163
154
|
* 插入逻辑项
|
|
164
155
|
* @param logicItemOptions 逻辑项参数
|
|
@@ -591,6 +582,14 @@ export class MatchCase extends LogicItem {
|
|
|
591
582
|
// 自动生成的代码已结束。下面可以手动编写。
|
|
592
583
|
//================================================================================
|
|
593
584
|
|
|
585
|
+
getLogicItemExistingNames(excludedList: Array<LogicItem> = []) {
|
|
586
|
+
const excludedSet = new Set(excludedList);
|
|
587
|
+
return ((this.patterns as LogicItem[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
|
|
588
|
+
}
|
|
589
|
+
getLogicItemUniqueName(name = 'logicItem1') {
|
|
590
|
+
return utils.unique(name, this.getLogicItemExistingNames(), undefined, false);
|
|
591
|
+
}
|
|
592
|
+
|
|
594
593
|
// 是否处于禁用状态
|
|
595
594
|
get isDisabled() {
|
|
596
595
|
const matchExpression = this.parentNode as Match;
|
|
@@ -1024,7 +1024,8 @@ export class NewComposite extends LogicItem {
|
|
|
1024
1024
|
if (!this.typeAnnotation) return null;
|
|
1025
1025
|
// 祖先逻辑
|
|
1026
1026
|
const ancestorLogic = this.getAncestor('Logic');
|
|
1027
|
-
|
|
1027
|
+
const bindAttribute = this.getAncestor('BindAttribute');
|
|
1028
|
+
if (ancestorLogic || bindAttribute?.name === 'dataSource') {
|
|
1028
1029
|
code += 'await (async () => { \n';
|
|
1029
1030
|
} else {
|
|
1030
1031
|
code += '(() => { \n';
|
|
@@ -320,7 +320,8 @@ export class NewList extends LogicItem {
|
|
|
320
320
|
let code = '';
|
|
321
321
|
// 祖先逻辑
|
|
322
322
|
const ancestorLogic = this.getAncestor('Logic');
|
|
323
|
-
|
|
323
|
+
const bindAttribute = this.getAncestor('BindAttribute');
|
|
324
|
+
if (ancestorLogic || bindAttribute?.name === 'dataSource') {
|
|
324
325
|
code += 'await (async () => { \n';
|
|
325
326
|
} else {
|
|
326
327
|
code += '(() => { \n';
|
package/src/concepts/NewMap__.ts
CHANGED
|
@@ -543,7 +543,8 @@ export class NewMap extends LogicItem {
|
|
|
543
543
|
let code = '';
|
|
544
544
|
// 祖先逻辑
|
|
545
545
|
const ancestorLogic = this.getAncestor('Logic');
|
|
546
|
-
|
|
546
|
+
const bindAttribute = this.getAncestor('BindAttribute');
|
|
547
|
+
if (ancestorLogic || bindAttribute?.name === 'dataSource') {
|
|
547
548
|
code += 'await (async () => { \n';
|
|
548
549
|
} else {
|
|
549
550
|
code += '(() => { \n';
|
|
@@ -124,17 +124,9 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
124
124
|
|
|
125
125
|
getTextVariables() {
|
|
126
126
|
this._TsVariables = [];
|
|
127
|
-
const str = this.code;
|
|
128
|
-
const variables: Set<string> = new Set();
|
|
129
127
|
const Identifier = getConceptConstructor('Identifier');
|
|
130
128
|
const MemberExpression = getConceptConstructor('MemberExpression');
|
|
131
|
-
|
|
132
|
-
const re = /\{(.+?)\}/g;
|
|
133
|
-
while ((temp = re.exec(str))) {
|
|
134
|
-
let variable = temp[1];
|
|
135
|
-
variable = variable.replaceAll(' ', '');
|
|
136
|
-
variables.add(variable);
|
|
137
|
-
}
|
|
129
|
+
const variables: Array<string> = this.codeSourceMap?.variableNames || [];
|
|
138
130
|
for (const variable of variables) {
|
|
139
131
|
// 遍历Set
|
|
140
132
|
let newVariable: Identifier | MemberExpression;
|
|
@@ -252,10 +244,10 @@ export class OqlQueryComponent extends LogicItem {
|
|
|
252
244
|
if (typescript) {
|
|
253
245
|
code += `${indent1}const __oqlQueryResult = ${typescript};`;
|
|
254
246
|
}
|
|
255
|
-
// 临时方案拼接字符串
|
|
256
|
-
self.getTextVariables();
|
|
257
247
|
// 翻译字段
|
|
258
248
|
code += '\n';
|
|
249
|
+
// 从接口获取可以调试变量的字段,用作下面翻译,作为后面调试的变量。拼接
|
|
250
|
+
self.getTextVariables();
|
|
259
251
|
yield* wrapForEach(self._TsVariables, function* warpForEachGenerator(variable) {
|
|
260
252
|
code += yield* variable.toEmbeddedTS(shiftState(state, code));
|
|
261
253
|
code += ';\n';
|
|
@@ -1594,6 +1594,9 @@ export class OverriddenLogic extends BaseNode {
|
|
|
1594
1594
|
// 内置函数对集合类型的推导
|
|
1595
1595
|
(asserts.isCallFunction(el) && el.derivablecollection?.name))
|
|
1596
1596
|
) {
|
|
1597
|
+
if (el?.getAncestor('SubLogic')) {
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1597
1600
|
if (asserts.isAssignment(el)) {
|
|
1598
1601
|
const advanceVar = self.variables?.find(
|
|
1599
1602
|
(variable) => !variable.typeAnnotation && el.left?.name === variable.name,
|
|
@@ -1976,6 +1979,10 @@ export class OverriddenLogic extends BaseNode {
|
|
|
1976
1979
|
const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
|
|
1977
1980
|
return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
|
|
1978
1981
|
}
|
|
1982
|
+
// 调用依赖库逻辑可能会有子逻辑,子逻辑拼接可能有ts忽略先去掉
|
|
1983
|
+
if (asserts.isCallLogic(rightNode) && rightNode.calleeNamespace?.startsWith('extensions.')) {
|
|
1984
|
+
code = code.replaceAll('// @ts-ignore', '');
|
|
1985
|
+
}
|
|
1979
1986
|
|
|
1980
1987
|
// ForEachStatement 内部变量需要替换处理,如 item、index
|
|
1981
1988
|
const forEachStatement = assignment.getAncestor('ForEachStatement') as ForEachStatement;
|
package/src/concepts/Param__.ts
CHANGED
|
@@ -23,6 +23,7 @@ import type Namespace from './Namespace__';
|
|
|
23
23
|
import type View from './View__';
|
|
24
24
|
import type HistoryProcessV2 from './HistoryProcessV2__';
|
|
25
25
|
import type ProcessV2 from './ProcessV2__';
|
|
26
|
+
import type SubLogic from './SubLogic__';
|
|
26
27
|
//================================================================================
|
|
27
28
|
// 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
|
|
28
29
|
// ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
|
|
@@ -1251,7 +1252,8 @@ export class ProcessElementV2 extends BaseNode {
|
|
|
1251
1252
|
}
|
|
1252
1253
|
|
|
1253
1254
|
get __isVirtual() {
|
|
1254
|
-
|
|
1255
|
+
const isDisabled = !!this.getAncestor('HistoryProcessV2') || ['enabled', 'history'].includes(this.processV2.status)
|
|
1256
|
+
return isDisabled;
|
|
1255
1257
|
}
|
|
1256
1258
|
|
|
1257
1259
|
get AssigneeV2() {
|
|
@@ -1351,6 +1353,9 @@ export class ProcessElementV2 extends BaseNode {
|
|
|
1351
1353
|
@withSourceMapGenerator
|
|
1352
1354
|
*toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
|
|
1353
1355
|
const self = this;
|
|
1356
|
+
// 获取所有子节点用于树上填充
|
|
1357
|
+
self.getSubLogics();
|
|
1358
|
+
|
|
1354
1359
|
const tab1 = indent((state?.tabSize || 0) + 1);
|
|
1355
1360
|
const tab2 = indent((state?.tabSize || 0) + 2);
|
|
1356
1361
|
const tab3 = indent((state?.tabSize || 0) + 3);
|
|
@@ -1528,22 +1533,15 @@ export class ProcessElementV2 extends BaseNode {
|
|
|
1528
1533
|
return code;
|
|
1529
1534
|
}
|
|
1530
1535
|
|
|
1531
|
-
|
|
1532
|
-
// 只有自动任务需要, 其他的UI展示上均在其下面的 Logic 中
|
|
1533
|
-
if (this.type === 'ServiceTask') {
|
|
1534
|
-
const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
|
|
1535
|
-
if (asserts.isSubLogic(node)) {
|
|
1536
|
-
return true;
|
|
1537
|
-
}
|
|
1538
|
-
});
|
|
1539
|
-
return subLogics;
|
|
1540
|
-
}
|
|
1541
|
-
return [];
|
|
1542
|
-
}
|
|
1536
|
+
subLogics: Array<SubLogic> = [];
|
|
1543
1537
|
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1538
|
+
getSubLogics() {
|
|
1539
|
+
const subLogics = this.findNaslNodeByBFS((node: BaseNode) => {
|
|
1540
|
+
if (asserts.isSubLogic(node)) {
|
|
1541
|
+
return true;
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
this.subLogics = subLogics as Array<SubLogic>;
|
|
1547
1545
|
}
|
|
1548
1546
|
|
|
1549
1547
|
//================================================================================
|