@nestia/core
Version:
Super-fast validation decorators of NestJS
55 lines (54 loc) • 2.68 kB
TypeScript
import { IEncryptionPassword } from "@nestia/fetcher/lib/IEncryptionPassword";
import { Module } from "@nestjs/common";
/**
* Encrypted module.
*
* `EncryptedModule` is an extension of the {@link Module} class decorator
* function who configures encryption password of the AES-128/256 algorithm. The
* encryption algorithm and password would be used by {@link EncryptedRoute} and
* {@link EncryptedBody} to encrypt the request and response bod of the HTTP
* protocol.
*
* By using this `EncryptedModule` decorator function, all of the
* {@link Controller controllers} configured in the _metadata_ would be
* automatically changed to the {@link EncryptedController} with the _password_.
* If there're some original {@link EncryptedController} decorated classes in the
* _metadata_, their encryption password would be kept.
*
* Therefore, if you're planning to place original {@link EncryptedController}
* decorated classes in the _metadata_, I hope them to have different encryption
* password from the module level. If not, I recommend you use the
* {@link Controller} decorator function instead.
*
* In addition, the `EncryptedModule` supports a convenient dynamic controller
* importing function, {@link EncryptedModule.dynamic}. If you utilize the
* function with directory path of the controller classes, it imports and
* configures the controller classes into the `Module`, automatically.
*
* @author Jeongho Nam - https://github.com/samchon
* @param metadata Module configuration metadata
* @param password Encryption password or its getter function
* @returns Class decorator
*/
export declare function EncryptedModule(metadata: Parameters<typeof Module>[0], password: IEncryptionPassword.Closure): ClassDecorator;
export declare namespace EncryptedModule {
/**
* Dynamic encrypted module.
*
* `EncryptedModule.dynamic` is an extension of the {@link EncryptedModule}
* function who configures controller classes by the dynamic importing. By
* specifying directory path of the controller classes, those controllers
* would be automatically imported and configured.
*
* @param path Directory path of the controller classes
* @param password Encryption password or its getter function
* @param options Additional options except controller
* @returns Class decorated module instance
*/
function dynamic(path: string | string[] | {
include: string[];
exclude?: string[];
}, password: IEncryptionPassword | IEncryptionPassword.Closure, options?: Omit<Parameters<typeof Module>[0], "controllers">, isTsNode?: boolean): Promise<{
new (): {};
}>;
}