@tsed/core 7.79.4 → 7.80.0

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.
Files changed (92) hide show
  1. package/lib/cjs/utils/imports/importPackage.js +1 -24
  2. package/lib/cjs/utils/imports/importPackage.js.map +1 -1
  3. package/lib/types-esm/decorators/configurable.d.ts +1 -0
  4. package/lib/types-esm/decorators/deprecated.d.ts +32 -0
  5. package/lib/types-esm/decorators/enumerable.d.ts +1 -0
  6. package/lib/types-esm/decorators/notConfigurable.d.ts +1 -0
  7. package/lib/types-esm/decorators/notEnumerable.d.ts +1 -0
  8. package/lib/types-esm/decorators/readOnly.d.ts +1 -0
  9. package/lib/types-esm/decorators/storeFn.d.ts +9 -0
  10. package/lib/types-esm/decorators/storeMerge.d.ts +1 -0
  11. package/lib/types-esm/decorators/storeSet.d.ts +1 -0
  12. package/lib/types-esm/decorators/writable.d.ts +1 -0
  13. package/lib/types-esm/domain/AnyToPromise.d.ts +42 -0
  14. package/lib/types-esm/domain/DecoratorTypes.d.ts +10 -0
  15. package/lib/types-esm/domain/Env.d.ts +13 -0
  16. package/lib/types-esm/domain/Hooks.d.ts +47 -0
  17. package/lib/types-esm/domain/Metadata.d.ts +442 -0
  18. package/lib/types-esm/domain/Store.d.ts +69 -0
  19. package/lib/types-esm/domain/Type.d.ts +11 -0
  20. package/lib/types-esm/errors/UnsupportedDecoratorType.d.ts +5 -0
  21. package/lib/types-esm/index.d.ts +86 -0
  22. package/lib/types-esm/interfaces/AnyDecorator.d.ts +1 -0
  23. package/lib/types-esm/interfaces/DecoratorParameters.d.ts +3 -0
  24. package/lib/types-esm/interfaces/MetadataTypes.d.ts +5 -0
  25. package/lib/types-esm/interfaces/Relation.d.ts +1 -0
  26. package/lib/types-esm/interfaces/ValueOf.d.ts +1 -0
  27. package/lib/types-esm/utils/catchError.d.ts +2 -0
  28. package/lib/types-esm/utils/decorators/decorateMethodsOf.d.ts +1 -0
  29. package/lib/types-esm/utils/decorators/decoratorArgs.d.ts +2 -0
  30. package/lib/types-esm/utils/decorators/decoratorTypeOf.d.ts +2 -0
  31. package/lib/types-esm/utils/decorators/inheritedDescriptorOf.d.ts +1 -0
  32. package/lib/types-esm/utils/decorators/useDecorators.d.ts +2 -0
  33. package/lib/types-esm/utils/decorators/useMethodDecorators.d.ts +3 -0
  34. package/lib/types-esm/utils/getRandomId.d.ts +1 -0
  35. package/lib/types-esm/utils/http/getHostInfoFromPort.d.ts +7 -0
  36. package/lib/types-esm/utils/imports/importPackage.d.ts +1 -0
  37. package/lib/types-esm/utils/objects/ancestorOf.d.ts +2 -0
  38. package/lib/types-esm/utils/objects/ancestorsOf.d.ts +6 -0
  39. package/lib/types-esm/utils/objects/classOf.d.ts +13 -0
  40. package/lib/types-esm/utils/objects/cleanObject.d.ts +6 -0
  41. package/lib/types-esm/utils/objects/constructorOf.d.ts +11 -0
  42. package/lib/types-esm/utils/objects/createInstance.d.ts +1 -0
  43. package/lib/types-esm/utils/objects/deepClone.d.ts +6 -0
  44. package/lib/types-esm/utils/objects/deepMerge.d.ts +9 -0
  45. package/lib/types-esm/utils/objects/descriptorOf.d.ts +8 -0
  46. package/lib/types-esm/utils/objects/getClassOrSymbol.d.ts +1 -0
  47. package/lib/types-esm/utils/objects/getConstructorArgNames.d.ts +1 -0
  48. package/lib/types-esm/utils/objects/getEnumerableKeys.d.ts +5 -0
  49. package/lib/types-esm/utils/objects/getValue.d.ts +32 -0
  50. package/lib/types-esm/utils/objects/hasJsonMethod.d.ts +1 -0
  51. package/lib/types-esm/utils/objects/isArray.d.ts +13 -0
  52. package/lib/types-esm/utils/objects/isArrowFn.d.ts +1 -0
  53. package/lib/types-esm/utils/objects/isBoolean.d.ts +7 -0
  54. package/lib/types-esm/utils/objects/isBuffer.d.ts +8 -0
  55. package/lib/types-esm/utils/objects/isClass.d.ts +1 -0
  56. package/lib/types-esm/utils/objects/isCollection.d.ts +6 -0
  57. package/lib/types-esm/utils/objects/isDate.d.ts +6 -0
  58. package/lib/types-esm/utils/objects/isEmpty.d.ts +6 -0
  59. package/lib/types-esm/utils/objects/isEnumerable.d.ts +6 -0
  60. package/lib/types-esm/utils/objects/isFunction.d.ts +1 -0
  61. package/lib/types-esm/utils/objects/isInheritedFrom.d.ts +1 -0
  62. package/lib/types-esm/utils/objects/isMomentObject.d.ts +1 -0
  63. package/lib/types-esm/utils/objects/isMongooseObject.d.ts +2 -0
  64. package/lib/types-esm/utils/objects/isNil.d.ts +1 -0
  65. package/lib/types-esm/utils/objects/isNumber.d.ts +7 -0
  66. package/lib/types-esm/utils/objects/isObject.d.ts +1 -0
  67. package/lib/types-esm/utils/objects/isObservable.d.ts +1 -0
  68. package/lib/types-esm/utils/objects/isPlainObject.d.ts +7 -0
  69. package/lib/types-esm/utils/objects/isPrimitive.d.ts +14 -0
  70. package/lib/types-esm/utils/objects/isPromise.d.ts +7 -0
  71. package/lib/types-esm/utils/objects/isProtectedKey.d.ts +5 -0
  72. package/lib/types-esm/utils/objects/isRegExp.d.ts +1 -0
  73. package/lib/types-esm/utils/objects/isSerializable.d.ts +1 -0
  74. package/lib/types-esm/utils/objects/isStream.d.ts +1 -0
  75. package/lib/types-esm/utils/objects/isString.d.ts +6 -0
  76. package/lib/types-esm/utils/objects/isSymbol.d.ts +6 -0
  77. package/lib/types-esm/utils/objects/methodsOf.d.ts +9 -0
  78. package/lib/types-esm/utils/objects/nameOf.d.ts +14 -0
  79. package/lib/types-esm/utils/objects/objectKeys.d.ts +1 -0
  80. package/lib/types-esm/utils/objects/primitiveOf.d.ts +1 -0
  81. package/lib/types-esm/utils/objects/prototypeOf.d.ts +6 -0
  82. package/lib/types-esm/utils/objects/setValue.d.ts +1 -0
  83. package/lib/types-esm/utils/objects/toMap.d.ts +3 -0
  84. package/lib/types-esm/utils/objects/toStringConstructor.d.ts +1 -0
  85. package/lib/types-esm/utils/proxyDelegation.d.ts +33 -0
  86. package/lib/types-esm/utils/uniq.d.ts +5 -0
  87. package/package.json +18 -12
  88. package/vitest.config.mts +21 -0
  89. package/jest.config.js +0 -14
  90. package/lib/cjs/package.json +0 -3
  91. package/lib/esm/package.json +0 -3
  92. package/tsconfig.esm.json +0 -29
