@apollo/gateway 0.26.0-alpha.2 → 0.26.3

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/config.d.ts +2 -2
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/datasources/RemoteGraphQLDataSource.d.ts.map +1 -1
  6. package/dist/datasources/RemoteGraphQLDataSource.js +6 -5
  7. package/dist/datasources/RemoteGraphQLDataSource.js.map +1 -1
  8. package/dist/executeQueryPlan.d.ts +1 -1
  9. package/dist/executeQueryPlan.d.ts.map +1 -1
  10. package/dist/index.d.ts +4 -15
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +15 -20
  13. package/dist/index.js.map +1 -1
  14. package/dist/loadServicesFromRemoteEndpoint.d.ts +8 -8
  15. package/dist/loadServicesFromRemoteEndpoint.d.ts.map +1 -1
  16. package/dist/loadServicesFromRemoteEndpoint.js +3 -3
  17. package/dist/loadServicesFromRemoteEndpoint.js.map +1 -1
  18. package/dist/operationContext.d.ts +17 -0
  19. package/dist/operationContext.d.ts.map +1 -0
  20. package/dist/{buildQueryPlan.js → operationContext.js} +3 -19
  21. package/dist/operationContext.js.map +1 -0
  22. package/dist/utilities/assert.d.ts +2 -0
  23. package/dist/utilities/assert.d.ts.map +1 -0
  24. package/dist/utilities/assert.js +10 -0
  25. package/dist/utilities/assert.js.map +1 -0
  26. package/dist/utilities/graphql.d.ts +0 -1
  27. package/dist/utilities/graphql.d.ts.map +1 -1
  28. package/dist/utilities/graphql.js +6 -9
  29. package/dist/utilities/graphql.js.map +1 -1
  30. package/package.json +8 -8
  31. package/src/__tests__/buildQueryPlan.test.ts +28 -76
  32. package/src/__tests__/executeQueryPlan.test.ts +22 -58
  33. package/src/__tests__/execution-utils.ts +8 -9
  34. package/src/__tests__/gateway/queryPlanCache.test.ts +3 -6
  35. package/src/__tests__/integration/configuration.test.ts +96 -0
  36. package/src/__tests__/integration/nockMocks.ts +1 -1
  37. package/src/__tests__/loadServicesFromRemoteEndpoint.test.ts +5 -1
  38. package/src/__tests__/loadSupergraphSdlFromStorage.test.ts +4 -4
  39. package/src/__tests__/queryPlanCucumber.test.ts +4 -8
  40. package/src/config.ts +8 -6
  41. package/src/datasources/RemoteGraphQLDataSource.ts +7 -6
  42. package/src/executeQueryPlan.ts +1 -1
  43. package/src/index.ts +16 -33
  44. package/src/loadServicesFromRemoteEndpoint.ts +12 -10
  45. package/src/{buildQueryPlan.ts → operationContext.ts} +6 -35
  46. package/src/utilities/assert.ts +14 -0
  47. package/src/utilities/graphql.ts +16 -9
  48. package/dist/buildQueryPlan.d.ts +0 -17
  49. package/dist/buildQueryPlan.d.ts.map +0 -1
  50. package/dist/buildQueryPlan.js.map +0 -1
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseSelections = exports.printWithReducedWhitespace = exports.astFromType = exports.allNodesAreOfSameKind = exports.getResponseName = void 0;
3
+ exports.parseSelections = exports.astFromType = exports.allNodesAreOfSameKind = exports.getResponseName = void 0;
4
4
  const graphql_1 = require("graphql");
5
+ const assert_1 = require("./assert");
5
6
  function getResponseName(node) {
6
7
  return node.alias ? node.alias.value : node.name.value;
7
8
  }
@@ -25,15 +26,11 @@ function astFromType(type) {
25
26
  }
26
27
  }
27
28
  exports.astFromType = astFromType;
