@graphql-tools/url-loader 7.17.2 → 7.17.3

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/cjs/index.js CHANGED
@@ -69,7 +69,11 @@ class UrlLoader {
69
69
  https: 'wss',
70
70
  http: 'ws',
71
71
  });
72
- return (0, executor_graphql_ws_1.buildGraphQLWSExecutor)(WS_URL, webSocketImpl, connectionParams);
72
+ return (0, executor_graphql_ws_1.buildGraphQLWSExecutor)({
73
+ url: WS_URL,
74
+ webSocketImpl,
75
+ connectionParams,
76
+ });
73
77
  }
74
78
  buildWSLegacyExecutor(subscriptionsEndpoint, WebSocketImpl, options) {
75
79
  const WS_URL = switchProtocols(subscriptionsEndpoint, {
@@ -152,8 +156,13 @@ class UrlLoader {
152
156
  });
153
157
  // eslint-disable-next-line no-inner-declarations
154
158
  function getExecutorByRequest(request) {
155
- const operationAst = (0, utils_1.getOperationASTFromRequest)(request);
156
- if (operationAst.operation === 'subscription' || (0, executor_http_1.isLiveQueryOperationDefinitionNode)(operationAst)) {
159
+ var _a;
160
+ request.operationType = request.operationType || ((_a = (0, utils_1.getOperationASTFromRequest)(request)) === null || _a === void 0 ? void 0 : _a.operation);
161
+ if (request.operationType === 'subscription' &&
162
+ (0, executor_http_1.isLiveQueryOperationDefinitionNode)((0, utils_1.getOperationASTFromRequest)(request))) {
163
+ request.operationType = graphql_1.OperationTypeNode.SUBSCRIPTION;
164
+ }
165
+ if (request.operationType === 'subscription') {
157
166
  return subscriptionExecutor$;
158
167
  }
159
168
  else {
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { buildASTSchema, buildSchema } from 'graphql';
1
+ import { buildASTSchema, buildSchema, OperationTypeNode } from 'graphql';
2
2
  import { parseGraphQLSDL, getOperationASTFromRequest, } from '@graphql-tools/utils';
3
3
  import { schemaFromExecutor, wrapSchema } from '@graphql-tools/wrap';
4
4
  import WebSocket from 'isomorphic-ws';
@@ -65,7 +65,11 @@ export class UrlLoader {
65
65
  https: 'wss',
66
66
  http: 'ws',
67
67
  });
68
- return buildGraphQLWSExecutor(WS_URL, webSocketImpl, connectionParams);
68
+ return buildGraphQLWSExecutor({
69
+ url: WS_URL,
70
+ webSocketImpl,
71
+ connectionParams,
72
+ });
69
73
  }
70
74
  buildWSLegacyExecutor(subscriptionsEndpoint, WebSocketImpl, options) {
71
75
  const WS_URL = switchProtocols(subscriptionsEndpoint, {
@@ -148,8 +152,13 @@ export class UrlLoader {
148
152
  });
149
153
  // eslint-disable-next-line no-inner-declarations
150
154
  function getExecutorByRequest(request) {
151
- const operationAst = getOperationASTFromRequest(request);
152
- if (operationAst.operation === 'subscription' || isLiveQueryOperationDefinitionNode(operationAst)) {
155
+ var _a;
156
+ request.operationType = request.operationType || ((_a = getOperationASTFromRequest(request)) === null || _a === void 0 ? void 0 : _a.operation);
157
+ if (request.operationType === 'subscription' &&
158
+ isLiveQueryOperationDefinitionNode(getOperationASTFromRequest(request))) {
159
+ request.operationType = OperationTypeNode.SUBSCRIPTION;
160
+ }
161
+ if (request.operationType === 'subscription') {
153
162
  return subscriptionExecutor$;
154
163
  }
155
164
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/url-loader",
3
- "version": "7.17.2",
3
+ "version": "7.17.3",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@graphql-tools/delegate": "9.0.22",
11
11
  "@graphql-tools/executor-http": "0.1.1",
12
- "@graphql-tools/executor-graphql-ws": "0.0.6",
12
+ "@graphql-tools/executor-graphql-ws": "0.0.7",
13
13
  "@graphql-tools/executor-legacy-ws": "0.0.6",
14
14
  "@graphql-tools/utils": "9.1.4",
15
15
  "@graphql-tools/wrap": "9.3.1",