@rafikidota/iroh 0.48.0 → 0.49.1
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/collection.json +0 -0
- package/dist/common/decorators/response/handle-response.decorator.d.ts +2 -2
- package/dist/common/decorators/response/handle-response.decorator.js +6 -3
- package/dist/common/decorators/response/handle-response.decorator.js.map +1 -1
- package/dist/common/interfaces/{exception-mapper.d.ts → error-handler.d.ts} +1 -1
- package/dist/common/interfaces/{exception-mapper.js → error-handler.js} +1 -1
- package/dist/common/interfaces/error-handler.js.map +1 -0
- package/dist/common/interfaces/index.d.ts +3 -1
- package/dist/common/interfaces/index.js +3 -1
- package/dist/common/interfaces/index.js.map +1 -1
- package/dist/common/interfaces/response-handler.d.ts +6 -0
- package/dist/common/interfaces/response-handler.js +3 -0
- package/dist/common/interfaces/response-handler.js.map +1 -0
- package/dist/common/interfaces/view-handler.d.ts +3 -0
- package/dist/common/interfaces/view-handler.js +3 -0
- package/dist/common/interfaces/view-handler.js.map +1 -0
- package/package.json +31 -30
- package/dist/common/interfaces/exception-mapper.js.map +0 -1
package/collection.json
CHANGED
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IMapper } from '../../interfaces/generic.mapper';
|
|
2
|
-
import {
|
|
2
|
+
import { IResponseHandler } from '../../interfaces/response-handler';
|
|
3
3
|
import { IService } from '../../interfaces/crud.service';
|
|
4
4
|
import { Persistence } from '../../../core/infra/generic.persistence';
|
|
5
5
|
import { Domain } from '../../../core/domain/generic.domain';
|
|
6
6
|
import { View } from '../../../core/app/dto/generic.view';
|
|
7
7
|
import { DtoMapper } from '../../../core/app/dto/generic.create.dto';
|
|
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>>(
|
|
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>>(handlers?: IResponseHandler): MethodDecorator;
|
|
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.HandleResponse = HandleResponse;
|
|
4
4
|
const response_handler_1 = require("../../../core/app/response-handler");
|
|
5
5
|
const iroh_service_1 = require("../../../core/iroh.service");
|
|
6
|
-
function HandleResponse(
|
|
6
|
+
function HandleResponse(handlers) {
|
|
7
7
|
return function (target, propertyKey, descriptor) {
|
|
8
8
|
const { value: method } = descriptor;
|
|
9
9
|
const wrapped = function (...args) {
|
|
10
10
|
const result = method.apply(this, args);
|
|
11
11
|
const getMapper = () => {
|
|
12
|
+
if (handlers?.view) {
|
|
13
|
+
return handlers.view.map;
|
|
14
|
+
}
|
|
12
15
|
if (this?.service instanceof iroh_service_1.Service) {
|
|
13
16
|
const EntityMapper = this.service.mapper;
|
|
14
17
|
return EntityMapper.DomainToView;
|
|
@@ -16,8 +19,8 @@ function HandleResponse(Handler) {
|
|
|
16
19
|
return (x) => x;
|
|
17
20
|
};
|
|
18
21
|
const getHandler = () => {
|
|
19
|
-
if (
|
|
20
|
-
return
|
|
22
|
+
if (handlers?.error) {
|
|
23
|
+
return handlers.error.handle;
|
|
21
24
|
}
|
|
22
25
|
return null;
|
|
23
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-response.decorator.js","sourceRoot":"","sources":["../../../../src/common/decorators/response/handle-response.decorator.ts"],"names":[],"mappings":";;AAWA,
|
|
1
|
+
{"version":3,"file":"handle-response.decorator.js","sourceRoot":"","sources":["../../../../src/common/decorators/response/handle-response.decorator.ts"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ACD,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpException } from '@nestjs/common';
|
|
2
2
|
import { InternalServerErrorException as InternalServerError } from '@nestjs/common';
|
|
3
|
-
export interface
|
|
3
|
+
export interface IErrorHandler {
|
|
4
4
|
handle<T extends HttpException = InternalServerError>(error: T): void;
|
|
5
5
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/common/interfaces/error-handler.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './crud.controller';
|
|
2
2
|
export * from './crud.repository';
|
|
3
3
|
export * from './crud.service';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './error-handler';
|
|
5
5
|
export * from './generic.mapper';
|
|
6
6
|
export * from './generic.props';
|
|
7
7
|
export * from './nomenclator.props';
|
|
8
|
+
export * from './response-handler';
|
|
9
|
+
export * from './view-handler';
|
|
@@ -17,8 +17,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./crud.controller"), exports);
|
|
18
18
|
__exportStar(require("./crud.repository"), exports);
|
|
19
19
|
__exportStar(require("./crud.service"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
20
|
+
__exportStar(require("./error-handler"), exports);
|
|
21
21
|
__exportStar(require("./generic.mapper"), exports);
|
|
22
22
|
__exportStar(require("./generic.props"), exports);
|
|
23
23
|
__exportStar(require("./nomenclator.props"), exports);
|
|
24
|
+
__exportStar(require("./response-handler"), exports);
|
|
25
|
+
__exportStar(require("./view-handler"), exports);
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,iDAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,iDAA+B;AAC/B,kDAAgC;AAChC,mDAAiC;AACjC,kDAAgC;AAChC,sDAAoC;AACpC,qDAAmC;AACnC,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-handler.js","sourceRoot":"","sources":["../../../src/common/interfaces/response-handler.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-handler.js","sourceRoot":"","sources":["../../../src/common/interfaces/view-handler.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rafikidota/iroh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "Sometimes, the best way to solve your own problems is to help someone else.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,18 +14,6 @@
|
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
-
"scripts": {
|
|
18
|
-
"prepare": "husky",
|
|
19
|
-
"prebuild": "rimraf -rf dist",
|
|
20
|
-
"build": "tsc -p tsconfig.json",
|
|
21
|
-
"postbuild": "npm run move:crud && npm run move:init && npm run move:usecase",
|
|
22
|
-
"move:crud": "mkdir -p dist/schematics/crud/files/ts && cp -ar ./src/schematics/crud/files/ts/* dist/schematics/crud/files/ts",
|
|
23
|
-
"move:init": "mkdir -p dist/schematics/init/files/ts && cp -ar ./src/schematics/init/files/ts/* dist/schematics/init/files/ts",
|
|
24
|
-
"move:usecase": "mkdir -p dist/schematics/use-case/files/ts && cp -ar ./src/schematics/use-case/files/ts/* dist/schematics/use-case/files/ts",
|
|
25
|
-
"lint": "npx eslint --debug . --fix",
|
|
26
|
-
"format": "prettier --write \"**/*.ts\"",
|
|
27
|
-
"prepublishOnly": "npm run lint && npm run build"
|
|
28
|
-
},
|
|
29
17
|
"dependencies": {
|
|
30
18
|
"chalk": "4.1.2"
|
|
31
19
|
},
|
|
@@ -34,39 +22,42 @@
|
|
|
34
22
|
"@angular-devkit/schematics": "19.2.13",
|
|
35
23
|
"@angular-devkit/schematics-cli": "19.2.13",
|
|
36
24
|
"@eslint/eslintrc": "3.3.1",
|
|
37
|
-
"@eslint/js": "9.
|
|
38
|
-
"@nestjs/common": "11.1.
|
|
25
|
+
"@eslint/js": "9.39.1",
|
|
26
|
+
"@nestjs/common": "11.1.9",
|
|
39
27
|
"@nestjs/config": "4.0.2",
|
|
40
|
-
"@nestjs/core": "11.1.
|
|
41
|
-
"@nestjs/swagger": "11.2.
|
|
28
|
+
"@nestjs/core": "11.1.9",
|
|
29
|
+
"@nestjs/swagger": "11.2.2",
|
|
42
30
|
"@nestjs/typeorm": "11.0.0",
|
|
43
31
|
"@rafikidota/serpens": "1.12.0",
|
|
44
|
-
"@swc/cli": "0.7.
|
|
45
|
-
"@swc/core": "1.
|
|
32
|
+
"@swc/cli": "0.7.9",
|
|
33
|
+
"@swc/core": "1.15.2",
|
|
46
34
|
"@swc/helpers": "0.5.17",
|
|
47
|
-
"@types/express": "5.0.
|
|
48
|
-
"@types/node": "24.
|
|
35
|
+
"@types/express": "5.0.5",
|
|
36
|
+
"@types/node": "24.10.1",
|
|
49
37
|
"@types/uuid": "11.0.0",
|
|
50
|
-
"@
|
|
51
|
-
"@typescript-eslint/
|
|
38
|
+
"@types/validator": "13.15.10",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "8.46.4",
|
|
40
|
+
"@typescript-eslint/parser": "8.46.4",
|
|
52
41
|
"class-transformer": "0.5.1",
|
|
53
42
|
"class-validator": "0.14.2",
|
|
54
|
-
"
|
|
43
|
+
"dotenv": "17.2.3",
|
|
44
|
+
"eslint": "9.39.1",
|
|
55
45
|
"eslint-config-prettier": "10.1.8",
|
|
56
46
|
"eslint-plugin-import": "2.32.0",
|
|
57
47
|
"eslint-plugin-prettier": "5.5.4",
|
|
58
48
|
"express": "5.1.0",
|
|
59
|
-
"globals": "16.
|
|
49
|
+
"globals": "16.5.0",
|
|
60
50
|
"husky": "9.1.7",
|
|
61
51
|
"joi": "18.0.1",
|
|
62
|
-
"
|
|
52
|
+
"libphonenumber-js": "1.12.31",
|
|
53
|
+
"lint-staged": "16.2.6",
|
|
63
54
|
"prettier": "3.6.2",
|
|
64
55
|
"reflect-metadata": "0.2.2",
|
|
65
|
-
"rimraf": "6.0
|
|
56
|
+
"rimraf": "6.1.0",
|
|
66
57
|
"rxjs": "7.8.2",
|
|
67
58
|
"typeorm": "0.3.27",
|
|
68
59
|
"typescript": "5.9.3",
|
|
69
|
-
"typescript-eslint": "8.
|
|
60
|
+
"typescript-eslint": "8.46.4",
|
|
70
61
|
"uuid": "13.0.0"
|
|
71
62
|
},
|
|
72
63
|
"peerDependencies": {
|
|
@@ -112,5 +103,15 @@
|
|
|
112
103
|
"generic",
|
|
113
104
|
"schematics",
|
|
114
105
|
"crud"
|
|
115
|
-
]
|
|
116
|
-
|
|
106
|
+
],
|
|
107
|
+
"scripts": {
|
|
108
|
+
"prebuild": "rimraf -rf dist",
|
|
109
|
+
"build": "tsc -p tsconfig.json",
|
|
110
|
+
"postbuild": "npm run move:crud && npm run move:init && npm run move:usecase",
|
|
111
|
+
"move:crud": "mkdir -p dist/schematics/crud/files/ts && cp -ar ./src/schematics/crud/files/ts/* dist/schematics/crud/files/ts",
|
|
112
|
+
"move:init": "mkdir -p dist/schematics/init/files/ts && cp -ar ./src/schematics/init/files/ts/* dist/schematics/init/files/ts",
|
|
113
|
+
"move:usecase": "mkdir -p dist/schematics/use-case/files/ts && cp -ar ./src/schematics/use-case/files/ts/* dist/schematics/use-case/files/ts",
|
|
114
|
+
"lint": "npx eslint --debug . --fix",
|
|
115
|
+
"format": "prettier --write \"**/*.ts\""
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exception-mapper.js","sourceRoot":"","sources":["../../../src/common/interfaces/exception-mapper.ts"],"names":[],"mappings":""}
|