28
- function printWithReducedWhitespace(ast) {
29
- return graphql_1.print(ast)
30
- .replace(/\s+/g, ' ')
31
- .trim();
32
- }
33
- exports.printWithReducedWhitespace = printWithReducedWhitespace;
34
29
  function parseSelections(source) {
35
- return graphql_1.parse(`query { ${source} }`)
36
- .definitions[0].selectionSet.selections;
30
+ const parsed = graphql_1.parse(`{${source}}`);
31
+ assert_1.assert(parsed.definitions.length === 1, `Invalid FieldSet provided: '${source}'. FieldSets may not contain operations within them.`);
32
+ return parsed.definitions[0].selectionSet
33
+ .selections;
37
34
  }
38
35
  exports.parseSelections = parseSelections;
39
36
  //# sourceMappingURL=graphql.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/utilities/graphql.ts"],"names":[],"mappings":";;;AAAA,qCAeiB;AAEjB,SAAgB,eAAe,CAAC,IAAe;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACzD,CAAC;AAFD,0CAEC;AAED,SAAgB,qBAAqB,CACnC,SAAY,EACZ,cAAyB;IAEzB,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC;AALD,sDAKC;AAKD,SAAgB,WAAW,CAAC,IAAiB;IAC3C,IAAI,oBAAU,CAAC,IAAI,CAAC,EAAE;QACpB,OAAO,EAAE,IAAI,EAAE,cAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KACjE;SAAM,IAAI,uBAAa,CAAC,IAAI,CAAC,EAAE;QAC9B,OAAO,EAAE,IAAI,EAAE,cAAI,CAAC,aAAa,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KACrE;SAAM;QACL,OAAO;YACL,IAAI,EAAE,cAAI,CAAC,UAAU;YACrB,IAAI,EAAE,EAAE,IAAI,EAAE,cAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE;SAC5C,CAAC;KACH;AACH,CAAC;AAXD,kCAWC;AAED,SAAgB,0BAA0B,CAAC,GAAY;IACrD,OAAO,eAAK,CAAC,GAAG,CAAC;SACd,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC;AAJD,gEAIC;AAED,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAQ,eAAK,CAAC,WAAW,MAAM,IAAI,CAAC;SACjC,WAAW,CAAC,CAAC,CAA6B,CAAC,YAAY,CAAC,UAAU,CAAC;AACxE,CAAC;AAHD,0CAGC"}
1
+ {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/utilities/graphql.ts"],"names":[],"mappings":";;;AAAA,qCAciB;AACjB,qCAAkC;AAElC,SAAgB,eAAe,CAAC,IAAe;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACzD,CAAC;AAFD,0CAEC;AAED,SAAgB,qBAAqB,CACnC,SAAY,EACZ,cAAyB;IAEzB,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC;AACpE,CAAC;AALD,sDAKC;AAKD,SAAgB,WAAW,CAAC,IAAiB;IAC3C,IAAI,oBAAU,CAAC,IAAI,CAAC,EAAE;QACpB,OAAO,EAAE,IAAI,EAAE,cAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KACjE;SAAM,IAAI,uBAAa,CAAC,IAAI,CAAC,EAAE;QAC9B,OAAO,EAAE,IAAI,EAAE,cAAI,CAAC,aAAa,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;KACrE;SAAM;QACL,OAAO;YACL,IAAI,EAAE,cAAI,CAAC,UAAU;YACrB,IAAI,EAAE,EAAE,IAAI,EAAE,cAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE;SAC5C,CAAC;KACH;AACH,CAAC;AAXD,kCAWC;AAUD,SAAgB,eAAe,CAAC,MAAc;IAC5C,MAAM,MAAM,GAAG,eAAK,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC;IACpC,eAAM,CACJ,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAC/B,+BAA+B,MAAM,sDAAsD,CAC5F,CAAC;IACF,OAAQ,MAAM,CAAC,WAAW,CAAC,CAAC,CAA6B,CAAC,YAAY;SACnE,UAAU,CAAC;AAChB,CAAC;AARD,0CAQC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/gateway",
3
- "version": "0.26.0-alpha.2",
3
+ "version": "0.26.3",
4
4
  "description": "Apollo Gateway",
5
5
  "author": "Apollo <opensource@apollographql.com>",
6
6
  "main": "dist/index.js",
@@ -25,15 +25,15 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@apollo/federation": "^0.23.0-alpha.0",
29
- "@apollo/query-planner": "^0.1.0-alpha.1",
30
- "@types/node-fetch": "2.5.8",
31
- "apollo-graphql": "^0.6.0",
28
+ "@apollo/federation": "^0.23.2",
29
+ "@apollo/query-planner": "^0.1.2",
30
+ "@types/node-fetch": "2.5.10",
31
+ "apollo-graphql": "^0.9.2",
32
32
  "apollo-reporting-protobuf": "^0.6.0",
33
33
  "apollo-server-caching": "^0.6.0",
34
- "apollo-server-core": "^2.21.0",
34
+ "apollo-server-core": "^2.23.0",
35
35
  "apollo-server-env": "^3.0.0",
36
- "apollo-server-errors": "^2.4.2",
36
+ "apollo-server-errors": "^2.5.0",
37
37
  "apollo-server-types": "^0.7.0",
38
38
  "loglevel": "^1.6.1",
39
39
  "make-fetch-happen": "^8.0.0",
@@ -42,5 +42,5 @@
42
42
  "peerDependencies": {
43
43
  "graphql": "^14.5.0 || ^15.0.0"
44
44
  },
45
- "gitHead": "d06ab0b92b03a3d3c4d241d94266653fc71695c3"
45
+ "gitHead": "86161e5b21a65d9d6c872e1446201214542eca11"
46
46
  }
