@apollo/gateway 2.0.0-preview.8 → 2.0.0-preview.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/gateway",
3
- "version": "2.0.0-preview.8",
3
+ "version": "2.0.0-preview.9",
4
4
  "description": "Apollo Gateway",
5
5
  "author": "Apollo <packages@apollographql.com>",
6
6
  "main": "dist/index.js",
@@ -18,16 +18,16 @@
18
18
  "apollo"
19
19
  ],
20
20
  "engines": {
21
- "node": ">=12.13.0 <17.0"
21
+ "node": ">=12.13.0 <18.0"
22
22
  },
23
23
  "license": "SEE LICENSE IN ./LICENSE",
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@apollo/composition": "^2.0.0-preview.8",
28
+ "@apollo/composition": "^2.0.0-preview.9",
29
29
  "@apollo/core-schema": "^0.2.2",
30
- "@apollo/query-planner": "^2.0.0-preview.8",
30
+ "@apollo/query-planner": "^2.0.0-preview.9",
31
31
  "@josephg/resolvable": "^1.0.1",
32
32
  "@opentelemetry/api": "^1.0.1",
33
33
  "@types/node-fetch": "2.6.1",
@@ -47,5 +47,5 @@
47
47
  "peerDependencies": {
48
48
  "graphql": "^16.0.0"
49
49
  },
50
- "gitHead": "516a30d879b4bde5945adb55b80d0f64118c322f"
50
+ "gitHead": "dd5ea3a7675af3e19e82d8150f72fe217074ae02"
51
51
  }
@@ -1,4 +1,7 @@
1
- import { astSerializer, queryPlanSerializer } from 'apollo-federation-integration-testsuite';
1
+ import {
2
+ astSerializer,
3
+ queryPlanSerializer,
4
+ } from 'apollo-federation-integration-testsuite';
2
5
  import { getFederatedTestingSchema } from './execution-utils';
3
6
  import { QueryPlan, QueryPlanner } from '@apollo/query-planner';
4
7
  import { Schema, parseOperation } from '@apollo/federation-internals';
@@ -6,14 +9,13 @@ import { Schema, parseOperation } from '@apollo/federation-internals';
6
9
  expect.addSnapshotSerializer(astSerializer);
7
10
  expect.addSnapshotSerializer(queryPlanSerializer);
8
11
 
