@carno.js/core 0.2.3
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/LICENSE +674 -0
- package/dist/Carno.d.ts +65 -0
- package/dist/Carno.js +307 -0
- package/dist/Cheetah.d.ts +65 -0
- package/dist/Cheetah.js +307 -0
- package/dist/cache/bento-cache.driver.d.ts +13 -0
- package/dist/cache/bento-cache.driver.js +55 -0
- package/dist/cache/cache.service.d.ts +8 -0
- package/dist/cache/cache.service.js +6 -0
- package/dist/commons/decorators/Injectable.decorator.d.ts +20 -0
- package/dist/commons/decorators/Injectable.decorator.js +33 -0
- package/dist/commons/decorators/controller.decorator.d.ts +8 -0
- package/dist/commons/decorators/controller.decorator.js +22 -0
- package/dist/commons/decorators/http.decorators.d.ts +13 -0
- package/dist/commons/decorators/http.decorators.js +44 -0
- package/dist/commons/decorators/index.d.ts +5 -0
- package/dist/commons/decorators/index.js +21 -0
- package/dist/commons/decorators/inject.decorator.d.ts +1 -0
- package/dist/commons/decorators/inject.decorator.js +5 -0
- package/dist/commons/decorators/middleware.decorator.d.ts +2 -0
- package/dist/commons/decorators/middleware.decorator.js +30 -0
- package/dist/commons/decorators/service.decorator.d.ts +2 -0
- package/dist/commons/decorators/service.decorator.js +7 -0
- package/dist/commons/http-code.enum.d.ts +50 -0
- package/dist/commons/http-code.enum.js +54 -0
- package/dist/commons/index.d.ts +3 -0
- package/dist/commons/index.js +19 -0
- package/dist/commons/registries/ProviderControl.d.ts +77 -0
- package/dist/commons/registries/ProviderControl.js +112 -0
- package/dist/commons/registries/ProviderRegistry.d.ts +7 -0
- package/dist/commons/registries/ProviderRegistry.js +20 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +10 -0
- package/dist/container/ContainerConfiguration.d.ts +45 -0
- package/dist/container/ContainerConfiguration.js +121 -0
- package/dist/container/DependencyResolver.d.ts +18 -0
- package/dist/container/DependencyResolver.js +81 -0
- package/dist/container/InjectorService.d.ts +34 -0
- package/dist/container/InjectorService.js +157 -0
- package/dist/container/MethodInvoker.d.ts +17 -0
- package/dist/container/MethodInvoker.js +69 -0
- package/dist/container/RouteResolver.d.ts +27 -0
- package/dist/container/RouteResolver.js +173 -0
- package/dist/container/container.d.ts +41 -0
- package/dist/container/container.js +71 -0
- package/dist/container/createContainer.d.ts +3 -0
- package/dist/container/createContainer.js +12 -0
- package/dist/container/createInjector.d.ts +2 -0
- package/dist/container/createInjector.js +7 -0
- package/dist/container/index.d.ts +6 -0
- package/dist/container/index.js +22 -0
- package/dist/container/middleware.resolver.d.ts +9 -0
- package/dist/container/middleware.resolver.js +35 -0
- package/dist/default-routes-carno.d.ts +3 -0
- package/dist/default-routes-carno.js +29 -0
- package/dist/default-routes-cheetah.d.ts +3 -0
- package/dist/default-routes-cheetah.js +29 -0
- package/dist/domain/CarnoClosure.d.ts +1 -0
- package/dist/domain/CarnoClosure.js +2 -0
- package/dist/domain/CarnoMiddleware.d.ts +5 -0
- package/dist/domain/CarnoMiddleware.js +2 -0
- package/dist/domain/CheetahClosure.d.ts +1 -0
- package/dist/domain/CheetahClosure.js +2 -0
- package/dist/domain/CheetahMiddleware.d.ts +5 -0
- package/dist/domain/CheetahMiddleware.js +2 -0
- package/dist/domain/Context.d.ts +26 -0
- package/dist/domain/Context.js +107 -0
- package/dist/domain/LocalsContainer.d.ts +4 -0
- package/dist/domain/LocalsContainer.js +10 -0
- package/dist/domain/Metadata.d.ts +449 -0
- package/dist/domain/Metadata.js +511 -0
- package/dist/domain/cors-config.d.ts +12 -0
- package/dist/domain/cors-config.js +18 -0
- package/dist/domain/http-method.d.ts +7 -0
- package/dist/domain/http-method.js +11 -0
- package/dist/domain/index.d.ts +10 -0
- package/dist/domain/index.js +26 -0
- package/dist/domain/provider-scope.d.ts +5 -0
- package/dist/domain/provider-scope.js +9 -0
- package/dist/domain/provider-type.d.ts +6 -0
- package/dist/domain/provider-type.js +10 -0
- package/dist/domain/provider.d.ts +37 -0
- package/dist/domain/provider.js +70 -0
- package/dist/events/hooks.decorator.d.ts +3 -0
- package/dist/events/hooks.decorator.js +29 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.js +18 -0
- package/dist/events/on-event.d.ts +13 -0
- package/dist/events/on-event.js +11 -0
- package/dist/exceptions/HttpException.d.ts +9 -0
- package/dist/exceptions/HttpException.js +26 -0
- package/dist/exceptions/index.d.ts +1 -0
- package/dist/exceptions/index.js +17 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +32 -0
- package/dist/route/Matcher.d.ts +16 -0
- package/dist/route/Matcher.js +48 -0
- package/dist/route/RouteExecutor.d.ts +13 -0
- package/dist/route/RouteExecutor.js +70 -0
- package/dist/route/memoirist.d.ts +25 -0
- package/dist/route/memoirist.js +250 -0
- package/dist/services/logger.service.d.ts +23 -0
- package/dist/services/logger.service.js +54 -0
- package/dist/services/request-logger.service.d.ts +15 -0
- package/dist/services/request-logger.service.js +50 -0
- package/dist/testing/core-testing.d.ts +24 -0
- package/dist/testing/core-testing.js +98 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +17 -0
- package/dist/utils/ancestorOf.d.ts +2 -0
- package/dist/utils/ancestorOf.js +10 -0
- package/dist/utils/ancestorsOf.d.ts +6 -0
- package/dist/utils/ancestorsOf.js +20 -0
- package/dist/utils/classOf.d.ts +13 -0
- package/dist/utils/classOf.js +21 -0
- package/dist/utils/cleanObject.d.ts +6 -0
- package/dist/utils/cleanObject.js +22 -0
- package/dist/utils/constructorOf.d.ts +11 -0
- package/dist/utils/constructorOf.js +18 -0
- package/dist/utils/createInstance.d.ts +1 -0
- package/dist/utils/createInstance.js +7 -0
- package/dist/utils/decoratorTypeOf.d.ts +11 -0
- package/dist/utils/decoratorTypeOf.js +32 -0
- package/dist/utils/deepClone.d.ts +6 -0
- package/dist/utils/deepClone.js +63 -0
- package/dist/utils/deepMerge.d.ts +9 -0
- package/dist/utils/deepMerge.js +62 -0
- package/dist/utils/descriptorOf.d.ts +8 -0
- package/dist/utils/descriptorOf.js +16 -0
- package/dist/utils/getClassOrSymbol.d.ts +1 -0
- package/dist/utils/getClassOrSymbol.js +8 -0
- package/dist/utils/getConstructorArgNames.d.ts +1 -0
- package/dist/utils/getConstructorArgNames.js +12 -0
- package/dist/utils/getMethodArgTypes.d.ts +1 -0
- package/dist/utils/getMethodArgTypes.js +9 -0
- package/dist/utils/getValue.d.ts +32 -0
- package/dist/utils/getValue.js +47 -0
- package/dist/utils/hasJsonMethod.d.ts +1 -0
- package/dist/utils/hasJsonMethod.js +6 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/isArray.d.ts +13 -0
- package/dist/utils/isArray.js +21 -0
- package/dist/utils/isArrowFn.d.ts +1 -0
- package/dist/utils/isArrowFn.js +7 -0
- package/dist/utils/isBoolean.d.ts +7 -0
- package/dist/utils/isBoolean.js +15 -0
- package/dist/utils/isBuffer.d.ts +7 -0
- package/dist/utils/isBuffer.js +19 -0
- package/dist/utils/isClass.d.ts +1 -0
- package/dist/utils/isClass.js +26 -0
- package/dist/utils/isClassValidator.d.ts +6 -0
- package/dist/utils/isClassValidator.js +13 -0
- package/dist/utils/isCollection.d.ts +6 -0
- package/dist/utils/isCollection.js +20 -0
- package/dist/utils/isDate.d.ts +6 -0
- package/dist/utils/isDate.js +11 -0
- package/dist/utils/isEmpty.d.ts +6 -0
- package/dist/utils/isEmpty.js +12 -0
- package/dist/utils/isFunction.d.ts +1 -0
- package/dist/utils/isFunction.js +6 -0
- package/dist/utils/isInheritedFrom.d.ts +1 -0
- package/dist/utils/isInheritedFrom.js +24 -0
- package/dist/utils/isMomentObject.d.ts +1 -0
- package/dist/utils/isMomentObject.js +6 -0
- package/dist/utils/isMongooseObject.d.ts +2 -0
- package/dist/utils/isMongooseObject.js +11 -0
- package/dist/utils/isNil.d.ts +1 -0
- package/dist/utils/isNil.js +6 -0
- package/dist/utils/isNumber.d.ts +7 -0
- package/dist/utils/isNumber.js +15 -0
- package/dist/utils/isObject.d.ts +1 -0
- package/dist/utils/isObject.js +6 -0
- package/dist/utils/isObservable.d.ts +1 -0
- package/dist/utils/isObservable.js +6 -0
- package/dist/utils/isPlainObject.d.ts +7 -0
- package/dist/utils/isPlainObject.js +16 -0
- package/dist/utils/isPrimitive.d.ts +14 -0
- package/dist/utils/isPrimitive.js +28 -0
- package/dist/utils/isPrimitiveType.d.ts +1 -0
- package/dist/utils/isPrimitiveType.js +11 -0
- package/dist/utils/isPromise.d.ts +7 -0
- package/dist/utils/isPromise.js +14 -0
- package/dist/utils/isProtectedKey.d.ts +5 -0
- package/dist/utils/isProtectedKey.js +10 -0
- package/dist/utils/isRegExp.d.ts +1 -0
- package/dist/utils/isRegExp.js +6 -0
- package/dist/utils/isRequestScope.d.ts +11 -0
- package/dist/utils/isRequestScope.js +23 -0
- package/dist/utils/isSerializable.d.ts +1 -0
- package/dist/utils/isSerializable.js +11 -0
- package/dist/utils/isStream.d.ts +1 -0
- package/dist/utils/isStream.js +6 -0
- package/dist/utils/isString.d.ts +6 -0
- package/dist/utils/isString.js +14 -0
- package/dist/utils/isSymbol.d.ts +6 -0
- package/dist/utils/isSymbol.js +14 -0
- package/dist/utils/methodsOf.d.ts +9 -0
- package/dist/utils/methodsOf.js +24 -0
- package/dist/utils/nameOf.d.ts +14 -0
- package/dist/utils/nameOf.js +31 -0
- package/dist/utils/objectKeys.d.ts +1 -0
- package/dist/utils/objectKeys.js +7 -0
- package/dist/utils/primitiveOf.d.ts +1 -0
- package/dist/utils/primitiveOf.js +18 -0
- package/dist/utils/prototypeOf.d.ts +6 -0
- package/dist/utils/prototypeOf.js +12 -0
- package/dist/utils/setValue.d.ts +1 -0
- package/dist/utils/setValue.js +32 -0
- package/dist/utils/toMap.d.ts +3 -0
- package/dist/utils/toMap.js +34 -0
- package/dist/utils/toStringConstructor.d.ts +1 -0
- package/dist/utils/toStringConstructor.js +10 -0
- package/package.json +55 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Type } from '../commons/registries/ProviderControl';
|
|
3
|
+
/**
|
|
4
|
+
* @stable
|
|
5
|
+
*/
|
|
6
|
+
export declare class Metadata {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
|
9
|
+
* @param key A key used to store and retrieve metadata.
|
|
10
|
+
* @param target The target object on which the metadata is defined.
|
|
11
|
+
* @param propertyKey The property key for the target.
|
|
12
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```typescript
|
|
16
|
+
* class Example {
|
|
17
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
18
|
+
* // static staticProperty;
|
|
19
|
+
* // property;
|
|
20
|
+
*
|
|
21
|
+
* static staticMethod(p) { }
|
|
22
|
+
* method(p) { }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // constructor
|
|
26
|
+
* result = Metadata.get("custom:annotation", Example);
|
|
27
|
+
*
|
|
28
|
+
* // property (on constructor)
|
|
29
|
+
* result = Metadata.get("custom:annotation", Example, "staticProperty");
|
|
30
|
+
*
|
|
31
|
+
* // property (on prototype)
|
|
32
|
+
* result = Metadata.get("custom:annotation", Example.prototype, "property");
|
|
33
|
+
*
|
|
34
|
+
* // method (on constructor)
|
|
35
|
+
* result = Metadata.get("custom:annotation", Example, "staticMethod");
|
|
36
|
+
*
|
|
37
|
+
* // method (on prototype)
|
|
38
|
+
* result = Metadata.get("custom:annotation", Example.prototype, "method");
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
static get(key: string, target: any, propertyKey?: string | symbol): any;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
|
45
|
+
* @param key A key used to store and retrieve metadata.
|
|
46
|
+
* @param target The target object on which the metadata is defined.
|
|
47
|
+
* @param propertyKey The property key for the target.
|
|
48
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
* ```typescript
|
|
52
|
+
* class Example {
|
|
53
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
54
|
+
* // static staticProperty;
|
|
55
|
+
* // property;
|
|
56
|
+
*
|
|
57
|
+
* static staticMethod(p) { }
|
|
58
|
+
* method(p) { }
|
|
59
|
+
* }
|
|
60
|
+
*
|
|
61
|
+
* // constructor
|
|
62
|
+
* result = Metadata.getOwn("custom:annotation", Example);
|
|
63
|
+
*
|
|
64
|
+
* // property (on constructor)
|
|
65
|
+
* result = Metadata.getOwn("custom:annotation", Example, "staticProperty");
|
|
66
|
+
*
|
|
67
|
+
* // property (on prototype)
|
|
68
|
+
* result = Metadata.getOwn("custom:annotation", Example.prototype, "property");
|
|
69
|
+
*
|
|
70
|
+
* // method (on constructor)
|
|
71
|
+
* result = Metadata.getOwn("custom:annotation", Example, "staticMethod");
|
|
72
|
+
*
|
|
73
|
+
* // method (on prototype)
|
|
74
|
+
* result = Metadata.getOwn("custom:annotation", Example.prototype, "method");
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
static getOwn(key: string, target: any, propertyKey?: string | symbol): any;
|
|
79
|
+
/**
|
|
80
|
+
* Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
|
|
81
|
+
* @param target The target object on which the metadata is defined.
|
|
82
|
+
* @param propertyKey The property key for the target.
|
|
83
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
84
|
+
* @example
|
|
85
|
+
*
|
|
86
|
+
* ```typescript
|
|
87
|
+
* class Example {
|
|
88
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
89
|
+
* // static staticProperty;
|
|
90
|
+
* // property;
|
|
91
|
+
*
|
|
92
|
+
* static staticMethod(p) { }
|
|
93
|
+
* method(p) { }
|
|
94
|
+
* }
|
|
95
|
+
*
|
|
96
|
+
* // on contructor
|
|
97
|
+
* result = Metadata.getType(Example);
|
|
98
|
+
*
|
|
99
|
+
* // property (on constructor)
|
|
100
|
+
* result = Metadata.getType(Example, "staticProperty");
|
|
101
|
+
*
|
|
102
|
+
* // method (on constructor)
|
|
103
|
+
* result = Metadata.getType(Example, "staticMethod");
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
static getType(target: any, propertyKey?: string | symbol): any;
|
|
108
|
+
/**
|
|
109
|
+
* Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
|
|
110
|
+
* @param target The target object on which the metadata is defined.
|
|
111
|
+
* @param propertyKey The property key for the target.
|
|
112
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
113
|
+
* @example
|
|
114
|
+
*
|
|
115
|
+
* ```typescript
|
|
116
|
+
* class Example {
|
|
117
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
118
|
+
* // static staticProperty;
|
|
119
|
+
* // property;
|
|
120
|
+
*
|
|
121
|
+
* static staticMethod(p) { }
|
|
122
|
+
* method(p) { }
|
|
123
|
+
* }
|
|
124
|
+
*
|
|
125
|
+
* // on contructor
|
|
126
|
+
* result = Metadata.getOwnType(Example);
|
|
127
|
+
*
|
|
128
|
+
* // property (on constructor)
|
|
129
|
+
* result = Metadata.getOwnType(Example, "staticProperty");
|
|
130
|
+
*
|
|
131
|
+
* // method (on constructor)
|
|
132
|
+
* result = Metadata.getOwnType(Example, "staticMethod");
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
*/
|
|
136
|
+
static getOwnType(target: any, propertyKey?: string | symbol): any;
|
|
137
|
+
/**
|
|
138
|
+
* Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
|
|
139
|
+
* @param target The target object on which the metadata is defined.
|
|
140
|
+
* @param propertyKey The property key for the target.
|
|
141
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
142
|
+
* @example
|
|
143
|
+
*
|
|
144
|
+
* ```typescript
|
|
145
|
+
* class Example {
|
|
146
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
147
|
+
* // static staticProperty;
|
|
148
|
+
* // property;
|
|
149
|
+
*
|
|
150
|
+
* static staticMethod(p) { }
|
|
151
|
+
* method(p) { }
|
|
152
|
+
* }
|
|
153
|
+
*
|
|
154
|
+
* // on contructor
|
|
155
|
+
* result = Metadata.getReturnType(Example);
|
|
156
|
+
*
|
|
157
|
+
* // property (on constructor)
|
|
158
|
+
* result = Metadata.getReturnType(Example, "staticProperty");
|
|
159
|
+
*
|
|
160
|
+
* // method (on constructor)
|
|
161
|
+
* result = Metadata.getReturnType(Example, "staticMethod");
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
*/
|
|
165
|
+
static getReturnType(target: any, propertyKey?: string | symbol): any;
|
|
166
|
+
/**
|
|
167
|
+
* Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
|
|
168
|
+
* @param target The target object on which the metadata is defined.
|
|
169
|
+
* @param propertyKey The property key for the target.
|
|
170
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
171
|
+
* @example
|
|
172
|
+
*
|
|
173
|
+
* ```typescript
|
|
174
|
+
* class Example {
|
|
175
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
176
|
+
* // static staticProperty;
|
|
177
|
+
* // property;
|
|
178
|
+
*
|
|
179
|
+
* static staticMethod(p) { }
|
|
180
|
+
* method(p) { }
|
|
181
|
+
* }
|
|
182
|
+
*
|
|
183
|
+
* // on contructor
|
|
184
|
+
* result = Metadata.getOwnReturnType(Example);
|
|
185
|
+
*
|
|
186
|
+
* // property (on constructor)
|
|
187
|
+
* result = Metadata.getOwnReturnType(Example, "staticProperty");
|
|
188
|
+
*
|
|
189
|
+
* // method (on constructor)
|
|
190
|
+
* result = Metadata.getOwnReturnType(Example, "staticMethod");
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
*/
|
|
194
|
+
static getOwnReturnType(target: any, propertyKey?: string | symbol): any;
|
|
195
|
+
/**
|
|
196
|
+
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
|
197
|
+
* @param key A key used to store and retrieve metadata.
|
|
198
|
+
* @param target The target object on which the metadata is defined.
|
|
199
|
+
* @param propertyKey The property key for the target.
|
|
200
|
+
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
|
201
|
+
* @example
|
|
202
|
+
*
|
|
203
|
+
* ```typescript
|
|
204
|
+
* class Example {
|
|
205
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
206
|
+
* // static staticProperty;
|
|
207
|
+
* // property;
|
|
208
|
+
*
|
|
209
|
+
* static staticMethod(p) { }
|
|
210
|
+
* method(p) { }
|
|
211
|
+
* }
|
|
212
|
+
*
|
|
213
|
+
* // constructor
|
|
214
|
+
* result = Metadata.has("custom:annotation", Example);
|
|
215
|
+
*
|
|
216
|
+
* // property (on constructor)
|
|
217
|
+
* result = Metadata.has("custom:annotation", Example, "staticProperty");
|
|
218
|
+
*
|
|
219
|
+
* // property (on prototype)
|
|
220
|
+
* result = Metadata.has("custom:annotation", Example.prototype, "property");
|
|
221
|
+
*
|
|
222
|
+
* // method (on constructor)
|
|
223
|
+
* result = Metadata.has("custom:annotation", Example, "staticMethod");
|
|
224
|
+
*
|
|
225
|
+
* // method (on prototype)
|
|
226
|
+
* result = Metadata.has("custom:annotation", Example.prototype, "method");
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
static has(key: string, target: any, propertyKey?: string | symbol): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
|
233
|
+
* @param key A key used to store and retrieve metadata.
|
|
234
|
+
* @param target The target object on which the metadata is defined.
|
|
235
|
+
* @param propertyKey The property key for the target.
|
|
236
|
+
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
|
237
|
+
* @example
|
|
238
|
+
*
|
|
239
|
+
* ```typescript
|
|
240
|
+
* class Example {
|
|
241
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
242
|
+
* // static staticProperty;
|
|
243
|
+
* // property;
|
|
244
|
+
*
|
|
245
|
+
* static staticMethod(p) { }
|
|
246
|
+
* method(p) { }
|
|
247
|
+
* }
|
|
248
|
+
*
|
|
249
|
+
* // constructor
|
|
250
|
+
* result = Metadata.has("custom:annotation", Example);
|
|
251
|
+
*
|
|
252
|
+
* // property (on constructor)
|
|
253
|
+
* result = Metadata.hasOwn("custom:annotation", Example, "staticProperty");
|
|
254
|
+
*
|
|
255
|
+
* // property (on prototype)
|
|
256
|
+
* result = Metadata.hasOwn("custom:annotation", Example.prototype, "property");
|
|
257
|
+
*
|
|
258
|
+
* // method (on constructor)
|
|
259
|
+
* result = Metadata.hasOwn("custom:annotation", Example, "staticMethod");
|
|
260
|
+
*
|
|
261
|
+
* // method (on prototype)
|
|
262
|
+
* result = Metadata.hasOwn("custom:annotation", Example.prototype, "method");
|
|
263
|
+
* ```
|
|
264
|
+
*
|
|
265
|
+
*/
|
|
266
|
+
static hasOwn(key: string, target: any, propertyKey?: string | symbol): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Deletes the metadata entry from the target object with the provided key.
|
|
269
|
+
* @param key A key used to store and retrieve metadata.
|
|
270
|
+
* @param target The target object on which the metadata is defined.
|
|
271
|
+
* @param propertyKey The property key for the target.
|
|
272
|
+
* @returns `true` if the metadata entry was found and deleted; otherwise, false.
|
|
273
|
+
* @example
|
|
274
|
+
*
|
|
275
|
+
* ```typescript
|
|
276
|
+
* class Example {
|
|
277
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
278
|
+
* // static staticProperty;
|
|
279
|
+
* // property;
|
|
280
|
+
*
|
|
281
|
+
* static staticMethod(p) { }
|
|
282
|
+
* method(p) { }
|
|
283
|
+
* }
|
|
284
|
+
*
|
|
285
|
+
* // constructor
|
|
286
|
+
* result = Metadata.delete("custom:annotation", Example);
|
|
287
|
+
*
|
|
288
|
+
* // property (on constructor)
|
|
289
|
+
* result = Metadata.delete("custom:annotation", Example, "staticProperty");
|
|
290
|
+
*
|
|
291
|
+
* // property (on prototype)
|
|
292
|
+
* result = Metadata.delete("custom:annotation", Example.prototype, "property");
|
|
293
|
+
*
|
|
294
|
+
* // method (on constructor)
|
|
295
|
+
* result = Metadata.delete("custom:annotation", Example, "staticMethod");
|
|
296
|
+
*
|
|
297
|
+
* // method (on prototype)
|
|
298
|
+
* result = Metadata.delete("custom:annotation", Example.prototype, "method");
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
*/
|
|
302
|
+
static delete(key: string, target: any, propertyKey?: string | symbol): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Set the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
|
|
305
|
+
* @param target The target object on which the metadata is defined.
|
|
306
|
+
* @param propertyKey The property key for the target.
|
|
307
|
+
* @param value A value that contains attached metadata.
|
|
308
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
309
|
+
* @example
|
|
310
|
+
*
|
|
311
|
+
* ```typescript
|
|
312
|
+
* class Example {
|
|
313
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
314
|
+
* // static staticProperty;
|
|
315
|
+
* // property;
|
|
316
|
+
*
|
|
317
|
+
* static staticMethod(p) { }
|
|
318
|
+
* method(p) { }
|
|
319
|
+
* }
|
|
320
|
+
*
|
|
321
|
+
* // on contructor
|
|
322
|
+
* result = Metadata.setParamTypes(Example, undefined, [Object]);
|
|
323
|
+
*
|
|
324
|
+
* // property (on constructor)
|
|
325
|
+
* result = Metadata.setParamTypes(Example, "staticProperty", [Object]);
|
|
326
|
+
*
|
|
327
|
+
* // property (on prototype)
|
|
328
|
+
* result = Metadata.setParamTypes(Example.prototype, "property", [Object]);
|
|
329
|
+
*
|
|
330
|
+
* // method (on constructor)
|
|
331
|
+
* result = Metadata.setParamTypes(Example, "staticMethod", [Object]);
|
|
332
|
+
*
|
|
333
|
+
* // method (on prototype)
|
|
334
|
+
* result = Metadata.setParamTypes(Example.prototype, "method", [Object]);
|
|
335
|
+
* ```
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
static setParamTypes(target: any, propertyKey: string | symbol, value: any): void;
|
|
339
|
+
/**
|
|
340
|
+
* Get all metadata for a metadataKey.
|
|
341
|
+
* @param metadataKey
|
|
342
|
+
*/
|
|
343
|
+
static getTargetsFromPropertyKey: (metadataKey: string | symbol) => any[];
|
|
344
|
+
/**
|
|
345
|
+
* Define a unique metadata entry on the target.
|
|
346
|
+
* @param key A key used to store and retrieve metadata.
|
|
347
|
+
* @param value A value that contains attached metadata.
|
|
348
|
+
* @param target The target object on which to define metadata.
|
|
349
|
+
* @param propertyKey The property key for the target.
|
|
350
|
+
* @example
|
|
351
|
+
*
|
|
352
|
+
* ```typescript
|
|
353
|
+
* class Example {
|
|
354
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
355
|
+
* // static staticProperty;
|
|
356
|
+
* // property;
|
|
357
|
+
*
|
|
358
|
+
* static staticMethod(p) { }
|
|
359
|
+
* method(p) { }
|
|
360
|
+
* }
|
|
361
|
+
*
|
|
362
|
+
* // constructor
|
|
363
|
+
* Reflect.defineMetadata("custom:annotation", options, Example);
|
|
364
|
+
*
|
|
365
|
+
* // property (on constructor)
|
|
366
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
|
|
367
|
+
*
|
|
368
|
+
* // property (on prototype)
|
|
369
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
|
|
370
|
+
*
|
|
371
|
+
* // method (on constructor)
|
|
372
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
|
|
373
|
+
*
|
|
374
|
+
* // method (on prototype)
|
|
375
|
+
* Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
|
|
376
|
+
*
|
|
377
|
+
* // decorator factory as metadata-producing annotation.
|
|
378
|
+
* function MyAnnotation(options): PropertyDecorator {
|
|
379
|
+
* return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
*/
|
|
384
|
+
static set(key: string, value: any, target: any, propertyKey?: string | symbol): void;
|
|
385
|
+
/**
|
|
386
|
+
* Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
|
|
387
|
+
* @param targetPrototype
|
|
388
|
+
* @param propertyKey The property key for the target.
|
|
389
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
390
|
+
* @example
|
|
391
|
+
*
|
|
392
|
+
* ```typescript
|
|
393
|
+
* class Example {
|
|
394
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
395
|
+
* // static staticProperty;
|
|
396
|
+
* // property;
|
|
397
|
+
*
|
|
398
|
+
* static staticMethod(p) { }
|
|
399
|
+
* method(p) { }
|
|
400
|
+
* }
|
|
401
|
+
*
|
|
402
|
+
* // on contructor
|
|
403
|
+
* result = Metadata.getParamTypes(Example.prototype);
|
|
404
|
+
*
|
|
405
|
+
* // property (on constructor)
|
|
406
|
+
* result = Metadata.getParamTypes(Example.prototype, "staticProperty");
|
|
407
|
+
*
|
|
408
|
+
* // method (on constructor)
|
|
409
|
+
* result = Metadata.getParamTypes(Example.prototype, "staticMethod");
|
|
410
|
+
* ```
|
|
411
|
+
*
|
|
412
|
+
*/
|
|
413
|
+
static getParamTypes(targetPrototype: any, propertyKey?: string | symbol): any[];
|
|
414
|
+
/**
|
|
415
|
+
* Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
|
|
416
|
+
* @param target The target object on which the metadata is defined.
|
|
417
|
+
* @param propertyKey The property key for the target.
|
|
418
|
+
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
|
419
|
+
* @example
|
|
420
|
+
*
|
|
421
|
+
* ```typescript
|
|
422
|
+
* class Example {
|
|
423
|
+
* // property declarations are not part of ES6, though they are valid in TypeScript:
|
|
424
|
+
* // static staticProperty;
|
|
425
|
+
* // property;
|
|
426
|
+
*
|
|
427
|
+
* static staticMethod(p) { }
|
|
428
|
+
* method(p) { }
|
|
429
|
+
* }
|
|
430
|
+
*
|
|
431
|
+
* // on contructor
|
|
432
|
+
* result = Metadata.getParamTypes(Example);
|
|
433
|
+
*
|
|
434
|
+
* // property (on constructor)
|
|
435
|
+
* result = Metadata.getParamTypes(Example, "staticProperty");
|
|
436
|
+
*
|
|
437
|
+
* // method (on constructor)
|
|
438
|
+
* result = Metadata.getParamTypes(Example, "staticMethod");
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
*/
|
|
442
|
+
static getOwnParamTypes(target: any, propertyKey?: string | symbol): any[];
|
|
443
|
+
static getParamDecoratorFunc(target: Type, propertyKey: string): {
|
|
444
|
+
[key: number]: {
|
|
445
|
+
fun: Function;
|
|
446
|
+
param?: any;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
}
|