diff --git a/src/decorator/async-inject.ts b/src/decorator/async-inject.ts index 907e601..a0cfdca 100644 --- a/src/decorator/async-inject.ts +++ b/src/decorator/async-inject.ts @@ -9,7 +9,7 @@ import { AsyncProviderFactory, StaticStore } from '../struct'; * @publicApi */ export function AsyncInjectable(target: Type) { - StaticStore.set(target.name); + StaticStore.set(target.name, Symbol(target.name)); } /** * Use this decorator to inject the asynchronous provider into the class instantiation process. @@ -19,6 +19,5 @@ export function AsyncInjectable(target: Type) { * @publicApi */ export function AsyncInject(target: Type) { - const token = (target as any).getToken(); - return Inject(token); + return Inject((target as any).getToken()); } diff --git a/src/decorator/controller.ts b/src/decorator/controller.ts index 7e354e1..4150177 100644 --- a/src/decorator/controller.ts +++ b/src/decorator/controller.ts @@ -1,14 +1,27 @@ import { AnyFilesInterceptor } from '@nestjs/platform-express'; -import { applyDecorators, Post as Default, HttpCode, UseInterceptors } from '@nestjs/common'; +import { applyDecorators, Post as DefaultPost, HttpCode, UseInterceptors } from '@nestjs/common'; +/** + * Route handler (method) Decorator. Routes HTTP POST requests to the specified path. + * + * @see [Routing](https://docs.nestjs.com/controllers#routing) + * + * @publicApi + */ export function Post(path: string | string[]) { return applyDecorators( - Default(path), + DefaultPost(path), HttpCode(200), ); } - +/** + * Route handler (method) Decorator. Routes HTTP POST FormData requests to the specified path. + * + * @see [Routing](https://docs.nestjs.com/controllers#routing) + * + * @publicApi + */ export function PostFormData(path: string | string[]) { return applyDecorators( Post(path), diff --git a/src/index.ts b/src/index.ts index f48c0a9..f5c6779 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,5 +21,4 @@ export { }; export { AsyncProviderFactory } from './struct'; - export * from './common'; diff --git a/src/struct/async-provider-factory.ts b/src/struct/async-provider-factory.ts index fd0ebea..425bd0e 100644 --- a/src/struct/async-provider-factory.ts +++ b/src/struct/async-provider-factory.ts @@ -1,5 +1,7 @@ import { FactoryProvider } from '../common'; +import { StaticStore } from './store'; + /** * Asynchronous provider factory for creating * @@ -15,12 +17,13 @@ export class AsyncProviderFactory { */ public create: (...args: any[]) => FactoryProvider; /** + * Gets the static token for the async provider factory class. * - * @returns this.name + * @returns symbol * - * @publicApi + * @publicStaticApi */ public static getToken() { - return this.name; + return StaticStore.get(this.name); } } diff --git a/src/struct/store.ts b/src/struct/store.ts index 3ab8396..956cdc3 100644 --- a/src/struct/store.ts +++ b/src/struct/store.ts @@ -5,7 +5,7 @@ export class StaticStore { return StaticStore.map.get(key); } - public static set(key: string) { - StaticStore.map.set(key, Symbol(key)); + public static set(key: string, token: symbol) { + StaticStore.map.set(key, token); } }