@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
|
@@ -37,7 +37,9 @@ Scenario: should use a single fetch when requesting a root field from one servic
|
|
|
37
37
|
"""
|
|
38
38
|
query {
|
|
39
39
|
me {
|
|
40
|
-
name
|
|
40
|
+
name {
|
|
41
|
+
first
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
"""
|
|
@@ -49,7 +51,7 @@ Scenario: should use a single fetch when requesting a root field from one servic
|
|
|
49
51
|
"kind": "Fetch",
|
|
50
52
|
"serviceName": "accounts",
|
|
51
53
|
"variableUsages": [],
|
|
52
|
-
"operation": "{me{name}}"
|
|
54
|
+
"operation": "{me{name{first}}}"
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
"""
|
|
@@ -59,7 +61,9 @@ Scenario: should use two independent fetches when requesting root fields from tw
|
|
|
59
61
|
"""
|
|
60
62
|
query {
|
|
61
63
|
me {
|
|
62
|
-
name
|
|
64
|
+
name {
|
|
65
|
+
first
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
topProducts {
|
|
65
69
|
name
|
|
@@ -77,7 +81,7 @@ Scenario: should use two independent fetches when requesting root fields from tw
|
|
|
77
81
|
"kind": "Fetch",
|
|
78
82
|
"serviceName": "accounts",
|
|
79
83
|
"variableUsages": [],
|
|
80
|
-
"operation": "{me{name}}"
|
|
84
|
+
"operation": "{me{name{first}}}"
|
|
81
85
|
},
|
|
82
86
|
{
|
|
83
87
|
"kind": "Sequence",
|
|
@@ -105,7 +109,7 @@ Scenario: should use two independent fetches when requesting root fields from tw
|
|
|
105
109
|
}
|
|
106
110
|
],
|
|
107
111
|
"variableUsages": [],
|
|
108
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{
|
|
112
|
+
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{title year}}}"
|
|
109
113
|
}
|
|
110
114
|
},
|
|
111
115
|
{
|
|
@@ -120,9 +124,9 @@ Scenario: should use two independent fetches when requesting root fields from tw
|
|
|
120
124
|
"typeCondition": "Book",
|
|
121
125
|
"selections": [
|
|
122
126
|
{ "kind": "Field", "name": "__typename" },
|
|
123
|
-
{ "kind": "Field", "name": "isbn" },
|
|
124
127
|
{ "kind": "Field", "name": "title" },
|
|
125
|
-
{ "kind": "Field", "name": "year" }
|
|
128
|
+
{ "kind": "Field", "name": "year" },
|
|
129
|
+
{ "kind": "Field", "name": "isbn" }
|
|
126
130
|
]
|
|
127
131
|
}
|
|
128
132
|
],
|
|
@@ -185,7 +189,7 @@ Scenario: should use a single fetch when requesting multiple root fields from th
|
|
|
185
189
|
}
|
|
186
190
|
],
|
|
187
191
|
"variableUsages": [],
|
|
188
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{
|
|
192
|
+
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{title year}}}"
|
|
189
193
|
}
|
|
190
194
|
},
|
|
191
195
|
{
|
|
@@ -200,9 +204,9 @@ Scenario: should use a single fetch when requesting multiple root fields from th
|
|
|
200
204
|
"typeCondition": "Book",
|
|
201
205
|
"selections": [
|
|
202
206
|
{ "kind": "Field", "name": "__typename" },
|
|
203
|
-
{ "kind": "Field", "name": "isbn" },
|
|
204
207
|
{ "kind": "Field", "name": "title" },
|
|
205
|
-
{ "kind": "Field", "name": "year" }
|
|
208
|
+
{ "kind": "Field", "name": "year" },
|
|
209
|
+
{ "kind": "Field", "name": "isbn" }
|
|
206
210
|
]
|
|
207
211
|
}
|
|
208
212
|
],
|
|
@@ -232,7 +236,7 @@ Scenario: should use a single fetch when requesting multiple root fields from th
|
|
|
232
236
|
}
|
|
233
237
|
],
|
|
234
238
|
"variableUsages": [],
|
|
235
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{
|
|
239
|
+
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{title year}}}"
|
|
236
240
|
}
|
|
237
241
|
},
|
|
238
242
|
{
|
|
@@ -247,9 +251,9 @@ Scenario: should use a single fetch when requesting multiple root fields from th
|
|
|
247
251
|
"typeCondition": "Book",
|
|
248
252
|
"selections": [
|
|
249
253
|
{ "kind": "Field", "name": "__typename" },
|
|
250
|
-
{ "kind": "Field", "name": "isbn" },
|
|
251
254
|
{ "kind": "Field", "name": "title" },
|
|
252
|
-
{ "kind": "Field", "name": "year" }
|
|
255
|
+
{ "kind": "Field", "name": "year" },
|
|
256
|
+
{ "kind": "Field", "name": "isbn" }
|
|
253
257
|
]
|
|
254
258
|
}
|
|
255
259
|
],
|
|
@@ -326,7 +330,9 @@ Scenario: when requesting an extension field from another service, it should add
|
|
|
326
330
|
"""
|
|
327
331
|
query {
|
|
328
332
|
me {
|
|
329
|
-
name
|
|
333
|
+
name {
|
|
334
|
+
first
|
|
335
|
+
}
|
|
330
336
|
reviews {
|
|
331
337
|
body
|
|
332
338
|
}
|
|
@@ -344,7 +350,7 @@ Scenario: when requesting an extension field from another service, it should add
|
|
|
344
350
|
"kind": "Fetch",
|
|
345
351
|
"serviceName": "accounts",
|
|
346
352
|
"variableUsages": [],
|
|
347
|
-
"operation": "{me{
|
|
353
|
+
"operation": "{me{__typename id name{first}}}"
|
|
348
354
|
},
|
|
349
355
|
{
|
|
350
356
|
"kind": "Flatten",
|
|
@@ -477,7 +483,9 @@ Scenario: when requesting a composite field with subfields from another service,
|
|
|
477
483
|
topReviews {
|
|
478
484
|
body
|
|
479
485
|
author {
|
|
480
|
-
name
|
|
486
|
+
name {
|
|
487
|
+
first
|
|
488
|
+
}
|
|
481
489
|
}
|
|
482
490
|
}
|
|
483
491
|
}
|
|
@@ -512,7 +520,7 @@ Scenario: when requesting a composite field with subfields from another service,
|
|
|
512
520
|
}
|
|
513
521
|
],
|
|
514
522
|
"variableUsages": [],
|
|
515
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on User{name}}}"
|
|
523
|
+
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on User{name{first}}}}"
|
|
516
524
|
}
|
|
517
525
|
}
|
|
518
526
|
]
|
|
@@ -574,7 +582,9 @@ Scenario: when requesting a composite field with subfields from another service,
|
|
|
574
582
|
query {
|
|
575
583
|
topReviews {
|
|
576
584
|
author {
|
|
577
|
-
name
|
|
585
|
+
name {
|
|
586
|
+
first
|
|
587
|
+
}
|
|
578
588
|
}
|
|
579
589
|
}
|
|
580
590
|
}
|
|
@@ -609,7 +619,7 @@ Scenario: when requesting a composite field with subfields from another service,
|
|
|
609
619
|
}
|
|
610
620
|
],
|
|
611
621
|
"variableUsages": [],
|
|
612
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on User{name}}}"
|
|
622
|
+
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on User{name{first}}}}"
|
|
613
623
|
}
|
|
614
624
|
}
|
|
615
625
|
]
|
|
@@ -683,7 +693,7 @@ Scenario: for abstract types, it should add __typename when fetching objects of
|
|
|
683
693
|
"kind": "Fetch",
|
|
684
694
|
"serviceName": "product",
|
|
685
695
|
"variableUsages": [],
|
|
686
|
-
"operation": "{topProducts{__typename
|
|
696
|
+
"operation": "{topProducts{__typename price}}"
|
|
687
697
|
}
|
|
688
698
|
}
|
|
689
699
|
"""
|
|
@@ -711,7 +721,7 @@ Scenario: should break up when traversing an extension field on an interface typ
|
|
|
711
721
|
"kind": "Fetch",
|
|
712
722
|
"serviceName": "product",
|
|
713
723
|
"variableUsages": [],
|
|
714
|
-
"operation": "{topProducts{__typename ...on Book{
|
|
724
|
+
"operation": "{topProducts{__typename price ...on Book{__typename isbn}...on Furniture{__typename upc}}}"
|
|
715
725
|
},
|
|
716
726
|
{
|
|
717
727
|
"kind": "Flatten",
|
|
@@ -819,288 +829,7 @@ Scenario: interface inside interface should expand into possible types only
|
|
|
819
829
|
"kind": "Fetch",
|
|
820
830
|
"serviceName": "product",
|
|
821
831
|
"variableUsages": [],
|
|
822
|
-
"operation": "{product(upc:\"\"){__typename
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
"""
|
|
826
|
-
|
|
827
|
-
Scenario: experimental compression to downstream services should generate fragments internally to downstream requests
|
|
828
|
-
Given query
|
|
829
|
-
"""
|
|
830
|
-
query {
|
|
831
|
-
topReviews {
|
|
832
|
-
body
|
|
833
|
-
author
|
|
834
|
-
product {
|
|
835
|
-
name
|
|
836
|
-
price
|
|
837
|
-
details {
|
|
838
|
-
country
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
"""
|
|
844
|
-
When using autofragmentization
|
|
845
|
-
Then query plan
|
|
846
|
-
"""
|
|
847
|
-
{
|
|
848
|
-
"kind": "QueryPlan",
|
|
849
|
-
"node": {
|
|
850
|
-
"kind": "Sequence",
|
|
851
|
-
"nodes": [
|
|
852
|
-
{
|
|
853
|
-
"kind": "Fetch",
|
|
854
|
-
"serviceName": "reviews",
|
|
855
|
-
"variableUsages": [],
|
|
856
|
-
"operation": "{topReviews{...__QueryPlanFragment_1__}}fragment __QueryPlanFragment_1__ on Review{body author product{...__QueryPlanFragment_0__}}fragment __QueryPlanFragment_0__ on Product{__typename ...on Book{__typename isbn}...on Furniture{__typename upc}}"
|
|
857
|
-
},
|
|
858
|
-
{
|
|
859
|
-
"kind": "Parallel",
|
|
860
|
-
"nodes": [
|
|
861
|
-
{
|
|
862
|
-
"kind": "Sequence",
|
|
863
|
-
"nodes": [
|
|
864
|
-
{
|
|
865
|
-
"kind": "Flatten",
|
|
866
|
-
"path": ["topReviews", "@", "product"],
|
|
867
|
-
"node": {
|
|
868
|
-
"kind": "Fetch",
|
|
869
|
-
"serviceName": "books",
|
|
870
|
-
"requires": [
|
|
871
|
-
{
|
|
872
|
-
"kind": "InlineFragment",
|
|
873
|
-
"typeCondition": "Book",
|
|
874
|
-
"selections": [
|
|
875
|
-
{ "kind": "Field", "name": "__typename" },
|
|
876
|
-
{ "kind": "Field", "name": "isbn" }
|
|
877
|
-
]
|
|
878
|
-
}
|
|
879
|
-
],
|
|
880
|
-
"variableUsages": [],
|
|
881
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{__typename isbn title year}}}"
|
|
882
|
-
}
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
"kind": "Flatten",
|
|
886
|
-
"path": ["topReviews", "@", "product"],
|
|
887
|
-
"node": {
|
|
888
|
-
"kind": "Fetch",
|
|
889
|
-
"serviceName": "product",
|
|
890
|
-
"requires": [
|
|
891
|
-
{
|
|
892
|
-
"kind": "InlineFragment",
|
|
893
|
-
"typeCondition": "Book",
|
|
894
|
-
"selections": [
|
|
895
|
-
{ "kind": "Field", "name": "__typename" },
|
|
896
|
-
{ "kind": "Field", "name": "isbn" },
|
|
897
|
-
{ "kind": "Field", "name": "title" },
|
|
898
|
-
{ "kind": "Field", "name": "year" }
|
|
899
|
-
]
|
|
900
|
-
}
|
|
901
|
-
],
|
|
902
|
-
"variableUsages": [],
|
|
903
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{name}}}"
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
]
|
|
907
|
-
},
|
|
908
|
-
{
|
|
909
|
-
"kind": "Flatten",
|
|
910
|
-
"path": ["topReviews", "@", "product"],
|
|
911
|
-
"node": {
|
|
912
|
-
"kind": "Fetch",
|
|
913
|
-
"serviceName": "product",
|
|
914
|
-
"requires": [
|
|
915
|
-
{
|
|
916
|
-
"kind": "InlineFragment",
|
|
917
|
-
"typeCondition": "Furniture",
|
|
918
|
-
"selections": [
|
|
919
|
-
{ "kind": "Field", "name": "__typename" },
|
|
920
|
-
{ "kind": "Field", "name": "upc" }
|
|
921
|
-
]
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
"kind": "InlineFragment",
|
|
925
|
-
"typeCondition": "Book",
|
|
926
|
-
"selections": [
|
|
927
|
-
{ "kind": "Field", "name": "__typename" },
|
|
928
|
-
{ "kind": "Field", "name": "isbn" }
|
|
929
|
-
]
|
|
930
|
-
}
|
|
931
|
-
],
|
|
932
|
-
"variableUsages": [],
|
|
933
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Furniture{name price details{country}}...on Book{price details{country}}}}"
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
]
|
|
937
|
-
}
|
|
938
|
-
]
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
"""
|
|
942
|
-
|
|
943
|
-
Scenario: experimental compression to downstream services shouldn't generate fragments for selection sets of length 2 or less
|
|
944
|
-
Given query
|
|
945
|
-
"""
|
|
946
|
-
query {
|
|
947
|
-
topReviews {
|
|
948
|
-
body
|
|
949
|
-
author
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
"""
|
|
953
|
-
When using autofragmentization
|
|
954
|
-
Then query plan
|
|
955
|
-
"""
|
|
956
|
-
{
|
|
957
|
-
"kind": "QueryPlan",
|
|
958
|
-
"node": {
|
|
959
|
-
"kind": "Fetch",
|
|
960
|
-
"serviceName": "reviews",
|
|
961
|
-
"variableUsages": [],
|
|
962
|
-
"operation": "{topReviews{body author}}"
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
"""
|
|
966
|
-
|
|
967
|
-
Scenario: experimental compression to downstream services should generate fragments for selection sets of length 3 or greater
|
|
968
|
-
Given query
|
|
969
|
-
"""
|
|
970
|
-
query {
|
|
971
|
-
topReviews {
|
|
972
|
-
id
|
|
973
|
-
body
|
|
974
|
-
author
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
"""
|
|
978
|
-
When using autofragmentization
|
|
979
|
-
Then query plan
|
|
980
|
-
"""
|
|
981
|
-
{
|
|
982
|
-
"kind": "QueryPlan",
|
|
983
|
-
"node": {
|
|
984
|
-
"kind": "Fetch",
|
|
985
|
-
"serviceName": "reviews",
|
|
986
|
-
"variableUsages": [],
|
|
987
|
-
"operation": "{topReviews{...__QueryPlanFragment_0__}}fragment __QueryPlanFragment_0__ on Review{id body author}"
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
"""
|
|
991
|
-
|
|
992
|
-
Scenario: experimental compression to downstream services should generate fragments correctly when aliases are used
|
|
993
|
-
Given query
|
|
994
|
-
"""
|
|
995
|
-
query {
|
|
996
|
-
reviews: topReviews {
|
|
997
|
-
content: body
|
|
998
|
-
author
|
|
999
|
-
product {
|
|
1000
|
-
name
|
|
1001
|
-
cost: price
|
|
1002
|
-
details {
|
|
1003
|
-
origin: country
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
"""
|
|
1009
|
-
When using autofragmentization
|
|
1010
|
-
Then query plan
|
|
1011
|
-
"""
|
|
1012
|
-
{
|
|
1013
|
-
"kind": "QueryPlan",
|
|
1014
|
-
"node": {
|
|
1015
|
-
"kind": "Sequence",
|
|
1016
|
-
"nodes": [
|
|
1017
|
-
{
|
|
1018
|
-
"kind": "Fetch",
|
|
1019
|
-
"serviceName": "reviews",
|
|
1020
|
-
"variableUsages": [],
|
|
1021
|
-
"operation": "{reviews:topReviews{...__QueryPlanFragment_1__}}fragment __QueryPlanFragment_1__ on Review{content:body author product{...__QueryPlanFragment_0__}}fragment __QueryPlanFragment_0__ on Product{__typename ...on Book{__typename isbn}...on Furniture{__typename upc}}"
|
|
1022
|
-
},
|
|
1023
|
-
{
|
|
1024
|
-
"kind": "Parallel",
|
|
1025
|
-
"nodes": [
|
|
1026
|
-
{
|
|
1027
|
-
"kind": "Sequence",
|
|
1028
|
-
"nodes": [
|
|
1029
|
-
{
|
|
1030
|
-
"kind": "Flatten",
|
|
1031
|
-
"path": ["reviews", "@", "product"],
|
|
1032
|
-
"node": {
|
|
1033
|
-
"kind": "Fetch",
|
|
1034
|
-
"serviceName": "books",
|
|
1035
|
-
"requires": [
|
|
1036
|
-
{
|
|
1037
|
-
"kind": "InlineFragment",
|
|
1038
|
-
"typeCondition": "Book",
|
|
1039
|
-
"selections": [
|
|
1040
|
-
{ "kind": "Field", "name": "__typename" },
|
|
1041
|
-
{ "kind": "Field", "name": "isbn" }
|
|
1042
|
-
]
|
|
1043
|
-
}
|
|
1044
|
-
],
|
|
1045
|
-
"variableUsages": [],
|
|
1046
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{__typename isbn title year}}}"
|
|
1047
|
-
}
|
|
1048
|
-
},
|
|
1049
|
-
{
|
|
1050
|
-
"kind": "Flatten",
|
|
1051
|
-
"path": ["reviews", "@", "product"],
|
|
1052
|
-
"node": {
|
|
1053
|
-
"kind": "Fetch",
|
|
1054
|
-
"serviceName": "product",
|
|
1055
|
-
"requires": [
|
|
1056
|
-
{
|
|
1057
|
-
"kind": "InlineFragment",
|
|
1058
|
-
"typeCondition": "Book",
|
|
1059
|
-
"selections": [
|
|
1060
|
-
{ "kind": "Field", "name": "__typename" },
|
|
1061
|
-
{ "kind": "Field", "name": "isbn" },
|
|
1062
|
-
{ "kind": "Field", "name": "title" },
|
|
1063
|
-
{ "kind": "Field", "name": "year" }
|
|
1064
|
-
]
|
|
1065
|
-
}
|
|
1066
|
-
],
|
|
1067
|
-
"variableUsages": [],
|
|
1068
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Book{name}}}"
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
]
|
|
1072
|
-
},
|
|
1073
|
-
{
|
|
1074
|
-
"kind": "Flatten",
|
|
1075
|
-
"path": ["reviews", "@", "product"],
|
|
1076
|
-
"node": {
|
|
1077
|
-
"kind": "Fetch",
|
|
1078
|
-
"serviceName": "product",
|
|
1079
|
-
"requires": [
|
|
1080
|
-
{
|
|
1081
|
-
"kind": "InlineFragment",
|
|
1082
|
-
"typeCondition": "Furniture",
|
|
1083
|
-
"selections": [
|
|
1084
|
-
{ "kind": "Field", "name": "__typename" },
|
|
1085
|
-
{ "kind": "Field", "name": "upc" }
|
|
1086
|
-
]
|
|
1087
|
-
},
|
|
1088
|
-
{
|
|
1089
|
-
"kind": "InlineFragment",
|
|
1090
|
-
"typeCondition": "Book",
|
|
1091
|
-
"selections": [
|
|
1092
|
-
{ "kind": "Field", "name": "__typename" },
|
|
1093
|
-
{ "kind": "Field", "name": "isbn" }
|
|
1094
|
-
]
|
|
1095
|
-
}
|
|
1096
|
-
],
|
|
1097
|
-
"variableUsages": [],
|
|
1098
|
-
"operation": "query($representations:[_Any!]!){_entities(representations:$representations){...on Furniture{name cost:price details{origin:country}}...on Book{cost:price details{origin:country}}}}"
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
]
|
|
1102
|
-
}
|
|
1103
|
-
]
|
|
832
|
+
"operation": "{product(upc:\"\"){__typename details{__typename country}}}"
|
|
1104
833
|
}
|
|
1105
834
|
}
|
|
1106
835
|
"""
|
|
@@ -1151,7 +880,7 @@ Scenario: deduplicates fields / selections regardless of adjacency and type cond
|
|
|
1151
880
|
"""
|
|
1152
881
|
query {
|
|
1153
882
|
body {
|
|
1154
|
-
... on
|
|
883
|
+
... on NamedObject {
|
|
1155
884
|
... on Text {
|
|
1156
885
|
attributes {
|
|
1157
886
|
bold
|
|
@@ -1200,7 +929,7 @@ Scenario: deduplicates fields / selections regardless of adjacency and type cond
|
|
|
1200
929
|
|
|
1201
930
|
query {
|
|
1202
931
|
body {
|
|
1203
|
-
... on
|
|
932
|
+
... on NamedObject {
|
|
1204
933
|
...TextFragment
|
|
1205
934
|
}
|
|
1206
935
|
... on Body {
|
|
@@ -1347,7 +1076,7 @@ Scenario: returning across service boundaries
|
|
|
1347
1076
|
Given query
|
|
1348
1077
|
"""
|
|
1349
1078
|
mutation Review($upc: String!, $body: String!) {
|
|
1350
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
1079
|
+
reviewProduct(input: {upc: $upc, body: $body}) {
|
|
1351
1080
|
... on Furniture {
|
|
1352
1081
|
name
|
|
1353
1082
|
}
|
|
@@ -1368,7 +1097,7 @@ Scenario: returning across service boundaries
|
|
|
1368
1097
|
"upc",
|
|
1369
1098
|
"body"
|
|
1370
1099
|
],
|
|
1371
|
-
"operation": "mutation($upc:String!$body:String!){reviewProduct(upc:$upc body:$body){__typename ...on Furniture{__typename upc}}}"
|
|
1100
|
+
"operation": "mutation($upc:String!$body:String!){reviewProduct(input:{upc:$upc body:$body}){__typename ...on Furniture{__typename upc}}}"
|
|
1372
1101
|
},
|
|
1373
1102
|
{
|
|
1374
1103
|
"kind": "Flatten",
|
|
@@ -1420,7 +1149,7 @@ Scenario: supports multiple root mutations
|
|
|
1420
1149
|
}
|
|
1421
1150
|
}
|
|
1422
1151
|
}
|
|
1423
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
1152
|
+
reviewProduct(input: {upc: $upc, body: $body}) {
|
|
1424
1153
|
... on Furniture {
|
|
1425
1154
|
name
|
|
1426
1155
|
}
|
|
@@ -1509,7 +1238,7 @@ Scenario: supports multiple root mutations
|
|
|
1509
1238
|
"upc",
|
|
1510
1239
|
"body"
|
|
1511
1240
|
],
|
|
1512
|
-
"operation": "mutation($upc:String!$body:String!){reviewProduct(upc:$upc body:$body){__typename ...on Furniture{__typename upc}}}"
|
|
1241
|
+
"operation": "mutation($upc:String!$body:String!){reviewProduct(input:{upc:$upc body:$body}){__typename ...on Furniture{__typename upc}}}"
|
|
1513
1242
|
},
|
|
1514
1243
|
{
|
|
1515
1244
|
"kind": "Flatten",
|
|
@@ -1556,7 +1285,7 @@ Scenario: multiple root mutations with correct service order
|
|
|
1556
1285
|
$password: String!
|
|
1557
1286
|
$reviewId: ID!
|
|
1558
1287
|
) {
|
|
1559
|
-
reviewProduct(upc: $upc, body: $body) {
|
|
1288
|
+
reviewProduct(input: {upc: $upc, body: $body}) {
|
|
1560
1289
|
... on Furniture {
|
|
1561
1290
|
upc
|
|
1562
1291
|
}
|
|
@@ -1590,7 +1319,7 @@ Scenario: multiple root mutations with correct service order
|
|
|
1590
1319
|
"body",
|
|
1591
1320
|
"updatedReview"
|
|
1592
1321
|
],
|
|
1593
|
-
"operation": "mutation($upc:String!$body:String!$updatedReview:UpdateReviewInput!){reviewProduct(upc:$upc body:$body){__typename ...on Furniture{upc}}updateReview(review:$updatedReview){id body}}"
|
|
1322
|
+
"operation": "mutation($upc:String!$body:String!$updatedReview:UpdateReviewInput!){reviewProduct(input:{upc:$upc body:$body}){__typename ...on Furniture{upc}}updateReview(review:$updatedReview){id body}}"
|
|
1594
1323
|
},
|
|
1595
1324
|
{
|
|
1596
1325
|
"kind": "Fetch",
|