@dipscope/type-manager 4.1.1 → 5.0.0-beta.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 (142) hide show
  1. package/CHANGELOG.md +222 -197
  2. package/LICENSE.md +201 -201
  3. package/README.md +1827 -2037
  4. package/alias.d.ts +6 -10
  5. package/custom-data.d.ts +6 -11
  6. package/{core/default-value-resolver.d.ts → default-value-resolver.d.ts} +7 -7
  7. package/default-value.d.ts +7 -11
  8. package/discriminant.d.ts +8 -11
  9. package/discriminator.d.ts +6 -11
  10. package/factories/index.d.ts +1 -1
  11. package/factories/type-factory.d.ts +19 -19
  12. package/factory.d.ts +18 -11
  13. package/functions/get-own-reflect-metadata.d.ts +9 -0
  14. package/functions/get-reflect-metadata.d.ts +10 -0
  15. package/functions/get-words.d.ts +8 -0
  16. package/functions/index.d.ts +16 -0
  17. package/functions/is-arrow-function.d.ts +8 -0
  18. package/functions/is-ctor-function.d.ts +8 -0
  19. package/functions/is-data-view.d.ts +8 -0
  20. package/functions/is-float-32-array.d.ts +8 -0
  21. package/functions/is-float-64-array.d.ts +8 -0
  22. package/functions/is-int-16-array.d.ts +8 -0
  23. package/functions/is-int-32-array.d.ts +8 -0
  24. package/functions/is-int-8-array.d.ts +8 -0
  25. package/functions/is-uint-16-array.d.ts +8 -0
  26. package/functions/is-uint-32-array.d.ts +8 -0
  27. package/functions/is-uint-8-array.d.ts +8 -0
  28. package/functions/is-uint-8-clamped-array.d.ts +8 -0
  29. package/functions/name-of.d.ts +8 -0
  30. package/{core/generic-argument.d.ts → generic-argument.d.ts} +7 -7
  31. package/{core/generic-metadata.d.ts → generic-metadata.d.ts} +7 -7
  32. package/index.d.ts +54 -24
  33. package/index.js +1 -2
  34. package/{core/inject-index.d.ts → inject-index.d.ts} +6 -6
  35. package/{core/inject-metadata.d.ts → inject-metadata.d.ts} +72 -72
  36. package/{core/inject-options.d.ts → inject-options.d.ts} +22 -22
  37. package/inject.d.ts +10 -10
  38. package/injector.d.ts +16 -11
  39. package/injectors/index.d.ts +1 -1
  40. package/injectors/singleton-injector.d.ts +31 -31
  41. package/{core/log-level.d.ts → log-level.d.ts} +11 -11
  42. package/{core/log.d.ts → log.d.ts} +95 -65
  43. package/{core/metadata.d.ts → metadata.d.ts} +42 -42
  44. package/naming-convention.d.ts +15 -11
  45. package/naming-conventions/camel-case-naming-convention.d.ts +26 -26
  46. package/naming-conventions/flat-case-naming-convention.d.ts +25 -25
  47. package/naming-conventions/flat-upper-case-naming-convention.d.ts +25 -25
  48. package/naming-conventions/index.d.ts +8 -8
  49. package/naming-conventions/kebab-case-naming-convention.d.ts +26 -26
  50. package/naming-conventions/kebab-upper-case-naming-convention.d.ts +26 -26
  51. package/naming-conventions/pascal-case-naming-convention.d.ts +26 -26
  52. package/naming-conventions/snake-case-naming-convention.d.ts +26 -26
  53. package/naming-conventions/snake-upper-case-naming-convention.d.ts +26 -26
  54. package/package.json +51 -48
  55. package/{core/property-metadata.d.ts → property-metadata.d.ts} +178 -178
  56. package/{core/property-name.d.ts → property-name.d.ts} +6 -6
  57. package/{core/property-options.d.ts → property-options.d.ts} +109 -100
  58. package/property.d.ts +13 -12
  59. package/{core/reference-callback.d.ts → reference-callback.d.ts} +7 -7
  60. package/reference-handler.d.ts +32 -11
  61. package/reference-handlers/direct-reference-handler.d.ts +33 -33
  62. package/reference-handlers/index.d.ts +3 -3
  63. package/reference-handlers/lead-reference-handler.d.ts +34 -34
  64. package/reference-handlers/path-reference-handler.d.ts +56 -56
  65. package/{core/reference-key.d.ts → reference-key.d.ts} +6 -6
  66. package/{core/reference-value-initializer.d.ts → reference-value-initializer.d.ts} +8 -8
  67. package/{core/reference-value-resolver.d.ts → reference-value-resolver.d.ts} +8 -8
  68. package/{core/reference-value.d.ts → reference-value.d.ts} +6 -6
  69. package/{core/serializer-context-options.d.ts → serializer-context-options.d.ts} +63 -63
  70. package/{core/serializer-context.d.ts → serializer-context.d.ts} +296 -296
  71. package/serializer.d.ts +27 -11
  72. package/serializers/array-buffer-serializer.d.ts +28 -28
  73. package/serializers/array-serializer.d.ts +28 -28
  74. package/serializers/boolean-serializer.d.ts +37 -37
  75. package/serializers/data-view-serializer.d.ts +28 -28
  76. package/serializers/date-serializer.d.ts +28 -28
  77. package/serializers/float-32-array-serializer.d.ts +28 -28
  78. package/serializers/float-64-array-serializer.d.ts +28 -28
  79. package/serializers/index.d.ts +19 -19
  80. package/serializers/int-16-array-serializer.d.ts +28 -28
  81. package/serializers/int-32-array-serializer.d.ts +28 -28
  82. package/serializers/int-8-array-serializer.d.ts +28 -28
  83. package/serializers/map-serializer.d.ts +28 -28
  84. package/serializers/number-serializer.d.ts +37 -37
  85. package/serializers/set-serializer.d.ts +28 -28
  86. package/serializers/string-serializer.d.ts +37 -37
  87. package/serializers/type-serializer.d.ts +28 -28
  88. package/serializers/uint-16-array-serializer.d.ts +28 -28
  89. package/serializers/uint-32-array-serializer.d.ts +28 -28
  90. package/serializers/uint-8-array-serializer.d.ts +28 -28
  91. package/serializers/uint-8-clamped-array-serializer.d.ts +28 -28
  92. package/{core/type-abstraction.d.ts → type-abstraction.d.ts} +8 -8
  93. package/{core/type-argument.d.ts → type-argument.d.ts} +9 -9
  94. package/{core/type-context-entry.d.ts → type-context-entry.d.ts} +36 -36
  95. package/{core/type-context.d.ts → type-context.d.ts} +58 -58
  96. package/{core/type-ctor.d.ts → type-ctor.d.ts} +6 -6
  97. package/{core/type-fn.d.ts → type-fn.d.ts} +8 -8
  98. package/{core/type-like.d.ts → type-like.d.ts} +7 -7
  99. package/type-manager-options.d.ts +24 -24
  100. package/type-manager.d.ts +331 -331
  101. package/{core/type-metadata-resolver.d.ts → type-metadata-resolver.d.ts} +8 -8
  102. package/{core/type-metadata-symbol.d.ts → type-metadata-symbol.d.ts} +6 -6
  103. package/{core/type-metadata.d.ts → type-metadata.d.ts} +304 -304
  104. package/{core/type-name.d.ts → type-name.d.ts} +6 -6
  105. package/{core/type-options-base.d.ts → type-options-base.d.ts} +83 -100
  106. package/{core/type-options.d.ts → type-options.d.ts} +79 -53
  107. package/{core/type-resolver.d.ts → type-resolver.d.ts} +7 -7
  108. package/type.d.ts +9 -9
  109. package/core/alias.d.ts +0 -6
  110. package/core/custom-data.d.ts +0 -6
  111. package/core/default-value.d.ts +0 -7
  112. package/core/discriminant.d.ts +0 -8
  113. package/core/discriminator.d.ts +0 -6
  114. package/core/factory.d.ts +0 -18
  115. package/core/fn.d.ts +0 -316
  116. package/core/index.d.ts +0 -44
  117. package/core/index.js +0 -2
  118. package/core/index.js.map +0 -1
  119. package/core/injector.d.ts +0 -16
  120. package/core/naming-convention.d.ts +0 -15
  121. package/core/reference-handler.d.ts +0 -32
  122. package/core/serializer.d.ts +0 -27
  123. package/deserializable.d.ts +0 -11
  124. package/deserialized-default-value.d.ts +0 -11
  125. package/factories/index.js +0 -2
  126. package/factories/index.js.map +0 -1
  127. package/index.js.map +0 -1
  128. package/injectable.d.ts +0 -10
  129. package/injectors/index.js +0 -2
  130. package/injectors/index.js.map +0 -1
  131. package/naming-conventions/index.js +0 -2
  132. package/naming-conventions/index.js.map +0 -1
  133. package/preserve-discriminator.d.ts +0 -10
  134. package/reference-handlers/index.js +0 -2
  135. package/reference-handlers/index.js.map +0 -1
  136. package/serializable.d.ts +0 -11
  137. package/serialized-default-value.d.ts +0 -11
  138. package/serializers/index.js +0 -2
  139. package/serializers/index.js.map +0 -1
  140. package/type-and-property.d.ts +0 -12
  141. package/use-default-value.d.ts +0 -10
  142. package/use-implicit-conversion.d.ts +0 -10
