@rafikidota/iroh 0.47.1 → 0.47.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.
- package/dist/common/decorators/handle-response.decorator.d.ts +1 -2
- package/dist/common/decorators/handle-response.decorator.js +1 -1
- package/dist/common/decorators/handle-response.decorator.js.map +1 -1
- package/dist/core/app/response-handler.js +3 -4
- package/dist/core/app/response-handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
1
|
import { IMapper } from '../interfaces/generic.mapper';
|
|
3
2
|
import { IExceptionMapper } from '../interfaces/exception-mapper';
|
|
4
3
|
import { IService } from '../interfaces/crud.service';
|
|
@@ -6,4 +5,4 @@ import { Persistence } from '../../core/infra/generic.persistence';
|
|
|
6
5
|
import { Domain } from '../../core/domain/generic.domain';
|
|
7
6
|
import { View } from '../../core/app/dto/generic.view';
|
|
8
7
|
import { DtoMapper } from '../../core/app/dto/generic.create.dto';
|
|
9
|
-
export declare function HandleResponse<M extends IMapper<T, D, V>, T extends Persistence = ReturnType<M['DomainToPersistence']>, D extends Domain = ReturnType<M['PersistenceToDomain']>, V extends View = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>, S extends IService<T, D, V, DTO> = IService<T, D, V, DTO>>(Handler?:
|
|
8
|
+
export declare function HandleResponse<M extends IMapper<T, D, V>, T extends Persistence = ReturnType<M['DomainToPersistence']>, D extends Domain = ReturnType<M['PersistenceToDomain']>, V extends View = ReturnType<M['DomainToView']>, DTO extends DtoMapper<D, DTO> = DtoMapper<D>, S extends IService<T, D, V, DTO> = IService<T, D, V, DTO>>(Handler?: IExceptionMapper): MethodDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-response.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/handle-response.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"handle-response.decorator.js","sourceRoot":"","sources":["../../../src/common/decorators/handle-response.decorator.ts"],"names":[],"mappings":";;AAWA,wCAoDC;AA/DD,sEAAkE;AAQlE,0DAAkD;AAGlD,SAAgB,cAAc,CAO5B,OAA0B;IAC1B,OAAO,UACL,MAAW,EACX,WAA4B,EAC5B,UAA8B;QAE9B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAErC,MAAM,OAAO,GAAG,UAAiC,GAAG,IAAW;YAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAExC,MAAM,SAAS,GAAG,GAAG,EAAE;gBACrB,IAAI,IAAI,EAAE,OAAO,YAAY,sBAAO,EAAE,CAAC;oBACrC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAW,CAAC;oBAC9C,OAAO,YAAY,CAAC,YAAY,CAAC;gBACnC,CAAC;gBACD,OAAO,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC;YAEF,MAAM,UAAU,GAAG,GAAG,EAAE;gBACtB,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,OAAO,CAAC,MAAM,CAAC;gBACxB,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;YACF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;YAEnC,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;gBAC9B,MAAM,OAAO,GAAG,MAA4B,CAAC;gBAC7C,OAAO,kCAAe,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;YACvD,CAAC;YACD,MAAM,IAAI,GAAG,MAAmB,CAAC;YACjC,OAAO,kCAAe,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC;QAEF,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAClD,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,KAAK,GAAG,OAAO,CAAC;QAC3B,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -4,17 +4,16 @@ exports.ResponseHandler = void 0;
|
|
|
4
4
|
const defaultMapper = (a) => a;
|
|
5
5
|
class ResponseHandler {
|
|
6
6
|
static sync(params) {
|
|
7
|
-
const { data, mapper, handler } = params;
|
|
8
|
-
const finalMapper = mapper || defaultMapper;
|
|
7
|
+
const { data, mapper = defaultMapper, handler } = params;
|
|
9
8
|
if (!data.successful) {
|
|
10
9
|
ResponseHandler.handle(data, handler);
|
|
11
10
|
}
|
|
12
11
|
const payload = data.unwrap();
|
|
13
12
|
const { pagination, items } = payload;
|
|
14
13
|
if (pagination && items) {
|
|
15
|
-
return {
|
|
14
|
+
return { items: items.map((x) => mapper(x), pagination) };
|
|
16
15
|
}
|
|
17
|
-
return
|
|
16
|
+
return mapper(payload);
|
|
18
17
|
}
|
|
19
18
|
static async async(params) {
|
|
20
19
|
const { promise, mapper, handler } = params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-handler.js","sourceRoot":"","sources":["../../../src/core/app/response-handler.ts"],"names":[],"mappings":";;;AAIA,MAAM,aAAa,GAAG,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC;AAapC,MAAa,eAAe;IACnB,MAAM,CAAC,IAAI,CAChB,MAAoC;QAEpC,MAAM,EAAE,IAAI,EAAE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