@deepkit/api-console-api
Version:
155 lines • 7.68 kB
JavaScript
"use strict";
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);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.__ΩApiConsoleApi = exports.ApiConsoleApi = exports.ApiEntryPoints = exports.ApiRoute = exports.ApiAction = exports.ApiDocument = exports.ApiRouteResponse = exports.ApiRouteParameter = void 0;
/*@ts-ignore*/
const { __ΩTypeMethod } = require('@deepkit/type');
/*@ts-ignore*/
const { __ΩExcluded } = require('@deepkit/type');
const rpc_1 = require("@deepkit/rpc");
const type_1 = require("@deepkit/type");
class ApiRouteParameter {
}
exports.ApiRouteParameter = 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 = (0, type_1.deserializeType)(this.serializedType);
}
return this.type;
}
};
exports.ApiRouteResponse = ApiRouteResponse;
ApiRouteResponse.__type = ['statusCode', 'description', 'serializedType', 'constructor', 'Type', 'getType', 'ApiRouteResponse', 'P\'2!:&2":"2#:"0$P"w%0&5w\''];
exports.ApiRouteResponse = ApiRouteResponse = __decorate([
type_1.entity.name('.deepkit/api-console/route/response'),
__metadata("design:paramtypes", [Number, String, Object])
], ApiRouteResponse);
let ApiDocument = class ApiDocument {
};
exports.ApiDocument = ApiDocument;
ApiDocument.__type = ['markdown', 'ApiDocument', '&3!85w"'];
exports.ApiDocument = ApiDocument = __decorate([
type_1.entity.name('.deepkit/api-console/document')
], 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 = (0, type_1.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;
}
};
exports.ApiAction = ApiAction;
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/'];
exports.ApiAction = ApiAction = __decorate([
type_1.entity.name('.deepkit/api-console/action'),
__metadata("design:paramtypes", [String, String, String, String, Array, String])
], 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 = (0, type_1.deserializeType)(bodySchemas);
if (type.kind === type_1.ReflectionKind.class || type.kind === type_1.ReflectionKind.objectLiteral) {
this.deserializedBodyType = type_1.ReflectionClass.from(type);
}
}
}
/** @reflection never */
getBodyType() {
return this.deserializedBodyType;
}
/** @reflection never */
getResultType() {
if (!this.deserializedResultType && this.resultType) {
this.deserializedResultType = (0, type_1.deserializeType)(this.resultType);
}
return this.deserializedResultType;
}
/** @reflection never */
getQueryType() {
if (!this.deserializedQueryType && this.queryType) {
const type = (0, type_1.deserializeType)(this.queryType);
if (type.kind === type_1.ReflectionKind.class || type.kind === type_1.ReflectionKind.objectLiteral) {
this.deserializedQueryType = type_1.ReflectionClass.from(type);
}
}
return this.deserializedQueryType;
}
/** @reflection never */
getUrlType() {
if (!this.deserializedUrlType && this.urlType) {
const type = (0, type_1.deserializeType)(this.urlType);
if (type.kind === type_1.ReflectionKind.class || type.kind === type_1.ReflectionKind.objectLiteral) {
this.deserializedUrlType = type_1.ReflectionClass.from(type);
}
}
return this.deserializedUrlType;
}
get id() {
return this.controller + '.' + this.action;
}
};
exports.ApiRoute = ApiRoute;
ApiRoute.__type = [() => type_1.ReflectionClass, () => __ΩExcluded, 'deserializedBodyType', () => type_1.ReflectionClass, () => __ΩExcluded, 'deserializedQueryType', () => type_1.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'];
exports.ApiRoute = ApiRoute = __decorate([
type_1.entity.name('.deepkit/api-console/route'),
__metadata("design:paramtypes", [String, Array, String, String, String, Array, String, Object])
], ApiRoute);
class ApiEntryPoints {
constructor() {
this.httpRoutes = [];
this.rpcActions = [];
}
}
exports.ApiEntryPoints = ApiEntryPoints;
ApiEntryPoints.__type = [() => ApiRoute, 'httpRoutes', function () { return []; }, () => ApiAction, 'rpcActions', function () { return []; }, 'ApiEntryPoints', 'P7!F3">#P7$F3%>&5w\''];
exports.ApiConsoleApi = (rpc_1.ControllerSymbol.Ω = [['!']], (0, rpc_1.ControllerSymbol)('.deepkit/api-console', [ApiRoute, ApiDocument, ApiAction]));
const __ΩApiConsoleApi = [() => ApiEntryPoints, 'getEntryPoints', () => ApiDocument, 'getDocument', 'ApiConsoleApi', 'PPP7!1"PP7#`1$Mw%y'];
exports.__ΩApiConsoleApi = __ΩApiConsoleApi;
//# sourceMappingURL=api.js.map