@rxdi/graphql-pubsub 0.7.194 → 0.7.196

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.
@@ -9,4 +9,12 @@ export declare class SubscriptionService implements PluginInterface {
9
9
  constructor(server: Server, config: GRAPHQL_PLUGIN_CONFIG, pubConfig: GRAPHQL_PUB_SUB_DI_CONFIG);
10
10
  OnInit(): void;
11
11
  register(): Promise<void>;
12
+ /**
13
+ * Cross compatability graphql v15 and v16 for subscriptions
14
+ */
15
+ private execute;
16
+ /**
17
+ * Cross compatability graphql v15 and v16 for subscriptions
18
+ */
19
+ private subscribe;
12
20
  }
@@ -37,14 +37,13 @@ let SubscriptionService = class SubscriptionService {
37
37
  this.pubConfig = pubConfig;
38
38
  }
39
39
  OnInit() {
40
- console.log('Subscription');
41
40
  this.register();
42
41
  }
43
42
  register() {
44
43
  return __awaiter(this, void 0, void 0, function* () {
45
- const currentC = {
46
- execute: execution_1.execute,
47
- subscribe: subscription_1.subscribe,
44
+ const config = {
45
+ execute: this.execute.bind(this),
46
+ subscribe: this.subscribe.bind(this),
48
47
  schema: this.config.graphqlOptions.schema,
49
48
  onConnect(connectionParams) {
50
49
  // return connectionHookService.modifyHooks
@@ -59,25 +58,55 @@ let SubscriptionService = class SubscriptionService {
59
58
  // params,
60
59
  // webSocket
61
60
  // );
62
- }
61
+ },
63
62
  };
64
63
  if (this.pubConfig.authentication) {
65
64
  const auth = core_1.Container.get(this.pubConfig.authentication);
66
- Object.assign(currentC, auth);
65
+ Object.assign(config, auth);
67
66
  if (auth.onSubConnection) {
68
- currentC.onConnect = auth.onSubConnection.bind(auth);
67
+ config.onConnect = auth.onSubConnection.bind(auth);
69
68
  }
70
69
  if (auth.onSubOperation) {
71
- currentC.onOperation = auth.onSubOperation.bind(auth);
70
+ config.onOperation = auth.onSubOperation.bind(auth);
72
71
  }
73
72
  if (auth.onSubOperationComplete) {
74
- currentC.onOperationComplete = auth.onSubOperationComplete.bind(auth);
73
+ config.onOperationComplete = auth.onSubOperationComplete.bind(auth);
75
74
  }
76
75
  if (auth.onSubDisconnect) {
77
- currentC.onDisconnect = auth.onSubDisconnect.bind(auth);
76
+ config.onDisconnect = auth.onSubDisconnect.bind(auth);
78
77
  }
79
78
  }
80
- 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));
80
+ });
81
+ }
82
+ /**
83
+ * Cross compatability graphql v15 and v16 for subscriptions
84
+ */
85
+ execute(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) {
86
+ return (0, execution_1.execute)({
87
+ schema,
88
+ document,
89
+ rootValue,
90
+ contextValue,
91
+ variableValues,
92
+ operationName,
93
+ fieldResolver,
94
+ subscribeFieldResolver,
95
+ });
96
+ }
97
+ /**
98
+ * Cross compatability graphql v15 and v16 for subscriptions
99
+ */
100
+ subscribe(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, subscribeFieldResolver) {
101
+ return (0, subscription_1.subscribe)({
102
+ schema,
103
+ document,
104
+ rootValue,
105
+ contextValue,
106
+ variableValues,
107
+ operationName,
108
+ fieldResolver,
109
+ subscribeFieldResolver,
81
110
  });
82
111
  }
83
112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdi/graphql-pubsub",
3
- "version": "0.7.194",
3
+ "version": "0.7.196",
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.193",
33
+ "@rxdi/graphql-rabbitmq-subscriptions": "^0.7.195",
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.193",
41
- "@rxdi/graphql": "^0.7.193",
42
- "@rxdi/hapi": "^0.7.193",
40
+ "@rxdi/core": "^0.7.195",
41
+ "@rxdi/graphql": "^0.7.195",
42
+ "@rxdi/hapi": "^0.7.195",
43
43
  "@types/graphql": "^14.5.0",
44
44
  "@types/hapi": "^18.0.4",
45
45
  "@types/jest": "^24.0.22",