@pristine-ts/data-mapping-common 0.0.283

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 (213) hide show
  1. package/LICENSE +201 -0
  2. package/dist/lib/cjs/builders/auto-data-mapping.builder.js +137 -0
  3. package/dist/lib/cjs/builders/auto-data-mapping.builder.js.map +1 -0
  4. package/dist/lib/cjs/builders/builders.js +19 -0
  5. package/dist/lib/cjs/builders/builders.js.map +1 -0
  6. package/dist/lib/cjs/builders/data-mapping.builder.js +178 -0
  7. package/dist/lib/cjs/builders/data-mapping.builder.js.map +1 -0
  8. package/dist/lib/cjs/data-mapping-common.js +26 -0
  9. package/dist/lib/cjs/data-mapping-common.js.map +1 -0
  10. package/dist/lib/cjs/decorators/decorators.js +18 -0
  11. package/dist/lib/cjs/decorators/decorators.js.map +1 -0
  12. package/dist/lib/cjs/decorators/type.decorator.js +20 -0
  13. package/dist/lib/cjs/decorators/type.decorator.js.map +1 -0
  14. package/dist/lib/cjs/enums/data-mapping-node-type.enum.js +11 -0
  15. package/dist/lib/cjs/enums/data-mapping-node-type.enum.js.map +1 -0
  16. package/dist/lib/cjs/enums/enums.js +19 -0
  17. package/dist/lib/cjs/enums/enums.js.map +1 -0
  18. package/dist/lib/cjs/enums/metadata.enum.js +8 -0
  19. package/dist/lib/cjs/enums/metadata.enum.js.map +1 -0
  20. package/dist/lib/cjs/errors/array-data-mapping-node-invalid-source-property-type.error.js +17 -0
  21. package/dist/lib/cjs/errors/array-data-mapping-node-invalid-source-property-type.error.js.map +1 -0
  22. package/dist/lib/cjs/errors/data-after-mapping-interceptor-already-added.error.js +17 -0
  23. package/dist/lib/cjs/errors/data-after-mapping-interceptor-already-added.error.js.map +1 -0
  24. package/dist/lib/cjs/errors/data-before-mapping-interceptor-already-added.error.js +17 -0
  25. package/dist/lib/cjs/errors/data-before-mapping-interceptor-already-added.error.js.map +1 -0
  26. package/dist/lib/cjs/errors/data-mapping-interceptor-not-found.error.js +17 -0
  27. package/dist/lib/cjs/errors/data-mapping-interceptor-not-found.error.js.map +1 -0
  28. package/dist/lib/cjs/errors/data-mapping-source-property-not-found.error.js +17 -0
  29. package/dist/lib/cjs/errors/data-mapping-source-property-not-found.error.js.map +1 -0
  30. package/dist/lib/cjs/errors/data-normalizer-already-added.error.js +17 -0
  31. package/dist/lib/cjs/errors/data-normalizer-already-added.error.js.map +1 -0
  32. package/dist/lib/cjs/errors/errors.js +25 -0
  33. package/dist/lib/cjs/errors/errors.js.map +1 -0
  34. package/dist/lib/cjs/errors/normalizer-invalid-source-type.error.js +17 -0
  35. package/dist/lib/cjs/errors/normalizer-invalid-source-type.error.js.map +1 -0
  36. package/dist/lib/cjs/errors/undefined-source-property.error.js +17 -0
  37. package/dist/lib/cjs/errors/undefined-source-property.error.js.map +1 -0
  38. package/dist/lib/cjs/interfaces/data-mapping-interceptor.interface.js +3 -0
  39. package/dist/lib/cjs/interfaces/data-mapping-interceptor.interface.js.map +1 -0
  40. package/dist/lib/cjs/interfaces/data-normalizer.interface.js +3 -0
  41. package/dist/lib/cjs/interfaces/data-normalizer.interface.js.map +1 -0
  42. package/dist/lib/cjs/interfaces/interfaces.js +19 -0
  43. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -0
  44. package/dist/lib/cjs/mappers/data.mapper.js +103 -0
  45. package/dist/lib/cjs/mappers/data.mapper.js.map +1 -0
  46. package/dist/lib/cjs/mappers/mappers.js +18 -0
  47. package/dist/lib/cjs/mappers/mappers.js.map +1 -0
  48. package/dist/lib/cjs/nodes/base-data-mapping.node.js +24 -0
  49. package/dist/lib/cjs/nodes/base-data-mapping.node.js.map +1 -0
  50. package/dist/lib/cjs/nodes/data-mapping.leaf.js +184 -0
  51. package/dist/lib/cjs/nodes/data-mapping.leaf.js.map +1 -0
  52. package/dist/lib/cjs/nodes/data-mapping.node.js +217 -0
  53. package/dist/lib/cjs/nodes/data-mapping.node.js.map +1 -0
  54. package/dist/lib/cjs/nodes/nodes.js +20 -0
  55. package/dist/lib/cjs/nodes/nodes.js.map +1 -0
  56. package/dist/lib/cjs/normalizer-options/base-normalizer.options.js +12 -0
  57. package/dist/lib/cjs/normalizer-options/base-normalizer.options.js.map +1 -0
  58. package/dist/lib/cjs/normalizer-options/date-normalizer.options.js +21 -0
  59. package/dist/lib/cjs/normalizer-options/date-normalizer.options.js.map +1 -0
  60. package/dist/lib/cjs/normalizer-options/lowercase-normalizer.options.js +11 -0
  61. package/dist/lib/cjs/normalizer-options/lowercase-normalizer.options.js.map +1 -0
  62. package/dist/lib/cjs/normalizer-options/normalizer-options.js +22 -0
  63. package/dist/lib/cjs/normalizer-options/normalizer-options.js.map +1 -0
  64. package/dist/lib/cjs/normalizer-options/number-normalizer.options.js +16 -0
  65. package/dist/lib/cjs/normalizer-options/number-normalizer.options.js.map +1 -0
  66. package/dist/lib/cjs/normalizer-options/string-normalizer.options.js +17 -0
  67. package/dist/lib/cjs/normalizer-options/string-normalizer.options.js.map +1 -0
  68. package/dist/lib/cjs/normalizers/date.normalizer.js +62 -0
  69. package/dist/lib/cjs/normalizers/date.normalizer.js.map +1 -0
  70. package/dist/lib/cjs/normalizers/lowercase.normalizer.js +20 -0
  71. package/dist/lib/cjs/normalizers/lowercase.normalizer.js.map +1 -0
  72. package/dist/lib/cjs/normalizers/normalizers.js +21 -0
  73. package/dist/lib/cjs/normalizers/normalizers.js.map +1 -0
  74. package/dist/lib/cjs/normalizers/number.normalizer.js +30 -0
  75. package/dist/lib/cjs/normalizers/number.normalizer.js.map +1 -0
  76. package/dist/lib/cjs/normalizers/string.normalizer.js +52 -0
  77. package/dist/lib/cjs/normalizers/string.normalizer.js.map +1 -0
  78. package/dist/lib/cjs/options/auto-data-mapping-builder.options.js +11 -0
  79. package/dist/lib/cjs/options/auto-data-mapping-builder.options.js.map +1 -0
  80. package/dist/lib/cjs/types/data-mapping-interceptor-unique-key.type.js +3 -0
  81. package/dist/lib/cjs/types/data-mapping-interceptor-unique-key.type.js.map +1 -0
  82. package/dist/lib/cjs/types/data-normalizer-unique-key.type.js +3 -0
  83. package/dist/lib/cjs/types/data-normalizer-unique-key.type.js.map +1 -0
  84. package/dist/lib/cjs/types/types.js +19 -0
  85. package/dist/lib/cjs/types/types.js.map +1 -0
  86. package/dist/lib/esm/builders/auto-data-mapping.builder.js +133 -0
  87. package/dist/lib/esm/builders/auto-data-mapping.builder.js.map +1 -0
  88. package/dist/lib/esm/builders/builders.js +3 -0
  89. package/dist/lib/esm/builders/builders.js.map +1 -0
  90. package/dist/lib/esm/builders/data-mapping.builder.js +174 -0
  91. package/dist/lib/esm/builders/data-mapping.builder.js.map +1 -0
  92. package/dist/lib/esm/data-mapping-common.js +10 -0
  93. package/dist/lib/esm/data-mapping-common.js.map +1 -0
  94. package/dist/lib/esm/decorators/decorators.js +2 -0
  95. package/dist/lib/esm/decorators/decorators.js.map +1 -0
  96. package/dist/lib/esm/decorators/type.decorator.js +16 -0
  97. package/dist/lib/esm/decorators/type.decorator.js.map +1 -0
  98. package/dist/lib/esm/enums/data-mapping-node-type.enum.js +8 -0
  99. package/dist/lib/esm/enums/data-mapping-node-type.enum.js.map +1 -0
  100. package/dist/lib/esm/enums/enums.js +3 -0
  101. package/dist/lib/esm/enums/enums.js.map +1 -0
  102. package/dist/lib/esm/enums/metadata.enum.js +5 -0
  103. package/dist/lib/esm/enums/metadata.enum.js.map +1 -0
  104. package/dist/lib/esm/errors/array-data-mapping-node-invalid-source-property-type.error.js +13 -0
  105. package/dist/lib/esm/errors/array-data-mapping-node-invalid-source-property-type.error.js.map +1 -0
  106. package/dist/lib/esm/errors/data-after-mapping-interceptor-already-added.error.js +13 -0
  107. package/dist/lib/esm/errors/data-after-mapping-interceptor-already-added.error.js.map +1 -0
  108. package/dist/lib/esm/errors/data-before-mapping-interceptor-already-added.error.js +13 -0
  109. package/dist/lib/esm/errors/data-before-mapping-interceptor-already-added.error.js.map +1 -0
  110. package/dist/lib/esm/errors/data-mapping-interceptor-not-found.error.js +13 -0
  111. package/dist/lib/esm/errors/data-mapping-interceptor-not-found.error.js.map +1 -0
  112. package/dist/lib/esm/errors/data-mapping-source-property-not-found.error.js +13 -0
  113. package/dist/lib/esm/errors/data-mapping-source-property-not-found.error.js.map +1 -0
  114. package/dist/lib/esm/errors/data-normalizer-already-added.error.js +13 -0
  115. package/dist/lib/esm/errors/data-normalizer-already-added.error.js.map +1 -0
  116. package/dist/lib/esm/errors/errors.js +9 -0
  117. package/dist/lib/esm/errors/errors.js.map +1 -0
  118. package/dist/lib/esm/errors/normalizer-invalid-source-type.error.js +13 -0
  119. package/dist/lib/esm/errors/normalizer-invalid-source-type.error.js.map +1 -0
  120. package/dist/lib/esm/errors/undefined-source-property.error.js +13 -0
  121. package/dist/lib/esm/errors/undefined-source-property.error.js.map +1 -0
  122. package/dist/lib/esm/interfaces/data-mapping-interceptor.interface.js +2 -0
  123. package/dist/lib/esm/interfaces/data-mapping-interceptor.interface.js.map +1 -0
  124. package/dist/lib/esm/interfaces/data-normalizer.interface.js +2 -0
  125. package/dist/lib/esm/interfaces/data-normalizer.interface.js.map +1 -0
  126. package/dist/lib/esm/interfaces/interfaces.js +3 -0
  127. package/dist/lib/esm/interfaces/interfaces.js.map +1 -0
  128. package/dist/lib/esm/mappers/data.mapper.js +99 -0
  129. package/dist/lib/esm/mappers/data.mapper.js.map +1 -0
  130. package/dist/lib/esm/mappers/mappers.js +2 -0
  131. package/dist/lib/esm/mappers/mappers.js.map +1 -0
  132. package/dist/lib/esm/nodes/base-data-mapping.node.js +20 -0
  133. package/dist/lib/esm/nodes/base-data-mapping.node.js.map +1 -0
  134. package/dist/lib/esm/nodes/data-mapping.leaf.js +180 -0
  135. package/dist/lib/esm/nodes/data-mapping.leaf.js.map +1 -0
  136. package/dist/lib/esm/nodes/data-mapping.node.js +213 -0
  137. package/dist/lib/esm/nodes/data-mapping.node.js.map +1 -0
  138. package/dist/lib/esm/nodes/nodes.js +4 -0
  139. package/dist/lib/esm/nodes/nodes.js.map +1 -0
  140. package/dist/lib/esm/normalizer-options/base-normalizer.options.js +8 -0
  141. package/dist/lib/esm/normalizer-options/base-normalizer.options.js.map +1 -0
  142. package/dist/lib/esm/normalizer-options/date-normalizer.options.js +17 -0
  143. package/dist/lib/esm/normalizer-options/date-normalizer.options.js.map +1 -0
  144. package/dist/lib/esm/normalizer-options/lowercase-normalizer.options.js +7 -0
  145. package/dist/lib/esm/normalizer-options/lowercase-normalizer.options.js.map +1 -0
  146. package/dist/lib/esm/normalizer-options/normalizer-options.js +6 -0
  147. package/dist/lib/esm/normalizer-options/normalizer-options.js.map +1 -0
  148. package/dist/lib/esm/normalizer-options/number-normalizer.options.js +12 -0
  149. package/dist/lib/esm/normalizer-options/number-normalizer.options.js.map +1 -0
  150. package/dist/lib/esm/normalizer-options/string-normalizer.options.js +13 -0
  151. package/dist/lib/esm/normalizer-options/string-normalizer.options.js.map +1 -0
  152. package/dist/lib/esm/normalizers/date.normalizer.js +58 -0
  153. package/dist/lib/esm/normalizers/date.normalizer.js.map +1 -0
  154. package/dist/lib/esm/normalizers/lowercase.normalizer.js +16 -0
  155. package/dist/lib/esm/normalizers/lowercase.normalizer.js.map +1 -0
  156. package/dist/lib/esm/normalizers/normalizers.js +5 -0
  157. package/dist/lib/esm/normalizers/normalizers.js.map +1 -0
  158. package/dist/lib/esm/normalizers/number.normalizer.js +26 -0
  159. package/dist/lib/esm/normalizers/number.normalizer.js.map +1 -0
  160. package/dist/lib/esm/normalizers/string.normalizer.js +48 -0
  161. package/dist/lib/esm/normalizers/string.normalizer.js.map +1 -0
  162. package/dist/lib/esm/options/auto-data-mapping-builder.options.js +7 -0
  163. package/dist/lib/esm/options/auto-data-mapping-builder.options.js.map +1 -0
  164. package/dist/lib/esm/types/data-mapping-interceptor-unique-key.type.js +2 -0
  165. package/dist/lib/esm/types/data-mapping-interceptor-unique-key.type.js.map +1 -0
  166. package/dist/lib/esm/types/data-normalizer-unique-key.type.js +2 -0
  167. package/dist/lib/esm/types/data-normalizer-unique-key.type.js.map +1 -0
  168. package/dist/lib/esm/types/types.js +3 -0
  169. package/dist/lib/esm/types/types.js.map +1 -0
  170. package/dist/types/builders/auto-data-mapping.builder.d.ts +25 -0
  171. package/dist/types/builders/builders.d.ts +2 -0
  172. package/dist/types/builders/data-mapping.builder.d.ts +110 -0
  173. package/dist/types/data-mapping-common.d.ts +9 -0
  174. package/dist/types/decorators/decorators.d.ts +1 -0
  175. package/dist/types/decorators/type.decorator.d.ts +2 -0
  176. package/dist/types/enums/data-mapping-node-type.enum.d.ts +6 -0
  177. package/dist/types/enums/enums.d.ts +2 -0
  178. package/dist/types/enums/metadata.enum.d.ts +3 -0
  179. package/dist/types/errors/array-data-mapping-node-invalid-source-property-type.error.d.ts +6 -0
  180. package/dist/types/errors/data-after-mapping-interceptor-already-added.error.d.ts +7 -0
  181. package/dist/types/errors/data-before-mapping-interceptor-already-added.error.d.ts +7 -0
  182. package/dist/types/errors/data-mapping-interceptor-not-found.error.d.ts +7 -0
  183. package/dist/types/errors/data-mapping-source-property-not-found.error.d.ts +6 -0
  184. package/dist/types/errors/data-normalizer-already-added.error.d.ts +6 -0
  185. package/dist/types/errors/errors.d.ts +8 -0
  186. package/dist/types/errors/normalizer-invalid-source-type.error.d.ts +6 -0
  187. package/dist/types/errors/undefined-source-property.error.d.ts +8 -0
  188. package/dist/types/interfaces/data-mapping-interceptor.interface.d.ts +19 -0
  189. package/dist/types/interfaces/data-normalizer.interface.d.ts +15 -0
  190. package/dist/types/interfaces/interfaces.d.ts +2 -0
  191. package/dist/types/mappers/data.mapper.d.ts +38 -0
  192. package/dist/types/mappers/mappers.d.ts +1 -0
  193. package/dist/types/nodes/base-data-mapping.node.d.ts +15 -0
  194. package/dist/types/nodes/data-mapping.leaf.d.ts +92 -0
  195. package/dist/types/nodes/data-mapping.node.d.ts +104 -0
  196. package/dist/types/nodes/nodes.d.ts +3 -0
  197. package/dist/types/normalizer-options/base-normalizer.options.d.ts +4 -0
  198. package/dist/types/normalizer-options/date-normalizer.options.d.ts +12 -0
  199. package/dist/types/normalizer-options/lowercase-normalizer.options.d.ts +4 -0
  200. package/dist/types/normalizer-options/normalizer-options.d.ts +5 -0
  201. package/dist/types/normalizer-options/number-normalizer.options.d.ts +8 -0
  202. package/dist/types/normalizer-options/string-normalizer.options.d.ts +12 -0
  203. package/dist/types/normalizers/date.normalizer.d.ts +6 -0
  204. package/dist/types/normalizers/lowercase.normalizer.d.ts +7 -0
  205. package/dist/types/normalizers/normalizers.d.ts +4 -0
  206. package/dist/types/normalizers/number.normalizer.d.ts +6 -0
  207. package/dist/types/normalizers/string.normalizer.d.ts +6 -0
  208. package/dist/types/options/auto-data-mapping-builder.options.d.ts +11 -0
  209. package/dist/types/types/data-mapping-interceptor-unique-key.type.d.ts +1 -0
  210. package/dist/types/types/data-normalizer-unique-key.type.d.ts +1 -0
  211. package/dist/types/types/types.d.ts +2 -0
  212. package/package.json +67 -0
  213. package/readme.md +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-normalizer.interface.js","sourceRoot":"","sources":["../../../../src/interfaces/data-normalizer.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from "./data-normalizer.interface";
