@loopback/metadata 2.2.5 → 3.0.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/CHANGELOG.md +48 -0
- package/dist/decorator-factory.d.ts +21 -17
- package/dist/decorator-factory.js +15 -11
- package/dist/decorator-factory.js.map +1 -1
- package/dist/inspector.d.ts +11 -3
- package/dist/inspector.js +26 -3
- package/dist/inspector.js.map +1 -1
- package/dist/types.d.ts +8 -8
- package/dist/types.js +3 -2
- package/dist/types.js.map +1 -1
- package/package.json +10 -10
- package/src/decorator-factory.ts +40 -36
- package/src/inspector.ts +34 -4
- package/src/types.ts +13 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,54 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.2](https://github.com/strongloop/loopback-next/compare/@loopback/metadata@3.0.1...@loopback/metadata@3.0.2) (2020-10-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/metadata
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.0.1](https://github.com/strongloop/loopback-next/compare/@loopback/metadata@3.0.0...@loopback/metadata@3.0.1) (2020-09-17)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @loopback/metadata
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [3.0.0](https://github.com/strongloop/loopback-next/compare/@loopback/metadata@2.2.6...@loopback/metadata@3.0.0) (2020-09-15)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **metadata:** improve handling of missing design-time type metadata ([4816cae](https://github.com/strongloop/loopback-next/commit/4816caee73fe8f4b99b246bc8544f90037791b6f))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
* **metadata:** If you are consuming `@loopback/metadata` directly,
|
|
33
|
+
then you may need to update your code to handle the case when
|
|
34
|
+
design-time type metadata is not available. (The compiler will tell you
|
|
35
|
+
what places to fix.)
|
|
36
|
+
|
|
37
|
+
Regular LoopBack users should not be affected as long as they update
|
|
38
|
+
all LB packages together.
|
|
39
|
+
|
|
40
|
+
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [2.2.6](https://github.com/strongloop/loopback-next/compare/@loopback/metadata@2.2.5...@loopback/metadata@2.2.6) (2020-08-27)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @loopback/metadata
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
6
54
|
## [2.2.5](https://github.com/strongloop/loopback-next/compare/@loopback/metadata@2.2.4...@loopback/metadata@2.2.5) (2020-08-19)
|
|
7
55
|
|
|
8
56
|
**Note:** Version bump only for package @loopback/metadata
|
|
@@ -73,17 +73,21 @@ D extends DecoratorType> {
|
|
|
73
73
|
*/
|
|
74
74
|
protected inherit(inheritedMetadata: T | undefined | null): T;
|
|
75
75
|
/**
|
|
76
|
-
* Get the qualified name of a decoration target.
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* MyClass.
|
|
84
|
-
* MyClass.
|
|
85
|
-
* MyClass.
|
|
86
|
-
*
|
|
76
|
+
* Get the qualified name of a decoration target.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
*
|
|
80
|
+
* Example of target names:
|
|
81
|
+
*
|
|
82
|
+
* - class MyClass
|
|
83
|
+
* - MyClass.constructor[0] // First parameter of the constructor
|
|
84
|
+
* - MyClass.myStaticProperty
|
|
85
|
+
* - MyClass.myStaticMethod()
|
|
86
|
+
* - MyClass.myStaticMethod[0] // First parameter of the myStaticMethod
|
|
87
|
+
* - MyClass.prototype.myProperty
|
|
88
|
+
* - MyClass.prototype.myMethod()
|
|
89
|
+
* - MyClass.prototype.myMethod[1] // Second parameter of myMethod
|
|
90
|
+
*
|
|
87
91
|
* @param target - Class or prototype of a class
|
|
88
92
|
* @param member - Optional property/method name
|
|
89
93
|
* @param descriptorOrIndex - Optional method descriptor or parameter index
|
|
@@ -162,7 +166,7 @@ D extends DecoratorType> {
|
|
|
162
166
|
* @param spec - Metadata object from the decorator function
|
|
163
167
|
* @param options - Options for the decorator
|
|
164
168
|
*/
|
|
165
|
-
protected static _createDecorator<
|
|
169
|
+
protected static _createDecorator<S, MT extends S | MetadataMap<S> | MetadataMap<S[]>, DT extends DecoratorType>(key: MetadataKey<S, DT>, spec: S, options?: DecoratorOptions): DT;
|
|
166
170
|
private static _cloneableTypes;
|
|
167
171
|
static cloneDeep<V>(val: Readonly<V>): V;
|
|
168
172
|
}
|
|
@@ -179,7 +183,7 @@ export declare class ClassDecoratorFactory<T> extends DecoratorFactory<T, T, Cla
|
|
|
179
183
|
* @param spec - Metadata object from the decorator function
|
|
180
184
|
* @param options - Options for the decorator
|
|
181
185
|
*/
|
|
182
|
-
static createDecorator<
|
|
186
|
+
static createDecorator<S>(key: MetadataKey<S, ClassDecorator>, spec: S, options?: DecoratorOptions): ClassDecorator;
|
|
183
187
|
}
|
|
184
188
|
/**
|
|
185
189
|
* Factory for property decorators
|
|
@@ -194,7 +198,7 @@ export declare class PropertyDecoratorFactory<T> extends DecoratorFactory<T, Met
|
|
|
194
198
|
* @param spec - Metadata object from the decorator function
|
|
195
199
|
* @param options - Options for the decorator
|
|
196
200
|
*/
|
|
197
|
-
static createDecorator<
|
|
201
|
+
static createDecorator<S>(key: MetadataKey<S, PropertyDecorator>, spec: S, options?: DecoratorOptions): PropertyDecorator;
|
|
198
202
|
}
|
|
199
203
|
/**
|
|
200
204
|
* Factory for method decorators
|
|
@@ -209,7 +213,7 @@ export declare class MethodDecoratorFactory<T> extends DecoratorFactory<T, Metad
|
|
|
209
213
|
* @param spec - Metadata object from the decorator function
|
|
210
214
|
* @param options - Options for the decorator
|
|
211
215
|
*/
|
|
212
|
-
static createDecorator<
|
|
216
|
+
static createDecorator<S>(key: MetadataKey<S, MethodDecorator>, spec: S, options?: DecoratorOptions): MethodDecorator;
|
|
213
217
|
}
|
|
214
218
|
/**
|
|
215
219
|
* Factory for parameter decorators
|
|
@@ -225,7 +229,7 @@ export declare class ParameterDecoratorFactory<T> extends DecoratorFactory<T, Me
|
|
|
225
229
|
* @param spec - Metadata object from the decorator function
|
|
226
230
|
* @param options - Options for the decorator
|
|
227
231
|
*/
|
|
228
|
-
static createDecorator<
|
|
232
|
+
static createDecorator<S>(key: MetadataKey<S, ParameterDecorator>, spec: S, options?: DecoratorOptions): ParameterDecorator;
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
235
|
* Factory for method level parameter decorator.
|
|
@@ -258,7 +262,7 @@ export declare class MethodParameterDecoratorFactory<T> extends DecoratorFactory
|
|
|
258
262
|
* @param spec - Metadata object from the decorator function
|
|
259
263
|
* @param options - Options for the decorator
|
|
260
264
|
*/
|
|
261
|
-
static createDecorator<
|
|
265
|
+
static createDecorator<S>(key: MetadataKey<S, MethodDecorator>, spec: S, options?: DecoratorOptions): MethodDecorator;
|
|
262
266
|
}
|
|
263
267
|
/**
|
|
264
268
|
* Factory for an append-array of method-level decorators
|
|
@@ -82,17 +82,21 @@ class DecoratorFactory {
|
|
|
82
82
|
return Object.assign(inheritedMetadata, this.spec);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* Get the qualified name of a decoration target.
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* MyClass.
|
|
93
|
-
* MyClass.
|
|
94
|
-
* MyClass.
|
|
95
|
-
*
|
|
85
|
+
* Get the qualified name of a decoration target.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
*
|
|
89
|
+
* Example of target names:
|
|
90
|
+
*
|
|
91
|
+
* - class MyClass
|
|
92
|
+
* - MyClass.constructor[0] // First parameter of the constructor
|
|
93
|
+
* - MyClass.myStaticProperty
|
|
94
|
+
* - MyClass.myStaticMethod()
|
|
95
|
+
* - MyClass.myStaticMethod[0] // First parameter of the myStaticMethod
|
|
96
|
+
* - MyClass.prototype.myProperty
|
|
97
|
+
* - MyClass.prototype.myMethod()
|
|
98
|
+
* - MyClass.prototype.myMethod[1] // Second parameter of myMethod
|
|
99
|
+
*
|
|
96
100
|
* @param target - Class or prototype of a class
|
|
97
101
|
* @param member - Optional property/method name
|
|
98
102
|
* @param descriptorOrIndex - Optional method descriptor or parameter index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator-factory.js","sourceRoot":"","sources":["../src/decorator-factory.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,kCAAkC;AAClC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,0DAAgC;AAChC,4DAAuB;AACvB,uCAAoC;AAEpC,MAAM,KAAK,GAAG,eAAW,CAAC,6BAA6B,CAAC,CAAC;AA8BzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,gBAAgB;IAY3B;;;;;;OAMG;IACH,YACY,GAAW,EACX,IAAO,EACP,UAA4B,EAAE;;QAF9B,QAAG,GAAH,GAAG,CAAQ;QACX,SAAI,GAAJ,IAAI,CAAG;QACP,YAAO,GAAP,OAAO,CAAuB;QAExC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAC1B;YACE,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,IAAI;SACrB,EACD,OAAO,CACR,CAAC;QACF,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,E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,CAC/C,iBAAiB,CAAC,UAAW,CAAC,EAC9B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CACnC,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAES,YAAY,CACpB,WAA6B,EAC7B,MAAc,EACd,UAAmB,EACnB,gBAAwD;QAExD,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;QAChC,WAAW,CAAC,UAAW,CAAC,GAAG,IAAI,CAAC,WAAW,CACzC,WAAW,CAAC,UAAW,CAAC,EACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CACnC,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,WAAW,CAAC,MAAW,EAAE,UAAmB;QAClD,IAAI,CAAC,MAAM,EAAE;YACX,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBAC7B,MAAM,GAAG,UAAU,CAAC;aACrB;iBAAM;gBACL,MAAM,GAAG,CAAC,UAAU,CAAC,CAAC;aACvB;SACF;aAAM;YACL,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBAC7B,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC;aAC5B;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACzB;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAjDD,kEAiDC"}
|
package/dist/inspector.d.ts
CHANGED
|
@@ -102,12 +102,20 @@ export declare class MetadataInspector {
|
|
|
102
102
|
* Get TypeScript design time type for a property
|
|
103
103
|
* @param target - Class or prototype
|
|
104
104
|
* @param propertyName - Property name
|
|
105
|
+
* @returns Design time metadata. The return value is `undefined` when:
|
|
106
|
+
* - The property has type `undefined`, `null` or a complex type like
|
|
107
|
+
* `Partial<MyModel>`, `string | number`, `string[]`.
|
|
108
|
+
* - The TypeScript project has not enabled the compiler option `emitDecoratorMetadata`.
|
|
109
|
+
* - The code is written in vanilla JavaScript.
|
|
105
110
|
*/
|
|
106
|
-
static getDesignTypeForProperty(target: Object, propertyName: string): Function;
|
|
111
|
+
static getDesignTypeForProperty(target: Object, propertyName: string): Function | undefined;
|
|
107
112
|
/**
|
|
108
|
-
* Get TypeScript design time type for a method
|
|
113
|
+
* Get TypeScript design time type for a method.
|
|
109
114
|
* @param target - Class or prototype
|
|
110
115
|
* @param methodName - Method name
|
|
116
|
+
* @returns Design time metadata. The return value is `undefined`
|
|
117
|
+
* in projects that do not enable `emitDecoratorMetadata`
|
|
118
|
+
* in TypeScript compiler options or are written in vanilla JavaScript.
|
|
111
119
|
*/
|
|
112
|
-
static getDesignTypeForMethod(target: Object, methodName: string): DesignTimeMethodMetadata;
|
|
120
|
+
static getDesignTypeForMethod(target: Object, methodName: string): DesignTimeMethodMetadata | undefined;
|
|
113
121
|
}
|
package/dist/inspector.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetadataInspector = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
2
5
|
// Copyright IBM Corp. 2017,2019. All Rights Reserved.
|
|
3
6
|
// Node module: @loopback/metadata
|
|
4
7
|
// This file is licensed under the MIT License.
|
|
5
8
|
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
10
|
+
const decorator_factory_1 = require("./decorator-factory");
|
|
8
11
|
const reflect_1 = require("./reflect");
|
|
12
|
+
const debug = debug_1.default('loopback:metadata:inspector');
|
|
9
13
|
/**
|
|
10
14
|
* TypeScript reflector without a namespace. The TypeScript compiler can be
|
|
11
15
|
* configured to add design time metadata.
|
|
@@ -124,19 +128,38 @@ class MetadataInspector {
|
|
|
124
128
|
* Get TypeScript design time type for a property
|
|
125
129
|
* @param target - Class or prototype
|
|
126
130
|
* @param propertyName - Property name
|
|
131
|
+
* @returns Design time metadata. The return value is `undefined` when:
|
|
132
|
+
* - The property has type `undefined`, `null` or a complex type like
|
|
133
|
+
* `Partial<MyModel>`, `string | number`, `string[]`.
|
|
134
|
+
* - The TypeScript project has not enabled the compiler option `emitDecoratorMetadata`.
|
|
135
|
+
* - The code is written in vanilla JavaScript.
|
|
127
136
|
*/
|
|
128
137
|
static getDesignTypeForProperty(target, propertyName) {
|
|
129
138
|
return TSReflector.getMetadata('design:type', target, propertyName);
|
|
130
139
|
}
|
|
131
140
|
/**
|
|
132
|
-
* Get TypeScript design time type for a method
|
|
141
|
+
* Get TypeScript design time type for a method.
|
|
133
142
|
* @param target - Class or prototype
|
|
134
143
|
* @param methodName - Method name
|
|
144
|
+
* @returns Design time metadata. The return value is `undefined`
|
|
145
|
+
* in projects that do not enable `emitDecoratorMetadata`
|
|
146
|
+
* in TypeScript compiler options or are written in vanilla JavaScript.
|
|
135
147
|
*/
|
|
136
148
|
static getDesignTypeForMethod(target, methodName) {
|
|
137
149
|
const type = TSReflector.getMetadata('design:type', target, methodName);
|
|
138
150
|
const parameterTypes = TSReflector.getMetadata('design:paramtypes', target, methodName);
|
|
139
151
|
const returnType = TSReflector.getMetadata('design:returntype', target, methodName);
|
|
152
|
+
if (type === undefined &&
|
|
153
|
+
parameterTypes === undefined &&
|
|
154
|
+
returnType === undefined) {
|
|
155
|
+
/* istanbul ignore next */
|
|
156
|
+
if (debug.enabled) {
|
|
157
|
+
const targetName = decorator_factory_1.DecoratorFactory.getTargetName(target, methodName);
|
|
158
|
+
debug('No design-time type metadata found while inspecting %s. ' +
|
|
159
|
+
'Did you forget to enable TypeScript compiler option `emitDecoratorMetadata`?', targetName);
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
162
|
+
}
|
|
140
163
|
return {
|
|
141
164
|
type,
|
|
142
165
|
parameterTypes,
|
package/dist/inspector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspector.js","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inspector.js","sourceRoot":"","sources":["../src/inspector.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,kCAAkC;AAClC,+CAA+C;AAC/C,gEAAgE;AAChE,0DAAgC;AAChC,2DAAqD;AACrD,uCAAuD;AAQvD,MAAM,KAAK,GAAG,eAAW,CAAC,6BAA6B,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,GAAG,IAAI,2BAAiB,EAAE,CAAC;AAgB5C;;GAEG;AACH,MAAa,iBAAiB;IAW5B;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CACrB,GAAmC,EACnC,MAAgB,EAChB,OAA2B;QAE3B,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,EAC7B,CAAC,CAAC,mBAAS,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC;YAClD,CAAC,CAAC,mBAAS,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CACnB,GAAkC,EAClC,KAAQ,EACR,MAAc,EACd,MAAe;QAEf,mBAAS,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,GAAoC,EACpC,MAAc,EACd,OAA2B;QAE3B,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,EAC7B,CAAC,CAAC,mBAAS,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC;YAClD,CAAC,CAAC,mBAAS,CAAC,WAAW,CAAC,GAAG,CAAC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CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAC3B,MAAc,EACd,UAAkB;QAElB,MAAM,IAAI,GAAG,WAAW,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACxE,MAAM,cAAc,GAAG,WAAW,CAAC,WAAW,CAC5C,mBAAmB,EACnB,MAAM,EACN,UAAU,CACX,CAAC;QACF,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CACxC,mBAAmB,EACnB,MAAM,EACN,UAAU,CACX,CAAC;QAEF,IACE,IAAI,KAAK,SAAS;YAClB,cAAc,KAAK,SAAS;YAC5B,UAAU,KAAK,SAAS,EACxB;YACA,0BAA0B;YAC1B,IAAI,KAAK,CAAC,OAAO,EAAE;gBACjB,MAAM,UAAU,GAAG,oCAAgB,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;gBACtE,KAAK,CACH,0DAA0D;oBACxD,8EAA8E,EAChF,UAAU,CACX,CAAC;aACH;YAED,OAAO,SAAS,CAAC;SAClB;QAED,OAAO;YACL,IAAI;YACJ,cAAc;YACd,UAAU;SACX,CAAC;IACJ,CAAC;;AAvOH,8CAwOC;AAvOC;;;GAGG;AACa,2BAAS,GAAG,mBAAS,CAAC;AACtC;;GAEG;AACa,qCAAmB,GAAG,WAAW,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -14,10 +14,10 @@ export declare class MetadataAccessor<T, D extends DecoratorType = DecoratorType
|
|
|
14
14
|
/**
|
|
15
15
|
* Create a strongly-typed metadata accessor
|
|
16
16
|
* @param key - The metadata key
|
|
17
|
-
* @typeParam
|
|
18
|
-
* @typeParam
|
|
17
|
+
* @typeParam V - Type of the metadata value
|
|
18
|
+
* @typeParam DT - Type of the decorator
|
|
19
19
|
*/
|
|
20
|
-
static create<
|
|
20
|
+
static create<V, DT extends DecoratorType>(key: string): MetadataAccessor<V, DT>;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Key for metadata access via reflection
|
|
@@ -56,15 +56,15 @@ export interface MetadataMap<T> {
|
|
|
56
56
|
*/
|
|
57
57
|
export interface DesignTimeMethodMetadata {
|
|
58
58
|
/**
|
|
59
|
-
* Type of the method itself. It is `Function`
|
|
59
|
+
* Type of the method itself. It is `Function` for methods, `undefined` for the constructor.
|
|
60
60
|
*/
|
|
61
|
-
type: Function;
|
|
61
|
+
type: Function | undefined;
|
|
62
62
|
/**
|
|
63
|
-
* An array of parameter types
|
|
63
|
+
* An array of parameter types.
|
|
64
64
|
*/
|
|
65
65
|
parameterTypes: Function[];
|
|
66
66
|
/**
|
|
67
|
-
* Return type
|
|
67
|
+
* Return type, may be `undefined` (e.g. for constructors).
|
|
68
68
|
*/
|
|
69
|
-
returnType: Function;
|
|
69
|
+
returnType: Function | undefined;
|
|
70
70
|
}
|
package/dist/types.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.MetadataAccessor = void 0;
|
|
|
10
10
|
* @typeParam T - Type of the metadata value
|
|
11
11
|
* @typeParam D - Type of the decorator
|
|
12
12
|
*/
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
14
|
class MetadataAccessor {
|
|
14
15
|
constructor(key) {
|
|
15
16
|
this.key = key;
|
|
@@ -20,8 +21,8 @@ class MetadataAccessor {
|
|
|
20
21
|
/**
|
|
21
22
|
* Create a strongly-typed metadata accessor
|
|
22
23
|
* @param key - The metadata key
|
|
23
|
-
* @typeParam
|
|
24
|
-
* @typeParam
|
|
24
|
+
* @typeParam V - Type of the metadata value
|
|
25
|
+
* @typeParam DT - Type of the decorator
|
|
25
26
|
*/
|
|
26
27
|
static create(key) {
|
|
27
28
|
return new MetadataAccessor(key);
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,kCAAkC;AAClC,+CAA+C;AAC/C,gEAAgE;;;AAWhE;;;;GAIG;AACH,MAAa,gBAAgB;IAC3B,YAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAEnD,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,kCAAkC;AAClC,+CAA+C;AAC/C,gEAAgE;;;AAWhE;;;;GAIG;AACH,6DAA6D;AAC7D,MAAa,gBAAgB;IAC3B,YAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAEnD,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAA8B,GAAW;QACpD,OAAO,IAAI,gBAAgB,CAAQ,GAAG,CAAC,CAAC;IAC1C,CAAC;CACF;AAhBD,4CAgBC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loopback/metadata",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Utilities to help developers implement TypeScript decorators, define/merge metadata, and inspect metadata",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "
|
|
8
|
+
"node": "^10.16 || 12 || 14"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"acceptance": "lb-mocha \"dist/__tests__/acceptance/**/*.js\"",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"debug": "^4.
|
|
26
|
+
"debug": "^4.2.0",
|
|
27
27
|
"lodash": "^4.17.20",
|
|
28
28
|
"reflect-metadata": "^0.1.13",
|
|
29
|
-
"tslib": "^2.0.
|
|
29
|
+
"tslib": "^2.0.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@loopback/build": "^6.2.
|
|
33
|
-
"@loopback/eslint-config": "^
|
|
34
|
-
"@loopback/testlab": "^3.2.
|
|
32
|
+
"@loopback/build": "^6.2.5",
|
|
33
|
+
"@loopback/eslint-config": "^10.0.1",
|
|
34
|
+
"@loopback/testlab": "^3.2.7",
|
|
35
35
|
"@types/debug": "^4.1.5",
|
|
36
|
-
"@types/lodash": "^4.14.
|
|
37
|
-
"@types/node": "^10.17.
|
|
36
|
+
"@types/lodash": "^4.14.161",
|
|
37
|
+
"@types/node": "^10.17.35"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"LoopBack",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"url": "https://github.com/strongloop/loopback-next.git",
|
|
53
53
|
"directory": "packages/metadata"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "390f2794d10eea3d969ae417963af815ce1bc417"
|
|
56
56
|
}
|
package/src/decorator-factory.ts
CHANGED
|
@@ -121,17 +121,21 @@ export class DecoratorFactory<
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* Get the qualified name of a decoration target.
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* MyClass.
|
|
132
|
-
* MyClass.
|
|
133
|
-
* MyClass.
|
|
134
|
-
*
|
|
124
|
+
* Get the qualified name of a decoration target.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
*
|
|
128
|
+
* Example of target names:
|
|
129
|
+
*
|
|
130
|
+
* - class MyClass
|
|
131
|
+
* - MyClass.constructor[0] // First parameter of the constructor
|
|
132
|
+
* - MyClass.myStaticProperty
|
|
133
|
+
* - MyClass.myStaticMethod()
|
|
134
|
+
* - MyClass.myStaticMethod[0] // First parameter of the myStaticMethod
|
|
135
|
+
* - MyClass.prototype.myProperty
|
|
136
|
+
* - MyClass.prototype.myMethod()
|
|
137
|
+
* - MyClass.prototype.myMethod[1] // Second parameter of myMethod
|
|
138
|
+
*
|
|
135
139
|
* @param target - Class or prototype of a class
|
|
136
140
|
* @param member - Optional property/method name
|
|
137
141
|
* @param descriptorOrIndex - Optional method descriptor or parameter index
|
|
@@ -337,11 +341,11 @@ export class DecoratorFactory<
|
|
|
337
341
|
* @param options - Options for the decorator
|
|
338
342
|
*/
|
|
339
343
|
protected static _createDecorator<
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
>(key: MetadataKey<
|
|
344
|
-
const inst = new this<
|
|
344
|
+
S,
|
|
345
|
+
MT extends S | MetadataMap<S> | MetadataMap<S[]>,
|
|
346
|
+
DT extends DecoratorType
|
|
347
|
+
>(key: MetadataKey<S, DT>, spec: S, options?: DecoratorOptions): DT {
|
|
348
|
+
const inst = new this<S, MT, DT>(key.toString(), spec, options);
|
|
345
349
|
return inst.create();
|
|
346
350
|
}
|
|
347
351
|
|
|
@@ -422,12 +426,12 @@ export class ClassDecoratorFactory<T> extends DecoratorFactory<
|
|
|
422
426
|
* @param spec - Metadata object from the decorator function
|
|
423
427
|
* @param options - Options for the decorator
|
|
424
428
|
*/
|
|
425
|
-
static createDecorator<
|
|
426
|
-
key: MetadataKey<
|
|
427
|
-
spec:
|
|
429
|
+
static createDecorator<S>(
|
|
430
|
+
key: MetadataKey<S, ClassDecorator>,
|
|
431
|
+
spec: S,
|
|
428
432
|
options?: DecoratorOptions,
|
|
429
433
|
) {
|
|
430
|
-
return super._createDecorator<
|
|
434
|
+
return super._createDecorator<S, S, ClassDecorator>(key, spec, options);
|
|
431
435
|
}
|
|
432
436
|
}
|
|
433
437
|
|
|
@@ -483,12 +487,12 @@ export class PropertyDecoratorFactory<T> extends DecoratorFactory<
|
|
|
483
487
|
* @param spec - Metadata object from the decorator function
|
|
484
488
|
* @param options - Options for the decorator
|
|
485
489
|
*/
|
|
486
|
-
static createDecorator<
|
|
487
|
-
key: MetadataKey<
|
|
488
|
-
spec:
|
|
490
|
+
static createDecorator<S>(
|
|
491
|
+
key: MetadataKey<S, PropertyDecorator>,
|
|
492
|
+
spec: S,
|
|
489
493
|
options?: DecoratorOptions,
|
|
490
494
|
) {
|
|
491
|
-
return super._createDecorator<
|
|
495
|
+
return super._createDecorator<S, MetadataMap<S>, PropertyDecorator>(
|
|
492
496
|
key,
|
|
493
497
|
spec,
|
|
494
498
|
options,
|
|
@@ -549,12 +553,12 @@ export class MethodDecoratorFactory<T> extends DecoratorFactory<
|
|
|
549
553
|
* @param spec - Metadata object from the decorator function
|
|
550
554
|
* @param options - Options for the decorator
|
|
551
555
|
*/
|
|
552
|
-
static createDecorator<
|
|
553
|
-
key: MetadataKey<
|
|
554
|
-
spec:
|
|
556
|
+
static createDecorator<S>(
|
|
557
|
+
key: MetadataKey<S, MethodDecorator>,
|
|
558
|
+
spec: S,
|
|
555
559
|
options?: DecoratorOptions,
|
|
556
560
|
) {
|
|
557
|
-
return super._createDecorator<
|
|
561
|
+
return super._createDecorator<S, MetadataMap<S>, MethodDecorator>(
|
|
558
562
|
key,
|
|
559
563
|
spec,
|
|
560
564
|
options,
|
|
@@ -642,12 +646,12 @@ export class ParameterDecoratorFactory<T> extends DecoratorFactory<
|
|
|
642
646
|
* @param spec - Metadata object from the decorator function
|
|
643
647
|
* @param options - Options for the decorator
|
|
644
648
|
*/
|
|
645
|
-
static createDecorator<
|
|
646
|
-
key: MetadataKey<
|
|
647
|
-
spec:
|
|
649
|
+
static createDecorator<S>(
|
|
650
|
+
key: MetadataKey<S, ParameterDecorator>,
|
|
651
|
+
spec: S,
|
|
648
652
|
options?: DecoratorOptions,
|
|
649
653
|
) {
|
|
650
|
-
return super._createDecorator<
|
|
654
|
+
return super._createDecorator<S, MetadataMap<S[]>, ParameterDecorator>(
|
|
651
655
|
key,
|
|
652
656
|
spec,
|
|
653
657
|
options,
|
|
@@ -777,12 +781,12 @@ export class MethodParameterDecoratorFactory<T> extends DecoratorFactory<
|
|
|
777
781
|
* @param spec - Metadata object from the decorator function
|
|
778
782
|
* @param options - Options for the decorator
|
|
779
783
|
*/
|
|
780
|
-
static createDecorator<
|
|
781
|
-
key: MetadataKey<
|
|
782
|
-
spec:
|
|
784
|
+
static createDecorator<S>(
|
|
785
|
+
key: MetadataKey<S, MethodDecorator>,
|
|
786
|
+
spec: S,
|
|
783
787
|
options?: DecoratorOptions,
|
|
784
788
|
) {
|
|
785
|
-
return super._createDecorator<
|
|
789
|
+
return super._createDecorator<S, MetadataMap<S[]>, MethodDecorator>(
|
|
786
790
|
key,
|
|
787
791
|
spec,
|
|
788
792
|
options,
|
package/src/inspector.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Node module: @loopback/metadata
|
|
3
3
|
// This file is licensed under the MIT License.
|
|
4
4
|
// License text available at https://opensource.org/licenses/MIT
|
|
5
|
-
|
|
5
|
+
import debugModule from 'debug';
|
|
6
|
+
import {DecoratorFactory} from './decorator-factory';
|
|
6
7
|
import {NamespacedReflect, Reflector} from './reflect';
|
|
7
8
|
import {
|
|
8
9
|
DecoratorType,
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
MetadataMap,
|
|
12
13
|
} from './types';
|
|
13
14
|
|
|
15
|
+
const debug = debugModule('loopback:metadata:inspector');
|
|
16
|
+
|
|
14
17
|
/**
|
|
15
18
|
* TypeScript reflector without a namespace. The TypeScript compiler can be
|
|
16
19
|
* configured to add design time metadata.
|
|
@@ -207,23 +210,31 @@ export class MetadataInspector {
|
|
|
207
210
|
* Get TypeScript design time type for a property
|
|
208
211
|
* @param target - Class or prototype
|
|
209
212
|
* @param propertyName - Property name
|
|
213
|
+
* @returns Design time metadata. The return value is `undefined` when:
|
|
214
|
+
* - The property has type `undefined`, `null` or a complex type like
|
|
215
|
+
* `Partial<MyModel>`, `string | number`, `string[]`.
|
|
216
|
+
* - The TypeScript project has not enabled the compiler option `emitDecoratorMetadata`.
|
|
217
|
+
* - The code is written in vanilla JavaScript.
|
|
210
218
|
*/
|
|
211
219
|
static getDesignTypeForProperty(
|
|
212
220
|
target: Object,
|
|
213
221
|
propertyName: string,
|
|
214
|
-
): Function {
|
|
222
|
+
): Function | undefined {
|
|
215
223
|
return TSReflector.getMetadata('design:type', target, propertyName);
|
|
216
224
|
}
|
|
217
225
|
|
|
218
226
|
/**
|
|
219
|
-
* Get TypeScript design time type for a method
|
|
227
|
+
* Get TypeScript design time type for a method.
|
|
220
228
|
* @param target - Class or prototype
|
|
221
229
|
* @param methodName - Method name
|
|
230
|
+
* @returns Design time metadata. The return value is `undefined`
|
|
231
|
+
* in projects that do not enable `emitDecoratorMetadata`
|
|
232
|
+
* in TypeScript compiler options or are written in vanilla JavaScript.
|
|
222
233
|
*/
|
|
223
234
|
static getDesignTypeForMethod(
|
|
224
235
|
target: Object,
|
|
225
236
|
methodName: string,
|
|
226
|
-
): DesignTimeMethodMetadata {
|
|
237
|
+
): DesignTimeMethodMetadata | undefined {
|
|
227
238
|
const type = TSReflector.getMetadata('design:type', target, methodName);
|
|
228
239
|
const parameterTypes = TSReflector.getMetadata(
|
|
229
240
|
'design:paramtypes',
|
|
@@ -235,6 +246,25 @@ export class MetadataInspector {
|
|
|
235
246
|
target,
|
|
236
247
|
methodName,
|
|
237
248
|
);
|
|
249
|
+
|
|
250
|
+
if (
|
|
251
|
+
type === undefined &&
|
|
252
|
+
parameterTypes === undefined &&
|
|
253
|
+
returnType === undefined
|
|
254
|
+
) {
|
|
255
|
+
/* istanbul ignore next */
|
|
256
|
+
if (debug.enabled) {
|
|
257
|
+
const targetName = DecoratorFactory.getTargetName(target, methodName);
|
|
258
|
+
debug(
|
|
259
|
+
'No design-time type metadata found while inspecting %s. ' +
|
|
260
|
+
'Did you forget to enable TypeScript compiler option `emitDecoratorMetadata`?',
|
|
261
|
+
targetName,
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
|
|
238
268
|
return {
|
|
239
269
|
type,
|
|
240
270
|
parameterTypes,
|
package/src/types.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type DecoratorType =
|
|
|
17
17
|
* @typeParam T - Type of the metadata value
|
|
18
18
|
* @typeParam D - Type of the decorator
|
|
19
19
|
*/
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
21
|
export class MetadataAccessor<T, D extends DecoratorType = DecoratorType> {
|
|
21
22
|
private constructor(public readonly key: string) {}
|
|
22
23
|
|
|
@@ -27,11 +28,11 @@ export class MetadataAccessor<T, D extends DecoratorType = DecoratorType> {
|
|
|
27
28
|
/**
|
|
28
29
|
* Create a strongly-typed metadata accessor
|
|
29
30
|
* @param key - The metadata key
|
|
30
|
-
* @typeParam
|
|
31
|
-
* @typeParam
|
|
31
|
+
* @typeParam V - Type of the metadata value
|
|
32
|
+
* @typeParam DT - Type of the decorator
|
|
32
33
|
*/
|
|
33
|
-
static create<
|
|
34
|
-
return new MetadataAccessor<
|
|
34
|
+
static create<V, DT extends DecoratorType>(key: string) {
|
|
35
|
+
return new MetadataAccessor<V, DT>(key);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -76,15 +77,18 @@ export interface MetadataMap<T> {
|
|
|
76
77
|
*/
|
|
77
78
|
export interface DesignTimeMethodMetadata {
|
|
78
79
|
/**
|
|
79
|
-
* Type of the method itself. It is `Function`
|
|
80
|
+
* Type of the method itself. It is `Function` for methods, `undefined` for the constructor.
|
|
80
81
|
*/
|
|
81
|
-
type: Function;
|
|
82
|
+
type: Function | undefined;
|
|
83
|
+
|
|
82
84
|
/**
|
|
83
|
-
* An array of parameter types
|
|
85
|
+
* An array of parameter types.
|
|
84
86
|
*/
|
|
87
|
+
|
|
85
88
|
parameterTypes: Function[];
|
|
89
|
+
|
|
86
90
|
/**
|
|
87
|
-
* Return type
|
|
91
|
+
* Return type, may be `undefined` (e.g. for constructors).
|
|
88
92
|
*/
|
|
89
|
-
returnType: Function;
|
|
93
|
+
returnType: Function | undefined;
|
|
90
94
|
}
|