@rxdi/graphql 0.7.235 → 0.7.237
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/config.tokens.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/services/{apollo.service.d.ts → graphql.service.d.ts} +1 -1
- package/dist/services/{apollo.service.js → graphql.service.js} +10 -2
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/test/helpers/core-module.d.ts +2 -0
- package/package.json +3 -3
package/dist/config.tokens.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
exports.GraphQLModule = void 0;
|
|
25
25
|
const core_1 = require("@rxdi/core");
|
|
26
26
|
const services_1 = require("./services");
|
|
27
|
-
const
|
|
27
|
+
const graphql_service_1 = require("./services/graphql.service");
|
|
28
28
|
const config_tokens_1 = require("./config.tokens");
|
|
29
29
|
const bootstrap_service_1 = require("./services/bootstrap.service");
|
|
30
30
|
const plugin_init_1 = require("./plugin-init");
|
|
@@ -40,7 +40,7 @@ let GraphQLModule = GraphQLModule_1 = class GraphQLModule {
|
|
|
40
40
|
},
|
|
41
41
|
services_1.HookService,
|
|
42
42
|
bootstrap_service_1.BootstrapService,
|
|
43
|
-
|
|
43
|
+
graphql_service_1.GraphqlService,
|
|
44
44
|
],
|
|
45
45
|
plugins: [plugin_init_1.PluginInit]
|
|
46
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PluginInterface } from '@rxdi/core';
|
|
2
2
|
import { Server, Request, ResponseToolkit } from '@hapi/hapi';
|
|
3
3
|
import { GRAPHQL_PLUGIN_CONFIG } from '../config.tokens';
|
|
4
|
-
import { BootstrapService } from '
|
|
4
|
+
import { BootstrapService } from './bootstrap.service';
|
|
5
5
|
import { HookService } from './hooks.service';
|
|
6
6
|
export declare class GraphqlService implements PluginInterface {
|
|
7
7
|
private server;
|
|
@@ -27,7 +27,7 @@ const boom_1 = require("@hapi/boom");
|
|
|
27
27
|
const hapi_1 = require("@hapi/hapi");
|
|
28
28
|
const hapi_2 = require("@rxdi/hapi");
|
|
29
29
|
const config_tokens_1 = require("../config.tokens");
|
|
30
|
-
const bootstrap_service_1 = require("
|
|
30
|
+
const bootstrap_service_1 = require("./bootstrap.service");
|
|
31
31
|
const hooks_service_1 = require("./hooks.service");
|
|
32
32
|
const graphql_1 = require("graphql");
|
|
33
33
|
let GraphqlService = class GraphqlService {
|
|
@@ -126,7 +126,7 @@ let GraphqlService = class GraphqlService {
|
|
|
126
126
|
register() {
|
|
127
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
128
|
if (!this.config || !this.config.graphqlOptions) {
|
|
129
|
-
throw new Error('
|
|
129
|
+
throw new Error('Graphql Server requires options.');
|
|
130
130
|
}
|
|
131
131
|
this.config.graphqlOptions.schema = yield this.config.graphqlOptions.schema;
|
|
132
132
|
this.hookService.AttachHooks([
|
|
@@ -145,6 +145,7 @@ let GraphqlService = class GraphqlService {
|
|
|
145
145
|
}
|
|
146
146
|
makeGQLRequest(request, h, err, context) {
|
|
147
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
var _a;
|
|
148
149
|
if (request.payload && request.payload.toString().includes('initQuery')) {
|
|
149
150
|
this.isInitQuery = true;
|
|
150
151
|
}
|
|
@@ -162,6 +163,13 @@ let GraphqlService = class GraphqlService {
|
|
|
162
163
|
: undefined,
|
|
163
164
|
contextValue: this.config.graphqlOptions.context,
|
|
164
165
|
});
|
|
166
|
+
if (((_a = graphqlResponse === null || graphqlResponse === void 0 ? void 0 : graphqlResponse.errors) === null || _a === void 0 ? void 0 : _a.length) && this.config.hideSchemaDetailsFromClientErrors) {
|
|
167
|
+
graphqlResponse.errors = graphqlResponse.errors.map(err => {
|
|
168
|
+
err.message = err.message.replace(/ ?Did you mean(.+?)\?\$/, '');
|
|
169
|
+
;
|
|
170
|
+
return err;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
165
173
|
const response = h.response(graphqlResponse);
|
|
166
174
|
response.type('application/json');
|
|
167
175
|
return response;
|
package/dist/services/index.d.ts
CHANGED
package/dist/services/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./hooks.service"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./graphql.service"), exports);
|
|
19
19
|
__exportStar(require("./bootstrap.service"), exports);
|
|
20
20
|
__exportStar(require("./error.service"), exports);
|
|
21
21
|
__exportStar(require("./hooks.service"), exports);
|
|
@@ -27,6 +27,7 @@ export declare const DEFAULT_CONFIG: {
|
|
|
27
27
|
export declare const setConfigServer: (config?: HapiConfigModel) => {
|
|
28
28
|
randomPort: boolean;
|
|
29
29
|
staticConfig?: import("@hapi/hapi").ServerRoute | import("@hapi/hapi").ServerRoute[];
|
|
30
|
+
mode?: "lambda" | "server";
|
|
30
31
|
hapi: {
|
|
31
32
|
port: number;
|
|
32
33
|
} | import("@hapi/hapi").ServerOptions;
|
|
@@ -46,6 +47,7 @@ export declare const setConfigGraphql: (config?: GRAPHQL_PLUGIN_CONFIG) => {
|
|
|
46
47
|
cors?: boolean;
|
|
47
48
|
};
|
|
48
49
|
graphqlOptions: any;
|
|
50
|
+
hideSchemaDetailsFromClientErrors?: boolean;
|
|
49
51
|
};
|
|
50
52
|
export declare const startServer: any;
|
|
51
53
|
export declare const stopServer: () => never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/graphql",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.237",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/rxdi/graphql"
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@hapi/boom": "^10.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@rxdi/core": "^0.7.
|
|
37
|
-
"@rxdi/hapi": "^0.7.
|
|
36
|
+
"@rxdi/core": "^0.7.236",
|
|
37
|
+
"@rxdi/hapi": "^0.7.236",
|
|
38
38
|
"graphql": "^16.12.0",
|
|
39
39
|
"@types/graphql": "^14.5.0",
|
|
40
40
|
"@types/jest": "^24.0.22",
|