@lcap/nasl 2.14.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/automate/engine/index.js +2 -2
- package/out/automate/engine/index.js.map +1 -1
- package/out/automate/engine/viewCache.js +5 -5
- package/out/automate/engine/viewCache.js.map +1 -1
- package/out/common/BaseNode.js +3 -1
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/AnonymousFunction__.d.ts +170 -0
- package/out/concepts/AnonymousFunction__.js +439 -0
- package/out/concepts/AnonymousFunction__.js.map +1 -0
- package/out/concepts/App__.js +7 -1
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/Assignee__.js +1 -1
- package/out/concepts/Assignee__.js.map +1 -1
- package/out/concepts/AssignmentLine__.d.ts +40 -0
- package/out/concepts/AssignmentLine__.js +109 -0
- package/out/concepts/AssignmentLine__.js.map +1 -0
- package/out/concepts/BatchAssignment__.d.ts +248 -0
- package/out/concepts/BatchAssignment__.js +742 -0
- package/out/concepts/BatchAssignment__.js.map +1 -0
- package/out/concepts/BindAttribute__.js +2 -0
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindEvent__.js +9 -4
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +126 -0
- package/out/concepts/BindStyle__.js +233 -0
- package/out/concepts/BindStyle__.js.map +1 -0
- package/out/concepts/CallLogic__.js +3 -4
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts +1 -1
- package/out/concepts/ConstructArgument__.d.ts +40 -0
- package/out/concepts/ConstructArgument__.js +108 -0
- package/out/concepts/ConstructArgument__.js.map +1 -0
- package/out/concepts/Construct__.d.ts +189 -0
- package/out/concepts/Construct__.js +340 -0
- package/out/concepts/Construct__.js.map +1 -0
- package/out/concepts/EnumItem__.js +1 -1
- package/out/concepts/EnumItem__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +1 -0
- package/out/concepts/Interface__.js +58 -0
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.js +3 -3
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.d.ts +256 -0
- package/out/concepts/MatchCase__.js +584 -0
- package/out/concepts/MatchCase__.js.map +1 -0
- package/out/concepts/Match__.d.ts +117 -0
- package/out/concepts/Match__.js +434 -0
- package/out/concepts/Match__.js.map +1 -0
- package/out/concepts/OqlQueryComponent__.d.ts +73 -0
- package/out/concepts/OqlQueryComponent__.js +395 -0
- package/out/concepts/OqlQueryComponent__.js.map +1 -0
- package/out/concepts/ProcessElement__.d.ts +2 -2
- package/out/concepts/ProcessElement__.js +30 -21
- package/out/concepts/ProcessElement__.js.map +1 -1
- package/out/concepts/Process__.d.ts +81 -0
- package/out/concepts/Process__.js +98 -2
- package/out/concepts/Process__.js.map +1 -1
- package/out/concepts/SelectMembers__.d.ts +141 -0
- package/out/concepts/SelectMembers__.js +290 -0
- package/out/concepts/SelectMembers__.js.map +1 -0
- package/out/concepts/SqlQueryComponent__.d.ts +4 -0
- package/out/concepts/SqlQueryComponent__.js +144 -2
- package/out/concepts/SqlQueryComponent__.js.map +1 -1
- package/out/concepts/Variable__.js +0 -1
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.js +10 -1
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.js +4 -1
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/stdlib/index.js +2 -1
- package/out/concepts/basics/stdlib/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.auth.js +26 -0
- package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.process.js +98 -0
- package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.ui.js +54 -0
- package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.util.js +2 -2
- package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.validation.js +4 -0
- package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
- package/out/enums/KEYWORDS.js +1 -0
- package/out/enums/KEYWORDS.js.map +1 -1
- package/out/generator/genBundleFiles.d.ts +1 -0
- package/out/generator/genBundleFiles.js +2 -0
- package/out/generator/genBundleFiles.js.map +1 -1
- package/out/server/extendBaseNode.js +32 -4
- package/out/server/extendBaseNode.js.map +1 -1
- package/out/server/getLogics.js +42 -14
- package/out/server/getLogics.js.map +1 -1
- package/out/server/getProcesses.d.ts +2 -2
- package/out/server/getProcesses.js +47 -21
- package/out/server/getProcesses.js.map +1 -1
- package/out/server/naslServer.js +46 -19
- package/out/server/naslServer.js.map +1 -1
- package/out/server/naslStdlibMap.js +1 -0
- package/out/server/naslStdlibMap.js.map +1 -1
- package/out/server/process2LogicNamespace.js +25 -21
- package/out/server/process2LogicNamespace.js.map +1 -1
- package/out/server/translator.js +35 -8
- package/out/server/translator.js.map +1 -1
- package/out/service/logic/api.d.ts +9 -0
- package/out/service/logic/api.js +11 -0
- package/out/service/logic/api.js.map +1 -0
- package/out/service/logic/index.d.ts +2 -0
- package/out/service/logic/index.js +10 -0
- package/out/service/logic/index.js.map +1 -0
- package/out/service/storage/init.js +18 -6
- package/out/service/storage/init.js.map +1 -1
- package/out/templator/genCreateBlock.js +1 -1
- package/out/templator/genCreateBlock.js.map +1 -1
- package/out/templator/genCurdEditMultipleKeyBlock.js +4 -5
- package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
- package/out/templator/genCurdMultipleKeyBlock.js +4 -4
- package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
- package/out/templator/genEditTableBlock.js +5 -3
- package/out/templator/genEditTableBlock.js.map +1 -1
- package/out/templator/genGetBlock.js +3 -2
- package/out/templator/genGetBlock.js.map +1 -1
- package/out/templator/genTableBlock.js +4 -2
- package/out/templator/genTableBlock.js.map +1 -1
- package/out/templator/genUpdateBlock.js +1 -1
- package/out/templator/genUpdateBlock.js.map +1 -1
- package/out/templator/sql-parser/index.d.ts +1 -0
- package/out/templator/sql-parser/index.js +228 -0
- package/out/templator/sql-parser/index.js.map +1 -0
- package/out/templator/sql-parser/parser.js +26664 -0
- package/out/templator/sql-parser/parser.js.map +1 -0
- package/package.json +1 -1
- package/src/automate/engine/index.js +1 -1
- package/src/automate/engine/viewCache.js +23 -23
- package/src/automate/template/myProcess.js +12295 -0
- package/src/common/BaseNode.ts +5 -1
- package/src/concepts/App__.ts +8 -1
- package/src/concepts/Assignee__.ts +1 -1
- package/src/concepts/BindAttribute__.ts +3 -1
- package/src/concepts/BindEvent__.ts +8 -4
- package/src/concepts/CallLogic__.ts +3 -4
- package/src/concepts/EnumItem__.ts +1 -1
- package/src/concepts/Interface__.ts +66 -7
- package/src/concepts/Logic__.ts +3 -3
- package/src/concepts/ProcessElement__.ts +34 -24
- package/src/concepts/Process__.ts +98 -2
- package/src/concepts/SqlQueryComponent__.ts +143 -2
- package/src/concepts/Variable__.ts +0 -1
- package/src/concepts/ViewElement__.ts +12 -20
- package/src/concepts/View__.ts +4 -1
- package/src/concepts/basics/stdlib/index.ts +2 -1
- package/src/concepts/basics/stdlib/nasl.auth.ts +25 -0
- package/src/concepts/basics/stdlib/nasl.io.ts +48 -0
- package/src/concepts/basics/stdlib/nasl.process.ts +98 -0
- package/src/concepts/basics/stdlib/nasl.ui.ts +54 -0
- package/src/concepts/basics/stdlib/nasl.util.ts +2 -2
- package/src/concepts/basics/stdlib/nasl.validation.ts +4 -0
- package/src/enums/KEYWORDS.ts +1 -0
- package/src/generator/genBundleFiles.ts +3 -0
- package/src/server/extendBaseNode.ts +31 -4
- package/src/server/getLogics.ts +43 -14
- package/src/server/getProcesses.ts +47 -21
- package/src/server/naslServer.ts +44 -21
- package/src/server/naslStdlibMap.ts +1 -0
- package/src/server/process2LogicNamespace.ts +27 -21
- package/src/server/translator.ts +35 -8
- package/src/service/storage/init.ts +18 -6
- package/src/templator/genCreateBlock.ts +1 -1
- package/src/templator/genCurdEditMultipleKeyBlock.ts +4 -7
- package/src/templator/genCurdMultipleKeyBlock.ts +4 -4
- package/src/templator/genEditTableBlock.ts +5 -3
- package/src/templator/genGetBlock.ts +3 -2
- package/src/templator/genTableBlock.ts +4 -2
- package/src/templator/genUpdateBlock.ts +1 -1
- package/src/automate/template/process.js +0 -11810
|
@@ -21,6 +21,7 @@ export async function genBundleFiles(app: App,
|
|
|
21
21
|
lowcodeDomain: string;
|
|
22
22
|
envLcpDomain: any,
|
|
23
23
|
envNuimsDomain: any,
|
|
24
|
+
tenantType: any,
|
|
24
25
|
appid: string;
|
|
25
26
|
}) {
|
|
26
27
|
const fnNuimsDomain = config?.envNuimsDomain?.[config?.env] || config?.nuimsDomain;
|
|
@@ -309,6 +310,7 @@ export async function genBundleFiles(app: App,
|
|
|
309
310
|
domainName: app.name,
|
|
310
311
|
nuimsDomain: fnNuimsDomain,
|
|
311
312
|
envNuimsDomain: config.envNuimsDomain,
|
|
313
|
+
tenantType: config.tenantType,
|
|
312
314
|
extendedConfig: config.extendedConfig,
|
|
313
315
|
envConfig: {
|
|
314
316
|
lowcodeDomain: fnLowcodeDomain,
|
|
@@ -320,6 +322,7 @@ export async function genBundleFiles(app: App,
|
|
|
320
322
|
tenant: config.tenant,
|
|
321
323
|
env: config.env,
|
|
322
324
|
hasUserCenter: app.hasUserCenter,
|
|
325
|
+
hasAuth: app.hasAuth,
|
|
323
326
|
authResourcePaths,
|
|
324
327
|
baseResourcePaths,
|
|
325
328
|
}, null, 4);
|
|
@@ -37,11 +37,19 @@ BaseNode.prototype.findReadOnlyLogicUsage = function () {
|
|
|
37
37
|
const sourceMap = this.parentNode.sourceMap;
|
|
38
38
|
for (const item of sourceMap) {
|
|
39
39
|
const logic = item[0] as Logic;
|
|
40
|
-
if (logic.
|
|
40
|
+
if (logic.calleewholeKey && logic.calleewholeKey === (this as Logic).calleewholeKey) {
|
|
41
41
|
targetNode = logic;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
if (!targetNode)
|
|
46
|
+
for (const item of sourceMap) {
|
|
47
|
+
const logic = item[0] as Logic;
|
|
48
|
+
if (logic.getNamespace && logic.getNamespace() === (this as Logic).getNamespace()) {
|
|
49
|
+
targetNode = logic;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
try {
|
|
@@ -198,11 +206,21 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
198
206
|
const find = refsList.find((record) => !record.file.includes(viewPath));
|
|
199
207
|
// 如果没有别的文件的依赖,就直接delete
|
|
200
208
|
if (!find) {
|
|
201
|
-
|
|
209
|
+
if (node instanceof Process) {
|
|
210
|
+
const App = this.rootNode;
|
|
211
|
+
App.emit('collect:start', {
|
|
212
|
+
actionMsg: `删除流程${node.name}`,
|
|
213
|
+
});
|
|
214
|
+
await Promise.all(node.elements.map((ele) => ele.isUserTask && ele.cancelBindDelete(true)));
|
|
215
|
+
this.delete();
|
|
216
|
+
App.emit('collect:end');
|
|
217
|
+
} else {
|
|
218
|
+
this.delete();
|
|
219
|
+
}
|
|
202
220
|
return;
|
|
203
221
|
}
|
|
204
222
|
}
|
|
205
|
-
callback = () => {
|
|
223
|
+
callback = async () => {
|
|
206
224
|
// removeParam
|
|
207
225
|
// 跟rename 还不太一样,部分修改依赖修改好的值,然后在下面的修改需要把自己传递进去
|
|
208
226
|
if (node instanceof Param) {
|
|
@@ -284,9 +302,18 @@ BaseNode.prototype.prepareDelete = async function prepareDelete() {
|
|
|
284
302
|
}
|
|
285
303
|
|
|
286
304
|
// 删除页面或者流程,如果上一步没有return 就说明他是有别的引用的,会有引用弹框
|
|
287
|
-
if (node instanceof View
|
|
305
|
+
if (node instanceof View) {
|
|
288
306
|
this.delete();
|
|
289
307
|
}
|
|
308
|
+
if (node instanceof Process) {
|
|
309
|
+
const App = this.rootNode;
|
|
310
|
+
App.emit('collect:start', {
|
|
311
|
+
actionMsg: `删除流程${node.name}`,
|
|
312
|
+
});
|
|
313
|
+
await Promise.all(node.elements.map((ele) => ele.isUserTask && ele.cancelBindDelete(true)));
|
|
314
|
+
this.delete();
|
|
315
|
+
App.emit('collect:end');
|
|
316
|
+
}
|
|
290
317
|
// 其余的都直接调用删除
|
|
291
318
|
// Structure 和 Interface是内部有delete方法
|
|
292
319
|
if (node instanceof Structure || node instanceof Interface) {
|
package/src/server/getLogics.ts
CHANGED
|
@@ -111,6 +111,40 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
|
|
|
111
111
|
result.push(tree);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
const processLogics = stdlibNamespace.findChild('process').logics;
|
|
115
|
+
const processLogicsTree = new Namespace({
|
|
116
|
+
name: 'category',
|
|
117
|
+
path: `process`,
|
|
118
|
+
title: '流程逻辑',
|
|
119
|
+
children: [
|
|
120
|
+
new Namespace({
|
|
121
|
+
name: 'category',
|
|
122
|
+
title: '流程实例',
|
|
123
|
+
logics: processLogics.filter((logic) => logic.name.includes('ProcessInstance')),
|
|
124
|
+
expanded: false,
|
|
125
|
+
}),
|
|
126
|
+
new Namespace({
|
|
127
|
+
name: 'category',
|
|
128
|
+
title: '流程定义',
|
|
129
|
+
logics: processLogics.filter((logic) => logic.name.includes('ProcessDefinition')),
|
|
130
|
+
expanded: false,
|
|
131
|
+
}),
|
|
132
|
+
new Namespace({
|
|
133
|
+
name: 'category',
|
|
134
|
+
title: '任务实例',
|
|
135
|
+
logics: processLogics.filter((logic) => logic.name.includes('TaskInstance') || logic.name.includes('TaskDestination')),
|
|
136
|
+
expanded: false,
|
|
137
|
+
}),
|
|
138
|
+
new Namespace({
|
|
139
|
+
name: 'category',
|
|
140
|
+
title: '任务定义',
|
|
141
|
+
logics: processLogics.filter((logic) => logic.name.includes('TaskDefinition')),
|
|
142
|
+
expanded: false,
|
|
143
|
+
}),
|
|
144
|
+
],
|
|
145
|
+
expanded: false,
|
|
146
|
+
});
|
|
147
|
+
|
|
114
148
|
if (node.view && node.view.logics) {
|
|
115
149
|
// 获取组件逻辑, 获取传入字段的子集
|
|
116
150
|
const elements: Array<ViewElement> = [];
|
|
@@ -148,13 +182,7 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
|
|
|
148
182
|
path: `nasl`,
|
|
149
183
|
title: '系统逻辑',
|
|
150
184
|
children: [
|
|
151
|
-
|
|
152
|
-
name: 'category',
|
|
153
|
-
path: `process`,
|
|
154
|
-
title: '流程逻辑',
|
|
155
|
-
logics: stdlibNamespace.findChild('process').logics,
|
|
156
|
-
expanded: false,
|
|
157
|
-
}),
|
|
185
|
+
processLogicsTree,
|
|
158
186
|
new Namespace({
|
|
159
187
|
name: 'category',
|
|
160
188
|
path: `browser`,
|
|
@@ -176,6 +204,13 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
|
|
|
176
204
|
logics: stdlibNamespace.findChild('configuration').logics,
|
|
177
205
|
expanded: false,
|
|
178
206
|
}),
|
|
207
|
+
new Namespace({
|
|
208
|
+
name: 'category',
|
|
209
|
+
path: `io`,
|
|
210
|
+
title: '文件处理',
|
|
211
|
+
logics: stdlibNamespace.findChild('io').logics,
|
|
212
|
+
expanded: false,
|
|
213
|
+
}),
|
|
179
214
|
],
|
|
180
215
|
expanded: false,
|
|
181
216
|
});
|
|
@@ -192,13 +227,7 @@ export async function getLogics(node: CallLogic | BindEvent, needAllLogic: boole
|
|
|
192
227
|
path: `nasl`,
|
|
193
228
|
title: '系统逻辑',
|
|
194
229
|
children: [
|
|
195
|
-
|
|
196
|
-
name: 'category',
|
|
197
|
-
path: `process`,
|
|
198
|
-
title: '流程逻辑',
|
|
199
|
-
logics: stdlibNamespace.findChild('process').logics,
|
|
200
|
-
expanded: false,
|
|
201
|
-
}),
|
|
230
|
+
processLogicsTree,
|
|
202
231
|
new Namespace({
|
|
203
232
|
name: 'category',
|
|
204
233
|
path: `configuration`,
|
|
@@ -60,25 +60,48 @@ export function constantToParam(v: Constant) {
|
|
|
60
60
|
export function genUserTaskLogic(userTask: ProcessElement) {
|
|
61
61
|
const taskId = userTask.constants.find((p) => p.name === 'taskId');
|
|
62
62
|
const process = userTask.process;
|
|
63
|
-
const l =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
const l = [
|
|
64
|
+
new Logic({
|
|
65
|
+
name: `complete`,
|
|
66
|
+
fake: true,
|
|
67
|
+
params: [constantToParam(taskId), ...userTask.returns.map(returnToParam)],
|
|
68
|
+
body: [],
|
|
69
|
+
returns: [],
|
|
70
|
+
}),
|
|
71
|
+
new Logic({
|
|
72
|
+
name: `reject`,
|
|
73
|
+
fake: true,
|
|
74
|
+
params: [
|
|
75
|
+
new Param({
|
|
76
|
+
name: 'taskId',
|
|
77
|
+
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
78
|
+
}),
|
|
79
|
+
new Param({
|
|
80
|
+
name: 'targetTaskDefinitionId',
|
|
81
|
+
typeAnnotation: TypeAnnotation.createPrimitive('String'),
|
|
82
|
+
}),
|
|
83
|
+
...userTask.returns.map(returnToParam),
|
|
84
|
+
],
|
|
85
|
+
body: [],
|
|
86
|
+
returns: [],
|
|
87
|
+
}),
|
|
88
|
+
];
|
|
89
|
+
if (userTask.type === 'InitiateTask')
|
|
90
|
+
l.pop();
|
|
70
91
|
const path = `app.processes.${process.name}.elements.${userTask.name}.logics`;
|
|
71
|
-
l.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
l.forEach((item) => {
|
|
93
|
+
item.getNamespace = function () {
|
|
94
|
+
return path;
|
|
95
|
+
};
|
|
96
|
+
item.fake = true;
|
|
97
|
+
});
|
|
75
98
|
return l;
|
|
76
99
|
}
|
|
77
100
|
|
|
78
101
|
export function userTask2LogicNamespace(userTask: ProcessElement) {
|
|
79
102
|
const ns = new Namespace({
|
|
80
103
|
name: userTask.name,
|
|
81
|
-
logics: [genUserTaskLogic(userTask)],
|
|
104
|
+
logics: [...genUserTaskLogic(userTask)],
|
|
82
105
|
});
|
|
83
106
|
|
|
84
107
|
return ns;
|
|
@@ -152,7 +175,7 @@ export function travelDown(node: any, callback: (node: any) => void) {
|
|
|
152
175
|
export function syncMemberExpression(elem: ProcessElement | Process, callback: (node: MemberExpression) => void) {
|
|
153
176
|
const process = elem instanceof Process ? elem : elem.process;
|
|
154
177
|
process.elements.forEach((el) => {
|
|
155
|
-
if (el.
|
|
178
|
+
if (el.isUserTask) {
|
|
156
179
|
el.bindAttrs.forEach((attr) => {
|
|
157
180
|
if (attr.name === 'destination') {
|
|
158
181
|
attr.destination.arguments.forEach((arg) => {
|
|
@@ -197,17 +220,18 @@ export function genMemberExpression(path: string) {
|
|
|
197
220
|
m = new MemberExpression({
|
|
198
221
|
object: cv,
|
|
199
222
|
});
|
|
223
|
+
cv.parentKey = 'object';
|
|
200
224
|
cv.parentNode = m;
|
|
201
225
|
} else {
|
|
202
226
|
m.property = cv;
|
|
227
|
+
cv.parentKey = 'property';
|
|
228
|
+
cv.parentNode = m;
|
|
203
229
|
if (arr.length) {
|
|
204
230
|
const tm = new MemberExpression({
|
|
205
231
|
object: m,
|
|
206
232
|
});
|
|
207
233
|
m.parentKey = 'object';
|
|
208
234
|
m.parentNode = tm;
|
|
209
|
-
cv.parentKey = 'property';
|
|
210
|
-
cv.parentNode = tm;
|
|
211
235
|
m = tm;
|
|
212
236
|
}
|
|
213
237
|
}
|
|
@@ -279,7 +303,7 @@ export function getPreviousTask(node: ProcessElement, nodePorcess?: Process) {
|
|
|
279
303
|
if (visitedMap.has(processElem)) {
|
|
280
304
|
return;
|
|
281
305
|
}
|
|
282
|
-
if (processElem !== node && (processElem.
|
|
306
|
+
if (processElem !== node && (processElem.isUserTask || processElem.type === 'AutoTask')) {
|
|
283
307
|
elements.push(processElem);
|
|
284
308
|
}
|
|
285
309
|
visitedMap.set(processElem, true);
|
|
@@ -349,7 +373,7 @@ export function getProcessVariableSuggestions(node: LogicItem, abandonConstant:
|
|
|
349
373
|
processVariables.children.push(scopeVariable);
|
|
350
374
|
}
|
|
351
375
|
|
|
352
|
-
if (processElem.
|
|
376
|
+
if (processElem.isUserTask) {
|
|
353
377
|
// 任务完成时可以拿到该任务的输出参数
|
|
354
378
|
let returns: CompletionProperty[] = [];
|
|
355
379
|
if (node.logic && node.logic.parentNode.name === 'OnClose') {
|
|
@@ -456,14 +480,15 @@ function deduceTypeAnnotation(app: App,
|
|
|
456
480
|
}
|
|
457
481
|
}
|
|
458
482
|
|
|
459
|
-
export function getProcessVariableSuggestionsAll(node: ProcessElement,
|
|
483
|
+
export function getProcessVariableSuggestionsAll(node: ProcessElement, exitConstantId?: Boolean) {
|
|
460
484
|
const processElem = node;
|
|
461
485
|
const process = node.process;
|
|
462
486
|
const app = node.app;
|
|
463
487
|
const elements: ProcessElement[] = getPreviousTask(processElem);
|
|
464
488
|
const prevtasks = elements.map((us) => {
|
|
465
489
|
const returns = us.returns.map((node) => deduceTypeAnnotation(app, node, node.typeAnnotation, [process.name, us.name], []));
|
|
466
|
-
|
|
490
|
+
let constants = us.constants.map((node) => deduceTypeAnnotation(app, node, node.typeAnnotation, [process.name, us.name], []));
|
|
491
|
+
exitConstantId && (constants = constants.filter((constant) => constant.name !== 'taskId'));
|
|
467
492
|
const cp = new CompletionProperty({
|
|
468
493
|
name: us.name,
|
|
469
494
|
value: us.name,
|
|
@@ -478,7 +503,8 @@ export function getProcessVariableSuggestionsAll(node: ProcessElement, exitConst
|
|
|
478
503
|
return cp;
|
|
479
504
|
});
|
|
480
505
|
|
|
481
|
-
|
|
506
|
+
let processContants = process.constants.map((node) => deduceTypeAnnotation(app, node, node.typeAnnotation, [process.name], []));
|
|
507
|
+
exitConstantId && (processContants = processContants.filter((constant) => constant.name !== 'processId'));
|
|
482
508
|
const processVariables = new CompletionProperty({
|
|
483
509
|
name: process.name,
|
|
484
510
|
value: process.name,
|
|
@@ -504,7 +530,7 @@ export function getProcessVariableSuggestionsAll(node: ProcessElement, exitConst
|
|
|
504
530
|
processVariables.children.push(scopeVariable);
|
|
505
531
|
}
|
|
506
532
|
|
|
507
|
-
if (processElem.
|
|
533
|
+
if ((processElem.isUserTask) && !exitConstantId) {
|
|
508
534
|
const scopeVariable = new CompletionProperty({
|
|
509
535
|
name: processElem.name,
|
|
510
536
|
value: processElem.name,
|
package/src/server/naslServer.ts
CHANGED
|
@@ -652,6 +652,20 @@ const naslServer = {
|
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
+
if (fileNode instanceof Logic) {
|
|
656
|
+
fileNode?.sourceMap.forEach((value, node) => {
|
|
657
|
+
// SqlQueryComponent内部返回值类型,如果是嵌套的就需要报错
|
|
658
|
+
if (node instanceof SqlQueryComponent && node.getTypeBanError()) {
|
|
659
|
+
const diagnostic = {
|
|
660
|
+
node,
|
|
661
|
+
severity: 'error',
|
|
662
|
+
message: 'SQL查询:返回类型内部,不支持复杂类型。',
|
|
663
|
+
};
|
|
664
|
+
node.tsErrorDetail = diagnostic;
|
|
665
|
+
diagnostics.push(diagnostic);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
}
|
|
655
669
|
|
|
656
670
|
return diagnostics;
|
|
657
671
|
},
|
|
@@ -1287,11 +1301,6 @@ const naslServer = {
|
|
|
1287
1301
|
if (minRange.node instanceof BindEvent && node instanceof Param) {
|
|
1288
1302
|
return null;
|
|
1289
1303
|
}
|
|
1290
|
-
// 如果是子页面修改
|
|
1291
|
-
// 父页面引起子页面改名,就可以不改了,自动同步
|
|
1292
|
-
if (minRange.node instanceof View && node instanceof View && minRange.node !== node) {
|
|
1293
|
-
return null;
|
|
1294
|
-
}
|
|
1295
1304
|
/**
|
|
1296
1305
|
* 理论上 logic setName只能自己触发,别的地方查到引用都不用重命名
|
|
1297
1306
|
* 流程改名不触发Logic改名
|
|
@@ -1305,23 +1314,37 @@ const naslServer = {
|
|
|
1305
1314
|
if (node instanceof Param && minRange.node instanceof Interface) {
|
|
1306
1315
|
return null;
|
|
1307
1316
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1317
|
+
// 如果是被影响的是页面
|
|
1318
|
+
if (minRange.node instanceof View) {
|
|
1319
|
+
if (node instanceof View) {
|
|
1320
|
+
// 如果是子页面修改
|
|
1321
|
+
// 父页面引起子页面改名,就可以不改了,自动同步
|
|
1322
|
+
if (minRange.node !== node) {
|
|
1323
|
+
return null;
|
|
1324
|
+
}
|
|
1325
|
+
} else if (!(node instanceof Role)) {
|
|
1326
|
+
/**
|
|
1327
|
+
* 无论是逻辑还是实体中的key,修改都不应该触发
|
|
1328
|
+
* 理论上除了组件自己改名可以触发
|
|
1329
|
+
* 下面这里 不属于Role是因为上面代码里有, 不符合 规范 的role改名存在所以先保留
|
|
1330
|
+
*/
|
|
1331
|
+
return null;
|
|
1332
|
+
}
|
|
1316
1333
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1334
|
+
// 如果是被影响的是页面元素
|
|
1335
|
+
if (minRange.node instanceof ViewElement) {
|
|
1336
|
+
if (node instanceof ViewElement) {
|
|
1337
|
+
if (minRange.node !== node) {
|
|
1338
|
+
return null;
|
|
1339
|
+
}
|
|
1340
|
+
} else if (!(node instanceof Role)) {
|
|
1341
|
+
/**
|
|
1342
|
+
* 无论是逻辑还是实体中的key,修改都不应该触发
|
|
1343
|
+
* 理论上除了组件自己改名可以触发
|
|
1344
|
+
* 下面这里 不属于Role是因为上面代码里有, 不符合 规范 的role改名存在所以先保留
|
|
1345
|
+
*/
|
|
1346
|
+
return null;
|
|
1347
|
+
}
|
|
1325
1348
|
}
|
|
1326
1349
|
} else {
|
|
1327
1350
|
console.log('没找到节点需要排查');
|
|
@@ -12,6 +12,7 @@ const naslStdlibMap: any = {
|
|
|
12
12
|
'nasl.validation.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.validation.ts').default,
|
|
13
13
|
'nasl.process.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.process.ts').default,
|
|
14
14
|
'nasl.logging.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.logging.ts').default,
|
|
15
|
+
'nasl.io.ts': require('!!raw-loader!../../../file-storage/data/stdlib/nasl.io.ts').default,
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export default naslStdlibMap;
|
|
@@ -9,22 +9,25 @@ import { genLaunchProcess, genUserTaskLogic } from './getProcesses';
|
|
|
9
9
|
export function process2LogicNamespace(process: Process) {
|
|
10
10
|
const children: Array<Namespace> = [];
|
|
11
11
|
process.elements.forEach((e) => {
|
|
12
|
-
if (e.
|
|
12
|
+
if (e.isUserTask) {
|
|
13
13
|
const l = genUserTaskLogic(e);
|
|
14
14
|
const ns = new Namespace({
|
|
15
15
|
name: e.name,
|
|
16
|
-
logics: [l],
|
|
17
|
-
originConcept:
|
|
16
|
+
logics: [...l],
|
|
17
|
+
originConcept: e.type,
|
|
18
18
|
});
|
|
19
19
|
// 与process 中 toEmbededTS 所设置的 namespace 相关
|
|
20
20
|
const path = `app.processes.${process.name}.elements.${e.name}.logics`;
|
|
21
|
-
l.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
l.forEach((k) => {
|
|
22
|
+
k.getNamespace = function () {
|
|
23
|
+
return path;
|
|
24
|
+
};
|
|
25
|
+
const api = `/api/${process.name}/${e.name}/${k.name}`;
|
|
26
|
+
k.getPath = function () {
|
|
27
|
+
return api;
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
|
|
28
31
|
children.push(ns);
|
|
29
32
|
ns.path = `app.processes.${process.name}.elements.${e.name}`;
|
|
30
33
|
ns.expanded = true;
|
|
@@ -73,23 +76,26 @@ export function processToTreeFragment(process: Process) {
|
|
|
73
76
|
elements: [],
|
|
74
77
|
};
|
|
75
78
|
process.elements.forEach((e) => {
|
|
76
|
-
if (e.
|
|
79
|
+
if (e.isUserTask) {
|
|
77
80
|
const l = genUserTaskLogic(e);
|
|
78
|
-
l.
|
|
79
|
-
|
|
80
|
-
p
|
|
81
|
+
l.forEach((k) => {
|
|
82
|
+
k.parentKey = 'readonly';
|
|
83
|
+
k.params.forEach((p) => {
|
|
84
|
+
p.readonly = true;
|
|
85
|
+
});
|
|
86
|
+
k.parentNode = process;
|
|
87
|
+
// 与process 中 toEmbededTS 所设置的 namespace 相关
|
|
88
|
+
const path = `app.processes.${process.name}.elements.${e.name}.logics`;
|
|
89
|
+
k.getNamespace = function () {
|
|
90
|
+
return path;
|
|
91
|
+
};
|
|
81
92
|
});
|
|
82
|
-
|
|
83
|
-
// 与process 中 toEmbededTS 所设置的 namespace 相关
|
|
84
|
-
const path = `app.processes.${process.name}.elements.${e.name}.logics`;
|
|
85
|
-
l.getNamespace = function () {
|
|
86
|
-
return path;
|
|
87
|
-
};
|
|
93
|
+
|
|
88
94
|
fragment.elements.push({
|
|
89
95
|
level: 'processTreeElementFragment',
|
|
90
96
|
id: e.id,
|
|
91
97
|
name: e.name,
|
|
92
|
-
logics: [l],
|
|
98
|
+
logics: [...l],
|
|
93
99
|
});
|
|
94
100
|
}
|
|
95
101
|
});
|
package/src/server/translator.ts
CHANGED
|
@@ -86,7 +86,7 @@ function transformType(tsType: string): string {
|
|
|
86
86
|
return '拓展模块';
|
|
87
87
|
else if (tsType === 'Promise<void>')
|
|
88
88
|
return '未知类型';
|
|
89
|
-
else if (tsType.startsWith('{') && tsType.endsWith('}'))
|
|
89
|
+
else if (tsType.startsWith('{') && tsType.endsWith('}') || tsType.startsWith('{') && tsType.endsWith('...'))
|
|
90
90
|
return '当前节点';
|
|
91
91
|
else if (tsType.endsWith('[]')) {
|
|
92
92
|
return `List<${transformType(tsType.slice(0, -2))}>`;
|
|
@@ -226,9 +226,13 @@ const TS_RULES: Array<{
|
|
|
226
226
|
re: /Cannot find name '__(?:EMPTY_AGGREGATE_ALIAS)__'/,
|
|
227
227
|
result: '数据查询:聚合函数别名不能为空。',
|
|
228
228
|
},
|
|
229
|
+
{
|
|
230
|
+
re: /Cannot find name '__(?:SQL_GRAMMAR_ERROR)__'/,
|
|
231
|
+
result: 'SQL查询:语句可能有异常。',
|
|
232
|
+
},
|
|
229
233
|
{
|
|
230
234
|
re: /Cannot find name '__UsersEmpty__'./,
|
|
231
|
-
result: '
|
|
235
|
+
result: '任务完成人为空',
|
|
232
236
|
},
|
|
233
237
|
{
|
|
234
238
|
re: /No value exists in scope for the shorthand property '__(?:IDENTIFIER|LEFT|RIGHT)__'. Either declare one or provide an initializer./,
|
|
@@ -307,7 +311,7 @@ const TS_RULES: Array<{
|
|
|
307
311
|
},
|
|
308
312
|
{
|
|
309
313
|
re: /'__destinationEmpty__' is declared but its value is never read./,
|
|
310
|
-
result: '
|
|
314
|
+
result: '任务未关联页面',
|
|
311
315
|
},
|
|
312
316
|
];
|
|
313
317
|
|
|
@@ -385,11 +389,24 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
385
389
|
return null;
|
|
386
390
|
}
|
|
387
391
|
|
|
388
|
-
if (node instanceof ProcessElement && (node.
|
|
392
|
+
if (node instanceof ProcessElement && (node.isUserTask || node.type === 'AutoTask' || node.type === 'StartNoneEvent')) {
|
|
389
393
|
const reg = /Expected (.+?) arguments, but got (.+?)./.exec(text);
|
|
390
|
-
let u
|
|
391
|
-
|
|
392
|
-
|
|
394
|
+
let u;
|
|
395
|
+
switch (node.type) {
|
|
396
|
+
case 'UserTask':
|
|
397
|
+
u = '用户任务';
|
|
398
|
+
break;
|
|
399
|
+
case 'AutoTask':
|
|
400
|
+
u = '自动任务';
|
|
401
|
+
break;
|
|
402
|
+
case 'ApprovalTask':
|
|
403
|
+
u = '审批任务';
|
|
404
|
+
break;
|
|
405
|
+
case 'InitiateTask':
|
|
406
|
+
u = '发起任务';
|
|
407
|
+
break;
|
|
408
|
+
default:
|
|
409
|
+
u = '任务';
|
|
393
410
|
}
|
|
394
411
|
if (reg[2] === '0') {
|
|
395
412
|
tsErrorDetail.message = `${u}出口顺序流个数不能是0`;
|
|
@@ -480,9 +497,19 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
|
|
|
480
497
|
tsErrorDetail.message = '调用逻辑:参数不能为空!';
|
|
481
498
|
} else if (node instanceof ProcessOutcome || node instanceof Function) {
|
|
482
499
|
tsErrorDetail.message = (node as any).constructor.nodeTitle + ':不能为空!';
|
|
483
|
-
} else if (node instanceof Argument
|
|
500
|
+
} else if (node instanceof Argument) {
|
|
501
|
+
let str = tsErrorDetail.message;
|
|
502
|
+
str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
|
|
503
|
+
tsErrorDetail.message = str;
|
|
504
|
+
} else if (node instanceof TypeAnnotation) {
|
|
505
|
+
// 如果是TypeAnnotation 嵌套TypeAnnotation,就往上冒,多是那种T嵌套的
|
|
484
506
|
let str = tsErrorDetail.message;
|
|
507
|
+
// TypeAnnotation要冒泡到最上面
|
|
508
|
+
while (node.parentNode && node.parentNode instanceof TypeAnnotation) {
|
|
509
|
+
node = node.parentNode;
|
|
510
|
+
}
|
|
485
511
|
str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
|
|
512
|
+
|
|
486
513
|
tsErrorDetail.message = str;
|
|
487
514
|
} else if (node instanceof Identifier) {
|
|
488
515
|
// 根据父级内容推断当前缺少啥
|
|
@@ -80,12 +80,30 @@ async function doAction(app: any, actionItem: any) {
|
|
|
80
80
|
let hasBackEnd = false;
|
|
81
81
|
const actionList: any[] = [];
|
|
82
82
|
const { list, actionMsg, action } = actionItem || {};
|
|
83
|
+
const itemloop = (_i: LogicItem, app: any, diffArr: string[]) => {
|
|
84
|
+
const _l = getStatement(_i, app, diffArr);
|
|
85
|
+
if (_l.length) {
|
|
86
|
+
_l.map((_ii: LogicItem) => itemloop(_ii, app, diffArr));
|
|
87
|
+
}
|
|
88
|
+
};
|
|
83
89
|
const loopEle = (view: View | ViewElement, checkAuth: boolean) => {
|
|
84
90
|
if (view instanceof View) {
|
|
85
91
|
view?.elements?.forEach((item) => loopEle(item, checkAuth));
|
|
86
92
|
}
|
|
87
93
|
view?.children?.forEach((item) => loopEle(item, checkAuth));
|
|
88
94
|
if (view instanceof ViewElement) {
|
|
95
|
+
if (view.bindEvents.length) {
|
|
96
|
+
const diffArr: string[] = [];
|
|
97
|
+
view.bindEvents.forEach((bindEvent) => {
|
|
98
|
+
bindEvent.logics.forEach((logic) => {
|
|
99
|
+
logic.body.forEach((logicItem) => itemloop(logicItem, app, diffArr));
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
const result = diffArr.filter((item) => item.startsWith('app') || item.startsWith('extensions'));
|
|
103
|
+
if (result.length) {
|
|
104
|
+
hasBackEnd = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
89
107
|
if (view.tag === 'u-uploader' || view.tag === 'van-uploader') {
|
|
90
108
|
const bute = view?.bindAttrs.find((item) => item.name === 'url');
|
|
91
109
|
if (checkAuth) {
|
|
@@ -112,12 +130,6 @@ async function doAction(app: any, actionItem: any) {
|
|
|
112
130
|
) {
|
|
113
131
|
hasBackEnd = true;
|
|
114
132
|
}
|
|
115
|
-
const itemloop = (_i: LogicItem, app: any, diffArr: string[]) => {
|
|
116
|
-
const _l = getStatement(_i, app, diffArr);
|
|
117
|
-
if (_l.length) {
|
|
118
|
-
_l.map((_ii: LogicItem) => itemloop(_ii, app, diffArr));
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
133
|
if (emitTarget.concept === 'Logic') {
|
|
122
134
|
const diffArr: string[] = [];
|
|
123
135
|
if (emitTarget.body.length > 2) {
|
|
@@ -34,7 +34,7 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
|
|
|
34
34
|
rules.push('required');
|
|
35
35
|
const rulesStr = rules.join(' | ');
|
|
36
36
|
|
|
37
|
-
let formItem = ` <u-form-item
|
|
37
|
+
let formItem = ` <u-form-item ${required ? ' required' : ''}${rulesStr.length ? ` rules="${rulesStr}"` : ''}><template #label><u-text text="${label}"></u-text></template>\n`;
|
|
38
38
|
|
|
39
39
|
const { typeAnnotation } = property || {};
|
|
40
40
|
const { typeName: propertyTypeName, typeNamespace: propertyTypeNamespace } = typeAnnotation || {};
|