1 | import { PipeTransform } from '../../index';
|
2 | import { Type } from '../../interfaces';
|
3 | /**
|
4 | * The `@Response()`/`@Res` parameter decorator options.
|
5 | */
|
6 | export interface ResponseDecoratorOptions {
|
7 | /**
|
8 | * Determines whether the response will be sent manually within the route handler,
|
9 | * with the use of native response handling methods exposed by the platform-specific response object,
|
10 | * or if it should passthrough Nest response processing pipeline.
|
11 | *
|
12 | * @default false
|
13 | */
|
14 | passthrough: boolean;
|
15 | }
|
16 | export type ParamData = object | string | number;
|
17 | export interface RouteParamMetadata {
|
18 | index: number;
|
19 | data?: ParamData;
|
20 | }
|
21 | export declare function assignMetadata<TParamtype = any, TArgs = any>(args: TArgs, paramtype: TParamtype, index: number, data?: ParamData, ...pipes: (Type<PipeTransform> | PipeTransform)[]): TArgs & {
|
22 | [x: string]: {
|
23 | index: number;
|
24 | data: ParamData;
|
25 | pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[];
|
26 | };
|
27 | };
|
28 | /**
|
29 | * Route handler parameter decorator. Extracts the `Request`
|
30 | * object from the underlying platform and populates the decorated
|
31 | * parameter with the value of `Request`.
|
32 | *
|
33 | * Example: `logout(@Request() req)`
|
34 | *
|
35 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
36 | *
|
37 | * @publicApi
|
38 | */
|
39 | export declare const Request: () => ParameterDecorator;
|
40 | /**
|
41 | * Route handler parameter decorator. Extracts the `Response`
|
42 | * object from the underlying platform and populates the decorated
|
43 | * parameter with the value of `Response`.
|
44 | *
|
45 | * Example: `logout(@Response() res)`
|
46 | *
|
47 | * @publicApi
|
48 | */
|
49 | export declare const Response: (options?: ResponseDecoratorOptions) => ParameterDecorator;
|
50 | /**
|
51 | * Route handler parameter decorator. Extracts reference to the `Next` function
|
52 | * from the underlying platform and populates the decorated
|
53 | * parameter with the value of `Next`.
|
54 | *
|
55 | * @publicApi
|
56 | */
|
57 | export declare const Next: () => ParameterDecorator;
|
58 | /**
|
59 | * Route handler parameter decorator. Extracts the `Ip` property
|
60 | * from the `req` object and populates the decorated
|
61 | * parameter with the value of `ip`.
|
62 | *
|
63 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
64 | *
|
65 | * @publicApi
|
66 | */
|
67 | export declare const Ip: () => ParameterDecorator;
|
68 | /**
|
69 | * Route handler parameter decorator. Extracts the `Session` object
|
70 | * from the underlying platform and populates the decorated
|
71 | * parameter with the value of `Session`.
|
72 | *
|
73 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
74 | *
|
75 | * @publicApi
|
76 | */
|
77 | export declare const Session: () => ParameterDecorator;
|
78 | /**
|
79 | * Route handler parameter decorator. Extracts the `file` object
|
80 | * and populates the decorated parameter with the value of `file`.
|
81 | * Used in conjunction with
|
82 | * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
|
83 | *
|
84 | * For example:
|
85 | * ```typescript
|
86 | * uploadFile(@UploadedFile() file) {
|
87 | * console.log(file);
|
88 | * }
|
89 | * ```
|
90 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
91 | *
|
92 | * @publicApi
|
93 | */
|
94 | export declare function UploadedFile(): ParameterDecorator;
|
95 | /**
|
96 | * Route handler parameter decorator. Extracts the `file` object
|
97 | * and populates the decorated parameter with the value of `file`.
|
98 | * Used in conjunction with
|
99 | * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
|
100 | *
|
101 | * For example:
|
102 | * ```typescript
|
103 | * uploadFile(@UploadedFile() file) {
|
104 | * console.log(file);
|
105 | * }
|
106 | * ```
|
107 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
108 | *
|
109 | * @publicApi
|
110 | */
|
111 | export declare function UploadedFile(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
112 | /**
|
113 | * Route handler parameter decorator. Extracts the `file` object
|
114 | * and populates the decorated parameter with the value of `file`.
|
115 | * Used in conjunction with
|
116 | * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
|
117 | *
|
118 | * For example:
|
119 | * ```typescript
|
120 | * uploadFile(@UploadedFile() file) {
|
121 | * console.log(file);
|
122 | * }
|
123 | * ```
|
124 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
125 | *
|
126 | * @publicApi
|
127 | */
|
128 | export declare function UploadedFile(fileKey?: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
129 | /**
|
130 | * Route handler parameter decorator. Extracts the `files` object
|
131 | * and populates the decorated parameter with the value of `files`.
|
132 | * Used in conjunction with
|
133 | * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
|
134 | *
|
135 | * For example:
|
136 | * ```typescript
|
137 | * uploadFile(@UploadedFiles() files) {
|
138 | * console.log(files);
|
139 | * }
|
140 | * ```
|
141 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
142 | *
|
143 | * @publicApi
|
144 | */
|
145 | export declare function UploadedFiles(): ParameterDecorator;
|
146 | /**
|
147 | * Route handler parameter decorator. Extracts the `files` object
|
148 | * and populates the decorated parameter with the value of `files`.
|
149 | * Used in conjunction with
|
150 | * [multer middleware](https://github.com/expressjs/multer) for Express-based applications.
|
151 | *
|
152 | * For example:
|
153 | * ```typescript
|
154 | * uploadFile(@UploadedFiles() files) {
|
155 | * console.log(files);
|
156 | * }
|
157 | * ```
|
158 | * @see [Request object](https://docs.nestjs.com/techniques/file-upload)
|
159 | *
|
160 | * @publicApi
|
161 | */
|
162 | export declare function UploadedFiles(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
163 | /**
|
164 | * Route handler parameter decorator. Extracts the `headers`
|
165 | * property from the `req` object and populates the decorated
|
166 | * parameter with the value of `headers`.
|
167 | *
|
168 | * For example: `async update(@Headers('Cache-Control') cacheControl: string)`
|
169 | *
|
170 | * @param property name of single header property to extract.
|
171 | *
|
172 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
173 | *
|
174 | * @publicApi
|
175 | */
|
176 | export declare const Headers: (property?: string) => ParameterDecorator;
|
177 | /**
|
178 | * Route handler parameter decorator. Extracts the `query`
|
179 | * property from the `req` object and populates the decorated
|
180 | * parameter with the value of `query`. May also apply pipes to the bound
|
181 | * query parameter.
|
182 | *
|
183 | * For example:
|
184 | * ```typescript
|
185 | * async find(@Query('user') user: string)
|
186 | * ```
|
187 | *
|
188 | * @param property name of single property to extract from the `query` object
|
189 | * @param pipes one or more pipes to apply to the bound query parameter
|
190 | *
|
191 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
192 | *
|
193 | * @publicApi
|
194 | */
|
195 | export declare function Query(): ParameterDecorator;
|
196 | /**
|
197 | * Route handler parameter decorator. Extracts the `query`
|
198 | * property from the `req` object and populates the decorated
|
199 | * parameter with the value of `query`. May also apply pipes to the bound
|
200 | * query parameter.
|
201 | *
|
202 | * For example:
|
203 | * ```typescript
|
204 | * async find(@Query('user') user: string)
|
205 | * ```
|
206 | *
|
207 | * @param property name of single property to extract from the `query` object
|
208 | * @param pipes one or more pipes to apply to the bound query parameter
|
209 | *
|
210 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
211 | *
|
212 | * @publicApi
|
213 | */
|
214 | export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
215 | /**
|
216 | * Route handler parameter decorator. Extracts the `query`
|
217 | * property from the `req` object and populates the decorated
|
218 | * parameter with the value of `query`. May also apply pipes to the bound
|
219 | * query parameter.
|
220 | *
|
221 | * For example:
|
222 | * ```typescript
|
223 | * async find(@Query('user') user: string)
|
224 | * ```
|
225 | *
|
226 | * @param property name of single property to extract from the `query` object
|
227 | * @param pipes one or more pipes to apply to the bound query parameter
|
228 | *
|
229 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
230 | *
|
231 | * @publicApi
|
232 | */
|
233 | export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
234 | /**
|
235 | * Route handler parameter decorator. Extracts the entire `body`
|
236 | * object from the `req` object and populates the decorated
|
237 | * parameter with the value of `body`.
|
238 | *
|
239 | * For example:
|
240 | * ```typescript
|
241 | * async create(@Body() createDto: CreateCatDto)
|
242 | * ```
|
243 | *
|
244 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
245 | *
|
246 | * @publicApi
|
247 | */
|
248 | export declare function Body(): ParameterDecorator;
|
249 | /**
|
250 | * Route handler parameter decorator. Extracts the entire `body`
|
251 | * object from the `req` object and populates the decorated
|
252 | * parameter with the value of `body`. Also applies the specified
|
253 | * pipes to that parameter.
|
254 | *
|
255 | * For example:
|
256 | * ```typescript
|
257 | * async create(@Body(new ValidationPipe()) createDto: CreateCatDto)
|
258 | * ```
|
259 | *
|
260 | * @param pipes one or more pipes - either instances or classes - to apply to
|
261 | * the bound body parameter.
|
262 | *
|
263 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
264 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
265 | *
|
266 | * @publicApi
|
267 | */
|
268 | export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
269 | /**
|
270 | * Route handler parameter decorator. Extracts a single property from
|
271 | * the `body` object property of the `req` object and populates the decorated
|
272 | * parameter with the value of that property. Also applies pipes to the bound
|
273 | * body parameter.
|
274 | *
|
275 | * For example:
|
276 | * ```typescript
|
277 | * async create(@Body('role', new ValidationPipe()) role: string)
|
278 | * ```
|
279 | *
|
280 | * @param property name of single property to extract from the `body` object
|
281 | * @param pipes one or more pipes - either instances or classes - to apply to
|
282 | * the bound body parameter.
|
283 | *
|
284 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
285 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
286 | *
|
287 | * @publicApi
|
288 | */
|
289 | export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
290 | /**
|
291 | * Route handler parameter decorator. Extracts the `rawBody` Buffer
|
292 | * property from the `req` object and populates the decorated parameter with that value.
|
293 | *
|
294 | * For example:
|
295 | * ```typescript
|
296 | * async create(@RawBody() rawBody: Buffer | undefined)
|
297 | * ```
|
298 | *
|
299 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
300 | * @see [Raw body](https://docs.nestjs.com/faq/raw-body)
|
301 | *
|
302 | * @publicApi
|
303 | */
|
304 | export declare function RawBody(): ParameterDecorator;
|
305 | /**
|
306 | * Route handler parameter decorator. Extracts the `params`
|
307 | * property from the `req` object and populates the decorated
|
308 | * parameter with the value of `params`. May also apply pipes to the bound
|
309 | * parameter.
|
310 | *
|
311 | * For example, extracting all params:
|
312 | * ```typescript
|
313 | * findOne(@Param() params: string[])
|
314 | * ```
|
315 | *
|
316 | * For example, extracting a single param:
|
317 | * ```typescript
|
318 | * findOne(@Param('id') id: string)
|
319 | * ```
|
320 | * @param property name of single property to extract from the `req` object
|
321 | * @param pipes one or more pipes - either instances or classes - to apply to
|
322 | * the bound parameter.
|
323 | *
|
324 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
325 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
326 | *
|
327 | * @publicApi
|
328 | */
|
329 | export declare function Param(): ParameterDecorator;
|
330 | /**
|
331 | * Route handler parameter decorator. Extracts the `params`
|
332 | * property from the `req` object and populates the decorated
|
333 | * parameter with the value of `params`. May also apply pipes to the bound
|
334 | * parameter.
|
335 | *
|
336 | * For example, extracting all params:
|
337 | * ```typescript
|
338 | * findOne(@Param() params: string[])
|
339 | * ```
|
340 | *
|
341 | * For example, extracting a single param:
|
342 | * ```typescript
|
343 | * findOne(@Param('id') id: string)
|
344 | * ```
|
345 | * @param property name of single property to extract from the `req` object
|
346 | * @param pipes one or more pipes - either instances or classes - to apply to
|
347 | * the bound parameter.
|
348 | *
|
349 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
350 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
351 | *
|
352 | * @publicApi
|
353 | */
|
354 | export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
355 | /**
|
356 | * Route handler parameter decorator. Extracts the `params`
|
357 | * property from the `req` object and populates the decorated
|
358 | * parameter with the value of `params`. May also apply pipes to the bound
|
359 | * parameter.
|
360 | *
|
361 | * For example, extracting all params:
|
362 | * ```typescript
|
363 | * findOne(@Param() params: string[])
|
364 | * ```
|
365 | *
|
366 | * For example, extracting a single param:
|
367 | * ```typescript
|
368 | * findOne(@Param('id') id: string)
|
369 | * ```
|
370 | * @param property name of single property to extract from the `req` object
|
371 | * @param pipes one or more pipes - either instances or classes - to apply to
|
372 | * the bound parameter.
|
373 | *
|
374 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
375 | * @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
|
376 | *
|
377 | * @publicApi
|
378 | */
|
379 | export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): ParameterDecorator;
|
380 | /**
|
381 | * Route handler parameter decorator. Extracts the `hosts`
|
382 | * property from the `req` object and populates the decorated
|
383 | * parameter with the value of `hosts`. May also apply pipes to the bound
|
384 | * parameter.
|
385 | *
|
386 | * For example, extracting all params:
|
387 | * ```typescript
|
388 | * findOne(@HostParam() params: string[])
|
389 | * ```
|
390 | *
|
391 | * For example, extracting a single param:
|
392 | * ```typescript
|
393 | * findOne(@HostParam('id') id: string)
|
394 | * ```
|
395 | * @param property name of single property to extract from the `req` object
|
396 | *
|
397 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
398 | *
|
399 | * @publicApi
|
400 | */
|
401 | export declare function HostParam(): ParameterDecorator;
|
402 | /**
|
403 | * Route handler parameter decorator. Extracts the `hosts`
|
404 | * property from the `req` object and populates the decorated
|
405 | * parameter with the value of `hosts`. May also apply pipes to the bound
|
406 | * parameter.
|
407 | *
|
408 | * For example, extracting all params:
|
409 | * ```typescript
|
410 | * findOne(@HostParam() params: string[])
|
411 | * ```
|
412 | *
|
413 | * For example, extracting a single param:
|
414 | * ```typescript
|
415 | * findOne(@HostParam('id') id: string)
|
416 | * ```
|
417 | * @param property name of single property to extract from the `req` object
|
418 | *
|
419 | * @see [Request object](https://docs.nestjs.com/controllers#request-object)
|
420 | *
|
421 | * @publicApi
|
422 | */
|
423 | export declare function HostParam(property: string): ParameterDecorator;
|
424 | export declare const Req: () => ParameterDecorator;
|
425 | export declare const Res: (options?: ResponseDecoratorOptions) => ParameterDecorator;
|