Initial commit - Event Planner application

This commit is contained in:
mberlin
2026-03-18 14:55:56 -03:00
commit 86d779eb4d
7548 changed files with 1006324 additions and 0 deletions

22
node_modules/@nestjs/common/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2017-present Kamil Mysliwiec <https://kamilmysliwiec.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
node_modules/@nestjs/common/PACKAGE.md generated vendored Normal file
View File

@@ -0,0 +1 @@
The common package comes with decorators such as `@Controller()`, `@Injectable()` and so on.

146
node_modules/@nestjs/common/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,146 @@
<p align="center">
<a href="https://nestjs.com/" target="_blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
<p align="center">A progressive <a href="https://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://github.com/nestjs/nest/blob/master/LICENSE" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description
Nest is a framework for building efficient, scalable <a href="https://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="https://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also provides compatibility with a wide range of other libraries, like <a href="https://github.com/fastify/fastify" target="_blank">Fastify</a>, allowing for easy use of the myriad of third-party plugins which are available.</p>
## Philosophy
<p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front-end and back-end applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a>, and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a>, which improve developer productivity and enable the construction of fast, testable, and extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers, and tools for Node, none of them effectively solve the main problem - the architecture.</p>
<p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, and loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.</p>
## Getting started
- To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
- 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
- [가이드](readme_kr.md) 문서는 [docs.nestjs.com](https://docs.nestjs.com)에서 확인하실 수 있습니다. :books:
- [ガイド](readme_jp.md)は [docs.nestjs.com](https://docs.nestjs.com)でご確認ください。 :books:
## Questions
For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
## Issues
Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
## Consulting
With official support, you can get expert help straight from the Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
#### Principal Sponsors
<table style="text-align:center;">
<tr>
<td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="200" valign="middle" /></a></td>
<td><a href="https://microsoft.com/" target="_blank"><img src="https://nestjs.com/img/logos/microsoft-logo.png" width="180" valign="middle" /></a></td>
<td><a href="https://mojam.co" target="_blank"><img src="https://nestjs.com/img/logos/mojam-logo.png" width="80" valign="middle" /></a></td>
<td><a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td>
<td><a href="https://serpapi.com/" target="_blank"><img src="https://nestjs.com/img/logos/serpapi-logo.png" width="150" valign="middle" /></a></td>
</tr>
</table>
#### Gold Sponsors
<table style="text-align:center;">
<tr>
<td><a href="https://www.redhat.com" target="_blank"><img src="https://nestjs.com/img/logos/red-hat-logo.svg" width="200" valign="middle" /></a></td>
<td><a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td>
<td><a href="https://nx.dev" target="_blank"><img src="https://nestjs.com/img/logos/nx-logo.png" height="45" valign="middle" /></a></td>
<td><a href="https://intrinsic.ventures/" target="_blank"><img src="https://nestjs.com/img/logos/intrinisic-logo.png" width="210" valign="middle" /></a></td>
<td><a href="https://jetbrains.com/" target="_blank"><img src="https://nestjs.com/img/logos/jetbrains-logo.svg" width="90" valign="middle" /></a></td>
</tr>
<tr>
<td><a href="https://snyk.co/nestjs" target="_blank"><img src="https://nestjs.com/img/logos/snyk-logo-black.png" width="185" valign="middle" /></a></td>
<td><a href="https://www.movavi.com/imovie-for-windows.html" target="_blank"><img src="https://nestjs.com/img/logos/movavi-logo.svg" width="105" valign="middle" /></a></td>
</tr>
</table>
#### Silver Sponsors
<table style="text-align:center;">
<tr>
<td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/logos/mercedes-logo.png" width="100" valign="middle" /></a></td>
<td><a href="https://www.dinii.jp/" target="_blank"><img src="https://nestjs.com/img/logos/dinii-logo.png" width="65" valign="middle" /></a></td>
<td><a href="https://handsontable.com/docs/react-data-grid/?utm_source=NestJS_GH&utm_medium=sponsorship&utm_campaign=library_sponsorship_2024" target="_blank"><img src="https://nestjs.com/img/logos/handsontable-dark-logo.svg#2" width="150" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.itflashcards.com/" target="_blank"><img src="https://nestjs.com/img/logos/it_flashcards-logo.png" width="170" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://arcjet.com/?ref=nestjs" target="_blank"><img src="https://nestjs.com/img/logos/arcjet-logo.svg" width="170" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://crawljobs.com" target="_blank"><img src="https://nestjs.com/img/logos/crawljobs-logo.svg" width="130" valign="middle" /></a></td>
</tr><tr>
<td align="center" valign="middle"><a href="https://pandektes.com" target="_blank"><img src="https://nestjs.com/img/logos/pandektes-logo.png" width="65" valign="middle" /></a></td>
</tr>
</table>
#### Sponsors
<table>
<tr>
<td align="center" valign="middle"><a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/logos/swingdev-logo.svg#1" width="110" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/logos/novologic.png" width="110" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/logos/mantro-logo.svg" width="95" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/logos/triplebyte.png" width="107" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/logos/nearpod-logo.svg" width="100" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/logos/genuinebee.svg" width="97" valign="middle" /></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/logos/vpn-review-logo.png" width="85" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://lambda-it.ch/" target="_blank"><img src="https://nestjs.com/img/logos/lambda-it-logo.svg" width="115" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://rocketech.it/cases/?utm_source=google&utm_medium=badge&utm_campaign=nestjs" target="_blank"><img src="https://nestjs.com/img/logos/rocketech-logo.svg" width="110" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.anonymistic.com/" target="_blank"><img src="https://nestjs.com/img/logos/anonymistic-logo.png" width="125" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.naologic.com/" target="_blank"><img src="https://nestjs.com/img/logos/naologic-logo.svg" width="125" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://triplecore.io" target="_blank"><img src="https://nestjs.com/img/logos/triplecore-logo.svg" width="50" valign="middle" /></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="https://polygon-software.ch/" target="_blank"><img src="https://nestjs.com/img/logos/polygon-logo.svg" width="120" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://boringowl.io/" target="_blank"><img src="https://nestjs.com/img/logos/boringowl-logo.svg" width="120" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://nordbot.app/" target="_blank"><img src="https://nestjs.com/img/logos/nordbot-logo.png" width="120" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://doppio.sh/" target="_blank"><img src="https://nestjs.com/img/logos/dopiosh-logo.png" width="50" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/logos/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.tripoffice.com/" target="_blank"><img src="https://nestjs.com/img/logos/tripoffice-logo.png" width="140" valign="middle" /></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="https://solcellsforetag.se/" target="_blank"><img src="https://nestjs.com/img/logos/solcellsforetag-logo.svg" width="140" valign="middle" /></a></td>
<td align="center" valign="middle"><a href="https://www.route4me.com/" target="_blank"><img src="https://nestjs.com/img/logos/route4me-logo.svg" width="100" valign="middle" /></a></td>
</tr>
</table>
## Backers
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1000"></a>
## Stay in touch
- Author - [Kamil Myśliwiec](https://x.com/kammysliwiec)
- Website - [https://nestjs.com](https://nestjs.com/)
- X - [@nestframework](https://x.com/nestframework)
## License
Nest is [MIT licensed](LICENSE).

42
node_modules/@nestjs/common/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
export declare const MODULE_METADATA: {
IMPORTS: string;
PROVIDERS: string;
CONTROLLERS: string;
EXPORTS: string;
};
export declare const GLOBAL_MODULE_METADATA = "__module:global__";
export declare const HOST_METADATA = "host";
export declare const PATH_METADATA = "path";
export declare const PARAMTYPES_METADATA = "design:paramtypes";
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
export declare const OPTIONAL_DEPS_METADATA = "optional:paramtypes";
export declare const PROPERTY_DEPS_METADATA = "self:properties_metadata";
export declare const OPTIONAL_PROPERTY_DEPS_METADATA = "optional:properties_metadata";
export declare const SCOPE_OPTIONS_METADATA = "scope:options";
export declare const METHOD_METADATA = "method";
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
export declare const CUSTOM_ROUTE_ARGS_METADATA = "__customRouteArgs__";
export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
export declare const PIPES_METADATA = "__pipes__";
export declare const GUARDS_METADATA = "__guards__";
export declare const INTERCEPTORS_METADATA = "__interceptors__";
export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
export declare const ENHANCER_KEY_TO_SUBTYPE_MAP: {
readonly __guards__: "guard";
readonly __interceptors__: "interceptor";
readonly __pipes__: "pipe";
readonly __exceptionFilters__: "filter";
};
export type EnhancerSubtype = (typeof ENHANCER_KEY_TO_SUBTYPE_MAP)[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
export declare const RENDER_METADATA = "__renderTemplate__";
export declare const HTTP_CODE_METADATA = "__httpCode__";
export declare const MODULE_PATH = "__module_path__";
export declare const HEADERS_METADATA = "__headers__";
export declare const REDIRECT_METADATA = "__redirect__";
export declare const RESPONSE_PASSTHROUGH_METADATA = "__responsePassthrough__";
export declare const SSE_METADATA = "__sse__";
export declare const VERSION_METADATA = "__version__";
export declare const INJECTABLE_WATERMARK = "__injectable__";
export declare const CONTROLLER_WATERMARK = "__controller__";
export declare const CATCH_WATERMARK = "__catch__";
export declare const ENTRY_PROVIDER_WATERMARK = "__entryProvider__";

44
node_modules/@nestjs/common/constants.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ENTRY_PROVIDER_WATERMARK = exports.CATCH_WATERMARK = exports.CONTROLLER_WATERMARK = exports.INJECTABLE_WATERMARK = exports.VERSION_METADATA = exports.SSE_METADATA = exports.RESPONSE_PASSTHROUGH_METADATA = exports.REDIRECT_METADATA = exports.HEADERS_METADATA = exports.MODULE_PATH = exports.HTTP_CODE_METADATA = exports.RENDER_METADATA = exports.ENHANCER_KEY_TO_SUBTYPE_MAP = exports.EXCEPTION_FILTERS_METADATA = exports.INTERCEPTORS_METADATA = exports.GUARDS_METADATA = exports.PIPES_METADATA = exports.FILTER_CATCH_EXCEPTIONS = exports.CUSTOM_ROUTE_ARGS_METADATA = exports.ROUTE_ARGS_METADATA = exports.METHOD_METADATA = exports.SCOPE_OPTIONS_METADATA = exports.OPTIONAL_PROPERTY_DEPS_METADATA = exports.PROPERTY_DEPS_METADATA = exports.OPTIONAL_DEPS_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.PATH_METADATA = exports.HOST_METADATA = exports.GLOBAL_MODULE_METADATA = exports.MODULE_METADATA = void 0;
exports.MODULE_METADATA = {
IMPORTS: 'imports',
PROVIDERS: 'providers',
CONTROLLERS: 'controllers',
EXPORTS: 'exports',
};
exports.GLOBAL_MODULE_METADATA = '__module:global__';
exports.HOST_METADATA = 'host';
exports.PATH_METADATA = 'path';
exports.PARAMTYPES_METADATA = 'design:paramtypes';
exports.SELF_DECLARED_DEPS_METADATA = 'self:paramtypes';
exports.OPTIONAL_DEPS_METADATA = 'optional:paramtypes';
exports.PROPERTY_DEPS_METADATA = 'self:properties_metadata';
exports.OPTIONAL_PROPERTY_DEPS_METADATA = 'optional:properties_metadata';
exports.SCOPE_OPTIONS_METADATA = 'scope:options';
exports.METHOD_METADATA = 'method';
exports.ROUTE_ARGS_METADATA = '__routeArguments__';
exports.CUSTOM_ROUTE_ARGS_METADATA = '__customRouteArgs__';
exports.FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
exports.PIPES_METADATA = '__pipes__';
exports.GUARDS_METADATA = '__guards__';
exports.INTERCEPTORS_METADATA = '__interceptors__';
exports.EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
exports.ENHANCER_KEY_TO_SUBTYPE_MAP = {
[exports.GUARDS_METADATA]: 'guard',
[exports.INTERCEPTORS_METADATA]: 'interceptor',
[exports.PIPES_METADATA]: 'pipe',
[exports.EXCEPTION_FILTERS_METADATA]: 'filter',
};
exports.RENDER_METADATA = '__renderTemplate__';
exports.HTTP_CODE_METADATA = '__httpCode__';
exports.MODULE_PATH = '__module_path__';
exports.HEADERS_METADATA = '__headers__';
exports.REDIRECT_METADATA = '__redirect__';
exports.RESPONSE_PASSTHROUGH_METADATA = '__responsePassthrough__';
exports.SSE_METADATA = '__sse__';
exports.VERSION_METADATA = '__version__';
exports.INJECTABLE_WATERMARK = '__injectable__';
exports.CONTROLLER_WATERMARK = '__controller__';
exports.CATCH_WATERMARK = '__catch__';
exports.ENTRY_PROVIDER_WATERMARK = '__entryProvider__';

View File

@@ -0,0 +1,10 @@
/**
* Function that returns a new decorator that applies all decorators provided by param
*
* Useful to build new decorators (or a decorator factory) encapsulating multiple decorators related with the same feature
*
* @param decorators one or more decorators (e.g., `ApplyGuard(...)`)
*
* @publicApi
*/
export declare function applyDecorators(...decorators: Array<ClassDecorator | MethodDecorator | PropertyDecorator>): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyDecorators = applyDecorators;
/**
* Function that returns a new decorator that applies all decorators provided by param
*
* Useful to build new decorators (or a decorator factory) encapsulating multiple decorators related with the same feature
*
* @param decorators one or more decorators (e.g., `ApplyGuard(...)`)
*
* @publicApi
*/
function applyDecorators(...decorators) {
return (target, propertyKey, descriptor) => {
for (const decorator of decorators) {
if (target instanceof Function && !descriptor) {
decorator(target);
continue;
}
decorator(target, propertyKey, descriptor);
}
};
}

View File

@@ -0,0 +1,11 @@
/**
* Decorator that binds *parameter decorators* to the method that follows.
*
* Useful when the language doesn't provide a 'Parameter Decorator' feature
* (i.e., vanilla JavaScript).
*
* @param decorators one or more parameter decorators (e.g., `Req()`)
*
* @publicApi
*/
export declare function Bind(...decorators: any[]): MethodDecorator;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bind = Bind;
/**
* Decorator that binds *parameter decorators* to the method that follows.
*
* Useful when the language doesn't provide a 'Parameter Decorator' feature
* (i.e., vanilla JavaScript).
*
* @param decorators one or more parameter decorators (e.g., `Req()`)
*
* @publicApi
*/
function Bind(...decorators) {
return (target, key, descriptor) => {
decorators.forEach((fn, index) => fn(target, key, index));
return descriptor;
};
}

View File

@@ -0,0 +1,19 @@
import { Type, Abstract } from '../../interfaces';
/**
* Decorator that marks a class as a Nest exception filter. An exception filter
* handles exceptions thrown by or not handled by your application code.
*
* The decorated class must implement the `ExceptionFilter` interface.
*
* @param exceptions one or more exception *types* specifying
* the exceptions to be caught and handled by this filter.
*
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
*
* @usageNotes
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
* with `app.useGlobalFilters()`.
*
* @publicApi
*/
export declare function Catch(...exceptions: Array<Type<any> | Abstract<any>>): ClassDecorator;

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Catch = Catch;
const constants_1 = require("../../constants");
/**
* Decorator that marks a class as a Nest exception filter. An exception filter
* handles exceptions thrown by or not handled by your application code.
*
* The decorated class must implement the `ExceptionFilter` interface.
*
* @param exceptions one or more exception *types* specifying
* the exceptions to be caught and handled by this filter.
*
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
*
* @usageNotes
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
* with `app.useGlobalFilters()`.
*
* @publicApi
*/
function Catch(...exceptions) {
return (target) => {
Reflect.defineMetadata(constants_1.CATCH_WATERMARK, true, target);
Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
};
}

View File

@@ -0,0 +1,102 @@
import { ScopeOptions, VersionOptions } from '../../interfaces';
/**
* Interface defining options that can be passed to `@Controller()` decorator
*
* @publicApi
*/
export interface ControllerOptions extends ScopeOptions, VersionOptions {
/**
* Specifies an optional `route path prefix`. The prefix is pre-pended to the
* path specified in any request decorator in the class.
*
* Supported only by HTTP-based applications (does not apply to non-HTTP microservices).
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*/
path?: string | string[];
/**
* Specifies an optional HTTP Request host filter. When configured, methods
* within the controller will only be routed if the request host matches the
* specified value.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*/
host?: string | RegExp | Array<string | RegExp>;
}
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /users/resume`.
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
*
* @publicApi
*/
export declare function Controller(): ClassDecorator;
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /users/resume`.
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param {string|Array} prefix string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
*
* @publicApi
*/
export declare function Controller(prefix: string | string[]): ClassDecorator;
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /users/resume`.
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param {object} options configuration object specifying:
*
* - `scope` - symbol that determines the lifetime of a Controller instance.
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
* more details.
* - `prefix` - string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
* - `version` - string, array of strings, or Symbol that defines the version
* of all routes in the class. [See Versioning](https://docs.nestjs.com/techniques/versioning)
* for more details.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
* @see [Versioning](https://docs.nestjs.com/techniques/versioning)
*
* @publicApi
*/
export declare function Controller(options: ControllerOptions): ClassDecorator;

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Controller = Controller;
const constants_1 = require("../../constants");
const shared_utils_1 = require("../../utils/shared.utils");
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /users/resume`
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param prefixOrOptions a `route path prefix` or a `ControllerOptions` object.
* A `route path prefix` is pre-pended to the path specified in any request decorator
* in the class. `ControllerOptions` is an options configuration object specifying:
* - `scope` - symbol that determines the lifetime of a Controller instance.
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
* more details.
* - `prefix` - string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
* - `version` - string, array of strings, or Symbol that defines the version
* of all routes in the class. [See Versioning](https://docs.nestjs.com/techniques/versioning)
* for more details.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
* @see [Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage)
* @see [Versioning](https://docs.nestjs.com/techniques/versioning)
*
* @publicApi
*/
function Controller(prefixOrOptions) {
const defaultPath = '/';
const [path, host, scopeOptions, versionOptions] = (0, shared_utils_1.isUndefined)(prefixOrOptions)
? [defaultPath, undefined, undefined, undefined]
: (0, shared_utils_1.isString)(prefixOrOptions) || Array.isArray(prefixOrOptions)
? [prefixOrOptions, undefined, undefined, undefined]
: [
prefixOrOptions.path || defaultPath,
prefixOrOptions.host,
{ scope: prefixOrOptions.scope, durable: prefixOrOptions.durable },
Array.isArray(prefixOrOptions.version)
? Array.from(new Set(prefixOrOptions.version))
: prefixOrOptions.version,
];
return (target) => {
Reflect.defineMetadata(constants_1.CONTROLLER_WATERMARK, true, target);
Reflect.defineMetadata(constants_1.PATH_METADATA, path, target);
Reflect.defineMetadata(constants_1.HOST_METADATA, host, target);
Reflect.defineMetadata(constants_1.SCOPE_OPTIONS_METADATA, scopeOptions, target);
Reflect.defineMetadata(constants_1.VERSION_METADATA, versionOptions, target);
};
}

View File

@@ -0,0 +1,7 @@
export declare function flatten<T extends Array<unknown> = any>(arr: T): T extends Array<infer R> ? R : never;
/**
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
*
* @publicApi
*/
export declare const Dependencies: (...dependencies: Array<unknown>) => ClassDecorator;

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Dependencies = void 0;
exports.flatten = flatten;
const constants_1 = require("../../constants");
function flatten(arr) {
const flat = [].concat(...arr);
return flat.some(Array.isArray)
? flatten(flat)
: flat;
}
/**
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
*
* @publicApi
*/
const Dependencies = (...dependencies) => {
const flattenDeps = flatten(dependencies);
return (target) => {
Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, flattenDeps, target);
};
};
exports.Dependencies = Dependencies;

View File

@@ -0,0 +1,23 @@
import { ExceptionFilter } from '../../index';
/**
* Decorator that binds exception filters to the scope of the controller or
* method, depending on its context.
*
* When `@UseFilters` is used at the controller level, the filter will be
* applied to every handler (method) in the controller.
*
* When `@UseFilters` is used at the individual handler level, the filter
* will apply only to that specific method.
*
* @param filters exception filter instance or class, or a list of exception
* filter instances or classes.
*
* @see [Exception filters](https://docs.nestjs.com/exception-filters)
*
* @usageNotes
* Exception filters can also be set up globally for all controllers and routes
* using `app.useGlobalFilters()`. [See here for details](https://docs.nestjs.com/exception-filters#binding-filters)
*
* @publicApi
*/
export declare const UseFilters: (...filters: (ExceptionFilter | Function)[]) => MethodDecorator & ClassDecorator;

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UseFilters = void 0;
const constants_1 = require("../../constants");
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
const shared_utils_1 = require("../../utils/shared.utils");
const validate_each_util_1 = require("../../utils/validate-each.util");
/**
* Decorator that binds exception filters to the scope of the controller or
* method, depending on its context.
*
* When `@UseFilters` is used at the controller level, the filter will be
* applied to every handler (method) in the controller.
*
* When `@UseFilters` is used at the individual handler level, the filter
* will apply only to that specific method.
*
* @param filters exception filter instance or class, or a list of exception
* filter instances or classes.
*
* @see [Exception filters](https://docs.nestjs.com/exception-filters)
*
* @usageNotes
* Exception filters can also be set up globally for all controllers and routes
* using `app.useGlobalFilters()`. [See here for details](https://docs.nestjs.com/exception-filters#binding-filters)
*
* @publicApi
*/
const UseFilters = (...filters) => addExceptionFiltersMetadata(...filters);
exports.UseFilters = UseFilters;
function addExceptionFiltersMetadata(...filters) {
return (target, key, descriptor) => {
const isFilterValid = (filter) => filter && ((0, shared_utils_1.isFunction)(filter) || (0, shared_utils_1.isFunction)(filter.catch));
if (descriptor) {
(0, validate_each_util_1.validateEach)(target.constructor, filters, isFilterValid, '@UseFilters', 'filter');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
return descriptor;
}
(0, validate_each_util_1.validateEach)(target, filters, isFilterValid, '@UseFilters', 'filter');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
return target;
};
}

14
node_modules/@nestjs/common/decorators/core/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export * from './bind.decorator';
export * from './catch.decorator';
export * from './controller.decorator';
export * from './dependencies.decorator';
export * from './exception-filters.decorator';
export * from './inject.decorator';
export * from './injectable.decorator';
export * from './optional.decorator';
export * from './set-metadata.decorator';
export * from './use-guards.decorator';
export * from './use-interceptors.decorator';
export * from './use-pipes.decorator';
export * from './apply-decorators';
export * from './version.decorator';

17
node_modules/@nestjs/common/decorators/core/index.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./bind.decorator"), exports);
tslib_1.__exportStar(require("./catch.decorator"), exports);
tslib_1.__exportStar(require("./controller.decorator"), exports);
tslib_1.__exportStar(require("./dependencies.decorator"), exports);
tslib_1.__exportStar(require("./exception-filters.decorator"), exports);
tslib_1.__exportStar(require("./inject.decorator"), exports);
tslib_1.__exportStar(require("./injectable.decorator"), exports);
tslib_1.__exportStar(require("./optional.decorator"), exports);
tslib_1.__exportStar(require("./set-metadata.decorator"), exports);
tslib_1.__exportStar(require("./use-guards.decorator"), exports);
tslib_1.__exportStar(require("./use-interceptors.decorator"), exports);
tslib_1.__exportStar(require("./use-pipes.decorator"), exports);
tslib_1.__exportStar(require("./apply-decorators"), exports);
tslib_1.__exportStar(require("./version.decorator"), exports);

View File

@@ -0,0 +1,31 @@
import { ForwardReference, InjectionToken } from '../../interfaces';
/**
* Decorator that marks a constructor parameter as a target for
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
*
* Any injected provider must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
* can be done by:
*
* - defining the provider in the same module scope
* - exporting the provider from one module scope and importing that module into the
* module scope of the class being injected into
* - exporting the provider from a module that is marked as global using the
* `@Global()` decorator
*
* #### Injection tokens
* Can be *types* (class names), *strings* or *symbols*. This depends on how the
* provider with which it is associated was defined. Providers defined with the
* `@Injectable()` decorator use the class name. Custom Providers may use strings
* or symbols as the injection token.
*
* @param token lookup key for the provider to be injected (assigned to the constructor
* parameter).
*
* @see [Providers](https://docs.nestjs.com/providers)
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
export declare function Inject(token?: InjectionToken | ForwardReference): PropertyDecorator & ParameterDecorator;

View File

@@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Inject = Inject;
const constants_1 = require("../../constants");
const shared_utils_1 = require("../../utils/shared.utils");
/**
* Decorator that marks a constructor parameter as a target for
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
*
* Any injected provider must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
* can be done by:
*
* - defining the provider in the same module scope
* - exporting the provider from one module scope and importing that module into the
* module scope of the class being injected into
* - exporting the provider from a module that is marked as global using the
* `@Global()` decorator
*
* #### Injection tokens
* Can be *types* (class names), *strings* or *symbols*. This depends on how the
* provider with which it is associated was defined. Providers defined with the
* `@Injectable()` decorator use the class name. Custom Providers may use strings
* or symbols as the injection token.
*
* @param token lookup key for the provider to be injected (assigned to the constructor
* parameter).
*
* @see [Providers](https://docs.nestjs.com/providers)
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
function Inject(token) {
const injectCallHasArguments = arguments.length > 0;
return (target, key, index) => {
let type = token || Reflect.getMetadata('design:type', target, key);
// Try to infer the token in a constructor-based injection
if (!type && !injectCallHasArguments) {
type = Reflect.getMetadata(constants_1.PARAMTYPES_METADATA, target, key)?.[index];
}
if (!(0, shared_utils_1.isUndefined)(index)) {
let dependencies = Reflect.getMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, target) || [];
dependencies = [...dependencies, { index, param: type }];
Reflect.defineMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, dependencies, target);
return;
}
let properties = Reflect.getMetadata(constants_1.PROPERTY_DEPS_METADATA, target.constructor) || [];
properties = [...properties, { key, type }];
Reflect.defineMetadata(constants_1.PROPERTY_DEPS_METADATA, properties, target.constructor);
};
}

View File

@@ -0,0 +1,43 @@
import { ScopeOptions } from '../../interfaces/scope-options.interface';
import { Type } from '../../interfaces/type.interface';
/**
* Defines the injection scope.
*
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
export type InjectableOptions = ScopeOptions;
/**
* Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).
* Providers can be injected into other classes via constructor parameter injection
* using Nest's built-in [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection)
* system.
*
* When injecting a provider, it must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
* can be done by:
*
* - defining the provider in the same module scope
* - exporting the provider from one module scope and importing that module into the
* module scope of the class being injected into
* - exporting the provider from a module that is marked as global using the
* `@Global()` decorator
*
* Providers can also be defined in a more explicit and imperative form using
* various [custom provider](https://docs.nestjs.com/fundamentals/custom-providers) techniques that expose
* more capabilities of the DI system.
*
* @param options options specifying scope of injectable
*
* @see [Providers](https://docs.nestjs.com/providers)
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
export declare function Injectable(options?: InjectableOptions): ClassDecorator;
/**
* @publicApi
*/
export declare function mixin<T>(mixinClass: Type<T>): Type<T>;

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Injectable = Injectable;
exports.mixin = mixin;
const uid_1 = require("uid");
const constants_1 = require("../../constants");
/**
* Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).
* Providers can be injected into other classes via constructor parameter injection
* using Nest's built-in [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection)
* system.
*
* When injecting a provider, it must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
* can be done by:
*
* - defining the provider in the same module scope
* - exporting the provider from one module scope and importing that module into the
* module scope of the class being injected into
* - exporting the provider from a module that is marked as global using the
* `@Global()` decorator
*
* Providers can also be defined in a more explicit and imperative form using
* various [custom provider](https://docs.nestjs.com/fundamentals/custom-providers) techniques that expose
* more capabilities of the DI system.
*
* @param options options specifying scope of injectable
*
* @see [Providers](https://docs.nestjs.com/providers)
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
function Injectable(options) {
return (target) => {
Reflect.defineMetadata(constants_1.INJECTABLE_WATERMARK, true, target);
Reflect.defineMetadata(constants_1.SCOPE_OPTIONS_METADATA, options, target);
};
}
/**
* @publicApi
*/
function mixin(mixinClass) {
Object.defineProperty(mixinClass, 'name', {
value: (0, uid_1.uid)(21),
});
Injectable()(mixinClass);
return mixinClass;
}

View File

@@ -0,0 +1,14 @@
/**
* Parameter decorator for an injected dependency marking the
* dependency as optional.
*
* For example:
* ```typescript
* constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
* ```
*
* @see [Optional providers](https://docs.nestjs.com/providers#optional-providers)
*
* @publicApi
*/
export declare function Optional(): PropertyDecorator & ParameterDecorator;

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Optional = Optional;
const constants_1 = require("../../constants");
const shared_utils_1 = require("../../utils/shared.utils");
/**
* Parameter decorator for an injected dependency marking the
* dependency as optional.
*
* For example:
* ```typescript
* constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
* ```
*
* @see [Optional providers](https://docs.nestjs.com/providers#optional-providers)
*
* @publicApi
*/
function Optional() {
return (target, key, index) => {
if (!(0, shared_utils_1.isUndefined)(index)) {
const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
Reflect.defineMetadata(constants_1.OPTIONAL_DEPS_METADATA, [...args, index], target);
return;
}
const properties = Reflect.getMetadata(constants_1.OPTIONAL_PROPERTY_DEPS_METADATA, target.constructor) || [];
Reflect.defineMetadata(constants_1.OPTIONAL_PROPERTY_DEPS_METADATA, [...properties, key], target.constructor);
};
}

View File

@@ -0,0 +1,20 @@
export type CustomDecorator<TKey = string> = MethodDecorator & ClassDecorator & {
KEY: TKey;
};
/**
* Decorator that assigns metadata to the class/function using the
* specified `key`.
*
* Requires two parameters:
* - `key` - a value defining the key under which the metadata is stored
* - `value` - metadata to be associated with `key`
*
* This metadata can be reflected using the `Reflector` class.
*
* Example: `@SetMetadata('roles', ['admin'])`
*
* @see [Reflection](https://docs.nestjs.com/fundamentals/execution-context#reflection-and-metadata)
*
* @publicApi
*/
export declare const SetMetadata: <K = string, V = any>(metadataKey: K, metadataValue: V) => CustomDecorator<K>;

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetMetadata = void 0;
/**
* Decorator that assigns metadata to the class/function using the
* specified `key`.
*
* Requires two parameters:
* - `key` - a value defining the key under which the metadata is stored
* - `value` - metadata to be associated with `key`
*
* This metadata can be reflected using the `Reflector` class.
*
* Example: `@SetMetadata('roles', ['admin'])`
*
* @see [Reflection](https://docs.nestjs.com/fundamentals/execution-context#reflection-and-metadata)
*
* @publicApi
*/
const SetMetadata = (metadataKey, metadataValue) => {
const decoratorFactory = (target, key, descriptor) => {
if (descriptor) {
Reflect.defineMetadata(metadataKey, metadataValue, descriptor.value);
return descriptor;
}
Reflect.defineMetadata(metadataKey, metadataValue, target);
return target;
};
decoratorFactory.KEY = metadataKey;
return decoratorFactory;
};
exports.SetMetadata = SetMetadata;

View File

@@ -0,0 +1,23 @@
import { CanActivate } from '../../interfaces';
/**
* Decorator that binds guards to the scope of the controller or method,
* depending on its context.
*
* When `@UseGuards` is used at the controller level, the guard will be
* applied to every handler (method) in the controller.
*
* When `@UseGuards` is used at the individual handler level, the guard
* will apply only to that specific method.
*
* @param guards a single guard instance or class, or a list of guard instances
* or classes.
*
* @see [Guards](https://docs.nestjs.com/guards)
*
* @usageNotes
* Guards can also be set up globally for all controllers and routes
* using `app.useGlobalGuards()`. [See here for details](https://docs.nestjs.com/guards#binding-guards)
*
* @publicApi
*/
export declare function UseGuards(...guards: (CanActivate | Function)[]): MethodDecorator & ClassDecorator;

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UseGuards = UseGuards;
const constants_1 = require("../../constants");
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
const shared_utils_1 = require("../../utils/shared.utils");
const validate_each_util_1 = require("../../utils/validate-each.util");
/**
* Decorator that binds guards to the scope of the controller or method,
* depending on its context.
*
* When `@UseGuards` is used at the controller level, the guard will be
* applied to every handler (method) in the controller.
*
* When `@UseGuards` is used at the individual handler level, the guard
* will apply only to that specific method.
*
* @param guards a single guard instance or class, or a list of guard instances
* or classes.
*
* @see [Guards](https://docs.nestjs.com/guards)
*
* @usageNotes
* Guards can also be set up globally for all controllers and routes
* using `app.useGlobalGuards()`. [See here for details](https://docs.nestjs.com/guards#binding-guards)
*
* @publicApi
*/
function UseGuards(...guards) {
return (target, key, descriptor) => {
const isGuardValid = (guard) => guard && ((0, shared_utils_1.isFunction)(guard) || (0, shared_utils_1.isFunction)(guard.canActivate));
if (descriptor) {
(0, validate_each_util_1.validateEach)(target.constructor, guards, isGuardValid, '@UseGuards', 'guard');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.GUARDS_METADATA, guards, descriptor.value);
return descriptor;
}
(0, validate_each_util_1.validateEach)(target, guards, isGuardValid, '@UseGuards', 'guard');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.GUARDS_METADATA, guards, target);
return target;
};
}

View File

@@ -0,0 +1,23 @@
import { NestInterceptor } from '../../interfaces';
/**
* Decorator that binds interceptors to the scope of the controller or method,
* depending on its context.
*
* When `@UseInterceptors` is used at the controller level, the interceptor will
* be applied to every handler (method) in the controller.
*
* When `@UseInterceptors` is used at the individual handler level, the interceptor
* will apply only to that specific method.
*
* @param interceptors a single interceptor instance or class, or a list of
* interceptor instances or classes.
*
* @see [Interceptors](https://docs.nestjs.com/interceptors)
*
* @usageNotes
* Interceptors can also be set up globally for all controllers and routes
* using `app.useGlobalInterceptors()`. [See here for details](https://docs.nestjs.com/interceptors#binding-interceptors)
*
* @publicApi
*/
export declare function UseInterceptors(...interceptors: (NestInterceptor | Function)[]): MethodDecorator & ClassDecorator;

View File

@@ -0,0 +1,42 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UseInterceptors = UseInterceptors;
const constants_1 = require("../../constants");
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
const shared_utils_1 = require("../../utils/shared.utils");
const validate_each_util_1 = require("../../utils/validate-each.util");
/**
* Decorator that binds interceptors to the scope of the controller or method,
* depending on its context.
*
* When `@UseInterceptors` is used at the controller level, the interceptor will
* be applied to every handler (method) in the controller.
*
* When `@UseInterceptors` is used at the individual handler level, the interceptor
* will apply only to that specific method.
*
* @param interceptors a single interceptor instance or class, or a list of
* interceptor instances or classes.
*
* @see [Interceptors](https://docs.nestjs.com/interceptors)
*
* @usageNotes
* Interceptors can also be set up globally for all controllers and routes
* using `app.useGlobalInterceptors()`. [See here for details](https://docs.nestjs.com/interceptors#binding-interceptors)
*
* @publicApi
*/
function UseInterceptors(...interceptors) {
return (target, key, descriptor) => {
const isInterceptorValid = (interceptor) => interceptor &&
((0, shared_utils_1.isFunction)(interceptor) || (0, shared_utils_1.isFunction)(interceptor.intercept));
if (descriptor) {
(0, validate_each_util_1.validateEach)(target.constructor, interceptors, isInterceptorValid, '@UseInterceptors', 'interceptor');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.INTERCEPTORS_METADATA, interceptors, descriptor.value);
return descriptor;
}
(0, validate_each_util_1.validateEach)(target, interceptors, isInterceptorValid, '@UseInterceptors', 'interceptor');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.INTERCEPTORS_METADATA, interceptors, target);
return target;
};
}

View File

@@ -0,0 +1,23 @@
import { PipeTransform } from '../../interfaces/index';
/**
* Decorator that binds pipes to the scope of the controller or method,
* depending on its context.
*
* When `@UsePipes` is used at the controller level, the pipe will be
* applied to every handler (method) in the controller.
*
* When `@UsePipes` is used at the individual handler level, the pipe
* will apply only to that specific method.
*
* @param pipes a single pipe instance or class, or a list of pipe instances or
* classes.
*
* @see [Pipes](https://docs.nestjs.com/pipes)
*
* @usageNotes
* Pipes can also be set up globally for all controllers and routes
* using `app.useGlobalPipes()`. [See here for details](https://docs.nestjs.com/pipes#class-validator)
*
* @publicApi
*/
export declare function UsePipes(...pipes: (PipeTransform | Function)[]): ClassDecorator & MethodDecorator;

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsePipes = UsePipes;
const constants_1 = require("../../constants");
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
const shared_utils_1 = require("../../utils/shared.utils");
const validate_each_util_1 = require("../../utils/validate-each.util");
/**
* Decorator that binds pipes to the scope of the controller or method,
* depending on its context.
*
* When `@UsePipes` is used at the controller level, the pipe will be
* applied to every handler (method) in the controller.
*
* When `@UsePipes` is used at the individual handler level, the pipe
* will apply only to that specific method.
*
* @param pipes a single pipe instance or class, or a list of pipe instances or
* classes.
*
* @see [Pipes](https://docs.nestjs.com/pipes)
*
* @usageNotes
* Pipes can also be set up globally for all controllers and routes
* using `app.useGlobalPipes()`. [See here for details](https://docs.nestjs.com/pipes#class-validator)
*
* @publicApi
*/
function UsePipes(...pipes) {
return (target, key, descriptor) => {
const isPipeValid = (pipe) => pipe && ((0, shared_utils_1.isFunction)(pipe) || (0, shared_utils_1.isFunction)(pipe.transform));
if (descriptor) {
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.PIPES_METADATA, pipes, descriptor.value);
return descriptor;
}
(0, validate_each_util_1.validateEach)(target, pipes, isPipeValid, '@UsePipes', 'pipe');
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.PIPES_METADATA, pipes, target);
return target;
};
}

View File

@@ -0,0 +1,7 @@
import { VersionValue } from '../../interfaces/version-options.interface';
/**
* Sets the version of the endpoint to the passed version
*
* @publicApi
*/
export declare function Version(version: VersionValue): MethodDecorator;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Version = Version;
const constants_1 = require("../../constants");
/**
* Sets the version of the endpoint to the passed version
*
* @publicApi
*/
function Version(version) {
if (Array.isArray(version)) {
// Drop duplicated versions
version = Array.from(new Set(version));
}
return (target, key, descriptor) => {
Reflect.defineMetadata(constants_1.VERSION_METADATA, version, descriptor.value);
return descriptor;
};
}

View File

@@ -0,0 +1,13 @@
import { PipeTransform } from '../../index';
import { Type } from '../../interfaces';
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
export type ParamDecoratorEnhancer = ParameterDecorator;
/**
* Defines HTTP route param decorator
*
* @param factory
* @param enhancers
*
* @publicApi
*/
export declare function createParamDecorator<FactoryData = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;

View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createParamDecorator = createParamDecorator;
const uid_1 = require("uid");
const constants_1 = require("../../constants");
const assign_custom_metadata_util_1 = require("../../utils/assign-custom-metadata.util");
const shared_utils_1 = require("../../utils/shared.utils");
/**
* Defines HTTP route param decorator
*
* @param factory
* @param enhancers
*
* @publicApi
*/
function createParamDecorator(factory, enhancers = []) {
const paramtype = (0, uid_1.uid)(21);
return (data, ...pipes) => (target, key, index) => {
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
{};
const isPipe = (pipe) => pipe &&
(((0, shared_utils_1.isFunction)(pipe) &&
pipe.prototype &&
(0, shared_utils_1.isFunction)(pipe.prototype.transform)) ||
(0, shared_utils_1.isFunction)(pipe.transform));
const hasParamData = (0, shared_utils_1.isNil)(data) || !isPipe(data);
const paramData = hasParamData ? data : undefined;
const paramPipes = hasParamData ? pipes : [data, ...pipes];
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, (0, assign_custom_metadata_util_1.assignCustomParameterMetadata)(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
enhancers.forEach(fn => fn(target, key, index));
};
}

View File

@@ -0,0 +1,15 @@
/**
* Request method Decorator. Sets a response header.
*
* For example:
* `@Header('Cache-Control', 'none')`
* `@Header('Cache-Control', () => 'none')`
*
* @param name string to be used for header name
* @param value string to be used for header value
*
* @see [Headers](https://docs.nestjs.com/controllers#headers)
*
* @publicApi
*/
export declare function Header(name: string, value: string | (() => string)): MethodDecorator;

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Header = Header;
const constants_1 = require("../../constants");
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
/**
* Request method Decorator. Sets a response header.
*
* For example:
* `@Header('Cache-Control', 'none')`
* `@Header('Cache-Control', () => 'none')`
*
* @param name string to be used for header name
* @param value string to be used for header value
*
* @see [Headers](https://docs.nestjs.com/controllers#headers)
*
* @publicApi
*/
function Header(name, value) {
return (target, key, descriptor) => {
(0, extend_metadata_util_1.extendArrayMetadata)(constants_1.HEADERS_METADATA, [{ name, value }], descriptor.value);
return descriptor;
};
}

View File

@@ -0,0 +1,11 @@
/**
* Request method Decorator. Defines the HTTP response status code. Overrides
* default status code for the decorated request method.
*
* @param statusCode HTTP response code to be returned by route handler.
*
* @see [Http Status Codes](https://docs.nestjs.com/controllers#status-code)
*
* @publicApi
*/
export declare function HttpCode(statusCode: number): MethodDecorator;

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpCode = HttpCode;
const constants_1 = require("../../constants");
/**
* Request method Decorator. Defines the HTTP response status code. Overrides
* default status code for the decorated request method.
*
* @param statusCode HTTP response code to be returned by route handler.
*
* @see [Http Status Codes](https://docs.nestjs.com/controllers#status-code)
*
* @publicApi
*/
function HttpCode(statusCode) {
return (target, key, descriptor) => {
Reflect.defineMetadata(constants_1.HTTP_CODE_METADATA, statusCode, descriptor.value);
return descriptor;
};
}

View File

@@ -0,0 +1,8 @@
export * from './request-mapping.decorator';
export * from './route-params.decorator';
export * from './http-code.decorator';
export * from './create-route-param-metadata.decorator';
export * from './render.decorator';
export * from './header.decorator';
export * from './redirect.decorator';
export * from './sse.decorator';

11
node_modules/@nestjs/common/decorators/http/index.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./request-mapping.decorator"), exports);
tslib_1.__exportStar(require("./route-params.decorator"), exports);
tslib_1.__exportStar(require("./http-code.decorator"), exports);
tslib_1.__exportStar(require("./create-route-param-metadata.decorator"), exports);
tslib_1.__exportStar(require("./render.decorator"), exports);
tslib_1.__exportStar(require("./header.decorator"), exports);
tslib_1.__exportStar(require("./redirect.decorator"), exports);
tslib_1.__exportStar(require("./sse.decorator"), exports);

View File

@@ -0,0 +1,6 @@
/**
* Redirects request to the specified URL.
*
* @publicApi
*/
export declare function Redirect(url?: string, statusCode?: number): MethodDecorator;

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Redirect = Redirect;
const constants_1 = require("../../constants");
/**
* Redirects request to the specified URL.
*
* @publicApi
*/
function Redirect(url = '', statusCode) {
return (target, key, descriptor) => {
Reflect.defineMetadata(constants_1.REDIRECT_METADATA, { statusCode, url }, descriptor.value);
return descriptor;
};
}

View File

@@ -0,0 +1,12 @@
/**
* Route handler method Decorator. Defines a template to be rendered by the controller.
*
* For example: `@Render('index')`
*
* @param template name of the render engine template file
*
* @see [Model-View-Controller](https://docs.nestjs.com/techniques/mvc)
*
* @publicApi
*/
export declare function Render(template: string): MethodDecorator;

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Render = Render;
const constants_1 = require("../../constants");
/**
* Route handler method Decorator. Defines a template to be rendered by the controller.
*
* For example: `@Render('index')`
*
* @param template name of the render engine template file
*
* @see [Model-View-Controller](https://docs.nestjs.com/techniques/mvc)
*
* @publicApi
*/
function Render(template) {
return (target, key, descriptor) => {
Reflect.defineMetadata(constants_1.RENDER_METADATA, template, descriptor.value);
return descriptor;
};
}

View File

@@ -0,0 +1,134 @@
import { RequestMethod } from '../../enums/request-method.enum';
export interface RequestMappingMetadata {
path?: string | string[];
method?: RequestMethod;
}
export declare const RequestMapping: (metadata?: RequestMappingMetadata) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP POST requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Post: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Get: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Delete: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Put: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Patch: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Options: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Head: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes all HTTP requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const All: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes HTTP SEARCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Search: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Propfind: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Proppatch: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Mkcol: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Copy: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Move: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Lock: (path?: string | string[]) => MethodDecorator;
/**
* Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export declare const Unlock: (path?: string | string[]) => MethodDecorator;

View File

@@ -0,0 +1,154 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Unlock = exports.Lock = exports.Move = exports.Copy = exports.Mkcol = exports.Proppatch = exports.Propfind = exports.Search = exports.All = exports.Head = exports.Options = exports.Patch = exports.Put = exports.Delete = exports.Get = exports.Post = exports.RequestMapping = void 0;
const constants_1 = require("../../constants");
const request_method_enum_1 = require("../../enums/request-method.enum");
const defaultMetadata = {
[constants_1.PATH_METADATA]: '/',
[constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET,
};
const RequestMapping = (metadata = defaultMetadata) => {
const pathMetadata = metadata[constants_1.PATH_METADATA];
const path = pathMetadata && pathMetadata.length ? pathMetadata : '/';
const requestMethod = metadata[constants_1.METHOD_METADATA] || request_method_enum_1.RequestMethod.GET;
return (target, key, descriptor) => {
Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
Reflect.defineMetadata(constants_1.METHOD_METADATA, requestMethod, descriptor.value);
return descriptor;
};
};
exports.RequestMapping = RequestMapping;
const createMappingDecorator = (method) => (path) => {
return (0, exports.RequestMapping)({
[constants_1.PATH_METADATA]: path,
[constants_1.METHOD_METADATA]: method,
});
};
/**
* Route handler (method) Decorator. Routes HTTP POST requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Post = createMappingDecorator(request_method_enum_1.RequestMethod.POST);
/**
* Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Get = createMappingDecorator(request_method_enum_1.RequestMethod.GET);
/**
* Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Delete = createMappingDecorator(request_method_enum_1.RequestMethod.DELETE);
/**
* Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Put = createMappingDecorator(request_method_enum_1.RequestMethod.PUT);
/**
* Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Patch = createMappingDecorator(request_method_enum_1.RequestMethod.PATCH);
/**
* Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Options = createMappingDecorator(request_method_enum_1.RequestMethod.OPTIONS);
/**
* Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Head = createMappingDecorator(request_method_enum_1.RequestMethod.HEAD);
/**
* Route handler (method) Decorator. Routes all HTTP requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.All = createMappingDecorator(request_method_enum_1.RequestMethod.ALL);
/**
* Route handler (method) Decorator. Routes HTTP SEARCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Search = createMappingDecorator(request_method_enum_1.RequestMethod.SEARCH);
/**
* Route handler (method) Decorator. Routes Webdav PROPFIND requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Propfind = createMappingDecorator(request_method_enum_1.RequestMethod.PROPFIND);
/**
* Route handler (method) Decorator. Routes Webdav PROPPATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Proppatch = createMappingDecorator(request_method_enum_1.RequestMethod.PROPPATCH);
/**
* Route handler (method) Decorator. Routes Webdav MKCOL requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Mkcol = createMappingDecorator(request_method_enum_1.RequestMethod.MKCOL);
/**
* Route handler (method) Decorator. Routes Webdav COPY requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Copy = createMappingDecorator(request_method_enum_1.RequestMethod.COPY);
/**
* Route handler (method) Decorator. Routes Webdav MOVE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Move = createMappingDecorator(request_method_enum_1.RequestMethod.MOVE);
/**
* Route handler (method) Decorator. Routes Webdav LOCK requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Lock = createMappingDecorator(request_method_enum_1.RequestMethod.LOCK);
/**
* Route handler (method) Decorator. Routes Webdav UNLOCK requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
exports.Unlock = createMappingDecorator(request_method_enum_1.RequestMethod.UNLOCK);

View File

@@ -0,0 +1,445 @@
import { PipeTransform } from '../../index';
import { Type } from '../../interfaces';
/**
* The `@Response()`/`@Res` parameter decorator options.
*/
export interface ResponseDecoratorOptions {
/**
* Determines whether the response will be sent manually within the route handler,
* with the use of native response handling methods exposed by the platform-specific response object,
* or if it should passthrough Nest response processing pipeline.
*
* @default false
*/
passthrough: boolean;
}
export type ParamData = object | string | number;
export interface RouteParamMetadata {
index: number;
data?: ParamData;
}
export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): TArgs & {
[x: string]: {
index: number;
data: ParamData | undefined;
pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
};
};
/**
* Route handler parameter decorator. Extracts the `Request`
* object from the underlying platform and populates the decorated
* parameter with the value of `Request`.
*
* Example: `logout(@Request() req)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare const Request: () => ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `Response`
* object from the underlying platform and populates the decorated
* parameter with the value of `Response`.
*
* Example: `logout(@Response() res)`
*
* @publicApi
*/
export declare const Response: (options?: ResponseDecoratorOptions) => ParameterDecorator;
/**
* Route handler parameter decorator. Extracts reference to the `Next` function
* from the underlying platform and populates the decorated
* parameter with the value of `Next`.
*
* @publicApi
*/
export declare const Next: () => ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `Ip` property
* from the `req` object and populates the decorated
* parameter with the value of `ip`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare const Ip: () => ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `Session` object
* from the underlying platform and populates the decorated
* parameter with the value of `Session`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare const Session: () => ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `file` object
* and populates the decorated parameter with the value of `file`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFile() file) {
* console.log(file);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export declare function UploadedFile(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `file` object
* and populates the decorated parameter with the value of `file`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFile() file) {
* console.log(file);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export declare function UploadedFile(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `file` object
* and populates the decorated parameter with the value of `file`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFile() file) {
* console.log(file);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export declare function UploadedFile(fileKey?: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `files` object
* and populates the decorated parameter with the value of `files`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFiles() files) {
* console.log(files);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export declare function UploadedFiles(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `files` object
* and populates the decorated parameter with the value of `files`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFiles() files) {
* console.log(files);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export declare function UploadedFiles(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `headers`
* property from the `req` object and populates the decorated
* parameter with the value of `headers`.
*
* For example: `async update(@Headers('Cache-Control') cacheControl: string)`
*
* @param property name of single header property to extract.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare const Headers: (property?: string) => ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare function Query(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the entire `body`
* object from the `req` object and populates the decorated
* parameter with the value of `body`.
*
* For example:
* ```typescript
* async create(@Body() createDto: CreateCatDto)
* ```
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare function Body(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the entire `body`
* object from the `req` object and populates the decorated
* parameter with the value of `body`. Also applies the specified
* pipes to that parameter.
*
* For example:
* ```typescript
* async create(@Body(new ValidationPipe()) createDto: CreateCatDto)
* ```
*
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts a single property from
* the `body` object property of the `req` object and populates the decorated
* parameter with the value of that property. Also applies pipes to the bound
* body parameter.
*
* For example:
* ```typescript
* async create(@Body('role', new ValidationPipe()) role: string)
* ```
*
* @param property name of single property to extract from the `body` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `rawBody` Buffer
* property from the `req` object and populates the decorated parameter with that value.
*
* For example:
* ```typescript
* async create(@RawBody() rawBody: Buffer | undefined)
* ```
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Raw body](https://docs.nestjs.com/faq/raw-body)
*
* @publicApi
*/
export declare function RawBody(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `rawBody` Buffer
* property from the `req` object and populates the decorated parameter with that value.
* Also applies pipes to the bound rawBody parameter.
*
* For example:
* ```typescript
* async create(@RawBody(new ValidationPipe()) rawBody: Buffer)
* ```
*
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Raw body](https://docs.nestjs.com/faq/raw-body)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export declare function RawBody(...pipes: (Type<PipeTransform<Buffer | undefined>> | PipeTransform<Buffer | undefined>)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export declare function Param(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `hosts`
* property from the `req` object and populates the decorated
* parameter with the value of `hosts`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@HostParam() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@HostParam('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare function HostParam(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `hosts`
* property from the `req` object and populates the decorated
* parameter with the value of `hosts`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@HostParam() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@HostParam('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export declare function HostParam(property: string): ParameterDecorator;
export declare const Req: () => ParameterDecorator;
export declare const Res: (options?: ResponseDecoratorOptions) => ParameterDecorator;

View File

@@ -0,0 +1,265 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Res = exports.Req = exports.Headers = exports.Session = exports.Ip = exports.Next = exports.Response = exports.Request = void 0;
exports.assignMetadata = assignMetadata;
exports.UploadedFile = UploadedFile;
exports.UploadedFiles = UploadedFiles;
exports.Query = Query;
exports.Body = Body;
exports.RawBody = RawBody;
exports.Param = Param;
exports.HostParam = HostParam;
const constants_1 = require("../../constants");
const route_paramtypes_enum_1 = require("../../enums/route-paramtypes.enum");
const shared_utils_1 = require("../../utils/shared.utils");
function assignMetadata(args, paramtype, index, data, ...pipes) {
return {
...args,
[`${paramtype}:${index}`]: {
index,
data,
pipes,
},
};
}
function createRouteParamDecorator(paramtype) {
return (data) => (target, key, index) => {
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) ||
{};
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
};
}
const createPipesRouteParamDecorator = (paramtype) => (data, ...pipes) => (target, key, index) => {
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
const hasParamData = (0, shared_utils_1.isNil)(data) || (0, shared_utils_1.isString)(data);
const paramData = hasParamData ? data : undefined;
const paramPipes = hasParamData ? pipes : [data, ...pipes];
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, paramData, ...paramPipes), target.constructor, key);
};
/**
* Route handler parameter decorator. Extracts the `Request`
* object from the underlying platform and populates the decorated
* parameter with the value of `Request`.
*
* Example: `logout(@Request() req)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
exports.Request = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.REQUEST);
/**
* Route handler parameter decorator. Extracts the `Response`
* object from the underlying platform and populates the decorated
* parameter with the value of `Response`.
*
* Example: `logout(@Response() res)`
*
* @publicApi
*/
const Response = (options) => (target, key, index) => {
if (options?.passthrough) {
Reflect.defineMetadata(constants_1.RESPONSE_PASSTHROUGH_METADATA, options?.passthrough, target.constructor, key);
}
return createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RESPONSE)()(target, key, index);
};
exports.Response = Response;
/**
* Route handler parameter decorator. Extracts reference to the `Next` function
* from the underlying platform and populates the decorated
* parameter with the value of `Next`.
*
* @publicApi
*/
exports.Next = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.NEXT);
/**
* Route handler parameter decorator. Extracts the `Ip` property
* from the `req` object and populates the decorated
* parameter with the value of `ip`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
exports.Ip = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.IP);
/**
* Route handler parameter decorator. Extracts the `Session` object
* from the underlying platform and populates the decorated
* parameter with the value of `Session`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
exports.Session = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.SESSION);
/**
* Route handler parameter decorator. Extracts the `file` object
* and populates the decorated parameter with the value of `file`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFile() file) {
* console.log(file);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
function UploadedFile(fileKey, ...pipes) {
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILE)(fileKey, ...pipes);
}
/**
* Route handler parameter decorator. Extracts the `files` object
* and populates the decorated parameter with the value of `files`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
*
* For example:
* ```typescript
* uploadFile(@UploadedFiles() files) {
* console.log(files);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
function UploadedFiles(...pipes) {
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.FILES)(undefined, ...pipes);
}
/**
* Route handler parameter decorator. Extracts the `headers`
* property from the `req` object and populates the decorated
* parameter with the value of `headers`.
*
* For example: `async update(@Headers('Cache-Control') cacheControl: string)`
*
* @param property name of single header property to extract.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
exports.Headers = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.HEADERS);
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
function Query(property, ...pipes) {
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.QUERY)(property, ...pipes);
}
/**
* Route handler parameter decorator. Extracts the entire `body` object
* property, or optionally a named property of the `body` object, from
* the `req` object and populates the decorated parameter with that value.
* Also applies pipes to the bound body parameter.
*
* For example:
* ```typescript
* async create(@Body('role', new ValidationPipe()) role: string)
* ```
*
* @param property name of single property to extract from the `body` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
function Body(property, ...pipes) {
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.BODY)(property, ...pipes);
}
/**
* Route handler parameter decorator. Extracts the `rawBody` Buffer
* property from the `req` object and populates the decorated parameter with that value.
* Also applies pipes to the bound rawBody parameter.
*
* For example:
* ```typescript
* async create(@RawBody(new ValidationPipe()) rawBody: Buffer)
* ```
*
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Raw body](https://docs.nestjs.com/faq/raw-body)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
function RawBody(...pipes) {
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RAW_BODY)(undefined, ...pipes);
}
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
function Param(property, ...pipes) {
return createPipesRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.PARAM)(property, ...pipes);
}
/**
* Route handler parameter decorator. Extracts the `hosts`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@HostParam() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@HostParam('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
function HostParam(property) {
return createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.HOST)(property);
}
exports.Req = exports.Request;
exports.Res = exports.Response;

View File

@@ -0,0 +1,10 @@
import { METHOD_METADATA } from '../../constants';
import { RequestMethod } from '../../enums/request-method.enum';
/**
* Declares this route as a Server-Sent-Events endpoint
*
* @publicApi
*/
export declare function Sse(path?: string, options?: {
[METHOD_METADATA]?: RequestMethod;
}): MethodDecorator;

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sse = Sse;
const constants_1 = require("../../constants");
const request_method_enum_1 = require("../../enums/request-method.enum");
/**
* Declares this route as a Server-Sent-Events endpoint
*
* @publicApi
*/
function Sse(path, options = {
[constants_1.METHOD_METADATA]: request_method_enum_1.RequestMethod.GET,
}) {
return (target, key, descriptor) => {
path = path && path.length ? path : '/';
Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
Reflect.defineMetadata(constants_1.METHOD_METADATA, options[constants_1.METHOD_METADATA], descriptor.value);
Reflect.defineMetadata(constants_1.SSE_METADATA, true, descriptor.value);
return descriptor;
};
}

3
node_modules/@nestjs/common/decorators/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from './core';
export * from './modules';
export * from './http';

6
node_modules/@nestjs/common/decorators/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./core"), exports);
tslib_1.__exportStar(require("./modules"), exports);
tslib_1.__exportStar(require("./http"), exports);

View File

@@ -0,0 +1,12 @@
/**
* Decorator that makes a module global-scoped.
*
* Once imported into any module, a global-scoped module will be visible
* in all modules. Thereafter, modules that wish to inject a service exported
* from a global module do not need to import the provider module.
*
* @see [Global modules](https://docs.nestjs.com/modules#global-modules)
*
* @publicApi
*/
export declare function Global(): ClassDecorator;

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Global = Global;
const constants_1 = require("../../constants");
/**
* Decorator that makes a module global-scoped.
*
* Once imported into any module, a global-scoped module will be visible
* in all modules. Thereafter, modules that wish to inject a service exported
* from a global module do not need to import the provider module.
*
* @see [Global modules](https://docs.nestjs.com/modules#global-modules)
*
* @publicApi
*/
function Global() {
return (target) => {
Reflect.defineMetadata(constants_1.GLOBAL_MODULE_METADATA, true, target);
};
}

View File

@@ -0,0 +1,2 @@
export * from './global.decorator';
export * from './module.decorator';

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./global.decorator"), exports);
tslib_1.__exportStar(require("./module.decorator"), exports);

View File

@@ -0,0 +1,16 @@
import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interface';
/**
* Decorator that marks a class as a [module](https://docs.nestjs.com/modules).
*
* Modules are used by Nest to organize the application structure into scopes. Controllers
* and Providers are scoped by the module they are declared in. Modules and their
* classes (Controllers and Providers) form a graph that determines how Nest
* performs [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
*
* @param metadata module configuration metadata
*
* @see [Modules](https://docs.nestjs.com/modules)
*
* @publicApi
*/
export declare function Module(metadata: ModuleMetadata): ClassDecorator;

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Module = Module;
const validate_module_keys_util_1 = require("../../utils/validate-module-keys.util");
/**
* Decorator that marks a class as a [module](https://docs.nestjs.com/modules).
*
* Modules are used by Nest to organize the application structure into scopes. Controllers
* and Providers are scoped by the module they are declared in. Modules and their
* classes (Controllers and Providers) form a graph that determines how Nest
* performs [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
*
* @param metadata module configuration metadata
*
* @see [Modules](https://docs.nestjs.com/modules)
*
* @publicApi
*/
function Module(metadata) {
const propsKeys = Object.keys(metadata);
(0, validate_module_keys_util_1.validateModuleKeys)(propsKeys);
return (target) => {
for (const property in metadata) {
if (Object.hasOwnProperty.call(metadata, property)) {
Reflect.defineMetadata(property, metadata[property], target);
}
}
};
}

View File

@@ -0,0 +1,60 @@
/**
* @publicApi
*/
export declare enum HttpStatus {
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
PROCESSING = 102,
EARLYHINTS = 103,
OK = 200,
CREATED = 201,
ACCEPTED = 202,
NON_AUTHORITATIVE_INFORMATION = 203,
NO_CONTENT = 204,
RESET_CONTENT = 205,
PARTIAL_CONTENT = 206,
MULTI_STATUS = 207,
ALREADY_REPORTED = 208,
CONTENT_DIFFERENT = 210,
AMBIGUOUS = 300,
MOVED_PERMANENTLY = 301,
FOUND = 302,
SEE_OTHER = 303,
NOT_MODIFIED = 304,
TEMPORARY_REDIRECT = 307,
PERMANENT_REDIRECT = 308,
BAD_REQUEST = 400,
UNAUTHORIZED = 401,
PAYMENT_REQUIRED = 402,
FORBIDDEN = 403,
NOT_FOUND = 404,
METHOD_NOT_ALLOWED = 405,
NOT_ACCEPTABLE = 406,
PROXY_AUTHENTICATION_REQUIRED = 407,
REQUEST_TIMEOUT = 408,
CONFLICT = 409,
GONE = 410,
LENGTH_REQUIRED = 411,
PRECONDITION_FAILED = 412,
PAYLOAD_TOO_LARGE = 413,
URI_TOO_LONG = 414,
UNSUPPORTED_MEDIA_TYPE = 415,
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
EXPECTATION_FAILED = 417,
I_AM_A_TEAPOT = 418,
MISDIRECTED = 421,
UNPROCESSABLE_ENTITY = 422,
LOCKED = 423,
FAILED_DEPENDENCY = 424,
PRECONDITION_REQUIRED = 428,
TOO_MANY_REQUESTS = 429,
UNRECOVERABLE_ERROR = 456,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
BAD_GATEWAY = 502,
SERVICE_UNAVAILABLE = 503,
GATEWAY_TIMEOUT = 504,
HTTP_VERSION_NOT_SUPPORTED = 505,
INSUFFICIENT_STORAGE = 507,
LOOP_DETECTED = 508
}

64
node_modules/@nestjs/common/enums/http-status.enum.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpStatus = void 0;
/**
* @publicApi
*/
var HttpStatus;
(function (HttpStatus) {
HttpStatus[HttpStatus["CONTINUE"] = 100] = "CONTINUE";
HttpStatus[HttpStatus["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
HttpStatus[HttpStatus["PROCESSING"] = 102] = "PROCESSING";
HttpStatus[HttpStatus["EARLYHINTS"] = 103] = "EARLYHINTS";
HttpStatus[HttpStatus["OK"] = 200] = "OK";
HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
HttpStatus[HttpStatus["ACCEPTED"] = 202] = "ACCEPTED";
HttpStatus[HttpStatus["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
HttpStatus[HttpStatus["NO_CONTENT"] = 204] = "NO_CONTENT";
HttpStatus[HttpStatus["RESET_CONTENT"] = 205] = "RESET_CONTENT";
HttpStatus[HttpStatus["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
HttpStatus[HttpStatus["MULTI_STATUS"] = 207] = "MULTI_STATUS";
HttpStatus[HttpStatus["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
HttpStatus[HttpStatus["CONTENT_DIFFERENT"] = 210] = "CONTENT_DIFFERENT";
HttpStatus[HttpStatus["AMBIGUOUS"] = 300] = "AMBIGUOUS";
HttpStatus[HttpStatus["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
HttpStatus[HttpStatus["FOUND"] = 302] = "FOUND";
HttpStatus[HttpStatus["SEE_OTHER"] = 303] = "SEE_OTHER";
HttpStatus[HttpStatus["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
HttpStatus[HttpStatus["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
HttpStatus[HttpStatus["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
HttpStatus[HttpStatus["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
HttpStatus[HttpStatus["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
HttpStatus[HttpStatus["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
HttpStatus[HttpStatus["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
HttpStatus[HttpStatus["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
HttpStatus[HttpStatus["CONFLICT"] = 409] = "CONFLICT";
HttpStatus[HttpStatus["GONE"] = 410] = "GONE";
HttpStatus[HttpStatus["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
HttpStatus[HttpStatus["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
HttpStatus[HttpStatus["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
HttpStatus[HttpStatus["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
HttpStatus[HttpStatus["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
HttpStatus[HttpStatus["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
HttpStatus[HttpStatus["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
HttpStatus[HttpStatus["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
HttpStatus[HttpStatus["MISDIRECTED"] = 421] = "MISDIRECTED";
HttpStatus[HttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
HttpStatus[HttpStatus["LOCKED"] = 423] = "LOCKED";
HttpStatus[HttpStatus["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
HttpStatus[HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
HttpStatus[HttpStatus["UNRECOVERABLE_ERROR"] = 456] = "UNRECOVERABLE_ERROR";
HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
HttpStatus[HttpStatus["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
HttpStatus[HttpStatus["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
HttpStatus[HttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
HttpStatus[HttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
HttpStatus[HttpStatus["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
HttpStatus[HttpStatus["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
HttpStatus[HttpStatus["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
})(HttpStatus || (exports.HttpStatus = HttpStatus = {}));

4
node_modules/@nestjs/common/enums/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './request-method.enum';
export * from './http-status.enum';
export * from './shutdown-signal.enum';
export * from './version-type.enum';

7
node_modules/@nestjs/common/enums/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./request-method.enum"), exports);
tslib_1.__exportStar(require("./http-status.enum"), exports);
tslib_1.__exportStar(require("./shutdown-signal.enum"), exports);
tslib_1.__exportStar(require("./version-type.enum"), exports);

View File

@@ -0,0 +1,18 @@
export declare enum RequestMethod {
GET = 0,
POST = 1,
PUT = 2,
DELETE = 3,
PATCH = 4,
ALL = 5,
OPTIONS = 6,
HEAD = 7,
SEARCH = 8,
PROPFIND = 9,
PROPPATCH = 10,
MKCOL = 11,
COPY = 12,
MOVE = 13,
LOCK = 14,
UNLOCK = 15
}

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestMethod = void 0;
var RequestMethod;
(function (RequestMethod) {
RequestMethod[RequestMethod["GET"] = 0] = "GET";
RequestMethod[RequestMethod["POST"] = 1] = "POST";
RequestMethod[RequestMethod["PUT"] = 2] = "PUT";
RequestMethod[RequestMethod["DELETE"] = 3] = "DELETE";
RequestMethod[RequestMethod["PATCH"] = 4] = "PATCH";
RequestMethod[RequestMethod["ALL"] = 5] = "ALL";
RequestMethod[RequestMethod["OPTIONS"] = 6] = "OPTIONS";
RequestMethod[RequestMethod["HEAD"] = 7] = "HEAD";
RequestMethod[RequestMethod["SEARCH"] = 8] = "SEARCH";
RequestMethod[RequestMethod["PROPFIND"] = 9] = "PROPFIND";
RequestMethod[RequestMethod["PROPPATCH"] = 10] = "PROPPATCH";
RequestMethod[RequestMethod["MKCOL"] = 11] = "MKCOL";
RequestMethod[RequestMethod["COPY"] = 12] = "COPY";
RequestMethod[RequestMethod["MOVE"] = 13] = "MOVE";
RequestMethod[RequestMethod["LOCK"] = 14] = "LOCK";
RequestMethod[RequestMethod["UNLOCK"] = 15] = "UNLOCK";
})(RequestMethod || (exports.RequestMethod = RequestMethod = {}));

View File

@@ -0,0 +1,16 @@
export declare enum RouteParamtypes {
REQUEST = 0,
RESPONSE = 1,
NEXT = 2,
BODY = 3,
QUERY = 4,
PARAM = 5,
HEADERS = 6,
SESSION = 7,
FILE = 8,
FILES = 9,
HOST = 10,
IP = 11,
RAW_BODY = 12,
ACK = 13
}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouteParamtypes = void 0;
var RouteParamtypes;
(function (RouteParamtypes) {
RouteParamtypes[RouteParamtypes["REQUEST"] = 0] = "REQUEST";
RouteParamtypes[RouteParamtypes["RESPONSE"] = 1] = "RESPONSE";
RouteParamtypes[RouteParamtypes["NEXT"] = 2] = "NEXT";
RouteParamtypes[RouteParamtypes["BODY"] = 3] = "BODY";
RouteParamtypes[RouteParamtypes["QUERY"] = 4] = "QUERY";
RouteParamtypes[RouteParamtypes["PARAM"] = 5] = "PARAM";
RouteParamtypes[RouteParamtypes["HEADERS"] = 6] = "HEADERS";
RouteParamtypes[RouteParamtypes["SESSION"] = 7] = "SESSION";
RouteParamtypes[RouteParamtypes["FILE"] = 8] = "FILE";
RouteParamtypes[RouteParamtypes["FILES"] = 9] = "FILES";
RouteParamtypes[RouteParamtypes["HOST"] = 10] = "HOST";
RouteParamtypes[RouteParamtypes["IP"] = 11] = "IP";
RouteParamtypes[RouteParamtypes["RAW_BODY"] = 12] = "RAW_BODY";
RouteParamtypes[RouteParamtypes["ACK"] = 13] = "ACK";
})(RouteParamtypes || (exports.RouteParamtypes = RouteParamtypes = {}));

View File

@@ -0,0 +1,16 @@
/**
* System signals which shut down a process
*/
export declare enum ShutdownSignal {
SIGHUP = "SIGHUP",
SIGINT = "SIGINT",
SIGQUIT = "SIGQUIT",
SIGILL = "SIGILL",
SIGTRAP = "SIGTRAP",
SIGABRT = "SIGABRT",
SIGBUS = "SIGBUS",
SIGFPE = "SIGFPE",
SIGSEGV = "SIGSEGV",
SIGUSR2 = "SIGUSR2",
SIGTERM = "SIGTERM"
}

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShutdownSignal = void 0;
/**
* System signals which shut down a process
*/
var ShutdownSignal;
(function (ShutdownSignal) {
ShutdownSignal["SIGHUP"] = "SIGHUP";
ShutdownSignal["SIGINT"] = "SIGINT";
ShutdownSignal["SIGQUIT"] = "SIGQUIT";
ShutdownSignal["SIGILL"] = "SIGILL";
ShutdownSignal["SIGTRAP"] = "SIGTRAP";
ShutdownSignal["SIGABRT"] = "SIGABRT";
ShutdownSignal["SIGBUS"] = "SIGBUS";
ShutdownSignal["SIGFPE"] = "SIGFPE";
ShutdownSignal["SIGSEGV"] = "SIGSEGV";
ShutdownSignal["SIGUSR2"] = "SIGUSR2";
ShutdownSignal["SIGTERM"] = "SIGTERM";
})(ShutdownSignal || (exports.ShutdownSignal = ShutdownSignal = {}));

View File

@@ -0,0 +1,9 @@
/**
* @publicApi
*/
export declare enum VersioningType {
URI = 0,
HEADER = 1,
MEDIA_TYPE = 2,
CUSTOM = 3
}

13
node_modules/@nestjs/common/enums/version-type.enum.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VersioningType = void 0;
/**
* @publicApi
*/
var VersioningType;
(function (VersioningType) {
VersioningType[VersioningType["URI"] = 0] = "URI";
VersioningType[VersioningType["HEADER"] = 1] = "HEADER";
VersioningType[VersioningType["MEDIA_TYPE"] = 2] = "MEDIA_TYPE";
VersioningType[VersioningType["CUSTOM"] = 3] = "CUSTOM";
})(VersioningType || (exports.VersioningType = VersioningType = {}));

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Bad Gateway* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class BadGatewayException extends HttpException {
/**
* Instantiate a `BadGatewayException` Exception.
*
* @example
* `throw new BadGatewayException()`
*
* @usageNotes
* The HTTP response status code will be 502.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 502.
* - `message`: the string `'Bad Gateway'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadGatewayException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Bad Gateway* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class BadGatewayException extends http_exception_1.HttpException {
/**
* Instantiate a `BadGatewayException` Exception.
*
* @example
* `throw new BadGatewayException()`
*
* @usageNotes
* The HTTP response status code will be 502.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 502.
* - `message`: the string `'Bad Gateway'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Bad Gateway') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.BAD_GATEWAY), http_status_enum_1.HttpStatus.BAD_GATEWAY, httpExceptionOptions);
}
}
exports.BadGatewayException = BadGatewayException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Bad Request* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class BadRequestException extends HttpException {
/**
* Instantiate a `BadRequestException` Exception.
*
* @example
* `throw new BadRequestException()`
*
* @usageNotes
* The HTTP response status code will be 400.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 400.
* - `message`: the string `'Bad Request'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadRequestException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Bad Request* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class BadRequestException extends http_exception_1.HttpException {
/**
* Instantiate a `BadRequestException` Exception.
*
* @example
* `throw new BadRequestException()`
*
* @usageNotes
* The HTTP response status code will be 400.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 400.
* - `message`: the string `'Bad Request'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Bad Request') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.BAD_REQUEST), http_status_enum_1.HttpStatus.BAD_REQUEST, httpExceptionOptions);
}
}
exports.BadRequestException = BadRequestException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Conflict* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class ConflictException extends HttpException {
/**
* Instantiate a `ConflictException` Exception.
*
* @example
* `throw new ConflictException()`
*
* @usageNotes
* The HTTP response status code will be 409.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 409.
* - `message`: the string `'Conflict'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConflictException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Conflict* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class ConflictException extends http_exception_1.HttpException {
/**
* Instantiate a `ConflictException` Exception.
*
* @example
* `throw new ConflictException()`
*
* @usageNotes
* The HTTP response status code will be 409.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 409.
* - `message`: the string `'Conflict'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Conflict') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.CONFLICT), http_status_enum_1.HttpStatus.CONFLICT, httpExceptionOptions);
}
}
exports.ConflictException = ConflictException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Forbidden* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class ForbiddenException extends HttpException {
/**
* Instantiate a `ForbiddenException` Exception.
*
* @example
* `throw new ForbiddenException()`
*
* @usageNotes
* The HTTP response status code will be 403.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 403.
* - `message`: the string `'Forbidden'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForbiddenException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Forbidden* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class ForbiddenException extends http_exception_1.HttpException {
/**
* Instantiate a `ForbiddenException` Exception.
*
* @example
* `throw new ForbiddenException()`
*
* @usageNotes
* The HTTP response status code will be 403.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 403.
* - `message`: the string `'Forbidden'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Forbidden') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.FORBIDDEN), http_status_enum_1.HttpStatus.FORBIDDEN, httpExceptionOptions);
}
}
exports.ForbiddenException = ForbiddenException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Gateway Timeout* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class GatewayTimeoutException extends HttpException {
/**
* Instantiate a `GatewayTimeoutException` Exception.
*
* @example
* `throw new GatewayTimeoutException()`
*
* @usageNotes
* The HTTP response status code will be 504.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 504.
* - `message`: the string `'Gateway Timeout'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GatewayTimeoutException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Gateway Timeout* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class GatewayTimeoutException extends http_exception_1.HttpException {
/**
* Instantiate a `GatewayTimeoutException` Exception.
*
* @example
* `throw new GatewayTimeoutException()`
*
* @usageNotes
* The HTTP response status code will be 504.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 504.
* - `message`: the string `'Gateway Timeout'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Gateway Timeout') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.GATEWAY_TIMEOUT), http_status_enum_1.HttpStatus.GATEWAY_TIMEOUT, httpExceptionOptions);
}
}
exports.GatewayTimeoutException = GatewayTimeoutException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Gone* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class GoneException extends HttpException {
/**
* Instantiate a `GoneException` Exception.
*
* @example
* `throw new GoneException()`
*
* @usageNotes
* The HTTP response status code will be 410.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 410.
* - `message`: the string `'Gone'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoneException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Gone* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class GoneException extends http_exception_1.HttpException {
/**
* Instantiate a `GoneException` Exception.
*
* @example
* `throw new GoneException()`
*
* @usageNotes
* The HTTP response status code will be 410.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 410.
* - `message`: the string `'Gone'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Gone') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.GONE), http_status_enum_1.HttpStatus.GONE, httpExceptionOptions);
}
}
exports.GoneException = GoneException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Http Version Not Supported* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class HttpVersionNotSupportedException extends HttpException {
/**
* Instantiate a `HttpVersionNotSupportedException` Exception.
*
* @example
* `throw new HttpVersionNotSupportedException()`
*
* @usageNotes
* The HTTP response status code will be 505.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 505.
* - `message`: the string `'HTTP Version Not Supported'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpVersionNotSupportedException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Http Version Not Supported* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class HttpVersionNotSupportedException extends http_exception_1.HttpException {
/**
* Instantiate a `HttpVersionNotSupportedException` Exception.
*
* @example
* `throw new HttpVersionNotSupportedException()`
*
* @usageNotes
* The HTTP response status code will be 505.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 505.
* - `message`: the string `'HTTP Version Not Supported'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'HTTP Version Not Supported') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.HTTP_VERSION_NOT_SUPPORTED), http_status_enum_1.HttpStatus.HTTP_VERSION_NOT_SUPPORTED, httpExceptionOptions);
}
}
exports.HttpVersionNotSupportedException = HttpVersionNotSupportedException;

View File

@@ -0,0 +1,85 @@
import { HttpExceptionBody, HttpExceptionBodyMessage } from '../interfaces/http/http-exception-body.interface';
import { IntrinsicException } from './intrinsic.exception';
export interface HttpExceptionOptions {
/** original cause of the error */
cause?: unknown;
description?: string;
}
export interface DescriptionAndOptions {
description?: string;
httpExceptionOptions?: HttpExceptionOptions;
}
/**
* Defines the base Nest HTTP exception, which is handled by the default
* Exceptions Handler.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class HttpException extends IntrinsicException {
private readonly response;
private readonly status;
private readonly options?;
/**
* Exception cause. Indicates the specific original cause of the error.
* It is used when catching and re-throwing an error with a more-specific or useful error message in order to still have access to the original error.
*/
cause: unknown;
/**
* Instantiate a plain HTTP Exception.
*
* @example
* throw new HttpException('message', HttpStatus.BAD_REQUEST)
* throw new HttpException('custom message', HttpStatus.BAD_REQUEST, {
* cause: new Error('Cause Error'),
* })
*
*
* @usageNotes
* The constructor arguments define the response and the HTTP response status code.
* - The `response` argument (required) defines the JSON response body. alternatively, it can also be
* an error object that is used to define an error [cause](https://nodejs.org/en/blog/release/v16.9.0/#error-cause).
* - The `status` argument (required) defines the HTTP Status Code.
* - The `options` argument (optional) defines additional error options. Currently, it supports the `cause` attribute,
* and can be used as an alternative way to specify the error cause: `const error = new HttpException('description', 400, { cause: new Error() });`
*
* By default, the JSON response body contains two properties:
* - `statusCode`: the Http Status Code.
* - `message`: a short description of the HTTP error by default; override this
* by supplying a string in the `response` parameter.
*
* To override the entire JSON response body, pass an object to the `createBody`
* method. Nest will serialize the object and return it as the JSON response body.
*
* The `status` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param response string, object describing the error condition or the error cause.
* @param status HTTP response status code.
* @param options An object used to add an error cause.
*/
constructor(response: string | Record<string, any>, status: number, options?: HttpExceptionOptions | undefined);
/**
* Configures error chaining support
*
* @see https://nodejs.org/en/blog/release/v16.9.0/#error-cause
* @see https://github.com/microsoft/TypeScript/issues/45167
*/
initCause(): void;
initMessage(): void;
initName(): void;
getResponse(): string | object;
getStatus(): number;
static createBody(nil: null | '', message: HttpExceptionBodyMessage, statusCode: number): HttpExceptionBody;
static createBody(message: HttpExceptionBodyMessage, error: string, statusCode: number): HttpExceptionBody;
static createBody<Body extends Record<string, unknown>>(custom: Body): Body;
static getDescriptionFrom(descriptionOrOptions: string | HttpExceptionOptions): string;
static getHttpExceptionOptionsFrom(descriptionOrOptions: string | HttpExceptionOptions): HttpExceptionOptions;
/**
* Utility method used to extract the error description and httpExceptionOptions from the given argument.
* This is used by inheriting classes to correctly parse both options.
* @returns the error description and the httpExceptionOptions as an object.
*/
static extractDescriptionAndOptionsFrom(descriptionOrOptions: string | HttpExceptionOptions): DescriptionAndOptions;
}

View File

@@ -0,0 +1,133 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpException = void 0;
const shared_utils_1 = require("../utils/shared.utils");
const intrinsic_exception_1 = require("./intrinsic.exception");
/**
* Defines the base Nest HTTP exception, which is handled by the default
* Exceptions Handler.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class HttpException extends intrinsic_exception_1.IntrinsicException {
/**
* Instantiate a plain HTTP Exception.
*
* @example
* throw new HttpException('message', HttpStatus.BAD_REQUEST)
* throw new HttpException('custom message', HttpStatus.BAD_REQUEST, {
* cause: new Error('Cause Error'),
* })
*
*
* @usageNotes
* The constructor arguments define the response and the HTTP response status code.
* - The `response` argument (required) defines the JSON response body. alternatively, it can also be
* an error object that is used to define an error [cause](https://nodejs.org/en/blog/release/v16.9.0/#error-cause).
* - The `status` argument (required) defines the HTTP Status Code.
* - The `options` argument (optional) defines additional error options. Currently, it supports the `cause` attribute,
* and can be used as an alternative way to specify the error cause: `const error = new HttpException('description', 400, { cause: new Error() });`
*
* By default, the JSON response body contains two properties:
* - `statusCode`: the Http Status Code.
* - `message`: a short description of the HTTP error by default; override this
* by supplying a string in the `response` parameter.
*
* To override the entire JSON response body, pass an object to the `createBody`
* method. Nest will serialize the object and return it as the JSON response body.
*
* The `status` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param response string, object describing the error condition or the error cause.
* @param status HTTP response status code.
* @param options An object used to add an error cause.
*/
constructor(response, status, options) {
super();
this.response = response;
this.status = status;
this.options = options;
this.initMessage();
this.initName();
this.initCause();
}
/**
* Configures error chaining support
*
* @see https://nodejs.org/en/blog/release/v16.9.0/#error-cause
* @see https://github.com/microsoft/TypeScript/issues/45167
*/
initCause() {
if (this.options?.cause) {
this.cause = this.options.cause;
return;
}
}
initMessage() {
if ((0, shared_utils_1.isString)(this.response)) {
this.message = this.response;
}
else if ((0, shared_utils_1.isObject)(this.response) && (0, shared_utils_1.isString)(this.response.message)) {
this.message = this.response.message;
}
else if (this.constructor) {
this.message =
this.constructor.name.match(/[A-Z][a-z]+|[0-9]+/g)?.join(' ') ??
'Error';
}
}
initName() {
this.name = this.constructor.name;
}
getResponse() {
return this.response;
}
getStatus() {
return this.status;
}
static createBody(arg0, arg1, statusCode) {
if (!arg0) {
return {
message: arg1,
statusCode: statusCode,
};
}
if ((0, shared_utils_1.isString)(arg0) || Array.isArray(arg0) || (0, shared_utils_1.isNumber)(arg0)) {
return {
message: arg0,
error: arg1,
statusCode: statusCode,
};
}
return arg0;
}
static getDescriptionFrom(descriptionOrOptions) {
return (0, shared_utils_1.isString)(descriptionOrOptions)
? descriptionOrOptions
: descriptionOrOptions?.description;
}
static getHttpExceptionOptionsFrom(descriptionOrOptions) {
return (0, shared_utils_1.isString)(descriptionOrOptions) ? {} : descriptionOrOptions;
}
/**
* Utility method used to extract the error description and httpExceptionOptions from the given argument.
* This is used by inheriting classes to correctly parse both options.
* @returns the error description and the httpExceptionOptions as an object.
*/
static extractDescriptionAndOptionsFrom(descriptionOrOptions) {
const description = (0, shared_utils_1.isString)(descriptionOrOptions)
? descriptionOrOptions
: descriptionOrOptions?.description;
const httpExceptionOptions = (0, shared_utils_1.isString)(descriptionOrOptions)
? {}
: descriptionOrOptions;
return {
description,
httpExceptionOptions,
};
}
}
exports.HttpException = HttpException;

View File

@@ -0,0 +1,38 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *ImATeapotException* type errors.
*
* Any attempt to brew coffee with a teapot should result in the error code
* "418 I'm a teapot". The resulting entity body MAY be short and stout.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class ImATeapotException extends HttpException {
/**
* Instantiate an `ImATeapotException` Exception.
*
* @example
* `throw new ImATeapotException()`
*
* @usageNotes
* The HTTP response status code will be 418.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 418.
* - `message`: the string `"I'm a Teapot"` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImATeapotException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *ImATeapotException* type errors.
*
* Any attempt to brew coffee with a teapot should result in the error code
* "418 I'm a teapot". The resulting entity body MAY be short and stout.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class ImATeapotException extends http_exception_1.HttpException {
/**
* Instantiate an `ImATeapotException` Exception.
*
* @example
* `throw new ImATeapotException()`
*
* @usageNotes
* The HTTP response status code will be 418.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 418.
* - `message`: the string `"I'm a Teapot"` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = `I'm a teapot`) {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.I_AM_A_TEAPOT), http_status_enum_1.HttpStatus.I_AM_A_TEAPOT, httpExceptionOptions);
}
}
exports.ImATeapotException = ImATeapotException;

23
node_modules/@nestjs/common/exceptions/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
export * from './bad-gateway.exception';
export * from './bad-request.exception';
export * from './conflict.exception';
export * from './forbidden.exception';
export * from './gateway-timeout.exception';
export * from './gone.exception';
export * from './http-version-not-supported.exception';
export * from './http.exception';
export * from './im-a-teapot.exception';
export * from './internal-server-error.exception';
export * from './intrinsic.exception';
export * from './method-not-allowed.exception';
export * from './misdirected.exception';
export * from './not-acceptable.exception';
export * from './not-found.exception';
export * from './not-implemented.exception';
export * from './payload-too-large.exception';
export * from './precondition-failed.exception';
export * from './request-timeout.exception';
export * from './service-unavailable.exception';
export * from './unauthorized.exception';
export * from './unprocessable-entity.exception';
export * from './unsupported-media-type.exception';

26
node_modules/@nestjs/common/exceptions/index.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./bad-gateway.exception"), exports);
tslib_1.__exportStar(require("./bad-request.exception"), exports);
tslib_1.__exportStar(require("./conflict.exception"), exports);
tslib_1.__exportStar(require("./forbidden.exception"), exports);
tslib_1.__exportStar(require("./gateway-timeout.exception"), exports);
tslib_1.__exportStar(require("./gone.exception"), exports);
tslib_1.__exportStar(require("./http-version-not-supported.exception"), exports);
tslib_1.__exportStar(require("./http.exception"), exports);
tslib_1.__exportStar(require("./im-a-teapot.exception"), exports);
tslib_1.__exportStar(require("./internal-server-error.exception"), exports);
tslib_1.__exportStar(require("./intrinsic.exception"), exports);
tslib_1.__exportStar(require("./method-not-allowed.exception"), exports);
tslib_1.__exportStar(require("./misdirected.exception"), exports);
tslib_1.__exportStar(require("./not-acceptable.exception"), exports);
tslib_1.__exportStar(require("./not-found.exception"), exports);
tslib_1.__exportStar(require("./not-implemented.exception"), exports);
tslib_1.__exportStar(require("./payload-too-large.exception"), exports);
tslib_1.__exportStar(require("./precondition-failed.exception"), exports);
tslib_1.__exportStar(require("./request-timeout.exception"), exports);
tslib_1.__exportStar(require("./service-unavailable.exception"), exports);
tslib_1.__exportStar(require("./unauthorized.exception"), exports);
tslib_1.__exportStar(require("./unprocessable-entity.exception"), exports);
tslib_1.__exportStar(require("./unsupported-media-type.exception"), exports);

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Internal Server Error* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class InternalServerErrorException extends HttpException {
/**
* Instantiate an `InternalServerErrorException` Exception.
*
* @example
* `throw new InternalServerErrorException()`
*
* @usageNotes
* The HTTP response status code will be 500.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 500.
* - `message`: the string `'Internal Server Error'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InternalServerErrorException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Internal Server Error* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class InternalServerErrorException extends http_exception_1.HttpException {
/**
* Instantiate an `InternalServerErrorException` Exception.
*
* @example
* `throw new InternalServerErrorException()`
*
* @usageNotes
* The HTTP response status code will be 500.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 500.
* - `message`: the string `'Internal Server Error'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Internal Server Error') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.INTERNAL_SERVER_ERROR), http_status_enum_1.HttpStatus.INTERNAL_SERVER_ERROR, httpExceptionOptions);
}
}
exports.InternalServerErrorException = InternalServerErrorException;

View File

@@ -0,0 +1,8 @@
/**
* Exception that represents an intrinsic error in the application.
* When thrown, the default exception filter will not log the error message.
*
* @publicApi
*/
export declare class IntrinsicException extends Error {
}

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IntrinsicException = void 0;
/**
* Exception that represents an intrinsic error in the application.
* When thrown, the default exception filter will not log the error message.
*
* @publicApi
*/
class IntrinsicException extends Error {
}
exports.IntrinsicException = IntrinsicException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Method Not Allowed* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class MethodNotAllowedException extends HttpException {
/**
* Instantiate a `MethodNotAllowedException` Exception.
*
* @example
* `throw new MethodNotAllowedException()`
*
* @usageNotes
* The HTTP response status code will be 405.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 405.
* - `message`: the string `'Method Not Allowed'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodNotAllowedException = void 0;
const http_status_enum_1 = require("../enums/http-status.enum");
const http_exception_1 = require("./http.exception");
/**
* Defines an HTTP exception for *Method Not Allowed* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
class MethodNotAllowedException extends http_exception_1.HttpException {
/**
* Instantiate a `MethodNotAllowedException` Exception.
*
* @example
* `throw new MethodNotAllowedException()`
*
* @usageNotes
* The HTTP response status code will be 405.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 405.
* - `message`: the string `'Method Not Allowed'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError, descriptionOrOptions = 'Method Not Allowed') {
const { description, httpExceptionOptions } = http_exception_1.HttpException.extractDescriptionAndOptionsFrom(descriptionOrOptions);
super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.METHOD_NOT_ALLOWED), http_status_enum_1.HttpStatus.METHOD_NOT_ALLOWED, httpExceptionOptions);
}
}
exports.MethodNotAllowedException = MethodNotAllowedException;

View File

@@ -0,0 +1,35 @@
import { HttpException, HttpExceptionOptions } from './http.exception';
/**
* Defines an HTTP exception for *Misdirected* type errors.
*
* @see [Built-in HTTP exceptions](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)
*
* @publicApi
*/
export declare class MisdirectedException extends HttpException {
/**
* Instantiate a `MisdirectedException` Exception.
*
* @example
* `throw new MisdirectedException()`
*
* @usageNotes
* The HTTP response status code will be 421.
* - The `objectOrError` argument defines the JSON response body or the message string.
* - The `descriptionOrOptions` argument contains either a short description of the HTTP error or an options object used to provide an underlying error cause.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: this will be the value 421.
* - `message`: the string `'Bad Gateway'` by default; override this by supplying
* a string in the `objectOrError` parameter.
*
* If the parameter `objectOrError` is a string, the response body will contain an
* additional property, `error`, with a short description of the HTTP error. To override the
* entire JSON response body, pass an object instead. Nest will serialize the object
* and return it as the JSON response body.
*
* @param objectOrError string or object describing the error condition.
* @param descriptionOrOptions either a short description of the HTTP error or an options object used to provide an underlying error cause
*/
constructor(objectOrError?: any, descriptionOrOptions?: string | HttpExceptionOptions);
}

Some files were not shown because too many files have changed in this diff Show More