@@ -1,100 +1,83 @@
1
- import { CustomData } from './custom-data';
2
- import { DefaultValue } from './default-value';
3
- import { Discriminator } from './discriminator';
4
- import { Factory } from './factory';
5
- import { Injector } from './injector';
6
- import { Log } from './log';
7
- import { NamingConvention } from './naming-convention';
8
- import { ReferenceHandler } from './reference-handler';
9
- import { Serializer } from './serializer';
10
- /**
11
- * Type options base interface.
12
- *
13
- * @type {TypeOptionsBase<TType>}
14
- */
15
- export interface TypeOptionsBase<TType> {
16
- /**
17
- * Custom developer data.
18
- *
19
- * @type {CustomData}
20
- */
21
- customData?: CustomData;
22
- /**
23
- * Discriminator.
24
- *
25
- * @type {Discriminator}
26
- */
27
- discriminator: Discriminator;
28
- /**
29
- * Serialized default value for undefined ones.
30
- *
31
- * Used only when use default value option is true.
32
- *
33
- * @type {DefaultValue}
34
- */
35
- serializedDefaultValue?: DefaultValue;
36
- /**
37
- * Deserialized default value for undefined ones.
38
- *
39
- * Used only when use default value option is true.
40
- *
41
- * @type {DefaultValue}
42
- */
43
- deserializedDefaultValue?: DefaultValue;
44
- /**
45
- * Factory used to build instances of type.
46
- *
47
- * @type {Factory}
48
- */
49
- factory: Factory;
50
- /**
51
- * Injector used to resolve types.
52
- *
53
- * @type {Injector}
54
- */
55
- injector: Injector;
56
- /**
57
- * Log instance with specified log level.
58
- *
59
- * @type {Log}
60
- */
61
- log: Log;
62
- /**
63
- * Naming convention.
64
- *
65
- * @type {NamingConvention}
66
- */
67
- namingConvention?: NamingConvention;
68
- /**
69
- * Preserve discriminator in object during serialization
70
- * and deserialization?
71
- *
72
- * @type {boolean}
73
- */
74
- preserveDiscriminator: boolean;
75
- /**
76
- * Reference handler.
77
- *
78
- * @type {ReferenceHandler}
79
- */
80
- referenceHandler: ReferenceHandler;
81
- /**
82
- * Serializer used to serialize and deserialize a type.
83
- *
84
- * @type {Serializer<TType>}
85
- */
86
- serializer: Serializer<TType>;
87
- /**
88
- * Use default value assignment for undefined values?
89
- *
90
- * @type {boolean}
91
- */
92
- useDefaultValue: boolean;
93
- /**
94
- * Use implicit conversion when provided value can be converted
95
- * to the target one?
96
- *
97
- * @type {boolean}
98
- */
99
- useImplicitConversion: boolean;
100
- }
1
+ import { CustomData } from './custom-data';
2
+ import { Discriminator } from './discriminator';
3
+ import { Factory } from './factory';
4
+ import { Injector } from './injector';
5
+ import { Log } from './log';
6
+ import { NamingConvention } from './naming-convention';
7
+ import { ReferenceHandler } from './reference-handler';
8
+ import { Serializer } from './serializer';
9
+ /**
10
+ * Type options base interface.
11
+ *
12
+ * @type {TypeOptionsBase<TType>}
13
+ */
14
+ export interface TypeOptionsBase<TType> {
15
+ /**
16
+ * Custom developer data.
17
+ *
18
+ * @type {CustomData}
19
+ */
20
+ customData?: CustomData;
21
+ /**
22
+ * Discriminator.
23
+ *
24
+ * @type {Discriminator}
25
+ */
26
+ discriminator: Discriminator;
27
+ /**
28
+ * Factory used to build instances of type.
29
+ *
30
+ * @type {Factory}
31
+ */
32
+ factory: Factory;
33
+ /**
34
+ * Injector used to resolve types.
35
+ *
36
+ * @type {Injector}
37
+ */
38
+ injector: Injector;
39
+ /**
40
+ * Log instance with specified log level.
41
+ *
42
+ * @type {Log}
43
+ */
44
+ log: Log;
45
+ /**
46
+ * Naming convention.
47
+ *
48
+ * @type {NamingConvention}
49
+ */
50
+ namingConvention?: NamingConvention;
51
+ /**
52
+ * Preserve discriminator in object during serialization
53
+ * and deserialization?
54
+ *
55
+ * @type {boolean}
56
+ */
57
+ preserveDiscriminator: boolean;
58
+ /**
59
+ * Reference handler.
60
+ *
61
+ * @type {ReferenceHandler}
62
+ */
63
+ referenceHandler: ReferenceHandler;
64
+ /**
65
+ * Serializer used to serialize and deserialize a type.
66
+ *
67
+ * @type {Serializer<TType>}
68
+ */
69
+ serializer: Serializer<TType>;
70
+ /**
71
+ * Use default value assignment for undefined values?
72
+ *
73
+ * @type {boolean}
74
+ */
75
+ useDefaultValue: boolean;
76
+ /**
77
+ * Use implicit conversion when provided value can be converted
78
+ * to the target one?
79
+ *
80
+ * @type {boolean}
81
+ */
82
+ useImplicitConversion: boolean;
83
+ }
@@ -1,53 +1,79 @@
1
- import { Alias } from './alias';
2
- import { Discriminant } from './discriminant';
3
- import { GenericArgument } from './generic-argument';
4
- import { InjectIndex } from './inject-index';
5
- import { InjectOptions } from './inject-options';
6
- import { PropertyName } from './property-name';
7
- import { PropertyOptions } from './property-options';
8
- import { TypeOptionsBase } from './type-options-base';
9
- /**
10
- * Type options interface.
11
- *
12
- * @type {TypeOptions<TType>}
13
- */
14
- export interface TypeOptions<TType> extends Partial<TypeOptionsBase<TType>> {
15
- /**
16
- * Type alias.
17
- *
18
- * Can be used to resolve a type at runtime instead of type resolver function.
19
- *
20
- * @type {Alias}
21
- */
22
- alias?: Alias;
23
- /**
24
- * Discriminant.
25
- *
26
- * @type {Discriminant}
27
- */
28
- discriminant?: Discriminant;
29
- /**
30
- * Generic arguments.
31
- *
32
- * @type {Array<GenericArgument<any>>}
33
- */
34
- genericArguments?: Array<GenericArgument<any>>;
35
- /**
36
- * Injectable type?
37
- *
38
- * @type {boolean}
39
- */
40
- injectable?: boolean;
41
- /**
42
- * Inject options related to this type.
43
- *
44
- * @type {Map<InjectIndex, InjectOptions<any>>}
45
- */
46
- injectOptionsMap?: Map<InjectIndex, InjectOptions<any>>;
47
- /**
48
- * Property options related to this type. Map key is a property name.
49
- *
50
- * @type {Map<PropertyName, PropertyOptions<any>>}
51
- */
52
- propertyOptionsMap?: Map<PropertyName, PropertyOptions<any>>;
53
- }
1
+ import { Alias } from './alias';
2
+ import { DefaultValue } from './default-value';
3
+ import { Discriminant } from './discriminant';
4
+ import { GenericArgument } from './generic-argument';
5
+ import { InjectIndex } from './inject-index';
6
+ import { InjectOptions } from './inject-options';
7
+ import { PropertyName } from './property-name';
8
+ import { PropertyOptions } from './property-options';
9
+ import { TypeOptionsBase } from './type-options-base';
10
+ /**
11
+ * Type options interface.
12
+ *
13
+ * @type {TypeOptions<TType>}
14
+ */
15
+ export interface TypeOptions<TType> extends Partial<TypeOptionsBase<TType>> {
16
+ /**
17
+ * Type alias.
18
+ *
19
+ * Can be used to resolve a type at runtime instead of type resolver function.
20
+ *
21
+ * @type {Alias}
22
+ */
23
+ alias?: Alias;
24
+ /**
25
+ * Default value for undefined ones.
26
+ *
27
+ * Used to set both serialized and deserialized default values and
28
+ * only when use default value option is true.
29
+ *
30
+ * @type {DefaultValue}
31
+ */
32
+ defaultValue?: DefaultValue;
33
+ /**
34
+ * Serialized default value for undefined ones.
35
+ *
36
+ * Used only when use default value option is true.
37
+ *
38
+ * @type {DefaultValue}
39
+ */
40
+ serializedDefaultValue?: DefaultValue;
41
+ /**
42
+ * Deserialized default value for undefined ones.
43
+ *
44
+ * Used only when use default value option is true.
45
+ *
46
+ * @type {DefaultValue}
47
+ */
48
+ deserializedDefaultValue?: DefaultValue;
49
+ /**
50
+ * Discriminant.
51
+ *
52
+ * @type {Discriminant}
53
+ */
54
+ discriminant?: Discriminant;
55
+ /**
56
+ * Generic arguments.
57
+ *
58
+ * @type {Array<GenericArgument<any>>}
59
+ */
60
+ genericArguments?: Array<GenericArgument<any>>;
61
+ /**
62
+ * Injectable type?
63
+ *
64
+ * @type {boolean}
65
+ */
66
+ injectable?: boolean;
67
+ /**
68
+ * Inject options related to this type.
69
+ *
70
+ * @type {Map<InjectIndex, InjectOptions<any>>}
71
+ */
72
+ injectOptionsMap?: Map<InjectIndex, InjectOptions<any>>;
73
+ /**
74
+ * Property options related to this type. Map key is a property name.
75
+ *
76
+ * @type {Map<PropertyName, PropertyOptions<any>>}
77
+ */
78
+ propertyOptionsMap?: Map<PropertyName, PropertyOptions<any>>;
79
+ }
@@ -1,7 +1,7 @@
1
- import { TypeFn } from './type-fn';
2
- /**
3
- * Type resolver.
4
- *
5
- * @type {TypeResolver<TType>}
6
- */
7
- export declare type TypeResolver<TType> = () => TypeFn<TType>;
1
+ import { TypeFn } from './type-fn';
2
+ /**
3
+ * Type resolver.
4
+ *
5
+ * @type {TypeResolver<TType>}
6
+ */
7
+ export declare type TypeResolver<TType> = () => TypeFn<TType>;
package/type.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { TypeOptions } from './core/type-options';
2
- /**
3
- * Type decorator.
4
- *
5
- * @param {TypeOptions<TType>} typeOptions Type options.
6
- *
7
- * @returns {ClassDecorator} Class decorator.
8
- */
9
- export declare function Type<TType>(typeOptions?: TypeOptions<TType>): ClassDecorator;
1
+ import { TypeOptions } from './type-options';
2
+ /**
3
+ * Type decorator.
4
+ *
5
+ * @param {TypeOptions<TType>} typeOptions Type options.
6
+ *
7
+ * @returns {ClassDecorator} Class decorator.
8
+ */
9
+ export declare function Type<TType>(typeOptions?: TypeOptions<TType>): ClassDecorator;
package/core/alias.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Type to explicitly define an alias within a source code.
3
- *
4
- * @type {Alias}
5
- */
6
- export declare type Alias = string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Custom data which can be defined by developer.
3
- *
4
- * @type {CustomData}
5
- */
6
- export declare type CustomData = Record<string, any>;
@@ -1,7 +0,0 @@
1
- import { DefaultValueResolver } from './default-value-resolver';
2
- /**
3
- * Default value which can be defined by developer.
4
- *
5
- * @type {DefaultValue}
6
- */
7
- export declare type DefaultValue = any | DefaultValueResolver;
@@ -1,8 +0,0 @@
1
- import { TypeName } from './type-name';
2
- /**
3
- * Discriminant intends to describe a unique key for a polymorphic type which will be
4
- * used during serialization and deserialization. Can be a type name, any string or number.
5
- *
6
- * @type {Discriminant}
7
- */
8
- export declare type Discriminant = TypeName | string | number;
@@ -1,6 +0,0 @@
1
- /**
2
- * Discriminator intends to indicate the property used to identify the type of an object.
3
- *
4
- * @type {Discriminator}
5
- */
6
- export declare type Discriminator = string;
package/core/factory.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Injector } from './injector';
2
- import { TypeContext } from './type-context';
3
- /**
4
- * Factory for building types.
5
- *
6
- * @type {Factory}
7
- */
8
- export interface Factory {
9
- /**
10
- * Builds type described by provided type context.
11
- *
12
- * @param {TypeContext<TType>} typeContext Type context.
13
- * @param {Injector} injector Injector.
14
- *
15
- * @returns {TType} Type instance described by provided type context.
16
- */
17
- build<TType>(typeContext: TypeContext<TType>, injector: Injector): TType;
18
- }