@@ -1,20 +1,20 @@
1
1
  import { GraphQLSchema } from 'graphql';
2
2
  import gql from 'graphql-tag';
3
- import { buildQueryPlan, buildOperationContext } from '../buildQueryPlan';
3
+ import { buildOperationContext } from '../operationContext';
4
4
  import { astSerializer, queryPlanSerializer } from 'apollo-federation-integration-testsuite';
5
5
  import { getFederatedTestingSchema } from './execution-utils';
6
- import { QueryPlannerPointer } from '@apollo/query-planner';
6
+ import { QueryPlanner } from '@apollo/query-planner';
7
7
 
8
8
  expect.addSnapshotSerializer(astSerializer);
9
9
  expect.addSnapshotSerializer(queryPlanSerializer);
10
10
 
11
11
  describe('buildQueryPlan', () => {
12
12
  let schema: GraphQLSchema;
13
- let queryPlannerPointer: QueryPlannerPointer;
13
+ let queryPlanner: QueryPlanner;
14
14
 
15
15
  beforeEach(() => {
16
16
  expect(
17
- () => ({ schema, queryPlannerPointer } = getFederatedTestingSchema()),
17
+ () => ({ schema, queryPlanner } = getFederatedTestingSchema()),
18
18
  ).not.toThrow();
19
19
  });
20
20
 
@@ -39,12 +39,10 @@ describe('buildQueryPlan', () => {
39
39
 
40
40
  const operationDocument = gql(operationString);
41
41
 
42
- const queryPlan = buildQueryPlan(
42
+ const queryPlan = queryPlanner.buildQueryPlan(
43
43
  buildOperationContext({
44
44
  schema,
45
45
  operationDocument,
46
- operationString,
47
- queryPlannerPointer,
48
46
  }),
49
47
  );
50
48
 
@@ -83,12 +81,10 @@ describe('buildQueryPlan', () => {
83
81
 
84
82
  const operationDocument = gql(operationString);
85
83
 
86
- const queryPlan = buildQueryPlan(
84
+ const queryPlan = queryPlanner.buildQueryPlan(
87
85
  buildOperationContext({
88
86
  schema,
89
87
  operationDocument,
90
- operationString,
91
- queryPlannerPointer,
92
88
  })
93
89
  );
94
90
 
@@ -119,12 +115,10 @@ describe('buildQueryPlan', () => {
119
115
 
120
116
  const operationDocument = gql(operationString);
121
117
 
122
- const queryPlan = buildQueryPlan(
118
+ const queryPlan = queryPlanner.buildQueryPlan(
123
119
  buildOperationContext({
124
120
  schema,
125
121
  operationDocument,
126
- operationString,
127
- queryPlannerPointer,
128
122
  })
129
123
  );
130
124
 
@@ -208,12 +202,10 @@ describe('buildQueryPlan', () => {
208
202
 
209
203
  const operationDocument = gql(operationString);
210
204
 
211
- const queryPlan = buildQueryPlan(
205
+ const queryPlan = queryPlanner.buildQueryPlan(
212
206
  buildOperationContext({
213
207
  schema,
214
208
  operationDocument,
215
- operationString,
216
- queryPlannerPointer,
217
209
  })
218
210
  );
219
211
 
@@ -341,12 +333,10 @@ describe('buildQueryPlan', () => {
341
333
 
342
334
  const operationDocument = gql(operationString);
343
335
 
344
- const queryPlan = buildQueryPlan(
336
+ const queryPlan = queryPlanner.buildQueryPlan(
345
337
  buildOperationContext({
346
338
  schema,
347
339
  operationDocument,
348
- operationString,
349
- queryPlannerPointer,
350
340
  })
351
341
  );
352
342
 
@@ -385,12 +375,10 @@ describe('buildQueryPlan', () => {
385
375
 
386
376
  const operationDocument = gql(operationString);
387
377
 
388
- const queryPlan = buildQueryPlan(
378
+ const queryPlan = queryPlanner.buildQueryPlan(
389
379
  buildOperationContext({
390
380
  schema,
391
381
  operationDocument,
392
- operationString,
393
- queryPlannerPointer,
394
382
  })
395
383
  );
396
384
 
@@ -428,12 +416,10 @@ describe('buildQueryPlan', () => {
428
416
 
429
417
  const operationDocument = gql(operationString);
430
418
 
431
- const queryPlan = buildQueryPlan(
419
+ const queryPlan = queryPlanner.buildQueryPlan(
432
420
  buildOperationContext({
433
421
  schema,
434
422
  operationDocument,
435
- operationString,
436
- queryPlannerPointer,
437
423
  })
438
424
  );
439
425
 
@@ -485,12 +471,10 @@ describe('buildQueryPlan', () => {
485
471
 
486
472
  const operationDocument = gql(operationString);
487
473
 
488
- const queryPlan = buildQueryPlan(
474
+ const queryPlan = queryPlanner.buildQueryPlan(
489
475
  buildOperationContext({
490
476
  schema,
491
477
  operationDocument,
492
- operationString,
493
- queryPlannerPointer,
494
478
  })
495
479
  );
496
480
 
@@ -543,12 +527,10 @@ describe('buildQueryPlan', () => {
543
527
 
544
528
  const operationDocument = gql(operationString);
545
529
 
546
- const queryPlan = buildQueryPlan(
530
+ const queryPlan = queryPlanner.buildQueryPlan(
547
531
  buildOperationContext({
548
532
  schema,
549
533
  operationDocument,
550
- operationString,
551
- queryPlannerPointer,
552
534
  })
553
535
  );
554
536
 
@@ -602,12 +584,10 @@ describe('buildQueryPlan', () => {
602
584
 
603
585
  const operationDocument = gql(operationString);
604
586
 
605
- const queryPlan = buildQueryPlan(
587
+ const queryPlan = queryPlanner.buildQueryPlan(
606
588
  buildOperationContext({
607
589
  schema,
608
590
  operationDocument,
609
- operationString,
610
- queryPlannerPointer,
611
591
  })
612
592
  );
613
593
 
@@ -657,12 +637,10 @@ describe('buildQueryPlan', () => {
657
637
 
658
638
  const operationDocument = gql(operationString);
659
639
 
660
- const queryPlan = buildQueryPlan(
640
+ const queryPlan = queryPlanner.buildQueryPlan(
661
641
  buildOperationContext({
662
642
  schema,
663
643
  operationDocument,
664
- operationString,
665
- queryPlannerPointer,
666
644
  })
667
645
  );
668
646
 
@@ -714,12 +692,10 @@ describe('buildQueryPlan', () => {
714
692
 
715
693
  const operationDocument = gql(operationString);
716
694
 
717
- const queryPlan = buildQueryPlan(
695
+ const queryPlan = queryPlanner.buildQueryPlan(
718
696
  buildOperationContext({
719
697
  schema,
720
698
  operationDocument,
721
- operationString,
722
- queryPlannerPointer,
723
699
  })
724
700
  );
725
701
 
@@ -771,12 +747,10 @@ describe('buildQueryPlan', () => {
771
747
 
772
748
  const operationDocument = gql(operationString);
773
749
 
774
- const queryPlan = buildQueryPlan(
750
+ const queryPlan = queryPlanner.buildQueryPlan(
775
751
  buildOperationContext({
776
752
  schema,
777
753
  operationDocument,
778
- operationString,
779
- queryPlannerPointer,
780
754
  })
781
755
  );
782
756
 
@@ -829,12 +803,10 @@ describe('buildQueryPlan', () => {
829
803
 
830
804
  const operationDocument = gql(operationString);
831
805
 
832
- const queryPlan = buildQueryPlan(
806
+ const queryPlan = queryPlanner.buildQueryPlan(
833
807
  buildOperationContext({
834
808
  schema,
835
809
  operationDocument,
836
- operationString,
837
- queryPlannerPointer,
838
810
  })
839
811
  );
840
812
 
@@ -875,12 +847,10 @@ describe('buildQueryPlan', () => {
875
847
 
876
848
  const operationDocument = gql(operationString);
877
849
 
878
- const queryPlan = buildQueryPlan(
850
+ const queryPlan = queryPlanner.buildQueryPlan(
879
851
  buildOperationContext({
880
852
  schema,
881
853
  operationDocument,
882
- operationString,
883
- queryPlannerPointer,
884
854
  })
885
855
  );
886
856
 
@@ -951,12 +921,10 @@ describe('buildQueryPlan', () => {
951
921
 
952
922
  const operationDocument = gql(operationString);
953
923
 
954
- const queryPlan = buildQueryPlan(
924
+ const queryPlan = queryPlanner.buildQueryPlan(
955
925
  buildOperationContext({
956
926
  schema,
957
927
  operationDocument,
958
- operationString,
959
- queryPlannerPointer,
960
928
  })
961
929
  );
962
930
 
@@ -1008,12 +976,10 @@ describe('buildQueryPlan', () => {
1008
976
 
1009
977
  const operationDocument = gql(operationString);
1010
978
 
1011
- const queryPlan = buildQueryPlan(
979
+ const queryPlan = queryPlanner.buildQueryPlan(
1012
980
  buildOperationContext({
1013
981
  schema,
1014
982
  operationDocument,
1015
- operationString,
1016
- queryPlannerPointer,
1017
983
  })
1018
984
  );
1019
985
 
@@ -1060,12 +1026,10 @@ describe('buildQueryPlan', () => {
1060
1026
 
1061
1027
  const operationDocument = gql(operationString);
1062
1028
 
1063
- const queryPlan = buildQueryPlan(
1029
+ const queryPlan = queryPlanner.buildQueryPlan(
1064
1030
  buildOperationContext({
1065
1031
  schema,
1066
1032
  operationDocument,
1067
- operationString,
1068
- queryPlannerPointer,
1069
1033
  }),
1070
1034
  { autoFragmentization: true },
1071
1035
  );
@@ -1185,12 +1149,10 @@ describe('buildQueryPlan', () => {
1185
1149
 
1186
1150
  const operationDocument = gql(operationString);
1187
1151
 
1188
- const queryPlan = buildQueryPlan(
1152
+ const queryPlan = queryPlanner.buildQueryPlan(
1189
1153
  buildOperationContext({
1190
1154
  schema,
1191
1155
  operationDocument,
1192
- operationString,
1193
- queryPlannerPointer,
1194
1156
  }),
1195
1157
  { autoFragmentization: true },
1196
1158
  );
@@ -1222,12 +1184,10 @@ describe('buildQueryPlan', () => {
1222
1184
 
1223
1185
  const operationDocument = gql(operationString);
1224
1186
 
1225
- const queryPlan = buildQueryPlan(
1187
+ const queryPlan = queryPlanner.buildQueryPlan(
1226
1188
  buildOperationContext({
1227
1189
  schema,
1228
1190
  operationDocument,
1229
- operationString,
1230
- queryPlannerPointer,
1231
1191
  }),
1232
1192
  { autoFragmentization: true },
1233
1193
  );
@@ -1270,12 +1230,10 @@ describe('buildQueryPlan', () => {
1270
1230
 
1271
1231
  const operationDocument = gql(operationString);
1272
1232
 
1273
- const queryPlan = buildQueryPlan(
1233
+ const queryPlan = queryPlanner.buildQueryPlan(
1274
1234
  buildOperationContext({
1275
1235
  schema,
1276
1236
  operationDocument,
1277
- operationString,
1278
- queryPlannerPointer,
1279
1237
  }),
1280
1238
  { autoFragmentization: true },
1281
1239
  );
@@ -1414,12 +1372,10 @@ describe('buildQueryPlan', () => {
1414
1372
 
1415
1373
  const operationDocument = gql(operationString);
1416
1374
 
1417
- const queryPlan = buildQueryPlan(
1375
+ const queryPlan = queryPlanner.buildQueryPlan(
1418
1376
  buildOperationContext({
1419
1377
  schema,
1420
1378
  operationDocument,
1421
- operationString,
1422
- queryPlannerPointer,
1423
1379
  })
1424
1380
  );
1425
1381
 
@@ -1478,12 +1434,10 @@ describe('buildQueryPlan', () => {
1478
1434
 
1479
1435
  const operationDocument = gql(operationString);
1480
1436
 
1481
- const queryPlan = buildQueryPlan(
1437
+ const queryPlan = queryPlanner.buildQueryPlan(
1482
1438
  buildOperationContext({
1483
1439
  schema,
1484
1440
  operationDocument,
1485
- operationString,
1486
- queryPlannerPointer,
1487
1441
  })
1488
1442
  );
1489
1443
 
@@ -1530,12 +1484,10 @@ describe('buildQueryPlan', () => {
1530
1484
 
1531
1485
  const operationDocument = gql(operationString);
1532
1486
 
1533
- const queryPlan = buildQueryPlan(
1487
+ const queryPlan = queryPlanner.buildQueryPlan(
1534
1488
  buildOperationContext({
1535
1489
  schema,
1536
1490
  operationDocument,
1537
- operationString,
1538
- queryPlannerPointer,
1539
1491
  })
1540
1492
  );
1541
1493
 
@@ -3,12 +3,12 @@ import { addResolversToSchema, GraphQLResolverMap } from 'apollo-graphql';
3
3
  import gql from 'graphql-tag';
4
4
  import { GraphQLRequestContext } from 'apollo-server-types';
5
5
  import { AuthenticationError } from 'apollo-server-core';
6
- import { buildQueryPlan, buildOperationContext } from '../buildQueryPlan';
6
+ import { buildOperationContext } from '../operationContext';
7
7
  import { executeQueryPlan } from '../executeQueryPlan';
8
8
  import { LocalGraphQLDataSource } from '../datasources/LocalGraphQLDataSource';
9
9
  import { astSerializer, queryPlanSerializer } from 'apollo-federation-integration-testsuite';
10
10
  import { getFederatedTestingSchema } from './execution-utils';
11
- import { QueryPlannerPointer } from '@apollo/query-planner';
11
+ import { QueryPlanner } from '@apollo/query-planner';
12
12
 
13
13
  expect.addSnapshotSerializer(astSerializer);
14
14
  expect.addSnapshotSerializer(queryPlanSerializer);
@@ -33,7 +33,7 @@ describe('executeQueryPlan', () => {
33
33
  }
34
34
 
35
35
  let schema: GraphQLSchema;
36
- let queryPlannerPointer: QueryPlannerPointer;
36
+ let queryPlanner: QueryPlanner;
37
37
 
38
38
  beforeEach(() => {
39
39
  expect(
@@ -41,7 +41,7 @@ describe('executeQueryPlan', () => {
41
41
  ({
42
42
  serviceMap,
43
43
  schema,
44
- queryPlannerPointer,
44
+ queryPlanner,
45
45
  } = getFederatedTestingSchema()),
46
46
  ).not.toThrow();
47
47
  });
@@ -75,11 +75,9 @@ describe('executeQueryPlan', () => {
75
75
  const operationContext = buildOperationContext({
76
76
  schema,
77
77
  operationDocument,
78
- operationString,
79
- queryPlannerPointer,
80
78
  });
81
79
 
82
- const queryPlan = buildQueryPlan(operationContext);
80
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
83
81
 
84
82
  const response = await executeQueryPlan(
85
83
  queryPlan,
@@ -116,11 +114,9 @@ describe('executeQueryPlan', () => {
116
114
  const operationContext = buildOperationContext({
117
115
  schema,
118
116
  operationDocument,
119
- operationString,
120
- queryPlannerPointer,
121
117
  });
122
118
 
123
- const queryPlan = buildQueryPlan(operationContext);
119
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
124
120
 
125
121
  const response = await executeQueryPlan(
126
122
  queryPlan,
@@ -180,11 +176,9 @@ describe('executeQueryPlan', () => {
180
176
  const operationContext = buildOperationContext({
181
177
  schema,
182
178
  operationDocument,
183
- operationString,
184
- queryPlannerPointer,
185
179
  });
186
180
 
187
- const queryPlan = buildQueryPlan(operationContext);
181
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
188
182
 
189
183
  const response = await executeQueryPlan(
190
184
  queryPlan,
@@ -260,11 +254,9 @@ describe('executeQueryPlan', () => {
260
254
  const operationContext = buildOperationContext({
261
255
  schema,
262
256
  operationDocument,
263
- operationString,
264
- queryPlannerPointer,
265
257
  });
266
258
 
267
- const queryPlan = buildQueryPlan(operationContext);
259
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
268
260
 
269
261
  const response = await executeQueryPlan(
270
262
  queryPlan,
@@ -364,11 +356,9 @@ describe('executeQueryPlan', () => {
364
356
  const operationContext = buildOperationContext({
365
357
  schema,
366
358
  operationDocument,
367
- operationString,
368
- queryPlannerPointer,
369
359
  });
370
360
 
371
- const queryPlan = buildQueryPlan(operationContext);
361
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
372
362
 
373
363
  const response = await executeQueryPlan(
374
364
  queryPlan,
@@ -415,11 +405,9 @@ describe('executeQueryPlan', () => {
415
405
  const operationContext = buildOperationContext({
416
406
  schema,
417
407
  operationDocument,
418
- operationString,
419
- queryPlannerPointer,
420
408
  });
421
409
 
422
- const queryPlan = buildQueryPlan(operationContext);
410
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
423
411
 
424
412
  const response = await executeQueryPlan(
425
413
  queryPlan,
@@ -491,11 +479,9 @@ describe('executeQueryPlan', () => {
491
479
  const operationContext = buildOperationContext({
492
480
  schema,
493
481
  operationDocument,
494
- operationString,
495
- queryPlannerPointer,
496
482
  });
497
483
 
498
- const queryPlan = buildQueryPlan(operationContext);
484
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
499
485
 
500
486
  const response = await executeQueryPlan(
501
487
  queryPlan,
@@ -530,11 +516,9 @@ describe('executeQueryPlan', () => {
530
516
  const operationContext = buildOperationContext({
531
517
  schema,
532
518
  operationDocument,
533
- operationString,
534
- queryPlannerPointer,
535
519
  });
536
520
 
537
- const queryPlan = buildQueryPlan(operationContext);
521
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
538
522
 
539
523
  const response = await executeQueryPlan(
540
524
  queryPlan,
@@ -568,11 +552,9 @@ describe('executeQueryPlan', () => {
568
552
  const operationContext = buildOperationContext({
569
553
  schema,
570
554
  operationDocument,
571
- operationString,
572
- queryPlannerPointer,
573
555
  });
574
556
 
575
- const queryPlan = buildQueryPlan(operationContext);
557
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
576
558
 
577
559
  const response = await executeQueryPlan(
578
560
  queryPlan,
@@ -663,11 +645,9 @@ describe('executeQueryPlan', () => {
663
645
  const operationContext = buildOperationContext({
664
646
  schema,
665
647
  operationDocument,
666
- operationString,
667
- queryPlannerPointer,
668
648
  });
669
649
 
670
- const queryPlan = buildQueryPlan(operationContext);
650
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
671
651
 
672
652
  const requestContext = buildRequestContext();
673
653
  requestContext.request.variables = { first: 3 };
@@ -764,11 +744,9 @@ describe('executeQueryPlan', () => {
764
744
  const operationContext = buildOperationContext({
765
745
  schema,
766
746
  operationDocument,
767
- operationString,
768
- queryPlannerPointer,
769
747
  });
770
748
 
771
- const queryPlan = buildQueryPlan(operationContext);
749
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
772
750
 
773
751
  const requestContext = buildRequestContext();
774
752
  requestContext.request.variables = { locale: 'en-US' };
@@ -844,10 +822,8 @@ describe('executeQueryPlan', () => {
844
822
  operationDocument: gql`
845
823
  ${getIntrospectionQuery()}
846
824
  `,
847
- operationString: getIntrospectionQuery(),
848
- queryPlannerPointer,
849
825
  });
850
- const queryPlan = buildQueryPlan(operationContext);
826
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
851
827
 
852
828
  const response = await executeQueryPlan(
853
829
  queryPlan,
@@ -876,11 +852,9 @@ describe('executeQueryPlan', () => {
876
852
  const operationContext = buildOperationContext({
877
853
  schema,
878
854
  operationDocument,
879
- operationString,
880
- queryPlannerPointer,
881
855
  });
882
856
 
883
- const queryPlan = buildQueryPlan(operationContext);
857
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
884
858
 
885
859
  const response = await executeQueryPlan(
886
860
  queryPlan,
@@ -922,11 +896,9 @@ describe('executeQueryPlan', () => {
922
896
  const operationContext = buildOperationContext({
923
897
  schema,
924
898
  operationDocument,
925
- operationString,
926
- queryPlannerPointer,
927
899
  });
928
900
 
929
- const queryPlan = buildQueryPlan(operationContext);
901
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
930
902
 
931
903
  const response = await executeQueryPlan(
932
904
  queryPlan,
@@ -979,11 +951,9 @@ describe('executeQueryPlan', () => {
979
951
  const operationContext = buildOperationContext({
980
952
  schema,
981
953
  operationDocument,
982
- operationString,
983
- queryPlannerPointer,
984
954
  });
985
955
 
986
- const queryPlan = buildQueryPlan(operationContext);
956
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
987
957
 
988
958
  const response = await executeQueryPlan(
989
959
  queryPlan,
@@ -1023,11 +993,9 @@ describe('executeQueryPlan', () => {
1023
993
  const operationContext = buildOperationContext({
1024
994
  schema,
1025
995
  operationDocument,
1026
- operationString,
1027
- queryPlannerPointer,
1028
996
  });
1029
997
 
1030
- const queryPlan = buildQueryPlan(operationContext);
998
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
1031
999
 
1032
1000
  const response = await executeQueryPlan(
1033
1001
  queryPlan,
@@ -1080,11 +1048,9 @@ describe('executeQueryPlan', () => {
1080
1048
  const operationContext = buildOperationContext({
1081
1049
  schema,
1082
1050
  operationDocument,
1083
- operationString,
1084
- queryPlannerPointer,
1085
1051
  });
1086
1052
 
1087
- const queryPlan = buildQueryPlan(operationContext);
1053
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
1088
1054
 
1089
1055
  const response = await executeQueryPlan(
1090
1056
  queryPlan,
@@ -1131,11 +1097,9 @@ describe('executeQueryPlan', () => {
1131
1097
  const operationContext = buildOperationContext({
1132
1098
  schema,
1133
1099
  operationDocument,
1134
- operationString,
1135
- queryPlannerPointer,
1136
1100
  });
1137
1101
 
1138
- const queryPlan = buildQueryPlan(operationContext);
1102
+ const queryPlan = queryPlanner.buildQueryPlan(operationContext);
1139
1103
 
1140
1104
  const response = await executeQueryPlan(
1141
1105
  queryPlan,