@apollo/gateway 0.42.3 → 0.44.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 +22 -1
- package/dist/__generated__/graphqlTypes.d.ts +9 -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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/loadSupergraphSdlFromStorage.d.ts +4 -3
- package/dist/loadSupergraphSdlFromStorage.d.ts.map +1 -1
- package/dist/loadSupergraphSdlFromStorage.js +7 -3
- package/dist/loadSupergraphSdlFromStorage.js.map +1 -1
- package/package.json +8 -8
- package/src/__generated__/graphqlTypes.ts +9 -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/__tests__/integration/networkRequests.test.ts +22 -10
- package/src/__tests__/integration/nockMocks.ts +33 -5
- package/src/__tests__/loadSupergraphSdlFromStorage.test.ts +30 -0
- package/src/executeQueryPlan.ts +30 -0
- package/src/index.ts +10 -1
- package/src/loadSupergraphSdlFromStorage.ts +7 -4
|
@@ -5,8 +5,8 @@ import { SupergraphSdlQuery } from './__generated__/graphqlTypes';
|
|
|
5
5
|
|
|
6
6
|
// Magic /* GraphQL */ comment below is for codegen, do not remove
|
|
7
7
|
export const SUPERGRAPH_SDL_QUERY = /* GraphQL */`#graphql
|
|
8
|
-
query SupergraphSdl($apiKey: String!, $ref: String
|
|
9
|
-
routerConfig(ref: $ref, apiKey: $apiKey) {
|
|
8
|
+
query SupergraphSdl($apiKey: String!, $ref: String!, $ifAfterId: ID) {
|
|
9
|
+
routerConfig(ref: $ref, apiKey: $apiKey, ifAfterId: $ifAfterId) {
|
|
10
10
|
__typename
|
|
11
11
|
... on RouterConfigResult {
|
|
12
12
|
id
|
|
@@ -43,11 +43,13 @@ export async function loadSupergraphSdlFromStorage({
|
|
|
43
43
|
apiKey,
|
|
44
44
|
endpoint,
|
|
45
45
|
fetcher,
|
|
46
|
+
compositionId,
|
|
46
47
|
}: {
|
|
47
48
|
graphRef: string;
|
|
48
49
|
apiKey: string;
|
|
49
50
|
endpoint: string;
|
|
50
51
|
fetcher: typeof fetch;
|
|
52
|
+
compositionId: string | null;
|
|
51
53
|
}) {
|
|
52
54
|
let result: Response;
|
|
53
55
|
const requestDetails = {
|
|
@@ -57,6 +59,7 @@ export async function loadSupergraphSdlFromStorage({
|
|
|
57
59
|
variables: {
|
|
58
60
|
ref: graphRef,
|
|
59
61
|
apiKey,
|
|
62
|
+
ifAfterId: compositionId,
|
|
60
63
|
},
|
|
61
64
|
}),
|
|
62
65
|
headers: {
|
|
@@ -124,13 +127,13 @@ export async function loadSupergraphSdlFromStorage({
|
|
|
124
127
|
supergraphSdl,
|
|
125
128
|
// messages,
|
|
126
129
|
} = routerConfig;
|
|
127
|
-
|
|
128
|
-
// `supergraphSdl` should not be nullable in the schema, but it currently is
|
|
129
130
|
return { id, supergraphSdl: supergraphSdl! };
|
|
130
131
|
} else if (routerConfig.__typename === 'FetchError') {
|
|
131
132
|
// FetchError case
|
|
132
133
|
const { code, message } = routerConfig;
|
|
133
134
|
throw new Error(`${code}: ${message}`);
|
|
135
|
+
} else if (routerConfig.__typename === 'Unchanged') {
|
|
136
|
+
return null;
|
|
134
137
|
} else {
|
|
135
138
|
throw new Error('Programming error: unhandled response failure');
|
|
136
139
|
}
|