@nestjs/core 10.2.0 → 10.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.2",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"fast-safe-stringify": "2.1.1",
|
|
33
33
|
"iterare": "1.2.1",
|
|
34
34
|
"path-to-regexp": "3.2.0",
|
|
35
|
-
"tslib": "2.6.
|
|
35
|
+
"tslib": "2.6.2",
|
|
36
36
|
"uid": "2.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nestjs/common": "10.2.
|
|
39
|
+
"@nestjs/common": "10.2.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@nestjs/common": "^10.0.0",
|
|
@@ -2,7 +2,7 @@ import { CustomDecorator, Type } from '@nestjs/common';
|
|
|
2
2
|
/**
|
|
3
3
|
* @publicApi
|
|
4
4
|
*/
|
|
5
|
-
export interface CreateDecoratorOptions<
|
|
5
|
+
export interface CreateDecoratorOptions<TParam = any, TTransformed = TParam> {
|
|
6
6
|
/**
|
|
7
7
|
* The key for the metadata.
|
|
8
8
|
* @default uid(21)
|
|
@@ -12,12 +12,13 @@ export interface CreateDecoratorOptions<T = any> {
|
|
|
12
12
|
* The transform function to apply to the metadata value.
|
|
13
13
|
* @default value => value
|
|
14
14
|
*/
|
|
15
|
-
transform?: (value:
|
|
15
|
+
transform?: (value: TParam) => TTransformed;
|
|
16
16
|
}
|
|
17
|
+
type CreateDecoratorWithTransformOptions<TParam, TTransformed = TParam> = CreateDecoratorOptions<TParam, TTransformed> & Required<Pick<CreateDecoratorOptions<TParam, TTransformed>, 'transform'>>;
|
|
17
18
|
/**
|
|
18
19
|
* @publicApi
|
|
19
20
|
*/
|
|
20
|
-
export type ReflectableDecorator<
|
|
21
|
+
export type ReflectableDecorator<TParam, TTransformed = TParam> = ((opts?: TParam) => CustomDecorator) & {
|
|
21
22
|
KEY: string;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
@@ -34,7 +35,8 @@ export declare class Reflector {
|
|
|
34
35
|
* @param options Decorator options.
|
|
35
36
|
* @returns A decorator function.
|
|
36
37
|
*/
|
|
37
|
-
static createDecorator<
|
|
38
|
+
static createDecorator<TParam>(options?: CreateDecoratorOptions<TParam>): ReflectableDecorator<TParam>;
|
|
39
|
+
static createDecorator<TParam, TTransformed>(options: CreateDecoratorWithTransformOptions<TParam, TTransformed>): ReflectableDecorator<TParam, TTransformed>;
|
|
38
40
|
/**
|
|
39
41
|
* Retrieve metadata for a reflectable decorator for a specified target.
|
|
40
42
|
*
|
|
@@ -45,7 +47,7 @@ export declare class Reflector {
|
|
|
45
47
|
* @param target context (decorated object) to retrieve metadata from
|
|
46
48
|
*
|
|
47
49
|
*/
|
|
48
|
-
get<T extends ReflectableDecorator<any>>(decorator: T, target: Type<any> | Function): T extends ReflectableDecorator<infer R> ? R : unknown;
|
|
50
|
+
get<T extends ReflectableDecorator<any>>(decorator: T, target: Type<any> | Function): T extends ReflectableDecorator<any, infer R> ? R : unknown;
|
|
49
51
|
/**
|
|
50
52
|
* Retrieve metadata for a specified key for a specified target.
|
|
51
53
|
*
|
|
@@ -64,7 +66,7 @@ export declare class Reflector {
|
|
|
64
66
|
* @param targets context (decorated objects) to retrieve metadata from
|
|
65
67
|
*
|
|
66
68
|
*/
|
|
67
|
-
getAll<T extends ReflectableDecorator<any>>(decorator: T, targets: (Type<any> | Function)[]): T extends ReflectableDecorator<infer R> ? R extends Array<any> ? R
|
|
69
|
+
getAll<T extends ReflectableDecorator<any>>(decorator: T, targets: (Type<any> | Function)[]): T extends ReflectableDecorator<infer R> ? R extends Array<any> ? R : R[] : unknown;
|
|
68
70
|
/**
|
|
69
71
|
* Retrieve metadata for a specified key for a specified set of targets.
|
|
70
72
|
*
|
|
@@ -106,3 +108,4 @@ export declare class Reflector {
|
|
|
106
108
|
*/
|
|
107
109
|
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
|
108
110
|
}
|
|
111
|
+
export {};
|
|
@@ -12,12 +12,6 @@ const uid_1 = require("uid");
|
|
|
12
12
|
* @publicApi
|
|
13
13
|
*/
|
|
14
14
|
class Reflector {
|
|
15
|
-
/**
|
|
16
|
-
* Creates a decorator that can be used to decorate classes and methods with metadata.
|
|
17
|
-
* Can be used as a strongly-typed alternative to `@SetMetadata`.
|
|
18
|
-
* @param options Decorator options.
|
|
19
|
-
* @returns A decorator function.
|
|
20
|
-
*/
|
|
21
15
|
static createDecorator(options = {}) {
|
|
22
16
|
const metadataKey = options.key ?? (0, uid_1.uid)(21);
|
|
23
17
|
const decoratorFn = (metadataValue) => (target, key, descriptor) => {
|