9
-
10
12
  describe('buildQueryPlan', () => {
11
13
  let schema: Schema;
12
14
  let queryPlanner: QueryPlanner;
13
15
 
14
16
  const buildPlan = (operation: string): QueryPlan => {
15
17
  return queryPlanner.buildQueryPlan(parseOperation(schema, operation));
16
- }
18
+ };
17
19
 
18
20
  beforeEach(() => {
19
21
  expect(
@@ -515,7 +517,7 @@ describe('buildQueryPlan', () => {
515
517
 
516
518
  describe(`when requesting a composite field with subfields from another service`, () => {
517
519
  it(`should add key fields to the parent selection set and use a dependent fetch`, () => {
518
- const operationString = `#graphql
520
+ const operationString = `#graphql
519
521
  query {
520
522
  topReviews {
521
523
  body
@@ -1171,4 +1173,49 @@ describe('buildQueryPlan', () => {
1171
1173
  `);
1172
1174
  });
1173
1175
  });
1176
+
1177
+ describe('overridden fields and type', () => {
1178
+ it(`query plan of overridden field`, () => {
1179
+ const operationString = `#graphql
1180
+ query {
1181
+ library (id: "3") {
1182
+ name
1183
+ description
1184
+ }
1185
+ }
1186
+ `;
1187
+
1188
+ const queryPlan = buildPlan(operationString);
1189
+ expect(queryPlan).toMatchInlineSnapshot(`
1190
+ QueryPlan {
1191
+ Sequence {
1192
+ Fetch(service: "books") {
1193
+ {
1194
+ library(id: 3) {
1195
+ __typename
1196
+ id
1197
+ name
1198
+ }
1199
+ }
1200
+ },
1201
+ Flatten(path: "library") {
1202
+ Fetch(service: "accounts") {
1203
+ {
1204
+ ... on Library {
1205
+ __typename
1206
+ id
1207
+ }
1208
+ } =>
1209
+ {
1210
+ ... on Library {
1211
+ description
1212
+ }
1213
+ }
1214
+ },
1215
+ },
1216
+ },
1217
+ }
1218
+ `);
1219
+ });
1220
+ });
1174
1221
  });
@@ -147,7 +147,7 @@ describe('lifecycle hooks', () => {
147
147
  // the supergraph (even just formatting differences), this ID will change
148
148
  // and this test will have to updated.
149
149
  expect(secondCall[0]!.compositionId).toEqual(
150
- 'cf96012e98a17d3739f90afed59ef6a5d969d42a5780f9a069a790f2a959d711',
150
+ '730a2fe4036db8e2c847096ba2a62f78ff8f3c08c9ee092a5b1b37e1aa00ef5a',
151
151
  );
152
152
  // second call should have previous info in the second arg
153
153
  expect(secondCall[1]!.compositionId).toEqual(expectedFirstId);
@@ -91,12 +91,7 @@ const userService: ServiceDefinitionModule = {
91
91
  );
92
92
  },
93
93
  organization(user) {
94
- return { id: user.organizationId };
95
- },
96
- },
97
- Organization: {
98
- __resolveObject(object) {
99
- return organizations.find(org => org.id === object.id);
94
+ return organizations.find(org => org.id === user.organizationId);
100
95
  },
101
96
  },
102
97
  },
@@ -31,7 +31,7 @@ describe('core v0.1', () => {
31
31
 
32
32
  directive @tag(
33
33
  name: String!
34
- ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION
34
+ ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
35
35
 
36
36
  enum CacheControlScope {
37
37
  PRIVATE
@@ -87,7 +87,7 @@ describe('core v0.1', () => {
87
87
 
88
88
  directive @tag(
89
89
  name: String!
90
- ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION
90
+ ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
91
91
 
92
92
  enum CacheControlScope {
93
93
  PRIVATE
@@ -124,7 +124,7 @@ describe('core v0.2', () => {
124
124
  schema
125
125
  @core(feature: "https://specs.apollo.dev/core/v0.2")
126
126
  @core(feature: "https://specs.apollo.dev/join/v0.1", for: EXECUTION)
127
- @core(feature: "https://specs.apollo.dev/tag/v0.1") {
127
+ @core(feature: "https://specs.apollo.dev/tag/v0.2") {
128
128
  query: Query
129
129
  }
130
130
 
@@ -151,7 +151,7 @@ describe('core v0.2', () => {
151
151
 
152
152
  directive @tag(
153
153
  name: String!
154
- ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION
154
+ ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
155
155
 
156
156
  enum CacheControlScope {
157
157
  PRIVATE
@@ -193,7 +193,7 @@ describe('core v0.2', () => {
193
193
  schema
194
194
  @core(feature: "https://specs.apollo.dev/core/v0.2")
195
195
  @core(feature: "https://specs.apollo.dev/join/v0.1", for: EXECUTION)
196
- @core(feature: "https://specs.apollo.dev/tag/v0.1")
196
+ @core(feature: "https://specs.apollo.dev/tag/v0.2")
197
197
  @core(feature: "https://specs.apollo.dev/unsupported-feature/v0.1") {
198
198
  query: Query
199
199
  }
@@ -221,7 +221,7 @@ describe('core v0.2', () => {
221
221
 
222
222
  directive @tag(
223
223
  name: String!
224
- ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION
224
+ ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
225
225
 
226
226
  enum CacheControlScope {
227
227
  PRIVATE
@@ -293,7 +293,7 @@ describe('core v0.2', () => {
293
293
 
294
294
  directive @tag(
295
295
  name: String!
296
- ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION
296
+ ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
297
297
 
298
298
  enum CacheControlScope {
299
299
  PRIVATE
@@ -369,7 +369,7 @@ describe('core v0.2', () => {
369
369
 
370
370
  directive @tag(
371
371
  name: String!
372
- ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION
372
+ ) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
373
373
 
374
374
  enum CacheControlScope {
375
375
  PRIVATE