🎯 MapView v2.0 - Global Deployment Ready

 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
This commit is contained in:
2025-07-20 19:52:16 +07:00
parent 3203463a6a
commit c65cc97a33
64624 changed files with 7199453 additions and 6462 deletions

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

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2017-2024 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
backend/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.

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

@@ -0,0 +1,151 @@
<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://www.npmjs.com/~nestjscore" 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 and backend 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 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://marblism.com?utm_source=nest" target="_blank"><img src="https://nestjs.com/img/logos/marblism-logo.png" width="180" 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://amplication.com/" target="_blank"><img src="https://nestjs.com/img/logos/amplication-logo.svg" width="190" 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://fuseautotech.com/" target="_blank"><img src="https://nestjs.com/img/logos/fuse-logo.svg" width="105" valign="middle" /></a></td>
<td><a href="https://ridicorp.com/career/" target="_blank"><img src="https://nestjs.com/img/logos/ridi-logo.svg" width="105" 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>
<td><a href="https://skunk.team" target="_blank"><img src="https://nestjs.com/img/logos/skunk-logo.png" height="60" 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://bloodycase.com/?promocode=NEST" target="_blank"><img src="https://nestjs.com/img/logos/bloodycase-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>
</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://thecasinowizard.com/bonuses/no-deposit-bonuses/" target="_blank"><img src="https://nestjs.com/img/logos/casinowizard-logo.png" width="120" valign="middle" /></a></td>
<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>
</tr>
<tr>
<td align="center" valign="middle"><a href="https://julienferand.dev/" target="_blank"><img src="https://nestjs.com/img/logos/julienferand-logo.jpeg" width="55" 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>
<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>
<td align="center" valign="middle"><a href="https://www.slotsup.com/" target="_blank"><img src="https://nestjs.com/img/logos/slotsup-logo.png" width="60" 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).

View File

@@ -0,0 +1,12 @@
/**
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
export declare const CACHE_MANAGER = "CACHE_MANAGER";
export declare const CACHE_KEY_METADATA = "cache_module:cache_key";
export declare const CACHE_TTL_METADATA = "cache_module:cache_ttl";
/**
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
export declare const CACHE_MODULE_OPTIONS: string | symbol;

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CACHE_MODULE_OPTIONS = exports.CACHE_TTL_METADATA = exports.CACHE_KEY_METADATA = exports.CACHE_MANAGER = void 0;
const cache_module_definition_1 = require("./cache.module-definition");
/**
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
exports.CACHE_MANAGER = 'CACHE_MANAGER';
exports.CACHE_KEY_METADATA = 'cache_module:cache_key';
exports.CACHE_TTL_METADATA = 'cache_module:cache_ttl';
/**
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
exports.CACHE_MODULE_OPTIONS = cache_module_definition_1.MODULE_OPTIONS_TOKEN;

View File

@@ -0,0 +1,2 @@
import { CacheModuleOptions } from './interfaces/cache-module.interface';
export declare const ConfigurableModuleClass: import("../module-utils").ConfigurableModuleCls<CacheModuleOptions, "register", "createCacheOptions", {}>, MODULE_OPTIONS_TOKEN: string | symbol;

View File

@@ -0,0 +1,10 @@
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = void 0;
const module_utils_1 = require("../module-utils");
_a = new module_utils_1.ConfigurableModuleBuilder({
moduleName: 'Cache',
})
.setFactoryMethodName('createCacheOptions')
.build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN;

View File

@@ -0,0 +1,29 @@
import { DynamicModule } from '../interfaces';
import { ConfigurableModuleClass } from './cache.module-definition';
import { CacheModuleAsyncOptions, CacheModuleOptions } from './interfaces/cache-module.interface';
/**
* Module that provides Nest cache-manager.
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
export declare class CacheModule extends ConfigurableModuleClass {
/**
* Configure the cache manager statically.
*
* @param options options to configure the cache manager
*
* @see [Customize caching](https://docs.nestjs.com/techniques/caching#customize-caching)
*/
static register<StoreConfig extends Record<any, any> = Record<string, any>>(options?: CacheModuleOptions<StoreConfig>): DynamicModule;
/**
* Configure the cache manager dynamically.
*
* @param options method for dynamically supplying cache manager configuration
* options
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*/
static registerAsync<StoreConfig extends Record<any, any> = Record<string, any>>(options: CacheModuleAsyncOptions<StoreConfig>): DynamicModule;
}

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheModule = void 0;
const tslib_1 = require("tslib");
const decorators_1 = require("../decorators");
const cache_constants_1 = require("./cache.constants");
const cache_module_definition_1 = require("./cache.module-definition");
const cache_providers_1 = require("./cache.providers");
/**
* Module that provides Nest cache-manager.
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
let CacheModule = class CacheModule extends cache_module_definition_1.ConfigurableModuleClass {
/**
* Configure the cache manager statically.
*
* @param options options to configure the cache manager
*
* @see [Customize caching](https://docs.nestjs.com/techniques/caching#customize-caching)
*/
static register(options = {}) {
return Object.assign({ global: options.isGlobal }, super.register(options));
}
/**
* Configure the cache manager dynamically.
*
* @param options method for dynamically supplying cache manager configuration
* options
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*/
static registerAsync(options) {
const moduleDefinition = super.registerAsync(options);
return Object.assign(Object.assign({ global: options.isGlobal }, moduleDefinition), { providers: options.extraProviders
? moduleDefinition.providers.concat(options.extraProviders)
: moduleDefinition.providers });
}
};
CacheModule = tslib_1.__decorate([
(0, decorators_1.Module)({
providers: [(0, cache_providers_1.createCacheManager)()],
exports: [cache_constants_1.CACHE_MANAGER],
})
], CacheModule);
exports.CacheModule = CacheModule;

