@apollo/gateway 0.42.1 → 0.43.1
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 +16 -0
- package/dist/__generated__/graphqlTypes.d.ts +8 -2
- package/dist/__generated__/graphqlTypes.d.ts.map +1 -1
- package/dist/executeQueryPlan.d.ts +3 -2
- package/dist/executeQueryPlan.d.ts.map +1 -1
- package/dist/executeQueryPlan.js +26 -1
- package/dist/executeQueryPlan.js.map +1 -1
- package/package.json +5 -5
- package/src/__generated__/graphqlTypes.ts +8 -3
- package/src/__tests__/buildQueryPlan.test.ts +277 -26
- package/src/__tests__/executeQueryPlan.test.ts +264 -7
- package/src/__tests__/execution-utils.ts +5 -1
- package/src/executeQueryPlan.ts +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,22 @@
|
|
|
6
6
|
|
|
7
7
|
- _Nothing yet. Stay tuned._
|
|
8
8
|
|
|
9
|
+
## v0.43.0
|
|
10
|
+
|
|
11
|
+
- Skip fetches when possible (based on @skip and @include usages). The query planner now aggregates top-level skip and include usages, which allows the gateway to skip `FetchNode`s altogether when possible during execution. [PR #1113](https://github.com/apollographql/federation/pull/1113)
|
|
12
|
+
|
|
13
|
+
## v0.42.4
|
|
14
|
+
|
|
15
|
+
- Updates to transitive dependencies. No other substantial changes.
|
|
16
|
+
|
|
17
|
+
## v0.42.3
|
|
18
|
+
|
|
19
|
+
- Updates to transitive dependencies. No other substantial changes.
|
|
20
|
+
|
|
21
|
+
## v0.42.2
|
|
22
|
+
|
|
23
|
+
- Updates to transitive dependencies. No other substantial changes.
|
|
24
|
+
|
|
9
25
|
## v0.42.1
|
|
10
26
|
|
|
11
27
|
- Emit a deprecation warning for deprecated functions. We would advise to adjust the code to use the new functionality, as the deprecated functions will be removed in a future version. If needed, deprecation warnings can be muted with either the --no-deprecation or --no-warnings command-line flags for node.js. Please keep in mind in doing so will also prevent any future deprecation warnings from node.js itself as well as from any package.[PR #1033](https://github.com/apollographql/federation/pull/1033).
|
|
@@ -77,7 +77,7 @@ export declare type Query = {
|
|
|
77
77
|
export declare type QueryRouterConfigArgs = {
|
|
78
78
|
apiKey: Scalars['String'];
|
|
79
79
|
ref: Scalars['String'];
|
|
80
|
-
|
|
80
|
+
unlessIdIn?: Maybe<Array<Scalars['ID']>>;
|
|
81
81
|
};
|
|
82
82
|
export declare type Request = {
|
|
83
83
|
body?: Maybe<Scalars['String']>;
|
|
@@ -89,13 +89,17 @@ export declare type Response = {
|
|
|
89
89
|
headers?: Maybe<Array<HttpHeader>>;
|
|
90
90
|
httpStatusCode: Scalars['Int'];
|
|
91
91
|
};
|
|
92
|
-
export declare type RouterConfigResponse = FetchError | RouterConfigResult;
|
|
92
|
+
export declare type RouterConfigResponse = FetchError | RouterConfigResult | Unchanged;
|
|
93
93
|
export declare type RouterConfigResult = {
|
|
94
94
|
__typename?: 'RouterConfigResult';
|
|
95
95
|
id: Scalars['ID'];
|
|
96
96
|
messages: Array<Message>;
|
|
97
97
|
supergraphSDL: Scalars['String'];
|
|
98
98
|
};
|
|
99
|
+
export declare type Unchanged = {
|
|
100
|
+
__typename?: 'Unchanged';
|
|
101
|
+
id: Scalars['ID'];
|
|
102
|
+
};
|
|
99
103
|
export declare type SupergraphSdlQueryVariables = Exact<{
|
|
100
104
|
apiKey: Scalars['String'];
|
|
101
105
|
ref: Scalars['String'];
|
|
@@ -110,6 +114,8 @@ export declare type SupergraphSdlQuery = {
|
|
|
110
114
|
__typename: 'RouterConfigResult';
|
|
111
115
|
id: string;
|
|
112
116
|
supergraphSdl: string;
|
|
117
|
+
} | {
|
|
118
|
+
__typename: 'Unchanged';
|
|
113
119
|
};
|
|
114
120
|
};
|
|
115
121
|
export declare type OobReportMutationVariables = Exact<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphqlTypes.d.ts","sourceRoot":"","sources":["../../src/__generated__/graphqlTypes.ts"],"names":[],"mappings":"AAAA,oBAAY,K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,CAAC,CAAC;IAEzB,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAClC,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB,CAAC;AAEF,oBAAY,2BAA2B,GAAG,KAAK,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1B,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB,CAAC,CAAC;AAGH,oBAAY,kBAAkB,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE;QAAE,UAAU,EAAE,YAAY,CAAC;QAAC,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,oBAAoB,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,WAAW,CAAA;KAAE,CAAA;CAAE,CAAC;AAErP,oBAAY,0BAA0B,GAAG,KAAK,CAAC;IAC7C,KAAK,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;CACpC,CAAC,CAAC;AAGH,oBAAY,iBAAiB,GAAG;IAAE,UAAU,CAAC,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { GraphQLExecutionResult, GraphQLRequestContext } from 'apollo-server-types';
|
|
1
|
+
import { GraphQLExecutionResult, GraphQLRequestContext, VariableValues } from 'apollo-server-types';
|
|
2
2
|
import { GraphQLFieldResolver } from 'graphql';
|
|
3
3
|
import { GraphQLDataSource } from './datasources/types';
|
|
4
4
|
import { OperationContext } from './operationContext';
|
|
5
|
-
import { QueryPlan } from '@apollo/query-planner';
|
|
5
|
+
import { FetchNode, QueryPlan } from '@apollo/query-planner';
|
|
6
6
|
export declare type ServiceMap = {
|
|
7
7
|
[serviceName: string]: GraphQLDataSource;
|
|
8
8
|
};
|
|
9
9
|
export declare function executeQueryPlan<TContext>(queryPlan: QueryPlan, serviceMap: ServiceMap, requestContext: GraphQLRequestContext<TContext>, operationContext: OperationContext): Promise<GraphQLExecutionResult>;
|
|
10
|
+
export declare function shouldSkipFetchNode(node: FetchNode, variables?: VariableValues): boolean;
|
|
10
11
|
export declare const defaultFieldResolverWithAliasSupport: GraphQLFieldResolver<any, any>;
|
|
11
12
|
//# sourceMappingURL=executeQueryPlan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeQueryPlan.d.ts","sourceRoot":"","sources":["../src/executeQueryPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"executeQueryPlan.d.ts","sourceRoot":"","sources":["../src/executeQueryPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAKL,oBAAoB,EAIrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,iBAAiB,EAAgC,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,SAAS,EAET,SAAS,EAMV,MAAM,uBAAuB,CAAC;AAM/B,oBAAY,UAAU,GAAG;IACvB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC1C,CAAC;AAYF,wBAAsB,gBAAgB,CAAC,QAAQ,EAC7C,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,qBAAqB,CAAC,QAAQ,CAAC,EAC/C,gBAAgB,EAAE,gBAAgB,GACjC,OAAO,CAAC,sBAAsB,CAAC,CA+GjC;AA8FD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,SAAS,EACf,SAAS,GAAE,cAAmB,WAqB/B;AAyVD,eAAO,MAAM,oCAAoC,EAAE,oBAAoB,CACrE,GAAG,EACH,GAAG,CAYJ,CAAC"}
|
package/dist/executeQueryPlan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultFieldResolverWithAliasSupport = exports.executeQueryPlan = void 0;
|
|
3
|
+
exports.defaultFieldResolverWithAliasSupport = exports.shouldSkipFetchNode = exports.executeQueryPlan = void 0;
|
|
4
4
|
const apollo_server_env_1 = require("apollo-server-env");
|
|
5
5
|
const graphql_1 = require("graphql");
|
|
6
6
|
const apollo_reporting_protobuf_1 = require("apollo-reporting-protobuf");
|
|
@@ -122,6 +122,9 @@ async function executeNode(context, node, results, path, captureTraces) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
case 'Fetch': {
|
|
125
|
+
if (shouldSkipFetchNode(node, context.requestContext.request.variables)) {
|
|
126
|
+
return new apollo_reporting_protobuf_1.Trace.QueryPlanNode();
|
|
127
|
+
}
|
|
125
128
|
const traceNode = new apollo_reporting_protobuf_1.Trace.QueryPlanNode.FetchNode({
|
|
126
129
|
serviceName: node.serviceName,
|
|
127
130
|
});
|
|
@@ -135,6 +138,28 @@ async function executeNode(context, node, results, path, captureTraces) {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
}
|
|
141
|
+
function shouldSkipFetchNode(node, variables = {}) {
|
|
142
|
+
if (!node.inclusionConditions)
|
|
143
|
+
return false;
|
|
144
|
+
return node.inclusionConditions.every((conditionals) => {
|
|
145
|
+
function resolveConditionalValue(conditional) {
|
|
146
|
+
const conditionalType = typeof conditionals[conditional];
|
|
147
|
+
if (conditionalType === 'boolean') {
|
|
148
|
+
return conditionals[conditional];
|
|
149
|
+
}
|
|
150
|
+
else if (conditionalType === 'string') {
|
|
151
|
+
return variables[conditionals[conditional]];
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const includeValue = resolveConditionalValue('include');
|
|
158
|
+
const skipValue = resolveConditionalValue('skip');
|
|
159
|
+
return includeValue === false || skipValue === true;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
exports.shouldSkipFetchNode = shouldSkipFetchNode;
|
|
138
163
|
async function executeFetch(context, fetch, results, _path, traceNode) {
|
|
139
164
|
const logger = context.requestContext.logger || console;
|
|
140
165
|
const service = context.serviceMap[fetch.serviceName];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeQueryPlan.js","sourceRoot":"","sources":["../src/executeQueryPlan.ts"],"names":[],"mappings":";;;AAIA,yDAA4C;AAC5C,qCASiB;AACjB,yEAA0D;AAC1D,mDAAoE;AACpE,+CAAsF;AAEtF,yDAS+B;AAC/B,qDAAkD;AAClD,6CAAyD;AACzD,4CAAoD;AACpD,6DAA2E;AAgBpE,KAAK,UAAU,gBAAgB,CACpC,SAAoB,EACpB,UAAsB,EACtB,cAA+C,EAC/C,gBAAkC;IAGlC,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,IAAI,OAAO,CAAC;IAEhD,OAAO,sBAAM,CAAC,eAAe,CAAC,sCAAsB,CAAC,OAAO,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;QACzE,IAAI;YACF,MAAM,MAAM,GAAmB,EAAE,CAAC;YAElC,MAAM,OAAO,GAA+B;gBAC1C,SAAS;gBACT,gBAAgB;gBAChB,UAAU;gBACV,cAAc;gBACd,MAAM;aACP,CAAC;YAEF,IAAI,IAAI,GAAiC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAE7D,MAAM,aAAa,GAAG,CAAC,CAAC,CACpB,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,aAAa,CACjE,CAAC;YAE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AE;QAG9D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAClC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;SACzD;QACD,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC,CAAC;AAdW,QAAA,oCAAoC,wCAc/C;AAgBF,SAAS,qBAAqB,CAAC,MAAwB;IACrD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAGD,SAAS,oBAAoB,CAAC,IAAU;IACtC,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC;IAC1B,MAAM,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IAClC,OAAO,IAAI,kCAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACnC,OAAO,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC,GAAG,IAAI;QACtC,KAAK,EAAE,MAAM,GAAG,GAAG;KACpB,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/gateway",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "Apollo Gateway",
|
|
5
|
-
"author": "Apollo <
|
|
5
|
+
"author": "Apollo <packages@apollographql.com>",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@apollo/core-schema": "^0.1.0",
|
|
29
|
-
"@apollo/federation": "^0.33.
|
|
30
|
-
"@apollo/query-planner": "^0.
|
|
29
|
+
"@apollo/federation": "^0.33.6",
|
|
30
|
+
"@apollo/query-planner": "^0.6.0",
|
|
31
31
|
"@opentelemetry/api": "^1.0.1",
|
|
32
32
|
"@types/node-fetch": "2.5.12",
|
|
33
33
|
"apollo-graphql": "^0.9.3",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"graphql": "^15.5.3"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "c6112749b4a3d840713da9a597a8f47ef3b336f8"
|
|
48
48
|
}
|
|
@@ -91,7 +91,7 @@ export type Query = {
|
|
|
91
91
|
export type QueryRouterConfigArgs = {
|
|
92
92
|
apiKey: Scalars['String'];
|
|
93
93
|
ref: Scalars['String'];
|
|
94
|
-
|
|
94
|
+
unlessIdIn?: Maybe<Array<Scalars['ID']>>;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
export type Request = {
|
|
@@ -106,7 +106,7 @@ export type Response = {
|
|
|
106
106
|
httpStatusCode: Scalars['Int'];
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
export type RouterConfigResponse = FetchError | RouterConfigResult;
|
|
109
|
+
export type RouterConfigResponse = FetchError | RouterConfigResult | Unchanged;
|
|
110
110
|
|
|
111
111
|
export type RouterConfigResult = {
|
|
112
112
|
__typename?: 'RouterConfigResult';
|
|
@@ -117,13 +117,18 @@ export type RouterConfigResult = {
|
|
|
117
117
|
supergraphSDL: Scalars['String'];
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
+
export type Unchanged = {
|
|
121
|
+
__typename?: 'Unchanged';
|
|
122
|
+
id: Scalars['ID'];
|
|
123
|
+
};
|
|
124
|
+
|
|
120
125
|
export type SupergraphSdlQueryVariables = Exact<{
|
|
121
126
|
apiKey: Scalars['String'];
|
|
122
127
|
ref: Scalars['String'];
|
|
123
128
|
}>;
|
|
124
129
|
|
|
125
130
|
|
|
126
|
-
export type SupergraphSdlQuery = { __typename?: 'Query', routerConfig: { __typename: 'FetchError', code: FetchErrorCode, message: string } | { __typename: 'RouterConfigResult', id: string, supergraphSdl: string } };
|
|
131
|
+
export type SupergraphSdlQuery = { __typename?: 'Query', routerConfig: { __typename: 'FetchError', code: FetchErrorCode, message: string } | { __typename: 'RouterConfigResult', id: string, supergraphSdl: string } | { __typename: 'Unchanged' } };
|
|
127
132
|
|
|
128
133
|
export type OobReportMutationVariables = Exact<{
|
|
129
134
|
input?: Maybe<ApiMonitoringReport>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { GraphQLSchema } from 'graphql';
|
|
2
2
|
import gql from 'graphql-tag';
|
|
3
3
|
import { buildOperationContext } from '../operationContext';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
astSerializer,
|
|
6
|
+
queryPlanSerializer,
|
|
7
|
+
fixturesWithUpdate,
|
|
8
|
+
} from 'apollo-federation-integration-testsuite';
|
|
5
9
|
import { getFederatedTestingSchema } from './execution-utils';
|
|
6
|
-
import { QueryPlanner } from '@apollo/query-planner';
|
|
10
|
+
import { QueryPlanner, FetchNode } from '@apollo/query-planner';
|
|
7
11
|
|
|
8
12
|
expect.addSnapshotSerializer(astSerializer);
|
|
9
13
|
expect.addSnapshotSerializer(queryPlanSerializer);
|
|
@@ -85,7 +89,7 @@ describe('buildQueryPlan', () => {
|
|
|
85
89
|
buildOperationContext({
|
|
86
90
|
schema,
|
|
87
91
|
operationDocument,
|
|
88
|
-
})
|
|
92
|
+
}),
|
|
89
93
|
);
|
|
90
94
|
|
|
91
95
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -119,7 +123,7 @@ describe('buildQueryPlan', () => {
|
|
|
119
123
|
buildOperationContext({
|
|
120
124
|
schema,
|
|
121
125
|
operationDocument,
|
|
122
|
-
})
|
|
126
|
+
}),
|
|
123
127
|
);
|
|
124
128
|
|
|
125
129
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -206,7 +210,7 @@ describe('buildQueryPlan', () => {
|
|
|
206
210
|
buildOperationContext({
|
|
207
211
|
schema,
|
|
208
212
|
operationDocument,
|
|
209
|
-
})
|
|
213
|
+
}),
|
|
210
214
|
);
|
|
211
215
|
|
|
212
216
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -337,7 +341,7 @@ describe('buildQueryPlan', () => {
|
|
|
337
341
|
buildOperationContext({
|
|
338
342
|
schema,
|
|
339
343
|
operationDocument,
|
|
340
|
-
})
|
|
344
|
+
}),
|
|
341
345
|
);
|
|
342
346
|
|
|
343
347
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -379,7 +383,7 @@ describe('buildQueryPlan', () => {
|
|
|
379
383
|
buildOperationContext({
|
|
380
384
|
schema,
|
|
381
385
|
operationDocument,
|
|
382
|
-
})
|
|
386
|
+
}),
|
|
383
387
|
);
|
|
384
388
|
|
|
385
389
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -420,7 +424,7 @@ describe('buildQueryPlan', () => {
|
|
|
420
424
|
buildOperationContext({
|
|
421
425
|
schema,
|
|
422
426
|
operationDocument,
|
|
423
|
-
})
|
|
427
|
+
}),
|
|
424
428
|
);
|
|
425
429
|
|
|
426
430
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -475,7 +479,7 @@ describe('buildQueryPlan', () => {
|
|
|
475
479
|
buildOperationContext({
|
|
476
480
|
schema,
|
|
477
481
|
operationDocument,
|
|
478
|
-
})
|
|
482
|
+
}),
|
|
479
483
|
);
|
|
480
484
|
|
|
481
485
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -531,7 +535,7 @@ describe('buildQueryPlan', () => {
|
|
|
531
535
|
buildOperationContext({
|
|
532
536
|
schema,
|
|
533
537
|
operationDocument,
|
|
534
|
-
})
|
|
538
|
+
}),
|
|
535
539
|
);
|
|
536
540
|
|
|
537
541
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -571,7 +575,7 @@ describe('buildQueryPlan', () => {
|
|
|
571
575
|
|
|
572
576
|
describe(`when requesting a composite field with subfields from another service`, () => {
|
|
573
577
|
it(`should add key fields to the parent selection set and use a dependent fetch`, () => {
|
|
574
|
-
|
|
578
|
+
const operationString = `#graphql
|
|
575
579
|
query {
|
|
576
580
|
topReviews {
|
|
577
581
|
body
|
|
@@ -588,7 +592,7 @@ describe('buildQueryPlan', () => {
|
|
|
588
592
|
buildOperationContext({
|
|
589
593
|
schema,
|
|
590
594
|
operationDocument,
|
|
591
|
-
})
|
|
595
|
+
}),
|
|
592
596
|
);
|
|
593
597
|
|
|
594
598
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -641,7 +645,7 @@ describe('buildQueryPlan', () => {
|
|
|
641
645
|
buildOperationContext({
|
|
642
646
|
schema,
|
|
643
647
|
operationDocument,
|
|
644
|
-
})
|
|
648
|
+
}),
|
|
645
649
|
);
|
|
646
650
|
|
|
647
651
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -696,7 +700,7 @@ describe('buildQueryPlan', () => {
|
|
|
696
700
|
buildOperationContext({
|
|
697
701
|
schema,
|
|
698
702
|
operationDocument,
|
|
699
|
-
})
|
|
703
|
+
}),
|
|
700
704
|
);
|
|
701
705
|
|
|
702
706
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -751,7 +755,7 @@ describe('buildQueryPlan', () => {
|
|
|
751
755
|
buildOperationContext({
|
|
752
756
|
schema,
|
|
753
757
|
operationDocument,
|
|
754
|
-
})
|
|
758
|
+
}),
|
|
755
759
|
);
|
|
756
760
|
|
|
757
761
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -807,7 +811,7 @@ describe('buildQueryPlan', () => {
|
|
|
807
811
|
buildOperationContext({
|
|
808
812
|
schema,
|
|
809
813
|
operationDocument,
|
|
810
|
-
})
|
|
814
|
+
}),
|
|
811
815
|
);
|
|
812
816
|
|
|
813
817
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -854,7 +858,7 @@ describe('buildQueryPlan', () => {
|
|
|
854
858
|
buildOperationContext({
|
|
855
859
|
schema,
|
|
856
860
|
operationDocument,
|
|
857
|
-
})
|
|
861
|
+
}),
|
|
858
862
|
);
|
|
859
863
|
|
|
860
864
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -901,7 +905,7 @@ describe('buildQueryPlan', () => {
|
|
|
901
905
|
buildOperationContext({
|
|
902
906
|
schema,
|
|
903
907
|
operationDocument,
|
|
904
|
-
})
|
|
908
|
+
}),
|
|
905
909
|
);
|
|
906
910
|
|
|
907
911
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -942,7 +946,7 @@ describe('buildQueryPlan', () => {
|
|
|
942
946
|
buildOperationContext({
|
|
943
947
|
schema,
|
|
944
948
|
operationDocument,
|
|
945
|
-
})
|
|
949
|
+
}),
|
|
946
950
|
);
|
|
947
951
|
|
|
948
952
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -982,7 +986,7 @@ describe('buildQueryPlan', () => {
|
|
|
982
986
|
buildOperationContext({
|
|
983
987
|
schema,
|
|
984
988
|
operationDocument,
|
|
985
|
-
})
|
|
989
|
+
}),
|
|
986
990
|
);
|
|
987
991
|
|
|
988
992
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1025,7 +1029,7 @@ describe('buildQueryPlan', () => {
|
|
|
1025
1029
|
buildOperationContext({
|
|
1026
1030
|
schema,
|
|
1027
1031
|
operationDocument,
|
|
1028
|
-
})
|
|
1032
|
+
}),
|
|
1029
1033
|
);
|
|
1030
1034
|
|
|
1031
1035
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1099,7 +1103,7 @@ describe('buildQueryPlan', () => {
|
|
|
1099
1103
|
buildOperationContext({
|
|
1100
1104
|
schema,
|
|
1101
1105
|
operationDocument,
|
|
1102
|
-
})
|
|
1106
|
+
}),
|
|
1103
1107
|
);
|
|
1104
1108
|
|
|
1105
1109
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1154,7 +1158,7 @@ describe('buildQueryPlan', () => {
|
|
|
1154
1158
|
buildOperationContext({
|
|
1155
1159
|
schema,
|
|
1156
1160
|
operationDocument,
|
|
1157
|
-
})
|
|
1161
|
+
}),
|
|
1158
1162
|
);
|
|
1159
1163
|
|
|
1160
1164
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1550,7 +1554,7 @@ describe('buildQueryPlan', () => {
|
|
|
1550
1554
|
buildOperationContext({
|
|
1551
1555
|
schema,
|
|
1552
1556
|
operationDocument,
|
|
1553
|
-
})
|
|
1557
|
+
}),
|
|
1554
1558
|
);
|
|
1555
1559
|
|
|
1556
1560
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1612,7 +1616,7 @@ describe('buildQueryPlan', () => {
|
|
|
1612
1616
|
buildOperationContext({
|
|
1613
1617
|
schema,
|
|
1614
1618
|
operationDocument,
|
|
1615
|
-
})
|
|
1619
|
+
}),
|
|
1616
1620
|
);
|
|
1617
1621
|
|
|
1618
1622
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1662,7 +1666,7 @@ describe('buildQueryPlan', () => {
|
|
|
1662
1666
|
buildOperationContext({
|
|
1663
1667
|
schema,
|
|
1664
1668
|
operationDocument,
|
|
1665
|
-
})
|
|
1669
|
+
}),
|
|
1666
1670
|
);
|
|
1667
1671
|
|
|
1668
1672
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
@@ -1684,4 +1688,251 @@ describe('buildQueryPlan', () => {
|
|
|
1684
1688
|
`);
|
|
1685
1689
|
});
|
|
1686
1690
|
});
|
|
1691
|
+
|
|
1692
|
+
describe('top-level @skip/@include behavior', () => {
|
|
1693
|
+
beforeEach(() => {
|
|
1694
|
+
({ schema, queryPlanner } =
|
|
1695
|
+
getFederatedTestingSchema(fixturesWithUpdate));
|
|
1696
|
+
});
|
|
1697
|
+
|
|
1698
|
+
function getQueryPlan(operation: string) {
|
|
1699
|
+
const operationDocument = gql(operation);
|
|
1700
|
+
|
|
1701
|
+
return queryPlanner.buildQueryPlan(
|
|
1702
|
+
buildOperationContext({
|
|
1703
|
+
schema,
|
|
1704
|
+
operationDocument,
|
|
1705
|
+
}),
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
it('simple skip', () => {
|
|
1710
|
+
const operation = `#graphql
|
|
1711
|
+
query {
|
|
1712
|
+
topReviews @skip(if: true) {
|
|
1713
|
+
body
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
`;
|
|
1717
|
+
|
|
1718
|
+
expect(
|
|
1719
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1720
|
+
).toEqual([{ skip: true, include: null }]);
|
|
1721
|
+
});
|
|
1722
|
+
|
|
1723
|
+
it('simple include', () => {
|
|
1724
|
+
const operation = `#graphql
|
|
1725
|
+
query {
|
|
1726
|
+
topReviews @include(if: false) {
|
|
1727
|
+
body
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
`;
|
|
1731
|
+
|
|
1732
|
+
expect(
|
|
1733
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1734
|
+
).toEqual([{ include: false, skip: null }]);
|
|
1735
|
+
});
|
|
1736
|
+
|
|
1737
|
+
it('simple include with variables', () => {
|
|
1738
|
+
const operation = `#graphql
|
|
1739
|
+
query {
|
|
1740
|
+
topReviews @include(if: $shouldInclude) {
|
|
1741
|
+
body
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
`;
|
|
1745
|
+
|
|
1746
|
+
expect(
|
|
1747
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1748
|
+
).toEqual([{ include: 'shouldInclude', skip: null }]);
|
|
1749
|
+
});
|
|
1750
|
+
|
|
1751
|
+
it('simple skip with variables', () => {
|
|
1752
|
+
const operation = `#graphql
|
|
1753
|
+
query {
|
|
1754
|
+
topReviews @skip(if: $shouldSkip) {
|
|
1755
|
+
body
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
`;
|
|
1759
|
+
|
|
1760
|
+
expect(
|
|
1761
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1762
|
+
).toEqual([{ skip: 'shouldSkip', include: null }]);
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
it('not all top-levels have conditionals', () => {
|
|
1766
|
+
const operation = `#graphql
|
|
1767
|
+
query {
|
|
1768
|
+
topReviews @skip(if: $shouldSkip) {
|
|
1769
|
+
body
|
|
1770
|
+
}
|
|
1771
|
+
review(id: "1") {
|
|
1772
|
+
body
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
`;
|
|
1776
|
+
|
|
1777
|
+
expect(
|
|
1778
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1779
|
+
).toBeUndefined();
|
|
1780
|
+
});
|
|
1781
|
+
|
|
1782
|
+
it('all top-levels have conditionals', () => {
|
|
1783
|
+
const operation = `#graphql
|
|
1784
|
+
query {
|
|
1785
|
+
topReviews @skip(if: $shouldSkip) {
|
|
1786
|
+
body
|
|
1787
|
+
}
|
|
1788
|
+
review(id: "1") @skip(if: true) {
|
|
1789
|
+
body
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
`;
|
|
1793
|
+
|
|
1794
|
+
expect(
|
|
1795
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1796
|
+
).toEqual([
|
|
1797
|
+
{ skip: 'shouldSkip', include: null },
|
|
1798
|
+
{ skip: true, include: null },
|
|
1799
|
+
]);
|
|
1800
|
+
});
|
|
1801
|
+
|
|
1802
|
+
it('all top-levels use literals (include case)', () => {
|
|
1803
|
+
const operation = `#graphql
|
|
1804
|
+
query {
|
|
1805
|
+
topReviews @skip(if: false) {
|
|
1806
|
+
body
|
|
1807
|
+
}
|
|
1808
|
+
review(id: "1") @include(if: true) {
|
|
1809
|
+
body
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
`;
|
|
1813
|
+
|
|
1814
|
+
expect(
|
|
1815
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1816
|
+
).toBeUndefined();
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1819
|
+
it('all top-levels use literals (skip case)', () => {
|
|
1820
|
+
const operation = `#graphql
|
|
1821
|
+
query {
|
|
1822
|
+
topReviews @skip(if: true) {
|
|
1823
|
+
body
|
|
1824
|
+
}
|
|
1825
|
+
review(id: "1") @include(if: false) {
|
|
1826
|
+
body
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
`;
|
|
1830
|
+
|
|
1831
|
+
expect(
|
|
1832
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1833
|
+
).toEqual([
|
|
1834
|
+
{ skip: true, include: null },
|
|
1835
|
+
{ include: false, skip: null },
|
|
1836
|
+
]);
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1839
|
+
it('skip: false, include: false', () => {
|
|
1840
|
+
const operation = `#graphql
|
|
1841
|
+
query {
|
|
1842
|
+
topReviews @skip(if: false) @include(if: false) {
|
|
1843
|
+
body
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
`;
|
|
1847
|
+
|
|
1848
|
+
expect(
|
|
1849
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1850
|
+
).toEqual([{ skip: false, include: false }]);
|
|
1851
|
+
});
|
|
1852
|
+
|
|
1853
|
+
it('skip: false, include: true', () => {
|
|
1854
|
+
const operation = `#graphql
|
|
1855
|
+
query {
|
|
1856
|
+
topReviews @skip(if: false) @include(if: true) {
|
|
1857
|
+
body
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
`;
|
|
1861
|
+
|
|
1862
|
+
expect(
|
|
1863
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1864
|
+
).toBeUndefined();
|
|
1865
|
+
});
|
|
1866
|
+
|
|
1867
|
+
it('skip: true, include: false', () => {
|
|
1868
|
+
const operation = `#graphql
|
|
1869
|
+
query {
|
|
1870
|
+
topReviews @skip(if: true) @include(if: false) {
|
|
1871
|
+
body
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
`;
|
|
1875
|
+
|
|
1876
|
+
expect(
|
|
1877
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1878
|
+
).toEqual([{ skip: true, include: false }]);
|
|
1879
|
+
});
|
|
1880
|
+
|
|
1881
|
+
it('skip: true, include: true', () => {
|
|
1882
|
+
const operation = `#graphql
|
|
1883
|
+
query {
|
|
1884
|
+
topReviews @skip(if: true) @include(if: true) {
|
|
1885
|
+
body
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
`;
|
|
1889
|
+
|
|
1890
|
+
expect(
|
|
1891
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1892
|
+
).toEqual([{ skip: true, include: true }]);
|
|
1893
|
+
});
|
|
1894
|
+
|
|
1895
|
+
describe.skip('known limitations', () => {
|
|
1896
|
+
it('conditionals on top-level fragment spreads are captured', () => {
|
|
1897
|
+
const operation = `#graphql
|
|
1898
|
+
query {
|
|
1899
|
+
...TopReviews @skip(if: $shouldSkip)
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
fragment TopReviews on Query {
|
|
1903
|
+
topReviews {
|
|
1904
|
+
body
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
`;
|
|
1908
|
+
|
|
1909
|
+
expect(
|
|
1910
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1911
|
+
).toEqual([{ skip: 'shouldSkip', include: null }]);
|
|
1912
|
+
});
|
|
1913
|
+
|
|
1914
|
+
it('conditionals on top-level inline fragments are captured', () => {
|
|
1915
|
+
const operation = `#graphql
|
|
1916
|
+
query {
|
|
1917
|
+
... on Query @skip(if: $shouldSkip) {
|
|
1918
|
+
topReviews {
|
|
1919
|
+
body
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
`;
|
|
1924
|
+
|
|
1925
|
+
expect(
|
|
1926
|
+
(getQueryPlan(operation).node as FetchNode).inclusionConditions,
|
|
1927
|
+
).toEqual([{ skip: 'shouldSkip', include: null }]);
|
|
1928
|
+
});
|
|
1929
|
+
|
|
1930
|
+
it.todo(
|
|
1931
|
+
'deeply-nested conditionals within fragment spreads are captured',
|
|
1932
|
+
);
|
|
1933
|
+
it.todo(
|
|
1934
|
+
'deeply-nested conditionals within inline fragments are captured',
|
|
1935
|
+
);
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
1687
1938
|
});
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from 'graphql';
|
|
8
8
|
import { addResolversToSchema, GraphQLResolverMap } from 'apollo-graphql';
|
|
9
9
|
import gql from 'graphql-tag';
|
|
10
|
-
import { GraphQLRequestContext } from 'apollo-server-types';
|
|
10
|
+
import { GraphQLRequestContext, VariableValues } from 'apollo-server-types';
|
|
11
11
|
import { AuthenticationError } from 'apollo-server-core';
|
|
12
12
|
import { buildOperationContext } from '../operationContext';
|
|
13
13
|
import { executeQueryPlan } from '../executeQueryPlan';
|
|
@@ -26,10 +26,6 @@ expect.addSnapshotSerializer(astSerializer);
|
|
|
26
26
|
expect.addSnapshotSerializer(queryPlanSerializer);
|
|
27
27
|
|
|
28
28
|
describe('executeQueryPlan', () => {
|
|
29
|
-
let serviceMap: {
|
|
30
|
-
[serviceName: string]: LocalGraphQLDataSource;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
29
|
function overrideResolversInService(
|
|
34
30
|
serviceName: string,
|
|
35
31
|
resolvers: GraphQLResolverMap,
|
|
@@ -44,6 +40,9 @@ describe('executeQueryPlan', () => {
|
|
|
44
40
|
return jest.spyOn(entitiesField, 'resolve');
|
|
45
41
|
}
|
|
46
42
|
|
|
43
|
+
let serviceMap: {
|
|
44
|
+
[serviceName: string]: LocalGraphQLDataSource;
|
|
45
|
+
};
|
|
47
46
|
let schema: GraphQLSchema;
|
|
48
47
|
let queryPlanner: QueryPlanner;
|
|
49
48
|
beforeEach(() => {
|
|
@@ -53,13 +52,15 @@ describe('executeQueryPlan', () => {
|
|
|
53
52
|
).not.toThrow();
|
|
54
53
|
});
|
|
55
54
|
|
|
56
|
-
function buildRequestContext(
|
|
55
|
+
function buildRequestContext(
|
|
56
|
+
variables: VariableValues = {},
|
|
57
|
+
): GraphQLRequestContext {
|
|
57
58
|
// @ts-ignore
|
|
58
59
|
return {
|
|
59
60
|
cache: undefined as any,
|
|
60
61
|
context: {},
|
|
61
62
|
request: {
|
|
62
|
-
variables
|
|
63
|
+
variables,
|
|
63
64
|
},
|
|
64
65
|
};
|
|
65
66
|
}
|
|
@@ -1379,4 +1380,260 @@ describe('executeQueryPlan', () => {
|
|
|
1379
1380
|
// `);
|
|
1380
1381
|
});
|
|
1381
1382
|
});
|
|
1383
|
+
|
|
1384
|
+
describe('top-level @skip / @include usages', () => {
|
|
1385
|
+
it(`top-level skip never calls reviews service (using literals)`, async () => {
|
|
1386
|
+
const operationDocument = gql`
|
|
1387
|
+
query {
|
|
1388
|
+
topReviews @skip(if: true) {
|
|
1389
|
+
body
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
`;
|
|
1393
|
+
|
|
1394
|
+
const operationContext = buildOperationContext({
|
|
1395
|
+
schema,
|
|
1396
|
+
operationDocument,
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1399
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1400
|
+
|
|
1401
|
+
const response = await executeQueryPlan(
|
|
1402
|
+
queryPlan,
|
|
1403
|
+
serviceMap,
|
|
1404
|
+
buildRequestContext(),
|
|
1405
|
+
operationContext,
|
|
1406
|
+
);
|
|
1407
|
+
|
|
1408
|
+
expect(response.data).toMatchInlineSnapshot(`Object {}`);
|
|
1409
|
+
expect(queryPlan).not.toCallService('reviews');
|
|
1410
|
+
});
|
|
1411
|
+
|
|
1412
|
+
it(`top-level skip never calls reviews service (using variables)`, async () => {
|
|
1413
|
+
const operationDocument = gql`
|
|
1414
|
+
query TopReviews($shouldSkip: Boolean!) {
|
|
1415
|
+
topReviews @skip(if: $shouldSkip) {
|
|
1416
|
+
body
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
`;
|
|
1420
|
+
|
|
1421
|
+
const operationContext = buildOperationContext({
|
|
1422
|
+
schema,
|
|
1423
|
+
operationDocument,
|
|
1424
|
+
});
|
|
1425
|
+
|
|
1426
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1427
|
+
|
|
1428
|
+
const variables = { shouldSkip: true };
|
|
1429
|
+
const response = await executeQueryPlan(
|
|
1430
|
+
queryPlan,
|
|
1431
|
+
serviceMap,
|
|
1432
|
+
buildRequestContext(variables),
|
|
1433
|
+
operationContext,
|
|
1434
|
+
);
|
|
1435
|
+
|
|
1436
|
+
expect(response.data).toMatchInlineSnapshot(`Object {}`);
|
|
1437
|
+
expect({ queryPlan, variables }).not.toCallService('reviews');
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1440
|
+
it(`call to service isn't skipped unless all top-level fields are skipped`, async () => {
|
|
1441
|
+
const operationDocument = gql`
|
|
1442
|
+
query {
|
|
1443
|
+
user(id: "1") @skip(if: true) {
|
|
1444
|
+
username
|
|
1445
|
+
}
|
|
1446
|
+
me @include(if: true) {
|
|
1447
|
+
username
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
`;
|
|
1451
|
+
|
|
1452
|
+
const operationContext = buildOperationContext({
|
|
1453
|
+
schema,
|
|
1454
|
+
operationDocument,
|
|
1455
|
+
});
|
|
1456
|
+
|
|
1457
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1458
|
+
|
|
1459
|
+
const response = await executeQueryPlan(
|
|
1460
|
+
queryPlan,
|
|
1461
|
+
serviceMap,
|
|
1462
|
+
buildRequestContext(),
|
|
1463
|
+
operationContext,
|
|
1464
|
+
);
|
|
1465
|
+
|
|
1466
|
+
expect(response.data).toMatchObject({
|
|
1467
|
+
me: {
|
|
1468
|
+
username: '@ada',
|
|
1469
|
+
},
|
|
1470
|
+
});
|
|
1471
|
+
expect(queryPlan).toCallService('accounts');
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
it(`call to service is skipped when all top-level fields are skipped`, async () => {
|
|
1475
|
+
const operationDocument = gql`
|
|
1476
|
+
query {
|
|
1477
|
+
user(id: "1") @skip(if: true) {
|
|
1478
|
+
username
|
|
1479
|
+
}
|
|
1480
|
+
me @include(if: false) {
|
|
1481
|
+
username
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
`;
|
|
1485
|
+
|
|
1486
|
+
const operationContext = buildOperationContext({
|
|
1487
|
+
schema,
|
|
1488
|
+
operationDocument,
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1492
|
+
|
|
1493
|
+
const response = await executeQueryPlan(
|
|
1494
|
+
queryPlan,
|
|
1495
|
+
serviceMap,
|
|
1496
|
+
buildRequestContext(),
|
|
1497
|
+
operationContext,
|
|
1498
|
+
);
|
|
1499
|
+
|
|
1500
|
+
expect(response.data).toMatchObject({});
|
|
1501
|
+
expect(queryPlan).not.toCallService('accounts');
|
|
1502
|
+
});
|
|
1503
|
+
|
|
1504
|
+
describe('@skip and @include combinations', () => {
|
|
1505
|
+
it(`include: false, skip: false`, async () => {
|
|
1506
|
+
const operationDocument = gql`
|
|
1507
|
+
query TopReviews($shouldInclude: Boolean!, $shouldSkip: Boolean!) {
|
|
1508
|
+
topReviews @include(if: $shouldInclude) @skip(if: $shouldSkip) {
|
|
1509
|
+
body
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
`;
|
|
1513
|
+
|
|
1514
|
+
const operationContext = buildOperationContext({
|
|
1515
|
+
schema,
|
|
1516
|
+
operationDocument,
|
|
1517
|
+
});
|
|
1518
|
+
|
|
1519
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1520
|
+
|
|
1521
|
+
const variables = { shouldInclude: false, shouldSkip: false };
|
|
1522
|
+
const response = await executeQueryPlan(
|
|
1523
|
+
queryPlan,
|
|
1524
|
+
serviceMap,
|
|
1525
|
+
buildRequestContext(variables),
|
|
1526
|
+
operationContext,
|
|
1527
|
+
);
|
|
1528
|
+
|
|
1529
|
+
expect(response.data).toMatchObject({});
|
|
1530
|
+
expect({ queryPlan, variables }).not.toCallService('reviews');
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1533
|
+
it(`include: false, skip: true`, async () => {
|
|
1534
|
+
const operationDocument = gql`
|
|
1535
|
+
query TopReviews($shouldInclude: Boolean!, $shouldSkip: Boolean!) {
|
|
1536
|
+
topReviews @include(if: $shouldInclude) @skip(if: $shouldSkip) {
|
|
1537
|
+
body
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
`;
|
|
1541
|
+
|
|
1542
|
+
const operationContext = buildOperationContext({
|
|
1543
|
+
schema,
|
|
1544
|
+
operationDocument,
|
|
1545
|
+
});
|
|
1546
|
+
|
|
1547
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1548
|
+
|
|
1549
|
+
const variables = { shouldInclude: false, shouldSkip: true };
|
|
1550
|
+
const response = await executeQueryPlan(
|
|
1551
|
+
queryPlan,
|
|
1552
|
+
serviceMap,
|
|
1553
|
+
buildRequestContext(variables),
|
|
1554
|
+
operationContext,
|
|
1555
|
+
);
|
|
1556
|
+
|
|
1557
|
+
expect(response.data).toMatchObject({});
|
|
1558
|
+
expect({ queryPlan, variables }).not.toCallService('reviews');
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
it(`include: true, skip: false`, async () => {
|
|
1562
|
+
const operationDocument = gql`
|
|
1563
|
+
query TopReviews($shouldInclude: Boolean!, $shouldSkip: Boolean!) {
|
|
1564
|
+
topReviews(first: 2) @include(if: $shouldInclude) @skip(if: $shouldSkip) {
|
|
1565
|
+
body
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
`;
|
|
1569
|
+
|
|
1570
|
+
const operationContext = buildOperationContext({
|
|
1571
|
+
schema,
|
|
1572
|
+
operationDocument,
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1575
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1576
|
+
|
|
1577
|
+
const variables = { shouldInclude: true, shouldSkip: false };
|
|
1578
|
+
const response = await executeQueryPlan(
|
|
1579
|
+
queryPlan,
|
|
1580
|
+
serviceMap,
|
|
1581
|
+
buildRequestContext(variables),
|
|
1582
|
+
operationContext,
|
|
1583
|
+
);
|
|
1584
|
+
|
|
1585
|
+
expect(response.data).toMatchObject({
|
|
1586
|
+
topReviews: [
|
|
1587
|
+
{
|
|
1588
|
+
body: 'Love it!',
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
body: 'Too expensive.',
|
|
1592
|
+
},
|
|
1593
|
+
],
|
|
1594
|
+
});
|
|
1595
|
+
expect({ queryPlan, variables }).toCallService('reviews');
|
|
1596
|
+
});
|
|
1597
|
+
|
|
1598
|
+
it(`include: true, skip: true`, async () => {
|
|
1599
|
+
const operationDocument = gql`
|
|
1600
|
+
query TopReviews($shouldInclude: Boolean!, $shouldSkip: Boolean!) {
|
|
1601
|
+
topReviews @include(if: $shouldInclude) @skip(if: $shouldSkip) {
|
|
1602
|
+
body
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
`;
|
|
1606
|
+
|
|
1607
|
+
const operationContext = buildOperationContext({
|
|
1608
|
+
schema,
|
|
1609
|
+
operationDocument,
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
const queryPlan = queryPlanner.buildQueryPlan(operationContext);
|
|
1613
|
+
|
|
1614
|
+
const variables = { shouldInclude: true, shouldSkip: true };
|
|
1615
|
+
const response = await executeQueryPlan(
|
|
1616
|
+
queryPlan,
|
|
1617
|
+
serviceMap,
|
|
1618
|
+
buildRequestContext(variables),
|
|
1619
|
+
operationContext,
|
|
1620
|
+
);
|
|
1621
|
+
|
|
1622
|
+
expect(response.data).toMatchObject({});
|
|
1623
|
+
expect(queryPlan).toMatchInlineSnapshot(`
|
|
1624
|
+
QueryPlan {
|
|
1625
|
+
Fetch(service: "reviews", inclusionConditions: [{ include: "shouldInclude", skip: "shouldSkip" }]) {
|
|
1626
|
+
{
|
|
1627
|
+
topReviews @include(if: $shouldInclude) @skip(if: $shouldSkip) {
|
|
1628
|
+
body
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
},
|
|
1632
|
+
}
|
|
1633
|
+
`);
|
|
1634
|
+
|
|
1635
|
+
expect({ queryPlan, variables }).not.toCallService('reviews');
|
|
1636
|
+
});
|
|
1637
|
+
});
|
|
1638
|
+
});
|
|
1382
1639
|
});
|
|
@@ -110,7 +110,11 @@ export function getTestingSupergraphSdl(services: typeof fixtures = fixtures) {
|
|
|
110
110
|
if (!compositionHasErrors(compositionResult)) {
|
|
111
111
|
return compositionResult.supergraphSdl;
|
|
112
112
|
}
|
|
113
|
-
throw new Error(
|
|
113
|
+
throw new Error(
|
|
114
|
+
`Testing fixtures don't compose properly!\n${compositionResult.errors.join(
|
|
115
|
+
'\t\n',
|
|
116
|
+
)}`,
|
|
117
|
+
);
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
export function wait(ms: number) {
|
package/src/executeQueryPlan.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GraphQLExecutionResult,
|
|
3
3
|
GraphQLRequestContext,
|
|
4
|
+
VariableValues,
|
|
4
5
|
} from 'apollo-server-types';
|
|
5
6
|
import { Headers } from 'apollo-server-env';
|
|
6
7
|
import {
|
|
@@ -232,6 +233,10 @@ async function executeNode<TContext>(
|
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
235
|
case 'Fetch': {
|
|
236
|
+
if (shouldSkipFetchNode(node, context.requestContext.request.variables)) {
|
|
237
|
+
return new Trace.QueryPlanNode();
|
|
238
|
+
}
|
|
239
|
+
|
|
235
240
|
const traceNode = new Trace.QueryPlanNode.FetchNode({
|
|
236
241
|
serviceName: node.serviceName,
|
|
237
242
|
// executeFetch will fill in the other fields if desired.
|
|
@@ -252,6 +257,31 @@ async function executeNode<TContext>(
|
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
259
|
|
|
260
|
+
export function shouldSkipFetchNode(
|
|
261
|
+
node: FetchNode,
|
|
262
|
+
variables: VariableValues = {},
|
|
263
|
+
) {
|
|
264
|
+
if (!node.inclusionConditions) return false;
|
|
265
|
+
|
|
266
|
+
return node.inclusionConditions.every((conditionals) => {
|
|
267
|
+
function resolveConditionalValue(conditional: 'skip' | 'include') {
|
|
268
|
+
const conditionalType = typeof conditionals[conditional];
|
|
269
|
+
if (conditionalType === 'boolean') {
|
|
270
|
+
return conditionals[conditional] as boolean;
|
|
271
|
+
} else if (conditionalType === 'string') {
|
|
272
|
+
return variables[conditionals[conditional] as string] as boolean;
|
|
273
|
+
} else {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const includeValue = resolveConditionalValue('include');
|
|
279
|
+
const skipValue = resolveConditionalValue('skip');
|
|
280
|
+
|
|
281
|
+
return includeValue === false || skipValue === true;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
255
285
|
async function executeFetch<TContext>(
|
|
256
286
|
context: ExecutionContext<TContext>,
|
|
257
287
|
fetch: FetchNode,
|