@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
package/CHANGELOG.md CHANGED
@@ -1,197 +1,222 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [4.1.0] - 2022-05-18
9
-
10
- ### Added
11
-
12
- - Getters for serialized and deserialized default value in metadata.
13
- - Decorators and options to define serialized and deserialized default value explicitly.
14
-
15
- ## [4.0.4] - 2022-05-15
16
-
17
- ### Changed
18
-
19
- - Set webpack global output object to `this`.
20
-
21
- ## [4.0.3] - 2022-05-07
22
-
23
- ### Added
24
-
25
- - Getters of serialized and deserialized property names for property metadata.
26
-
27
- ### Removed
28
-
29
- - Definition logic of serialized and deserialized property names from type serializer.
30
-
31
- ### Fixed
32
-
33
- - Serialized property name was displayed in log messages.
34
-
35
- ## [4.0.2] - 2022-05-01
36
-
37
- ### Changed
38
-
39
- - Used symbol instead of string based key to store type metadata.
40
- - Avoid complete reset of custom data by providing `null` as argument.
41
- - Code style improvements.
42
-
43
- ## [4.0.1] - 2021-08-01
44
-
45
- ### Changed
46
-
47
- - Custom data options are now behave like built in configure options.
48
- - Path reference handler is now using path traversal instead of direct evaluation for resolving references.
49
-
50
- ## [4.0.0] - 2021-03-24
51
-
52
- ### Added
53
-
54
- - Polymorphic types support.
55
- - Enums support.
56
- - Accessors support.
57
- - Multiple runtime configurations support.
58
-
59
- ### Changed
60
-
61
- - Newly introduced `TypeFn` is now used instead of `TypeCtor` in configure methods due to adding polymorphic types support.
62
- - Static methods of `TypeManager` now return static instance to enable method chaining.
63
-
64
- ### Migrating from previous version
65
-
66
- - Replace `TypeCtor` with `TypeFn` if you are using declarative configuration.
67
-
68
- ## [3.0.0] - 2021-03-06
69
-
70
- ### Added
71
-
72
- - Generics support.
73
- - Circular object reference support.
74
- - Short property declaration syntax.
75
- - Naming convention support.
76
- - Module separation.
77
- - New set of serializers.
78
-
79
- ### Changed
80
-
81
- - Core types, interfaces and classes moved to a core module to keep main namespace clean.
82
- - All decorators are now available from the main namespace.
83
-
84
- ### Fixed
85
-
86
- - Invalid implicit conversion of boolean serializer.
87
- - Properties were not assigned during deserialization if they already have initialized value.
88
-
89
- ### Removed
90
-
91
- - Multiple decorator and related options as they are no longer required.
92
-
93
- ### Migrating from previous version
94
-
95
- - Replace all core type and interface imports from `@dipscope/type-manager` to `@dipscope/type-manager/core`.
96
- - Replace all helper decorator imports from `@dipscope/type-manager/helpers` to `@dipscope/type-manager`.
97
- - Change all places where `Property` decorator is used to declare an array of types to a proper generic variant.
98
- - If you are using `TypeSerializer`, `TypeFactory`, `TypeInjector` helper decorators or interfaces then rename them to `Serializer`, `Factory`, `Injector` accordingly.
99
- - If you are using `typeAlias` or `typeResolver` property options replace them to `typeArgument`.
100
-
101
- ## [2.0.4] - 2021-02-13
102
-
103
- ### Changed
104
-
105
- - Improved type serializer context to avoid instance of call in serializers.
106
-
107
- ## [2.0.3] - 2021-02-13
108
-
109
- ### Fixed
110
-
111
- - Broken helpers module.
112
-
113
- ## [2.0.2] - 2021-02-11
114
-
115
- ### Fixed
116
-
117
- - Broken module resolvers.
118
-
119
- ## [2.0.1] - 2021-02-11
120
-
121
- ### Fixed
122
-
123
- - Broken imports from newly introduced namespaces.
124
-
125
- ## [2.0.0] - 2021-02-10
126
-
127
- ### Added
128
-
129
- - Dependency injection support.
130
- - Immutable types support.
131
- - Type hint support.
132
- - Custom data support.
133
-
134
- ### Changed
135
-
136
- - Type serializer now an inteface.
137
- - Some helper decorators renamed to match option names.
138
- - Helper decorators moved to their own namespace.
139
-
140
- ### Migrating from previous version
141
-
142
- - Replace extension with implementation for custom type serializers.
143
- - If your custom serializers uses implicit conversion make it part of the serialize and deserialize methods. You can check if it should be used based on newly introduced serializer context.
144
- - If you are using `Serializer` helper decorator then rename it to `TypeSerializer`.
145
- - For all helper decorators change imports to `@dipscope/type-manager/helpers`. Now they are located in their own namespace.
146
-
147
- ## [1.3.0] - 2021-01-20
148
-
149
- ### Added
150
-
151
- - Type manager methods to configure each option individually.
152
-
153
- ### Fixed
154
-
155
- - Type options were not applied after changes at runtime.
156
-
157
- ## [1.2.2] - 2020-12-25
158
-
159
- ### Fixed
160
-
161
- - Type error when trying to serialize and deserialize object with null values.
162
- - Explicit deserialization of properties.
163
-
164
- ## [1.2.1] - 2020-12-24
165
-
166
- ### Fixed
167
-
168
- - Broken exports for browser based applications.
169
-
170
- ## [1.2.0] - 2020-12-23
171
-
172
- ### Added
173
-
174
- - Multiple property option to indicate that certain property is an array when using without reflect metadata.
175
-
176
- ### Fixed
177
-
178
- - Type extraction using reflect metadata.
179
-
180
- ## [1.1.0] - 2020-12-22
181
-
182
- ### Added
183
-
184
- - Global type options.
185
- - Default value definition for types and properties.
186
- - Implicit conversion for types and properties.
187
- - Type manager stringify and parse methods for working with JSON.
188
-
189
- ## [1.0.0] - 2020-12-16
190
-
191
- ### Added
192
-
193
- - Type manager for serializing and deserializing objects.
194
- - Decorator annotations for type and property metadata.
195
- - Declarative configuration for type and property metadata.
196
- - Custom serializer support.
197
- - Reflect metadata support.
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [5.0.0] - 2022-**-**
9
+
10
+ ### Added
11
+
12
+ - Performance improvements.
13
+
14
+ ### Changed
15
+
16
+ - Separate modules are now merged into one to reduce final application bundle size and simplify usage.
17
+
18
+ ### Removed
19
+
20
+ - Helper decorators as they silently increase final application bundle size and reduce performance on startup for the end user.
21
+
22
+ ### Migrating from previous version
23
+
24
+ - Replace all separate module imports to `@dipscope/type-manager`.
25
+ - Remove all helper decorators and use configure options with the same names from the main `Type`, `Property` and `Inject` decorators.
26
+
27
+ ## [4.1.1] - 2022-05-30
28
+
29
+ ### Changed
30
+
31
+ - Moved source maps into separate file and reduced production bundle size.
32
+
33
+ ## [4.1.0] - 2022-05-18
34
+
35
+ ### Added
36
+
37
+ - Getters for serialized and deserialized default value in metadata.
38
+ - Decorators and options to define serialized and deserialized default value explicitly.
39
+
40
+ ## [4.0.4] - 2022-05-15
41
+
42
+ ### Changed
43
+
44
+ - Set webpack global output object to `this`.
45
+
46
+ ## [4.0.3] - 2022-05-07
47
+
48
+ ### Added
49
+
50
+ - Getters of serialized and deserialized property names for property metadata.
51
+
52
+ ### Removed
53
+
54
+ - Definition logic of serialized and deserialized property names from type serializer.
55
+
56
+ ### Fixed
57
+
58
+ - Serialized property name was displayed in log messages.
59
+
60
+ ## [4.0.2] - 2022-05-01
61
+
62
+ ### Changed
63
+
64
+ - Used symbol instead of string based key to store type metadata.
65
+ - Avoid complete reset of custom data by providing `null` as argument.
66
+ - Code style improvements.
67
+
68
+ ## [4.0.1] - 2021-08-01
69
+
70
+ ### Changed
71
+
72
+ - Custom data options are now behave like built in configure options.
73
+ - Path reference handler is now using path traversal instead of direct evaluation for resolving references.
74
+
75
+ ## [4.0.0] - 2021-03-24
76
+
77
+ ### Added
78
+
79
+ - Polymorphic types support.
80
+ - Enums support.
81
+ - Accessors support.
82
+ - Multiple runtime configurations support.
83
+
84
+ ### Changed
85
+
86
+ - Newly introduced `TypeFn` is now used instead of `TypeCtor` in configure methods due to adding polymorphic types support.
87
+ - Static methods of `TypeManager` now return static instance to enable method chaining.
88
+
89
+ ### Migrating from previous version
90
+
91
+ - Replace `TypeCtor` with `TypeFn` if you are using declarative configuration.
92
+
93
+ ## [3.0.0] - 2021-03-06
94
+
95
+ ### Added
96
+
97
+ - Generics support.
98
+ - Circular object reference support.
99
+ - Short property declaration syntax.
100
+ - Naming convention support.
101
+ - Module separation.
102
+ - New set of serializers.
103
+
104
+ ### Changed
105
+
106
+ - Core types, interfaces and classes moved to a core module to keep main namespace clean.
107
+ - All decorators are now available from the main namespace.
108
+
109
+ ### Fixed
110
+
111
+ - Invalid implicit conversion of boolean serializer.
112
+ - Properties were not assigned during deserialization if they already have initialized value.
113
+
114
+ ### Removed
115
+
116
+ - Multiple decorator and related options as they are no longer required.
117
+
118
+ ### Migrating from previous version
119
+
120
+ - Replace all core type and interface imports from `@dipscope/type-manager` to `@dipscope/type-manager/core`.
121
+ - Replace all helper decorator imports from `@dipscope/type-manager/helpers` to `@dipscope/type-manager`.
122
+ - Change all places where `Property` decorator is used to declare an array of types to a proper generic variant.
123
+ - If you are using `TypeSerializer`, `TypeFactory`, `TypeInjector` helper decorators or interfaces then rename them to `Serializer`, `Factory`, `Injector` accordingly.
124
+ - If you are using `typeAlias` or `typeResolver` property options replace them to `typeArgument`.
125
+
126
+ ## [2.0.4] - 2021-02-13
127
+
128
+ ### Changed
129
+
130
+ - Improved type serializer context to avoid instance of call in serializers.
131
+
132
+ ## [2.0.3] - 2021-02-13
133
+
134
+ ### Fixed
135
+
136
+ - Broken helpers module.
137
+
138
+ ## [2.0.2] - 2021-02-11
139
+
140
+ ### Fixed
141
+
142
+ - Broken module resolvers.
143
+
144
+ ## [2.0.1] - 2021-02-11
145
+
146
+ ### Fixed
147
+
148
+ - Broken imports from newly introduced namespaces.
149
+
150
+ ## [2.0.0] - 2021-02-10
151
+
152
+ ### Added
153
+
154
+ - Dependency injection support.
155
+ - Immutable types support.
156
+ - Type hint support.
157
+ - Custom data support.
158
+
159
+ ### Changed
160
+
161
+ - Type serializer now an inteface.
162
+ - Some helper decorators renamed to match option names.
163
+ - Helper decorators moved to their own namespace.
164
+
165
+ ### Migrating from previous version
166
+
167
+ - Replace extension with implementation for custom type serializers.
168
+ - If your custom serializers uses implicit conversion make it part of the serialize and deserialize methods. You can check if it should be used based on newly introduced serializer context.
169
+ - If you are using `Serializer` helper decorator then rename it to `TypeSerializer`.
170
+ - For all helper decorators change imports to `@dipscope/type-manager/helpers`. Now they are located in their own namespace.
171
+
172
+ ## [1.3.0] - 2021-01-20
173
+
174
+ ### Added
175
+
176
+ - Type manager methods to configure each option individually.
177
+
178
+ ### Fixed
179
+
180
+ - Type options were not applied after changes at runtime.
181
+
182
+ ## [1.2.2] - 2020-12-25
183
+
184
+ ### Fixed
185
+
186
+ - Type error when trying to serialize and deserialize object with null values.
187
+ - Explicit deserialization of properties.
188
+
189
+ ## [1.2.1] - 2020-12-24
190
+
191
+ ### Fixed
192
+
193
+ - Broken exports for browser based applications.
194
+
195
+ ## [1.2.0] - 2020-12-23
196
+
197
+ ### Added
198
+
199
+ - Multiple property option to indicate that certain property is an array when using without reflect metadata.
200
+
201
+ ### Fixed
202
+
203
+ - Type extraction using reflect metadata.
204
+
205
+ ## [1.1.0] - 2020-12-22
206
+
207
+ ### Added
208
+
209
+ - Global type options.
210
+ - Default value definition for types and properties.
211
+ - Implicit conversion for types and properties.
212
+ - Type manager stringify and parse methods for working with JSON.
213
+
214
+ ## [1.0.0] - 2020-12-16
215
+
216
+ ### Added
217
+
218
+ - Type manager for serializing and deserializing objects.
219
+ - Decorator annotations for type and property metadata.
220
+ - Declarative configuration for type and property metadata.
221
+ - Custom serializer support.
222
+ - Reflect metadata support.