View File

@@ -0,0 +1,7 @@
import { Provider } from '../interfaces';
/**
* Creates a CacheManager Provider.
*
* @publicApi
*/
export declare function createCacheManager(): Provider;

View File

@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCacheManager = void 0;
const load_package_util_1 = require("../utils/load-package.util");
const cache_constants_1 = require("./cache.constants");
const cache_module_definition_1 = require("./cache.module-definition");
const default_options_1 = require("./default-options");
/**
* Creates a CacheManager Provider.
*
* @publicApi
*/
function createCacheManager() {
return {
provide: cache_constants_1.CACHE_MANAGER,
useFactory: async (options) => {
const cacheManager = (0, load_package_util_1.loadPackage)('cache-manager', 'CacheModule', () => require('cache-manager'));
const cacheManagerIsv5OrGreater = 'memoryStore' in cacheManager;
const cachingFactory = async (store, options) => {
if (!cacheManagerIsv5OrGreater) {
return cacheManager.caching(Object.assign(Object.assign({}, default_options_1.defaultCacheOptions), Object.assign(Object.assign({}, options), { store })));
}
let cache = 'memory';
default_options_1.defaultCacheOptions.ttl *= 1000;
if (typeof store === 'object') {
if ('create' in store) {
cache = store.create;
}
else {
cache = store;
}
}
else if (typeof store === 'function') {
cache = store;
}
return cacheManager.caching(cache, Object.assign(Object.assign({}, default_options_1.defaultCacheOptions), options));
};
return Array.isArray(options)
? cacheManager.multiCaching(await Promise.all(options.map(option => cachingFactory(option.store, option))))
: cachingFactory(options.store, options);
},
inject: [cache_module_definition_1.MODULE_OPTIONS_TOKEN],
};
}
exports.createCacheManager = createCacheManager;

View File

