@dipscope/type-manager 3.0.0 → 4.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 +33 -0
- package/README.md +653 -119
- package/core/discriminant.d.ts +8 -0
- package/core/discriminator.d.ts +6 -0
- package/core/fn.d.ts +21 -11
- package/core/generic-argument.d.ts +1 -1
- package/core/generic-metadata.d.ts +1 -1
- package/core/index.d.ts +8 -0
- package/core/index.js +2 -2
- package/core/inject-index.d.ts +6 -0
- package/core/inject-metadata.d.ts +15 -14
- package/core/inject-options.d.ts +5 -5
- package/core/log.d.ts +6 -6
- package/core/metadata.d.ts +3 -3
- package/core/property-metadata.d.ts +24 -36
- package/core/property-name.d.ts +6 -0
- package/core/property-options.d.ts +58 -2
- package/core/serializer-context-options.d.ts +6 -6
- package/core/serializer-context.d.ts +65 -6
- package/core/type-abstraction.d.ts +8 -0
- package/core/type-argument.d.ts +2 -2
- package/core/type-ctor.d.ts +1 -1
- package/core/type-fn.d.ts +8 -0
- package/core/type-like.d.ts +1 -1
- package/core/type-metadata-symbol.d.ts +6 -0
- package/core/type-metadata.d.ts +118 -28
- package/core/type-name.d.ts +6 -0
- package/core/type-options-base.d.ts +15 -8
- package/core/type-options.d.ts +21 -5
- package/core/type-resolver.d.ts +2 -2
- package/discriminant.d.ts +11 -0
- package/discriminator.d.ts +11 -0
- package/factories/index.js +2 -2
- package/factory.d.ts +4 -4
- package/index.d.ts +3 -3
- package/index.js +2 -2
- package/inject.d.ts +3 -3
- package/injector.d.ts +3 -3
- package/injectors/index.js +2 -2
- package/naming-conventions/index.js +2 -2
- package/naming-conventions/pascal-case.naming-convention.d.ts +1 -1
- package/package.json +1 -1
- package/preserve-discriminator.d.ts +10 -0
- package/property.d.ts +3 -3
- package/reference-handlers/index.js +2 -2
- package/reference-handlers/path.reference-handler.d.ts +22 -6
- package/serializers/index.js +2 -2
- package/type-manager-options.d.ts +3 -3
- package/type-manager.d.ts +217 -46
- package/inject-artisan.d.ts +0 -20
- package/property-artisan.d.ts +0 -20
- package/type-artisan.d.ts +0 -95
package/type-manager.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Alias } from './core/alias';
|
|
2
|
+
import { TypeFn } from './core/type-fn';
|
|
2
3
|
import { TypeLike } from './core/type-like';
|
|
3
4
|
import { TypeMetadata } from './core/type-metadata';
|
|
4
5
|
import { TypeOptions } from './core/type-options';
|
|
@@ -11,107 +12,277 @@ import { TypeManagerOptions } from './type-manager-options';
|
|
|
11
12
|
*/
|
|
12
13
|
export declare class TypeManager<TType> {
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Static global options of any type.
|
|
16
|
+
*
|
|
17
|
+
* @type {TypeOptionsBase<any>}
|
|
18
|
+
*/
|
|
19
|
+
static readonly typeOptionsBase: TypeOptionsBase<any>;
|
|
20
|
+
/**
|
|
21
|
+
* Static type options per type.
|
|
22
|
+
*
|
|
23
|
+
* Overrides static global type options.
|
|
24
|
+
*
|
|
25
|
+
* @type {Map<TypeFn<any>, TypeOptions<any>>}
|
|
26
|
+
*/
|
|
27
|
+
static readonly typeOptionsMap: Map<TypeFn<any>, TypeOptions<any>>;
|
|
28
|
+
/**
|
|
29
|
+
* Static type function map for types with aliases.
|
|
30
|
+
*
|
|
31
|
+
* @type {Map<Alias, TypeFn<any>>}
|
|
32
|
+
*/
|
|
33
|
+
static readonly typeFnMap: Map<Alias, TypeFn<any>>;
|
|
34
|
+
/**
|
|
35
|
+
* Type function provided to the type manager.
|
|
36
|
+
*
|
|
37
|
+
* @type {TypeFn<TType>}
|
|
38
|
+
*/
|
|
39
|
+
readonly typeFn: TypeFn<TType>;
|
|
40
|
+
/**
|
|
41
|
+
* Type metadata for provided type function.
|
|
15
42
|
*
|
|
16
43
|
* @type {TypeMetadata<TType>}
|
|
17
44
|
*/
|
|
18
45
|
readonly typeMetadata: TypeMetadata<TType>;
|
|
19
46
|
/**
|
|
20
|
-
*
|
|
47
|
+
* Type manager options.
|
|
48
|
+
*
|
|
49
|
+
* @type {TypeManagerOptions}
|
|
50
|
+
*/
|
|
51
|
+
readonly typeManagerOptions: TypeManagerOptions;
|
|
52
|
+
/**
|
|
53
|
+
* Type options base of current instance.
|
|
54
|
+
*
|
|
55
|
+
* @type {TypeOptionsBase<any>}
|
|
56
|
+
*/
|
|
57
|
+
readonly typeOptionsBase: TypeOptionsBase<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Type options map of current instance.
|
|
60
|
+
*
|
|
61
|
+
* @type {Map<TypeFn<any>, TypeOptions<any>>}
|
|
62
|
+
*/
|
|
63
|
+
readonly typeOptionsMap: Map<TypeFn<any>, TypeOptions<any>>;
|
|
64
|
+
/**
|
|
65
|
+
* Type function map for types with aliases of current instance.
|
|
21
66
|
*
|
|
22
|
-
* @type {
|
|
67
|
+
* @type {Map<Alias, TypeFn<any>>}
|
|
23
68
|
*/
|
|
24
|
-
|
|
69
|
+
readonly typeFnMap: Map<Alias, TypeFn<any>>;
|
|
70
|
+
/**
|
|
71
|
+
* Type metadata map of current instance.
|
|
72
|
+
*
|
|
73
|
+
* @type {Map<TypeFn<any>, TypeMetadata<any>>}
|
|
74
|
+
*/
|
|
75
|
+
readonly typeMetadataMap: Map<TypeFn<any>, TypeMetadata<any>>;
|
|
25
76
|
/**
|
|
26
77
|
* Constructor.
|
|
27
78
|
*
|
|
28
|
-
*
|
|
79
|
+
* Creating an instance of type manager is a heavy operation as it preserves a configuration state.
|
|
80
|
+
* If you don't modify any of type manager options at runtime it is better to use static methods.
|
|
81
|
+
*
|
|
82
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
83
|
+
* @param {TypeManagerOptions} typeManagerOptions Type manager options.
|
|
29
84
|
*/
|
|
30
|
-
constructor(
|
|
85
|
+
constructor(typeFn: TypeFn<TType>, typeManagerOptions?: TypeManagerOptions);
|
|
31
86
|
/**
|
|
32
|
-
*
|
|
87
|
+
* Declares type metadata for provided type function based on general configuration.
|
|
33
88
|
*
|
|
34
|
-
* @param {
|
|
89
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
90
|
+
*
|
|
91
|
+
* @returns {TypeMetadata<TType>} Type metadata.
|
|
92
|
+
*/
|
|
93
|
+
private static declareTypeMetadata;
|
|
94
|
+
/**
|
|
95
|
+
* Defines type metadata for the type prototype.
|
|
96
|
+
*
|
|
97
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
98
|
+
* @param {TypeOptions<TType>} typeOptions Type options.
|
|
99
|
+
*
|
|
100
|
+
* @returns {TypeMetadata<TType>} Type metadata for provided type function.
|
|
101
|
+
*/
|
|
102
|
+
static defineTypeMetadata<TType>(typeFn: TypeFn<TType>, typeOptions?: TypeOptions<TType>): TypeMetadata<TType>;
|
|
103
|
+
/**
|
|
104
|
+
* Extracts type metadata from provided type function.
|
|
105
|
+
*
|
|
106
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
107
|
+
*
|
|
108
|
+
* @returns {TypeMetadata<TType>} Type metadata for provided type function.
|
|
109
|
+
*/
|
|
110
|
+
static extractTypeMetadata<TType>(typeFn: TypeFn<TType>): TypeMetadata<TType>;
|
|
111
|
+
/**
|
|
112
|
+
* Resolves type metadata by provided type argument.
|
|
35
113
|
*
|
|
36
|
-
* @
|
|
114
|
+
* @type {TypeMetadata<any>} Type metadata for provided type argument.
|
|
37
115
|
*/
|
|
38
|
-
static
|
|
116
|
+
private static resolveTypeMetadata;
|
|
39
117
|
/**
|
|
40
|
-
* Configures type options.
|
|
118
|
+
* Configures static global type options.
|
|
41
119
|
*
|
|
42
|
-
* @param {
|
|
43
|
-
* @param {TypeOptions<any>} typeOptions Type options.
|
|
120
|
+
* @param {Partial<TypeOptionsBase<TType>>} typeOptionsBase Type options base.
|
|
44
121
|
*
|
|
45
|
-
* @returns {
|
|
122
|
+
* @returns {typeof TypeManager} Static instance of type manager.
|
|
46
123
|
*/
|
|
47
|
-
static
|
|
124
|
+
static configureTypeOptionsBase<TType>(typeOptionsBase: Partial<TypeOptionsBase<TType>>): typeof TypeManager;
|
|
48
125
|
/**
|
|
49
|
-
* Configures type options
|
|
126
|
+
* Configures static type options.
|
|
50
127
|
*
|
|
51
|
-
* @param {
|
|
128
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
129
|
+
* @param {TypeOptions<TType>} typeOptions Type options.
|
|
52
130
|
*
|
|
53
|
-
* @returns {
|
|
131
|
+
* @returns {typeof TypeManager} Static instance of type manager.
|
|
54
132
|
*/
|
|
55
|
-
static
|
|
133
|
+
static configureTypeOptions<TType>(typeFn: TypeFn<TType>, typeOptions: TypeOptions<TType>): typeof TypeManager;
|
|
56
134
|
/**
|
|
57
|
-
* Configures type
|
|
135
|
+
* Configures static type options map.
|
|
136
|
+
*
|
|
137
|
+
* @param {Map<TypeFn<TType>, TypeOptions<TType>>} typeOptionsMap Type options map.
|
|
138
|
+
*
|
|
139
|
+
* @returns {typeof TypeManager} Static instance of type manager.
|
|
140
|
+
*/
|
|
141
|
+
static configureTypeOptionsMap<TType>(typeOptionsMap: Map<TypeFn<TType>, TypeOptions<TType>>): typeof TypeManager;
|
|
142
|
+
/**
|
|
143
|
+
* Configures type manager in static context.
|
|
58
144
|
*
|
|
59
145
|
* @param {TypeManagerOptions} typeManagerOptions Type manager options.
|
|
60
146
|
*
|
|
61
|
-
* @returns {
|
|
147
|
+
* @returns {typeof TypeManager} Static instance of type manager.
|
|
62
148
|
*/
|
|
63
|
-
static configure(typeManagerOptions: TypeManagerOptions):
|
|
149
|
+
static configure(typeManagerOptions: TypeManagerOptions): typeof TypeManager;
|
|
64
150
|
/**
|
|
65
|
-
*
|
|
151
|
+
* Defines serializer context for x in static context.
|
|
66
152
|
*
|
|
67
|
-
* @param {
|
|
153
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
154
|
+
* @param {any} x Some value.
|
|
155
|
+
* @param {Array<GenericArgument<any>>} genericArguments Generic arguments.
|
|
156
|
+
*
|
|
157
|
+
* @returns {SerializerContext<TType>} Serializer context.
|
|
158
|
+
*/
|
|
159
|
+
private static defineSerializerContext;
|
|
160
|
+
/**
|
|
161
|
+
* Serializes provided value based on the type function.
|
|
162
|
+
*
|
|
163
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
68
164
|
* @param {TypeLike<TType>} x Input value.
|
|
69
165
|
*
|
|
70
166
|
* @returns {TypeLike<any>} Object created from provided input value or undefined.
|
|
71
167
|
*/
|
|
72
|
-
static serialize<TType>(
|
|
73
|
-
static serialize<TType>(
|
|
74
|
-
static serialize<TType>(
|
|
75
|
-
static serialize<TType>(
|
|
168
|
+
static serialize<TType>(typeFn: TypeFn<TType>, x: undefined): undefined;
|
|
169
|
+
static serialize<TType>(typeFn: TypeFn<TType>, x: null): null;
|
|
170
|
+
static serialize<TType>(typeFn: TypeFn<TType>, x: Array<TType>): Array<any>;
|
|
171
|
+
static serialize<TType>(typeFn: TypeFn<TType>, x: TType): any;
|
|
76
172
|
/**
|
|
77
|
-
* Deserializes provided value based on the type
|
|
173
|
+
* Deserializes provided value based on the type function.
|
|
78
174
|
*
|
|
79
|
-
* @param {
|
|
175
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
80
176
|
* @param {TypeLike<any>} x Input value.
|
|
81
177
|
*
|
|
82
178
|
* @returns {TypeLike<TType>} Type created from provided input value or undefined.
|
|
83
179
|
*/
|
|
84
|
-
static deserialize<TType>(
|
|
85
|
-
static deserialize<TType>(
|
|
86
|
-
static deserialize<TType>(
|
|
87
|
-
static deserialize<TType>(
|
|
180
|
+
static deserialize<TType>(typeFn: TypeFn<TType>, x: undefined): undefined;
|
|
181
|
+
static deserialize<TType>(typeFn: TypeFn<TType>, x: null): null;
|
|
182
|
+
static deserialize<TType>(typeFn: TypeFn<TType>, x: Array<any>): Array<TType>;
|
|
183
|
+
static deserialize<TType>(typeFn: TypeFn<TType>, x: any): TType;
|
|
88
184
|
/**
|
|
89
185
|
* Converts provided value to a JavaScript Object Notation (JSON) string.
|
|
90
186
|
*
|
|
91
|
-
* @param {
|
|
187
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
92
188
|
* @param {any} x Input value, usually an object or array, to be converted.
|
|
93
|
-
* @param {Function|number
|
|
189
|
+
* @param {Function|Array<number>|Array<string>} replacer A function that transforms the results or an array of strings and numbers that acts as an approved list.
|
|
94
190
|
* @param {string|number} space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
95
191
|
*
|
|
96
192
|
* @returns {string} JSON string.
|
|
97
193
|
*/
|
|
98
|
-
static stringify<TType>(
|
|
194
|
+
static stringify<TType>(typeFn: TypeFn<TType>, x: any, replacer?: (this: any, key: string, value: any) => any | Array<number> | Array<string> | null, space?: string | number): string;
|
|
99
195
|
/**
|
|
100
196
|
* Converts a JavaScript Object Notation (JSON) string into a type.
|
|
101
197
|
*
|
|
102
|
-
* @param {
|
|
198
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
103
199
|
* @param {string} x A valid JSON string.
|
|
104
200
|
* @param {Function} reviver A function that transforms the results. This function is called for each member of the object.
|
|
105
201
|
*
|
|
106
202
|
* @returns {TypeLike<TType>} Type created from provided input value or undefined.
|
|
107
203
|
*/
|
|
108
|
-
static parse<TType>(
|
|
204
|
+
static parse<TType>(typeFn: TypeFn<TType>, x: string, reviver?: (this: any, key: string, value: any) => any): TypeLike<TType>;
|
|
205
|
+
/**
|
|
206
|
+
* Declares type metadata for provided type function.
|
|
207
|
+
*
|
|
208
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
209
|
+
*
|
|
210
|
+
* @returns {TypeMetadata<TType>} Type metadata.
|
|
211
|
+
*/
|
|
212
|
+
private declareTypeMetadata;
|
|
213
|
+
/**
|
|
214
|
+
* Defines type metadata in the type metadata map.
|
|
215
|
+
*
|
|
216
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
217
|
+
* @param {TypeOptions<TType>} typeOptions Type options.
|
|
218
|
+
*
|
|
219
|
+
* @returns {TypeMetadata<TType>} Type metadata for provided type function.
|
|
220
|
+
*/
|
|
221
|
+
defineTypeMetadata<TType>(typeFn: TypeFn<TType>, typeOptions?: TypeOptions<TType>): TypeMetadata<TType>;
|
|
222
|
+
/**
|
|
223
|
+
* Extracts type metadata from provided type function.
|
|
224
|
+
*
|
|
225
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
226
|
+
*
|
|
227
|
+
* @returns {TypeMetadata<TType>} Type metadata for provided type function.
|
|
228
|
+
*/
|
|
229
|
+
extractTypeMetadata<TType>(typeFn: TypeFn<TType>): TypeMetadata<TType>;
|
|
230
|
+
/**
|
|
231
|
+
* Resolves type metadata by provided type argument.
|
|
232
|
+
*
|
|
233
|
+
* @type {TypeMetadata<any>} Type metadata for provided type argument.
|
|
234
|
+
*/
|
|
235
|
+
private resolveTypeMetadata;
|
|
236
|
+
/**
|
|
237
|
+
* Configures instance global type options.
|
|
238
|
+
*
|
|
239
|
+
* @param {Partial<TypeOptionsBase<any>>} typeOptionsBase Type options base.
|
|
240
|
+
*
|
|
241
|
+
* @returns {TypeManager<TType>} Current instance of type manager.
|
|
242
|
+
*/
|
|
243
|
+
configureTypeOptionsBase(typeOptionsBase: Partial<TypeOptionsBase<any>>): TypeManager<TType>;
|
|
244
|
+
/**
|
|
245
|
+
* Configures instance type options.
|
|
246
|
+
*
|
|
247
|
+
* @param {TypeFn<TType>} typeFn Type function.
|
|
248
|
+
* @param {TypeOptions<TType>} typeOptions Type options.
|
|
249
|
+
*
|
|
250
|
+
* @returns {TypeManager<TType>} Current instance of type manager.
|
|
251
|
+
*/
|
|
252
|
+
configureTypeOptions(typeFn: TypeFn<any>, typeOptions: TypeOptions<any>): TypeManager<TType>;
|
|
253
|
+
/**
|
|
254
|
+
* Configures instance type options map.
|
|
255
|
+
*
|
|
256
|
+
* @param {Map<TypeFn<TType>, TypeOptions<TType>>} typeOptionsMap Type options map.
|
|
257
|
+
*
|
|
258
|
+
* @returns {TypeManager<TType>} Current instance of type manager.
|
|
259
|
+
*/
|
|
260
|
+
configureTypeOptionsMap(typeOptionsMap: Map<TypeFn<any>, TypeOptions<any>>): TypeManager<TType>;
|
|
261
|
+
/**
|
|
262
|
+
* Configures type manager.
|
|
263
|
+
*
|
|
264
|
+
* @param {TypeManagerOptions} typeManagerOptions Type manager options.
|
|
265
|
+
*
|
|
266
|
+
* @returns {TypeManager<TType>} Current instance of type manager.
|
|
267
|
+
*/
|
|
268
|
+
configure(typeManagerOptions: TypeManagerOptions): TypeManager<TType>;
|
|
269
|
+
/**
|
|
270
|
+
* Builds type options base for the current instance.
|
|
271
|
+
*
|
|
272
|
+
* @returns {TypeOptionsBase<any>} Type options base.
|
|
273
|
+
*/
|
|
274
|
+
private buildTypeOptionsBase;
|
|
275
|
+
/**
|
|
276
|
+
* Builds type options map of the current instance.
|
|
277
|
+
*
|
|
278
|
+
* @returns {Map<TypeFn<any>, TypeOptions<any>>} Type options map.
|
|
279
|
+
*/
|
|
280
|
+
private buildTypeOptionsMap;
|
|
109
281
|
/**
|
|
110
282
|
* Defines serializer context for x.
|
|
111
283
|
*
|
|
112
284
|
* @param {any} x Some value.
|
|
113
|
-
* @param {
|
|
114
|
-
* @param {GenericArgument<any>[]} genericArguments Generic arguments.
|
|
285
|
+
* @param {Array<GenericArgument<any>>} genericArguments Generic arguments.
|
|
115
286
|
*
|
|
116
287
|
* @returns {SerializerContext<any>} Serializer context.
|
|
117
288
|
*/
|
|
@@ -125,7 +296,7 @@ export declare class TypeManager<TType> {
|
|
|
125
296
|
*/
|
|
126
297
|
serialize(x: undefined): undefined;
|
|
127
298
|
serialize(x: null): null;
|
|
128
|
-
serialize(x: TType
|
|
299
|
+
serialize(x: Array<TType>): Array<any>;
|
|
129
300
|
serialize(x: TType): any;
|
|
130
301
|
/**
|
|
131
302
|
* Deserializes provided value.
|
|
@@ -136,18 +307,18 @@ export declare class TypeManager<TType> {
|
|
|
136
307
|
*/
|
|
137
308
|
deserialize(x: undefined): undefined;
|
|
138
309
|
deserialize(x: null): null;
|
|
139
|
-
deserialize(x: any
|
|
310
|
+
deserialize(x: Array<any>): Array<TType>;
|
|
140
311
|
deserialize(x: any): TType;
|
|
141
312
|
/**
|
|
142
313
|
* Converts provided value to a JavaScript Object Notation (JSON) string.
|
|
143
314
|
*
|
|
144
315
|
* @param {any} x Input value, usually an object or array, to be converted.
|
|
145
|
-
* @param {Function|number
|
|
316
|
+
* @param {Function|Array<number>|Array<string>} replacer A function that transforms the results or an array of strings and numbers that acts as an approved list.
|
|
146
317
|
* @param {string|number} space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
|
|
147
318
|
*
|
|
148
319
|
* @returns {string} JSON string.
|
|
149
320
|
*/
|
|
150
|
-
stringify(x: any, replacer?: (this: any, key: string, value: any) => any | number
|
|
321
|
+
stringify(x: any, replacer?: (this: any, key: string, value: any) => any | Array<number> | Array<string> | null, space?: string | number): string;
|
|
151
322
|
/**
|
|
152
323
|
* Converts a JavaScript Object Notation (JSON) string into a type.
|
|
153
324
|
*
|
package/inject-artisan.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { InjectMetadata } from './core/inject-metadata';
|
|
2
|
-
import { InjectOptions } from './core/inject-options';
|
|
3
|
-
import { TypeCtor } from './core/type-ctor';
|
|
4
|
-
/**
|
|
5
|
-
* Inject artisan class to encapsulate injection manipulating functions.
|
|
6
|
-
*
|
|
7
|
-
* @type {InjectArtisan}
|
|
8
|
-
*/
|
|
9
|
-
export declare class InjectArtisan {
|
|
10
|
-
/**
|
|
11
|
-
* Defines inject metadata for a certain type constructor.
|
|
12
|
-
*
|
|
13
|
-
* @param {TypeCtor<TDeclaringType>} declaringTypeCtor Declaring type constructor function.
|
|
14
|
-
* @param {number} injectIndex Inject index.
|
|
15
|
-
* @param {InjectOptions<TType>} injectOptions Inject options.
|
|
16
|
-
*
|
|
17
|
-
* @returns {InjectMetadata<TDeclaringType, TType>} Inject metadata for provided type constructor.
|
|
18
|
-
*/
|
|
19
|
-
static defineInjectMetadata<TDeclaringType, TType>(declaringTypeCtor: TypeCtor<TDeclaringType>, injectIndex: number, injectOptions: InjectOptions<TType>): InjectMetadata<TDeclaringType, TType>;
|
|
20
|
-
}
|
package/property-artisan.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PropertyMetadata } from './core/property-metadata';
|
|
2
|
-
import { PropertyOptions } from './core/property-options';
|
|
3
|
-
import { TypeCtor } from './core/type-ctor';
|
|
4
|
-
/**
|
|
5
|
-
* Property artisan class to encapsulate property manipulating functions.
|
|
6
|
-
*
|
|
7
|
-
* @type {PropertyArtisan}
|
|
8
|
-
*/
|
|
9
|
-
export declare class PropertyArtisan {
|
|
10
|
-
/**
|
|
11
|
-
* Defines property metadata for a certain type constructor.
|
|
12
|
-
*
|
|
13
|
-
* @param {TypeCtor<TDeclaringType>} declaringTypeCtor Declaring type constructor function.
|
|
14
|
-
* @param {string} propertyName Property name.
|
|
15
|
-
* @param {PropertyOptions<TType>} propertyOptions Property options.
|
|
16
|
-
*
|
|
17
|
-
* @returns {PropertyMetadata<TDeclaringType, TType>} Property metadata for provided type constructor.
|
|
18
|
-
*/
|
|
19
|
-
static definePropertyMetadata<TDeclaringType, TType>(declaringTypeCtor: TypeCtor<TDeclaringType>, propertyName: string, propertyOptions: PropertyOptions<TType>): PropertyMetadata<TDeclaringType, TType>;
|
|
20
|
-
}
|
package/type-artisan.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Alias } from './core/alias';
|
|
2
|
-
import { TypeArgument } from './core/type-argument';
|
|
3
|
-
import { TypeCtor } from './core/type-ctor';
|
|
4
|
-
import { TypeMetadata } from './core/type-metadata';
|
|
5
|
-
import { TypeOptions } from './core/type-options';
|
|
6
|
-
import { TypeOptionsBase } from './core/type-options-base';
|
|
7
|
-
/**
|
|
8
|
-
* Type artisan class to encapsulate type manipulating functions.
|
|
9
|
-
*
|
|
10
|
-
* @type {TypeArtisan}
|
|
11
|
-
*/
|
|
12
|
-
export declare class TypeArtisan {
|
|
13
|
-
/**
|
|
14
|
-
* Type metadata key which is used to store data in prototypes.
|
|
15
|
-
*
|
|
16
|
-
* @type {string}
|
|
17
|
-
*/
|
|
18
|
-
static readonly typeMetadataKey: string;
|
|
19
|
-
/**
|
|
20
|
-
* Global options of any type.
|
|
21
|
-
*
|
|
22
|
-
* @type {TypeOptionsBase<any>}
|
|
23
|
-
*/
|
|
24
|
-
static readonly typeOptionsBase: TypeOptionsBase<any>;
|
|
25
|
-
/**
|
|
26
|
-
* Type options per type.
|
|
27
|
-
*
|
|
28
|
-
* Overrides global type options.
|
|
29
|
-
*
|
|
30
|
-
* @type {Map<TypeCtor<any>, TypeOptions<any>>}
|
|
31
|
-
*/
|
|
32
|
-
static readonly typeOptionsMap: Map<TypeCtor<any>, TypeOptions<any>>;
|
|
33
|
-
/**
|
|
34
|
-
* Type constructor map for types with aliases.
|
|
35
|
-
*
|
|
36
|
-
* @type {Map<Alias, TypeCtor<any>>}
|
|
37
|
-
*/
|
|
38
|
-
static readonly typeCtorMap: Map<Alias, TypeCtor<any>>;
|
|
39
|
-
/**
|
|
40
|
-
* Configures global type options.
|
|
41
|
-
*
|
|
42
|
-
* @param {Partial<TypeOptionsBase<TType>>} typeOptionsBase Type options base.
|
|
43
|
-
*
|
|
44
|
-
* @returns {void}
|
|
45
|
-
*/
|
|
46
|
-
static configureTypeOptionsBase<TType>(typeOptionsBase: Partial<TypeOptionsBase<TType>>): void;
|
|
47
|
-
/**
|
|
48
|
-
* Configures type options.
|
|
49
|
-
*
|
|
50
|
-
* @param {TypeCtor<TType>} typeCtor Type constructor function.
|
|
51
|
-
* @param {TypeOptions<TType>} typeOptions Type options.
|
|
52
|
-
*
|
|
53
|
-
* @returns {void}
|
|
54
|
-
*/
|
|
55
|
-
static configureTypeOptions<TType>(typeCtor: TypeCtor<TType>, typeOptions: TypeOptions<TType>): void;
|
|
56
|
-
/**
|
|
57
|
-
* Configures type options per type.
|
|
58
|
-
*
|
|
59
|
-
* @param {Map<TypeCtor<TType>, TypeOptions<TType>>} typeOptionsMap Type options map.
|
|
60
|
-
*
|
|
61
|
-
* @returns {void}
|
|
62
|
-
*/
|
|
63
|
-
static configureTypeOptionsMap<TType>(typeOptionsMap: Map<TypeCtor<TType>, TypeOptions<TType>>): void;
|
|
64
|
-
/**
|
|
65
|
-
* Declares type metadata for provided type constructor based on general configuration.
|
|
66
|
-
*
|
|
67
|
-
* @param {TypeCtor<TType>} typeCtor Type constructor function.
|
|
68
|
-
*
|
|
69
|
-
* @returns {TypeMetadata<TType>} Type metadata.
|
|
70
|
-
*/
|
|
71
|
-
static declareTypeMetadata<TType>(typeCtor: TypeCtor<TType>): TypeMetadata<TType>;
|
|
72
|
-
/**
|
|
73
|
-
* Defines type metadata for the type prototype.
|
|
74
|
-
*
|
|
75
|
-
* @param {TypeCtor<TType>} typeCtor Type constructor function.
|
|
76
|
-
* @param {TypeOptions<TType>} typeOptions Type options.
|
|
77
|
-
*
|
|
78
|
-
* @returns {TypeMetadata<TType>} Type metadata for provided type constructor.
|
|
79
|
-
*/
|
|
80
|
-
static defineTypeMetadata<TType>(typeCtor: TypeCtor<TType>, typeOptions?: TypeOptions<TType>): TypeMetadata<TType>;
|
|
81
|
-
/**
|
|
82
|
-
* Extracts type metadata from provided type constructor.
|
|
83
|
-
*
|
|
84
|
-
* @param {TypeCtor<TType>} typeCtor Type constructor function.
|
|
85
|
-
*
|
|
86
|
-
* @returns {TypeMetadata<TType>} Type metadata for provided type constructor.
|
|
87
|
-
*/
|
|
88
|
-
static extractTypeMetadata<TType>(typeCtor: TypeCtor<TType>): TypeMetadata<TType>;
|
|
89
|
-
/**
|
|
90
|
-
* Resolves type metadata by provided type argument.
|
|
91
|
-
*
|
|
92
|
-
* @type {TypeMetadata<any>} Type metadata for provided type argument.
|
|
93
|
-
*/
|
|
94
|
-
static resolveTypeMetadata<TType>(typeArgument: TypeArgument<TType>): TypeMetadata<TType>;
|
|
95
|
-
}
|