@nest-yalc-2/utils 1.0.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 (148) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +9 -0
  3. package/package.json +29 -0
  4. package/src/__mocks__/enum.mock.ts +9 -0
  5. package/src/__tests__/class.helper.spec.ts +32 -0
  6. package/src/__tests__/command.helper.spec.ts +35 -0
  7. package/src/__tests__/config-manager.helper.spec.ts +93 -0
  8. package/src/__tests__/custom-validator.spec.ts +34 -0
  9. package/src/__tests__/data-structure.helper.spec.ts +30 -0
  10. package/src/__tests__/date.helper.spec.ts +78 -0
  11. package/src/__tests__/encryption.helper.spec.ts +45 -0
  12. package/src/__tests__/enum.helper.spec.ts +53 -0
  13. package/src/__tests__/env.helper.spec.ts +68 -0
  14. package/src/__tests__/error.helper.spec.ts +20 -0
  15. package/src/__tests__/faker-helper.spec.ts +187 -0
  16. package/src/__tests__/files.helper.spec.ts +22 -0
  17. package/src/__tests__/http.helper.spec.ts +15 -0
  18. package/src/__tests__/interval.helper.spec.ts +29 -0
  19. package/src/__tests__/math.helper.spec.ts +24 -0
  20. package/src/__tests__/nest.decorator.spec.ts +29 -0
  21. package/src/__tests__/nest.helper.spec.ts +26 -0
  22. package/src/__tests__/object-mapper.helper.spec.ts +167 -0
  23. package/src/__tests__/object-mapper.interceptor.spec.ts +104 -0
  24. package/src/__tests__/object.helper.spec.ts +181 -0
  25. package/src/__tests__/plugin.helper.spec.ts +85 -0
  26. package/src/__tests__/promise.helper.spec.ts +76 -0
  27. package/src/__tests__/returnValue.spec.ts +49 -0
  28. package/src/__tests__/rxjs.helper.spec.ts +79 -0
  29. package/src/__tests__/simple-mapper.interceptor.spec.ts +82 -0
  30. package/src/__tests__/tsconfig.json +3 -0
  31. package/src/__tests__/validator-helper.spec.ts +34 -0
  32. package/src/__tests__/zlib.helper.spec.ts +20 -0
  33. package/src/class.helper.d.ts +4 -0
  34. package/src/class.helper.js +19 -0
  35. package/src/class.helper.js.map +1 -0
  36. package/src/class.helper.ts +33 -0
  37. package/src/command.helper.d.ts +1 -0
  38. package/src/command.helper.js +16 -0
  39. package/src/command.helper.js.map +1 -0
  40. package/src/command.helper.ts +19 -0
  41. package/src/config-manager.helper.d.ts +12 -0
  42. package/src/config-manager.helper.js +60 -0
  43. package/src/config-manager.helper.js.map +1 -0
  44. package/src/config-manager.helper.ts +122 -0
  45. package/src/custom-validator.d.ts +3 -0
  46. package/src/custom-validator.js +13 -0
  47. package/src/custom-validator.js.map +1 -0
  48. package/src/custom-validator.ts +13 -0
  49. package/src/data-structure.helper.d.ts +1 -0
  50. package/src/data-structure.helper.js +13 -0
  51. package/src/data-structure.helper.js.map +1 -0
  52. package/src/data-structure.helper.ts +14 -0
  53. package/src/date.helper.d.ts +12 -0
  54. package/src/date.helper.js +47 -0
  55. package/src/date.helper.js.map +1 -0
  56. package/src/date.helper.ts +65 -0
  57. package/src/encryption.helper.d.ts +2 -0
  58. package/src/encryption.helper.js +58 -0
  59. package/src/encryption.helper.js.map +1 -0
  60. package/src/encryption.helper.ts +29 -0
  61. package/src/enum.helper.d.ts +8 -0
  62. package/src/enum.helper.js +21 -0
  63. package/src/enum.helper.js.map +1 -0
  64. package/src/enum.helper.ts +34 -0
  65. package/src/env.helper.d.ts +3 -0
  66. package/src/env.helper.js +23 -0
  67. package/src/env.helper.js.map +1 -0
  68. package/src/env.helper.ts +35 -0
  69. package/src/error.helper.d.ts +1 -0
  70. package/src/error.helper.js +12 -0
  71. package/src/error.helper.js.map +1 -0
  72. package/src/error.helper.ts +12 -0
  73. package/src/faker-helper.d.ts +16 -0
  74. package/src/faker-helper.js +73 -0
  75. package/src/faker-helper.js.map +1 -0
  76. package/src/faker-helper.ts +98 -0
  77. package/src/files.helper.d.ts +2 -0
  78. package/src/files.helper.js +13 -0
  79. package/src/files.helper.js.map +1 -0
  80. package/src/files.helper.ts +20 -0
  81. package/src/http.helper.d.ts +26 -0
  82. package/src/http.helper.js +84 -0
  83. package/src/http.helper.js.map +1 -0
  84. package/src/http.helper.ts +152 -0
  85. package/src/index.d.ts +21 -0
  86. package/src/index.js +38 -0
  87. package/src/index.js.map +1 -0
  88. package/src/index.ts +23 -0
  89. package/src/interval.helper.d.ts +5 -0
  90. package/src/interval.helper.js +16 -0
  91. package/src/interval.helper.js.map +1 -0
  92. package/src/interval.helper.ts +13 -0
  93. package/src/math.helper.d.ts +1 -0
  94. package/src/math.helper.js +8 -0
  95. package/src/math.helper.js.map +1 -0
  96. package/src/math.helper.ts +4 -0
  97. package/src/nest.decorator.d.ts +3 -0
  98. package/src/nest.decorator.js +10 -0
  99. package/src/nest.decorator.js.map +1 -0
  100. package/src/nest.decorator.ts +10 -0
  101. package/src/nestjs/nest.decorator.d.ts +3 -0
  102. package/src/nestjs/nest.decorator.js +10 -0
  103. package/src/nestjs/nest.decorator.js.map +1 -0
  104. package/src/nestjs/nest.decorator.ts +10 -0
  105. package/src/nestjs/nest.helper.d.ts +2 -0
  106. package/src/nestjs/nest.helper.js +7 -0
  107. package/src/nestjs/nest.helper.js.map +1 -0
  108. package/src/nestjs/nest.helper.ts +5 -0
  109. package/src/object-mapper.helper.d.ts +16 -0
  110. package/src/object-mapper.helper.js +47 -0
  111. package/src/object-mapper.helper.js.map +1 -0
  112. package/src/object-mapper.helper.ts +148 -0
  113. package/src/object-mapper.interceptor.d.ts +16 -0
  114. package/src/object-mapper.interceptor.js +36 -0
  115. package/src/object-mapper.interceptor.js.map +1 -0
  116. package/src/object-mapper.interceptor.ts +51 -0
  117. package/src/object.helper.d.ts +18 -0
  118. package/src/object.helper.js +91 -0
  119. package/src/object.helper.js.map +1 -0
  120. package/src/object.helper.ts +173 -0
  121. package/src/plugin.helper.d.ts +22 -0
  122. package/src/plugin.helper.js +26 -0
  123. package/src/plugin.helper.js.map +1 -0
  124. package/src/plugin.helper.ts +42 -0
  125. package/src/promise.helper.d.ts +13 -0
  126. package/src/promise.helper.js +71 -0
  127. package/src/promise.helper.js.map +1 -0
  128. package/src/promise.helper.ts +65 -0
  129. package/src/returnValue.d.ts +14 -0
  130. package/src/returnValue.js +17 -0
  131. package/src/returnValue.js.map +1 -0
  132. package/src/returnValue.ts +26 -0
  133. package/src/rxjs.helper.d.ts +7 -0
  134. package/src/rxjs.helper.js +33 -0
  135. package/src/rxjs.helper.js.map +1 -0
  136. package/src/rxjs.helper.ts +71 -0
  137. package/src/simple-mapper.interceptor.d.ts +7 -0
  138. package/src/simple-mapper.interceptor.js +29 -0
  139. package/src/simple-mapper.interceptor.js.map +1 -0
  140. package/src/simple-mapper.interceptor.ts +43 -0
  141. package/src/validator-helper.d.ts +2 -0
  142. package/src/validator-helper.js +22 -0
  143. package/src/validator-helper.js.map +1 -0
  144. package/src/validator-helper.ts +26 -0
  145. package/src/zlib.helper.d.ts +3 -0
  146. package/src/zlib.helper.js +25 -0
  147. package/src/zlib.helper.js.map +1 -0
  148. package/src/zlib.helper.ts +19 -0