@@ -1,30 +1,7 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.importPackage = void 0;
27
- async function importPackage(packageName, loaderFn = () => { var _a; return _a = packageName, Promise.resolve().then(() => __importStar(require(_a))); }, optional = false) {
4
+ async function importPackage(packageName, loaderFn = () => import(packageName), optional = false) {
28
5
  try {
29
6
  return await loaderFn();
30
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../../../src/utils/imports/importPackage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,WAAqB,GAAG,EAAE,uBAAQ,WAAW,4DAAC,EAAE,QAAQ,GAAG,KAAK;IACvH,IAAI;QACF,OAAO,MAAM,QAAQ,EAAE,CAAC;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,CAAC,CAAC;SACT;QAED,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAVD,sCAUC"}
1
+ {"version":3,"file":"importPackage.js","sourceRoot":"","sources":["../../../../src/utils/imports/importPackage.ts"],"names":[],"mappings":";;;AAAO,KAAK,UAAU,aAAa,CAAC,WAAmB,EAAE,WAAqB,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,KAAK;IACvH,IAAI;QACF,OAAO,MAAM,QAAQ,EAAE,CAAC;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,CAAC,CAAC;SACT;QAED,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAVD,sCAUC"}
@@ -0,0 +1 @@
1
+ export declare function Configurable(value?: boolean): Function;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.
3
+ *
4
+ * ```typescript
5
+ * provide Foo {
6
+ *
7
+ * @Deprecated("Foo.method: Use Foo.method2 instead")
8
+ * public method() {
9
+ *
10
+ * }
11
+ * ```
12
+ *
13
+ * When called, @Deprecated() will return a function that will emit a `DeprecationWarning` using the `process.on('warning')` event.
14
+ * By default, this warning will be emitted and printed to `stderr` exactly once, the first time it is called. After the warning is emitted, the wrapped method is called.
15
+ *
16
+ * If either the `--no-deprecation` or `--no-warnings` command line flags are used, or if the `process.noDeprecation`
17
+ * property is set to `true` prior to the first deprecation warning, the `@Deprecated()` decorators does nothing.
18
+ *
19
+ * If the `--trace-deprecation` or `--trace-warnings` command line flags are set, or the `process.traceDeprecation`
20
+ * property is set to `true`, a warning and a stack trace are printed to stderr the first time the deprecated function is called.
21
+ *
22
+ * If the `--throw-deprecation` command line flag is set, or the `process.throwDeprecation` property is set to `true`,
23
+ * then an exception will be thrown when the deprecated function is called.
24
+ *
25
+ * The `--throw-deprecation` command line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation`
26
+ * and `process.traceDeprecation`.
27
+ *
28
+ * @param message
29
+ * @returns {Function}
30
+ * @decorator
31
+ */
32
+ export declare function Deprecated(message: string): Function;
@@ -0,0 +1 @@
1
+ export declare function Enumerable(value?: boolean): Function;
@@ -0,0 +1 @@
1
+ export declare function NotConfigurable(): Function;
@@ -0,0 +1 @@
1
+ export declare function NotEnumerable(): Function;
@@ -0,0 +1 @@
1
+ export declare function Readonly(): Function;
@@ -0,0 +1,9 @@
1
+ import { Store } from "../domain/Store.js";
2
+ import { DecoratorParameters } from "../interfaces/DecoratorParameters.js";
3
+ /**
4
+ * Create a store correctly configured from the parameters given by the decorator.
5
+ * The `fn` can return a decorator that will be initialized with the parameters (target, propertyKey, descriptor).
6
+ * @param {(store: Store, parameters: DecoratorParameters) => void} fn
7
+ * @returns {Function}
8
+ */
9
+ export declare function StoreFn(fn: (store: Store, parameters: DecoratorParameters) => void): Function;
@@ -0,0 +1 @@
1
+ export declare function StoreMerge(key: any, value: any): Function;
@@ -0,0 +1 @@
1
+ export declare function StoreSet(key: any, value: any): Function;
@@ -0,0 +1 @@
1
+ export declare function Writable(value?: boolean): Function;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @ignore
3
+ */
4
+ export declare enum AnyToPromiseStatus {
5
+ PENDING = "PENDING",
6
+ CANCELED = "CANCELED",
7
+ RESOLVED = "RESOLVED",
8
+ REJECTED = "REJECTED"
9
+ }
10
+ export declare enum AnyToPromiseResponseTypes {
11
+ STREAM = "STREAM",
12
+ BUFFER = "BUFFER",
13
+ DATA = "DATA"
14
+ }
15
+ export interface AnyPromiseResult<T = any> {
16
+ state: AnyToPromiseStatus;
17
+ type: AnyToPromiseResponseTypes;
18
+ status?: number;
19
+ headers?: Record<string, any>;
20
+ data: T;
21
+ }
22
+ export declare class AnyToPromise<T = any> {
23
+ #private;
24
+ status: AnyToPromiseStatus;
25
+ args: any[];
26
+ constructor({ hasNextFunction }?: {
27
+ hasNextFunction?: boolean;
28
+ });
29
+ isDone(): boolean;
30
+ get next(): (error?: any) => void;
31
+ /**
32
+ *
33
+ */
34
+ call(cb: Function): Promise<AnyPromiseResult<T>>;
35
+ reject(er: any): void;
36
+ resolve(response?: any): void;
37
+ destroy(): void;
38
+ cancel(): any;
39
+ done(status: AnyToPromiseStatus): void;
40
+ handle(process: any, additionalProps?: {}): any;
41
+ protected isCanceledResponse(process: any): boolean;
42
+ }
@@ -0,0 +1,10 @@
1
+ export declare enum DecoratorTypes {
2
+ PARAM = "parameter",
3
+ PARAM_CTOR = "parameter.constructor",
4
+ PARAM_STC = "parameter.static",
5
+ PROP = "property",
6
+ PROP_STC = "property.static",
7
+ METHOD = "method",
8
+ METHOD_STC = "method.static",
9
+ CLASS = "class"
10
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ *
3
+ */
4
+ export declare enum Env {
5
+ PROD = "production",
6
+ DEV = "development",
7
+ TEST = "test"
8
+ }
9
+ /**
10
+ * Fallback
11
+ * @type {Env}
12
+ */
13
+ export declare const EnvTypes: typeof Env;
@@ -0,0 +1,47 @@
1
+ export declare class Hooks {
2
+ #private;
3
+ has(event: string): boolean;
4
+ /**
5
+ * Listen a hook event
6
+ * @param event
7
+ * @param cb
8
+ */
9
+ on(event: string, cb: Function): this;
10
+ /**
11
+ * Remove a listener attached to an event
12
+ * @param event
13
+ * @param cb
14
+ */
15
+ off(event: string, cb: Function): this;
16
+ /**
17
+ * Trigger an event and call listener.
18
+ * @param event
19
+ * @param args
20
+ * @param callThis
21
+ */
22
+ emit(event: string, args?: any[], callThis?: any): void;
23
+ /**
24
+ * Trigger an event, listener alter given value and return it.
25
+ * @param event
26
+ * @param value
27
+ * @param args
28
+ * @param callThis
29
+ */
30
+ alter<Arg = any, AlteredArg = Arg>(event: string, value: Arg, args?: any[], callThis?: any): AlteredArg;
31
+ /**
32
+ * Trigger an event and call async listener.
33
+ * @param event
34
+ * @param args
35
+ * @param callThis
36
+ */
37
+ asyncEmit(event: string, args?: any[], callThis?: any): Promise<void>;
38
+ /**
39
+ * Trigger an event, async listener alter given value and return it.
40
+ * @param event
41
+ * @param value
42
+ * @param args
43
+ * @param callThis
44
+ */
45
+ asyncAlter<Arg = any, AlteredArg = Arg>(event: string, value: Arg, args?: any[], callThis?: any): Promise<AlteredArg>;
46
+ destroy(): void;
47
+ }
@@ -0,0 +1,442 @@
1
+ import "reflect-metadata";
2
+ /**
3
+ * @stable
4
+ */
5
+ export declare class Metadata {
6
+ /**
7
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
8
+ * @param key A key used to store and retrieve metadata.
9
+ * @param target The target object on which the metadata is defined.
10
+ * @param propertyKey The property key for the target.
11
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
12
+ * @example
13
+ *
14
+ * ```typescript
15
+ * class Example {
16
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
17
+ * // static staticProperty;
18
+ * // property;
19
+ *
20
+ * static staticMethod(p) { }
21
+ * method(p) { }
22
+ * }
23
+ *
24
+ * // constructor
25
+ * result = Metadata.get("custom:annotation", Example);
26
+ *
27
+ * // property (on constructor)
28
+ * result = Metadata.get("custom:annotation", Example, "staticProperty");
29
+ *
30
+ * // property (on prototype)
31
+ * result = Metadata.get("custom:annotation", Example.prototype, "property");
32
+ *
33
+ * // method (on constructor)
34
+ * result = Metadata.get("custom:annotation", Example, "staticMethod");
35
+ *
36
+ * // method (on prototype)
37
+ * result = Metadata.get("custom:annotation", Example.prototype, "method");
38
+ * ```
39
+ *
40
+ */
41
+ static get(key: string, target: any, propertyKey?: string | symbol): any;
42
+ /**
43
+ * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
44
+ * @param key A key used to store and retrieve metadata.
45
+ * @param target The target object on which the metadata is defined.
46
+ * @param propertyKey The property key for the target.
47
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
48
+ * @example
49
+ *
50
+ * ```typescript
51
+ * class Example {
52
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
53
+ * // static staticProperty;
54
+ * // property;
55
+ *
56
+ * static staticMethod(p) { }
57
+ * method(p) { }
58
+ * }
59
+ *
60
+ * // constructor
61
+ * result = Metadata.getOwn("custom:annotation", Example);
62
+ *
63
+ * // property (on constructor)
64
+ * result = Metadata.getOwn("custom:annotation", Example, "staticProperty");
65
+ *
66
+ * // property (on prototype)
67
+ * result = Metadata.getOwn("custom:annotation", Example.prototype, "property");
68
+ *
69
+ * // method (on constructor)
70
+ * result = Metadata.getOwn("custom:annotation", Example, "staticMethod");
71
+ *
72
+ * // method (on prototype)
73
+ * result = Metadata.getOwn("custom:annotation", Example.prototype, "method");
74
+ * ```
75
+ *
76
+ */
77
+ static getOwn(key: string, target: any, propertyKey?: string | symbol): any;
78
+ /**
79
+ * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
80
+ * @param target The target object on which the metadata is defined.
81
+ * @param propertyKey The property key for the target.
82
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
83
+ * @example
84
+ *
85
+ * ```typescript
86
+ * class Example {
87
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
88
+ * // static staticProperty;
89
+ * // property;
90
+ *
91
+ * static staticMethod(p) { }
92
+ * method(p) { }
93
+ * }
94
+ *
95
+ * // on contructor
96
+ * result = Metadata.getType(Example);
97
+ *
98
+ * // property (on constructor)
99
+ * result = Metadata.getType(Example, "staticProperty");
100
+ *
101
+ * // method (on constructor)
102
+ * result = Metadata.getType(Example, "staticMethod");
103
+ * ```
104
+ *
105
+ */
106
+ static getType(target: any, propertyKey?: string | symbol): any;
107
+ /**
108
+ * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
109
+ * @param target The target object on which the metadata is defined.
110
+ * @param propertyKey The property key for the target.
111
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
112
+ * @example
113
+ *
114
+ * ```typescript
115
+ * class Example {
116
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
117
+ * // static staticProperty;
118
+ * // property;
119
+ *
120
+ * static staticMethod(p) { }
121
+ * method(p) { }
122
+ * }
123
+ *
124
+ * // on contructor
125
+ * result = Metadata.getOwnType(Example);
126
+ *
127
+ * // property (on constructor)
128
+ * result = Metadata.getOwnType(Example, "staticProperty");
129
+ *
130
+ * // method (on constructor)
131
+ * result = Metadata.getOwnType(Example, "staticMethod");
132
+ * ```
133
+ *
134
+ */
135
+ static getOwnType(target: any, propertyKey?: string | symbol): any;
136
+ /**
137
+ * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
138
+ * @param target The target object on which the metadata is defined.
139
+ * @param propertyKey The property key for the target.
140
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
141
+ * @example
142
+ *
143
+ * ```typescript
144
+ * class Example {
145
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
146
+ * // static staticProperty;
147
+ * // property;
148
+ *
149
+ * static staticMethod(p) { }
150
+ * method(p) { }
151
+ * }
152
+ *
153
+ * // on contructor
154
+ * result = Metadata.getReturnType(Example);
155
+ *
156
+ * // property (on constructor)
157
+ * result = Metadata.getReturnType(Example, "staticProperty");
158
+ *
159
+ * // method (on constructor)
160
+ * result = Metadata.getReturnType(Example, "staticMethod");
161
+ * ```
162
+ *
163
+ */
164
+ static getReturnType(target: any, propertyKey?: string | symbol): any;
165
+ /**
166
+ * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
167
+ * @param target The target object on which the metadata is defined.
168
+ * @param propertyKey The property key for the target.
169
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
170
+ * @example
171
+ *
172
+ * ```typescript
173
+ * class Example {
174
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
175
+ * // static staticProperty;
176
+ * // property;
177
+ *
178
+ * static staticMethod(p) { }
179
+ * method(p) { }
180
+ * }
181
+ *
182
+ * // on contructor
183
+ * result = Metadata.getOwnReturnType(Example);
184
+ *
185
+ * // property (on constructor)
186
+ * result = Metadata.getOwnReturnType(Example, "staticProperty");
187
+ *
188
+ * // method (on constructor)
189
+ * result = Metadata.getOwnReturnType(Example, "staticMethod");
190
+ * ```
191
+ *
192
+ */
193
+ static getOwnReturnType(target: any, propertyKey?: string | symbol): any;
194
+ /**
195
+ * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
196
+ * @param key A key used to store and retrieve metadata.
197
+ * @param target The target object on which the metadata is defined.
198
+ * @param propertyKey The property key for the target.
199
+ * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
200
+ * @example
201
+ *
202
+ * ```typescript
203
+ * class Example {
204
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
205
+ * // static staticProperty;
206
+ * // property;
207
+ *
208
+ * static staticMethod(p) { }
209
+ * method(p) { }
210
+ * }
211
+ *
212
+ * // constructor
213
+ * result = Metadata.has("custom:annotation", Example);
214
+ *
215
+ * // property (on constructor)
216
+ * result = Metadata.has("custom:annotation", Example, "staticProperty");
217
+ *
218
+ * // property (on prototype)
219
+ * result = Metadata.has("custom:annotation", Example.prototype, "property");
220
+ *
221
+ * // method (on constructor)
222
+ * result = Metadata.has("custom:annotation", Example, "staticMethod");
223
+ *
224
+ * // method (on prototype)
225
+ * result = Metadata.has("custom:annotation", Example.prototype, "method");
226
+ * ```
227
+ *
228
+ */
229
+ static has(key: string, target: any, propertyKey?: string | symbol): boolean;
230
+ /**
231
+ * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
232
+ * @param key A key used to store and retrieve metadata.
233
+ * @param target The target object on which the metadata is defined.
234
+ * @param propertyKey The property key for the target.
235
+ * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
236
+ * @example
237
+ *
238
+ * ```typescript
239
+ * class Example {
240
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
241
+ * // static staticProperty;
242
+ * // property;
243
+ *
244
+ * static staticMethod(p) { }
245
+ * method(p) { }
246
+ * }
247
+ *
248
+ * // constructor
249
+ * result = Metadata.has("custom:annotation", Example);
250
+ *
251
+ * // property (on constructor)
252
+ * result = Metadata.hasOwn("custom:annotation", Example, "staticProperty");
253
+ *
254
+ * // property (on prototype)
255
+ * result = Metadata.hasOwn("custom:annotation", Example.prototype, "property");
256
+ *
257
+ * // method (on constructor)
258
+ * result = Metadata.hasOwn("custom:annotation", Example, "staticMethod");
259
+ *
260
+ * // method (on prototype)
261
+ * result = Metadata.hasOwn("custom:annotation", Example.prototype, "method");
262
+ * ```
263
+ *
264
+ */
265
+ static hasOwn(key: string, target: any, propertyKey?: string | symbol): boolean;
266
+ /**
267
+ * Deletes the metadata entry from the target object with the provided key.
268
+ * @param key A key used to store and retrieve metadata.
269
+ * @param target The target object on which the metadata is defined.
270
+ * @param propertyKey The property key for the target.
271
+ * @returns `true` if the metadata entry was found and deleted; otherwise, false.
272
+ * @example
273
+ *
274
+ * ```typescript
275
+ * class Example {
276
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
277
+ * // static staticProperty;
278
+ * // property;
279
+ *
280
+ * static staticMethod(p) { }
281
+ * method(p) { }
282
+ * }
283
+ *
284
+ * // constructor
285
+ * result = Metadata.delete("custom:annotation", Example);
286
+ *
287
+ * // property (on constructor)
288
+ * result = Metadata.delete("custom:annotation", Example, "staticProperty");
289
+ *
290
+ * // property (on prototype)
291
+ * result = Metadata.delete("custom:annotation", Example.prototype, "property");
292
+ *
293
+ * // method (on constructor)
294
+ * result = Metadata.delete("custom:annotation", Example, "staticMethod");
295
+ *
296
+ * // method (on prototype)
297
+ * result = Metadata.delete("custom:annotation", Example.prototype, "method");
298
+ * ```
299
+ *
300
+ */
301
+ static delete(key: string, target: any, propertyKey?: string | symbol): boolean;
302
+ /**
303
+ * Set the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
304
+ * @param target The target object on which the metadata is defined.
305
+ * @param propertyKey The property key for the target.
306
+ * @param value A value that contains attached metadata.
307
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
308
+ * @example
309
+ *
310
+ * ```typescript
311
+ * class Example {
312
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
313
+ * // static staticProperty;
314
+ * // property;
315
+ *
316
+ * static staticMethod(p) { }
317
+ * method(p) { }
318
+ * }
319
+ *
320
+ * // on contructor
321
+ * result = Metadata.setParamTypes(Example, undefined, [Object]);
322
+ *
323
+ * // property (on constructor)
324
+ * result = Metadata.setParamTypes(Example, "staticProperty", [Object]);
325
+ *
326
+ * // property (on prototype)
327
+ * result = Metadata.setParamTypes(Example.prototype, "property", [Object]);
328
+ *
329
+ * // method (on constructor)
330
+ * result = Metadata.setParamTypes(Example, "staticMethod", [Object]);
331
+ *
332
+ * // method (on prototype)
333
+ * result = Metadata.setParamTypes(Example.prototype, "method", [Object]);
334
+ * ```
335
+ *
336
+ */
337
+ static setParamTypes(target: any, propertyKey: string | symbol, value: any): void;
338
+ /**
339
+ * Get all metadata for a metadataKey.
340
+ * @param metadataKey
341
+ */
342
+ static getTargetsFromPropertyKey: (metadataKey: string | symbol) => any[];
343
+ /**
344
+ * Define a unique metadata entry on the target.
345
+ * @param key A key used to store and retrieve metadata.
346
+ * @param value A value that contains attached metadata.
347
+ * @param target The target object on which to define metadata.
348
+ * @param propertyKey The property key for the target.
349
+ * @example
350
+ *
351
+ * ```typescript
352
+ * class Example {
353
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
354
+ * // static staticProperty;
355
+ * // property;
356
+ *
357
+ * static staticMethod(p) { }
358
+ * method(p) { }
359
+ * }
360
+ *
361
+ * // constructor
362
+ * Reflect.defineMetadata("custom:annotation", options, Example);
363
+ *
364
+ * // property (on constructor)
365
+ * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
366
+ *
367
+ * // property (on prototype)
368
+ * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
369
+ *
370
+ * // method (on constructor)
371
+ * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
372
+ *
373
+ * // method (on prototype)
374
+ * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
375
+ *
376
+ * // decorator factory as metadata-producing annotation.
377
+ * function MyAnnotation(options): PropertyDecorator {
378
+ * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
379
+ * }
380
+ * ```
381
+ *
382
+ */
383
+ static set(key: string, value: any, target: any, propertyKey?: string | symbol): void;
384
+ /**
385
+ * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
386
+ * @param targetPrototype
387
+ * @param propertyKey The property key for the target.
388
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
389
+ * @example
390
+ *
391
+ * ```typescript
392
+ * class Example {
393
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
394
+ * // static staticProperty;
395
+ * // property;
396
+ *
397
+ * static staticMethod(p) { }
398
+ * method(p) { }
399
+ * }
400
+ *
401
+ * // on contructor
402
+ * result = Metadata.getParamTypes(Example.prototype);
403
+ *
404
+ * // property (on constructor)
405
+ * result = Metadata.getParamTypes(Example.prototype, "staticProperty");
406
+ *
407
+ * // method (on constructor)
408
+ * result = Metadata.getParamTypes(Example.prototype, "staticMethod");
409
+ * ```
410
+ *
411
+ */
412
+ static getParamTypes(targetPrototype: any, propertyKey?: string | symbol): any[];
413
+ /**
414
+ * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
415
+ * @param target The target object on which the metadata is defined.
416
+ * @param propertyKey The property key for the target.
417
+ * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
418
+ * @example
419
+ *
420
+ * ```typescript
421
+ * class Example {
422
+ * // property declarations are not part of ES6, though they are valid in TypeScript:
423
+ * // static staticProperty;
424
+ * // property;
425
+ *
426
+ * static staticMethod(p) { }
427
+ * method(p) { }
428
+ * }
429
+ *
430
+ * // on contructor
431
+ * result = Metadata.getParamTypes(Example);
432
+ *
433
+ * // property (on constructor)
434
+ * result = Metadata.getParamTypes(Example, "staticProperty");
435
+ *
436
+ * // method (on constructor)
437
+ * result = Metadata.getParamTypes(Example, "staticMethod");
438
+ * ```
439
+ *
440
+ */
441
+ static getOwnParamTypes(target: any, propertyKey?: string | symbol): any[];
442
+ }