@apollo/gateway 0.300.0-alpha.2 → 2.0.0-alpha.2
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/LICENSE +95 -0
- package/README.md +1 -1
- package/dist/__generated__/graphqlTypes.d.ts +130 -0
- package/dist/__generated__/graphqlTypes.d.ts.map +1 -0
- package/dist/__generated__/graphqlTypes.js +25 -0
- package/dist/__generated__/graphqlTypes.js.map +1 -0
- package/dist/config.d.ts +104 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +47 -0
- package/dist/config.js.map +1 -0
- package/dist/datasources/LocalGraphQLDataSource.d.ts +3 -3
- package/dist/datasources/LocalGraphQLDataSource.d.ts.map +1 -1
- package/dist/datasources/LocalGraphQLDataSource.js +5 -5
- package/dist/datasources/LocalGraphQLDataSource.js.map +1 -1
- package/dist/datasources/RemoteGraphQLDataSource.d.ts +6 -4
- package/dist/datasources/RemoteGraphQLDataSource.d.ts.map +1 -1
- package/dist/datasources/RemoteGraphQLDataSource.js +60 -17
- package/dist/datasources/RemoteGraphQLDataSource.js.map +1 -1
- package/dist/datasources/index.d.ts +1 -1
- package/dist/datasources/index.d.ts.map +1 -1
- package/dist/datasources/index.js +1 -0
- package/dist/datasources/index.js.map +1 -1
- package/dist/datasources/parseCacheControlHeader.d.ts +2 -0
- package/dist/datasources/parseCacheControlHeader.d.ts.map +1 -0
- package/dist/datasources/parseCacheControlHeader.js +16 -0
- package/dist/datasources/parseCacheControlHeader.js.map +1 -0
- package/dist/datasources/types.d.ts +16 -1
- package/dist/datasources/types.d.ts.map +1 -1
- package/dist/datasources/types.js +7 -0
- package/dist/datasources/types.js.map +1 -1
- package/dist/executeQueryPlan.d.ts +2 -1
- package/dist/executeQueryPlan.d.ts.map +1 -1
- package/dist/executeQueryPlan.js +199 -112
- package/dist/executeQueryPlan.js.map +1 -1
- package/dist/index.d.ts +62 -80
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +543 -234
- package/dist/index.js.map +1 -1
- package/dist/loadServicesFromRemoteEndpoint.d.ts +9 -9
- package/dist/loadServicesFromRemoteEndpoint.d.ts.map +1 -1
- package/dist/loadServicesFromRemoteEndpoint.js +13 -8
- package/dist/loadServicesFromRemoteEndpoint.js.map +1 -1
- package/dist/loadSupergraphSdlFromStorage.d.ts +13 -0
- package/dist/loadSupergraphSdlFromStorage.d.ts.map +1 -0
- package/dist/loadSupergraphSdlFromStorage.js +101 -0
- package/dist/loadSupergraphSdlFromStorage.js.map +1 -0
- package/dist/operationContext.d.ts +17 -0
- package/dist/operationContext.d.ts.map +1 -0
- package/dist/operationContext.js +42 -0
- package/dist/operationContext.js.map +1 -0
- package/dist/outOfBandReporter.d.ts +15 -0
- package/dist/outOfBandReporter.d.ts.map +1 -0
- package/dist/outOfBandReporter.js +88 -0
- package/dist/outOfBandReporter.js.map +1 -0
- package/dist/utilities/array.d.ts +1 -2
- package/dist/utilities/array.d.ts.map +1 -1
- package/dist/utilities/array.js +7 -14
- package/dist/utilities/array.js.map +1 -1
- package/dist/utilities/assert.d.ts +2 -0
- package/dist/utilities/assert.d.ts.map +1 -0
- package/dist/utilities/assert.js +10 -0
- package/dist/utilities/assert.js.map +1 -0
- package/dist/utilities/cleanErrorOfInaccessibleNames.d.ts +3 -0
- package/dist/utilities/cleanErrorOfInaccessibleNames.d.ts.map +1 -0
- package/dist/utilities/cleanErrorOfInaccessibleNames.js +27 -0
- package/dist/utilities/cleanErrorOfInaccessibleNames.js.map +1 -0
- package/dist/utilities/deepMerge.js +2 -2
- package/dist/utilities/deepMerge.js.map +1 -1
- package/dist/utilities/graphql.d.ts +1 -4
- package/dist/utilities/graphql.d.ts.map +1 -1
- package/dist/utilities/graphql.js +3 -36
- package/dist/utilities/graphql.js.map +1 -1
- package/dist/utilities/opentelemetry.d.ts +10 -0
- package/dist/utilities/opentelemetry.d.ts.map +1 -0
- package/dist/utilities/opentelemetry.js +19 -0
- package/dist/utilities/opentelemetry.js.map +1 -0
- package/package.json +30 -21
- package/src/__generated__/graphqlTypes.ts +140 -0
- package/src/__mocks__/apollo-server-env.ts +56 -0
- package/src/__mocks__/make-fetch-happen-fetcher.ts +55 -0
- package/src/__mocks__/tsconfig.json +7 -0
- package/src/__tests__/build-query-plan.feature +40 -311
- package/src/__tests__/buildQueryPlan.test.ts +246 -426
- package/src/__tests__/executeQueryPlan.test.ts +1691 -194
- package/src/__tests__/execution-utils.ts +33 -26
- package/src/__tests__/gateway/__snapshots__/opentelemetry.test.ts.snap +195 -0
- package/src/__tests__/gateway/buildService.test.ts +16 -19
- package/src/__tests__/gateway/composedSdl.test.ts +44 -0
- package/src/__tests__/gateway/endToEnd.test.ts +166 -0
- package/src/__tests__/gateway/executor.test.ts +49 -43
- package/src/__tests__/gateway/lifecycle-hooks.test.ts +58 -29
- package/src/__tests__/gateway/opentelemetry.test.ts +123 -0
- package/src/__tests__/gateway/queryPlanCache.test.ts +19 -20
- package/src/__tests__/gateway/reporting.test.ts +76 -55
- package/src/__tests__/integration/abstract-types.test.ts +1086 -22
- package/src/__tests__/integration/aliases.test.ts +5 -6
- package/src/__tests__/integration/boolean.test.ts +40 -38
- package/src/__tests__/integration/complex-key.test.ts +41 -56
- package/src/__tests__/integration/configuration.test.ts +321 -0
- package/src/__tests__/integration/custom-directives.test.ts +61 -46
- package/src/__tests__/integration/fragments.test.ts +8 -2
- package/src/__tests__/integration/list-key.test.ts +2 -2
- package/src/__tests__/integration/logger.test.ts +2 -2
- package/src/__tests__/integration/multiple-key.test.ts +11 -12
- package/src/__tests__/integration/mutations.test.ts +8 -5
- package/src/__tests__/integration/networkRequests.test.ts +447 -289
- package/src/__tests__/integration/nockMocks.ts +95 -66
- package/src/__tests__/integration/provides.test.ts +9 -6
- package/src/__tests__/integration/requires.test.ts +17 -15
- package/src/__tests__/integration/scope.test.ts +557 -0
- package/src/__tests__/integration/unions.test.ts +1 -1
- package/src/__tests__/integration/value-types.test.ts +35 -32
- package/src/__tests__/integration/variables.test.ts +8 -2
- package/src/__tests__/loadServicesFromRemoteEndpoint.test.ts +6 -2
- package/src/__tests__/loadSupergraphSdlFromStorage.test.ts +694 -0
- package/src/__tests__/queryPlanCucumber.test.ts +11 -61
- package/src/__tests__/testSetup.ts +1 -4
- package/src/__tests__/tsconfig.json +2 -1
- package/src/config.ts +225 -0
- package/src/core/__tests__/core.test.ts +412 -0
- package/src/datasources/LocalGraphQLDataSource.ts +9 -10
- package/src/datasources/RemoteGraphQLDataSource.ts +117 -43
- package/src/datasources/__tests__/LocalGraphQLDataSource.test.ts +11 -4
- package/src/datasources/__tests__/RemoteGraphQLDataSource.test.ts +148 -79
- package/src/datasources/__tests__/tsconfig.json +4 -2
- package/src/datasources/index.ts +1 -1
- package/src/datasources/parseCacheControlHeader.ts +43 -0
- package/src/datasources/types.ts +47 -2
- package/src/executeQueryPlan.ts +264 -153
- package/src/index.ts +925 -480
- package/src/loadServicesFromRemoteEndpoint.ts +24 -17
- package/src/loadSupergraphSdlFromStorage.ts +140 -0
- package/src/make-fetch-happen.d.ts +2 -2
- package/src/operationContext.ts +70 -0
- package/src/outOfBandReporter.ts +128 -0
- package/src/utilities/__tests__/cleanErrorOfInaccessibleElements.test.ts +104 -0
- package/src/utilities/__tests__/tsconfig.json +8 -0
- package/src/utilities/array.ts +6 -28
- package/src/utilities/assert.ts +14 -0
- package/src/utilities/cleanErrorOfInaccessibleNames.ts +29 -0
- package/src/utilities/graphql.ts +0 -64
- package/src/utilities/opentelemetry.ts +13 -0
- package/CHANGELOG.md +0 -226
- package/LICENSE.md +0 -20
- package/dist/FieldSet.d.ts +0 -18
- package/dist/FieldSet.d.ts.map +0 -1
- package/dist/FieldSet.js +0 -96
- package/dist/FieldSet.js.map +0 -1
- package/dist/QueryPlan.d.ts +0 -41
- package/dist/QueryPlan.d.ts.map +0 -1
- package/dist/QueryPlan.js +0 -15
- package/dist/QueryPlan.js.map +0 -1
- package/dist/buildQueryPlan.d.ts +0 -44
- package/dist/buildQueryPlan.d.ts.map +0 -1
- package/dist/buildQueryPlan.js +0 -670
- package/dist/buildQueryPlan.js.map +0 -1
- package/dist/loadServicesFromStorage.d.ts +0 -21
- package/dist/loadServicesFromStorage.d.ts.map +0 -1
- package/dist/loadServicesFromStorage.js +0 -64
- package/dist/loadServicesFromStorage.js.map +0 -1
- package/dist/snapshotSerializers/astSerializer.d.ts +0 -3
- package/dist/snapshotSerializers/astSerializer.d.ts.map +0 -1
- package/dist/snapshotSerializers/astSerializer.js +0 -14
- package/dist/snapshotSerializers/astSerializer.js.map +0 -1
- package/dist/snapshotSerializers/index.d.ts +0 -13
- package/dist/snapshotSerializers/index.d.ts.map +0 -1
- package/dist/snapshotSerializers/index.js +0 -15
- package/dist/snapshotSerializers/index.js.map +0 -1
- package/dist/snapshotSerializers/queryPlanSerializer.d.ts +0 -3
- package/dist/snapshotSerializers/queryPlanSerializer.d.ts.map +0 -1
- package/dist/snapshotSerializers/queryPlanSerializer.js +0 -78
- package/dist/snapshotSerializers/queryPlanSerializer.js.map +0 -1
- package/dist/snapshotSerializers/selectionSetSerializer.d.ts +0 -3
- package/dist/snapshotSerializers/selectionSetSerializer.d.ts.map +0 -1
- package/dist/snapshotSerializers/selectionSetSerializer.js +0 -12
- package/dist/snapshotSerializers/selectionSetSerializer.js.map +0 -1
- package/dist/snapshotSerializers/typeSerializer.d.ts +0 -3
- package/dist/snapshotSerializers/typeSerializer.d.ts.map +0 -1
- package/dist/snapshotSerializers/typeSerializer.js +0 -12
- package/dist/snapshotSerializers/typeSerializer.js.map +0 -1
- package/dist/utilities/MultiMap.d.ts +0 -4
- package/dist/utilities/MultiMap.d.ts.map +0 -1
- package/dist/utilities/MultiMap.js +0 -17
- package/dist/utilities/MultiMap.js.map +0 -1
- package/src/FieldSet.ts +0 -169
- package/src/QueryPlan.ts +0 -57
- package/src/__tests__/matchers/toCallService.ts +0 -105
- package/src/__tests__/matchers/toHaveBeenCalledBefore.ts +0 -40
- package/src/__tests__/matchers/toHaveFetched.ts +0 -81
- package/src/__tests__/matchers/toMatchAST.ts +0 -64
- package/src/buildQueryPlan.ts +0 -1190
- package/src/loadServicesFromStorage.ts +0 -170
- package/src/snapshotSerializers/astSerializer.ts +0 -21
- package/src/snapshotSerializers/index.ts +0 -21
- package/src/snapshotSerializers/queryPlanSerializer.ts +0 -144
- package/src/snapshotSerializers/selectionSetSerializer.ts +0 -13
- package/src/snapshotSerializers/typeSerializer.ts +0 -11
- package/src/utilities/MultiMap.ts +0 -11
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import gql from 'graphql-tag';
|
|
2
2
|
import { execute } from '../execution-utils';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
astSerializer,
|
|
5
|
+
queryPlanSerializer,
|
|
6
|
+
} from 'apollo-federation-integration-testsuite';
|
|
4
7
|
import { fixtures } from 'apollo-federation-integration-testsuite';
|
|
5
8
|
|
|
6
9
|
expect.addSnapshotSerializer(astSerializer);
|
|
@@ -16,7 +19,7 @@ describe('custom executable directives', () => {
|
|
|
16
19
|
}
|
|
17
20
|
`;
|
|
18
21
|
|
|
19
|
-
const { errors, queryPlan } = await execute(
|
|
22
|
+
const { errors, queryPlan } = await execute({
|
|
20
23
|
query,
|
|
21
24
|
});
|
|
22
25
|
|
|
@@ -41,13 +44,16 @@ describe('custom executable directives', () => {
|
|
|
41
44
|
topReviews {
|
|
42
45
|
body @stream
|
|
43
46
|
author @transform(from: "JSON") {
|
|
44
|
-
name @stream
|
|
47
|
+
name @stream {
|
|
48
|
+
first
|
|
49
|
+
last
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
`;
|
|
49
55
|
|
|
50
|
-
const { errors, queryPlan } = await execute(
|
|
56
|
+
const { errors, queryPlan } = await execute({
|
|
51
57
|
query,
|
|
52
58
|
});
|
|
53
59
|
|
|
@@ -55,40 +61,46 @@ describe('custom executable directives', () => {
|
|
|
55
61
|
expect(queryPlan).toCallService('reviews');
|
|
56
62
|
expect(queryPlan).toCallService('accounts');
|
|
57
63
|
expect(queryPlan).toMatchInlineSnapshot(`
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
64
|
+
QueryPlan {
|
|
65
|
+
Sequence {
|
|
66
|
+
Fetch(service: "reviews") {
|
|
67
|
+
{
|
|
68
|
+
topReviews {
|
|
69
|
+
body @stream
|
|
70
|
+
author @transform(from: "JSON") {
|
|
71
|
+
__typename
|
|
72
|
+
id
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
Flatten(path: "topReviews.@.author") {
|
|
78
|
+
Fetch(service: "accounts") {
|
|
79
|
+
{
|
|
80
|
+
... on User {
|
|
81
|
+
__typename
|
|
82
|
+
id
|
|
83
|
+
}
|
|
84
|
+
} =>
|
|
85
|
+
{
|
|
86
|
+
... on User {
|
|
87
|
+
name @stream {
|
|
88
|
+
first
|
|
89
|
+
last
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
|
-
}
|
|
92
|
+
}
|
|
85
93
|
},
|
|
86
94
|
},
|
|
87
|
-
}
|
|
88
|
-
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
`);
|
|
89
98
|
});
|
|
90
99
|
|
|
91
|
-
|
|
100
|
+
// With relaxed composition, instead of erroring out if a directive is not declared everywhere, we compose but don't
|
|
101
|
+
// include the directive in the supergraph and generate a hint. So the following test will complain that @stream
|
|
102
|
+
// is unknown in the query. Not that the hints tests do test we properly raise an hint in that case.
|
|
103
|
+
it.skip("returns validation errors when directives aren't present across all services", async () => {
|
|
92
104
|
const invalidService = {
|
|
93
105
|
name: 'invalidService',
|
|
94
106
|
typeDefs: gql`
|
|
@@ -112,15 +124,18 @@ describe('custom executable directives', () => {
|
|
|
112
124
|
[...fixtures, invalidService],
|
|
113
125
|
),
|
|
114
126
|
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
115
|
-
"[@
|
|
127
|
+
"[@invalid] -> Custom directives must be implemented in every service. The following services do not implement the @invalid directive: accounts, books, documents, inventory, product, reviews.
|
|
116
128
|
|
|
117
|
-
[@
|
|
129
|
+
[@stream] -> Custom directives must be implemented in every service. The following services do not implement the @stream directive: invalidService.
|
|
118
130
|
|
|
119
|
-
[@
|
|
120
|
-
`);
|
|
131
|
+
[@transform] -> Custom directives must be implemented in every service. The following services do not implement the @transform directive: invalidService."
|
|
132
|
+
`);
|
|
121
133
|
});
|
|
122
134
|
|
|
123
|
-
|
|
135
|
+
// Same as previous: we don't of error out on inconsistent execution directives. Here, we instead look at the intersection of locations
|
|
136
|
+
// defined, and as that is empty, we don't include the directive in the supergraph (and raise a hint).
|
|
137
|
+
// So the following test will complain that @stream is unknown in the query. Not that the hints tests do test we properly raise an hint in that case.
|
|
138
|
+
it.skip("returns validation errors when directives aren't identical across all services", async () => {
|
|
124
139
|
const invalidService = {
|
|
125
140
|
name: 'invalid',
|
|
126
141
|
typeDefs: gql`
|
|
@@ -144,16 +159,16 @@ describe('custom executable directives', () => {
|
|
|
144
159
|
[...fixtures, invalidService],
|
|
145
160
|
),
|
|
146
161
|
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
|
147
|
-
"[@transform] -> Custom directives must be implemented in every service. The following services do not implement the @transform directive: invalid.
|
|
148
|
-
|
|
149
|
-
[@stream] -> custom directives must be defined identically across all services. See below for a list of current implementations:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`);
|
|
162
|
+
"[@transform] -> Custom directives must be implemented in every service. The following services do not implement the @transform directive: invalid.
|
|
163
|
+
|
|
164
|
+
[@stream] -> custom directives must be defined identically across all services. See below for a list of current implementations:
|
|
165
|
+
accounts: directive @stream on FIELD
|
|
166
|
+
books: directive @stream on FIELD
|
|
167
|
+
documents: directive @stream on FIELD
|
|
168
|
+
inventory: directive @stream on FIELD
|
|
169
|
+
product: directive @stream on FIELD
|
|
170
|
+
reviews: directive @stream on FIELD
|
|
171
|
+
invalid: directive @stream on QUERY"
|
|
172
|
+
`);
|
|
158
173
|
});
|
|
159
174
|
});
|
|
@@ -104,7 +104,10 @@ it('supports named fragments (one level)', async () => {
|
|
|
104
104
|
it('supports multiple named fragments (one level, mixed ordering)', async () => {
|
|
105
105
|
const query = `#graphql
|
|
106
106
|
fragment userInfo on User {
|
|
107
|
-
name
|
|
107
|
+
name {
|
|
108
|
+
first
|
|
109
|
+
last
|
|
110
|
+
}
|
|
108
111
|
}
|
|
109
112
|
query GetUser {
|
|
110
113
|
me {
|
|
@@ -125,7 +128,10 @@ it('supports multiple named fragments (one level, mixed ordering)', async () =>
|
|
|
125
128
|
expect(data).toEqual({
|
|
126
129
|
me: {
|
|
127
130
|
username: '@ada',
|
|
128
|
-
name:
|
|
131
|
+
name: {
|
|
132
|
+
first: 'Ada',
|
|
133
|
+
last: 'Lovelace',
|
|
134
|
+
}
|
|
129
135
|
},
|
|
130
136
|
});
|
|
131
137
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import gql from 'graphql-tag';
|
|
2
2
|
import { execute, ServiceDefinitionModule } from '../execution-utils';
|
|
3
|
-
import { astSerializer, queryPlanSerializer } from '
|
|
3
|
+
import { astSerializer, queryPlanSerializer } from 'apollo-federation-integration-testsuite';
|
|
4
4
|
|
|
5
5
|
expect.addSnapshotSerializer(astSerializer);
|
|
6
6
|
expect.addSnapshotSerializer(queryPlanSerializer);
|
|
@@ -49,7 +49,7 @@ const reviewService: ServiceDefinitionModule = {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const listsAreEqual = <T>(as: T[], bs: T[]) =>
|
|
52
|
-
as.length === bs.length && as.every((
|
|
52
|
+
as.length === bs.length && as.every((_, i) => bs[i] === as[i]);
|
|
53
53
|
|
|
54
54
|
const userService: ServiceDefinitionModule = {
|
|
55
55
|
name: 'user',
|
|
@@ -10,7 +10,7 @@ import * as log4js from "log4js";
|
|
|
10
10
|
|
|
11
11
|
const LOWEST_LOG_LEVEL = "debug";
|
|
12
12
|
|
|
13
|
-
const KNOWN_DEBUG_MESSAGE = "Checking
|
|
13
|
+
const KNOWN_DEBUG_MESSAGE = "Checking for composition updates...";
|
|
14
14
|
|
|
15
15
|
async function triggerKnownDebugMessage(logger: Logger) {
|
|
16
16
|
// Trigger a known error.
|
|
@@ -18,7 +18,7 @@ async function triggerKnownDebugMessage(logger: Logger) {
|
|
|
18
18
|
// message outside of the constructor, but it seemed worth testing
|
|
19
19
|
// the compatibility with `ApolloGateway` itself rather than generically.
|
|
20
20
|
// The error does not matter, so it is caught and ignored.
|
|
21
|
-
await new ApolloGateway({ logger }).load().catch(_e =>
|
|
21
|
+
await new ApolloGateway({ logger }).load().catch(_e => undefined);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
describe("logger", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import gql from 'graphql-tag';
|
|
2
2
|
import { execute, ServiceDefinitionModule } from '../execution-utils';
|
|
3
|
-
import { astSerializer, queryPlanSerializer } from '
|
|
3
|
+
import { astSerializer, queryPlanSerializer } from 'apollo-federation-integration-testsuite';
|
|
4
4
|
|
|
5
5
|
expect.addSnapshotSerializer(astSerializer);
|
|
6
6
|
expect.addSnapshotSerializer(queryPlanSerializer);
|
|
@@ -192,9 +192,8 @@ it('fetches data correctly with multiple @key fields', async () => {
|
|
|
192
192
|
} =>
|
|
193
193
|
{
|
|
194
194
|
... on User {
|
|
195
|
-
name
|
|
196
|
-
__typename
|
|
197
195
|
ssn
|
|
196
|
+
name
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
},
|
|
@@ -283,40 +282,40 @@ it('fetches keys as needed to reduce round trip queries', async () => {
|
|
|
283
282
|
{
|
|
284
283
|
users {
|
|
285
284
|
__typename
|
|
286
|
-
ssn
|
|
287
285
|
id
|
|
286
|
+
ssn
|
|
288
287
|
}
|
|
289
288
|
}
|
|
290
289
|
},
|
|
291
290
|
Parallel {
|
|
292
291
|
Flatten(path: "users.@") {
|
|
293
|
-
Fetch(service: "
|
|
292
|
+
Fetch(service: "reviews") {
|
|
294
293
|
{
|
|
295
294
|
... on User {
|
|
296
295
|
__typename
|
|
297
|
-
|
|
296
|
+
id
|
|
298
297
|
}
|
|
299
298
|
} =>
|
|
300
299
|
{
|
|
301
300
|
... on User {
|
|
302
|
-
|
|
301
|
+
reviews {
|
|
302
|
+
body
|
|
303
|
+
}
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
},
|
|
306
307
|
},
|
|
307
308
|
Flatten(path: "users.@") {
|
|
308
|
-
Fetch(service: "
|
|
309
|
+
Fetch(service: "actuary") {
|
|
309
310
|
{
|
|
310
311
|
... on User {
|
|
311
312
|
__typename
|
|
312
|
-
|
|
313
|
+
ssn
|
|
313
314
|
}
|
|
314
315
|
} =>
|
|
315
316
|
{
|
|
316
317
|
... on User {
|
|
317
|
-
|
|
318
|
-
body
|
|
319
|
-
}
|
|
318
|
+
risk
|
|
320
319
|
}
|
|
321
320
|
}
|
|
322
321
|
},
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { execute } from '../execution-utils';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
astSerializer,
|
|
4
|
+
queryPlanSerializer,
|
|
5
|
+
} from 'apollo-federation-integration-testsuite';
|
|
3
6
|
import { accounts, reviews } from 'apollo-federation-integration-testsuite';
|
|
4
7
|
|
|
5
8
|
expect.addSnapshotSerializer(astSerializer);
|
|
@@ -47,7 +50,7 @@ it('supports mutations', async () => {
|
|
|
47
50
|
it('returning across service boundaries', async () => {
|
|
48
51
|
const query = `#graphql
|
|
49
52
|
mutation Review($upc: String!, $body: String!) {
|
|
50
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
53
|
+
reviewProduct(input: { upc: $upc, body: $body }) {
|
|
51
54
|
... on Furniture {
|
|
52
55
|
name
|
|
53
56
|
}
|
|
@@ -92,7 +95,7 @@ it('multiple root mutations', async () => {
|
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
98
|
+
reviewProduct(input: { upc: $upc, body: $body }) {
|
|
96
99
|
... on Furniture {
|
|
97
100
|
name
|
|
98
101
|
}
|
|
@@ -148,7 +151,7 @@ it('multiple root mutations with correct service order', async () => {
|
|
|
148
151
|
$password: String!
|
|
149
152
|
$reviewId: ID!
|
|
150
153
|
) {
|
|
151
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
154
|
+
reviewProduct(input: { upc: $upc, body: $body }) {
|
|
152
155
|
... on Furniture {
|
|
153
156
|
upc
|
|
154
157
|
}
|
|
@@ -208,7 +211,7 @@ it('multiple root mutations with correct service order', async () => {
|
|
|
208
211
|
Sequence {
|
|
209
212
|
Fetch(service: "reviews") {
|
|
210
213
|
{
|
|
211
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
214
|
+
reviewProduct(input: {upc: $upc, body: $body}) {
|
|
212
215
|
__typename
|
|
213
216
|
... on Furniture {
|
|
214
217
|
upc
|