@rsdk/graphql 2.3.1 → 2.4.1-next.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.
- package/CHANGELOG.md +8 -0
- package/dist/error-handling/graphql-errors.formatter.d.ts +1 -1
- package/dist/error-handling/graphql-errors.formatter.js +3 -3
- package/dist/error-handling/graphql-errors.formatter.js.map +1 -1
- package/dist/error-handling/graphql-errors.sender.d.ts +1 -1
- package/dist/error-handling/graphql-errors.sender.js +1 -1
- package/dist/error-handling/graphql-errors.sender.js.map +1 -1
- package/package.json +5 -5
- package/src/error-handling/graphql-errors.formatter.ts +3 -3
- package/src/error-handling/graphql-errors.sender.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.4.1-next.0](https://github.com/R-Vision/rsdk/compare/v2.4.0...v2.4.1-next.0) (2023-06-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsdk/graphql
|
|
9
|
+
|
|
10
|
+
# [2.4.0](https://github.com/R-Vision/rsdk/compare/v2.3.1...v2.4.0) (2023-06-15)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rsdk/graphql
|
|
13
|
+
|
|
6
14
|
## [2.3.1](https://github.com/R-Vision/rsdk/compare/v2.3.0...v2.3.1) (2023-06-08)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @rsdk/graphql
|
|
@@ -11,7 +11,7 @@ import { GraphQLError } from 'graphql';
|
|
|
11
11
|
* в ErrorsFormatter) и нормализация объектов.
|
|
12
12
|
*/
|
|
13
13
|
export declare class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
14
|
-
static finalFormat(formattedError: GraphQLFormattedError,
|
|
14
|
+
static finalFormat(formattedError: GraphQLFormattedError, _error: unknown): GraphQLFormattedError;
|
|
15
15
|
match(host: ArgumentsHost): boolean;
|
|
16
16
|
format(ex: unknown, verbose?: boolean): GraphQLError;
|
|
17
17
|
}
|
|
@@ -4,7 +4,7 @@ exports.GraphQLErrorsFormatter = void 0;
|
|
|
4
4
|
const common_1 = require("@rsdk/common");
|
|
5
5
|
const core_1 = require("@rsdk/core");
|
|
6
6
|
const graphql_1 = require("graphql");
|
|
7
|
-
const ALWAYS_VERBOSE = [core_1.ExceptionKind.INPUT];
|
|
7
|
+
const ALWAYS_VERBOSE = new Set([core_1.ExceptionKind.INPUT]);
|
|
8
8
|
const DEFAULT_MESSAGE = 'Something went wrong';
|
|
9
9
|
/**
|
|
10
10
|
* Форматирование ошибок происходит в 2 этапа:
|
|
@@ -17,7 +17,7 @@ const DEFAULT_MESSAGE = 'Something went wrong';
|
|
|
17
17
|
class GraphQLErrorsFormatter {
|
|
18
18
|
static finalFormat(formattedError,
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
-
|
|
20
|
+
_error) {
|
|
21
21
|
delete formattedError.extensions?.exception;
|
|
22
22
|
return {
|
|
23
23
|
message: formattedError.message,
|
|
@@ -39,7 +39,7 @@ class GraphQLErrorsFormatter {
|
|
|
39
39
|
}
|
|
40
40
|
format(ex, verbose) {
|
|
41
41
|
if (ex instanceof core_1.PipelineException) {
|
|
42
|
-
const formatVerbose = verbose || ALWAYS_VERBOSE.
|
|
42
|
+
const formatVerbose = verbose || ALWAYS_VERBOSE.has(ex.kind);
|
|
43
43
|
const { kind, code, details, cause } = ex;
|
|
44
44
|
const message = formatVerbose
|
|
45
45
|
? [ex.message, ...core_1.PipelineException.innerMessages(ex)].join(' > ')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-errors.formatter.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.formatter.ts"],"names":[],"mappings":";;;AACA,yCAAyD;AAEzD,qCAA8D;AAE9D,qCAAuC;AAEvC,MAAM,cAAc,GAAG,CAAC,oBAAa,CAAC,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql-errors.formatter.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.formatter.ts"],"names":[],"mappings":";;;AACA,yCAAyD;AAEzD,qCAA8D;AAE9D,qCAAuC;AAEvC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,oBAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AACtD,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAa,sBAAsB;IACjC,MAAM,CAAC,WAAW,CAChB,cAAqC;IACrC,6DAA6D;IAC7D,MAAe;QAEf,OAAO,cAAc,CAAC,UAAU,EAAE,SAAS,CAAC;QAE5C,OAAO;YACL,OAAO,EAAE,cAAc,CAAC,OAAO;YAC/B,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI;gBACzB,IAAI,EAAE,cAAc,CAAC,IAAI;aAC1B,CAAC;YAEF,GAAG,CAAC,cAAc,CAAC,SAAS,IAAI;gBAC9B,SAAS,EAAE,cAAc,CAAC,SAAS;aACpC,CAAC;YAEF,UAAU,EAAE,IAAA,mBAAU,GAAE,CAAC,cAAc,CAAC,UAAU,EAAE;gBAClD,mDAAmD;gBACnD,UAAU,EAAE,CAAC,OAAO,CAAC;gBACrB,QAAQ,EAAE,sBAAa;aACxB,CAA4B;SAC9B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAmB;QACvB,OAAO,IAAI,CAAC,OAAO,EAAa,KAAK,SAAS,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,EAAW,EAAE,OAAiB;QACnC,IAAI,EAAE,YAAY,wBAAiB,EAAE;YACnC,MAAM,aAAa,GAAG,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;YAE7D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;YAE1C,MAAM,OAAO,GAAG,aAAa;gBAC3B,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,wBAAiB,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;gBAClE,CAAC,CAAC,eAAe,CAAC;YAEpB,OAAO,IAAI,sBAAY,CAAC,OAAO,EAAE;gBAC/B,UAAU,EAAE;oBACV,IAAI,EAAE,oBAAa,CAAC,IAAI,CAAC;oBAEzB,IAAI;oBACJ;;;uBAGG;oBACH,GAAG,CAAC,OAAO,IAAI;wBACb,KAAK;wBACL,OAAO;qBACR,CAAC;iBACH;aACF,CAAC,CAAC;SACJ;QAED,MAAM,OAAO,GAAG,OAAO;YACrB,CAAC,CAAE,EAAU,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3C,CAAC,CAAC,eAAe,CAAC;QAEpB,OAAO,IAAI,sBAAY,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CACF;AA/DD,wDA+DC"}
|
|
@@ -3,5 +3,5 @@ import type { IErrorsSender } from '@rsdk/core';
|
|
|
3
3
|
import type { Observable } from 'rxjs';
|
|
4
4
|
export declare class GraphQLErrorsSender implements IErrorsSender {
|
|
5
5
|
match(host: ArgumentsHost): boolean;
|
|
6
|
-
send(
|
|
6
|
+
send(_host: ArgumentsHost, ex: unknown): Observable<never>;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-errors.sender.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.sender.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAC9B,KAAK,CAAC,IAAmB;QACvB,OAAO,IAAI,CAAC,OAAO,EAAa,KAAK,SAAS,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"graphql-errors.sender.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.sender.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAC9B,KAAK,CAAC,IAAmB;QACvB,OAAO,IAAI,CAAC,OAAO,EAAa,KAAK,SAAS,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,KAAoB,EAAE,EAAW;QACpC,+DAA+D;QAC/D,MAAM,EAAE,CAAC;IACX,CAAC;CACF;AATD,kDASC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/graphql",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1-next.0",
|
|
4
4
|
"description": "Plugin for graphql",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"@nestjs/apollo": "^11.0.0",
|
|
16
16
|
"@nestjs/common": "^9.0.0",
|
|
17
17
|
"@nestjs/graphql": "^11.0.0",
|
|
18
|
-
"@rsdk/common": "^2.
|
|
19
|
-
"@rsdk/core": "^2.
|
|
20
|
-
"@rsdk/logging": "^2.
|
|
18
|
+
"@rsdk/common": "^2.4.1-next.0",
|
|
19
|
+
"@rsdk/core": "^2.4.1-next.0",
|
|
20
|
+
"@rsdk/logging": "^2.4.1-next.0",
|
|
21
21
|
"graphql": "^16.6.0",
|
|
22
22
|
"graphql-subscriptions": "^2.0.0",
|
|
23
23
|
"rxjs": "^7.8.1"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "02cbc6be59dcf7d7784b316b315eb746c6d5ac4a"
|
|
26
26
|
}
|
|
@@ -5,7 +5,7 @@ import { ExceptionKind, PipelineException } from '@rsdk/core';
|
|
|
5
5
|
import type { GraphQLFormattedError } from 'graphql';
|
|
6
6
|
import { GraphQLError } from 'graphql';
|
|
7
7
|
|
|
8
|
-
const ALWAYS_VERBOSE = [ExceptionKind.INPUT];
|
|
8
|
+
const ALWAYS_VERBOSE = new Set([ExceptionKind.INPUT]);
|
|
9
9
|
const DEFAULT_MESSAGE = 'Something went wrong';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -20,7 +20,7 @@ export class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
|
20
20
|
static finalFormat(
|
|
21
21
|
formattedError: GraphQLFormattedError,
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
|
|
23
|
+
_error: unknown,
|
|
24
24
|
): GraphQLFormattedError {
|
|
25
25
|
delete formattedError.extensions?.exception;
|
|
26
26
|
|
|
@@ -48,7 +48,7 @@ export class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
|
48
48
|
|
|
49
49
|
format(ex: unknown, verbose?: boolean): GraphQLError {
|
|
50
50
|
if (ex instanceof PipelineException) {
|
|
51
|
-
const formatVerbose = verbose || ALWAYS_VERBOSE.
|
|
51
|
+
const formatVerbose = verbose || ALWAYS_VERBOSE.has(ex.kind);
|
|
52
52
|
|
|
53
53
|
const { kind, code, details, cause } = ex;
|
|
54
54
|
|
|
@@ -7,7 +7,7 @@ export class GraphQLErrorsSender implements IErrorsSender {
|
|
|
7
7
|
return host.getType<'graphql'>() === 'graphql';
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
send(
|
|
10
|
+
send(_host: ArgumentsHost, ex: unknown): Observable<never> {
|
|
11
11
|
// Only throwing will provision exception data to apollo-server
|
|
12
12
|
throw ex;
|
|
13
13
|
}
|