2
+ export * from "./data-mapping-interceptor.interface";
3
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC"}
@@ -0,0 +1,99 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { plainToInstance } from "class-transformer";
11
+ import { DataMappingInterceptorNotFoundError } from "../errors/data-mapping-interceptor-not-found.error";
12
+ export class DataMapper {
13
+ constructor(autoDataMappingBuilder, dataNormalizers, dataTransformerInterceptors) {
14
+ this.autoDataMappingBuilder = autoDataMappingBuilder;
15
+ this.dataNormalizers = dataNormalizers;
16
+ this.dataTransformerInterceptors = dataTransformerInterceptors;
17
+ this.dataNormalizersMap = {};
18
+ this.dataTransformerInterceptorsMap = {};
19
+ dataNormalizers.forEach(dataNormalizer => {
20
+ this.dataNormalizersMap[dataNormalizer.getUniqueKey()] = dataNormalizer;
21
+ });
22
+ dataTransformerInterceptors.forEach(interceptor => {
23
+ this.dataTransformerInterceptorsMap[interceptor.getUniqueKey()] = interceptor;
24
+ });
25
+ }
26
+ /**
27
+ * This method takes an array of source and maps each item.
28
+ *
29
+ * @param builder
30
+ * @param source
31
+ * @param destinationType
32
+ */
33
+ mapAll(builder, source, destinationType) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const destination = [];
36
+ for (const element of source) {
37
+ destination.push(yield this.map(builder, element, destinationType));
38
+ }
39
+ return destination;
40
+ });
41
+ }
42
+ /**
43
+ * This method automatically maps a source object into the DestinationType.
44
+ * @param source
45
+ * @param destinationType
46
+ * @param options
47
+ */
48
+ autoMap(source, destinationType, options) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const dataMappingBuilder = this.autoDataMappingBuilder.build(source, destinationType, options);
51
+ return this.map(dataMappingBuilder, source, destinationType);
52
+ });
53
+ }
54
+ /**
55
+ * This method takes a builder, a source and maps it according to the builder. You can pass a `destinationType (optional)`
56
+ * that is an object that will be constructed.
57
+ *
58
+ * @param builder
59
+ * @param source
60
+ * @param destinationType
61
+ */
62
+ map(builder, source, destinationType) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ let destination = {};
65
+ let interceptedSource = source;
66
+ // Execute the before interceptors.
67
+ for (const element of builder.beforeMappingInterceptors) {
68
+ const interceptor = this.dataTransformerInterceptorsMap[element.key];
69
+ if (interceptor === undefined) {
70
+ throw new DataMappingInterceptorNotFoundError("The interceptor wasn't found and cannot be loaded.", element.key);
71
+ }
72
+ // todo: Pass the options when we start using them.
73
+ interceptedSource = yield interceptor.beforeMapping(interceptedSource);
74
+ }
75
+ // Loop over the properties defined in the builder
76
+ for (const key in builder.nodes) {
77
+ if (builder.nodes.hasOwnProperty(key) === false) {
78
+ continue;
79
+ }
80
+ const node = builder.nodes[key];
81
+ yield node.map(interceptedSource, destination, this.dataNormalizersMap);
82
+ }
83
+ // Execute the before interceptors.
84
+ for (const element of builder.afterMappingInterceptors) {
85
+ const interceptor = this.dataTransformerInterceptorsMap[element.key];
86
+ if (interceptor === undefined) {
87
+ throw new DataMappingInterceptorNotFoundError("The interceptor wasn't found and cannot be loaded.", element.key);
88
+ }
89
+ // todo pass the options when we start using it.
90
+ destination = yield interceptor.afterMapping(destination);
91
+ }
92
+ if (destinationType) {
93
+ destination = plainToInstance(destinationType, destination);
94
+ }
95
+ return destination;
96
+ });
97
+ }
98
+ }
99
+ //# sourceMappingURL=data.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.mapper.js","sourceRoot":"","sources":["../../../../src/mappers/data.mapper.ts"],"names":[],"mappings":";;;;;;;;;AAKA,OAAO,EAAmB,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAC,mCAAmC,EAAC,MAAM,oDAAoD,CAAC;AAKvG,MAAM,OAAO,UAAU;IAInB,YACqB,sBAA8C,EAC9C,eAAoD,EACpD,2BAA8D;QAF9D,2BAAsB,GAAtB,sBAAsB,CAAwB;QAC9C,oBAAe,GAAf,eAAe,CAAqC;QACpD,gCAA2B,GAA3B,2BAA2B,CAAmC;QANlE,uBAAkB,GAA4E,EAAE,CAAA;QAChG,mCAA8B,GAAsF,EAAE,CAAA;QAMnI,e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":"","sources":["../../../../src/mappers/mappers.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { UndefinedSourcePropertyError } from "../errors/undefined-source-property.error";
2
+ export class BaseDataMappingNode {
3
+ constructor() {
4
+ this.nodes = {};
5
+ }
6
+ /**
7
+ * This method is called by the node itself to tell its parent that it has been build and is ready to be added.
8
+ * We use this mechanism to force the `end()` method on the leaf to be called so we can do some validations before
9
+ * adding it to the tree.
10
+ *
11
+ * @param node
12
+ */
13
+ addNode(node) {
14
+ if (node.sourceProperty === undefined) {
15
+ throw new UndefinedSourcePropertyError(node);
16
+ }
17
+ this.nodes[node.sourceProperty] = node;
18
+ }
19
+ }
20
+ //# sourceMappingURL=base-data-mapping.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-data-mapping.node.js","sourceRoot":"","sources":["../../../../src/nodes/base-data-mapping.node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAEvF,MAAM,OAAgB,mBAAmB;IAAzC;QACW,UAAK,GAAoE,EAAE,CAAC;IAkBvF,CAAC;IAhBG;;;;;;OAMG;IACI,OAAO,CAAC,IAAuC;QAClD,IAAG,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAC3C,CAAC;CAGJ"}
@@ -0,0 +1,180 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { DataMappingNodeTypeEnum } from "../enums/data-mapping-node-type.enum";
11
+ import { DataNormalizerAlreadyAdded } from "../errors/data-normalizer-already-added.error";
12
+ import { DataMappingSourcePropertyNotFoundError } from "../errors/data-mapping-source-property-not-found.error";
13
+ import { ArrayDataMappingNodeInvalidSourcePropertyTypeError } from "../errors/array-data-mapping-node-invalid-source-property-type.error";
14
+ export class DataMappingLeaf {
15
+ constructor(root, parent, type = DataMappingNodeTypeEnum.Leaf) {
16
+ this.root = root;
17
+ this.parent = parent;
18
+ this.type = type;
19
+ /**
20
+ * This property contains an array of Normalizers to apply sequentially when mapping this property.
21
+ */
22
+ this.normalizers = [];
23
+ /**
24
+ * This property contains an array of Normalizers that must be excluded from normalizers defined by parents.
25
+ */
26
+ this.excludedNormalizers = new Set();
27
+ /**
28
+ * This method specified whether it's possible that this element not be present in the `source` object.
29
+ */
30
+ this.isOptional = false;
31
+ }
32
+ /**
33
+ * This is a setter for `sourceProperty`.
34
+ * @param sourceProperty
35
+ */
36
+ setSourceProperty(sourceProperty) {
37
+ this.sourceProperty = sourceProperty;
38
+ return this;
39
+ }
40
+ /**
41
+ * This is a setter for `destinationProperty`.
42
+ * @param destinationProperty
43
+ */
44
+ setDestinationProperty(destinationProperty) {
45
+ this.destinationProperty = destinationProperty;
46
+ return this;
47
+ }
48
+ /**
49
+ * This is a setter for `isOptional`.
50
+ * @param isOptional
51
+ */
52
+ setIsOptional(isOptional) {
53
+ this.isOptional = isOptional;
54
+ return this;
55
+ }
56
+ /**
57
+ * This methods adds a normalizer but checks that this normalizer hasn't been added already (either at the root) or
58
+ * directly on this leaf.
59
+ *
60
+ * @param normalizerUniqueKey
61
+ * @param options
62
+ */
63
+ addNormalizer(normalizerUniqueKey, options) {
64
+ if (this.hasNormalizer(normalizerUniqueKey)) {
65
+ throw new DataNormalizerAlreadyAdded("The data normalizer '" + normalizerUniqueKey + "' has already been added to the leaf with destination property: '" + this.destinationProperty + "'.", normalizerUniqueKey, options);
66
+ }
67
+ if (this.root.hasNormalizer(normalizerUniqueKey)) {
68
+ throw new DataNormalizerAlreadyAdded("The data normalizer '" + normalizerUniqueKey + "' has already been added to the root and cannot be also added to the leaf with destination property: '" + this.destinationProperty + "'.", normalizerUniqueKey, options);
69
+ }
70
+ this.normalizers.push({
71
+ key: normalizerUniqueKey,
72
+ options,
73
+ });
74
+ return this;
75
+ }
76
+ /**
77
+ * This method simply returns whether the normalizer was already added to this node.
78
+ * @param normalizerUniqueKey
79
+ */
80
+ hasNormalizer(normalizerUniqueKey) {
81
+ return this.normalizers.find(element => element.key === normalizerUniqueKey) !== undefined;
82
+ }
83
+ /**
84
+ * This method adds a normalizer that must be excluded from the normalizers applied at a higher level.à
85
+ * @param normalizerUniqueKey
86
+ */
87
+ excludeNormalizer(normalizerUniqueKey) {
88
+ if (this.excludedNormalizers.has(normalizerUniqueKey)) {
89
+ throw new DataNormalizerAlreadyAdded("The EXCLUDED data normalizer '" + normalizerUniqueKey + "' has already been added to this source property: '" + this.sourceProperty + "'.", normalizerUniqueKey);
90
+ }
91
+ this.excludedNormalizers.add(normalizerUniqueKey);
92
+ return this;
93
+ }
94
+ /**
95
+ * This method adds this node to its parent and returns the parent.
96
+ */
97
+ end() {
98
+ // todo: Validate that we actually have all the properties needed (sourceProperty and destinationProperty) for example.
99
+ this.parent.addNode(this);
100
+ return this.parent;
101
+ }
102
+ /**
103
+ * This method maps the `sourceProperty` from the `source` object and maps it to the `destinationProperty` of the
104
+ * `destination` object while applying the normalizers.
105
+ *
106
+ * @param source
107
+ * @param destination
108
+ * @param normalizersMap
109
+ */
110
+ map(source, destination, normalizersMap) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ if (source.hasOwnProperty(this.sourceProperty) === false) {
113
+ if (this.isOptional) {
114
+ return;
115
+ }
116
+ throw new DataMappingSourcePropertyNotFoundError("The property '" + this.sourceProperty + "' isn't found in the Source object and isn't marked as Optional. If you want to ignore this property, use the 'setIsOptional(true)' method in the builder.", this.sourceProperty);
117
+ }
118
+ const normalizers = this.root.normalizers.filter(element => this.excludedNormalizers.has(element.key) === false);
119
+ normalizers.push(...this.normalizers);
120
+ if (this.type === DataMappingNodeTypeEnum.ScalarArray) {
121
+ // This means that the source[propertyKey] contains an array of objects and each object should be mapped
122
+ const array = source[this.sourceProperty];
123
+ if (Array.isArray(array) === false) {
124
+ throw new ArrayDataMappingNodeInvalidSourcePropertyTypeError(`According to your schema, the property '${this.sourceProperty}' in the source object must contain an Array of Scalar. Instead, it contains: '${typeof array}'.`, this.sourceProperty);
125
+ }
126
+ destination[this.destinationProperty] = [];
127
+ for (let value of array) {
128
+ normalizers.forEach(element => {
129
+ const normalizer = normalizersMap[element.key];
130
+ value = normalizer.normalize(value, element.options);
131
+ });
132
+ destination[this.destinationProperty].push(value);
133
+ }
134
+ return;
135
+ }
136
+ let value = source[this.sourceProperty];
137
+ normalizers.forEach(element => {
138
+ const normalizer = normalizersMap[element.key];
139
+ value = normalizer.normalize(value, element.options);
140
+ });
141
+ destination[this.destinationProperty] = value;
142
+ return;
143
+ });
144
+ }
145
+ /**
146
+ * This method imports a schema.
147
+ *
148
+ * @param schema
149
+ */
150
+ import(schema) {
151
+ this.normalizers = schema.normalizers;
152
+ this.excludedNormalizers = new Set();
153
+ if (schema.hasOwnProperty("excludedNormalizers")) {
154
+ for (const item in schema.excludedNormalizers) {
155
+ this.excludeNormalizer(item);
156
+ }
157
+ }
158
+ this.isOptional = schema.isOptional;
159
+ this.sourceProperty = schema.sourceProperty;
160
+ this.destinationProperty = schema.destinationProperty;
161
+ }
162
+ /**
163
+ * This method exports this node.
164
+ */
165
+ export() {
166
+ const excludedNormalizers = {};
167
+ for (const element of this.excludedNormalizers.values()) {
168
+ excludedNormalizers[element] = true;
169
+ }
170
+ return {
171
+ "_type": this.type,
172
+ "sourceProperty": this.sourceProperty,
173
+ "destinationProperty": this.destinationProperty,
174
+ "isOptional": this.isOptional,
175
+ "normalizers": this.normalizers,
176
+ "excludedNormalizers": excludedNormalizers,
177
+ };
178
+ }
179
+ }
180
+ //# sourceMappingURL=data-mapping.leaf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-mapping.leaf.js","sourceRoot":"","sources":["../../../../src/nodes/data-mapping.leaf.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAC,0BAA0B,EAAC,MAAM,+CAA+C,CAAC;AAGzF,OAAO,EAAC,sCAAsC,EAAC,MAAM,wDAAwD,CAAC;AAE9G,OAAO,EACH,kDAAkD,EACrD,MAAM,sEAAsE,CAAC;AAE9E,MAAM,OAAO,eAAe;IA0BxB,YACqB,IAAwB,EACzB,MAA4C,EAC5C,OAAgC,uBAAuB,CAAC,IAAI;QAF3D,SAAI,GAAJ,IAAI,CAAoB;QACzB,WAAM,GAAN,MAAM,CAAsC;QAC5C,SAAI,GAAJ,IAAI,CAAwD;QAlBhF;;WAEG;QACI,gBAAW,GAAoD,EAAE,CAAC;QAEzE;;WAEG;QACI,wBAAmB,GAAiC,IAAI,GAAG,EAA2B,CAAC;QAE9F;;WAEG;QACI,eAAU,GAAY,KAAK,CAAC;IAOnC,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,cAAsB;QAC3C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,sBAAsB,CAAC,mBAA2B;QACrD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAC/C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,UAAmB;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,aA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AQ,EAAE,CAAA;QAEnC,KAAI,MAAM,OAAO,IAAI,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,EAAE,CAAC;YACrD,mBAAmB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACxC,CAAC;QAED,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,gBAAgB,EAAE,IAAI,CAAC,cAAc;YACrC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB;YAC/C,YAAY,EAAE,IAAI,CAAC,UAAU;YAC7B,aAAa,EAAE,IAAI,CAAC,WAAW;YAC/B,qBAAqB,EAAE,mBAAmB;SAC7C,CAAA;IACL,CAAC;CACJ"}
@@ -0,0 +1,213 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { DataMappingNodeTypeEnum } from "../enums/data-mapping-node-type.enum";
11
+ import { DataMappingLeaf } from "./data-mapping.leaf";
12
+ import { BaseDataMappingNode } from "./base-data-mapping.node";
13
+ import { DataMappingSourcePropertyNotFoundError } from "../errors/data-mapping-source-property-not-found.error";
14
+ import { ArrayDataMappingNodeInvalidSourcePropertyTypeError } from "../errors/array-data-mapping-node-invalid-source-property-type.error";
15
+ import { plainToInstance } from "class-transformer";
16
+ export class DataMappingNode extends BaseDataMappingNode {
17
+ constructor(root, parent, type = DataMappingNodeTypeEnum.Node) {
18
+ super();
19
+ this.root = root;
20
+ this.parent = parent;
21
+ this.type = type;
22
+ /**
23
+ * This method specified whether it's possible that this element not be present in the `source` object.
24
+ */
25
+ this.isOptional = false;
26
+ }
27
+ /**
28
+ * This is a setter for `sourceProperty`.
29
+ * @param sourceProperty
30
+ */
31
+ setSourceProperty(sourceProperty) {
32
+ this.sourceProperty = sourceProperty;
33
+ return this;
34
+ }
35
+ /**
36
+ * This is a setter for `destinationProperty`.
37
+ * @param destinationProperty
38
+ */
39
+ setDestinationProperty(destinationProperty) {
40
+ this.destinationProperty = destinationProperty;
41
+ return this;
42
+ }
43
+ /**
44
+ * This is a setter for `destinationType`.
45
+ * @param destinationType
46
+ */
47
+ setDestinationType(destinationType) {
48
+ this.destinationType = destinationType;
49
+ return this;
50
+ }
51
+ /**
52
+ * This is a setter for `isOptional`.
53
+ * @param isOptional
54
+ */
55
+ setIsOptional(isOptional) {
56
+ this.isOptional = isOptional;
57
+ return this;
58
+ }
59
+ /**
60
+ * This property creates a new DataMappingLeaf and returns it. It doesn't add it yet. To do so, the `end()` method
61
+ * must be called.
62
+ */
63
+ add() {
64
+ return new DataMappingLeaf(this.root, this);
65
+ }
66
+ /**
67
+ * This method adds a nesting level. This should be used when the property contains an object and you want to map
68
+ * this object into another object.
69
+ */
70
+ addNestingLevel() {
71
+ return new DataMappingNode(this.root, this);
72
+ }
73
+ /**
74
+ * This method adds an array of Scalar allowing you to apply the normalizer on each scalar in the array. The
75
+ * `sourceProperty` and `destinationProperty` correspond to the name of the property that is an array. But, the
76
+ * values in the array will be normalized using the normalizer.
77
+ *
78
+ */
79
+ addArrayOfScalar() {
80
+ return new DataMappingLeaf(this.root, this, DataMappingNodeTypeEnum.ScalarArray);
81
+ }
82
+ /**
83
+ * This method adds an array of objects allowing to define a node for each property in the object. Each object in
84
+ * the array will be treated as being the same.
85
+ */
86
+ addArrayOfObjects() {
87
+ return new DataMappingNode(this.root, this, DataMappingNodeTypeEnum.ObjectArray);
88
+ }
89
+ /**
90
+ * This method adds this node to its parent and returns the parent.
91
+ */
92
+ end() {
93
+ // todo: Validate that we actually have all the properties needed (sourceProperty and destinationProperty) for example.
94
+ this.parent.addNode(this);
95
+ return this.parent;
96
+ }
97
+ /**
98
+ * This method maps the `sourceProperty` from the `source` object and maps it to the `destinationProperty` of the
99
+ * `destination` object while applying the normalizers.
100
+ *
101
+ * @param source
102
+ * @param destination
103
+ * @param normalizersMap
104
+ */
105
+ map(source, destination, normalizersMap) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ if (source.hasOwnProperty(this.sourceProperty) === false) {
108
+ if (this.isOptional) {
109
+ return;
110
+ }
111
+ throw new DataMappingSourcePropertyNotFoundError("The property '" + this.sourceProperty + "' isn't found in the Source object and isn't marked as Optional. If you want to ignore this property, use the 'setIsOptional(true)' method in the builder.", this.sourceProperty);
112
+ }
113
+ const sourceElement = source[this.sourceProperty];
114
+ if (destination[this.destinationProperty] === undefined) {
115
+ if (this.type === DataMappingNodeTypeEnum.ObjectArray) {
116
+ destination[this.destinationProperty] = [];
117
+ }
118
+ else {
119
+ if (this.destinationType) {
120
+ destination[this.destinationProperty] = plainToInstance(this.destinationType, {});
121
+ }
122
+ else {
123
+ destination[this.destinationProperty] = {};
124
+ }
125
+ }
126
+ }
127
+ const destinationElement = destination[this.destinationProperty];
128
+ if (this.type === DataMappingNodeTypeEnum.ObjectArray) {
129
+ // This means that the source[propertyKey] contains an array of objects and each object should be mapped
130
+ const array = source[this.sourceProperty];
131
+ if (Array.isArray(array) === false) {
132
+ throw new ArrayDataMappingNodeInvalidSourcePropertyTypeError(`According to your schema, the property '${this.sourceProperty}' in the source object must contain an Array of objects. Instead, it contains: '${typeof array}'.`, this.sourceProperty);
133
+ }
134
+ for (const element of array) {
135
+ let dest = {};
136
+ if (this.destinationType) {
137
+ dest = plainToInstance(this.destinationType, {});
138
+ }
139
+ for (const key in this.nodes) {
140
+ if (this.nodes.hasOwnProperty(key) === false) {
141
+ continue;
142
+ }
143
+ const node = this.nodes[key];
144
+ yield node.map(element, dest, normalizersMap);
145
+ }
146
+ destinationElement.push(dest);
147
+ }
148
+ return;
149
+ }
150
+ // When the current node is not an array, we simply iterate
151
+ for (const key in this.nodes) {
152
+ if (this.nodes.hasOwnProperty(key) === false) {
153
+ continue;
154
+ }
155
+ const node = this.nodes[key];
156
+ yield node.map(sourceElement, destinationElement, normalizersMap);
157
+ }
158
+ });
159
+ }
160
+ /**
161
+ * This method imports a schema.
162
+ *
163
+ * @param schema
164
+ */
165
+ import(schema) {
166
+ this.sourceProperty = schema.sourceProperty;
167
+ this.destinationProperty = schema.destinationProperty;
168
+ this.isOptional = schema.isOptional;
169
+ this.nodes = {};
170
+ const nodes = schema.nodes;
171
+ for (const key in nodes) {
172
+ if (nodes.hasOwnProperty(key) === false) {
173
+ continue;
174
+ }
175
+ const nodeInfo = nodes[key];
176
+ const type = nodeInfo["_type"];
177
+ switch (type) {
178
+ case DataMappingNodeTypeEnum.ScalarArray:
179
+ case DataMappingNodeTypeEnum.Leaf:
180
+ const leaf = new DataMappingLeaf(this.root, this, type);
181
+ leaf.import(nodeInfo);
182
+ this.nodes[leaf.sourceProperty] = leaf;
183
+ continue;
184
+ case DataMappingNodeTypeEnum.Node:
185
+ case DataMappingNodeTypeEnum.ObjectArray:
186
+ const node = new DataMappingNode(this.root, this, type);
187
+ node.import(nodeInfo);
188
+ this.nodes[node.sourceProperty] = node;
189
+ continue;
190
+ }
191
+ }
192
+ }
193
+ /**
194
+ * This method exports this node.
195
+ */
196
+ export() {
197
+ const nodes = this.nodes;
198
+ for (const key in nodes) {
199
+ if (nodes.hasOwnProperty(key) === false) {
200
+ continue;
201
+ }
202
+ nodes[key] = nodes[key].export();
203
+ }
204
+ return {
205
+ "_type": this.type,
206
+ "sourceProperty": this.sourceProperty,
207
+ "destinationProperty": this.destinationProperty,
208
+ "isOptional": this.isOptional,
209
+ "nodes": nodes,
210
+ };
211
+ }
212
+ }
213
+ //# sourceMappingURL=data-mapping.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-mapping.node.js","sourceRoot":"","sources":["../../../../src/nodes/data-mapping.node.ts"],"names":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AI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;oBACvC,SAAS;gBAEb,KAAK,uBAAuB,CAAC,IAAI,CAAC;gBAClC,KAAK,uBAAuB,CAAC,WAAW;oBACpC,MAAM,IAAI,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;oBACxD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;oBACvC,SAAS;YACjB,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACI,MAAM;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACtB,IAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;gBACrC,SAAS;YACb,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;QACrC,CAAC;QAED,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,gBAAgB,EAAE,IAAI,CAAC,cAAc;YACrC,qBAAqB,EAAE,IAAI,CAAC,mBAAmB;YAC/C,YAAY,EAAE,IAAI,CAAC,UAAU;YAC7B,OAAO,EAAE,KAAK;SACjB,CAAA;IACL,CAAC;CACJ"}
@@ -0,0 +1,4 @@
1
+ export * from "./base-data-mapping.node";
2
+ export * from "./data-mapping.leaf";
3
+ export * from "./data-mapping.node";
4
+ //# sourceMappingURL=nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../../src/nodes/nodes.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export class BaseNormalizerOptions {
2
+ constructor(options) {
3
+ var _a;
4
+ this.shouldThrowIfTypeIsNotString = false;
5
+ this.shouldThrowIfTypeIsNotString = (_a = options === null || options === void 0 ? void 0 : options.shouldThrowIfTypeIsNotString) !== null && _a !== void 0 ? _a : this.shouldThrowIfTypeIsNotString;
6
+ }
7
+ }
8
+ //# sourceMappingURL=base-normalizer.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-normalizer.options.js","sourceRoot":"","sources":["../../../../src/normalizer-options/base-normalizer.options.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,qBAAqB;IAGvC,YAAmB,OAAwC;;QAFpD,iCAA4B,GAAY,KAAK,CAAC;QAGjD,IAAI,CAAC,4BAA4B,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,4BAA4B,mCAAI,IAAI,CAAC,4BAA4B,CAAC;IACnH,CAAC;CACJ"}
@@ -0,0 +1,17 @@
1
+ export class DateNormalizerOptions {
2
+ constructor(options) {
3
+ var _a, _b;
4
+ /**
5
+ * This property specifies whether an invalid date should return undefined or a date object.
6
+ */
7
+ this.returnUndefinedOnInvalidDate = true;
8
+ /**
9
+ * This property specifies if a number should be treated as being in seconds or not. Since JS Date expects a
10
+ * timestamp in milliseconds, if the number is in seconds, it will be multiplied by 1000.
11
+ */
12
+ this.treatNumbers = "seconds";
13
+ this.returnUndefinedOnInvalidDate = (_a = options === null || options === void 0 ? void 0 : options.returnUndefinedOnInvalidDate) !== null && _a !== void 0 ? _a : this.returnUndefinedOnInvalidDate;
14
+ this.treatNumbers = (_b = options === null || options === void 0 ? void 0 : options.treatNumbers) !== null && _b !== void 0 ? _b : this.treatNumbers;
15
+ }
16
+ }
17
+ //# sourceMappingURL=date-normalizer.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-normalizer.options.js","sourceRoot":"","sources":["../../../../src/normalizer-options/date-normalizer.options.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,qBAAqB;IAY9B,YAAmB,OAAwC;;QAX3D;;WAEG;QACI,iCAA4B,GAAY,IAAI,CAAC;QAEpD;;;WAGG;QACI,iBAAY,GAA+B,SAAS,CAAC;QAGxD,IAAI,CAAC,4BAA4B,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,4BAA4B,mCAAI,IAAI,CAAC,4BAA4B,CAAC;QAC/G,IAAI,CAAC,YAAY,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,mCAAI,IAAI,CAAC,YAAY,CAAC;IACnE,CAAC;CACJ"}
@@ -0,0 +1,7 @@
1
+ import { BaseNormalizerOptions } from "./base-normalizer.options";
2
+ export class LowercaseNormalizerOptions extends BaseNormalizerOptions {
3
+ constructor(options) {
4
+ super(options);
5
+ }
6
+ }
7
+ //# sourceMappingURL=lowercase-normalizer.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lowercase-normalizer.options.js","sourceRoot":"","sources":["../../../../src/normalizer-options/lowercase-normalizer.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AAEhE,MAAM,OAAO,0BAA2B,SAAQ,qBAAqB;IACjE,YAAmB,OAA6C;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CACJ"}
@@ -0,0 +1,6 @@
1
+ export * from "./base-normalizer.options";
2
+ export * from "./date-normalizer.options";
3
+ export * from "./lowercase-normalizer.options";
4
+ export * from "./number-normalizer.options";
5
+ export * from "./string-normalizer.options";
6
+ //# sourceMappingURL=normalizer-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizer-options.js","sourceRoot":"","sources":["../../../../src/normalizer-options/normalizer-options.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,12 @@
1
+ export class NumberNormalizerOptions {
2
+ constructor(options) {
3
+ var _a;
4
+ /**
5
+ * This property specifies whether an undefined value should be ignored and simply returned or treated as a potential string
6
+ * and return an empty string `""`.
7
+ */
8
+ this.ignoreUndefined = true;
9
+ this.ignoreUndefined = (_a = options === null || options === void 0 ? void 0 : options.ignoreUndefined) !== null && _a !== void 0 ? _a : this.ignoreUndefined;
10
+ }
11
+ }
12
+ //# sourceMappingURL=number-normalizer.options.js.map