Skip to content

Commit 8b41a52

Browse files
renovate[bot]ardatangithub-actions[bot]
authored
fix(deps): update dependency @graphql-tools/executor-http to v2 (#3998)
* enhance: remove extra error handling plugin * Changeset * fix(deps): update dependency @graphql-tools/executor-http to v2 * Deps * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 633eca0 commit 8b41a52

File tree

10 files changed

+113
-84
lines changed

10 files changed

+113
-84
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@graphql-yoga/apollo-link": major
3+
---
4+
dependencies updates:
5+
- Updated dependency [`@graphql-tools/executor-http@^2.0.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor-http/v/2.0.0) (from `^1.1.10`, in `dependencies`)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@graphql-yoga/urql-exchange": major
3+
---
4+
dependencies updates:
5+
- Updated dependency [`@graphql-tools/executor-http@^2.0.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/executor-http/v/2.0.0) (from `^1.1.9`, in `dependencies`)

.changeset/brown-waves-jump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-yoga': patch
3+
---
4+
5+
Remove extra error handling plugin

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,3 +323,17 @@ jobs:
323323
ENSURE_DELETION: 1
324324
TEST_PLAN_NAME: ${{ matrix.plan }}
325325
COMMIT_ID: ${{ steps.vars.outputs.sha_short }}
326+
327+
dependencies:
328+
if:
329+
github.event_name == 'pull_request' && github.event.pull_request.title != 'Upcoming Release
330+
Changes'
331+
name: Dependencies
332+
concurrency:
333+
group: ${{ github.workflow }}-${{ github.ref }}-dependencies
334+
cancel-in-progress: true
335+
uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yml@v1
336+
with:
337+
node-version-file: .node-version
338+
secrets:
339+
githubToken: ${{ secrets.BOT_GITHUB_TOKEN }}

packages/client/apollo-link/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
},
4949
"dependencies": {
5050
"@graphql-tools/executor-apollo-link": "^1.0.5",
51-
"@graphql-tools/executor-http": "^1.1.10",
51+
"@graphql-tools/executor-http": "^2.0.0",
5252
"tslib": "^2.8.1"
5353
},
5454
"devDependencies": {

packages/client/urql-exchange/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"wonka": "^6.0.0"
4949
},
5050
"dependencies": {
51-
"@graphql-tools/executor-http": "^1.1.9",
51+
"@graphql-tools/executor-http": "^2.0.0",
5252
"@graphql-tools/executor-urql-exchange": "^1.0.4",
5353
"tslib": "^2.8.1"
5454
},

packages/graphql-yoga/src/process-request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getOperationAST } from 'graphql';
22
import { GetEnvelopedFn } from '@envelop/core';
33
import { ExecutionArgs } from '@graphql-tools/executor';
4-
import { handleMaybePromise, iterateAsync } from '@whatwg-node/promise-helpers';
4+
import { handleMaybePromise, iterateAsync, MaybePromise } from '@whatwg-node/promise-helpers';
55
import { ServerAdapterInitialContext } from '@whatwg-node/server';
66
import { OnResultProcess, ResultProcessor, ResultProcessorInput } from './plugins/types.js';
77
import { FetchAPI, GraphQLParams } from './types.js';
@@ -21,7 +21,7 @@ export function processResult<TServerContext>({
2121
*/
2222
onResultProcessHooks: OnResultProcess<TServerContext>[];
2323
serverContext: TServerContext & ServerAdapterInitialContext;
24-
}) {
24+
}): MaybePromise<Response> {
2525
let resultProcessor: ResultProcessor | undefined;
2626

2727
const acceptableMediaTypes: string[] = [];

packages/graphql-yoga/src/server.ts

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ import {
1111
} from '@envelop/core';
1212
import { chain, getInstrumented } from '@envelop/instrumentation';
1313
import { normalizedExecutor } from '@graphql-tools/executor';
14-
import { mapAsyncIterator } from '@graphql-tools/utils';
1514
import { createLogger, LogLevel, YogaLogger } from '@graphql-yoga/logger';
1615
import * as defaultFetchAPI from '@whatwg-node/fetch';
1716
import {
17+
fakePromise,
1818
handleMaybePromise,
1919
iterateAsync,
2020
iterateAsyncVoid,
21+
mapAsyncIterator,
2122
MaybePromise,
23+
unfakePromise,
2224
} from '@whatwg-node/promise-helpers';
2325
import {
2426
createServerAdapter,
@@ -28,7 +30,6 @@ import {
2830
ServerAdapterOptions,
2931
ServerAdapterRequestHandler,
3032
useCORS,
31-
useErrorHandling,
3233
} from '@whatwg-node/server';
3334
import { handleError, isAbortError } from './error.js';
3435
import { isGETRequest, parseGETRequest } from './plugins/request-parser/get.js';
@@ -361,23 +362,6 @@ export class YogaServer<
361362
}),
362363
// Middlewares after the GraphQL execution
363364
useResultProcessors(),
364-
useErrorHandling(
365-
(error, request, serverContext: TServerContext & ServerAdapterInitialContext) => {
366-
const errors = handleError(error, this.maskedErrorsOpts, this.logger);
367-
368-
const result = {
369-
errors,
370-
};
371-
372-
return processResult({
373-
request,
374-
result,
375-
fetchAPI: this.fetchAPI,
376-
onResultProcessHooks: this.onResultProcessHooks,
377-
serverContext,
378-
});
379-
},
380-
),
381365

