@nest-yalc-2/errors 2.2.0 → 2.2.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/LICENSE +661 -0
- package/package.json +31 -15
- package/{dist/src → src}/__tests__/database-exception.filter.spec.ts +1 -1
- package/{dist/src → src}/__tests__/default.error.spec.ts +1 -1
- package/{dist/src → src}/__tests__/errors.enum.spec.ts +1 -1
- package/{dist/src → src}/__tests__/http-status-code-to-errors.spec.ts +1 -1
- package/{dist/src → src}/__tests__/input-validation.error.spec.ts +1 -1
- package/{dist/src → src}/__tests__/login.error.spec.ts +1 -1
- package/{dist/src → src}/__tests__/system-exception.filter.spec.ts +1 -1
- package/{dist/src → src}/__tests__/verification.error.spec.ts +1 -1
- package/src/filters/database-exception.filter.js +30 -0
- package/src/filters/database-exception.filter.js.map +1 -0
- package/{dist/src → src}/filters/database-exception.filter.ts +1 -1
- package/{dist/src → src}/filters/http-exception.filter.d.ts +2 -2
- package/{dist/src → src}/filters/http-exception.filter.js +23 -26
- package/src/filters/http-exception.filter.js.map +1 -0
- package/{dist/src → src}/filters/http-exception.filter.ts +2 -2
- package/src/filters/index.js +2 -0
- package/src/filters/index.js.map +1 -0
- package/src/filters/system-exception.filter.js +18 -0
- package/src/filters/system-exception.filter.js.map +1 -0
- package/{dist/src → src}/filters/system-exception.filter.ts +1 -1
- package/src/filters/validation-exception.filter.js +22 -0
- package/src/filters/validation-exception.filter.js.map +1 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +7 -0
- package/src/index.js.map +1 -0
- package/src/index.ts +8 -0
- package/dist/src/filters/database-exception.filter.js +0 -33
- package/dist/src/filters/database-exception.filter.js.map +0 -1
- package/dist/src/filters/http-exception.filter.js.map +0 -1
- package/dist/src/filters/index.js +0 -6
- package/dist/src/filters/index.js.map +0 -1
- package/dist/src/filters/system-exception.filter.js +0 -21
- package/dist/src/filters/system-exception.filter.js.map +0 -1
- package/dist/src/filters/validation-exception.filter.js +0 -25
- package/dist/src/filters/validation-exception.filter.js.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.js +0 -12
- package/dist/src/index.js.map +0 -1
- package/dist/src/index.ts +0 -8
- /package/{dist/src → src}/__tests__/error.helper.spec.ts +0 -0
- /package/{dist/src → src}/__tests__/http-exception.filter.spec.ts +0 -0
- /package/{dist/src → src}/__tests__/result.error.spec.ts +0 -0
- /package/{dist/src → src}/__tests__/tsconfig.json +0 -0
- /package/{dist/src → src}/__tests__/validation-exception.filter.spec.ts +0 -0
- /package/{dist/src → src}/filters/database-exception.filter.d.ts +0 -0
- /package/{dist/src → src}/filters/index.d.ts +0 -0
- /package/{dist/src → src}/filters/index.ts +0 -0
- /package/{dist/src → src}/filters/system-exception.filter.d.ts +0 -0
- /package/{dist/src → src}/filters/validation-exception.filter.d.ts +0 -0
- /package/{dist/src → src}/filters/validation-exception.filter.ts +0 -0
package/package.json
CHANGED
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-yalc-2/errors",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
|
-
"main": "./
|
|
6
|
+
"main": "./src/index.js",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./
|
|
9
|
-
"
|
|
10
|
-
"./*": "./dist/src/*"
|
|
8
|
+
".": "./src/index.js",
|
|
9
|
+
"./*": "./src/*"
|
|
11
10
|
},
|
|
12
|
-
"
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
-
},
|
|
15
|
-
"author": "",
|
|
11
|
+
"author": "Autistic_Intelligence",
|
|
16
12
|
"license": "MIT",
|
|
17
|
-
"types": "./
|
|
13
|
+
"types": "./src/index.d.ts",
|
|
18
14
|
"files": [
|
|
19
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"src"
|
|
20
17
|
],
|
|
21
18
|
"dependencies": {
|
|
22
|
-
"@nest-yalc-2/crud-gen": "^2.
|
|
23
|
-
"@nest-yalc-2/event-manager": "^2.
|
|
24
|
-
"@nest-yalc-2/logger": "^2.
|
|
25
|
-
"@nest-yalc-2/utils": "^
|
|
19
|
+
"@nest-yalc-2/crud-gen": "^2.2.2",
|
|
20
|
+
"@nest-yalc-2/event-manager": "^2.2.2",
|
|
21
|
+
"@nest-yalc-2/logger": "^2.2.2",
|
|
22
|
+
"@nest-yalc-2/utils": "^2.2.2",
|
|
26
23
|
"axios": "^1.15.0",
|
|
27
24
|
"neverthrow": "^8.2.0",
|
|
28
25
|
"tslib": "^2.6.3"
|
|
29
26
|
},
|
|
30
27
|
"peerDependencies": {
|
|
31
28
|
"@nestjs/common": "^11.1.19"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"nestjs",
|
|
32
|
+
"yalc",
|
|
33
|
+
"framework",
|
|
34
|
+
"errors",
|
|
35
|
+
"error-handling",
|
|
36
|
+
"exceptions"
|
|
37
|
+
],
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/Nek97/nestjs-yalc.git"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/Nek97/nestjs-yalc/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/Nek97/nestjs-yalc#readme",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
32
48
|
}
|
|
33
49
|
}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@nestjs/common';
|
|
17
17
|
import { EntityTarget } from 'typeorm';
|
|
18
18
|
import { ConnectionNotFoundError, EntityNotFoundError } from 'typeorm';
|
|
19
|
-
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum';
|
|
19
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
20
20
|
import { DatabaseExceptionFilter } from '../filters/database-exception.filter.js';
|
|
21
21
|
|
|
22
22
|
import { GqlArgumentsHost } from '@nestjs/graphql';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
HttpException,
|
|
18
18
|
HttpStatus,
|
|
19
19
|
} from '@nestjs/common';
|
|
20
|
-
import { getHttpStatusDescription } from '@node-yalc/utils/http.helper';
|
|
20
|
+
import { getHttpStatusDescription } from '@node-yalc/utils/http.helper.js';
|
|
21
21
|
|
|
22
22
|
describe('DefaultErrorMixin', () => {
|
|
23
23
|
it('should create a class that extends Error when no base class is provided', () => {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
afterAll,
|
|
9
9
|
afterEach,
|
|
10
10
|
} from '@jest/globals';
|
|
11
|
-
import { ErrorsEnum, ExceptionContextEnum } from '@node-yalc/errors/error.enum';
|
|
11
|
+
import { ErrorsEnum, ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
12
12
|
|
|
13
13
|
describe('errors enum test', () => {
|
|
14
14
|
it('ErrorsEnum should have all the values', () => {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
afterEach,
|
|
10
10
|
} from '@jest/globals';
|
|
11
11
|
import { BadRequestError, InputValidationError } from '../error.class.js';
|
|
12
|
-
import { ErrorsEnum } from '@node-yalc/errors/error.enum';
|
|
12
|
+
import { ErrorsEnum } from '@node-yalc/errors/error.enum.js';
|
|
13
13
|
|
|
14
14
|
describe('InputValidationError', () => {
|
|
15
15
|
it('should have internal message without the custom message', () => {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { createMock } from '@golevelup/ts-jest';
|
|
12
12
|
import { LoggerService, UnprocessableEntityException } from '@nestjs/common';
|
|
13
13
|
|
|
14
|
-
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum';
|
|
14
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
15
15
|
import { SystemExceptionFilter } from '../filters/system-exception.filter.js';
|
|
16
16
|
|
|
17
17
|
describe('System exceptions filter', () => {
|
|
@@ -2,7 +2,7 @@ import { expect, describe, it } from '@jest/globals';
|
|
|
2
2
|
import {
|
|
3
3
|
getHttpStatusDescription,
|
|
4
4
|
HttpStatusCodes,
|
|
5
|
-
} from '@node-yalc/utils/http.helper';
|
|
5
|
+
} from '@node-yalc/utils/http.helper.js';
|
|
6
6
|
import { HttpException } from '@nestjs/common';
|
|
7
7
|
import { AdditionalVerificationNeededError } from '../index.js';
|
|
8
8
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { GqlArgumentsHost } from '@nestjs/graphql';
|
|
3
|
+
import * as common from '@nestjs/common';
|
|
4
|
+
import { EntityNotFoundError, ConnectionNotFoundError } from 'typeorm';
|
|
5
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
6
|
+
let DatabaseExceptionFilter = class DatabaseExceptionFilter {
|
|
7
|
+
constructor(logger) {
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
}
|
|
10
|
+
catch(error, host) {
|
|
11
|
+
const gqlHost = GqlArgumentsHost.create(host);
|
|
12
|
+
gqlHost.getType();
|
|
13
|
+
switch (true) {
|
|
14
|
+
case error instanceof EntityNotFoundError:
|
|
15
|
+
this.logger.error(error, ExceptionContextEnum.DATABASE);
|
|
16
|
+
error = new common.InternalServerErrorException(error);
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
this.logger.error(error, error.stack, ExceptionContextEnum.DATABASE);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
return error;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
DatabaseExceptionFilter = __decorate([
|
|
26
|
+
common.Catch(EntityNotFoundError, ConnectionNotFoundError),
|
|
27
|
+
__metadata("design:paramtypes", [Object])
|
|
28
|
+
], DatabaseExceptionFilter);
|
|
29
|
+
export { DatabaseExceptionFilter };
|
|
30
|
+
//# sourceMappingURL=database-exception.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-exception.filter.js","sourceRoot":"","sources":["database-exception.filter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAsB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAKhE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY,EAAE,IAA0B;QAC5C,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,OAAO,EAAE,CAAC;QAWlB,QAAQ,IAAI,EAAE,CAAC;YAIb,KAAK,KAAK,YAAY,mBAAmB;gBACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;gBACxD,KAAK,GAAG,IAAI,MAAM,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;gBAEvD,MAAM;YAER;gBACE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;gBAErE,MAAM;QACV,CAAC;QAGD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAnCY,uBAAuB;IADnC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;;GAC9C,uBAAuB,CAmCnC"}
|
|
@@ -2,7 +2,7 @@ import { GqlExceptionFilter, GqlArgumentsHost } from '@nestjs/graphql';
|
|
|
2
2
|
import * as common from '@nestjs/common';
|
|
3
3
|
// We can import more errors from the typeorm/error folder if necessary, nothing is exported though, so use explicit paths.
|
|
4
4
|
import { EntityNotFoundError, ConnectionNotFoundError } from 'typeorm';
|
|
5
|
-
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum';
|
|
5
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
6
6
|
|
|
7
7
|
import type { LoggerService } from '@nestjs/common';
|
|
8
8
|
|
|
@@ -5,13 +5,13 @@ import { DefaultErrorMixin, MissingArgumentsError } from '@nest-yalc-2/errors';
|
|
|
5
5
|
import { FastifyReply as FResponse } from 'fastify';
|
|
6
6
|
import { GqlError } from '@nest-yalc-2/graphql/plugins/gql.error.js';
|
|
7
7
|
import { BaseExceptionFilter } from '@nestjs/core';
|
|
8
|
-
import { type ImprovedLoggerService } from '@node-yalc/logger/logger-abstract.service';
|
|
8
|
+
import { type ImprovedLoggerService } from '@node-yalc/logger/logger-abstract.service.js';
|
|
9
9
|
type HttpErrorType = common.HttpException | MissingArgumentsError | GqlError | DefaultErrorMixin;
|
|
10
10
|
export declare class HttpExceptionFilter extends BaseExceptionFilter implements GqlExceptionFilter, common.ExceptionFilter {
|
|
11
11
|
protected logger: ImprovedLoggerService;
|
|
12
12
|
constructor(logger: ImprovedLoggerService, applicationRef?: HttpServer);
|
|
13
13
|
catch(error: Error | HttpErrorType, host: common.ArgumentsHost, { sendResponse }?: {
|
|
14
14
|
sendResponse: boolean;
|
|
15
|
-
}): Error |
|
|
15
|
+
}): Error | FResponse<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown> | import("@nest-yalc-2/errors").IAbstractDefaultError;
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const event_helper_js_1 = require("../../../event-manager/src/event.helper.js");
|
|
11
|
-
const logger_enum_1 = require("@node-yalc/logger/logger.enum");
|
|
12
|
-
let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseExceptionFilter {
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import * as common from '@nestjs/common';
|
|
3
|
+
import { DefaultErrorMixin, MissingArgumentsError, isDefaultErrorMixin, formatCause, } from '@nest-yalc-2/errors';
|
|
4
|
+
import { isEntityError, } from '@nest-yalc-2/crud-gen/entity.error.js';
|
|
5
|
+
import { GqlError } from '@nest-yalc-2/graphql/plugins/gql.error.js';
|
|
6
|
+
import { BaseExceptionFilter } from '@nestjs/core';
|
|
7
|
+
import { getLogLevelByStatus } from '../../../event-manager/src/event.helper.js';
|
|
8
|
+
import { LogLevelEnum } from '@node-yalc/logger/logger.enum.js';
|
|
9
|
+
let HttpExceptionFilter = class HttpExceptionFilter extends BaseExceptionFilter {
|
|
13
10
|
constructor(logger, applicationRef) {
|
|
14
11
|
super(applicationRef);
|
|
15
12
|
this.logger = logger;
|
|
@@ -18,14 +15,14 @@ let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseException
|
|
|
18
15
|
try {
|
|
19
16
|
const isHttpError = this.isHttpError(error) || error instanceof common.HttpException;
|
|
20
17
|
switch (true) {
|
|
21
|
-
case error instanceof
|
|
18
|
+
case error instanceof MissingArgumentsError:
|
|
22
19
|
this.logger.log(error.message, {
|
|
23
20
|
stack: error.stack,
|
|
24
21
|
});
|
|
25
22
|
break;
|
|
26
|
-
case
|
|
23
|
+
case isDefaultErrorMixin(error):
|
|
27
24
|
break;
|
|
28
|
-
case
|
|
25
|
+
case isEntityError(error):
|
|
29
26
|
{
|
|
30
27
|
const entityError = error;
|
|
31
28
|
this.logger.error(entityError.originalError?.message
|
|
@@ -35,7 +32,7 @@ let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseException
|
|
|
35
32
|
data: {
|
|
36
33
|
response: entityError.getResponse(),
|
|
37
34
|
name: entityError.name,
|
|
38
|
-
cause:
|
|
35
|
+
cause: formatCause(entityError.cause),
|
|
39
36
|
},
|
|
40
37
|
});
|
|
41
38
|
}
|
|
@@ -43,14 +40,14 @@ let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseException
|
|
|
43
40
|
case isHttpError:
|
|
44
41
|
{
|
|
45
42
|
const httpError = error;
|
|
46
|
-
const logLevel =
|
|
47
|
-
if (logLevel ===
|
|
43
|
+
const logLevel = getLogLevelByStatus(httpError.getStatus());
|
|
44
|
+
if (logLevel === LogLevelEnum.ERROR) {
|
|
48
45
|
this.logger[logLevel](error.message, error.stack, {
|
|
49
46
|
stack: httpError.stack,
|
|
50
47
|
data: {
|
|
51
48
|
response: httpError.getResponse(),
|
|
52
49
|
name: error.name,
|
|
53
|
-
cause:
|
|
50
|
+
cause: formatCause(error.cause),
|
|
54
51
|
},
|
|
55
52
|
});
|
|
56
53
|
}
|
|
@@ -60,20 +57,20 @@ let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseException
|
|
|
60
57
|
data: {
|
|
61
58
|
response: httpError.getResponse(),
|
|
62
59
|
name: error.name,
|
|
63
|
-
cause:
|
|
60
|
+
cause: formatCause(error.cause),
|
|
64
61
|
},
|
|
65
62
|
});
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
break;
|
|
69
|
-
case error instanceof
|
|
66
|
+
case error instanceof GqlError:
|
|
70
67
|
this.logger.error(error.systemMessage ?? error.message);
|
|
71
68
|
break;
|
|
72
69
|
default:
|
|
73
70
|
this.logger.error(error.message, error.stack, {
|
|
74
71
|
stack: error.stack,
|
|
75
72
|
data: {
|
|
76
|
-
cause:
|
|
73
|
+
cause: formatCause(error.cause),
|
|
77
74
|
name: error.name,
|
|
78
75
|
},
|
|
79
76
|
});
|
|
@@ -96,9 +93,9 @@ let HttpExceptionFilter = class HttpExceptionFilter extends core_1.BaseException
|
|
|
96
93
|
return error;
|
|
97
94
|
}
|
|
98
95
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
tslib_1.__metadata("design:paramtypes", [Object, Object])
|
|
96
|
+
HttpExceptionFilter = __decorate([
|
|
97
|
+
common.Catch(common.HttpException, MissingArgumentsError, GqlError, DefaultErrorMixin),
|
|
98
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
103
99
|
], HttpExceptionFilter);
|
|
100
|
+
export { HttpExceptionFilter };
|
|
104
101
|
//# sourceMappingURL=http-exception.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-exception.filter.js","sourceRoot":"","sources":["http-exception.filter.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,aAAa,GACd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAWzD,IAAM,mBAAmB,GAAzB,MAAM,mBACX,SAAQ,mBAAmB;IAG3B,YACY,MAA6B,EACvC,cAA2B;QAE3B,KAAK,CAAC,cAAc,CAAC,CAAC;QAHZ,WAAM,GAAN,MAAM,CAAuB;IAIzC,CAAC;IAED,KAAK,CACH,KAA4B,EAC5B,IAA0B,EAC1B,EAAE,YAAY,KAAgC,EAAE,YAAY,EAAE,IAAI,EAAE;QAEpE,IAAI,CAAC;YACH,MAAM,WAAW,GACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,MAAM,CAAC,aAAa,CAAC;YAEnE,QAAQ,IAAI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AAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YAEX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAnHY,mBAAmB;IAN/B,MAAM,CAAC,KAAK,CACX,MAAM,CAAC,aAAa,EACpB,qBAAqB,EACrB,QAAQ,EACR,iBAAiB,CAClB;;GACY,mBAAmB,CAmH/B"}
|
|
@@ -15,8 +15,8 @@ import { FastifyReply as FResponse } from 'fastify';
|
|
|
15
15
|
import { GqlError } from '@nest-yalc-2/graphql/plugins/gql.error.js';
|
|
16
16
|
import { BaseExceptionFilter } from '@nestjs/core';
|
|
17
17
|
import { getLogLevelByStatus } from '../../../event-manager/src/event.helper.js';
|
|
18
|
-
import { LogLevelEnum } from '@node-yalc/logger/logger.enum';
|
|
19
|
-
import { type ImprovedLoggerService } from '@node-yalc/logger/logger-abstract.service';
|
|
18
|
+
import { LogLevelEnum } from '@node-yalc/logger/logger.enum.js';
|
|
19
|
+
import { type ImprovedLoggerService } from '@node-yalc/logger/logger-abstract.service.js';
|
|
20
20
|
|
|
21
21
|
type HttpErrorType =
|
|
22
22
|
common.HttpException | MissingArgumentsError | GqlError | DefaultErrorMixin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Catch } from '@nestjs/common';
|
|
3
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
4
|
+
let SystemExceptionFilter = class SystemExceptionFilter {
|
|
5
|
+
constructor(logger) {
|
|
6
|
+
this.logger = logger;
|
|
7
|
+
}
|
|
8
|
+
catch(error) {
|
|
9
|
+
this.logger.error(error, error.stack, ExceptionContextEnum.SYSTEM);
|
|
10
|
+
return error;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
SystemExceptionFilter = __decorate([
|
|
14
|
+
Catch(TypeError, SyntaxError, RangeError, EvalError, ReferenceError),
|
|
15
|
+
__metadata("design:paramtypes", [Object])
|
|
16
|
+
], SystemExceptionFilter);
|
|
17
|
+
export { SystemExceptionFilter };
|
|
18
|
+
//# sourceMappingURL=system-exception.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-exception.filter.js","sourceRoot":"","sources":["system-exception.filter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGhE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAPY,qBAAqB;IADjC,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC;;GACxD,qBAAqB,CAOjC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Catch, ExceptionFilter } from '@nestjs/common';
|
|
2
2
|
import type { LoggerService } from '@nestjs/common';
|
|
3
|
-
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum';
|
|
3
|
+
import { ExceptionContextEnum } from '@node-yalc/errors/error.enum.js';
|
|
4
4
|
|
|
5
5
|
@Catch(TypeError, SyntaxError, RangeError, EvalError, ReferenceError)
|
|
6
6
|
export class SystemExceptionFilter implements ExceptionFilter {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { CrudGenError } from '@nest-yalc-2/crud-gen/crud-gen.error.js';
|
|
3
|
+
import { UUIDValidationError } from '@nest-yalc-2/graphql/scalars/uuid-validation.error.js';
|
|
4
|
+
import * as common from '@nestjs/common';
|
|
5
|
+
import { InputValidationError } from '../index.js';
|
|
6
|
+
let ValidationExceptionFilter = class ValidationExceptionFilter {
|
|
7
|
+
constructor(logger) {
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
}
|
|
10
|
+
catch(error) {
|
|
11
|
+
const newError = new InputValidationError(error.systemMessage, { response: { message: error.message } });
|
|
12
|
+
newError.stack = error.stack;
|
|
13
|
+
this.logger.error(error.systemMessage ?? newError.message, newError.stack);
|
|
14
|
+
return newError;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
ValidationExceptionFilter = __decorate([
|
|
18
|
+
common.Catch(UUIDValidationError, CrudGenError),
|
|
19
|
+
__metadata("design:paramtypes", [Object])
|
|
20
|
+
], ValidationExceptionFilter);
|
|
21
|
+
export { ValidationExceptionFilter };
|
|
22
|
+
//# sourceMappingURL=validation-exception.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-exception.filter.js","sourceRoot":"","sources":["validation-exception.filter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAK5C,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY;QAChB,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CACxB,KAAM,CAAC,aAAa,EACnC,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CACzC,CAAC;QACF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CACA,KAAM,CAAC,aAAa,IAAI,QAAQ,CAAC,OAAO,EACvD,QAAQ,CAAC,KAAK,CACf,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAhBY,yBAAyB;IADrC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,YAAY,CAAC;;GACnC,yBAAyB,CAgBrC"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
2
|
+
export * from '@node-yalc/errors/error.enum.js';
|
|
3
|
+
export * from '@node-yalc/errors/error.class.js';
|
|
4
|
+
export * from '@node-yalc/errors/default.error.js';
|
|
5
|
+
export * from '@node-yalc/errors/result.error.js';
|
|
6
|
+
export * from './filters/index.js';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
2
|
+
export * from '@node-yalc/errors/error.enum.js';
|
|
3
|
+
export * from '@node-yalc/errors/error.class.js';
|
|
4
|
+
export * from '@node-yalc/errors/default.error.js';
|
|
5
|
+
export * from '@node-yalc/errors/result.error.js';
|
|
6
|
+
export * from './filters/index.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC"}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
|
|
3
|
+
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
4
|
+
export * from '@node-yalc/errors/error.enum.js';
|
|
5
|
+
export * from '@node-yalc/errors/error.class.js';
|
|
6
|
+
export * from '@node-yalc/errors/default.error.js';
|
|
7
|
+
export * from '@node-yalc/errors/result.error.js';
|
|
8
|
+
export * from './filters/index.js';
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DatabaseExceptionFilter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const graphql_1 = require("@nestjs/graphql");
|
|
6
|
-
const common = tslib_1.__importStar(require("@nestjs/common"));
|
|
7
|
-
const typeorm_1 = require("typeorm");
|
|
8
|
-
const error_enum_1 = require("@node-yalc/errors/error.enum");
|
|
9
|
-
let DatabaseExceptionFilter = class DatabaseExceptionFilter {
|
|
10
|
-
constructor(logger) {
|
|
11
|
-
this.logger = logger;
|
|
12
|
-
}
|
|
13
|
-
catch(error, host) {
|
|
14
|
-
const gqlHost = graphql_1.GqlArgumentsHost.create(host);
|
|
15
|
-
gqlHost.getType();
|
|
16
|
-
switch (true) {
|
|
17
|
-
case error instanceof typeorm_1.EntityNotFoundError:
|
|
18
|
-
this.logger.error(error, error_enum_1.ExceptionContextEnum.DATABASE);
|
|
19
|
-
error = new common.InternalServerErrorException(error);
|
|
20
|
-
break;
|
|
21
|
-
default:
|
|
22
|
-
this.logger.error(error, error.stack, error_enum_1.ExceptionContextEnum.DATABASE);
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
return error;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.DatabaseExceptionFilter = DatabaseExceptionFilter;
|
|
29
|
-
exports.DatabaseExceptionFilter = DatabaseExceptionFilter = tslib_1.__decorate([
|
|
30
|
-
common.Catch(typeorm_1.EntityNotFoundError, typeorm_1.ConnectionNotFoundError),
|
|
31
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
32
|
-
], DatabaseExceptionFilter);
|
|
33
|
-
//# sourceMappingURL=database-exception.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database-exception.filter.js","sourceRoot":"","sources":["database-exception.filter.ts"],"names":[],"mappings":";;;;AAAA,6CAAuE;AACvE,+DAAyC;AAEzC,qCAAuE;AACvE,6DAAoE;AAK7D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY,EAAE,IAA0B;QAC5C,MAAM,OAAO,GAAG,0BAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,CAAC,OAAO,EAAE,CAAC;QAWlB,QAAQ,IAAI,EAAE,CAAC;YAIb,KAAK,KAAK,YAAY,6BAAmB;gBACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,iCAAoB,CAAC,QAAQ,CAAC,CAAC;gBACxD,KAAK,GAAG,IAAI,MAAM,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC;gBAEvD,MAAM;YAER;gBACE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,iCAAoB,CAAC,QAAQ,CAAC,CAAC;gBAErE,MAAM;QACV,CAAC;QAGD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAnCY,0DAAuB;kCAAvB,uBAAuB;IADnC,MAAM,CAAC,KAAK,CAAC,6BAAmB,EAAE,iCAAuB,CAAC;;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AM;gBAGR;oBACE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE;wBAC5C,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,IAAI,EAAE;4BACJ,KAAK,EAAE,IAAA,oBAAW,EAAC,KAAK,CAAC,KAAK,CAAC;4BAC/B,IAAI,EAAE,KAAK,CAAC,IAAI;yBACjB;qBACF,CAAC,CAAC;oBACH,MAAM;YACV,CAAC;YAED,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;gBAC9B,IAAI,YAAY,EAAE,CAAC;oBACjB,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;oBAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAa,CAAC;oBAC9C,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,qBAAqB,CAAC;oBACrD,IAAI,WAAW;wBAAE,MAAM,GAAI,KAA8B,CAAC,SAAS,EAAE,CAAC;oBACtE,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YAEX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAnHY,kDAAmB;8BAAnB,mBAAmB;IAN/B,MAAM,CAAC,KAAK,CACX,MAAM,CAAC,aAAa,EACpB,8BAAqB,EACrB,uBAAQ,EACR,0BAAiB,CAClB;;GACY,mBAAmB,CAmH/B"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SystemExceptionFilter = void 0;
|
|
4
|
-
var system_exception_filter_js_1 = require("./system-exception.filter.js");
|
|
5
|
-
Object.defineProperty(exports, "SystemExceptionFilter", { enumerable: true, get: function () { return system_exception_filter_js_1.SystemExceptionFilter; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAKA,2EAAqE;AAA5D,mIAAA,qBAAqB,OAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SystemExceptionFilter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const common_1 = require("@nestjs/common");
|
|
6
|
-
const error_enum_1 = require("@node-yalc/errors/error.enum");
|
|
7
|
-
let SystemExceptionFilter = class SystemExceptionFilter {
|
|
8
|
-
constructor(logger) {
|
|
9
|
-
this.logger = logger;
|
|
10
|
-
}
|
|
11
|
-
catch(error) {
|
|
12
|
-
this.logger.error(error, error.stack, error_enum_1.ExceptionContextEnum.SYSTEM);
|
|
13
|
-
return error;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.SystemExceptionFilter = SystemExceptionFilter;
|
|
17
|
-
exports.SystemExceptionFilter = SystemExceptionFilter = tslib_1.__decorate([
|
|
18
|
-
(0, common_1.Catch)(TypeError, SyntaxError, RangeError, EvalError, ReferenceError),
|
|
19
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
20
|
-
], SystemExceptionFilter);
|
|
21
|
-
//# sourceMappingURL=system-exception.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system-exception.filter.js","sourceRoot":"","sources":["system-exception.filter.ts"],"names":[],"mappings":";;;;AAAA,2CAAwD;AAExD,6DAAoE;AAG7D,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,iCAAoB,CAAC,MAAM,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAA;AAPY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,cAAK,EAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC;;GACxD,qBAAqB,CAOjC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidationExceptionFilter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const crud_gen_error_js_1 = require("@nest-yalc-2/crud-gen/crud-gen.error.js");
|
|
6
|
-
const uuid_validation_error_js_1 = require("@nest-yalc-2/graphql/scalars/uuid-validation.error.js");
|
|
7
|
-
const common = tslib_1.__importStar(require("@nestjs/common"));
|
|
8
|
-
const index_js_1 = require("../index.js");
|
|
9
|
-
let ValidationExceptionFilter = class ValidationExceptionFilter {
|
|
10
|
-
constructor(logger) {
|
|
11
|
-
this.logger = logger;
|
|
12
|
-
}
|
|
13
|
-
catch(error) {
|
|
14
|
-
const newError = new index_js_1.InputValidationError(error.systemMessage, { response: { message: error.message } });
|
|
15
|
-
newError.stack = error.stack;
|
|
16
|
-
this.logger.error(error.systemMessage ?? newError.message, newError.stack);
|
|
17
|
-
return newError;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.ValidationExceptionFilter = ValidationExceptionFilter;
|
|
21
|
-
exports.ValidationExceptionFilter = ValidationExceptionFilter = tslib_1.__decorate([
|
|
22
|
-
common.Catch(uuid_validation_error_js_1.UUIDValidationError, crud_gen_error_js_1.CrudGenError),
|
|
23
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
24
|
-
], ValidationExceptionFilter);
|
|
25
|
-
//# sourceMappingURL=validation-exception.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation-exception.filter.js","sourceRoot":"","sources":["validation-exception.filter.ts"],"names":[],"mappings":";;;;AAAA,+EAAuE;AACvE,oGAA4F;AAC5F,+DAAyC;AAEzC,0CAAmD;AAK5C,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C,KAAK,CAAC,KAAY;QAChB,MAAM,QAAQ,GAAG,IAAI,+BAAoB,CACxB,KAAM,CAAC,aAAa,EACnC,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CACzC,CAAC;QACF,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,KAAK,CACA,KAAM,CAAC,aAAa,IAAI,QAAQ,CAAC,OAAO,EACvD,QAAQ,CAAC,KAAK,CACf,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAhBY,8DAAyB;oCAAzB,yBAAyB;IADrC,MAAM,CAAC,KAAK,CAAC,8CAAmB,EAAE,gCAAY,CAAC;;GACnC,yBAAyB,CAgBrC"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
2
|
-
export * from '@node-yalc/errors/error.enum';
|
|
3
|
-
export * from '@node-yalc/errors/error.class';
|
|
4
|
-
export * from '@node-yalc/errors/default.error';
|
|
5
|
-
export * from '@node-yalc/errors/result.error';
|
|
6
|
-
export * from './filters/index.js';
|
package/dist/src/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingArgumentsError = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
var crud_gen_1 = require("@nest-yalc-2/crud-gen");
|
|
6
|
-
Object.defineProperty(exports, "MissingArgumentsError", { enumerable: true, get: function () { return crud_gen_1.MissingArgumentsError; } });
|
|
7
|
-
tslib_1.__exportStar(require("@node-yalc/errors/error.enum"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("@node-yalc/errors/error.class"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("@node-yalc/errors/default.error"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("@node-yalc/errors/result.error"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./filters/index.js"), exports);
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;AAEA,kDAA8D;AAArD,iHAAA,qBAAqB,OAAA;AAC9B,uEAA6C;AAC7C,wEAA8C;AAC9C,0EAAgD;AAChD,yEAA+C;AAC/C,6DAAmC"}
|
package/dist/src/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* istanbul ignore file */
|
|
2
|
-
|
|
3
|
-
export { MissingArgumentsError } from '@nest-yalc-2/crud-gen';
|
|
4
|
-
export * from '@node-yalc/errors/error.enum';
|
|
5
|
-
export * from '@node-yalc/errors/error.class';
|
|
6
|
-
export * from '@node-yalc/errors/default.error';
|
|
7
|
-
export * from '@node-yalc/errors/result.error';
|
|
8
|
-
export * from './filters/index.js';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|