@rsdk/graphql 4.0.0-next.13 → 4.0.0-next.15
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 +24 -6
- package/dist/error-handling/graphql-errors.formatter.d.ts +1 -2
- package/dist/error-handling/graphql-errors.formatter.js +1 -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 -3
- package/dist/error-handling/graphql-errors.sender.js.map +1 -1
- package/dist/graphql-logger.interceptor.js.map +1 -1
- package/dist/graphql.plugin.js +4 -1
- package/dist/graphql.plugin.js.map +1 -1
- package/package.json +7 -7
- package/src/error-handling/graphql-errors.formatter.ts +2 -5
- package/src/error-handling/graphql-errors.sender.ts +1 -3
- package/src/graphql.plugin.ts +4 -1
- package/tsconfig.json +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
## [4.0.0-next.15](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.14...v4.0.0-next.15) (2023-11-30)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added protocol detector ([#166](https://github.com/R-Vision/rsdk/issues/166)) ([f348995](https://github.com/R-Vision/rsdk/commit/f348995f29648c7392b7375c5b2001197d60eb36))
|
|
11
|
+
|
|
12
|
+
## [4.0.0-next.14](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.13...v4.0.0-next.14) (2023-11-29)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **core:** PFM-601 Add support send trace id from client to server ([#164](https://github.com/R-Vision/rsdk/issues/164)) ([9e37243](https://github.com/R-Vision/rsdk/commit/9e372437fbb3d7d2b1167b99d07b0ac64cb4013d)), closes [#pfm-601](https://github.com/R-Vision/rsdk/issues/pfm-601) [#pfm-601](https://github.com/R-Vision/rsdk/issues/pfm-601)
|
|
17
|
+
|
|
6
18
|
## [4.0.0-next.13](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.12...v4.0.0-next.13) (2023-11-29)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @rsdk/graphql
|
|
@@ -21,7 +33,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
21
33
|
|
|
22
34
|
### Features
|
|
23
35
|
|
|
24
|
-
* added configuration for request logging and move to trace level all request
|
|
36
|
+
* added configuration for request logging and move to trace level all request
|
|
37
|
+
logging ([#158](https://github.com/R-Vision/rsdk/issues/158)) ([0304672](https://github.com/R-Vision/rsdk/commit/0304672c112fd626642a2d44b0384fbf188e71b4))
|
|
25
38
|
|
|
26
39
|
## [4.0.0-next.9](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.8...v4.0.0-next.9) (2023-11-29)
|
|
27
40
|
|
|
@@ -51,7 +64,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
51
64
|
|
|
52
65
|
### Bug Fixes
|
|
53
66
|
|
|
54
|
-
* all yarn peers dependency
|
|
67
|
+
* all yarn peers dependency
|
|
68
|
+
issues ([e0db9ef](https://github.com/R-Vision/rsdk/commit/e0db9ef1ab8a4df4e1f8ff6f6a9e3728f497549b))
|
|
55
69
|
|
|
56
70
|
## [4.0.0-next.2](https://github.com/R-Vision/rsdk/compare/v4.0.0-next.1...v4.0.0-next.2) (2023-11-10)
|
|
57
71
|
|
|
@@ -221,7 +235,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
221
235
|
|
|
222
236
|
### Bug Fixes
|
|
223
237
|
|
|
224
|
-
* **deps:** correctly
|
|
238
|
+
* **deps:** correctly
|
|
239
|
+
peerDependencies ([349628f](https://github.com/R-Vision/rsdk/commit/349628f10da46a30d6c8b9f9387e010869318212))
|
|
225
240
|
|
|
226
241
|
## [3.0.1-next.0](https://github.com/R-Vision/rsdk/compare/v3.0.0...v3.0.1-next.0) (2023-08-07)
|
|
227
242
|
|
|
@@ -347,7 +362,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
347
362
|
|
|
348
363
|
### Bug Fixes
|
|
349
364
|
|
|
350
|
-
* remove private dependencies from `peerDependencies`
|
|
365
|
+
* remove private dependencies from `peerDependencies`
|
|
366
|
+
section ([0bce6ff](https://github.com/R-Vision/rsdk/commit/0bce6ffb5b699e2ed1dc9aca77cbdbf085267ff7))
|
|
351
367
|
|
|
352
368
|
## 1.0.11 (2023-05-23)
|
|
353
369
|
|
|
@@ -357,7 +373,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
357
373
|
|
|
358
374
|
### Bug Fixes
|
|
359
375
|
|
|
360
|
-
* add "access: public" to new
|
|
376
|
+
* add "access: public" to new
|
|
377
|
+
packages ([04d5983](https://github.com/R-Vision/rsdk/commit/04d5983cfa3e97c5d8219e07208a0499a8c6bc83))
|
|
361
378
|
|
|
362
379
|
## 1.0.9 (2023-05-21)
|
|
363
380
|
|
|
@@ -387,7 +404,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
387
404
|
|
|
388
405
|
### Bug Fixes
|
|
389
406
|
|
|
390
|
-
* builtin make not private in
|
|
407
|
+
* builtin make not private in
|
|
408
|
+
npm ([50c83b6](https://github.com/R-Vision/rsdk/commit/50c83b6454f9a89f1e99d3b33a497ce2c029d8c6))
|
|
391
409
|
|
|
392
410
|
## 1.0.2 (2023-05-10)
|
|
393
411
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ArgumentsHost } from '@nestjs/common';
|
|
2
1
|
import type { IErrorsFormatter } from '@rsdk/core';
|
|
3
2
|
import type { GraphQLFormattedError } from 'graphql';
|
|
4
3
|
import { GraphQLError } from 'graphql';
|
|
@@ -11,7 +10,7 @@ import { GraphQLError } from 'graphql';
|
|
|
11
10
|
* в ErrorsFormatter) и нормализация объектов.
|
|
12
11
|
*/
|
|
13
12
|
export declare class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
13
|
+
protocol: string;
|
|
14
14
|
static finalFormat(formattedError: GraphQLFormattedError, _error: unknown): GraphQLFormattedError;
|
|
15
|
-
match(host: ArgumentsHost): boolean;
|
|
16
15
|
format(ex: unknown, verbose?: boolean): GraphQLError;
|
|
17
16
|
}
|
|
@@ -15,6 +15,7 @@ const DEFAULT_MESSAGE = 'Something went wrong';
|
|
|
15
15
|
* в ErrorsFormatter) и нормализация объектов.
|
|
16
16
|
*/
|
|
17
17
|
class GraphQLErrorsFormatter {
|
|
18
|
+
protocol = 'graphql';
|
|
18
19
|
static finalFormat(formattedError,
|
|
19
20
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
21
|
_error) {
|
|
@@ -34,9 +35,6 @@ class GraphQLErrorsFormatter {
|
|
|
34
35
|
}),
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
match(host) {
|
|
38
|
-
return host.getType() === 'graphql';
|
|
39
|
-
}
|
|
40
38
|
format(ex, verbose) {
|
|
41
39
|
if (ex instanceof core_1.PipelineException) {
|
|
42
40
|
const formatVerbose = verbose || ALWAYS_VERBOSE.has(ex.kind);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-errors.formatter.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.formatter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"graphql-errors.formatter.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.formatter.ts"],"names":[],"mappings":";;;AAAA,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;A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,CAAC;iBACH;aACF,CAAC,CAAC;QACL,CAAC;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;AA7DD,wDA6DC"}
|
|
@@ -2,6 +2,6 @@ import type { ArgumentsHost } from '@nestjs/common';
|
|
|
2
2
|
import type { IErrorsSender } from '@rsdk/core';
|
|
3
3
|
import type { Observable } from 'rxjs';
|
|
4
4
|
export declare class GraphQLErrorsSender implements IErrorsSender {
|
|
5
|
-
|
|
5
|
+
protocol: string;
|
|
6
6
|
send(_host: ArgumentsHost, ex: unknown): Observable<never>;
|
|
7
7
|
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GraphQLErrorsSender = void 0;
|
|
4
4
|
class GraphQLErrorsSender {
|
|
5
|
-
|
|
6
|
-
return host.getType() === 'graphql';
|
|
7
|
-
}
|
|
5
|
+
protocol = 'graphql';
|
|
8
6
|
send(_host, ex) {
|
|
9
7
|
// Only throwing will provision exception data to apollo-server
|
|
10
8
|
throw ex;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"graphql-errors.sender.js","sourceRoot":"","sources":["../../src/error-handling/graphql-errors.sender.ts"],"names":[],"mappings":";;;AAIA,MAAa,mBAAmB;IAC9B,QAAQ,GAAG,SAAS,CAAC;IAErB,IAAI,CAAC,KAAoB,EAAE,EAAW;QACpC,+DAA+D;QAC/D,MAAM,EAAE,CAAC;IACX,CAAC;CACF;AAPD,kDAOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-logger.interceptor.js","sourceRoot":"","sources":["../src/graphql-logger.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,2CAA4C;AAE5C,6CAAsD;AACtD,qCAA0C;AAG1C,oEAAiE;AACjE,mEAAgE;AAChE,qDAAkD;AAElD,qDAAiD;AAG1C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEe;IACxC;IAFV,YACkD,MAAe,EACvD,aAA4B;QADY,WAAM,GAAN,MAAM,CAAS;QACvD,kBAAa,GAAb,aAAa,CAAe;IACnC,CAAC;IAEJ,SAAS,CACP,OAAyB,EACzB,IAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"graphql-logger.interceptor.js","sourceRoot":"","sources":["../src/graphql-logger.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,2CAA4C;AAE5C,6CAAsD;AACtD,qCAA0C;AAG1C,oEAAiE;AACjE,mEAAgE;AAChE,qDAAkD;AAElD,qDAAiD;AAG1C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEe;IACxC;IAFV,YACkD,MAAe,EACvD,aAA4B;QADY,WAAM,GAAN,MAAM,CAAS;QACvD,kBAAa,GAAb,aAAa,CAAe;IACnC,CAAC;IAEJ,SAAS,CACP,OAAyB,EACzB,IAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QACD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAkB,KAAK,SAAS,CAAC;QAClE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;QAED,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,6BAAmB,CAAC,MAAM,CAA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CAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,mBAAY,EAAC,wBAAwB,CAAC,CAAA;6CAChB,8BAAa;GAH3B,wBAAwB,CA6DpC"}
|
package/dist/graphql.plugin.js
CHANGED
|
@@ -64,7 +64,10 @@ class GraphQLPlugin {
|
|
|
64
64
|
}),
|
|
65
65
|
// Что это?
|
|
66
66
|
context: ({ req, connection }) => ({
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Иногда даже контекста может не быть, поэтому "?"
|
|
69
|
+
*/
|
|
70
|
+
req: req ?? connection?.context,
|
|
68
71
|
}),
|
|
69
72
|
fieldResolverEnhancers: ['filters'],
|
|
70
73
|
formatError: error_handling_1.GraphQLErrorsFormatter.finalFormat,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.plugin.js","sourceRoot":"","sources":["../src/graphql.plugin.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAE9C,uCAA+C;AAC/C,6CAAgD;AAOhD,2CAA8C;AAE9C,mEAA8D;AAC9D,qDAA+E;AAC/E,qDAAiD;AACjD,6EAAwE;AAExE,MAAM,SAAS,GAAG,CAAC,gBAAqB,EAAO,EAAE;IAC/C,MAAM,GAAG,GAAG,gBAAgB,IAAI,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;IAElC,4BAA4B;IAC5B,IAAI,gBAAgB,EAAE,aAAa,IAAI,gBAAgB,EAAE,aAAa,EAAE;
|
|
1
|
+
{"version":3,"file":"graphql.plugin.js","sourceRoot":"","sources":["../src/graphql.plugin.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAE9C,uCAA+C;AAC/C,6CAAgD;AAOhD,2CAA8C;AAE9C,mEAA8D;AAC9D,qDAA+E;AAC/E,qDAAiD;AACjD,6EAAwE;AAExE,MAAM,SAAS,GAAG,CAAC,gBAAqB,EAAO,EAAE;IAC/C,MAAM,GAAG,GAAG,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CAC5B,SAAS;gCACT,IAAI,EAAE,IAAI,CAAC,IAAI;6BAChB;yBACF,CAAC;qBACH;oBACD,eAAe,EAAE,IAAI;oBACrB,sEAAsE;oBACtE,wCAAwC;iBACzC,CAAC;aACH,CAAC;SACH,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,QAA4B;QAC9C,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;YACvD,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,uCAAsB,EAAE,CAAC;IACtC,CAAC;IAED,WAAW;QACT,OAAO,IAAI,oCAAmB,EAAE,CAAC;IACnC,CAAC;CACF;AAxGD,sCAwGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/graphql",
|
|
3
|
-
"version": "4.0.0-next.
|
|
3
|
+
"version": "4.0.0-next.15",
|
|
4
4
|
"description": "Plugin for graphql",
|
|
5
5
|
"license": "Apache License 2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"@nestjs/apollo": "^12.0.0",
|
|
22
22
|
"@nestjs/common": "^10.0.0",
|
|
23
23
|
"@nestjs/core": "^10.0.0",
|
|
24
|
-
"@nestjs/graphql": "^12.0.
|
|
25
|
-
"@rsdk/common": "^4.0.0-next.
|
|
26
|
-
"@rsdk/core": "^4.0.0-next.
|
|
27
|
-
"@rsdk/http.server.express": "^4.0.0-next.
|
|
28
|
-
"@rsdk/logging": "^4.0.0-next.
|
|
24
|
+
"@nestjs/graphql": "^12.0.8",
|
|
25
|
+
"@rsdk/common": "^4.0.0-next.15",
|
|
26
|
+
"@rsdk/core": "^4.0.0-next.15",
|
|
27
|
+
"@rsdk/http.server.express": "^4.0.0-next.15",
|
|
28
|
+
"@rsdk/logging": "^4.0.0-next.15",
|
|
29
29
|
"graphql": "^16.6.0",
|
|
30
30
|
"graphql-subscriptions": "^2.0.0",
|
|
31
31
|
"reflect-metadata": "^0.1.13",
|
|
32
32
|
"rxjs": "^7.8.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "8abd89d7800375749b024410dc3465ff40389277"
|
|
35
35
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ArgumentsHost } from '@nestjs/common';
|
|
2
1
|
import { normalizer, sortErrorKeys } from '@rsdk/common';
|
|
3
2
|
import type { IErrorsFormatter } from '@rsdk/core';
|
|
4
3
|
import { ExceptionKind, PipelineException } from '@rsdk/core';
|
|
@@ -17,6 +16,8 @@ const DEFAULT_MESSAGE = 'Something went wrong';
|
|
|
17
16
|
* в ErrorsFormatter) и нормализация объектов.
|
|
18
17
|
*/
|
|
19
18
|
export class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
19
|
+
protocol = 'graphql';
|
|
20
|
+
|
|
20
21
|
static finalFormat(
|
|
21
22
|
formattedError: GraphQLFormattedError,
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -42,10 +43,6 @@ export class GraphQLErrorsFormatter implements IErrorsFormatter {
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
match(host: ArgumentsHost): boolean {
|
|
46
|
-
return host.getType<'graphql'>() === 'graphql';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
46
|
format(ex: unknown, verbose?: boolean): GraphQLError {
|
|
50
47
|
if (ex instanceof PipelineException) {
|
|
51
48
|
const formatVerbose = verbose || ALWAYS_VERBOSE.has(ex.kind);
|
|
@@ -3,9 +3,7 @@ import type { IErrorsSender } from '@rsdk/core';
|
|
|
3
3
|
import type { Observable } from 'rxjs';
|
|
4
4
|
|
|
5
5
|
export class GraphQLErrorsSender implements IErrorsSender {
|
|
6
|
-
|
|
7
|
-
return host.getType<'graphql'>() === 'graphql';
|
|
8
|
-
}
|
|
6
|
+
protocol = 'graphql';
|
|
9
7
|
|
|
10
8
|
send(_host: ArgumentsHost, ex: unknown): Observable<never> {
|
|
11
9
|
// Only throwing will provision exception data to apollo-server
|
package/src/graphql.plugin.ts
CHANGED
|
@@ -111,7 +111,10 @@ export class GraphQLPlugin implements PlatformAppPlugin {
|
|
|
111
111
|
|
|
112
112
|
// Что это?
|
|
113
113
|
context: ({ req, connection }: any) => ({
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Иногда даже контекста может не быть, поэтому "?"
|
|
116
|
+
*/
|
|
117
|
+
req: req ?? connection?.context,
|
|
115
118
|
}),
|
|
116
119
|
fieldResolverEnhancers: ['filters'],
|
|
117
120
|
formatError: GraphQLErrorsFormatter.finalFormat,
|
package/tsconfig.json
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"outDir": "dist"
|
|
6
6
|
},
|
|
7
|
-
"include": [
|
|
8
|
-
|
|
7
|
+
"include": [
|
|
8
|
+
"src/**/*"
|
|
9
|
+
],
|
|
10
|
+
"exclude": [
|
|
11
|
+
"node_modules",
|
|
12
|
+
"dist",
|
|
13
|
+
"test",
|
|
14
|
+
"**/*.spec.ts",
|
|
15
|
+
"**/*.test.ts",
|
|
16
|
+
"**/*.spec.e2e.ts",
|
|
17
|
+
"**/*.test.e2e.ts"
|
|
18
|
+
]
|
|
9
19
|
}
|