@lcap/nasl 0.3.12-beta.1 → 0.3.12-beta.4
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/logic/checktypeSocket.d.ts +5 -0
- package/out/service/logic/checktypeSocket.js +55 -0
- package/out/service/logic/checktypeSocket.js.map +1 -0
- package/out/service/logic/index.d.ts +3 -0
- package/out/service/logic/index.js +4 -1
- package/out/service/logic/index.js.map +1 -1
- package/out/types/app/App.d.ts +3 -1
- package/out/types/app/App.js +17 -0
- package/out/types/app/App.js.map +1 -1
- package/out/types/app/Service.d.ts +1 -0
- package/out/types/app/Service.js +36 -3
- package/out/types/app/Service.js.map +1 -1
- package/out/types/data/Entity.d.ts +5 -0
- package/out/types/data/Entity.js +13 -0
- package/out/types/data/Entity.js.map +1 -1
- package/out/types/data/Enum.d.ts +4 -0
- package/out/types/data/Enum.js +7 -0
- package/out/types/data/Enum.js.map +1 -1
- package/out/types/data/Module.d.ts +34 -0
- package/out/types/data/Module.js +53 -0
- package/out/types/data/Module.js.map +1 -0
- package/out/types/data/Structure.d.ts +4 -0
- package/out/types/data/Structure.js +7 -0
- package/out/types/data/Structure.js.map +1 -1
- package/out/types/data/dataTypes.js +21 -4
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/data/genBlock/index.d.ts +0 -2
- package/out/types/data/genBlock/index.js +0 -2
- package/out/types/data/genBlock/index.js.map +1 -1
- package/out/types/data/systemTypes.js +73 -0
- package/out/types/data/systemTypes.js.map +1 -1
- package/out/types/index.d.ts +2 -0
- package/out/types/index.js +5 -2
- package/out/types/index.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -0
- package/out/types/logic/Logic.js +7 -0
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.js +18 -10
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +1 -1
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/translator.js +75 -51
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/process/ProcessParam.js +1 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/out/types/typeCheck.js +2 -1
- package/out/types/typeCheck.js.map +1 -1
- package/package.json +2 -1
- package/src/service/logic/checktypeSocket.js +49 -0
- package/src/service/logic/index.js +3 -0
- package/src/service/modules/api.js +20 -0
- package/src/service/modules/index.js +6 -0
- package/src/types/app/App.ts +17 -2
- package/src/types/app/Service.ts +39 -4
- package/src/types/data/Entity.ts +17 -6
- package/src/types/data/Enum.ts +5 -0
- package/src/types/data/Module.ts +51 -0
- package/src/types/data/Structure.ts +5 -0
- package/src/types/data/dataTypes.ts +24 -4
- package/src/types/data/genBlock/index.ts +0 -2
- package/src/types/data/systemTypes.ts +73 -0
- package/src/types/index.ts +2 -0
- package/src/types/logic/Logic.ts +5 -0
- package/src/types/logic/LogicItem.ts +21 -13
- package/src/types/logic/Param.ts +1 -1
- package/src/types/logic/translator.js +73 -51
- package/src/types/process/ProcessParam.ts +1 -1
- package/src/types/typeCheck.ts +5 -4
- package/src/types/data/genBlock/genCurdBlock.ts +0 -654
- package/src/types/data/genBlock/genCurdEditTableBlock.ts +0 -581
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lcap/nasl",
|
|
3
3
|
"description": "NetEase Application Specific Language",
|
|
4
|
-
"version": "0.3.12-beta.
|
|
4
|
+
"version": "0.3.12-beta.4",
|
|
5
5
|
"author": "Forrest <rainforest92@126.com>",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "tsc -watch -p ./",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"module-alias": "^2.2.2",
|
|
39
39
|
"qs": "^6.10.1",
|
|
40
40
|
"request-pre": "^0.4.3",
|
|
41
|
+
"socket.io-client": "^2.4.0",
|
|
41
42
|
"uuid": "^8.3.2",
|
|
42
43
|
"vue-template-compiler": "^2.6.10"
|
|
43
44
|
},
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import io from 'socket.io-client';
|
|
2
|
+
export const checkTypeClient = {
|
|
3
|
+
client: null,
|
|
4
|
+
connect: false,
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function createLogicSocketClient(appId) {
|
|
8
|
+
const client = io('/socket/ide/checktype', {
|
|
9
|
+
reconnectionDelayMax: 10000,
|
|
10
|
+
// reconnectionAttempts: 0,
|
|
11
|
+
path: '/socket/ide/checktype',
|
|
12
|
+
// query: {
|
|
13
|
+
// id: appId,
|
|
14
|
+
// type: 'app',
|
|
15
|
+
// },
|
|
16
|
+
transports: ['websocket'],
|
|
17
|
+
upgrade: true,
|
|
18
|
+
reconnection: true,
|
|
19
|
+
rejectUnauthorized: false,
|
|
20
|
+
});
|
|
21
|
+
let timeout;
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
client.on('connect', () => {
|
|
24
|
+
console.log('connect');
|
|
25
|
+
if (timeout) {
|
|
26
|
+
clearTimeout(timeout);
|
|
27
|
+
}
|
|
28
|
+
checkTypeClient.client = client;
|
|
29
|
+
checkTypeClient.connect = true;
|
|
30
|
+
resolve(client);
|
|
31
|
+
});
|
|
32
|
+
client.on('connect_error', (err) => {
|
|
33
|
+
console.log(err);
|
|
34
|
+
if (timeout) {
|
|
35
|
+
clearTimeout(timeout);
|
|
36
|
+
}
|
|
37
|
+
checkTypeClient.client = null;
|
|
38
|
+
checkTypeClient.connect = false;
|
|
39
|
+
reject();
|
|
40
|
+
});
|
|
41
|
+
timeout = setTimeout(() => {
|
|
42
|
+
console.log('timeout');
|
|
43
|
+
checkTypeClient.client = null;
|
|
44
|
+
checkTypeClient.connect = false;
|
|
45
|
+
reject();
|
|
46
|
+
}, 1000 * 10);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createService } from '../create';
|
|
2
2
|
import logicApi from './logic';
|
|
3
3
|
import paramApi from './param';
|
|
4
|
+
import { createLogicSocketClient, checkTypeClient } from './checktypeSocket';
|
|
4
5
|
|
|
5
6
|
const logicService = createService(logicApi);
|
|
6
7
|
const paramService = createService(paramApi);
|
|
@@ -8,4 +9,6 @@ const paramService = createService(paramApi);
|
|
|
8
9
|
export {
|
|
9
10
|
logicService,
|
|
10
11
|
paramService,
|
|
12
|
+
createLogicSocketClient,
|
|
13
|
+
checkTypeClient,
|
|
11
14
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
loadList: {
|
|
3
|
+
url: {
|
|
4
|
+
method: 'get',
|
|
5
|
+
path: '/api/v1/module/list',
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
add: {
|
|
9
|
+
url: {
|
|
10
|
+
method: 'post',
|
|
11
|
+
path: '/api/v1/module/add',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
delete: {
|
|
15
|
+
url: {
|
|
16
|
+
method: 'delete',
|
|
17
|
+
path: '/api/v1/module/delete',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
package/src/types/app/App.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { excludedInJSON, immutable } from '../decorators';
|
|
2
|
-
import { LEVEL_ENUM, Vertex, Service, WebService, MicroService, SERVICE_TYPE, utils, History, updateGenericTypeList, vertexsMap, Entity, Structure, Enum, dataTypesMap, BaseVariable, variablesMap, updateDataTypeList } from '..';
|
|
2
|
+
import { LEVEL_ENUM, Vertex, Service, WebService, MicroService, SERVICE_TYPE, utils, History, updateGenericTypeList, vertexsMap, Entity, Structure, Enum, dataTypesMap, BaseVariable, variablesMap, updateDataTypeList, Module } from '..';
|
|
3
3
|
import appService from '../../service/app';
|
|
4
4
|
|
|
5
5
|
interface AppLoadAllOptions {
|
|
@@ -112,6 +112,8 @@ export class App extends Vertex {
|
|
|
112
112
|
*/
|
|
113
113
|
@immutable()
|
|
114
114
|
public readonly firstMicroService: MicroService = undefined;
|
|
115
|
+
@immutable()
|
|
116
|
+
public modules: Module[] = [];
|
|
115
117
|
/**
|
|
116
118
|
* 历史记录
|
|
117
119
|
* 用于处理撤销重做
|
|
@@ -174,6 +176,10 @@ export class App extends Vertex {
|
|
|
174
176
|
id: this.id,
|
|
175
177
|
},
|
|
176
178
|
});
|
|
179
|
+
const { status } = result || {};
|
|
180
|
+
if (['PULLING', 'PUSHING'].includes(status)) {
|
|
181
|
+
this.emit('updateIdeStatus', status);
|
|
182
|
+
}
|
|
177
183
|
await this.loadEnvList(result);
|
|
178
184
|
this.loadWebConfig(result);
|
|
179
185
|
delete result.services;
|
|
@@ -266,7 +272,7 @@ export class App extends Vertex {
|
|
|
266
272
|
asyncLoadServicesDetail: false,
|
|
267
273
|
asyncLoadViewsDetail: false,
|
|
268
274
|
}) {
|
|
269
|
-
await this.load();
|
|
275
|
+
await this.load(); // 请求其它接口前,需要先查询到 app 上的 baseVersion
|
|
270
276
|
await Promise.all([
|
|
271
277
|
this.loadServices(),
|
|
272
278
|
updateGenericTypeList(),
|
|
@@ -319,6 +325,15 @@ export class App extends Vertex {
|
|
|
319
325
|
});
|
|
320
326
|
updateDataTypeList();
|
|
321
327
|
}
|
|
328
|
+
getModule(moduleName: string) {
|
|
329
|
+
const { modules } = this;
|
|
330
|
+
let module = modules.find((m) => m.name === moduleName);
|
|
331
|
+
if(module) return module;
|
|
332
|
+
|
|
333
|
+
module = new Module({ name: moduleName });
|
|
334
|
+
modules.push(module);
|
|
335
|
+
return module;
|
|
336
|
+
}
|
|
322
337
|
}
|
|
323
338
|
|
|
324
339
|
export default App;
|
package/src/types/app/Service.ts
CHANGED
|
@@ -109,10 +109,16 @@ export class Service extends Vertex {
|
|
|
109
109
|
id: this.id,
|
|
110
110
|
},
|
|
111
111
|
});
|
|
112
|
+
|
|
112
113
|
const structures: Array<Structure> = [];
|
|
113
114
|
structuresOrigin.forEach((item) => {
|
|
114
115
|
const structureNode = Structure.from(item, this);
|
|
115
|
-
if (structureNode.
|
|
116
|
+
if (structureNode.moduleName) {
|
|
117
|
+
const module = this.app.getModule(structureNode.moduleName);
|
|
118
|
+
const isHave = module.structures.some((it:any) => it.id === item.id);
|
|
119
|
+
if (!isHave)
|
|
120
|
+
module.structures.push(structureNode);
|
|
121
|
+
} else if (structureNode.serviceType === 'external' && structureNode.category) {
|
|
116
122
|
this.globalLogic.addCategoryStructure(structureNode);
|
|
117
123
|
} else {
|
|
118
124
|
structures.push(structureNode);
|
|
@@ -685,7 +691,18 @@ export class MicroService extends Service {
|
|
|
685
691
|
|
|
686
692
|
updateDataTypeList();
|
|
687
693
|
|
|
688
|
-
|
|
694
|
+
const globalEnums: Enum[] = [];
|
|
695
|
+
for (const e of enums) {
|
|
696
|
+
if (e.moduleName) {
|
|
697
|
+
const module = this.app.getModule(e.moduleName);
|
|
698
|
+
module.enums.push(e);
|
|
699
|
+
} else
|
|
700
|
+
globalEnums.push(e);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
this.data.assign({
|
|
704
|
+
enums: globalEnums,
|
|
705
|
+
});
|
|
689
706
|
return enums;
|
|
690
707
|
}
|
|
691
708
|
/**
|
|
@@ -804,7 +821,6 @@ export class MicroService extends Service {
|
|
|
804
821
|
IdeVersion: 2.3,
|
|
805
822
|
},
|
|
806
823
|
});
|
|
807
|
-
|
|
808
824
|
interfaces = interfaces.map((item) => {
|
|
809
825
|
if (logicMap.has(item.id)) {
|
|
810
826
|
item.logic = logicMap.get(item.id);
|
|
@@ -827,6 +843,7 @@ export class MicroService extends Service {
|
|
|
827
843
|
this.assign({ interfaces });
|
|
828
844
|
this.mountResolverOnEntity();
|
|
829
845
|
this.mountResolverOnInterface();
|
|
846
|
+
this.mountOnModule();
|
|
830
847
|
// this.generateLogics();
|
|
831
848
|
return interfaces;
|
|
832
849
|
}
|
|
@@ -839,7 +856,8 @@ export class MicroService extends Service {
|
|
|
839
856
|
const entity = Entity.getVertexByRef(item.logic.entityId) as Entity;
|
|
840
857
|
if (entity)
|
|
841
858
|
entity.assign({ resolvers: entity.resolvers || [] });
|
|
842
|
-
|
|
859
|
+
// Bug-34673: 兼容实体名称包含 All/Delete/Create/Update 导致 RESOLVER_NAMES 误判情况
|
|
860
|
+
const resolverName = RESOLVER_NAMES.find((name) => item.name === `${name}${entity.name}` || item.name === `${name}${entity.name}s`);
|
|
843
861
|
if (entity) {
|
|
844
862
|
const exist = entity.resolvers.find((r) => r.name === resolverName);
|
|
845
863
|
if (exist) {
|
|
@@ -874,6 +892,9 @@ export class MicroService extends Service {
|
|
|
874
892
|
// const categoryInterfaceMap = {};
|
|
875
893
|
// const categoryProccessMap = {};
|
|
876
894
|
this.interfaces.forEach((item) => {
|
|
895
|
+
if (item.logic?.moduleName)
|
|
896
|
+
return;
|
|
897
|
+
|
|
877
898
|
if (item.serviceType === 'micro') {
|
|
878
899
|
globalLogics.push(item);
|
|
879
900
|
} else if (item.serviceType === 'external') {
|
|
@@ -914,6 +935,20 @@ export class MicroService extends Service {
|
|
|
914
935
|
this.globalLogic.assign({ globalLogics, interfaces });
|
|
915
936
|
}
|
|
916
937
|
|
|
938
|
+
mountOnModule() {
|
|
939
|
+
const { interfaces } = this;
|
|
940
|
+
|
|
941
|
+
for (const item of interfaces) {
|
|
942
|
+
const logic = item.logic;
|
|
943
|
+
if (logic.moduleName) {
|
|
944
|
+
const module = this.app.getModule(logic.moduleName);
|
|
945
|
+
const isHave = module.globalLogics.some((it:any) => it.id === item.id);
|
|
946
|
+
if (!isHave)
|
|
947
|
+
module.globalLogics.push(item);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
917
952
|
private _onDataTypesChange() {
|
|
918
953
|
config.webFileCache && generator.saveDataTypesCache(this.app);
|
|
919
954
|
}
|
package/src/types/data/Entity.ts
CHANGED
|
@@ -334,16 +334,27 @@ export class Entity extends Vertex implements ObjectSchema {
|
|
|
334
334
|
this.dataNode.service.emit('vertexIdToNameChange', this.id, this.name);
|
|
335
335
|
}
|
|
336
336
|
/**
|
|
337
|
-
*
|
|
338
|
-
* @param
|
|
337
|
+
* 设置实体表名
|
|
338
|
+
* @param tableName 表名
|
|
339
339
|
*/
|
|
340
|
-
|
|
341
|
-
async
|
|
342
|
-
this.assign({
|
|
340
|
+
@action('设置实体表名')
|
|
341
|
+
async setTableName(tableName: string) {
|
|
342
|
+
this.assign({ tableName });
|
|
343
343
|
await this.update(undefined, {
|
|
344
|
-
actionDesc: `设置实体"${this.name}"
|
|
344
|
+
actionDesc: `设置实体"${this.name}"的表名为"${tableName}"`,
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* 设置实体描述
|
|
349
|
+
* @param description 描述
|
|
350
|
+
*/
|
|
351
|
+
@action('设置实体描述')
|
|
352
|
+
async setDescription(description: string) {
|
|
353
|
+
this.assign({ description });
|
|
354
|
+
await this.update(undefined, {
|
|
355
|
+
actionDesc: `设置实体"${this.name}"的描述为"${description}"`,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
347
358
|
/**
|
|
348
359
|
* 同步interfaces
|
|
349
360
|
* interface、logic、params、returns、variabes采用plainAssign
|
package/src/types/data/Enum.ts
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { immutable, circular } from '../decorators';
|
|
2
|
+
import {
|
|
3
|
+
LEVEL_ENUM, Vertex,
|
|
4
|
+
Interface, Structure, Enum, App,
|
|
5
|
+
} from '..';
|
|
6
|
+
|
|
7
|
+
export interface Category {
|
|
8
|
+
level: LEVEL_ENUM.category;
|
|
9
|
+
name: string;
|
|
10
|
+
categoryInterfaces: Array<Interface>;
|
|
11
|
+
categoryStructures: Array<Structure>;
|
|
12
|
+
isLeaf: false;
|
|
13
|
+
structureExpanded: false;
|
|
14
|
+
interfaceExpanded: false;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 数据分类
|
|
18
|
+
*/
|
|
19
|
+
export class Module extends Vertex {
|
|
20
|
+
/**
|
|
21
|
+
* 模块名
|
|
22
|
+
*/
|
|
23
|
+
@immutable()
|
|
24
|
+
public readonly name: string = '';
|
|
25
|
+
@immutable()
|
|
26
|
+
public readonly level: LEVEL_ENUM = LEVEL_ENUM.module;
|
|
27
|
+
|
|
28
|
+
@immutable()
|
|
29
|
+
public globalLogics: Array<Interface> = [];
|
|
30
|
+
public structures: Array<Structure> = [];
|
|
31
|
+
public enums: Array<Enum> = [];
|
|
32
|
+
|
|
33
|
+
public structureExpanded: Boolean = false;
|
|
34
|
+
public enumExpanded: Boolean = false;
|
|
35
|
+
public globalLogicExpanded: Boolean = false;
|
|
36
|
+
public structureHidden: Boolean = false;
|
|
37
|
+
public enumHidden: Boolean = false;
|
|
38
|
+
|
|
39
|
+
@circular()
|
|
40
|
+
@immutable()
|
|
41
|
+
public readonly app: App = undefined;
|
|
42
|
+
/**
|
|
43
|
+
* @param source 需要合并的部分参数
|
|
44
|
+
*/
|
|
45
|
+
constructor(source?: Partial<Module>) {
|
|
46
|
+
super();
|
|
47
|
+
source && this.assign(source);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default Module;
|
|
@@ -20,12 +20,32 @@ export const dataTypesMap: { [name: string]: Schema } = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export function updateDataTypeList() {
|
|
23
|
-
|
|
23
|
+
const typeMap: any = {};
|
|
24
|
+
Object.keys(dataTypesMap)
|
|
24
25
|
.filter((key) => !key.includes('#/basicTypes') && !key.includes('#/systemTypes') && !key.includes('#/genericTypes'))
|
|
25
|
-
.
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
.forEach((key) => {
|
|
27
|
+
const { level, name, createdTime }: any = dataTypesMap[key];
|
|
28
|
+
// 数据分类
|
|
29
|
+
if (!typeMap[level]) {
|
|
30
|
+
typeMap[level] = [];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
typeMap[level].push({ kind: level, text: name, value: key, createdTime });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// 实体按创建时间排序
|
|
37
|
+
if (typeMap.entity) {
|
|
38
|
+
typeMap.entity.sort((a: any, b: any) => {
|
|
39
|
+
// 刚创建的实体createdTime没有值。。。
|
|
40
|
+
if (!a.createdTime) {
|
|
41
|
+
return -1;
|
|
42
|
+
}
|
|
43
|
+
return b.createdTime - a.createdTime;
|
|
28
44
|
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const children = Object.keys(typeMap).reduce((result, type) => result.concat(typeMap[type]), []);
|
|
48
|
+
dataTypeList[1].children = children;
|
|
29
49
|
}
|
|
30
50
|
|
|
31
51
|
export function properties2PropertyList(definition: any) {
|
|
@@ -10,11 +10,9 @@ export * from './genGetBlock';
|
|
|
10
10
|
export * from './genCreateBlock';
|
|
11
11
|
export * from './genUpdateBlock';
|
|
12
12
|
export * from './genSelectBlock';
|
|
13
|
-
export * from './genCurdBlock';
|
|
14
13
|
export * from './genListViewBlock';
|
|
15
14
|
export * from './genGridViewBlock';
|
|
16
15
|
export * from './genEditTableBlock';
|
|
17
|
-
export * from './genCurdEditTableBlock';
|
|
18
16
|
export * from './genCurdMultipleKeyBlock';
|
|
19
17
|
export * from './genCurdEditMultipleKeyBlock';
|
|
20
18
|
|
|
@@ -24,6 +24,7 @@ export const systemTypeList = [
|
|
|
24
24
|
{ kind: 'systemType', text: 'UploadErrorEvent', value: '#/systemTypes/UploadErrorEvent' },
|
|
25
25
|
{ kind: 'systemType', text: 'SortEvent', value: '#/systemTypes/SortEvent' },
|
|
26
26
|
{ kind: 'systemType', text: 'PoiInfo', value: '#/systemTypes/PoiInfo' },
|
|
27
|
+
{ kind: 'systemType', text: 'File', value: '#/systemTypes/File' },
|
|
27
28
|
];
|
|
28
29
|
|
|
29
30
|
export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
@@ -417,6 +418,27 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
|
417
418
|
description: '选择项相关对象',
|
|
418
419
|
isLeaf: true,
|
|
419
420
|
},
|
|
421
|
+
{
|
|
422
|
+
type: 'genericType',
|
|
423
|
+
typeKey: '#/genericTypes/List',
|
|
424
|
+
typeInstantiation: {
|
|
425
|
+
typeName: 'List',
|
|
426
|
+
typeParams: [
|
|
427
|
+
{
|
|
428
|
+
type: 'typeParam',
|
|
429
|
+
typeParamName: 'T',
|
|
430
|
+
typeParamValue: {
|
|
431
|
+
typeKey: '#/basicTypes/String',
|
|
432
|
+
type: 'string',
|
|
433
|
+
format: '',
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
name: 'items',
|
|
439
|
+
description: '所有选中项相关对象的数组',
|
|
440
|
+
isLeaf: true,
|
|
441
|
+
},
|
|
420
442
|
{
|
|
421
443
|
typeKey: '#/basicTypes/String',
|
|
422
444
|
type: 'string',
|
|
@@ -1311,6 +1333,27 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
|
1311
1333
|
description: '选择项相关对象',
|
|
1312
1334
|
isLeaf: true,
|
|
1313
1335
|
},
|
|
1336
|
+
{
|
|
1337
|
+
type: 'genericType',
|
|
1338
|
+
typeKey: '#/genericTypes/List',
|
|
1339
|
+
typeInstantiation: {
|
|
1340
|
+
typeName: 'List',
|
|
1341
|
+
typeParams: [
|
|
1342
|
+
{
|
|
1343
|
+
type: 'typeParam',
|
|
1344
|
+
typeParamName: 'T',
|
|
1345
|
+
typeParamValue: {
|
|
1346
|
+
typeKey: '#/basicTypes/String',
|
|
1347
|
+
type: 'string',
|
|
1348
|
+
format: '',
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
1351
|
+
],
|
|
1352
|
+
},
|
|
1353
|
+
name: 'items',
|
|
1354
|
+
description: '所有选中项相关对象的数组',
|
|
1355
|
+
isLeaf: true,
|
|
1356
|
+
},
|
|
1314
1357
|
],
|
|
1315
1358
|
},
|
|
1316
1359
|
'#/systemTypes/UploadEvent': {
|
|
@@ -1559,4 +1602,34 @@ export const systemTypeMap: { [name: string]: ObjectSchema } = {
|
|
|
1559
1602
|
},
|
|
1560
1603
|
],
|
|
1561
1604
|
},
|
|
1605
|
+
'#/systemTypes/File': {
|
|
1606
|
+
name: 'File',
|
|
1607
|
+
type: 'object',
|
|
1608
|
+
propertyList: [
|
|
1609
|
+
{
|
|
1610
|
+
typeKey: '#/basicTypes/String',
|
|
1611
|
+
type: 'string',
|
|
1612
|
+
format: '',
|
|
1613
|
+
name: 'name',
|
|
1614
|
+
description: '文件名称',
|
|
1615
|
+
isLeaf: true,
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
typeKey: '#/basicTypes/Integer',
|
|
1619
|
+
type: 'integer',
|
|
1620
|
+
format: 'int',
|
|
1621
|
+
name: 'size',
|
|
1622
|
+
description: '文件大小',
|
|
1623
|
+
isLeaf: true,
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
typeKey: '#/basicTypes/String',
|
|
1627
|
+
type: 'string',
|
|
1628
|
+
format: '',
|
|
1629
|
+
name: 'type',
|
|
1630
|
+
description: '文件类型',
|
|
1631
|
+
isLeaf: true,
|
|
1632
|
+
},
|
|
1633
|
+
],
|
|
1634
|
+
},
|
|
1562
1635
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { Service, WebService, MicroService, SERVICE_TYPE } from './app/Service';
|
|
|
9
9
|
|
|
10
10
|
export { DataNode } from './data/DataNode';
|
|
11
11
|
export { GlobalLogicNode } from './data/GlobalLogicNode';
|
|
12
|
+
export { Module } from './data/Module';
|
|
12
13
|
export { Entity, systemProperty } from './data/Entity';
|
|
13
14
|
export { EntityProperty } from './data/EntityProperty';
|
|
14
15
|
export { EntityIndex } from './data/EntityIndex';
|
|
@@ -84,6 +85,7 @@ export enum LEVEL_ENUM {
|
|
|
84
85
|
dataNode = 'dataNode',
|
|
85
86
|
gloablLogicNode = 'gloablLogicNode',
|
|
86
87
|
category = 'category',
|
|
88
|
+
module = 'module',
|
|
87
89
|
entity = 'entity',
|
|
88
90
|
structure = 'structure',
|
|
89
91
|
enum = 'enum',
|
package/src/types/logic/Logic.ts
CHANGED
|
@@ -144,6 +144,11 @@ export class Logic extends Vertex {
|
|
|
144
144
|
*/
|
|
145
145
|
@immutable()
|
|
146
146
|
public readonly moreChildrenFields: Array<string> = ['params', 'returns', 'variables'];
|
|
147
|
+
/**
|
|
148
|
+
* 归属的模块
|
|
149
|
+
*/
|
|
150
|
+
@immutable()
|
|
151
|
+
public readonly moduleName: string = undefined;
|
|
147
152
|
/**
|
|
148
153
|
* @param source 需要合并的部分参数
|
|
149
154
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { immutable, excludedInJSON, action } from '../decorators';
|
|
2
2
|
import { config, typeCheck, utils, Vertex, LEVEL_ENUM, Logic, Schema, ActionOptions, ACTION_MODE } from '..';
|
|
3
|
-
import { logicService } from '../../service/logic';
|
|
3
|
+
import { logicService, checkTypeClient } from '../../service/logic';
|
|
4
4
|
import { traverse } from '../utils';
|
|
5
5
|
import { vertexsMap } from '../cacheData';
|
|
6
6
|
import { getSchemaOfExpressionNode } from './tools';
|
|
@@ -1051,20 +1051,28 @@ export class LogicItem extends Vertex {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
private async _checkType(node: LogicItem) {
|
|
1054
|
-
|
|
1055
|
-
|
|
1054
|
+
if (checkTypeClient.connect) {
|
|
1055
|
+
checkTypeClient.client.emit('checktype', {
|
|
1056
|
+
id: node.id,
|
|
1057
|
+
type: 'logicItem',
|
|
1056
1058
|
logicId: this.logic && this.logic.id,
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
if (res) {
|
|
1061
|
-
res.logicId = this.logic && this.logic.id;
|
|
1062
|
-
typeCheck.pushAll([res]);
|
|
1063
|
-
|
|
1064
|
-
LogicItem.assignTypeCheckResult(node, res);
|
|
1059
|
+
appId: config.defaultApp?.id,
|
|
1060
|
+
});
|
|
1065
1061
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1062
|
+
// const res = await logicService.checkType({
|
|
1063
|
+
// query: {
|
|
1064
|
+
// logicId: this.logic && this.logic.id,
|
|
1065
|
+
// loItemId: node.id,
|
|
1066
|
+
// },
|
|
1067
|
+
// });
|
|
1068
|
+
// if (res) {
|
|
1069
|
+
// res.logicId = this.logic && this.logic.id;
|
|
1070
|
+
// typeCheck.pushAll([res]);
|
|
1071
|
+
|
|
1072
|
+
// LogicItem.assignTypeCheckResult(node, res);
|
|
1073
|
+
// }
|
|
1074
|
+
|
|
1075
|
+
// return res;
|
|
1068
1076
|
}
|
|
1069
1077
|
|
|
1070
1078
|
static assignTypeCheckResult(logicItem: LogicItem | LogicItem[], typeCheckResult: any) {
|
package/src/types/logic/Param.ts
CHANGED