@lcap/asl
Version:
NetEase Application Specific Language
117 lines (113 loc) • 3.15 kB
JavaScript
import { prePosIndex } from '../common/preprocess';
import { properties2PropertyList } from '../../types/data/dataTypes';
export default {
loadList: {
url: {
path: '/proxy/graph/api/v1/graph/view',
method: 'get',
},
},
load: {
url: {
path: '/proxy/graph/api/v1/graph/view/{id}',
method: 'get',
},
},
create: {
url: {
path: '/proxy/graph/api/v1/graph/view',
method: 'post',
},
config: {
preprocess: (info) => {
prePosIndex(info);
return info;
},
},
},
update: {
url: {
path: '/proxy/graph/api/v1/graph/view',
method: 'put',
},
config: {
preprocess: (info) => {
prePosIndex(info);
return info;
},
},
},
delete: {
url: {
path: '/proxy/graph/api/v1/graph/view/{id}',
method: 'delete',
},
},
createViewParam: {
url: {
path: '/proxy/graph/api/v1/graph/view/param',
method: 'post',
},
},
deleteViewParam: {
url: {
path: '/proxy/graph/api/v1/graph/view/param',
method: 'delete',
},
},
updateViewParam: {
url: {
path: '/proxy/graph/api/v1/graph/view/param',
method: 'put',
},
},
createViewVariable: {
url: {
path: '/proxy/graph/api/v1/graph/view/variable',
method: 'post',
},
},
deleteViewVariable: {
url: {
path: '/proxy/graph/api/v1/graph/view/variable',
method: 'delete',
},
},
updateViewVariable: {
url: {
path: '/proxy/graph/api/v1/graph/view/variable',
method: 'put',
},
},
importView: {
url: {
path: '/api/v1/page/addView',
method: 'post',
},
config: {
postprocess: (data) => {
// 导入的数据能显示 propertyList, 添加 properties 到 propertyList 的转化
const structures = data.structures.map((item) => {
item.type = item.definition.type;
item.definition = properties2PropertyList(item.definition);
item.propertyList = properties2PropertyList(item.definition).propertyList;
return item;
});
data.structures = structures;
const entities = data.entities.map((item) => {
item.definition = properties2PropertyList(item.definition);
item.propertyList = properties2PropertyList(item.definition).propertyList;
return item;
});
data.entities = entities;
return data;
},
},
},
mergeBlock: {
url: {
path: '/proxy/graph/api/v1/graph/view/mergeBlock',
method: 'post',
},
},
};