Skip to content

Commit

Permalink
chore: Fix documentation. Limit amount of exported symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Oct 11, 2020
1 parent f3ad933 commit 8eac2de
Show file tree
Hide file tree
Showing 60 changed files with 272 additions and 75 deletions.
1 change: 0 additions & 1 deletion docs/.vuepress/config.js
Expand Up @@ -257,7 +257,6 @@ module.exports = {
"/tutorials/throw-http-exceptions",
"/tutorials/not-found-page",
"/tutorials/aws",
"/tutorials/jest",
"/tutorials/seq",
"/docs/controllers",
"/docs/providers",
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/mvc/decorators/method/contentType.ts
Expand Up @@ -19,6 +19,7 @@ import {Returns} from "@tsed/schema";
* @response
* @headers
* @deprecated Since v6. Use @Returns().ContentType() instead.
* @ignore
*/
export function ContentType(type: string) {
return Returns().ContentType(type);
Expand Down
2 changes: 2 additions & 0 deletions packages/common/src/mvc/decorators/method/returnType.ts
Expand Up @@ -3,13 +3,15 @@ import {Returns as R, ReturnsChainedDecorators} from "@tsed/schema";

/**
* @deprecated Since v6.
* @ignore
*/
export interface ReturnTypeHeader {
value?: string | number;
}

/**
* @deprecated Since v6.
* @ignore
*/
export interface ReturnTypeOptions extends Partial<MetadataTypes> {
code?: number;
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/mvc/decorators/required.ts
Expand Up @@ -45,6 +45,7 @@ import {Allow} from "@tsed/schema";
* @schema
* @validation
* @deprecated Since v6. Use @Allow decorator from @tsed/schema instead of.
* @ignore
*/
export function Required(...allowedRequiredValues: any[]): any {
return Allow(...allowedRequiredValues);
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/mvc/interfaces/HandlerType.ts
@@ -1,3 +1,6 @@
/**
* @ignore
*/
export enum HandlerType {
CUSTOM = "custom",
ENDPOINT = "endpoint",
Expand Down
Expand Up @@ -2,7 +2,7 @@ import {Type} from "@tsed/core";
import {IParamOptions} from "./IParamOptions";

/**
*
* @ignore
*/
export interface IInjectableParamSettings<T> extends IParamOptions<T> {
target: Type<T>;
Expand Down
Expand Up @@ -27,10 +27,16 @@ import {
setLoggerLevel
} from "../utils";

/**
* @ignore
*/
export interface PlatformType<T = any> extends Type<T> {
providers: IProvider[];
}

/**
* @ignore
*/
export interface PlatformBootstrap {
bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder>;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/platform/PlatformModule.ts
Expand Up @@ -2,6 +2,9 @@ import {InjectorService, Module} from "@tsed/di";
import {ConverterService} from "../mvc";
import {Platform} from "./services/Platform";

/**
* @ignore
*/
@Module({
imports: [InjectorService, ConverterService, Platform]
})
Expand Down
Expand Up @@ -8,10 +8,16 @@ import {bindEndpointMiddleware} from "../middlewares/bindEndpointMiddleware";
import {PlatformRouter} from "../services/PlatformRouter";
import {useCtxHandler} from "../utils/useCtxHandler";

/**
* @ignore
*/
function formatMethod(method: string | undefined) {
return (method === OperationMethods.CUSTOM ? "use" : method || "use").toLowerCase();
}

/**
* @ignore
*/
export class PlatformControllerBuilder {
constructor(private provider: ControllerProvider) {}

Expand Down
9 changes: 9 additions & 0 deletions packages/common/src/platform/domain/HandlerContext.ts
Expand Up @@ -3,17 +3,26 @@ import {InjectorService} from "@tsed/di";
import {HandlerMetadata} from "../../mvc/models/HandlerMetadata";
import {PlatformContext} from "./PlatformContext";

/**
* @ignore
*/
function isResponse(obj: any) {
return obj.data && obj.headers && obj.status && obj.statusText;
}

/**
* @ignore
*/
export interface HandlerContextOptions {
$ctx: PlatformContext;
metadata: HandlerMetadata;
args: any[];
err?: any;
}

/**
* @ignore
*/
export enum HandlerContextStatus {
PENDING = "pending",
CANCELED = "canceled",
Expand Down
10 changes: 10 additions & 0 deletions packages/common/src/platform/interfaces/PlatformRouterMethods.ts
@@ -1,19 +1,29 @@
import {PathParamsType} from "../../mvc";

/**
* @ignore
*/
export interface PlatformRouteOptions {
method: string;
path: PathParamsType;
handlers: any[];
isFinal?: boolean;
}

/**
* @ignore
*/
export type PlatformRouteWithoutHandlers = Partial<Omit<PlatformRouteOptions, "handlers">>;

/**
* @ignore
*/
export interface PlatformRouterMethods<T = any> {
addRoute(routeOptions: PlatformRouteOptions): this;

use(...handlers: any[]): this;

callback(): any;

getRouter(): T;
}
6 changes: 4 additions & 2 deletions packages/common/src/platform/services/PlatformRouter.ts
@@ -1,12 +1,14 @@
import {Env} from "@tsed/core";
import {Constant, Inject, Injectable, InjectorService, ProviderScope} from "@tsed/di";
import {Inject, Injectable, InjectorService, ProviderScope} from "@tsed/di";
import {promisify} from "util";
import {PlatformMulter, PlatformMulterSettings, PlatformStaticsOptions} from "../../config";
import {PathParamsType} from "../../mvc/interfaces/PathParamsType";
import {PlatformRouteOptions, PlatformRouteWithoutHandlers} from "../interfaces/PlatformRouterMethods";
import {createFakeRawDriver} from "./FakeRawDriver";
import {PlatformHandler} from "./PlatformHandler";

/**
* @ignore
*/
export const PLATFORM_ROUTER_OPTIONS = Symbol.for("PlatformRouterOptions");

declare global {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/platform/utils/createContext.ts
Expand Up @@ -11,6 +11,7 @@ const defaultReqIdBuilder = () => uuidv4().replace(/-/gi, "");
* @param injector
* @param req
* @param res
* @ignore
*/
export async function createContext(injector: InjectorService, req: any, res: any): Promise<PlatformContext> {
const {level, ignoreUrlPatterns, maxStackSize, reqIdBuilder = defaultReqIdBuilder} = injector.settings.logger;
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/platform/utils/createHandlerMetadata.ts
Expand Up @@ -8,6 +8,9 @@ function isMetadata(input: any) {
return input instanceof HandlerMetadata;
}

/**
* @ignore
*/
export function createHandlerMetadata(
injector: InjectorService,
obj: any | EndpointMetadata,
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/platform/utils/renderView.ts
@@ -1,6 +1,9 @@
import {TemplateRenderError} from "../errors/TemplateRenderError";
import {PlatformContext} from "../domain/PlatformContext";

/**
* @ignore
*/
export async function renderView(data: any, ctx: PlatformContext) {
const {response, endpoint} = ctx;
try {
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/platform/utils/setResponseContentType.ts
@@ -1,6 +1,9 @@
import {PlatformContext} from "../domain/PlatformContext";
import {isObject} from "@tsed/core";

/**
* @ignore
*/
export function setResponseContentType(data: any, ctx: PlatformContext) {
const {endpoint, response} = ctx;
const {operation} = endpoint;
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/platform/utils/setResponseHeaders.ts
Expand Up @@ -9,6 +9,9 @@ function toHeaders(headers: {[key: string]: any}) {
}, {});
}

/**
* @ignore
*/
export function setResponseHeaders(ctx: PlatformContext) {
const {response, endpoint} = ctx;
const {operation} = endpoint;
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/platform/utils/useCtxHandler.ts
Expand Up @@ -6,6 +6,7 @@ export type PlatformCtxHandler = ($ctx: PlatformContext) => any | Promise<any>;
/**
* Create Ts.ED context handler
* @param fn
* @ignore
*/
export function useCtxHandler(fn: PlatformCtxHandler & {type?: HandlerType}) {
fn.type = HandlerType.CTX_FN;
Expand Down
17 changes: 15 additions & 2 deletions packages/core/src/class/Store.ts
@@ -1,12 +1,25 @@
import {DecoratorParameters} from "../interfaces";
import {deepClone, deepExtends, descriptorOf, getDecoratorType, isSymbol, nameOf} from "../utils";
import {Metadata} from "./Metadata";

/**
* @ignore
*/
export const CLASS_STORE = "tsed:class:store";
/**
* @ignore
*/
export const METHOD_STORE = "tsed:method:store";
/**
* @ignore
*/
export const PROPERTY_STORE = "tsed:property:store";
/**
* @ignore
*/
export const PARAM_STORE = "tsed:param:store";

/**
* @ignore
*/
export type StoreMap = Map<string, any>;

const stores = new Map<symbol, any>();
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/utils/cleanObject.ts
Expand Up @@ -2,7 +2,6 @@
* Remove undefined value
* @param obj
*/

export function cleanObject(obj: any): any {
return Object.entries(obj).reduce(
(obj, [key, value]) =>
Expand Down
17 changes: 16 additions & 1 deletion packages/core/src/utils/proxyDelegation.ts
@@ -1,8 +1,22 @@
/**
* @ignore
*/
export type ProxyDelegationGetter<T = any> = (target: T, property: PropertyKey) => any | undefined;
/**
* @ignore
*/
export type ProxyDelegationRemove<T = any> = (target: T, property: PropertyKey) => any;
/**
* @ignore
*/
export type ProxyDelegationSetter<T = any> = (target: T, property: PropertyKey, value: any, receiver: any) => any;
/**
* @ignore
*/
export type ProxyDelegationOwnKeys<T = any> = (target: T) => PropertyKey[];

/**
* @ignore
*/
export interface ProxyDelegation<T extends object> {
handlers?: ProxyHandler<T>;
getter?: ProxyDelegationGetter<T>;
Expand All @@ -15,6 +29,7 @@ export interface ProxyDelegation<T extends object> {
* Create a complete and iterable trap.
* @param self
* @param options
* @ignore
*/
export function proxyDelegation<T extends object = any>(self: any, options: ProxyDelegation<T> = {}) {
const {handlers = {}, remove, ownKeys} = options;
Expand Down
4 changes: 2 additions & 2 deletions packages/di/src/decorators/module.ts
Expand Up @@ -3,7 +3,7 @@ import {IDIResolver, ProviderScope, ProviderType, TokenProvider} from "../interf
import {Configuration} from "./configuration";
import {Injectable} from "./injectable";

export interface IModuleOptions extends Omit<TsED.Configuration, "scopes"> {
export interface ModuleOptions extends Omit<TsED.Configuration, "scopes"> {
/**
* Provider scope
*/
Expand Down Expand Up @@ -38,7 +38,7 @@ export interface IModuleOptions extends Omit<TsED.Configuration, "scopes"> {
* @param options
* @decorator
*/
export function Module(options: Partial<IModuleOptions> = {}) {
export function Module(options: Partial<ModuleOptions> = {}) {
const {scopes, imports, resolvers, deps, scope, ...configuration} = options;

return applyDecorators(
Expand Down
3 changes: 3 additions & 0 deletions packages/graphql/src/GraphQLModule.ts
Expand Up @@ -2,6 +2,9 @@ import {AfterListen, Configuration, Constant, InjectorService, Module, OnInit} f
import {GraphQLSettings} from "./interfaces/GraphQLSettings";
import {GraphQLService} from "./services/GraphQLService";

/**
* @ignore
*/
@Module()
export class GraphQLModule implements OnInit, AfterListen {
@Constant("graphql", {})
Expand Down
3 changes: 3 additions & 0 deletions packages/mongoose/src/MongooseModule.ts
Expand Up @@ -3,6 +3,9 @@ import {ValidationErrorMiddleware} from "./middlewares/ValidationErrorMiddleware
import {MONGOOSE_CONNECTIONS} from "./services/MongooseConnections";
import {MongooseService} from "./services/MongooseService";

/**
* @ignore
*/
@Module({
imports: [MONGOOSE_CONNECTIONS]
})
Expand Down
4 changes: 2 additions & 2 deletions packages/mongoose/src/decorators/virtualRef.ts
Expand Up @@ -6,8 +6,8 @@ export interface MongooseVirtualRefOptions {
/**
* @deprecated Since v6. Use ref instead.
*/
type?: string | Type<any>;
ref?: string | Type<any>;
type?: string | Type<any> | (() => Type<any>);
ref?: string | Type<any> | (() => Type<any>);
foreignField?: string;
localField?: string;
justOne?: boolean;
Expand Down
9 changes: 0 additions & 9 deletions packages/mongoose/src/interfaces/MongooseVirtualRefOptions.ts

This file was deleted.

6 changes: 6 additions & 0 deletions packages/mongoose/src/services/MongooseConnections.ts
Expand Up @@ -3,8 +3,14 @@ import {isArray} from "@tsed/core";
import {MDBConnection} from "../interfaces";
import {MongooseService} from "../services/MongooseService";

/**
* @ignore
*/
// tslint:disable-next-line:variable-name
export const MONGOOSE_CONNECTIONS = Symbol.for("MONGOOSE_CONNECTIONS");
/**
* @ignore
*/
export type MONGOOSE_CONNECTIONS = MongooseService;

function mapOptions(options: Omit<MDBConnection, "id"> | MDBConnection[]): MDBConnection[] {
Expand Down
11 changes: 0 additions & 11 deletions packages/mongoose/src/utils/cleanProps.ts

This file was deleted.

0 comments on commit 8eac2de

Please sign in to comment.