@rxdi/graphql 0.7.182 → 0.7.184

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.
@@ -32,7 +32,7 @@ export interface GRAPHQL_PLUGIN_CONFIG {
32
32
  route?: {
33
33
  cors?: boolean;
34
34
  };
35
- graphqlOptions?: GraphQLOptions;
35
+ graphqlOptions?: Omit<GraphQLOptions, 'schemaHash'>;
36
36
  graphiqlOptions?: GraphiQL.GraphiQLData;
37
37
  graphiqlPlaygroundConfig?: RenderPageOptions;
38
38
  }
@@ -23,7 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.ApolloService = void 0;
25
25
  const core_1 = require("@rxdi/core");
26
- const Boom = require("@hapi/boom");
26
+ const boom_1 = require("@hapi/boom");
27
27
  const hapi_1 = require("@hapi/hapi");
28
28
  const apollo_server_core_1 = require("apollo-server-core");
29
29
  const hapi_2 = require("@rxdi/hapi");
@@ -43,19 +43,18 @@ let ApolloService = class ApolloService {
43
43
  }
44
44
  catch (e) { }
45
45
  if (onRequest) {
46
- return yield onRequest(context => this.makeGQLRequest(request, response, error, context), request, response, error);
46
+ return yield onRequest((context) => this.makeGQLRequest(request, response, error, context), request, response, error);
47
47
  }
48
- this.config.graphqlOptions.context =
49
- this.config.graphqlOptions.context || {};
48
+ this.config.graphqlOptions.context = this.config.graphqlOptions.context || {};
50
49
  if (request.headers.authorization &&
51
50
  request.headers.authorization !== 'undefined' &&
52
51
  this.config.authentication) {
53
52
  try {
54
- const serviceUtilsService = core_1.Container.get((this.config.authentication));
53
+ const serviceUtilsService = core_1.Container.get(this.config.authentication);
55
54
  this.config.graphqlOptions.context['user'] = yield serviceUtilsService.validateToken(request.headers.authorization);
56
55
  }
57
56
  catch (e) {
58
- return Boom.unauthorized();
57
+ return (0, boom_1.unauthorized)();
59
58
  }
60
59
  }
61
60
  else {
@@ -75,7 +74,7 @@ let ApolloService = class ApolloService {
75
74
  console.error(error);
76
75
  }
77
76
  if ('HttpQueryError' !== error.name) {
78
- throw Boom.boomify(error);
77
+ throw (0, boom_1.boomify)(error);
79
78
  }
80
79
  if (error &&
81
80
  error.message.constructor === String &&
@@ -89,9 +88,9 @@ let ApolloService = class ApolloService {
89
88
  response.type('application/json');
90
89
  return response;
91
90
  }
92
- const err = new Boom(error.message, { statusCode: error.statusCode });
91
+ const err = new boom_1.Boom(error.message, { statusCode: error.statusCode });
93
92
  if (error.headers) {
94
- Object.keys(error.headers).forEach(header => (err.output.headers[header] = error.headers[header]));
93
+ Object.keys(error.headers).forEach((header) => (err.output.headers[header] = error.headers[header]));
95
94
  }
96
95
  // Boom hides the error when status code is 500
97
96
  err.output.payload.message = error.message;
@@ -133,14 +132,14 @@ let ApolloService = class ApolloService {
133
132
  this.hookService.AttachHooks([
134
133
  this.config.graphqlOptions.schema.getQueryType(),
135
134
  this.config.graphqlOptions.schema.getMutationType(),
136
- this.config.graphqlOptions.schema.getSubscriptionType()
135
+ this.config.graphqlOptions.schema.getSubscriptionType(),
137
136
  ]);
138
137
  this.server.route({
139
138
  method: ['GET', 'POST'],
140
139
  path: this.config.path || '/graphql',
141
140
  vhost: this.config.vhost,
142
141
  config: this.config.route || {},
143
- handler: this.handler
142
+ handler: this.handler,
144
143
  });
145
144
  });
146
145
  }
@@ -160,7 +159,7 @@ let ApolloService = class ApolloService {
160
159
  ? // TODO type payload as string or Record
161
160
  request.payload
162
161
  : request.query,
163
- request: (0, apollo_server_core_1.convertNodeHttpToRequest)(request.raw.req)
162
+ request: (0, apollo_server_core_1.convertNodeHttpToRequest)(request.raw.req),
164
163
  });
165
164
  const response = h.response(graphqlResponse);
166
165
  response.type('application/json');
@@ -1,6 +1,5 @@
1
1
  import { GRAPHQL_PLUGIN_CONFIG } from '../../config.tokens';
2
2
  import { HapiConfigModel } from '@rxdi/hapi';
3
- import { ConfigModel } from '@rxdi/core';
4
3
  import { SendRequestQueryType } from '../../plugin-init';
5
4
  import { Server } from '@hapi/hapi';
6
5
  export interface CoreModuleConfig {
@@ -61,7 +60,7 @@ export declare const setConfigGraphql: (config?: GRAPHQL_PLUGIN_CONFIG) => {
61
60
  route?: {
62
61
  cors?: boolean;
63
62
  };
64
- graphqlOptions: import("apollo-server-core").GraphQLOptions<Record<string, any>, any> | {
63
+ graphqlOptions: Omit<import("apollo-server-core").GraphQLOptions<Record<string, any>, any>, "schemaHash"> | {
65
64
  schema: any;
66
65
  };
67
66
  graphiqlOptions: import("apollo-server-module-graphiql").GraphiQLData | {
@@ -73,7 +72,7 @@ export declare const setConfigGraphql: (config?: GRAPHQL_PLUGIN_CONFIG) => {
73
72
  };
74
73
  graphiqlPlaygroundConfig?: import("graphql-playground-html").RenderPageOptions;
75
74
  };
76
- export declare const startServer: (config?: CoreModuleConfig, bootstrapOptions?: ConfigModel) => import("rxjs").Observable<import("@rxdi/core/dist/container/observable-interface").ObservableContainer>;
75
+ export declare const startServer: any;
77
76
  export declare const stopServer: () => never;
78
77
  export declare const getServer: () => import("rxjs").Observable<Server<import("@hapi/hapi").ServerApplicationState>>;
79
78
  export declare const getGraphqlSchema: () => import("rxjs").Observable<import("graphql").GraphQLSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdi/graphql",
3
- "version": "0.7.182",
3
+ "version": "0.7.184",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rxdi/graphql"
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@gapi/playground": "^1.8.146",
34
34
  "apollo-errors": "1.9.0",
35
- "apollo-server-core": "2.12.0",
35
+ "apollo-server-core": "3.13.0",
36
36
  "apollo-server-module-graphiql": "1.4.0",
37
37
  "@hapi/boom": "^10.0.1",
38
38
  "fs-extra": "7.0.1",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "graphql": "^14.5.8",
43
- "@rxdi/core": "^0.7.181",
44
- "@rxdi/hapi": "^0.7.181",
43
+ "@rxdi/core": "^0.7.183",
44
+ "@rxdi/hapi": "^0.7.183",
45
45
  "@types/graphql": "^14.5.0",
46
46
  "@types/jest": "^24.0.22",
47
47
  "@types/node": "^12.0.10",