package/src/index.ts ADDED
@@ -0,0 +1,23 @@
1
+ export * from './class.helper.js';
2
+ export * from './custom-validator.js';
3
+ export * from './data-structure.helper.js';
4
+ export * from './date.helper.js';
5
+ export * from './encryption.helper.js';
6
+ export * from './enum.helper.js';
7
+ export * from './env.helper.js';
8
+ export * from './error.helper.js';
9
+ // export * from './faker-helper.js';
10
+ export * from './interval.helper.js';
11
+ export * from './nestjs/nest.decorator.js';
12
+ export * from './object.helper.js';
13
+ export * from './object-mapper.helper.js';
14
+ export * from './object-mapper.interceptor.js';
15
+ // export * from './promise.helper.js';
16
+ export * from './returnValue.js';
17
+ export * from './validator-helper.js';
18
+ export * from './zlib.helper.js';
19
+ export * from './command.helper.js';
20
+ export * from './files.helper.js';
21
+ export * from './rxjs.helper.js';
22
+ export * from './math.helper.js';
23
+ export * from './config-manager.helper.js';
@@ -0,0 +1,5 @@
1
+ export declare class IntervalHelper {
2
+ static createOneDayInterval(): number;
3
+ static createOneSecondInterval(): number;
4
+ static createFiveMinutesInterval(): number;
5
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntervalHelper = void 0;
4
+ class IntervalHelper {
5
+ static createOneDayInterval() {
6
+ return 24 * 60 * 60 * 1000;
7
+ }
8
+ static createOneSecondInterval() {
9
+ return 1000;
10
+ }
11
+ static createFiveMinutesInterval() {
12
+ return 1000 * 60 * 5;
13
+ }
14
+ }
15
+ exports.IntervalHelper = IntervalHelper;
16
+ //# sourceMappingURL=interval.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interval.helper.js","sourceRoot":"","sources":["interval.helper.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IACzB,MAAM,CAAC,oBAAoB;QACzB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,uBAAuB;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,yBAAyB;QAC9B,OAAO,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC;IACvB,CAAC;CACF;AAZD,wCAYC"}
@@ -0,0 +1,13 @@
1
+ export class IntervalHelper {
2
+ static createOneDayInterval(): number {
3
+ return 24 * 60 * 60 * 1000;
4
+ }
5
+
6
+ static createOneSecondInterval(): number {
7
+ return 1000;
8
+ }
9
+
10
+ static createFiveMinutesInterval(): number {
11
+ return 1000 * 60 * 5;
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ export declare function isScientificNotation(num: any): boolean;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isScientificNotation = isScientificNotation;
4
+ function isScientificNotation(num) {
5
+ const scientificPattern = /^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/;
6
+ return scientificPattern.test(num.toString());
7
+ }
8
+ //# sourceMappingURL=math.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.helper.js","sourceRoot":"","sources":["math.helper.ts"],"names":[],"mappings":";;AAAA,oDAGC;AAHD,SAAgB,oBAAoB,CAAC,GAAQ;IAC3C,MAAM,iBAAiB,GAAG,gCAAgC,CAAC;IAC3D,OAAO,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export function isScientificNotation(num: any) {
2
+ const scientificPattern = /^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/;
3
+ return scientificPattern.test(num.toString());
4
+ }
@@ -0,0 +1,3 @@
1
+ import { ExecutionContext } from '@nestjs/common';
2
+ export declare const paramDecoratorToCreate: (_data: unknown, context: ExecutionContext) => ExecutionContext;
3
+ export declare const GetContext: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetContext = exports.paramDecoratorToCreate = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const paramDecoratorToCreate = (_data, context) => {
6
+ return context;
7
+ };
8
+ exports.paramDecoratorToCreate = paramDecoratorToCreate;
9
+ exports.GetContext = (0, common_1.createParamDecorator)(exports.paramDecoratorToCreate);
10
+ //# sourceMappingURL=nest.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest.decorator.js","sourceRoot":"","sources":["nest.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAEjE,MAAM,sBAAsB,GAAG,CACpC,KAAc,EACd,OAAyB,EACP,EAAE;IACpB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEW,QAAA,UAAU,GAAG,IAAA,6BAAoB,EAAC,8BAAsB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ExecutionContext, createParamDecorator } from '@nestjs/common';
2
+
3
+ export const paramDecoratorToCreate = (
4
+ _data: unknown,
5
+ context: ExecutionContext,
6
+ ): ExecutionContext => {
7
+ return context;
8
+ };
9
+
10
+ export const GetContext = createParamDecorator(paramDecoratorToCreate);
@@ -0,0 +1,3 @@
1
+ import { ExecutionContext } from '@nestjs/common';
2
+ export declare const paramDecoratorToCreate: (_data: unknown, context: ExecutionContext) => ExecutionContext;
3
+ export declare const GetContext: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetContext = exports.paramDecoratorToCreate = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const paramDecoratorToCreate = (_data, context) => {
6
+ return context;
7
+ };
8
+ exports.paramDecoratorToCreate = paramDecoratorToCreate;
9
+ exports.GetContext = (0, common_1.createParamDecorator)(exports.paramDecoratorToCreate);
10
+ //# sourceMappingURL=nest.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest.decorator.js","sourceRoot":"","sources":["nest.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAEjE,MAAM,sBAAsB,GAAG,CACpC,KAAc,EACd,OAAyB,EACzB,EAAE;IACF,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AALW,QAAA,sBAAsB,0BAKjC;AAEW,QAAA,UAAU,GAAG,IAAA,6BAAoB,EAAC,8BAAsB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ExecutionContext, createParamDecorator } from '@nestjs/common';
2
+
3
+ export const paramDecoratorToCreate = (
4
+ _data: unknown,
5
+ context: ExecutionContext,
6
+ ) => {
7
+ return context;
8
+ };
9
+
10
+ export const GetContext = createParamDecorator(paramDecoratorToCreate);
@@ -0,0 +1,2 @@
1
+ import { Provider } from '@nestjs/common';
2
+ export declare function isProviderObject(obj: any): obj is Provider;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isProviderObject = isProviderObject;
4
+ function isProviderObject(obj) {
5
+ return obj && typeof obj === 'object' && 'provide' in obj;
6
+ }
7
+ //# sourceMappingURL=nest.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nest.helper.js","sourceRoot":"","sources":["nest.helper.ts"],"names":[],"mappings":";;AAEA,4CAEC;AAFD,SAAgB,gBAAgB,CAAC,GAAQ;IACvC,OAAO,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,SAAS,IAAI,GAAG,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Provider } from '@nestjs/common';
2
+
3
+ export function isProviderObject(obj: any): obj is Provider {
4
+ return obj && typeof obj === 'object' && 'provide' in obj;
5
+ }
@@ -0,0 +1,16 @@
1
+ export type ObjectMapperDestPropertyType<TInputObject extends Record<string, any>, TOutputObject extends Record<string, any>, TPropertyDest extends keyof TOutputObject> = {
2
+ transformer?: (inputObject: TInputObject, propertyName: keyof TInputObject) => TOutputObject[TPropertyDest];
3
+ exclude?: boolean;
4
+ };
5
+ type ObjectType<TInputObject extends Record<string, any>, TOutputObject extends Record<string, any>> = {
6
+ [index in keyof TInputObject]: Partial<{
7
+ [K in keyof TOutputObject]: ObjectMapperDestPropertyType<TInputObject, TOutputObject, K> | boolean;
8
+ }> | keyof TOutputObject | false;
9
+ } & Partial<{
10
+ [index in '$transformer']: (inputObject: TInputObject, outputObject: TOutputObject) => void;
11
+ }>;
12
+ export type ObjectMapperType<TInputObject extends Record<string, any>, TOutputObject extends Record<string, any>> = ObjectType<TInputObject, TOutputObject>;
13
+ export declare function objectMapper<TInputObject extends Record<string, any>, TOutputObject extends Record<string, any>>(inputObject: TInputObject, mapper: ObjectMapperType<TInputObject, TOutputObject>, options?: {
14
+ copyNonMappedProperties?: boolean;
15
+ }): TOutputObject;
16
+ export {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectMapper = objectMapper;
4
+ function setMappedProperty(mapProperty, inputObject, outputObject, propertyName, outputKey) {
5
+ let options;
6
+ if (mapProperty === true) {
7
+ options = {};
8
+ }
9
+ else {
10
+ options = mapProperty;
11
+ }
12
+ if (options.exclude === true)
13
+ return;
14
+ outputObject[outputKey] = options.transformer
15
+ ? options.transformer(inputObject, propertyName)
16
+ : inputObject[propertyName];
17
+ }
18
+ function objectMapper(inputObject, mapper, options = {}) {
19
+ const outputObject = {};
20
+ for (const propertyName in inputObject) {
21
+ if (propertyName === '$transformer') {
22
+ const transformer = inputObject[propertyName];
23
+ transformer(inputObject, outputObject);
24
+ continue;
25
+ }
26
+ const mapProperty = mapper[propertyName];
27
+ if (mapProperty === undefined) {
28
+ if (options.copyNonMappedProperties === true)
29
+ outputObject[propertyName] = inputObject[propertyName];
30
+ continue;
31
+ }
32
+ if (mapProperty === false)
33
+ continue;
34
+ if (typeof mapProperty !== 'object') {
35
+ outputObject[mapProperty] = inputObject[propertyName];
36
+ continue;
37
+ }
38
+ Object.keys(mapProperty).forEach((mapPropertyKey) => {
39
+ const mapPropertyItem = mapProperty[mapPropertyKey];
40
+ if (!mapPropertyItem)
41
+ return;
42
+ setMappedProperty(mapPropertyItem, inputObject, outputObject, propertyName, mapPropertyKey);
43
+ });
44
+ }
45
+ return outputObject;
46
+ }
47
+ //# sourceMappingURL=object-mapper.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-mapper.helper.js","sourceRoot":"","sources":["object-mapper.helper.ts"],"names":[],"mappings":";;AA0EA,oCAyEC;AA/GD,SAAS,iBAAiB,CAKxB,WAEQ,EACR,WAAyB,EACzB,YAA2B,EAC3B,YAAgC,EAChC,SAAwB;IAExB,IAAI,OAIH,CAAC;IAEF,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,WAAW,CAAC;IACxB,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI;QAAE,OAAO;IAErC,YAAY,CAAC,SAAS,CAAC,GAAG,OAAO,CA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ObjectMapperDestPropertyType<
2
+ TInputObject extends Record<string, any>,
3
+ TOutputObject extends Record<string, any>,
4
+ TPropertyDest extends keyof TOutputObject,
5
+ > = {
6
+ transformer?: (
7
+ inputObject: TInputObject,
8
+ propertyName: keyof TInputObject,
9
+ ) => TOutputObject[TPropertyDest];
10
+ exclude?: boolean;
11
+ };
12
+
13
+ type ObjectType<
14
+ TInputObject extends Record<string, any>,
15
+ TOutputObject extends Record<string, any>,
16
+ > = {
17
+ [index in keyof TInputObject]:
18
+ | Partial<{
19
+ [K in keyof TOutputObject]:
20
+ | ObjectMapperDestPropertyType<TInputObject, TOutputObject, K>
21
+ | boolean;
22
+ }>
23
+ | keyof TOutputObject
24
+ | false;
25
+ } & Partial<{
26
+ [index in '$transformer']: (
27
+ inputObject: TInputObject,
28
+ outputObject: TOutputObject,
29
+ ) => void;
30
+ }>;
31
+
32
+ export type ObjectMapperType<
33
+ TInputObject extends Record<string, any>,
34
+ TOutputObject extends Record<string, any>,
35
+ > = ObjectType<TInputObject, TOutputObject>;
36
+
37
+ function setMappedProperty<
38
+ TInputObject extends Record<string, any>,
39
+ TOutputObject extends Record<string, any>,
40
+ TPropertyDest extends keyof TOutputObject,
41
+ >(
42
+ mapProperty:
43
+ | ObjectMapperDestPropertyType<TInputObject, TOutputObject, TPropertyDest>
44
+ | true,
45
+ inputObject: TInputObject,
46
+ outputObject: TOutputObject,
47
+ propertyName: keyof TInputObject,
48
+ outputKey: TPropertyDest,
49
+ ) {
50
+ let options: ObjectMapperDestPropertyType<
51
+ TInputObject,
52
+ TOutputObject,
53
+ TPropertyDest
54
+ >;
55
+
56
+ if (mapProperty === true) {
57
+ options = {};
58
+ } else {
59
+ options = mapProperty;
60
+ }
61
+
62
+ if (options.exclude === true) return; // do not map
63
+
64
+ outputObject[outputKey] = options.transformer
65
+ ? (options.transformer(inputObject, propertyName) as any)
66
+ : inputObject[propertyName];
67
+ }
68
+
69
+ /**
70
+ * This function allows to map 2 Objects with different properties by using
71
+ * a bridge object (the mapper). In this way we can avoid using property decorators
72
+ * that limit the mapping to a single destination, by allowing any mapping combinations.
73
+ *
74
+ */
75
+ export function objectMapper<
76
+ TInputObject extends Record<string, any>,
77
+ TOutputObject extends Record<string, any>,
78
+ >(
79
+ inputObject: TInputObject,
80
+ mapper: ObjectMapperType<TInputObject, TOutputObject>,
81
+ options: {
82
+ copyNonMappedProperties?: boolean;
83
+ } = {},
84
+ ): TOutputObject {
85
+ const outputObject: TOutputObject = {} as TOutputObject;
86
+ for (const propertyName in inputObject) {
87
+ if (propertyName === '$transformer') {
88
+ const transformer = inputObject[propertyName] as (
89
+ inputObject: TInputObject,
90
+ outputObject: TOutputObject,
91
+ ) => void;
92
+ transformer(inputObject, outputObject);
93
+ continue;
94
+ }
95
+
96
+ const mapProperty = mapper[propertyName];
97
+
98
+ // handle mapping when properties are not specified but the option is enabled
99
+ if (mapProperty === undefined) {
100
+ // TODO: use an option to enable this behaviour
101
+ // if (!Object.keys(outputObject).includes(propertyName))
102
+ // throw new Error(
103
+ // `Cannot map property ${propertyName} into the OutputObject. Property doesn't exist in the destination`,
104
+ // );
105
+
106
+ if (options.copyNonMappedProperties === true)
107
+ outputObject[propertyName as keyof TOutputObject] = inputObject[
108
+ propertyName
109
+ ] as any;
110
+
111
+ continue;
112
+ }
113
+
114
+ // handle excluded properties
115
+ if (mapProperty === false) continue; // do not map
116
+
117
+ // handle simple mapping with a string
118
+ if (typeof mapProperty !== 'object') {
119
+ outputObject[mapProperty as keyof TOutputObject] = inputObject[
120
+ propertyName
121
+ ] as any;
122
+ continue;
123
+ }
124
+
125
+ Object.keys(mapProperty).forEach((mapPropertyKey) => {
126
+ // if (typeof mapProperty === 'boolean') {
127
+ // outputObject[mapPropertyKey as keyof TOutputObject] = inputObject[
128
+ // propertyName
129
+ // ] as any;
130
+ // return;
131
+ // }
132
+
133
+ const mapPropertyItem = mapProperty[mapPropertyKey];
134
+
135
+ if (!mapPropertyItem) return; // do not map (should not happen)
136
+
137
+ setMappedProperty(
138
+ mapPropertyItem,
139
+ inputObject,
140
+ outputObject,
141
+ propertyName,
142
+ mapPropertyKey,
143
+ );
144
+ });
145
+ }
146
+
147
+ return outputObject;
148
+ }
@@ -0,0 +1,16 @@
1
+ import { CallHandler, ExecutionContext } from '@nestjs/common';
2
+ import { Observable } from 'rxjs';
3
+ import { ObjectMapperType } from './object-mapper.helper.js';
4
+ export declare function objectMapperInterceptor<TInputObject extends Record<string, any>, TOutputObject extends Record<string, any>>(mapper: ObjectMapperType<TInputObject, TOutputObject>, options?: {
5
+ copyNonMappedProperties?: boolean;
6
+ transformData?: {
7
+ (data: any): any;
8
+ };
9
+ callback?: {
10
+ (inputData: any, outputData: any): any;
11
+ };
12
+ }): {
13
+ new (): {
14
+ intercept(_context: ExecutionContext, next: CallHandler): Observable<any>;
15
+ };
16
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.objectMapperInterceptor = objectMapperInterceptor;
10
+ const common_1 = require("@nestjs/common");
11
+ const rxjs_1 = require("rxjs");
12
+ const object_mapper_helper_js_1 = require("./object-mapper.helper.js");
13
+ function objectMapperInterceptor(mapper, options = {}) {
14
+ let ObjectMapperInterceptor = class ObjectMapperInterceptor {
15
+ intercept(_context, next) {
16
+ return next.handle().pipe((0, rxjs_1.map)((data) => {
17
+ const _data = options.transformData
18
+ ? options.transformData(data)
19
+ : data;
20
+ if (Array.isArray(_data)) {
21
+ const result = _data.map((item) => (0, object_mapper_helper_js_1.objectMapper)(item, mapper));
22
+ return options.callback?.(data, result) ?? result;
23
+ }
24
+ const result = (0, object_mapper_helper_js_1.objectMapper)(_data, mapper, {
25
+ copyNonMappedProperties: options.copyNonMappedProperties,
26
+ });
27
+ return options.callback?.(data, result) ?? result;
28
+ }));
29
+ }
30
+ };
31
+ ObjectMapperInterceptor = __decorate([
32
+ (0, common_1.Injectable)()
33
+ ], ObjectMapperInterceptor);
34
+ return ObjectMapperInterceptor;
35
+ }
36
+ //# sourceMappingURL=object-mapper.interceptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-mapper.interceptor.js","sourceRoot":"","sources":["object-mapper.interceptor.ts"],"names":[],"mappings":";;;;;;;;AASA,0DAyCC;AAlDD,2CAKwB;AACxB,+BAAuC;AACvC,uEAA2E;AAE3E,SAAgB,uBAAuB,CAIrC,MAAqD,EACrD,UASI,EAAE;IAGN,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;QAC3B,SAAS,CAAC,QAA0B,EAAE,IAAiB;YACrD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,UAAG,EAAC,CAAC,IAAI,EAAE,EAAE;gBACX,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa;oBACjC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;oBAC7B,CAAC,CAAC,IAAI,CAAC;gBAET,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,sCAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;oBAC/D,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC;gBACpD,CAAC;gBAED,MAAM,MAAM,GAAG,IAAA,sCAAY,EAAC,KAAK,EAAE,MAAM,EAAE;oBACzC,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;iBACzD,CAAC,CAAC;gBAEH,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC;YACpD,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;KACF,CAAA;IArBK,uBAAuB;QAD5B,IAAA,mBAAU,GAAE;OACP,uBAAuB,CAqB5B;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import {
2
+ CallHandler,
3
+ ExecutionContext,
4
+ Injectable,
5
+ NestInterceptor,
6
+ } from '@nestjs/common';
7
+ import { Observable, map } from 'rxjs';
8
+ import { objectMapper, ObjectMapperType } from './object-mapper.helper.js';
9
+
10
+ export function objectMapperInterceptor<
11
+ TInputObject extends Record<string, any>,
12
+ TOutputObject extends Record<string, any>,
13
+ >(
14
+ mapper: ObjectMapperType<TInputObject, TOutputObject>,
15
+ options: {
16
+ copyNonMappedProperties?: boolean;
17
+ /*
18
+ * Mainly used to select the object to process when the structure
19
+ * of the data contains the object that needs to be mapped in a nested property
20
+ * Can also be used to transform the data before mapping
21
+ */
22
+ transformData?: { (data: any): any };
23
+ callback?: { (inputData: any, outputData: any): any };
24
+ } = {},
25
+ ) {
26
+ @Injectable()
27
+ class ObjectMapperInterceptor implements NestInterceptor {
28
+ intercept(_context: ExecutionContext, next: CallHandler): Observable<any> {
29
+ return next.handle().pipe(
30
+ map((data) => {
31
+ const _data = options.transformData
32
+ ? options.transformData(data)
33
+ : data;
34
+
35
+ if (Array.isArray(_data)) {
36
+ const result = _data.map((item) => objectMapper(item, mapper));
37
+ return options.callback?.(data, result) ?? result;
38
+ }
39
+
40
+ const result = objectMapper(_data, mapper, {
41
+ copyNonMappedProperties: options.copyNonMappedProperties,
42
+ });
43
+
44
+ return options.callback?.(data, result) ?? result;
45
+ }),
46
+ );
47
+ }
48
+ }
49
+
50
+ return ObjectMapperInterceptor;
51
+ }
@@ -0,0 +1,18 @@
1
+ interface IIsObject {
2
+ (item: any): boolean;
3
+ }
4
+ interface IObject {
5
+ [key: string]: any;
6
+ }
7
+ interface IDeepMerge {
8
+ (target: IObject, ...sources: Array<IObject>): IObject;
9
+ }
10
+ export declare const isObject: IIsObject;
11
+ export declare function isObjectStrict(val: any): val is Record<string, any>;
12
+ export declare const _deepMerge: (isArrayConcat: boolean, target: IObject, ...sources: Array<IObject>) => IObject;
13
+ export declare const deepMerge: IDeepMerge;
14
+ export declare const deepMergeWithoutArrayConcat: IDeepMerge;
15
+ export declare function objectSetProp(obj: Record<any, any>, path: string, value: any): Record<any, any>;
16
+ export declare function objectsHaveSameKeys(...objects: any[]): boolean;
17
+ export declare function getObjectId(object: Record<string, unknown> | Array<unknown>): number;
18
+ export {};
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deepMergeWithoutArrayConcat = exports.deepMerge = exports._deepMerge = exports.isObject = void 0;
4
+ exports.isObjectStrict = isObjectStrict;
5
+ exports.objectSetProp = objectSetProp;
6
+ exports.objectsHaveSameKeys = objectsHaveSameKeys;
7
+ exports.getObjectId = getObjectId;
8
+ const isObject = (val) => {
9
+ return val === Object(val) && !Array.isArray(val);
10
+ };
11
+ exports.isObject = isObject;
12
+ function isObjectStrict(val) {
13
+ return ((0, exports.isObject)(val) &&
14
+ !Array.isArray(val) &&
15
+ !(val instanceof Date) &&
16
+ !(typeof val === 'function'));
17
+ }
18
+ const _deepMerge = (isArrayConcat, target, ...sources) => {
19
+ if (!sources.length) {
20
+ return target;
21
+ }
22
+ const result = target;
23
+ if ((0, exports.isObject)(result)) {
24
+ const len = sources.length;
25
+ for (let i = 0; i < len; i += 1) {
26
+ const elm = sources[i];
27
+ if ((0, exports.isObject)(elm)) {
28
+ for (const key in elm) {
29
+ if (Object.prototype.hasOwnProperty.call(elm, key)) {
30
+ if ((0, exports.isObject)(elm[key]) && typeof elm[key] !== 'function') {
31
+ if (!result[key] || !(0, exports.isObject)(result[key])) {
32
+ result[key] = {};
33
+ }
34
+ (0, exports._deepMerge)(isArrayConcat, result[key], elm[key]);
35
+ }
36
+ else {
37
+ if (isArrayConcat &&
38
+ Array.isArray(result[key]) &&
39
+ Array.isArray(elm[key])) {
40
+ result[key] = Array.from(new Set(result[key].concat(elm[key])));
41
+ }
42
+ else {
43
+ result[key] = elm[key];
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ return result;
52
+ };
53
+ exports._deepMerge = _deepMerge;
54
+ const deepMerge = (target, ...sources) => {
55
+ return (0, exports._deepMerge)(true, target, ...sources);
56
+ };
57
+ exports.deepMerge = deepMerge;
58
+ const deepMergeWithoutArrayConcat = (target, ...sources) => {
59
+ return (0, exports._deepMerge)(false, target, ...sources);
60
+ };
61
+ exports.deepMergeWithoutArrayConcat = deepMergeWithoutArrayConcat;
62
+ function objectSetProp(obj, path, value) {
63
+ let schema = obj;
64
+ const pList = path.split('.');
65
+ const len = pList.length;
66
+ for (let i = 0; i < len - 1; i++) {
67
+ const elem = pList[i];
68
+ if (!schema[elem])
69
+ schema[elem] = {};
70
+ schema = schema[elem];
71
+ }
72
+ schema[pList[len - 1]] = value;
73
+ return obj;
74
+ }
75
+ function objectsHaveSameKeys(...objects) {
76
+ const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
77
+ const union = new Set(allKeys);
78
+ return objects.every((object) => union.size === Object.keys(object).length);
79
+ }
80
+ let count = 0;
81
+ const idMap = new WeakMap();
82
+ function getObjectId(object) {
83
+ const objectId = idMap.get(object);
84
+ if (objectId === undefined) {
85
+ count += 1;
86
+ idMap.set(object, count);
87
+ return count;
88
+ }
89
+ return objectId;
90
+ }
91
+ //# sourceMappingURL=object.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.helper.js","sourceRoot":"","sources":["object.helper.ts"],"names":[],"mappings":";;;AA2BA,wCAOC;AA4FD,s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