@forklaunch/core 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.prettierignore +2 -0
  2. package/.prettierrc +6 -0
  3. package/dist/cache/index.d.ts +3 -0
  4. package/dist/cache/index.js +20 -0
  5. package/dist/cache/index.js.map +1 -0
  6. package/dist/cache/interfaces/ttlCache.interface.d.ts +1 -1
  7. package/dist/cache/redisTtlCache.d.ts +3 -2
  8. package/dist/cache/redisTtlCache.js +2 -2
  9. package/dist/cache/redisTtlCache.js.map +1 -1
  10. package/dist/cache/types/{ttlCacheRecord.js → ttlCacheRecord.types.js} +1 -1
  11. package/dist/cache/types/ttlCacheRecord.types.js.map +1 -0
  12. package/dist/controllers/index.d.ts +1 -0
  13. package/dist/controllers/index.js +18 -0
  14. package/dist/controllers/index.js.map +1 -0
  15. package/dist/database/index.d.ts +1 -0
  16. package/dist/database/index.js +18 -0
  17. package/dist/database/index.js.map +1 -0
  18. package/dist/database/mikro/models/entities/base.entity.js +1 -1
  19. package/dist/entityMapper/index.d.ts +2 -0
  20. package/dist/entityMapper/index.js +19 -0
  21. package/dist/entityMapper/index.js.map +1 -0
  22. package/dist/entityMapper/interfaces/entityMapper.interface.d.ts +3 -3
  23. package/dist/entityMapper/models/baseEntityMapper.model.d.ts +23 -23
  24. package/dist/entityMapper/models/baseEntityMapper.model.js +15 -15
  25. package/dist/entityMapper/models/baseEntityMapper.model.js.map +1 -1
  26. package/dist/entityMapper/models/requestEntityMapper.model.d.ts +17 -23
  27. package/dist/entityMapper/models/requestEntityMapper.model.js +13 -19
  28. package/dist/entityMapper/models/requestEntityMapper.model.js.map +1 -1
  29. package/dist/entityMapper/models/responseEntityMapper.model.d.ts +15 -16
  30. package/dist/entityMapper/models/responseEntityMapper.model.js +8 -8
  31. package/dist/entityMapper/models/responseEntityMapper.model.js.map +1 -1
  32. package/dist/entityMapper/types/entityMapper.types.d.ts +3 -22
  33. package/dist/http/index.d.ts +2 -0
  34. package/dist/http/index.js +19 -0
  35. package/dist/http/index.js.map +1 -0
  36. package/dist/http/middlewares/index.d.ts +2 -0
  37. package/dist/http/middlewares/index.js +19 -0
  38. package/dist/http/middlewares/index.js.map +1 -0
  39. package/dist/http/middlewares/request.middleware.d.ts +11 -11
  40. package/dist/http/middlewares/request.middleware.js +23 -21
  41. package/dist/http/middlewares/request.middleware.js.map +1 -1
  42. package/dist/http/middlewares/response.middleware.d.ts +3 -3
  43. package/dist/http/middlewares/response.middleware.js +7 -3
  44. package/dist/http/middlewares/response.middleware.js.map +1 -1
  45. package/dist/http/types/api.types.d.ts +16 -12
  46. package/dist/http/types/index.d.ts +2 -0
  47. package/dist/http/types/index.js +19 -0
  48. package/dist/http/types/index.js.map +1 -0
  49. package/dist/http/types/primitive.types.d.ts +14 -13
  50. package/dist/index.d.ts +6 -1
  51. package/dist/index.js +20 -5
  52. package/dist/index.js.map +1 -1
  53. package/dist/services/index.d.ts +1 -0
  54. package/dist/services/index.js +18 -0
  55. package/dist/services/index.js.map +1 -0
  56. package/dist/services/interfaces/baseService.d.ts +1 -1
  57. package/dist/tests/{dto.test.js → entityMapper.test.js} +10 -32
  58. package/dist/tests/entityMapper.test.js.map +1 -0
  59. package/dist/tests/http.middleware.test.d.ts +1 -0
  60. package/dist/tests/http.middleware.test.js +79 -0
  61. package/dist/tests/http.middleware.test.js.map +1 -0
  62. package/dist/tests/redisTtlCache.test.js +32 -15
  63. package/dist/tests/redisTtlCache.test.js.map +1 -1
  64. package/entityMapper/index.ts +2 -0
  65. package/entityMapper/interfaces/entityMapper.interface.ts +11 -11
  66. package/entityMapper/models/baseEntityMapper.model.ts +90 -73
  67. package/entityMapper/models/requestEntityMapper.model.ts +96 -75
  68. package/entityMapper/models/responseEntityMapper.model.ts +83 -62
  69. package/entityMapper/types/entityMapper.types.ts +6 -23
  70. package/http/index.ts +2 -0
  71. package/http/middlewares/index.ts +2 -0
  72. package/http/middlewares/request.middleware.ts +103 -55
  73. package/http/middlewares/response.middleware.ts +56 -31
  74. package/http/types/api.types.ts +43 -25
  75. package/http/types/index.ts +2 -0
  76. package/http/types/primitive.types.ts +65 -44
  77. package/index.ts +6 -5
  78. package/jest.config.ts +2 -2
  79. package/package.json +13 -4
  80. package/tests/entityMapper.test.ts +219 -0
  81. package/tests/http.middleware.test.ts +99 -0
  82. package/tests/redisTtlCache.test.ts +49 -29
  83. package/dist/cache/types/ttlCacheRecord.js.map +0 -1
  84. package/dist/tests/dto.test.js.map +0 -1
  85. package/tests/dto.test.ts +0 -235
  86. /package/dist/cache/types/{ttlCacheRecord.d.ts → ttlCacheRecord.types.d.ts} +0 -0
  87. /package/dist/tests/{dto.test.d.ts → entityMapper.test.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ node_modules/
2
+ dist/
package/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "none",
4
+ "singleQuote": true,
5
+ "printWidth": 80
6
+ }
@@ -0,0 +1,3 @@
1
+ export * from './interfaces/ttlCache.interface';
2
+ export * from './redisTtlCache';
3
+ export * from './types/ttlCacheRecord.types';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces/ttlCache.interface"), exports);
18
+ __exportStar(require("./redisTtlCache"), exports);
19
+ __exportStar(require("./types/ttlCacheRecord.types"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,kDAAgC;AAChC,+DAA6C"}
@@ -1,4 +1,4 @@
1
- import { TtlCacheRecord } from "../types/ttlCacheRecord";
1
+ import { TtlCacheRecord } from '../types/ttlCacheRecord.types';
2
2
  /**
3
3
  * Interface representing a TTL (Time-To-Live) cache.
4
4
  */
@@ -1,5 +1,6 @@
1
+ import { RedisClientOptions } from 'redis';
1
2
  import { TtlCache } from './interfaces/ttlCache.interface';
2
- import { TtlCacheRecord } from './types/ttlCacheRecord';
3
+ import { TtlCacheRecord } from './types/ttlCacheRecord.types';
3
4
  /**
4
5
  * Class representing a Redis-based TTL (Time-To-Live) cache.
5
6
  * Implements the TtlCache interface.
@@ -12,7 +13,7 @@ export declare class RedisTtlCache implements TtlCache {
12
13
  *
13
14
  * @param {number} ttlMilliseconds - The default TTL in milliseconds.
14
15
  */
15
- constructor(ttlMilliseconds: number);
16
+ constructor(ttlMilliseconds: number, hostingOptions?: RedisClientOptions);
16
17
  /**
17
18
  * Puts a record into the Redis cache.
18
19
  *
@@ -14,11 +14,11 @@ class RedisTtlCache {
14
14
  *
15
15
  * @param {number} ttlMilliseconds - The default TTL in milliseconds.
16
16
  */
17
- constructor(ttlMilliseconds) {
17
+ constructor(ttlMilliseconds, hostingOptions) {
18
18
  this.ttlMilliseconds = ttlMilliseconds;
19
19
  // Connects to localhost:6379 by default
20
20
  // url usage: redis[s]://[[username][:password]@][host][:port][/db-number]
21
- this.client = (0, redis_1.createClient)();
21
+ this.client = (0, redis_1.createClient)(hostingOptions);
22
22
  this.client.on('error', (err) => console.log('Redis Client Error', err));
23
23
  this.client.on('connect', () => {
24
24
  console.log('\x1b[32m%s\x1b[0m', 'Successfully Connected to Redis'); // Green text
@@ -1 +1 @@
1
- {"version":3,"file":"redisTtlCache.js","sourceRoot":"","sources":["../../cache/redisTtlCache.ts"],"names":[],"mappings":";;;AAAA,iCAAqC;AAIrC;;;GAGG;AACH,MAAa,aAAa;IAQJ;IAPZ,MAAM,CAAC;IAEf;;;;OAIG;IACH,YAAoB,eAAuB;QAAvB,oBAAe,GAAf,eAAe,CAAQ;QACzC,wCAAwC;QACxC,0EAA0E;QAC1E,IAAI,CAAC,MAAM,GAAG,IAAA,oBAAY,GAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC7B,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,iCAAiC,CAAC,CAAC,CAAE,aAAa;QACrF,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC,eAAe,EAAkB;QACpF,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YAChD,EAAE,EAAE,eAAe;SACpB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,cAAsB;QACvC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,UAAU,CAAC,c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M,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,uBAAuB;QAC1E,OAAO;YACL,GAAG,EAAE,cAAc;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACxB,eAAe,EAAE,GAAG,GAAG,IAAI;SAC5B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,cAAsB;QACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,cAAsB;QACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACxD,OAAO,MAAM,KAAK,CAAC,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF;AA3GD,sCA2GC"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ttlCacheRecord.js.map
3
+ //# sourceMappingURL=ttlCacheRecord.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ttlCacheRecord.types.js","sourceRoot":"","sources":["../../../cache/types/ttlCacheRecord.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './interfaces/controller.interface';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./interfaces/controller.interface"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD"}
@@ -0,0 +1 @@
1
+ export * from './mikro/models/entities/base.entity';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./mikro/models/entities/base.entity"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD"}
@@ -39,7 +39,7 @@ class BaseEntity {
39
39
  }
40
40
  exports.BaseEntity = BaseEntity;
41
41
  __decorate([
42
- (0, core_1.PrimaryKey)({ type: "uuid" }),
42
+ (0, core_1.PrimaryKey)({ type: 'uuid' }),
43
43
  __metadata("design:type", String)
44
44
  ], BaseEntity.prototype, "id", void 0);
45
45
  __decorate([
@@ -0,0 +1,2 @@
1
+ export * from './models/requestEntityMapper.model';
2
+ export * from './models/responseEntityMapper.model';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models/requestEntityMapper.model"), exports);
18
+ __exportStar(require("./models/responseEntityMapper.model"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../entityMapper/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAmD;AACnD,sEAAoD"}
@@ -1,15 +1,15 @@
1
- import { SchemaValidator } from "@forklaunch/validator/interfaces";
1
+ import { AnySchemaValidator } from '@forklaunch/validator';
2
2
  /**
3
3
  * Interface representing a constructor for an entity mapper.
4
4
  *
5
5
  * @template T - The type of the entity mapper.
6
6
  * @interface EntityMapperConstructor
7
7
  */
8
- export interface EntityMapperConstructor<T, SV extends SchemaValidator> {
8
+ export interface EntityMapperConstructor<T, SV extends AnySchemaValidator> {
9
9
  /**
10
10
  * Creates a new instance of the entity mapper.
11
11
  *
12
- * @param {SchemaValidator} schemaValidator - The arguments to pass to the constructor.
12
+ * @param {AnySchemaValidator} schemaValidator - The arguments to pass to the constructor.
13
13
  * @returns {T} - A new instance of the entity mapper.
14
14
  */
15
15
  new (schemaValidator: SV): T;
@@ -1,33 +1,33 @@
1
- import { SchemaValidator } from "@forklaunch/validator/interfaces";
2
- import { EntityMapperConstructor } from "../interfaces/entityMapper.interface";
3
- import { EntityMapperSchema, EntityMapperSchemaValidatorObject } from "../types/entityMapper.types";
1
+ import { AnySchemaValidator, Schema, SchemaValidator } from '@forklaunch/validator';
2
+ import { EntityMapperConstructor } from '../interfaces/entityMapper.interface';
3
+ import { EntityMapperSchemaValidatorObject } from '../types/entityMapper.types';
4
4
  /**
5
- * Constructs an instance of a EntityMapperType.
5
+ * Constructs an instance of a T.
6
6
  *
7
- * @template EntityMapperType - A type that extends BaseEntityMapper.
8
- * @param {EntityMapperConstructor<EntityMapperType>} self - The constructor of the EntityMapperType.
7
+ * @template T - A type that extends BaseEntityMapper.
8
+ * @param {EntityMapperConstructor<T>} self - The constructor of the T.
9
9
  * @param {...any[]} args - The arguments to pass to the constructor.
10
- * @returns {EntityMapperType} - An instance of the EntityMapperType.
10
+ * @returns {T} - An instance of the T.
11
11
  */
12
- export declare function construct<EntityMapperType, SV extends SchemaValidator>(self: EntityMapperConstructor<EntityMapperType, SV>, schemaValidator?: SV): EntityMapperType;
12
+ export declare function construct<T, SV extends AnySchemaValidator>(self: EntityMapperConstructor<T, SV>, schemaValidator?: SV): T;
13
13
  /**
14
14
  * Abstract class representing a base entityMapper.
15
15
  *
16
16
  * @template SV - A type that extends SchemaValidator.
17
17
  */
18
- export declare abstract class BaseEntityMapper<SV extends SchemaValidator> {
18
+ export declare abstract class BaseEntityMapper<SV extends AnySchemaValidator> {
19
19
  /**
20
- * The schema validator.
21
- * @type {SV}
22
- * @protected
23
- */
20
+ * The schema validator exact type.
21
+ * @type {SV}
22
+ * @protected
23
+ */
24
24
  _SV: SV;
25
25
  /**
26
- * The schema provider.
27
- * @type {SV}
26
+ * The schema validator as a general type.
27
+ * @type {SchemaValidator}
28
28
  * @protected
29
29
  */
30
- protected schemaValidator: SV;
30
+ protected schemaValidator: SchemaValidator;
31
31
  /**
32
32
  * The schema definition.
33
33
  * @type {EntityMapperSchemaValidatorObject<SV>}
@@ -36,10 +36,10 @@ export declare abstract class BaseEntityMapper<SV extends SchemaValidator> {
36
36
  abstract schema: EntityMapperSchemaValidatorObject<SV>;
37
37
  /**
38
38
  * The Data Transfer Object (DTO).
39
- * @type {EntityMapperSchema<this['schema'], SV>}
39
+ * @type {Schema<this['schema'], SV>}
40
40
  *
41
41
  */
42
- _dto: EntityMapperSchema<this['schema'], SV>;
42
+ _dto: Schema<this['schema'], SV>;
43
43
  /**
44
44
  * Creates an instance of BaseEntityMapper.
45
45
  *
@@ -61,11 +61,11 @@ export declare abstract class BaseEntityMapper<SV extends SchemaValidator> {
61
61
  */
62
62
  get dto(): this['_dto'];
63
63
  /**
64
- * Gets the schema of a EntityMapperType.
64
+ * Gets the schema of a T.
65
65
  *
66
- * @template EntityMapperType - A type that extends BaseEntityMapper.
67
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
68
- * @returns {EntityMapperType['schema']} - The schema of the EntityMapperType.
66
+ * @template T - A type that extends BaseEntityMapper.
67
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
68
+ * @returns {T['schema']} - The schema of the T.
69
69
  */
70
- static schema<EntityMapperType extends BaseEntityMapper<any>>(this: EntityMapperConstructor<EntityMapperType, EntityMapperType['_SV']>): EntityMapperType['schema'];
70
+ static schema<T extends BaseEntityMapper<SV>, SV extends AnySchemaValidator>(this: EntityMapperConstructor<T, SV>): T['schema'];
71
71
  }
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseEntityMapper = void 0;
4
4
  exports.construct = construct;
5
5
  /**
6
- * Constructs an instance of a EntityMapperType.
6
+ * Constructs an instance of a T.
7
7
  *
8
- * @template EntityMapperType - A type that extends BaseEntityMapper.
9
- * @param {EntityMapperConstructor<EntityMapperType>} self - The constructor of the EntityMapperType.
8
+ * @template T - A type that extends BaseEntityMapper.
9
+ * @param {EntityMapperConstructor<T>} self - The constructor of the T.
10
10
  * @param {...any[]} args - The arguments to pass to the constructor.
11
- * @returns {EntityMapperType} - An instance of the EntityMapperType.
11
+ * @returns {T} - An instance of the T.
12
12
  */
13
13
  function construct(self, schemaValidator) {
14
14
  return new self(schemaValidator || {});
@@ -20,20 +20,20 @@ function construct(self, schemaValidator) {
20
20
  */
21
21
  class BaseEntityMapper {
22
22
  /**
23
- * The schema validator.
24
- * @type {SV}
25
- * @protected
26
- */
23
+ * The schema validator exact type.
24
+ * @type {SV}
25
+ * @protected
26
+ */
27
27
  _SV;
28
28
  /**
29
- * The schema provider.
30
- * @type {SV}
29
+ * The schema validator as a general type.
30
+ * @type {SchemaValidator}
31
31
  * @protected
32
32
  */
33
33
  schemaValidator;
34
34
  /**
35
35
  * The Data Transfer Object (DTO).
36
- * @type {EntityMapperSchema<this['schema'], SV>}
36
+ * @type {Schema<this['schema'], SV>}
37
37
  *
38
38
  */
39
39
  _dto = {};
@@ -67,11 +67,11 @@ class BaseEntityMapper {
67
67
  return this._dto;
68
68
  }
69
69
  /**
70
- * Gets the schema of a EntityMapperType.
70
+ * Gets the schema of a T.
71
71
  *
72
- * @template EntityMapperType - A type that extends BaseEntityMapper.
73
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
74
- * @returns {EntityMapperType['schema']} - The schema of the EntityMapperType.
72
+ * @template T - A type that extends BaseEntityMapper.
73
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
74
+ * @returns {T['schema']} - The schema of the T.
75
75
  */
76
76
  static schema() {
77
77
  return construct(this).schema;
@@ -1 +1 @@
1
- {"version":3,"file":"baseEntityMapper.model.js","sourceRoot":"","sources":["../../../entityMapper/models/baseEntityMapper.model.ts"],"names":[],"mappings":";;;AAYA,8BAEC;AAVD;;;;;;;GAOG;AACH,SAAgB,SAAS,CAA+C,IAAmD,EAAE,eAAoB;IAC7I,OAAO,IAAI,IAAI,CAAC,eAAe,IAAI,EAAQ,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAsB,gBAAgB;IACjC;;;;MAIE;IACH,GAAG,CAAM;IAET;;;;OAIG;IACO,eAAe,CAAK;IAS9B;;;;OAIG;IACH,IAAI,GAA2C,EAAuD,CAAC;IAEvG;;;;OAIG;IACH,YAAY,eAAmB;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,IAAI,GAAG,CAAC,IAAkB;QACtB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;YACnF,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAyD,CAAC;IAC1E,CAAC;IAED;;;;;OAKG;IACH,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,IAA+B,CAAC;IAChD,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM;QACT,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAClC,CAAC;CACJ;AAvED,4CAuEC"}
1
+ {"version":3,"file":"baseEntityMapper.model.js","sourceRoot":"","sources":["../../../entityMapper/models/baseEntityMapper.model.ts"],"names":[],"mappings":";;;AAgBA,8BAKC;AAbD;;;;;;;GAOG;AACH,SAAgB,SAAS,CACvB,IAAoC,EACpC,eAAoB;IAEpB,OAAO,IAAI,IAAI,CAAC,eAAe,IAAK,EAAS,CAAC,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAsB,gBAAgB;IACpC;;;;OAIG;IACH,GAAG,CAAM;IAET;;;;OAIG;IACO,eAAe,CAAkB;IAS3C;;;;OAIG;IACH,IAAI,GAA+B,EAGlC,CAAC;IAEF;;;;OAIG;IACH,YAAY,eAAmB;QAC7B,IAAI,CAAC,eAAe,GAAG,eAA6C,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACH,IAAI,GAAG,CAAC,IAAkB;QACxB,IACE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAC5B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,IAAI,CACL,EACD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAA6C,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAA+B,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM;QAGX,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAChC,CAAC;CACF;AAjFD,4CAiFC"}
@@ -1,7 +1,7 @@
1
- import { SchemaValidator } from "@forklaunch/validator/interfaces";
2
- import { BaseEntity } from "../../database/mikro/models/entities/base.entity";
3
- import { EntityMapperConstructor } from "../interfaces/entityMapper.interface";
4
- import { BaseEntityMapper } from "./baseEntityMapper.model";
1
+ import { AnySchemaValidator } from '@forklaunch/validator';
2
+ import { BaseEntity } from '../../database/mikro/models/entities/base.entity';
3
+ import { EntityMapperConstructor } from '../interfaces/entityMapper.interface';
4
+ import { BaseEntityMapper } from './baseEntityMapper.model';
5
5
  /**
6
6
  * Abstract class representing a request entityMapper.
7
7
  *
@@ -9,19 +9,13 @@ import { BaseEntityMapper } from "./baseEntityMapper.model";
9
9
  * @template SV - A type that extends SchemaValidator.
10
10
  * @extends {BaseEntityMapper<SV>}
11
11
  */
12
- export declare abstract class RequestEntityMapper<Entity extends BaseEntity | unknown, SV extends SchemaValidator> extends BaseEntityMapper<SV> {
12
+ export declare abstract class RequestEntityMapper<Entity extends BaseEntity, SV extends AnySchemaValidator> extends BaseEntityMapper<SV> {
13
13
  /**
14
14
  * The entity.
15
15
  * @type {Entity}
16
16
  * @protected
17
17
  */
18
18
  _Entity: Entity;
19
- /**
20
- * Creates an instance of RequestEntityMapper.
21
- *
22
- * @param {SV} schemaValidator - The schema provider.
23
- */
24
- constructor(schemaValidator: SV);
25
19
  /**
26
20
  * Converts the underlying DTO to an entity.
27
21
  *
@@ -48,22 +42,22 @@ export declare abstract class RequestEntityMapper<Entity extends BaseEntity | un
48
42
  /**
49
43
  * Creates an instance of a RequestEntityMapper from a JSON object.
50
44
  *
51
- * @template EntityMapperType - A type that extends RequestEntityMapper.
52
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
53
- * @param {EntityMapperType['_SV']} schemaValidator - The schema provider.
54
- * @param {EntityMapperType['_dto']} json - The JSON object.
55
- * @returns {EntityMapperType} - An instance of the EntityMapperType.
45
+ * @template T - A type that extends RequestEntityMapper.
46
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
47
+ * @param {T['_SV']} schemaValidator - The schema provider.
48
+ * @param {T['_dto']} json - The JSON object.
49
+ * @returns {T} - An instance of the T.
56
50
  */
57
- static fromJson<EntityMapperType extends RequestEntityMapper<unknown, any>>(this: EntityMapperConstructor<EntityMapperType, EntityMapperType['_SV']>, schemaValidator: EntityMapperType['_SV'], json: EntityMapperType['_dto']): EntityMapperType;
51
+ static fromJson<T extends RequestEntityMapper<BaseEntity, SV>, SV extends AnySchemaValidator, JsonType extends T['_dto']>(this: EntityMapperConstructor<T, SV>, schemaValidator: SV, json: JsonType): T;
58
52
  /**
59
53
  * Deserializes a JSON object to an entity.
60
54
  *
61
- * @template EntityMapperType - A type that extends RequestEntityMapper.
62
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
63
- * @param {EntityMapperType['_SV']} schemaValidator - The schema provider.
64
- * @param {EntityMapperType['_dto']} json - The JSON object.
55
+ * @template T - A type that extends RequestEntityMapper.
56
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
57
+ * @param {T['_SV']} schemaValidator - The schema provider.
58
+ * @param {T['_dto']} json - The JSON object.
65
59
  * @param {...unknown[]} additionalArgs - Additional arguments.
66
- * @returns {EntityMapperType['_Entity']} - The entity.
60
+ * @returns {T['_Entity']} - The entity.
67
61
  */
68
- static deserializeJsonToEntity<EntityMapperType extends RequestEntityMapper<unknown, any>>(this: EntityMapperConstructor<EntityMapperType, EntityMapperType['_SV']>, schemaValidator: EntityMapperType['_SV'], json: EntityMapperType['_dto'], ...additionalArgs: unknown[]): EntityMapperType['_Entity'];
62
+ static deserializeJsonToEntity<T extends RequestEntityMapper<BaseEntity, SV>, SV extends AnySchemaValidator, JsonType extends T['_dto']>(this: EntityMapperConstructor<T, SV>, schemaValidator: SV, json: JsonType, ...additionalArgs: unknown[]): T['_Entity'];
69
63
  }
@@ -16,14 +16,6 @@ class RequestEntityMapper extends baseEntityMapper_model_1.BaseEntityMapper {
16
16
  * @protected
17
17
  */
18
18
  _Entity;
19
- /**
20
- * Creates an instance of RequestEntityMapper.
21
- *
22
- * @param {SV} schemaValidator - The schema provider.
23
- */
24
- constructor(schemaValidator) {
25
- super(schemaValidator);
26
- }
27
19
  /**
28
20
  * Populates the DTO with data from a JSON object.
29
21
  *
@@ -50,11 +42,11 @@ class RequestEntityMapper extends baseEntityMapper_model_1.BaseEntityMapper {
50
42
  /**
51
43
  * Creates an instance of a RequestEntityMapper from a JSON object.
52
44
  *
53
- * @template EntityMapperType - A type that extends RequestEntityMapper.
54
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
55
- * @param {EntityMapperType['_SV']} schemaValidator - The schema provider.
56
- * @param {EntityMapperType['_dto']} json - The JSON object.
57
- * @returns {EntityMapperType} - An instance of the EntityMapperType.
45
+ * @template T - A type that extends RequestEntityMapper.
46
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
47
+ * @param {T['_SV']} schemaValidator - The schema provider.
48
+ * @param {T['_dto']} json - The JSON object.
49
+ * @returns {T} - An instance of the T.
58
50
  */
59
51
  static fromJson(schemaValidator, json) {
60
52
  return (0, baseEntityMapper_model_1.construct)(this, schemaValidator).fromJson(json);
@@ -62,15 +54,17 @@ class RequestEntityMapper extends baseEntityMapper_model_1.BaseEntityMapper {
62
54
  /**
63
55
  * Deserializes a JSON object to an entity.
64
56
  *
65
- * @template EntityMapperType - A type that extends RequestEntityMapper.
66
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
67
- * @param {EntityMapperType['_SV']} schemaValidator - The schema provider.
68
- * @param {EntityMapperType['_dto']} json - The JSON object.
57
+ * @template T - A type that extends RequestEntityMapper.
58
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
59
+ * @param {T['_SV']} schemaValidator - The schema provider.
60
+ * @param {T['_dto']} json - The JSON object.
69
61
  * @param {...unknown[]} additionalArgs - Additional arguments.
70
- * @returns {EntityMapperType['_Entity']} - The entity.
62
+ * @returns {T['_Entity']} - The entity.
71
63
  */
72
64
  static deserializeJsonToEntity(schemaValidator, json, ...additionalArgs) {
73
- return (0, baseEntityMapper_model_1.construct)(this, schemaValidator).fromJson(json).toEntity(...additionalArgs);
65
+ return (0, baseEntityMapper_model_1.construct)(this, schemaValidator)
66
+ .fromJson(json)
67
+ .toEntity(...additionalArgs);
74
68
  }
75
69
  }
76
70
  exports.RequestEntityMapper = RequestEntityMapper;
@@ -1 +1 @@
1
- {"version":3,"file":"requestEntityMapper.model.js","sourceRoot":"","sources":["../../../entityMapper/models/requestEntityMapper.model.ts"],"names":[],"mappings":";;;AAGA,qEAAuE;AAEvE;;;;;;GAMG;AACH,MAAsB,mBAAqF,SAAQ,yCAAoB;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IACH,OAAO,CAAU;IAWjB;;;;;OAKG;IACH,QAAQ,CAAC,IAAkB;QACzB,IACE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAC5B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,IAAI,CACL,EACD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,uBAAuB,CACrB,IAAkB,EAClB,GAAG,cAAyB;QAE5B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAMb,eAAmB,EACnB,IAAc;QAEd,OAAO,IAAA,kCAAS,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,uBAAuB,CAM5B,eAAmB,EACnB,IAAc,EACd,GAAG,cAAyB;QAE5B,OAAO,IAAA,kCAAS,EAAC,IAAI,EAAE,eAAe,CAAC;aACpC,QAAQ,CAAC,IAAI,CAAC;aACd,QAAQ,CAAC,GAAG,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AAlGD,kDAkGC"}
@@ -1,8 +1,7 @@
1
- import { SchemaValidator } from "@forklaunch/validator/interfaces";
2
- import { BaseEntity } from "../../database/mikro/models/entities/base.entity";
3
- import { EntityMapperConstructor } from "../interfaces/entityMapper.interface";
4
- import { EntityMapperStaticSchema } from "../types/entityMapper.types";
5
- import { BaseEntityMapper } from "./baseEntityMapper.model";
1
+ import { AnySchemaValidator } from '@forklaunch/validator';
2
+ import { BaseEntity } from '../../database/mikro/models/entities/base.entity';
3
+ import { EntityMapperConstructor } from '../interfaces/entityMapper.interface';
4
+ import { BaseEntityMapper } from './baseEntityMapper.model';
6
5
  /**
7
6
  * Abstract class representing a response entityMapper.
8
7
  *
@@ -10,7 +9,7 @@ import { BaseEntityMapper } from "./baseEntityMapper.model";
10
9
  * @template SV - A type that extends SchemaValidator.
11
10
  * @extends {BaseEntityMapper<SV>}
12
11
  */
13
- export declare abstract class ResponseEntityMapper<Entity extends BaseEntity | unknown, SV extends SchemaValidator> extends BaseEntityMapper<SV> {
12
+ export declare abstract class ResponseEntityMapper<Entity extends BaseEntity, SV extends AnySchemaValidator> extends BaseEntityMapper<SV> {
14
13
  /**
15
14
  * The entity type.
16
15
  * @type {Entity}
@@ -42,19 +41,19 @@ export declare abstract class ResponseEntityMapper<Entity extends BaseEntity | u
42
41
  /**
43
42
  * Populates entityMapper with DTO from an entity.
44
43
  *
45
- * @template EntityMapperType - A type that extends ResponseEntityMapper.
46
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
47
- * @param {EntityMapperType['_Entity']} entity - The entity to convert.
48
- * @returns {EntityMapperType} - An instance of the EntityMapperType.
44
+ * @template T - A type that extends ResponseEntityMapper.
45
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
46
+ * @param {T['_Entity']} entity - The entity to convert.
47
+ * @returns {T} - An instance of the T.
49
48
  */
50
- static fromEntity<EntityMapperType extends ResponseEntityMapper<unknown, any>>(this: EntityMapperConstructor<EntityMapperType, EntityMapperType['_SV']>, schemaValidator: EntityMapperType['_SV'], entity: EntityMapperType['_Entity']): EntityMapperType;
49
+ static fromEntity<T extends ResponseEntityMapper<BaseEntity, SV>, SV extends AnySchemaValidator>(this: EntityMapperConstructor<T, SV>, schemaValidator: SV, entity: T['_Entity']): T;
51
50
  /**
52
51
  * Serializes an entity to a JSON object.
53
52
  *
54
- * @template EntityMapperType - A type that extends ResponseEntityMapper.
55
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
56
- * @param {EntityMapperType['_Entity']} entity - The entity to serialize.
57
- * @returns {EntityMapperStaticSchema<EntityMapperType>} - The JSON object.
53
+ * @template T - A type that extends ResponseEntityMapper.
54
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
55
+ * @param {T['_Entity']} entity - The entity to serialize.
56
+ * @returns {T['_dto']} - The JSON object.
58
57
  */
59
- static serializeEntityToJson<EntityMapperType extends ResponseEntityMapper<unknown, any>>(this: EntityMapperConstructor<EntityMapperType, EntityMapperType['_SV']>, schemaValidator: EntityMapperType['_SV'], entity: EntityMapperType['_Entity']): EntityMapperStaticSchema<EntityMapperType>;
58
+ static serializeEntityToJson<T extends ResponseEntityMapper<BaseEntity, SV>, SV extends AnySchemaValidator>(this: EntityMapperConstructor<T, SV>, schemaValidator: SV, entity: T['_Entity']): T['_dto'];
60
59
  }
@@ -40,10 +40,10 @@ class ResponseEntityMapper extends baseEntityMapper_model_1.BaseEntityMapper {
40
40
  /**
41
41
  * Populates entityMapper with DTO from an entity.
42
42
  *
43
- * @template EntityMapperType - A type that extends ResponseEntityMapper.
44
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
45
- * @param {EntityMapperType['_Entity']} entity - The entity to convert.
46
- * @returns {EntityMapperType} - An instance of the EntityMapperType.
43
+ * @template T - A type that extends ResponseEntityMapper.
44
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
45
+ * @param {T['_Entity']} entity - The entity to convert.
46
+ * @returns {T} - An instance of the T.
47
47
  */
48
48
  static fromEntity(schemaValidator, entity) {
49
49
  return (0, baseEntityMapper_model_1.construct)(this, schemaValidator).fromEntity(entity);
@@ -51,10 +51,10 @@ class ResponseEntityMapper extends baseEntityMapper_model_1.BaseEntityMapper {
51
51
  /**
52
52
  * Serializes an entity to a JSON object.
53
53
  *
54
- * @template EntityMapperType - A type that extends ResponseEntityMapper.
55
- * @param {EntityMapperConstructor<EntityMapperType>} this - The constructor of the EntityMapperType.
56
- * @param {EntityMapperType['_Entity']} entity - The entity to serialize.
57
- * @returns {EntityMapperStaticSchema<EntityMapperType>} - The JSON object.
54
+ * @template T - A type that extends ResponseEntityMapper.
55
+ * @param {EntityMapperConstructor<T>} this - The constructor of the T.
56
+ * @param {T['_Entity']} entity - The entity to serialize.
57
+ * @returns {T['_dto']} - The JSON object.
58
58
  */
59
59
  static serializeEntityToJson(schemaValidator, entity) {
60
60
  return (0, baseEntityMapper_model_1.construct)(this, schemaValidator).serializeEntityToJson(entity);
@@ -1 +1 @@
1
- {"version":3,"file":"responseEntityMapper.model.js","sourceRoot":"","sources":["../../../entityMapper/models/responseEntityMapper.model.ts"],"names":[],"mappings":";;;AAIA,qEAAuE;AAEvE;;;;;;GAMG;AACH,MAAsB,oBAAsF,SAAQ,yCAAoB;IACpI;;;;OAIG;IACH,OAAO,CAAU;IAWjB;;;;;OAKG;IACH,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACvF,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CAAC,MAAc;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAwI,eAAwC,EAAE,MAAmC;QAClO,OAAO,IAAA,kCAAS,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAAwI,eAAwC,EAAE,MAAmC;QAC7O,OAAO,IAAA,kCAAS,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAA+C,CAAC;IACxH,CAAC;CACJ;AA/DD,oDA+DC"}
1
+ {"version":3,"file":"responseEntityMapper.model.js","sourceRoot":"","sources":["../../../entityMapper/models/responseEntityMapper.model.ts"],"names":[],"mappings":";;;AAGA,qEAAuE;AAEvE;;;;;;GAMG;AACH,MAAsB,oBAGpB,SAAQ,yCAAoB;IAC5B;;;;OAIG;IACH,OAAO,CAAU;IAWjB;;;;;OAKG;IACH,MAAM;QACJ,IACE,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAC5B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,IAAI,CAAC,GAAG,CACT,EACD,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;;;;OAKG;IACH,qBAAqB,CAAC,MAAc;QAClC,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAKf,eAAmB,EACnB,MAAoB;QAEpB,OAAO,IAAA,kCAAS,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAK1B,eAAmB,EACnB,MAAoB;QAEpB,OAAO,IAAA,kCAAS,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACxE,CAAC;CACF;AArFD,oDAqFC"}