@rxdi/graphql-pubsub 0.7.195 → 0.7.197

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.
@@ -30,7 +30,6 @@ const hapi_1 = require("@rxdi/hapi");
30
30
  const hapi_2 = require("@hapi/hapi");
31
31
  const graphql_1 = require("@rxdi/graphql");
32
32
  const config_tokens_1 = require("../config.tokens");
33
- const graphql_2 = require("graphql");
34
33
  let SubscriptionService = class SubscriptionService {
35
34
  constructor(server, config, pubConfig) {
36
35
  this.server = server;
@@ -38,14 +37,13 @@ let SubscriptionService = class SubscriptionService {
38
37
  this.pubConfig = pubConfig;
39
38
  }
40
39
  OnInit() {
41
- console.log('Subscription');
42
40
  this.register();
43
41
  }
44
42
  register() {
45
43
  return __awaiter(this, void 0, void 0, function* () {
46
- const currentC = {
47
- execute: this.execute,
48
- subscribe: this.subscribe,
44
+ const config = {
45
+ execute: this.execute.bind(this),
46
+ subscribe: this.subscribe.bind(this),
49
47
  schema: this.config.graphqlOptions.schema,
50
48
  onConnect(connectionParams) {
51
49
  // return connectionHookService.modifyHooks
@@ -64,30 +62,30 @@ let SubscriptionService = class SubscriptionService {
64
62
  };
65
63
  if (this.pubConfig.authentication) {
66
64
  const auth = core_1.Container.get(this.pubConfig.authentication);
67
- Object.assign(currentC, auth);
65
+ Object.assign(config, auth);
68
66
  if (auth.onSubConnection) {
69
- currentC.onConnect = auth.onSubConnection.bind(auth);
67
+ config.onConnect = auth.onSubConnection.bind(auth);
70
68
  }
71
69
  if (auth.onSubOperation) {
72
- currentC.onOperation = auth.onSubOperation.bind(auth);
70
+ config.onOperation = auth.onSubOperation.bind(auth);
73
71
  }
74
72
  if (auth.onSubOperationComplete) {
75
- currentC.onOperationComplete = auth.onSubOperationComplete.bind(auth);
73
+ config.onOperationComplete = auth.onSubOperationComplete.bind(auth);
76
74
  }
77
75
  if (auth.onSubDisconnect) {
78
- currentC.onDisconnect = auth.onSubDisconnect.bind(auth);
76
+ config.onDisconnect = auth.onSubDisconnect.bind(auth);
79
77
  }
80
78
  }
81
- new subscriptions_transport_ws_1.SubscriptionServer(currentC, Object.assign({ server: this.server.listener, path: '/subscriptions' }, this.pubConfig.subscriptionServerOptions));
79
+ new subscriptions_transport_ws_1.SubscriptionServer(config, Object.assign({ server: this.server.listener, path: '/subscriptions' }, this.pubConfig.subscriptionServerOptions));
82
80
  });
83
81
  }
84
82
  /**
85
83
  * Cross compatability graphql v15 and v16 for subscriptions
86
84
  */
87
- execute(schema, node, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) {
85
+ execute(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) {
88
86
  return (0, execution_1.execute)({
89
87
  schema,
90
- document: typeof node === 'string' ? (0, graphql_2.parse)(node) : node,
88
+ document,
91
89
  rootValue,
92
90
  contextValue,
93
91
  variableValues,
@@ -99,10 +97,10 @@ let SubscriptionService = class SubscriptionService {
99
97
  /**
100
98
  * Cross compatability graphql v15 and v16 for subscriptions
101
99
  */
102
- subscribe(schema, node, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) {
100
+ subscribe(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) {
103
101
  return (0, subscription_1.subscribe)({
104
102
  schema,
105
- document: typeof node === 'string' ? (0, graphql_2.parse)(node) : node,
103
+ document,
106
104
  rootValue,
107
105
  contextValue,
108
106
  variableValues,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdi/graphql-pubsub",
3
- "version": "0.7.195",
3
+ "version": "0.7.197",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rxdi/graphql-pubsub"
@@ -30,16 +30,16 @@
30
30
  },
31
31
  "homepage": "https://github.com/rxdi/graphql-pubsub#readme",
32
32
  "dependencies": {
33
- "@rxdi/graphql-rabbitmq-subscriptions": "^0.7.194",
33
+ "@rxdi/graphql-rabbitmq-subscriptions": "^0.7.196",
34
34
  "@apollo/client": "^3.7.3",
35
35
  "graphql-request": "^1.8.2",
36
36
  "subscriptions-transport-ws": "^0.9.19",
37
37
  "ws": "6.2.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@rxdi/core": "^0.7.194",
41
- "@rxdi/graphql": "^0.7.194",
42
- "@rxdi/hapi": "^0.7.194",
40
+ "@rxdi/core": "^0.7.196",
41
+ "@rxdi/graphql": "^0.7.196",
42
+ "@rxdi/hapi": "^0.7.196",
43
43
  "@types/graphql": "^14.5.0",
44
44
  "@types/hapi": "^18.0.4",
45
45
  "@types/jest": "^24.0.22",