@rxdi/graphql 0.7.186 → 0.7.187

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.
@@ -1,11 +1,10 @@
1
1
  import { InjectionToken } from '@rxdi/core';
2
2
  import * as GraphiQL from 'apollo-server-module-graphiql';
3
- import { GraphQLOptions } from 'apollo-server-core';
4
3
  import { GraphQLSchema, GraphQLField, GraphQLDirective } from 'graphql';
5
4
  import { Server, ResponseToolkit } from '@hapi/hapi';
6
5
  import { RenderPageOptions } from 'graphql-playground-html';
7
6
  export interface HapiOptionsFunction {
8
- (req?: Request): GraphQLOptions | Promise<GraphQLOptions>;
7
+ (req?: Request): any | Promise<any>;
9
8
  }
10
9
  export interface HapiGraphiQLOptionsFunction {
11
10
  (req?: Request): GraphiQL.GraphiQLData | Promise<GraphiQL.GraphiQLData>;
@@ -32,7 +31,7 @@ export interface GRAPHQL_PLUGIN_CONFIG {
32
31
  route?: {
33
32
  cors?: boolean;
34
33
  };
35
- graphqlOptions?: GraphQLOptions;
34
+ graphqlOptions?: any;
36
35
  graphiqlOptions?: GraphiQL.GraphiQLData;
37
36
  graphiqlPlaygroundConfig?: RenderPageOptions;
38
37
  }
@@ -25,11 +25,11 @@ exports.ApolloService = void 0;
25
25
  const core_1 = require("@rxdi/core");
26
26
  const boom_1 = require("@hapi/boom");
27
27
  const hapi_1 = require("@hapi/hapi");
28
- const apollo_server_core_1 = require("apollo-server-core");
29
28
  const hapi_2 = require("@rxdi/hapi");
30
29
  const config_tokens_1 = require("../config.tokens");
31
30
  const bootstrap_service_1 = require("../services/bootstrap.service");
32
31
  const hooks_service_1 = require("./hooks.service");
32
+ const graphql_1 = require("graphql");
33
33
  let ApolloService = class ApolloService {
34
34
  constructor(server, config, bootstrapService, hookService) {
35
35
  this.server = server;
@@ -152,14 +152,11 @@ let ApolloService = class ApolloService {
152
152
  this.isInitQuery = false;
153
153
  }
154
154
  this.config.graphqlOptions.context = Object.assign(Object.assign({}, this.config.graphqlOptions.context), context);
155
- const { graphqlResponse, responseInit } = yield (0, apollo_server_core_1.runHttpQuery)([request, h], {
156
- method: request.method.toUpperCase(),
157
- options: this.config.graphqlOptions,
158
- query: request.method === 'post'
159
- ? // TODO type payload as string or Record
160
- request.payload
161
- : request.query,
162
- request: (0, apollo_server_core_1.convertNodeHttpToRequest)(request.raw.req),
155
+ const graphqlResponse = yield (0, graphql_1.graphql)({
156
+ schema: this.config.graphqlOptions.schema,
157
+ source: request.method === 'post' ? request.payload['query'] : request.query,
158
+ variableValues: request.payload['variables'],
159
+ contextValue: this.config.graphqlOptions.context,
163
160
  });
164
161
  const response = h.response(graphqlResponse);
165
162
  response.type('application/json');
@@ -28,7 +28,7 @@ const config_tokens_1 = require("../config.tokens");
28
28
  const bootstrap_service_1 = require("./bootstrap.service");
29
29
  const effect_service_1 = require("./effect.service");
30
30
  const rxjs_1 = require("rxjs");
31
- const fs_extra_1 = require("fs-extra");
31
+ const fs_1 = require("fs");
32
32
  let HookService = class HookService {
33
33
  constructor(config, effectService, logger) {
34
34
  this.config = config;
@@ -65,8 +65,8 @@ export type EffectTypes = keyof typeof EffectTypes;
65
65
  `;
66
66
  try {
67
67
  const folder = process.env.INTROSPECTION_FOLDER || `./src/app/core/api-introspection/`;
68
- (0, fs_extra_1.ensureDirSync)(folder);
69
- (0, fs_extra_1.writeFileSync)(folder + 'EffectTypes.ts', types, 'utf8');
68
+ (0, fs_1.mkdirSync)(folder, { recursive: true });
69
+ (0, fs_1.writeFileSync)(folder + 'EffectTypes.ts', types, 'utf8');
70
70
  }
71
71
  catch (e) {
72
72
  console.error(e, 'Effects are not saved to directory');
@@ -60,9 +60,7 @@ export declare const setConfigGraphql: (config?: GRAPHQL_PLUGIN_CONFIG) => {
60
60
  route?: {
61
61
  cors?: boolean;
62
62
  };
63
- graphqlOptions: import("apollo-server-core").GraphQLOptions<Record<string, any>, any> | {
64
- schema: any;
65
- };
63
+ graphqlOptions: any;
66
64
  graphiqlOptions: import("apollo-server-module-graphiql").GraphiQLData | {
67
65
  endpointURL: string;
68
66
  subscriptionsEndpoint: string;
@@ -75,5 +73,5 @@ export declare const setConfigGraphql: (config?: GRAPHQL_PLUGIN_CONFIG) => {
75
73
  export declare const startServer: any;
76
74
  export declare const stopServer: () => never;
77
75
  export declare const getServer: () => import("rxjs").Observable<Server<import("@hapi/hapi").ServerApplicationState>>;
78
- export declare const getGraphqlSchema: () => import("rxjs").Observable<import("graphql").GraphQLSchema>;
76
+ export declare const getGraphqlSchema: () => import("rxjs").Observable<any>;
79
77
  export declare const sendRequest: <T = {}>(request: SendRequestQueryType, url?: string) => PromiseLike<import("../../plugin-init").Response<T>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdi/graphql",
3
- "version": "0.7.186",
3
+ "version": "0.7.187",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rxdi/graphql"
@@ -32,16 +32,14 @@
32
32
  "dependencies": {
33
33
  "@gapi/playground": "^1.8.146",
34
34
  "apollo-errors": "1.9.0",
35
- "apollo-server-core": "2.12.0",
36
35
  "apollo-server-module-graphiql": "1.4.0",
37
36
  "@hapi/boom": "^10.0.1",
38
- "fs-extra": "7.0.1",
39
37
  "graphql-tester": "0.0.5"
40
38
  },
41
39
  "devDependencies": {
42
40
  "graphql": "^14.5.8",
43
- "@rxdi/core": "^0.7.185",
44
- "@rxdi/hapi": "^0.7.185",
41
+ "@rxdi/core": "^0.7.186",
42
+ "@rxdi/hapi": "^0.7.186",
45
43
  "@types/graphql": "^14.5.0",
46
44
  "@types/jest": "^24.0.22",
47
45
  "@types/node": "^12.0.10",