@graphql-mesh/transport-http-callback 0.5.21 → 0.5.22-alpha-0700d88cf1e9c11bc4b7dab376d3eb21c02cb1d6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @graphql-mesh/transport-http-callback
2
2
 
3
+ ## 0.5.22-alpha-0700d88cf1e9c11bc4b7dab376d3eb21c02cb1d6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#726](https://github.com/graphql-hive/gateway/pull/726) [`0700d88`](https://github.com/graphql-hive/gateway/commit/0700d88cf1e9c11bc4b7dab376d3eb21c02cb1d6) Thanks [@ardatan](https://github.com/ardatan)! - dependencies updates:
8
+
9
+ - Added dependency [`@whatwg-node/promise-helpers@^1.0.0` ↗︎](https://www.npmjs.com/package/@whatwg-node/promise-helpers/v/1.0.0) (to `dependencies`)
10
+
3
11
  ## 0.5.21
4
12
 
5
13
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -7,6 +7,7 @@ var executorCommon = require('@graphql-tools/executor-common');
7
7
  var utils$1 = require('@graphql-tools/utils');
8
8
  var repeater = require('@repeaterjs/repeater');
9
9
  var fetch = require('@whatwg-node/fetch');
10
+ var promiseHelpers = require('@whatwg-node/promise-helpers');
10
11
 
11
12
  function createTimeoutError() {
12
13
  return utils$1.createGraphQLError("Subscription timed out", {
@@ -106,8 +107,8 @@ var index = {
106
107
  if (signal) {
107
108
  signal = AbortSignal.any([reqAbortCtrl.signal, signal]);
108
109
  }
109
- const subFetchCall$ = utils$1.mapMaybePromise(
110
- fetch$1(
110
+ const subFetchCall$ = promiseHelpers.handleMaybePromise(
111
+ () => fetch$1(
111
112
  transportEntry.location,
112
113
  {
113
114
  method: "POST",
@@ -127,42 +128,45 @@ var index = {
127
128
  executionRequest.context,
128
129
  executionRequest.info
129
130
  ),
130
- (res) => utils$1.mapMaybePromise(res.text(), (resText) => {
131
- let resJson;
132
- try {
133
- resJson = JSON.parse(resText);
134
- } catch (e) {
135
- if (!res.ok) {
136
- stopSubscription(
137
- new Error(
138
- `Subscription request failed with an HTTP Error: ${res.status} ${resText}`
139
- )
140
- );
141
- } else {
142
- stopSubscription(e);
131
+ (res) => promiseHelpers.handleMaybePromise(
132
+ () => res.text(),
133
+ (resText) => {
134
+ let resJson;
135
+ try {
136
+ resJson = JSON.parse(resText);
137
+ } catch (e) {
138
+ if (!res.ok) {
139
+ stopSubscription(
140
+ new Error(
141
+ `Subscription request failed with an HTTP Error: ${res.status} ${resText}`
142
+ )
143
+ );
144
+ } else {
145
+ stopSubscription(e);
146
+ }
147
+ return;
143
148
  }
144
- return;
145
- }
146
- logger?.debug(`Subscription request received`, resJson);
147
- if (resJson.errors) {
148
- if (resJson.errors.length === 1 && resJson.errors[0]) {
149
- const error = resJson.errors[0];
150
- stopSubscription(utils$1.createGraphQLError(error.message, error));
151
- } else {
152
- stopSubscription(
153
- new AggregateError(
154
- resJson.errors.map(
155
- (err) => utils$1.createGraphQLError(err.message, err)
156
- ),
157
- resJson.errors.map((err) => err.message).join("\n")
158
- )
159
- );
149
+ logger?.debug(`Subscription request received`, resJson);
150
+ if (resJson.errors) {
151
+ if (resJson.errors.length === 1 && resJson.errors[0]) {
152
+ const error = resJson.errors[0];
153
+ stopSubscription(utils$1.createGraphQLError(error.message, error));
154
+ } else {
155
+ stopSubscription(
156
+ new AggregateError(
157
+ resJson.errors.map(
158
+ (err) => utils$1.createGraphQLError(err.message, err)
159
+ ),
160
+ resJson.errors.map((err) => err.message).join("\n")
161
+ )
162
+ );
163
+ }
164
+ } else if (resJson.data != null) {
165
+ pushFn(resJson.data);
166
+ stopSubscription();
160
167
  }
161
- } else if (resJson.data != null) {
162
- pushFn(resJson.data);
163
- stopSubscription();
164
168
  }
165
- }),
169
+ ),
166
170
  (e) => {
167
171
  logger?.debug(`Subscription request failed`, e);
168
172
  stopSubscription(e);
package/dist/index.js CHANGED
@@ -2,9 +2,10 @@ import { process } from '@graphql-mesh/cross-helpers';
2
2
  import { getInterpolatedHeadersFactory } from '@graphql-mesh/string-interpolation';
3
3
  import { makeDisposable } from '@graphql-mesh/utils';
4
4
  import { serializeExecutionRequest } from '@graphql-tools/executor-common';
5
- import { mapMaybePromise, createGraphQLError, registerAbortSignalListener } from '@graphql-tools/utils';
5
+ import { createGraphQLError, registerAbortSignalListener } from '@graphql-tools/utils';
6
6
  import { Repeater } from '@repeaterjs/repeater';
7
7
  import { crypto } from '@whatwg-node/fetch';
8
+ import { handleMaybePromise } from '@whatwg-node/promise-helpers';
8
9
 
9
10
  function createTimeoutError() {
10
11
  return createGraphQLError("Subscription timed out", {
@@ -104,8 +105,8 @@ var index = {
104
105
  if (signal) {
105
106
  signal = AbortSignal.any([reqAbortCtrl.signal, signal]);
106
107
  }
107
- const subFetchCall$ = mapMaybePromise(
108
- fetch(
108
+ const subFetchCall$ = handleMaybePromise(
109
+ () => fetch(
109
110
  transportEntry.location,
110
111
  {
111
112
  method: "POST",
@@ -125,42 +126,45 @@ var index = {
125
126
  executionRequest.context,
126
127
  executionRequest.info
127
128
  ),
128
- (res) => mapMaybePromise(res.text(), (resText) => {
129
- let resJson;
130
- try {
131
- resJson = JSON.parse(resText);
132
- } catch (e) {
133
- if (!res.ok) {
134
- stopSubscription(
135
- new Error(
136
- `Subscription request failed with an HTTP Error: ${res.status} ${resText}`
137
- )
138
- );
139
- } else {
140
- stopSubscription(e);
129
+ (res) => handleMaybePromise(
130
+ () => res.text(),
131
+ (resText) => {
132
+ let resJson;
133
+ try {
134
+ resJson = JSON.parse(resText);
135
+ } catch (e) {
136
+ if (!res.ok) {
137
+ stopSubscription(
138
+ new Error(
139
+ `Subscription request failed with an HTTP Error: ${res.status} ${resText}`
140
+ )
141
+ );
142
+ } else {
143
+ stopSubscription(e);
144
+ }
145
+ return;
141
146
  }
142
- return;
143
- }
144
- logger?.debug(`Subscription request received`, resJson);
145
- if (resJson.errors) {
146
- if (resJson.errors.length === 1 && resJson.errors[0]) {
147
- const error = resJson.errors[0];
148
- stopSubscription(createGraphQLError(error.message, error));
149
- } else {
150
- stopSubscription(
151
- new AggregateError(
152
- resJson.errors.map(
153
- (err) => createGraphQLError(err.message, err)
154
- ),
155
- resJson.errors.map((err) => err.message).join("\n")
156
- )
157
- );
147
+ logger?.debug(`Subscription request received`, resJson);
148
+ if (resJson.errors) {
149
+ if (resJson.errors.length === 1 && resJson.errors[0]) {
150
+ const error = resJson.errors[0];
151
+ stopSubscription(createGraphQLError(error.message, error));
152
+ } else {
153
+ stopSubscription(
154
+ new AggregateError(
155
+ resJson.errors.map(
156
+ (err) => createGraphQLError(err.message, err)
157
+ ),
158
+ resJson.errors.map((err) => err.message).join("\n")
159
+ )
160
+ );
161
+ }
162
+ } else if (resJson.data != null) {
163
+ pushFn(resJson.data);
164
+ stopSubscription();
158
165
  }
159
- } else if (resJson.data != null) {
160
- pushFn(resJson.data);
161
- stopSubscription();
162
166
  }
163
- }),
167
+ ),
164
168
  (e) => {
165
169
  logger?.debug(`Subscription request failed`, e);
166
170
  stopSubscription(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/transport-http-callback",
3
- "version": "0.5.21",
3
+ "version": "0.5.22-alpha-0700d88cf1e9c11bc4b7dab376d3eb21c02cb1d6",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,6 +51,7 @@
51
51
  "@graphql-tools/utils": "^10.8.1",
52
52
  "@repeaterjs/repeater": "^3.0.6",
53
53
  "@whatwg-node/fetch": "^0.10.4",
54
+ "@whatwg-node/promise-helpers": "^1.0.0",
54
55
  "tslib": "^2.8.1"
55
56
  },
56
57
  "devDependencies": {