382366
...(options?.plugins ?? []),
383367
// To make sure those are called at the end
@@ -682,61 +666,77 @@ export class YogaServer<
682666
? instrumented!.asyncFn(this.instrumentation?.requestParse, this.parseRequest)
683667
: this.parseRequest;
684668

685-
return handleMaybePromise(
686-
() => parseRequest(request, serverContext),
687-
({ response, requestParserResult }) => {
688-
if (response) {
689-
return response;
690-
}
691-
const getResultForParams = this.instrumentation?.operation
692-
? (payload: { request: Request; params: GraphQLParams }, context: any) => {
693-
const instrumented = getInstrumented({ context, request: payload.request });
694-
const tracedHandler = instrumented.asyncFn(
695-
this.instrumentation?.operation,
696-
this.getResultForParams,
697-
);
698-
return tracedHandler(payload, context);
699-
}
700-
: this.getResultForParams;
701-
return handleMaybePromise(
702-
() =>
703-
(Array.isArray(requestParserResult)
704-
? Promise.all(
705-
requestParserResult.map(params =>
706-
getResultForParams(
707-
{
708-
params,
709-
request,
710-
},
711-
Object.create(serverContext),
669+
return unfakePromise(
670+
fakePromise()
671+
.then(() => parseRequest(request, serverContext))
672+
.then(({ response, requestParserResult }) => {
673+
if (response) {
674+
return response;
675+
}
676+
const getResultForParams = this.instrumentation?.operation
677+
? (payload: { request: Request; params: GraphQLParams }, context: any) => {
678+
const instrumented = getInstrumented({ context, request: payload.request });
679+
const tracedHandler = instrumented.asyncFn(
680+
this.instrumentation?.operation,
681+
this.getResultForParams,
682+
);
683+
return tracedHandler(payload, context);
684+
}
685+
: this.getResultForParams;
686+
return handleMaybePromise(
687+
() =>
688+
(Array.isArray(requestParserResult)
689+
? Promise.all(
690+
requestParserResult.map(params =>
691+
getResultForParams(
692+
{
693+
params,
694+
request,
695+
},
696+
Object.create(serverContext),
697+
),
712698
),
713-
),
714-
)
715-
: getResultForParams(
716-
{
717-
params: requestParserResult,
718-
request,
719-
},
720-
serverContext,
721-
)) as ResultProcessorInput,
722-
result => {
723-
const tracedProcessResult = this.instrumentation?.resultProcess
724-
? instrumented!.asyncFn(
725-
this.instrumentation.resultProcess,
726-
processResult<TServerContext>,
727-
)
728-
: processResult<TServerContext>;
729-
730-
return tracedProcessResult({
731-
request,
732-
result,
733-
fetchAPI: this.fetchAPI,
734-
onResultProcessHooks: this.onResultProcessHooks,
735-
serverContext,
736-
});
737-
},
738-
);
739-
},
699+
)
700+
: getResultForParams(
701+
{
702+
params: requestParserResult,
703+
request,
704+
},
705+
serverContext,
706+
)) as ResultProcessorInput,
707+
result => {
708+
const tracedProcessResult = this.instrumentation?.resultProcess
709+
? instrumented!.asyncFn(
710+
this.instrumentation.resultProcess,
711+
processResult<TServerContext>,
712+
)
713+
: processResult<TServerContext>;
714+
715+
return tracedProcessResult({
716+
request,
717+
result,
718+
fetchAPI: this.fetchAPI,
719+
onResultProcessHooks: this.onResultProcessHooks,
720+
serverContext,
721+
});
722+
},
723+
);
724+
})
725+
.catch(error => {
726+
const errors = handleError(error, this.maskedErrorsOpts, this.logger);
727+
728+
const result = {
729+
errors,
730+
};
731+
732+
return processResult({
733+
request,
734+
result,
735+
fetchAPI: this.fetchAPI,
736+
onResultProcessHooks: this.onResultProcessHooks,
737+
serverContext,
738+
});
739+
}),
740740
);
741741
};
742742
}

packages/plugins/defer-stream/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@graphql-tools/utils": "^10.6.1"
4545
},
4646
"devDependencies": {
47-
"@graphql-tools/executor-http": "^1.1.9",
47+
"@graphql-tools/executor-http": "^2.0.0",
4848
"@whatwg-node/fetch": "^0.10.6",
4949
"@whatwg-node/server": "^0.10.5",
5050
"fetch-multipart-graphql": "3.2.2",

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)