Skip to content

Commit

Permalink
use graphql-executor
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Jan 6, 2022
1 parent 5ee7c7e commit b557e34
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/delegate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@graphql-tools/schema": "^8.3.1",
"@graphql-tools/utils": "^8.5.4",
"dataloader": "2.0.0",
"graphql-executor": "0.0.14",
"tslib": "~2.3.0",
"value-or-promise": "1.0.11"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/delegate/src/delegateToSchema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
subscribe,
execute,
validate,
GraphQLSchema,
FieldDefinitionNode,
Expand All @@ -10,6 +9,8 @@ import {
ExecutionArgs,
} from 'graphql';

import { Executor as GraphQLExecutor } from 'graphql-executor';

import { ValueOrPromise } from 'value-or-promise';

import { getBatchingExecutor } from '@graphql-tools/batch-execute';
Expand Down Expand Up @@ -207,6 +208,7 @@ function getExecutor<TContext>(delegationContext: DelegationContext<TContext>):
}

export const createDefaultExecutor = memoize1(function createDefaultExecutor(schema: GraphQLSchema): Executor {
const executor = new GraphQLExecutor({ schema });
return function defaultExecutor(request: ExecutionRequest) {
const operationAst = getOperationASTFromRequest(request);
const executionArgs: ExecutionArgs = {
Expand All @@ -220,6 +222,6 @@ export const createDefaultExecutor = memoize1(function createDefaultExecutor(sch
if (operationAst.operation === 'subscription') {
return subscribe(executionArgs);
}
return execute(executionArgs);
return executor.execute(executionArgs);
} as Executor;
});
41 changes: 35 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3867,14 +3867,14 @@ apollo-graphql@^0.9.5:
lodash.sortby "^4.7.0"
sha.js "^2.4.11"

"apollo-reporting-protobuf@^0.8.0 || ^3.0.0 || ^3.3.0-alpha.0", apollo-reporting-protobuf@^3.3.0:
"apollo-reporting-protobuf@^0.8.0 || ^3.0.0 || ^3.3.0-alpha.0", apollo-reporting-protobuf@^3.0.0, apollo-reporting-protobuf@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/apollo-reporting-protobuf/-/apollo-reporting-protobuf-3.3.0.tgz#2fc0f7508e488851eda8a6e7c8cc3b5a156ab44b"
integrity sha512-51Jwrg0NvHJfKz7TIGU8+Os3rUAqWtXeKRsRtKYtTeMSBPNhzz8UoGjAB3XyVmUXRE3IRmLtDPDRFL7qbxMI/w==
dependencies:
"@apollo/protobufjs" "1.2.2"

"apollo-server-caching@^0.7.0 || ^3.0.0", apollo-server-caching@^3.3.0:
"apollo-server-caching@^0.7.0 || ^3.0.0", apollo-server-caching@^3.0.1, apollo-server-caching@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/apollo-server-caching/-/apollo-server-caching-3.3.0.tgz#f501cbeb820a4201d98c2b768c085f22848d9dc5"
integrity sha512-Wgcb0ArjZ5DjQ7ID+tvxUcZ7Yxdbk5l1MxZL8D8gkyjooOkhPNzjRVQ7ubPoXqO54PrOMOTm1ejVhsF+AfIirQ==
Expand Down Expand Up @@ -3908,14 +3908,19 @@ apollo-graphql@^0.9.5:
sha.js "^2.4.11"
uuid "^8.0.0"

"apollo-server-env@^3.0.0 || ^4.0.0", apollo-server-env@^4.2.0:
"apollo-server-env@^3.0.0 || ^4.0.0", apollo-server-env@^4.0.3, apollo-server-env@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/apollo-server-env/-/apollo-server-env-4.2.0.tgz#d7cb08a81cee3025cd47b08be80b359d61d85913"
integrity sha512-4xJ+PCoWsFLj4rU6iXrIhqD7nI42goi4Iqrhsof9680ljSzkzd+PCwZsja3mHOFXKUQQUvJ7StVSgwaiRu45+A==
dependencies:
node-fetch "^2.6.1"

"apollo-server-errors@^2.5.0 || ^3.0.0", apollo-server-errors@^3.3.0:
"apollo-server-errors@^2.5.0 || ^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-3.0.1.tgz#0dfcc1fe8b10eab311fc7e4f6da93189ea6bcdae"
integrity sha512-PSp64IFeN1YK5EYZ3V/8iDRESMMyE00h1vE5aCr83wHL3T0mN7VRiMKoOIZ+2rUtnn7CpK73o6QLmouhxPtXsQ==

apollo-server-errors@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-3.3.0.tgz#ac8ceb1400064312f983d8d70195693fbcf2be3c"
integrity sha512-9/MNlPZBbEjcCdJcUSbKbVEBT9xZS8GSpX7T/TyzcxHSbsXJszSDSipQNGC+PRKTKAUnv61IONScVyLKEZ5XEQ==
Expand All @@ -3927,7 +3932,7 @@ apollo-server-plugin-base@^3.5.0:
dependencies:
apollo-server-types "^3.5.0"

"apollo-server-types@^0.9.0 || ^3.0.0 || ^3.5.0-alpha.0", apollo-server-types@^3.0.2, apollo-server-types@^3.5.0:
"apollo-server-types@^0.9.0 || ^3.0.0 || ^3.5.0-alpha.0", apollo-server-types@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-3.5.0.tgz#82f912d7765152fe1fde86cea8a076e9a0831a9d"
integrity sha512-4JaZNu1kjrzIbppgc78hhIe2DFe+XONf8grprcjTOe0v8dIsuV0tFUnl+awTvTpHU1sdjRCKwnj382BebiL+qw==
Expand All @@ -3936,6 +3941,15 @@ apollo-server-plugin-base@^3.5.0:
apollo-server-caching "^3.3.0"
apollo-server-env "^4.2.0"

apollo-server-types@^3.0.2:
version "3.1.1"
resolved "https://registry.yarnpkg.com/apollo-server-types/-/apollo-server-types-3.1.1.tgz#a45bf4d7c978340dc7c7dff317628629bdc53443"
integrity sha512-dTNlRxqdo+wnrcOFpFfzehdmcYHl6MQKuLnCCRzAHuVR5yOiuhQ5CIGhIjvMx2bP9ZoyON1SvXOIDTyTaU9gaQ==
dependencies:
apollo-reporting-protobuf "^3.0.0"
apollo-server-caching "^3.0.1"
apollo-server-env "^4.0.3"

apollo-upload-client@17.0.0:
version "17.0.0"
resolved "https://registry.yarnpkg.com/apollo-upload-client/-/apollo-upload-client-17.0.0.tgz#d9baaff8d14e54510de9f2855b487e75ca63b392"
Expand Down Expand Up @@ -6842,6 +6856,11 @@ grapheme-splitter@^1.0.4:
resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e"
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==

graphql-executor@0.0.14:
version "0.0.14"
resolved "https://registry.yarnpkg.com/graphql-executor/-/graphql-executor-0.0.14.tgz#4eaff42eca38794153becdd914029bf0fe00fe9f"
integrity sha512-ucgmNIewyZgWibqjCKSfhCsiZEcsYmsBleUklSamdiIC7rE06ABb5OvbIAE5I5zzZcjMF7v79t2cTcrPcN0pvQ==

graphql-helix@1.11.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/graphql-helix/-/graphql-helix-1.11.0.tgz#bd8c3e9e208f853215fff7b6b45e4e46b909d0b6"
Expand Down Expand Up @@ -9881,7 +9900,17 @@ prettier@^1.19.1:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==

pretty-format@^27.0.0, pretty-format@^27.3.1, pretty-format@^27.4.6:
pretty-format@^27.0.0, pretty-format@^27.3.1:
version "27.4.2"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.4.2.tgz#e4ce92ad66c3888423d332b40477c87d1dac1fb8"
integrity sha512-p0wNtJ9oLuvgOQDEIZ9zQjZffK7KtyR6Si0jnXULIDwrlNF8Cuir3AZP0hHv0jmKuNN/edOnbMjnzd4uTcmWiw==
dependencies:
"@jest/types" "^27.4.2"
ansi-regex "^5.0.1"
ansi-styles "^5.0.0"
react-is "^17.0.1"

pretty-format@^27.4.6:
version "27.4.6"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.4.6.tgz#1b784d2f53c68db31797b2348fa39b49e31846b7"
integrity sha512-NblstegA1y/RJW2VyML+3LlpFjzx62cUrtBIKIWDXEDkjNeleA7Od7nrzcs/VLQvAeV4CgSYhrN39DRN88Qi/g==
Expand Down

0 comments on commit b557e34

Please sign in to comment.