@lcap/asl
Version:
NetEase Application Specific Language
227 lines • 6.41 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProcessInterface = void 0;
const decorators_1 = require("../decorators");
const __1 = require("..");
const common_1 = require("../../service/common");
// src/views/designer/asl/src/service/common
// src/views/designer/asl/src/types/process/ProcessInterface.ts
/**
* 接口类
*/
class ProcessInterface extends __1.Vertex {
/**
* @param source 需要合并的部分参数
*/
constructor(source) {
super();
/**
* 概念类型
*/
this.level = __1.LEVEL_ENUM.interface;
/**
* Id
*/
this.id = undefined;
/**
* InterfaceKey
*/
this.key = undefined;
/**
* 名称
*/
this.name = undefined;
/**
* 协议
*/
this.protocol = undefined;
/**
* 地址
*/
this.host = undefined;
/**
* 端口
*/
this.port = undefined;
/**
* 路径
*/
this.path = undefined;
/**
* 方法
*/
this.method = undefined;
/**
* 描述
*/
this.description = undefined;
/**
* 逻辑 Id
*/
this.logicId = undefined;
/**
* 逻辑
*/
this.logic = undefined;
/**
* Service 类型
*/
this.serviceType = undefined;
/**
* Service Id
*/
this.serviceId = undefined;
/**
* Service 名称
*/
this.serviceName = undefined;
/**
* Process
*/
this.process = undefined;
/**
* ProcessComponent
*/
this.processComponent = undefined;
/**
* 参数
*/
this.parameters = undefined;
/**
* 返回值
*/
this.responses = undefined;
/**
* 请求数据
*/
this.requestBody = undefined;
/**
* 树组件的子节点字段
*/
this.moreChildrenFields = ['logic.params', 'logic.returns', 'logic.variables'];
/**
* 周边存在的名称
*/
this.existingNames = [];
source && this.assign(source);
}
/**
* 按当前 id 加载接口数据
* @requires this.id
*/
load() {
return this;
}
/**
* 从后端 JSON 生成规范的 ProcessInterface 对象
*/
static from(source, parent) {
const item = new ProcessInterface(source);
item.assign({
key: `#/${parent.id}/${item.id}`,
expanded: false,
});
item.logic && item.assign({ logic: __1.Logic.from(item.logic, item) });
if (parent instanceof __1.Process) {
item.assign({ process: parent });
}
else if (parent instanceof __1.ProcessComponent) {
item.assign({ processComponent: parent });
}
return item;
}
/**
* 查找引用
*/
async findUsage() {
let id = this.id;
if (['entity', 'micro', 'process', 'processComponent'].includes(this.serviceType)) {
id = this.logicId;
}
const result = await common_1.findUsageService.findUsage({
query: {
id,
},
});
return result;
}
}
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "level", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "id", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "key", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "name", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "protocol", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "host", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "port", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "path", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "method", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "description", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "logicId", void 0);
__decorate([
decorators_1.excludedInJSON(),
decorators_1.immutable()
], ProcessInterface.prototype, "logic", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "serviceType", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "serviceId", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "serviceName", void 0);
__decorate([
decorators_1.circular(),
decorators_1.immutable()
], ProcessInterface.prototype, "process", void 0);
__decorate([
decorators_1.circular(),
decorators_1.immutable()
], ProcessInterface.prototype, "processComponent", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "parameters", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "responses", void 0);
__decorate([
decorators_1.immutable()
], ProcessInterface.prototype, "requestBody", void 0);
__decorate([
decorators_1.excludedInJSON(),
decorators_1.immutable()
], ProcessInterface.prototype, "moreChildrenFields", void 0);
__decorate([
decorators_1.excludedInJSON()
], ProcessInterface.prototype, "existingNames", void 0);
exports.ProcessInterface = ProcessInterface;
exports.default = ProcessInterface;
//# sourceMappingURL=ProcessInterface.js.map