UNPKG

youzanyun-devtool-worker

Version:

- web - ws - proxy

135 lines (134 loc) 5.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const spring4js_nodejs_1 = require("spring4js-nodejs"); const lodash_1 = require("lodash"); let DocumentCenterApiService = class DocumentCenterApiService { constructor() { } async start() { } async getBepCategoryList() { let res = await this.requestService.dubboCall("com.youzan.baymax.api.ExtensionPointDocService", "getExtPointCatList", []); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } let bepInfo = lodash_1.find(res.data, info => { return info.type == 0; }); const { categoryDtos, name, type } = bepInfo; return categoryDtos; } async getBepDocList(categoryId) { let temp = await this.requestService.dubboCall("com.youzan.baymax.api.ExtensionPointDocService", "getExtPointDocList", [0, categoryId]); if (+temp.code !== 200 && +temp.code !== 0) { throw new Error(temp.msg); } return temp.data; } async getBepDetail(extId) { let res = await this.requestService.dubboCall("com.youzan.baymax.api.ExtensionPointDocService", "getExtPointDocById", [extId]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async getAllMepInfo() { let res = await this.requestService.dubboCall("com.youzan.bifrost.developer.api.service.push.DocumentsCenterService", "getDirectory", []); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async getMepParamType(bizType) { let res = await this.requestService.dubboCall("com.youzan.bifrost.developer.api.service.push.DocumentsCenterService", "getBizTypeField", [{ bizType: bizType }]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async getFocusedBep(projectId) { let project = await this.projectService.getProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.mock.platform.api.ExtensionPointFocusApiService", "queryExtensionPointFocusByApp", [ { "projectName": project.proName } ]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async focusBep(projectId, bepId) { let project = await this.projectService.getProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.mock.platform.api.ExtensionPointFocusApiService", "focusExtensionPoint", [ { "projectName": project.proName, "extensionPointId": bepId } ]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async unfocuseBep(projectId, bepId) { let project = await this.projectService.getProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.mock.platform.api.ExtensionPointFocusApiService", "unFocusExtensionPoint", [ { "projectName": project.proName, "extensionPointId": bepId } ]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async getFocusedMep(projectId) { let project = await this.projectService.getProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.mock.platform.api.MessagePushFocusApiService", "queryMessagePushFocusByApp", [ { "projectName": project.proName } ]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async focusMep(projectId, bizType) { let project = await this.projectService.getProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.mock.platform.api.MessagePushFocusApiService", "focusMessagePush", [ { "projectName": project.proName, bizType, } ]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } async unfocuseMep(projectId, bizType) { let project = await this.projectService.getProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.mock.platform.api.MessagePushFocusApiService", "unFocusMessagePush", [ { "projectName": project.proName, bizType } ]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.msg); } return res.data; } }; tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], DocumentCenterApiService.prototype, "requestService", void 0); tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], DocumentCenterApiService.prototype, "projectService", void 0); DocumentCenterApiService = tslib_1.__decorate([ spring4js_nodejs_1.Service() ], DocumentCenterApiService); exports.default = DocumentCenterApiService;