@@ -0,0 +1,15 @@
/**
* Decorator that sets the caching key used to store/retrieve cached items for
* Web sockets or Microservice based apps.
*
* For example:
* `@CacheKey('events')`
*
* @param key string naming the field to be used as a cache key
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
export declare const CacheKey: (key: string) => import("../../decorators").CustomDecorator<string>;

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheKey = void 0;
const decorators_1 = require("../../decorators");
const cache_constants_1 = require("../cache.constants");
/**
* Decorator that sets the caching key used to store/retrieve cached items for
* Web sockets or Microservice based apps.
*
* For example:
* `@CacheKey('events')`
*
* @param key string naming the field to be used as a cache key
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
const CacheKey = (key) => (0, decorators_1.SetMetadata)(cache_constants_1.CACHE_KEY_METADATA, key);
exports.CacheKey = CacheKey;

View File

@@ -0,0 +1,16 @@
import { ExecutionContext } from '../../interfaces/features/execution-context.interface';
/**
* Decorator that sets the cache ttl setting the duration for cache expiration.
*
* For example: `@CacheTTL(5)`
*
* @param ttl number set the cache expiration time
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
type CacheTTLFactory = (ctx: ExecutionContext) => Promise<number> | number;
export declare const CacheTTL: (ttl: number | CacheTTLFactory) => import("../../decorators").CustomDecorator<string>;
export {};

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheTTL = void 0;
const decorators_1 = require("../../decorators");
const cache_constants_1 = require("../cache.constants");
const CacheTTL = (ttl) => (0, decorators_1.SetMetadata)(cache_constants_1.CACHE_TTL_METADATA, ttl);
exports.CacheTTL = CacheTTL;

View File

@@ -0,0 +1,2 @@
export * from './cache-key.decorator';
export * from './cache-ttl.decorator';

View File

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

View File

@@ -0,0 +1,5 @@
export declare const defaultCacheOptions: {
ttl: number;
max: number;
store: string;
};

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultCacheOptions = void 0;
exports.defaultCacheOptions = {
ttl: 5,
max: 100,
store: 'memory',
};

5
backend/node_modules/@nestjs/common/cache/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
export * from './cache.constants';
export * from './cache.module';
export * from './decorators';
export * from './interceptors';
export * from './interfaces';

8
backend/node_modules/@nestjs/common/cache/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./cache.constants"), exports);
tslib_1.__exportStar(require("./cache.module"), exports);
tslib_1.__exportStar(require("./decorators"), exports);
tslib_1.__exportStar(require("./interceptors"), exports);
tslib_1.__exportStar(require("./interfaces"), exports);

View File

@@ -0,0 +1,23 @@
import { Observable } from 'rxjs';
import { CallHandler, ExecutionContext, HttpServer, NestInterceptor } from '../../interfaces';
/** @deprecated Import from the "@nestjs/core" instead. */
export interface HttpAdapterHost<T extends HttpServer = any> {
httpAdapter: T;
}
/**
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
export declare class CacheInterceptor implements NestInterceptor {
protected readonly cacheManager: any;
protected readonly reflector: any;
protected readonly httpAdapterHost: HttpAdapterHost;
protected allowedMethods: string[];
private cacheManagerIsv5OrGreater;
constructor(cacheManager: any, reflector: any);
intercept(context: ExecutionContext, next: CallHandler): Promise<Observable<any>>;
protected trackBy(context: ExecutionContext): string | undefined;
protected isRequestCacheable(context: ExecutionContext): boolean;
}

View File

@@ -0,0 +1,98 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheInterceptor = void 0;
const tslib_1 = require("tslib");
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const decorators_1 = require("../../decorators");
const file_stream_1 = require("../../file-stream");
const logger_service_1 = require("../../services/logger.service");
const load_package_util_1 = require("../../utils/load-package.util");
const shared_utils_1 = require("../../utils/shared.utils");
const cache_constants_1 = require("../cache.constants");
/** @deprecated */
const HTTP_ADAPTER_HOST = 'HttpAdapterHost';
/** @deprecated */
const REFLECTOR = 'Reflector';
/**
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
* @publicApi
*/
let CacheInterceptor = class CacheInterceptor {
constructor(cacheManager, reflector) {
this.cacheManager = cacheManager;
this.reflector = reflector;
this.allowedMethods = ['GET'];
// We need to check if the cache-manager package is v5 or greater
// because the set method signature changed in v5
const cacheManagerPackage = (0, load_package_util_1.loadPackage)('cache-manager', 'CacheModule', () => require('cache-manager'));
this.cacheManagerIsv5OrGreater = 'memoryStore' in cacheManagerPackage;
logger_service_1.Logger.warn('DEPRECATED! "CacheModule" (from the "@nestjs/common" package) is deprecated and will be removed in the next major release. Please, use the "@nestjs/cache-manager" package instead.');
}
async intercept(context, next) {
var _a;
const key = this.trackBy(context);
const ttlValueOrFactory = (_a = this.reflector.get(cache_constants_1.CACHE_TTL_METADATA, context.getHandler())) !== null && _a !== void 0 ? _a : null;
if (!key) {
return next.handle();
}
try {
const value = await this.cacheManager.get(key);
if (!(0, shared_utils_1.isNil)(value)) {
return (0, rxjs_1.of)(value);
}
const ttl = (0, shared_utils_1.isFunction)(ttlValueOrFactory)
? await ttlValueOrFactory(context)
: ttlValueOrFactory;
return next.handle().pipe((0, operators_1.tap)(async (response) => {
if (response instanceof file_stream_1.StreamableFile) {
return;
}
const args = [key, response];
if (!(0, shared_utils_1.isNil)(ttl)) {
args.push(this.cacheManagerIsv5OrGreater ? ttl : { ttl });
}
try {
await this.cacheManager.set(...args);
}
catch (err) {
logger_service_1.Logger.error(`An error has occurred when inserting "key: ${key}", "value: ${response}"`, 'CacheInterceptor');
}
}));
}
catch (_b) {
return next.handle();
}
}
trackBy(context) {
const httpAdapter = this.httpAdapterHost.httpAdapter;
const isHttpApp = httpAdapter && !!httpAdapter.getRequestMethod;
const cacheMetadata = this.reflector.get(cache_constants_1.CACHE_KEY_METADATA, context.getHandler());
if (!isHttpApp || cacheMetadata) {
return cacheMetadata;
}
const request = context.getArgByIndex(0);
if (!this.isRequestCacheable(context)) {
return undefined;
}
return httpAdapter.getRequestUrl(request);
}
isRequestCacheable(context) {
const req = context.switchToHttp().getRequest();
return this.allowedMethods.includes(req.method);
}
};
tslib_1.__decorate([
(0, decorators_1.Optional)(),
(0, decorators_1.Inject)(HTTP_ADAPTER_HOST),
tslib_1.__metadata("design:type", Object)
], CacheInterceptor.prototype, "httpAdapterHost", void 0);
CacheInterceptor = tslib_1.__decorate([
(0, decorators_1.Injectable)(),
tslib_1.__param(0, (0, decorators_1.Inject)(cache_constants_1.CACHE_MANAGER)),
tslib_1.__param(1, (0, decorators_1.Inject)(REFLECTOR)),
tslib_1.__metadata("design:paramtypes", [Object, Object])
], CacheInterceptor);
exports.CacheInterceptor = CacheInterceptor;

