UNPKG

@deepkit/api-console-api

Version:

150 lines 7.05 kB
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; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; /*@ts-ignore*/ import { __ΩTypeMethod } from '@deepkit/type'; /*@ts-ignore*/ import { __ΩExcluded } from '@deepkit/type'; import { ControllerSymbol } from '@deepkit/rpc'; import { deserializeType, entity, ReflectionClass, ReflectionKind } from '@deepkit/type'; export class ApiRouteParameter { } ApiRouteParameter.__type = ['name', "body", "query", "url", 'type', 'schema', 'ApiRouteParameter', '&3!P.".#.$J3%"3&5w\'']; let ApiRouteResponse = class ApiRouteResponse { constructor(statusCode, description, serializedType) { this.statusCode = statusCode; this.description = description; this.serializedType = serializedType; } getType() { if (!this.type) { this.type = deserializeType(this.serializedType); } return this.type; } }; ApiRouteResponse.__type = ['statusCode', 'description', 'serializedType', 'constructor', 'Type', 'getType', 'ApiRouteResponse', 'P\'2!:&2":"2#:"0$P"w%0&5w\'']; ApiRouteResponse = __decorate([ entity.name('.deepkit/api-console/route/response'), __metadata("design:paramtypes", [Number, String, Object]) ], ApiRouteResponse); export { ApiRouteResponse }; let ApiDocument = class ApiDocument { }; ApiDocument.__type = ['markdown', 'ApiDocument', '&3!85w"']; ApiDocument = __decorate([ entity.name('.deepkit/api-console/document') ], ApiDocument); export { ApiDocument }; let ApiAction = class ApiAction { constructor(controllerClassName, controllerPath, methodName, description, groups, category) { this.controllerClassName = controllerClassName; this.controllerPath = controllerPath; this.methodName = methodName; this.description = description; this.groups = groups; this.category = category; this.parameterSignature = ''; this.returnSignature = ''; } getMethodType() { if (!this.deserializedMethodType) { this.deserializedMethodType = deserializeType(this.methodType); } return this.deserializedMethodType; } /** @reflection never */ getParametersType() { return this.getMethodType().parameters; } /** @reflection never */ getResultsType() { return this.getMethodType().return; } /** @reflection never */ get id() { return this.controllerPath + '.' + this.methodName; } }; ApiAction.__type = ['methodType', 'parameterSignature', function () { return ''; }, 'returnSignature', function () { return ''; }, 'controllerClassName', 'controllerPath', 'methodName', 'description', 'groups', 'category', 'constructor', () => __ΩTypeMethod, 'getMethodType', 'ApiAction', '"3!&3">#&3$>%P&2&:&2\':&2(:&2):&F2*:&2+:"0,Pn-0.""!5w/']; ApiAction = __decorate([ entity.name('.deepkit/api-console/action'), __metadata("design:paramtypes", [String, String, String, String, Array, String]) ], ApiAction); export { ApiAction }; let ApiRoute = class ApiRoute { constructor(path, httpMethods, controller, action, description, groups, category, bodySchemas) { this.path = path; this.httpMethods = httpMethods; this.controller = controller; this.action = action; this.description = description; this.groups = groups; this.category = category; this.bodySchemas = bodySchemas; this.responses = []; if (bodySchemas) { const type = deserializeType(bodySchemas); if (type.kind === ReflectionKind.class || type.kind === ReflectionKind.objectLiteral) { this.deserializedBodyType = ReflectionClass.from(type); } } } /** @reflection never */ getBodyType() { return this.deserializedBodyType; } /** @reflection never */ getResultType() { if (!this.deserializedResultType && this.resultType) { this.deserializedResultType = deserializeType(this.resultType); } return this.deserializedResultType; } /** @reflection never */ getQueryType() { if (!this.deserializedQueryType && this.queryType) { const type = deserializeType(this.queryType); if (type.kind === ReflectionKind.class || type.kind === ReflectionKind.objectLiteral) { this.deserializedQueryType = ReflectionClass.from(type); } } return this.deserializedQueryType; } /** @reflection never */ getUrlType() { if (!this.deserializedUrlType && this.urlType) { const type = deserializeType(this.urlType); if (type.kind === ReflectionKind.class || type.kind === ReflectionKind.objectLiteral) { this.deserializedUrlType = ReflectionClass.from(type); } } return this.deserializedUrlType; } get id() { return this.controller + '.' + this.action; } }; ApiRoute.__type = [() => ReflectionClass, () => __ΩExcluded, 'deserializedBodyType', () => ReflectionClass, () => __ΩExcluded, 'deserializedQueryType', () => ReflectionClass, () => __ΩExcluded, 'deserializedUrlType', 'queryType', 'resultType', 'urlType', () => ApiRouteResponse, 'responses', function () { return []; }, 'path', 'httpMethods', 'controller', 'action', 'description', 'groups', 'category', 'bodySchemas', 'constructor', 'ApiRoute', 'PP"7!n"K3#8PP"7$n%K3&8PP"7\'n(K3)8"3*"3+"3,P7-F3.>/P&20:&F21:&22:&23:&24:&F25:&26:"278:"08""""!5w9']; ApiRoute = __decorate([ entity.name('.deepkit/api-console/route'), __metadata("design:paramtypes", [String, Array, String, String, String, Array, String, Object]) ], ApiRoute); export { ApiRoute }; export class ApiEntryPoints { constructor() { this.httpRoutes = []; this.rpcActions = []; } } ApiEntryPoints.__type = [() => ApiRoute, 'httpRoutes', function () { return []; }, () => ApiAction, 'rpcActions', function () { return []; }, 'ApiEntryPoints', 'P7!F3">#P7$F3%>&5w\'']; export const ApiConsoleApi = (ControllerSymbol.Ω = [['!']], ControllerSymbol('.deepkit/api-console', [ApiRoute, ApiDocument, ApiAction])); const __ΩApiConsoleApi = [() => ApiEntryPoints, 'getEntryPoints', () => ApiDocument, 'getDocument', 'ApiConsoleApi', 'PPP7!1"PP7#`1$Mw%y']; export { __ΩApiConsoleApi as __ΩApiConsoleApi }; //# sourceMappingURL=api.js.map