UNPKG

youzanyun-devtool-worker

Version:

- web - ws - proxy

111 lines (110 loc) 5.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const spring4js_nodejs_1 = require("spring4js-nodejs"); const BaseController_1 = tslib_1.__importDefault(require("../BaseController")); let MockPlatformController = class MockPlatformController extends BaseController_1.default { async getAllMockedBep(ctx, next) { let { projectId } = ctx.query; let bepList = await this.mockPlatformService.getAllMockedBep(projectId); return bepList; } async openBepMock(ctx, next) { let { projectId, extensionPointId, interfaceName } = ctx.query; await this.mockPlatformService.openBepMock(projectId, extensionPointId, interfaceName); return true; } async closeBepMock(ctx, next) { let { projectId, extensionPointId } = ctx.query; await this.mockPlatformService.closeBepMock(projectId, extensionPointId); return true; } async closeAllBepMock(ctx, next) { let { projectId } = ctx.query; await this.mockPlatformService.closeAllBepMock(projectId); return true; } async getBepMockEditorData(ctx, next) { let { id, projectId } = ctx.query; let bepDetail = await this.documentCenterApiService.getBepDetail(id); let { inParam, outParam, interfaceDto } = bepDetail; let { fullyQualifiedClassName, methodName } = interfaceDto; let inExample = this.bepService.generateBepDataExample(inParam); outParam.name = 'return'; let outExample = this.bepService.generateBepDataExample(outParam); let inKeyPathList = this.bepService.getBepKeyPath(inParam); let savedResponse = await this.mockPlatformService.getBepMockResponse(projectId, fullyQualifiedClassName, methodName); return { inExample, outExample: outExample.return, inKeyPathList, savedResponse: savedResponse && savedResponse.mockRule && JSON.parse(savedResponse.mockRule) }; } async saveBepMockResponse(ctx, next) { let { projectId, serviceName, methodName, response } = ctx.request.body; await this.mockPlatformService.saveBepMockResponse(projectId, serviceName, methodName, response); return true; } async getAllMockedMep(ctx, next) { let { projectId } = ctx.query; let bepList = await this.mockPlatformService.getAllMockedMep(projectId); return bepList; } async openMepMock(ctx, next) { let { projectId, bizType } = ctx.query; await this.mockPlatformService.openMepMock(projectId, bizType); return true; } async closeMepMock(ctx, next) { let { projectId, bizType } = ctx.query; await this.mockPlatformService.closeMepMock(projectId, bizType); return true; } async closeAllMepMock(ctx, next) { let { projectId } = ctx.query; await this.mockPlatformService.closeAllMepMock(projectId); return true; } }; tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], MockPlatformController.prototype, "mockPlatformService", void 0); tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], MockPlatformController.prototype, "documentCenterApiService", void 0); tslib_1.__decorate([ spring4js_nodejs_1.Resource() ], MockPlatformController.prototype, "bepService", void 0); tslib_1.__decorate([ spring4js_nodejs_1.Path("bep/mock/list", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "getAllMockedBep", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("bep/mock/open", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "openBepMock", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("bep/mock/close", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "closeBepMock", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("bep/mock/closeAll", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "closeAllBepMock", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("bep/mock/editor-data", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "getBepMockEditorData", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("bep/mock/save-response-data", spring4js_nodejs_1.HttpMethod.POST) ], MockPlatformController.prototype, "saveBepMockResponse", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("mep/mock/list", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "getAllMockedMep", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("mep/mock/open", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "openMepMock", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("mep/mock/close", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "closeMepMock", null); tslib_1.__decorate([ spring4js_nodejs_1.Path("mep/mock/closeAll", spring4js_nodejs_1.HttpMethod.GET) ], MockPlatformController.prototype, "closeAllMepMock", null); MockPlatformController = tslib_1.__decorate([ spring4js_nodejs_1.Controller("/api/extension-point") ], MockPlatformController); exports.default = MockPlatformController;