View File

@@ -0,0 +1 @@
export * from './cache.interceptor';

View File

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

View File

@@ -0,0 +1,76 @@
export interface LiteralObject {
[key: string]: any;
}
/**
* Interface defining a cache store. Implement this interface to create a custom
* cache store.
*
* @publicApi
*/
export interface CacheStore {
/**
* Create a key/value pair in the cache.
*
* @param key cache key
* @param value cache value
*/
set<T>(key: string, value: T, options?: CacheStoreSetOptions<T> | number): Promise<void> | void;
/**
* Retrieve a key/value pair from the cache.
*
* @param key cache key
*/
get<T>(key: string): Promise<T | undefined> | T | undefined;
/**
* Destroy a key/value pair from the cache.
*
* @param key cache key
*/
del?(key: string): void | Promise<void>;
}
export interface CacheStoreSetOptions<T> {
/**
* Time to live - amount of time in seconds that a response is cached before it
* is deleted. Defaults based on your cache manager settings.
*/
ttl?: ((value: T) => number) | number;
}
/**
* Interface defining a factory to create a cache store.
*
* @publicApi
*/
export type CacheStoreFactory = {
/**
* Return a configured cache store.
*
* @param args Cache manager options received from `CacheModule.register()`
* or `CacheModule.registerAsync()`
*/
create(args: LiteralObject): CacheStore;
} | ((args: LiteralObject) => CacheStore | Promise<CacheStore>);
/**
* Interface defining Cache Manager configuration options.
*
* @publicApi
*/
export interface CacheManagerOptions {
/**
* Cache storage manager. Default is `'memory'` (in-memory store). See
* [Different stores](https://docs.nestjs.com/techniques/caching#different-stores)
* for more info.
*/
store?: string | CacheStoreFactory | CacheStore;
/**
* Time to live - amount of time that a response is cached before it
* is deleted. Subsequent request will call through the route handler and refresh
* the cache. Defaults to 5 seconds. In `cache-manager@^4` this value is in seconds.
* In `cache-manager@^5` this value is in milliseconds.
*/
ttl?: number;
/**
* Maximum number of responses to store in the cache. Defaults to 100.
*/
max?: number;
isCacheableValue?: (value: any) => boolean;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,56 @@
import { Provider, Type } from '../../interfaces';
import { ConfigurableModuleAsyncOptions } from '../../module-utils';
import { CacheManagerOptions } from './cache-manager.interface';
export type CacheModuleOptions<StoreConfig extends Record<any, any> = Record<string, any>> = CacheManagerOptions & StoreConfig & {
/**
* If "true', register `CacheModule` as a global module.
*/
isGlobal?: boolean;
};
/**
* Interface describing a `CacheOptionsFactory`. Providers supplying configuration
* options for the Cache module must implement this interface.
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*
* @publicApi
*/
export interface CacheOptionsFactory<StoreConfig extends Record<any, any> = Record<string, any>> {
createCacheOptions(): Promise<CacheModuleOptions<StoreConfig>> | CacheModuleOptions<StoreConfig>;
}
/**
* Options for dynamically configuring the Cache module.
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*
* @publicApi
*/
export interface CacheModuleAsyncOptions<StoreConfig extends Record<any, any> = Record<string, any>> extends ConfigurableModuleAsyncOptions<CacheModuleOptions<StoreConfig>, keyof CacheOptionsFactory> {
/**
* Injection token resolving to an existing provider. The provider must implement
* the `CacheOptionsFactory` interface.
*/
useExisting?: Type<CacheOptionsFactory<StoreConfig>>;
/**
* Injection token resolving to a class that will be instantiated as a provider.
* The class must implement the `CacheOptionsFactory` interface.
*/
useClass?: Type<CacheOptionsFactory<StoreConfig>>;
/**
* Function returning options (or a Promise resolving to options) to configure the
* cache module.
*/
useFactory?: (...args: any[]) => Promise<CacheModuleOptions<StoreConfig>> | CacheModuleOptions<StoreConfig>;
/**
* Dependencies that a Factory may inject.
*/
inject?: any[];
/**
* Extra providers to be registered within a scope of this module.
*/
extraProviders?: Provider[];
/**
* If "true', register `CacheModule` as a global module.
*/
isGlobal?: boolean;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
export * from './cache-manager.interface';
export * from './cache-module.interface';

View File

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

42
backend/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
backend/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,21 @@
"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,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UseFilters = void 0;
/* eslint-disable @typescript-eslint/no-use-before-define */
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;
};
}

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';

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,30 @@
/**
* 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<T = any>(token?: T): 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,43 @@
"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,43 @@
"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,41 @@
"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, FactoryInput = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryInput, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;

View File

@@ -0,0 +1,31 @@
"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';

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,78 @@
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;

View File

@@ -0,0 +1,98 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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);

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;
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,264 @@
"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,6 @@
/**
* Declares this route as a Server-Sent-Events endpoint
*
* @publicApi
*/
export declare function Sse(path?: string): MethodDecorator;

