@lcap/nasl 0.3.10-beta.oom4 → 0.3.12-beta
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/service/app/api.js +17 -17
- package/out/service/app/api.js.map +1 -1
- package/out/service/create/errHandles.js +12 -0
- package/out/service/create/errHandles.js.map +1 -1
- package/out/service/create/index.js +5 -0
- package/out/service/create/index.js.map +1 -1
- package/out/service/logic/logic.d.ts +26 -17
- package/out/service/logic/logic.js +6 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/types/app/App.d.ts +9 -0
- package/out/types/app/App.js +25 -1
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/History.js +3 -2
- package/out/types/app/History.js.map +1 -1
- package/out/types/app/Service.d.ts +3 -0
- package/out/types/app/Service.js +14 -6
- package/out/types/app/Service.js.map +1 -1
- package/out/types/cacheData.js.map +1 -1
- package/out/types/common/Vertex.js +2 -1
- package/out/types/common/Vertex.js.map +1 -1
- package/out/types/data/Entity.d.ts +4 -0
- package/out/types/data/Entity.js +8 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/EntityProperty.d.ts +5 -0
- package/out/types/data/EntityProperty.js +16 -0
- package/out/types/data/EntityProperty.js.map +1 -1
- package/out/types/data/GlobalLogicNode.js +8 -1
- package/out/types/data/GlobalLogicNode.js.map +1 -1
- package/out/types/data/dataTypes.js +1 -1
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/genCurdEditTableBlock.d.ts +3 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js +578 -0
- package/out/types/data/genBlock/genCurdEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genEditTableBlock.d.ts +234 -0
- package/out/types/data/genBlock/genEditTableBlock.js +419 -0
- package/out/types/data/genBlock/genEditTableBlock.js.map +1 -0
- package/out/types/data/genBlock/genQueryComponent.d.ts +20 -0
- package/out/types/data/genBlock/genQueryComponent.js +57 -1
- package/out/types/data/genBlock/genQueryComponent.js.map +1 -1
- package/out/types/data/genBlock/genTableBlock.js +9 -5
- package/out/types/data/genBlock/genTableBlock.js.map +1 -1
- package/out/types/data/genBlock/index.d.ts +2 -0
- package/out/types/data/genBlock/index.js +2 -0
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/data/genBlock/utils.d.ts +7 -0
- package/out/types/data/genBlock/utils.js +38 -1
- package/out/types/data/genBlock/utils.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -0
- package/out/types/logic/Logic.js +35 -10
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.js +6 -8
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +5 -13
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/Return.js +3 -11
- package/out/types/logic/Return.js.map +1 -1
- package/out/types/logic/Variable.js +3 -6
- package/out/types/logic/Variable.js.map +1 -1
- package/out/types/logic/translator.js +39 -8
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/Element.d.ts +21 -2
- package/out/types/page/Element.js +86 -5
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/Page.d.ts +4 -0
- package/out/types/page/Page.js +7 -0
- package/out/types/page/Page.js.map +1 -1
- package/out/types/page/View.d.ts +18 -0
- package/out/types/page/View.js +112 -7
- package/out/types/page/View.js.map +1 -1
- package/out/types/page/ViewVariable.js +0 -6
- package/out/types/page/ViewVariable.js.map +1 -1
- package/out/types/process/ProcessParam.js +3 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/out/types/utils/index.d.ts +1 -0
- package/out/types/utils/index.js +16 -7
- package/out/types/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/service/app/api.js +4 -4
- package/src/service/create/errHandles.js +12 -0
- package/src/service/create/index.js +6 -0
- package/src/service/logic/logic.js +6 -0
- package/src/types/app/App.ts +32 -9
- package/src/types/app/History.ts +3 -2
- package/src/types/app/Service.ts +18 -9
- package/src/types/cacheData.ts +7 -7
- package/src/types/common/Vertex.ts +2 -1
- package/src/types/data/Entity.ts +7 -0
- package/src/types/data/EntityProperty.ts +12 -0
- package/src/types/data/GlobalLogicNode.ts +8 -1
- package/src/types/data/dataTypes.ts +1 -1
- package/src/types/data/genBlock/genCurdEditTableBlock.ts +581 -0
- package/src/types/data/genBlock/genEditTableBlock.ts +470 -0
- package/src/types/data/genBlock/genQueryComponent.ts +56 -0
- package/src/types/data/genBlock/genTableBlock.ts +14 -10
- package/src/types/data/genBlock/index.ts +2 -0
- package/src/types/data/genBlock/utils.ts +38 -0
- package/src/types/logic/Logic.ts +45 -17
- package/src/types/logic/LogicItem.ts +8 -11
- package/src/types/logic/Param.ts +25 -35
- package/src/types/logic/Return.ts +18 -26
- package/src/types/logic/Variable.ts +18 -20
- package/src/types/logic/translator.js +41 -10
- package/src/types/page/Element.ts +157 -71
- package/src/types/page/Page.ts +7 -0
- package/src/types/page/View.ts +150 -41
- package/src/types/page/ViewVariable.ts +13 -19
- package/src/types/page/dist/View.js +727 -0
- package/src/types/process/ProcessParam.ts +4 -1
- package/src/types/utils/index.ts +16 -7
- package/out/service/debugger/debugger.d.ts +0 -3
- package/out/service/debugger/debugger.js +0 -95
- package/out/service/debugger/debugger.js.map +0 -1
- package/out/test/units/config.spec.d.ts +0 -1
- package/out/test/units/config.spec.js +0 -12
- package/out/test/units/config.spec.js.map +0 -1
- package/out/types/logic/BreakPoint.d.ts +0 -42
- package/out/types/logic/BreakPoint.js +0 -155
- package/out/types/logic/BreakPoint.js.map +0 -1
- package/out/types/logic/Debugger.d.ts +0 -156
- package/out/types/logic/Debugger.js +0 -912
- package/out/types/logic/Debugger.js.map +0 -1
package/src/types/logic/Logic.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { immutable, excludedInJSON, circular, action } from '../decorators';
|
|
2
|
-
import { config,
|
|
2
|
+
import { config, utils, Vertex, LEVEL_ENUM, Interface, Param, Return, Variable, vertexsMap, typeCheck, ProcessComponent, ProcessInterface, Process, ActionOptions } from '..';
|
|
3
3
|
import { logicService, paramService } from '../../service/logic';
|
|
4
4
|
import View from '../page/View';
|
|
5
5
|
import { ExpressionNode, LogicItem, LogicNode } from './LogicItem';
|
|
@@ -11,14 +11,14 @@ import { BusinessCode } from '../enum';
|
|
|
11
11
|
export function catchFn(logic: Logic) {
|
|
12
12
|
return async (err: any) => {
|
|
13
13
|
const code = err?.code;
|
|
14
|
-
if([BusinessCode.ElementExist, BusinessCode.ElementNotExist].includes(code)) {
|
|
15
|
-
if(logic.interface) {
|
|
14
|
+
if ([BusinessCode.ElementExist, BusinessCode.ElementNotExist].includes(code)) {
|
|
15
|
+
if (logic.interface) {
|
|
16
16
|
await refreshInterfaces();
|
|
17
|
-
} else if(logic.view) {
|
|
17
|
+
} else if (logic.view) {
|
|
18
18
|
await refreshView(logic.view);
|
|
19
19
|
}
|
|
20
|
-
} else if(code === BusinessCode.ParentElementNotExist) {
|
|
21
|
-
if(logic.view) {
|
|
20
|
+
} else if (code === BusinessCode.ParentElementNotExist) { // 父节点不存在。视图添加逻辑,发现视图不存在
|
|
21
|
+
if (logic.view) {
|
|
22
22
|
await refreshPages();
|
|
23
23
|
}
|
|
24
24
|
} else
|
|
@@ -27,7 +27,7 @@ export function catchFn(logic: Logic) {
|
|
|
27
27
|
config.defaultApp?.history.load();
|
|
28
28
|
|
|
29
29
|
throw err;
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -178,12 +178,10 @@ export class Logic extends Vertex {
|
|
|
178
178
|
config.defaultApp?.emit('saving');
|
|
179
179
|
|
|
180
180
|
const body = this.toJSON();
|
|
181
|
-
// body.params.forEach((param: any) => convert2SchemaType(param.schema));
|
|
182
|
-
// body.returns.forEach((ret: any) => convert2SchemaType(ret.schema));
|
|
183
|
-
// body.variables.forEach((variable: any) => convert2SchemaType(variable.schema));
|
|
184
181
|
utils.logger.debug('添加逻辑', body);
|
|
185
182
|
const result: Logic = await logicService.create({
|
|
186
183
|
headers: {
|
|
184
|
+
moduleType: this.moduleType,
|
|
187
185
|
appId: config.defaultApp?.id,
|
|
188
186
|
operationAction: actionOptions?.actionName || 'Logic.create',
|
|
189
187
|
operationDesc: actionOptions?.actionDesc || `添加逻辑"${this.name}"`,
|
|
@@ -230,6 +228,7 @@ export class Logic extends Vertex {
|
|
|
230
228
|
|
|
231
229
|
await logicService.delete({
|
|
232
230
|
headers: {
|
|
231
|
+
moduleType: this.moduleType,
|
|
233
232
|
appId: config.defaultApp?.id,
|
|
234
233
|
operationAction: actionOptions?.actionName || 'Logic.delete',
|
|
235
234
|
operationDesc: actionOptions?.actionDesc || `删除逻辑"${this.name}"`,
|
|
@@ -248,7 +247,6 @@ export class Logic extends Vertex {
|
|
|
248
247
|
typeCheck.delete(node.id);
|
|
249
248
|
});
|
|
250
249
|
|
|
251
|
-
// const index =
|
|
252
250
|
this.destroy();
|
|
253
251
|
if (this.view) {
|
|
254
252
|
this.view.page.service.emit('pageTreeChange');
|
|
@@ -274,8 +272,9 @@ export class Logic extends Vertex {
|
|
|
274
272
|
|
|
275
273
|
const body = this.toPlainJSON();
|
|
276
274
|
utils.logger.debug('修改逻辑', body);
|
|
277
|
-
|
|
275
|
+
await logicService.update({
|
|
278
276
|
headers: {
|
|
277
|
+
moduleType: this.moduleType,
|
|
279
278
|
appId: config.defaultApp?.id,
|
|
280
279
|
operationAction: actionOptions?.actionName || 'Logic.update',
|
|
281
280
|
operationDesc: actionOptions?.actionDesc || `修改逻辑"${this.name}"`,
|
|
@@ -288,6 +287,35 @@ export class Logic extends Vertex {
|
|
|
288
287
|
config.defaultApp?.emit('saved');
|
|
289
288
|
return this;
|
|
290
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* 更新所有调用了此Logic的LogicNode
|
|
292
|
+
*/
|
|
293
|
+
async callLogicUpdate(actionOptions?: ActionOptions) {
|
|
294
|
+
config.defaultApp?.emit('saving');
|
|
295
|
+
|
|
296
|
+
const body = this.toPlainJSON();
|
|
297
|
+
body.params = this.params;
|
|
298
|
+
const result = await logicService.callLogicUpdate({
|
|
299
|
+
headers: {
|
|
300
|
+
appId: config.defaultApp?.id,
|
|
301
|
+
operationAction: actionOptions?.actionName || 'Logic.callLogicUpdate',
|
|
302
|
+
operationDesc: actionOptions?.actionDesc || `修改调用逻辑"${this.name}"`,
|
|
303
|
+
},
|
|
304
|
+
body,
|
|
305
|
+
}).catch((err: Error) => console.log(err)); // 报错不应影响参数的添加流程
|
|
306
|
+
|
|
307
|
+
(result || []).forEach(async (item: LogicNode) => {
|
|
308
|
+
if (vertexsMap.has(item.id)) {
|
|
309
|
+
const logicNode = vertexsMap.get(item.id) as LogicNode;
|
|
310
|
+
await logicNode.logic.load();
|
|
311
|
+
await logicNode.checkType();
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// await config.defaultApp?.history.load();
|
|
316
|
+
config.defaultApp?.emit('saved');
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
291
319
|
/**
|
|
292
320
|
* 设置逻辑名称
|
|
293
321
|
*/
|
|
@@ -328,7 +356,7 @@ export class Logic extends Vertex {
|
|
|
328
356
|
/**
|
|
329
357
|
* 按当前 id 加载逻辑数据
|
|
330
358
|
*/
|
|
331
|
-
|
|
359
|
+
load() {
|
|
332
360
|
if (!this.id)
|
|
333
361
|
return;
|
|
334
362
|
|
|
@@ -364,6 +392,10 @@ export class Logic extends Vertex {
|
|
|
364
392
|
});
|
|
365
393
|
|
|
366
394
|
const results = await paramService.addList({
|
|
395
|
+
headers: {
|
|
396
|
+
moduleType: this.moduleType,
|
|
397
|
+
appId: config.defaultApp?.id,
|
|
398
|
+
},
|
|
367
399
|
body,
|
|
368
400
|
});
|
|
369
401
|
params.forEach((param, index) => param.pick(results[index], ['id']));
|
|
@@ -377,10 +409,6 @@ export class Logic extends Vertex {
|
|
|
377
409
|
if (isPlainObject(item)) {
|
|
378
410
|
item = LogicItem.from(item, this, null);
|
|
379
411
|
}
|
|
380
|
-
// if (!this.children.includes(child)) {
|
|
381
|
-
// const index = child._posIndex === undefined ? this.children.length : child._posIndex;
|
|
382
|
-
// this.children.splice(index, 0, child);
|
|
383
|
-
// }
|
|
384
412
|
const parent = item.parentAttr ? vertexsMap.get(item.parentId) as LogicItem : undefined;
|
|
385
413
|
return item.create({
|
|
386
414
|
parent,
|
|
@@ -448,6 +448,7 @@ export class LogicItem extends Vertex {
|
|
|
448
448
|
body.logicId = this.logic && this.logic.id;
|
|
449
449
|
result = await logicService.addItem({
|
|
450
450
|
headers: {
|
|
451
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
451
452
|
appId: config.defaultApp?.id,
|
|
452
453
|
serviceId: this.logic?.interface?.serviceId,
|
|
453
454
|
operationAction: 'LogicItem.create',
|
|
@@ -548,8 +549,9 @@ export class LogicItem extends Vertex {
|
|
|
548
549
|
if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
|
|
549
550
|
utils.logger.debug(`在该逻辑节点的属性"${parentAttr}"上插入一个节点"`, body);
|
|
550
551
|
|
|
551
|
-
|
|
552
|
+
await logicService.moveItem({
|
|
552
553
|
headers: {
|
|
554
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
553
555
|
appId: config.defaultApp?.id,
|
|
554
556
|
operationAction: 'LogicItem.move',
|
|
555
557
|
operationDesc: actionOptions?.actionDesc || `移动逻辑项"${this.label || this.type}"`,
|
|
@@ -600,7 +602,7 @@ export class LogicItem extends Vertex {
|
|
|
600
602
|
await config.defaultApp?.history.load(actionOptions?.actionMode !== ACTION_MODE.undoRedo && {
|
|
601
603
|
operationAction: 'LogicItem.move',
|
|
602
604
|
operationBeforeImage: null,
|
|
603
|
-
operationAfterImage: null,
|
|
605
|
+
operationAfterImage: null,
|
|
604
606
|
operationDesc: `移动逻辑项"${this.label || this.type}"`,
|
|
605
607
|
});
|
|
606
608
|
config.defaultApp?.emit('saved');
|
|
@@ -805,11 +807,11 @@ export class LogicItem extends Vertex {
|
|
|
805
807
|
|
|
806
808
|
await logicService.removeItem({
|
|
807
809
|
headers: {
|
|
810
|
+
moduleType: this.logic?.moduleType,
|
|
808
811
|
appId: config.defaultApp?.id,
|
|
809
812
|
serviceId: this.logic?.interface?.serviceId,
|
|
810
813
|
operationAction: 'LogicItem.delete',
|
|
811
814
|
operationDesc: `删除逻辑项"${this.label || this.type}"`,
|
|
812
|
-
|
|
813
815
|
},
|
|
814
816
|
body,
|
|
815
817
|
}).catch(catchFn(this.logic));
|
|
@@ -818,7 +820,7 @@ export class LogicItem extends Vertex {
|
|
|
818
820
|
|
|
819
821
|
if (this.id) {
|
|
820
822
|
typeCheck.delete(this.id);
|
|
821
|
-
this.logic
|
|
823
|
+
this.logic?.interface?.service?.syncStructures(); // 处理 CallQueryComponent 嵌套的情形
|
|
822
824
|
|
|
823
825
|
const parent: LogicItem = this.parent;
|
|
824
826
|
if (parent && parent.checkType) {
|
|
@@ -878,7 +880,6 @@ export class LogicItem extends Vertex {
|
|
|
878
880
|
}
|
|
879
881
|
this.assign(source);
|
|
880
882
|
}
|
|
881
|
-
// const body = this.toPlainJSON();
|
|
882
883
|
const body = this.toJSON();
|
|
883
884
|
|
|
884
885
|
body.params = (this as any).params && JSON.parse(JSON.stringify((this as any).params));
|
|
@@ -897,6 +898,7 @@ export class LogicItem extends Vertex {
|
|
|
897
898
|
if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
|
|
898
899
|
const result = await logicService.updateItem({
|
|
899
900
|
headers: {
|
|
901
|
+
moduleType: this.logic.moduleType,
|
|
900
902
|
appId: config.defaultApp?.id,
|
|
901
903
|
operationAction: 'LogicItem.update',
|
|
902
904
|
operationDesc: `修改逻辑项"${this.label || this.type}"`,
|
|
@@ -904,7 +906,6 @@ export class LogicItem extends Vertex {
|
|
|
904
906
|
},
|
|
905
907
|
body,
|
|
906
908
|
}).catch(catchFn(this.logic));
|
|
907
|
-
// this.deepPick(result, ['id', 'parentId', 'parentAttr']);
|
|
908
909
|
|
|
909
910
|
// 合并params里的id
|
|
910
911
|
if (body.params && body.params.length) {
|
|
@@ -924,7 +925,6 @@ export class LogicItem extends Vertex {
|
|
|
924
925
|
let eachSchema = getSchemaOfExpressionNode(each);
|
|
925
926
|
if (eachSchema) {
|
|
926
927
|
eachSchema = eachSchema.schema || eachSchema;
|
|
927
|
-
// eachSchema = convert2SchemaType(eachSchema);
|
|
928
928
|
(item as any).schema = eachSchema.items; // 兼容老的items形式
|
|
929
929
|
if (eachSchema.type === 'genericType') {
|
|
930
930
|
(item as any).schema = eachSchema.typeInstantiation.typeParams[0].typeParamValue;
|
|
@@ -945,7 +945,7 @@ export class LogicItem extends Vertex {
|
|
|
945
945
|
|
|
946
946
|
await config.defaultApp?.history.load(actionOptions?.actionMode !== ACTION_MODE.undoRedo && {
|
|
947
947
|
operationAction: 'LogicItem.update',
|
|
948
|
-
operationBeforeImage: null,
|
|
948
|
+
operationBeforeImage: null,
|
|
949
949
|
operationAfterImage: null,
|
|
950
950
|
operationDesc: `修改逻辑项"${this.label || this.type}"`,
|
|
951
951
|
});
|
|
@@ -1082,7 +1082,6 @@ export class LogicItem extends Vertex {
|
|
|
1082
1082
|
if (!typeCheckResult || !logicItem || typeof typeCheckResult !== 'object')
|
|
1083
1083
|
return;
|
|
1084
1084
|
|
|
1085
|
-
// if(logicItem.id === typeCheckResult.id)
|
|
1086
1085
|
logicItem.typeCheckNote = typeCheckResult.typeCheckNote;
|
|
1087
1086
|
|
|
1088
1087
|
for (const [key, object] of Object.entries(typeCheckResult)) {
|
|
@@ -1220,8 +1219,6 @@ export class LogicNode extends LogicItem {
|
|
|
1220
1219
|
const hasInstantiated = source && source.id && vertexsMap.get(source.id) instanceof LogicNode;
|
|
1221
1220
|
if (hasInstantiated) {
|
|
1222
1221
|
console.warn(`LogicNode (${source.id}) 多次实例化`);
|
|
1223
|
-
// Object.assign(vertexsMap.get(source.id), source);
|
|
1224
|
-
// return vertexsMap.get(source.id) as LogicNode;
|
|
1225
1222
|
}
|
|
1226
1223
|
|
|
1227
1224
|
source && this.assign(source);
|
package/src/types/logic/Param.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { immutable,
|
|
2
|
-
import { config,
|
|
1
|
+
import { immutable, action } from '../decorators';
|
|
2
|
+
import { config, utils, LEVEL_ENUM, Vertex, Logic, Schema, BaseVariable, ActionOptions, Interface } from '..';
|
|
3
3
|
import { paramService } from '../../service/logic';
|
|
4
|
-
import { convert2RefType
|
|
4
|
+
import { convert2RefType } from '../data/dataTypeUtils';
|
|
5
5
|
import { getBasicTypeDefaultValue } from '../data/basicTypes';
|
|
6
6
|
import { schemaService } from '../../service/common';
|
|
7
7
|
import { refreshLogic, refreshInterfaces, refreshView } from '../cache';
|
|
@@ -11,21 +11,19 @@ export function catchFn(logic: Logic) {
|
|
|
11
11
|
return async (err: any) => {
|
|
12
12
|
const code = err?.code;
|
|
13
13
|
// 节点已存在; 节点不存在
|
|
14
|
-
if([BusinessCode.ElementExist, BusinessCode.ElementNotExist].includes(code)) {
|
|
14
|
+
if ([BusinessCode.ElementExist, BusinessCode.ElementNotExist].includes(code)) {
|
|
15
15
|
await refreshLogic(logic);
|
|
16
|
-
} else if(code === BusinessCode.ParentElementNotExist) {
|
|
17
|
-
if(logic.interface) {
|
|
16
|
+
} else if (code === BusinessCode.ParentElementNotExist) { // 父节点不存在,即逻辑不存在
|
|
17
|
+
if (logic.interface) {
|
|
18
18
|
await refreshInterfaces();
|
|
19
|
-
} else if(logic.view) {
|
|
19
|
+
} else if (logic.view) {
|
|
20
20
|
await refreshView(logic.view);
|
|
21
21
|
}
|
|
22
22
|
} else
|
|
23
23
|
config.defaultApp?.emit('saved', err);
|
|
24
|
-
|
|
25
24
|
config.defaultApp?.history.load();
|
|
26
|
-
|
|
27
25
|
throw err;
|
|
28
|
-
}
|
|
26
|
+
};
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
/**
|
|
@@ -73,23 +71,21 @@ export class Param extends BaseVariable {
|
|
|
73
71
|
config.defaultApp?.emit('saving');
|
|
74
72
|
|
|
75
73
|
const body = this.toJSON();
|
|
76
|
-
// convert2SchemaType(body.schema);
|
|
77
74
|
body._posIndex = this.logic.params.indexOf(this);
|
|
78
75
|
utils.logger.debug('添加逻辑输入参数', body);
|
|
79
76
|
const result: Param = await paramService.create({
|
|
80
77
|
headers: {
|
|
78
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
81
79
|
appId: config.defaultApp?.id,
|
|
82
80
|
operationAction: actionOptions?.actionName || 'Param.create',
|
|
83
81
|
operationDesc: actionOptions?.actionDesc || `添加逻辑"${this.logic.name}"输入参数"${this.name}"`,
|
|
84
82
|
},
|
|
85
83
|
body,
|
|
86
84
|
}).catch(catchFn(this.logic));
|
|
87
|
-
// convert2RefType(result.schema);
|
|
88
85
|
this.deepPick(result, ['id']);
|
|
89
86
|
this.assign({ code: this.genCode() });
|
|
90
87
|
if (this.logic.interface) {
|
|
91
88
|
const interfaceItem = Vertex.getVertexByRef(this.logic.interface.id) as Interface;
|
|
92
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
93
89
|
interfaceItem.setParamAndReturn();
|
|
94
90
|
} else if (this.logic.view) {
|
|
95
91
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -98,6 +94,9 @@ export class Param extends BaseVariable {
|
|
|
98
94
|
|
|
99
95
|
await config.defaultApp?.history.load();
|
|
100
96
|
config.defaultApp?.emit('saved');
|
|
97
|
+
|
|
98
|
+
// 更新所有调用此Logic的LogicItem
|
|
99
|
+
// await this.logic.callLogicUpdate();
|
|
101
100
|
return this;
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
@@ -108,24 +107,24 @@ export class Param extends BaseVariable {
|
|
|
108
107
|
config.defaultApp?.emit('saving');
|
|
109
108
|
|
|
110
109
|
if (this.id) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
110
|
+
await paramService.delete({
|
|
111
|
+
headers: {
|
|
112
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
113
|
+
appId: config.defaultApp?.id,
|
|
114
|
+
operationAction: actionOptions?.actionName || 'Param.create',
|
|
115
|
+
operationDesc: actionOptions?.actionDesc || `删除逻辑"${this.logic.name}"输入参数"${this.name}"`,
|
|
116
|
+
},
|
|
117
|
+
query: {
|
|
118
|
+
loValId: this.id,
|
|
119
|
+
logicId: this.logic.id,
|
|
120
|
+
},
|
|
121
|
+
}).catch(catchFn(this.logic));
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
const index = this.logic.params.indexOf(this);
|
|
125
125
|
~index && this.logic.params.splice(index, 1);
|
|
126
126
|
this.destroy();
|
|
127
127
|
if (this.logic.interface) {
|
|
128
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
129
128
|
this.logic.interface.setParamAndReturn();
|
|
130
129
|
} else if (this.logic.view) {
|
|
131
130
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -142,10 +141,10 @@ export class Param extends BaseVariable {
|
|
|
142
141
|
config.defaultApp?.emit('saving');
|
|
143
142
|
|
|
144
143
|
const body = this.toJSON();
|
|
145
|
-
// convert2SchemaType(body.schema);
|
|
146
144
|
utils.logger.debug('修改逻辑输入参数', body);
|
|
147
145
|
const result = await paramService.update({
|
|
148
146
|
headers: {
|
|
147
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
149
148
|
appId: config.defaultApp?.id,
|
|
150
149
|
operationAction: actionOptions?.actionName || 'Param.update',
|
|
151
150
|
operationDesc: actionOptions?.actionDesc || `修改逻辑输入参数"${this.name}"`,
|
|
@@ -153,9 +152,6 @@ export class Param extends BaseVariable {
|
|
|
153
152
|
body,
|
|
154
153
|
}).catch(catchFn(this.logic));
|
|
155
154
|
this.schema.id = result.schema.id;
|
|
156
|
-
// convert2RefType(result.schema);
|
|
157
|
-
// this.plainAssign(result);
|
|
158
|
-
|
|
159
155
|
await then?.();
|
|
160
156
|
await config.defaultApp?.history.load();
|
|
161
157
|
config.defaultApp?.emit('saved');
|
|
@@ -174,7 +170,6 @@ export class Param extends BaseVariable {
|
|
|
174
170
|
});
|
|
175
171
|
|
|
176
172
|
if (this.logic.interface) {
|
|
177
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
178
173
|
this.logic.interface.setParamAndReturn();
|
|
179
174
|
} else if (this.logic.view) {
|
|
180
175
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -231,7 +226,6 @@ export class Param extends BaseVariable {
|
|
|
231
226
|
typeInstantiation: undefined,
|
|
232
227
|
});
|
|
233
228
|
Object.assign(this.schema, schema);
|
|
234
|
-
// if (this.defaultValue)
|
|
235
229
|
this.assign({ defaultValue: getBasicTypeDefaultValue() });
|
|
236
230
|
|
|
237
231
|
try {
|
|
@@ -241,7 +235,6 @@ export class Param extends BaseVariable {
|
|
|
241
235
|
this.genSchemaChildren();
|
|
242
236
|
|
|
243
237
|
if (this.logic.interface) {
|
|
244
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
245
238
|
this.logic.interface.setParamAndReturn();
|
|
246
239
|
} else if (this.logic.view) {
|
|
247
240
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -268,7 +261,6 @@ export class Param extends BaseVariable {
|
|
|
268
261
|
this.genSchemaChildren();
|
|
269
262
|
|
|
270
263
|
if (this.logic.interface) {
|
|
271
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
272
264
|
this.logic.interface.setParamAndReturn();
|
|
273
265
|
} else if (this.logic.view) {
|
|
274
266
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -304,7 +296,6 @@ export class Param extends BaseVariable {
|
|
|
304
296
|
});
|
|
305
297
|
|
|
306
298
|
if (this.logic.interface) {
|
|
307
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
308
299
|
this.logic.interface.setParamAndReturn();
|
|
309
300
|
} else if (this.logic.view) {
|
|
310
301
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -323,7 +314,6 @@ export class Param extends BaseVariable {
|
|
|
323
314
|
});
|
|
324
315
|
|
|
325
316
|
if (this.logic.interface) {
|
|
326
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
327
317
|
this.logic.interface.setParamAndReturn();
|
|
328
318
|
} else if (this.logic.view) {
|
|
329
319
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { immutable,
|
|
2
|
-
import { config,
|
|
1
|
+
import { immutable, action } from '../decorators';
|
|
2
|
+
import { config, utils, ActionOptions, LEVEL_ENUM, Logic, Schema, BaseVariable, genRefSchemaChildren } from '..';
|
|
3
3
|
import { paramService } from '../../service/logic';
|
|
4
|
-
import { convert2RefType
|
|
4
|
+
import { convert2RefType } from '../data/dataTypeUtils';
|
|
5
5
|
import { getBasicTypeDefaultValue } from '../data/basicTypes';
|
|
6
6
|
import { schemaService } from '../../service/common';
|
|
7
7
|
import { catchFn } from './Param';
|
|
@@ -40,23 +40,21 @@ export class Return extends BaseVariable {
|
|
|
40
40
|
config.defaultApp?.emit('saving');
|
|
41
41
|
|
|
42
42
|
const body = this.toJSON();
|
|
43
|
-
// convert2SchemaType(body.schema);
|
|
44
43
|
body._posIndex = this.logic.returns.indexOf(this);
|
|
45
44
|
utils.logger.debug('添加逻辑输出参数', body);
|
|
46
45
|
const result: Return = await paramService.create({
|
|
47
46
|
headers: {
|
|
47
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
48
48
|
appId: config.defaultApp?.id,
|
|
49
49
|
operationAction: actionOptions?.actionName || 'Return.create',
|
|
50
50
|
operationDesc: actionOptions?.actionDesc || `添加逻辑"${this.logic.name}"输出参数"${this.name}"`,
|
|
51
51
|
},
|
|
52
52
|
body,
|
|
53
53
|
}).catch(catchFn(this.logic));
|
|
54
|
-
// convert2RefType(result.schema);
|
|
55
54
|
this.deepPick(result, ['id']);
|
|
56
55
|
this.assign({ code: this.genCode() });
|
|
57
56
|
|
|
58
57
|
if (this.logic.interface) {
|
|
59
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
60
58
|
this.logic.interface.setParamAndReturn();
|
|
61
59
|
} else if (this.logic.view) {
|
|
62
60
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -75,24 +73,24 @@ export class Return extends BaseVariable {
|
|
|
75
73
|
config.defaultApp?.emit('saving');
|
|
76
74
|
|
|
77
75
|
if (this.id) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
76
|
+
await paramService.delete({
|
|
77
|
+
headers: {
|
|
78
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
79
|
+
appId: config.defaultApp?.id,
|
|
80
|
+
operationAction: actionOptions?.actionName || 'Return.create',
|
|
81
|
+
operationDesc: `删除逻辑"${this.logic.name}"输出参数"${this.name}"`,
|
|
82
|
+
},
|
|
83
|
+
query: {
|
|
84
|
+
loValId: this.id,
|
|
85
|
+
logicId: this.logic.id,
|
|
86
|
+
},
|
|
87
|
+
}).catch(catchFn(this.logic));
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
const index = this.logic.returns.indexOf(this);
|
|
92
91
|
~index && this.logic.returns.splice(index, 1);
|
|
93
92
|
|
|
94
93
|
if (this.logic.interface) {
|
|
95
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
96
94
|
this.logic.interface.setParamAndReturn();
|
|
97
95
|
} else if (this.logic.view) {
|
|
98
96
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -109,10 +107,10 @@ export class Return extends BaseVariable {
|
|
|
109
107
|
config.defaultApp?.emit('saving');
|
|
110
108
|
|
|
111
109
|
const body = this.toJSON();
|
|
112
|
-
// convert2SchemaType(body.schema);
|
|
113
110
|
utils.logger.debug('修改逻辑输出参数', body);
|
|
114
111
|
const result = await paramService.update({
|
|
115
112
|
headers: {
|
|
113
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
116
114
|
appId: config.defaultApp?.id,
|
|
117
115
|
operationAction: actionOptions?.actionName || 'Return.update',
|
|
118
116
|
operationDesc: actionOptions?.actionDesc || `修改逻辑输出参数"${this.name}"`,
|
|
@@ -120,8 +118,6 @@ export class Return extends BaseVariable {
|
|
|
120
118
|
body,
|
|
121
119
|
}).catch(catchFn(this.logic));
|
|
122
120
|
this.schema.id = result.schema.id;
|
|
123
|
-
// convert2RefType(result.schema);
|
|
124
|
-
// this.plainAssign(result);
|
|
125
121
|
|
|
126
122
|
await then?.();
|
|
127
123
|
await config.defaultApp?.history.load();
|
|
@@ -141,7 +137,6 @@ export class Return extends BaseVariable {
|
|
|
141
137
|
});
|
|
142
138
|
|
|
143
139
|
if (this.logic.interface) {
|
|
144
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
145
140
|
this.logic.interface.setParamAndReturn();
|
|
146
141
|
} else if (this.logic.view) {
|
|
147
142
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -192,13 +187,12 @@ export class Return extends BaseVariable {
|
|
|
192
187
|
defaultValue: this.defaultValue,
|
|
193
188
|
};
|
|
194
189
|
Object.assign(this.schema, {
|
|
195
|
-
$ref: undefined,
|
|
190
|
+
$ref: undefined, // 引用到Entity或者structure
|
|
196
191
|
type: undefined,
|
|
197
192
|
format: undefined,
|
|
198
193
|
typeInstantiation: undefined,
|
|
199
194
|
});
|
|
200
195
|
Object.assign(this.schema, schema);
|
|
201
|
-
// if (this.defaultValue)
|
|
202
196
|
this.assign({ defaultValue: getBasicTypeDefaultValue() });
|
|
203
197
|
try {
|
|
204
198
|
await this.update(undefined, {
|
|
@@ -207,7 +201,6 @@ export class Return extends BaseVariable {
|
|
|
207
201
|
this.genSchemaChildren();
|
|
208
202
|
|
|
209
203
|
if (this.logic.interface) {
|
|
210
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
211
204
|
this.logic.interface.setParamAndReturn();
|
|
212
205
|
} else if (this.logic.view) {
|
|
213
206
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -234,7 +227,6 @@ export class Return extends BaseVariable {
|
|
|
234
227
|
this.genSchemaChildren();
|
|
235
228
|
|
|
236
229
|
if (this.logic.interface) {
|
|
237
|
-
// this.logic.interface.service.emit('interfacesChange');
|
|
238
230
|
this.logic.interface.setParamAndReturn();
|
|
239
231
|
} else if (this.logic.view) {
|
|
240
232
|
this.logic.view.page.service.emit('pageTreeChange');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { immutable,
|
|
2
|
-
import { config,
|
|
1
|
+
import { immutable, action } from '../decorators';
|
|
2
|
+
import { config, utils, LEVEL_ENUM, Logic, Schema, BaseVariable, ActionOptions } from '..';
|
|
3
3
|
import { paramService } from '../../service/logic';
|
|
4
|
-
import { convert2RefType
|
|
4
|
+
import { convert2RefType } from '../data/dataTypeUtils';
|
|
5
5
|
import { getBasicTypeDefaultValue } from '../data/basicTypes';
|
|
6
6
|
import { schemaService } from '../../service/common';
|
|
7
7
|
import { catchFn } from './Param';
|
|
@@ -40,18 +40,18 @@ export class Variable extends BaseVariable {
|
|
|
40
40
|
config.defaultApp?.emit('saving');
|
|
41
41
|
|
|
42
42
|
const body = this.toJSON();
|
|
43
|
-
// convert2SchemaType(body.schema);
|
|
44
43
|
body._posIndex = this.logic.variables.indexOf(this);
|
|
45
44
|
utils.logger.debug('添加逻辑局部变量', body);
|
|
46
45
|
const result: Variable = await paramService.create({
|
|
47
46
|
headers: {
|
|
47
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
48
48
|
appId: config.defaultApp?.id,
|
|
49
49
|
operationAction: actionOptions?.actionName || 'Variable.create',
|
|
50
50
|
operationDesc: actionOptions?.actionDesc || `添加逻辑"${this.logic.name}"局部变量"${this.name}"`,
|
|
51
51
|
},
|
|
52
52
|
body,
|
|
53
53
|
}).catch(catchFn(this.logic));
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
this.deepPick(result, ['id']);
|
|
56
56
|
this.assign({ code: this.genCode() });
|
|
57
57
|
|
|
@@ -74,17 +74,18 @@ export class Variable extends BaseVariable {
|
|
|
74
74
|
config.defaultApp?.emit('saving');
|
|
75
75
|
|
|
76
76
|
if (this.id) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
77
|
+
await paramService.delete({
|
|
78
|
+
headers: {
|
|
79
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
80
|
+
appId: config.defaultApp?.id,
|
|
81
|
+
operationAction: actionOptions?.actionName || 'Param.create',
|
|
82
|
+
operationDesc: actionOptions?.actionDesc || `删除逻辑"${this.logic.name}"局部变量"${this.name}"`,
|
|
83
|
+
},
|
|
84
|
+
query: {
|
|
85
|
+
loValId: this.id,
|
|
86
|
+
logicId: this.logic.id,
|
|
87
|
+
},
|
|
88
|
+
}).catch(catchFn(this.logic));
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const index = this.logic.variables.indexOf(this);
|
|
@@ -107,10 +108,10 @@ export class Variable extends BaseVariable {
|
|
|
107
108
|
config.defaultApp?.emit('saving');
|
|
108
109
|
|
|
109
110
|
const body = this.toJSON();
|
|
110
|
-
// convert2SchemaType(body.schema);
|
|
111
111
|
utils.logger.debug('修改逻辑局部变量', body);
|
|
112
112
|
const result = await paramService.update({
|
|
113
113
|
headers: {
|
|
114
|
+
moduleType: this.logic && this.logic.moduleType,
|
|
114
115
|
appId: config.defaultApp?.id,
|
|
115
116
|
operationAction: actionOptions?.actionName || 'Param.update',
|
|
116
117
|
operationDesc: actionOptions?.actionDesc || `修改逻辑局部变量"${this.name}"`,
|
|
@@ -118,8 +119,6 @@ export class Variable extends BaseVariable {
|
|
|
118
119
|
body,
|
|
119
120
|
}).catch(catchFn(this.logic));
|
|
120
121
|
this.schema.id = result.schema.id;
|
|
121
|
-
// convert2RefType(result.schema);
|
|
122
|
-
// this.plainAssign(result);
|
|
123
122
|
|
|
124
123
|
await then?.();
|
|
125
124
|
await config.defaultApp?.history.load();
|
|
@@ -195,7 +194,6 @@ export class Variable extends BaseVariable {
|
|
|
195
194
|
typeInstantiation: undefined,
|
|
196
195
|
});
|
|
197
196
|
Object.assign(this.schema, schema);
|
|
198
|
-
// if (this.defaultValue)
|
|
199
197
|
this.assign({ defaultValue: getBasicTypeDefaultValue() });
|
|
200
198
|
try {
|
|
201
199
|
await this.update(undefined, {
|