UNPKG

youzanyun-devtool-worker

Version:

- web - ws - proxy

59 lines (58 loc) 2.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const spring4js_nodejs_1 = require("spring4js-nodejs"); let CustomApiService = class CustomApiService { constructor() { } async start() { } async checkUserAuth(params) { const resData = await this.requestService.get('https://diy.youzanyun.com/api/custom/devtool/app/auth', { params, }); return resData; } async saveCustomContent(data) { const request = JSON.stringify(data); const result = await this.requestService.dubboCallWithAuth("com.youzan.baymax.api.FrontPagePushRecordService", "saveFrontPagePushRecord", [request]); if (+result.code === 0 || +result.code === 200) { return result.data || {}; } else { throw new Error('网络错误'); } } async saveCustomContentAndCreateImpl(data) { let resData = await this.requestService.post('https://diy.youzanyun.com/api/custom/devtool/pc/save-create-impl', data); if (+resData.code !== 200 && +resData.code !== 0) { throw new Error(resData.message); } return resData.data; } async getRemoteToolConfig() { let resData = await this.requestService.get('https://diy.youzanyun.com/api/mall-cloud/dev-tool/config/get'); if (+resData.code !== 200 && +resData.code !== 0) { throw new Error(resData.message); } return resData.data; } async getExtImplAndRule(projectId) { const { appId } = await this.projectService.getCompletedProjectById(projectId); let res = await this.requestService.dubboCallWithAuth("com.youzan.cloud.darwin.api.service.local.LocalExtRuleService", "queryExtImplAndRuleByAppId", [appId]); if (+res.code !== 200 && +res.code !== 0) { throw new Error(res.message); } return res; } }; tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], CustomApiService.prototype, "requestService", void 0); tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], CustomApiService.prototype, "projectService", void 0); CustomApiService = tslib_1.__decorate([ spring4js_nodejs_1.Service() ], CustomApiService); exports.default = CustomApiService;