View File

@@ -0,0 +1,19 @@
"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) {
return (target, key, descriptor) => {
path = path && path.length ? path : '/';
Reflect.defineMetadata(constants_1.PATH_METADATA, path, descriptor.value);
Reflect.defineMetadata(constants_1.METHOD_METADATA, request_method_enum_1.RequestMethod.GET, descriptor.value);
Reflect.defineMetadata(constants_1.SSE_METADATA, true, descriptor.value);
return descriptor;
};
}

View File

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

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 (metadata.hasOwnProperty(property)) {
Reflect.defineMetadata(property, metadata[property], target);
}
}
};
}

View File

@@ -0,0 +1,53 @@
/**
* @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,
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,
FAILED_DEPENDENCY = 424,
PRECONDITION_REQUIRED = 428,
TOO_MANY_REQUESTS = 429,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
BAD_GATEWAY = 502,
SERVICE_UNAVAILABLE = 503,
GATEWAY_TIMEOUT = 504,
HTTP_VERSION_NOT_SUPPORTED = 505
}

View File

@@ -0,0 +1,57 @@
"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["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["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
HttpStatus[HttpStatus["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
HttpStatus[HttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
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 || (exports.HttpStatus = HttpStatus = {}));

4
backend/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
backend/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,11 @@
export declare enum RequestMethod {
GET = 0,
POST = 1,
PUT = 2,
DELETE = 3,
PATCH = 4,
ALL = 5,
OPTIONS = 6,
HEAD = 7,
SEARCH = 8
}

View File

@@ -0,0 +1,15 @@
"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 || (exports.RequestMethod = RequestMethod = {}));

View File

@@ -0,0 +1,15 @@
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
}

View File

@@ -0,0 +1,19 @@
"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 || (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
}

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