Skip to content

Commit

Permalink
Rename compression option to autoFragmentization
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-scheer committed Feb 15, 2020
1 parent cc224d7 commit 98bdb30
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/apollo-gateway/src/__tests__/buildQueryPlan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ describe('buildQueryPlan', () => {

const queryPlan = buildQueryPlan(
buildOperationContext(schema, query, undefined),
{ compressDownstreamRequests: true },
{ autoFragmentization: true },
);

expect(queryPlan).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -1014,7 +1014,7 @@ describe('buildQueryPlan', () => {

const queryPlan = buildQueryPlan(
buildOperationContext(schema, query, undefined),
{ compressDownstreamRequests: true },
{ autoFragmentization: true },
);

expect(queryPlan).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -1044,7 +1044,7 @@ describe('buildQueryPlan', () => {

const queryPlan = buildQueryPlan(
buildOperationContext(schema, query, undefined),
{ compressDownstreamRequests: true },
{ autoFragmentization: true },
);

expect(queryPlan).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -1084,7 +1084,7 @@ describe('buildQueryPlan', () => {

const queryPlan = buildQueryPlan(
buildOperationContext(schema, query, undefined),
{ compressDownstreamRequests: true },
{ autoFragmentization: true },
);

expect(queryPlan).toMatchInlineSnapshot(`
Expand Down
10 changes: 5 additions & 5 deletions packages/apollo-gateway/src/buildQueryPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ const typenameField = {
};

interface BuildQueryPlanOptions {
compressDownstreamRequests: boolean;
autoFragmentization: boolean;
}

export function buildQueryPlan(
operationContext: OperationContext,
options: BuildQueryPlanOptions = { compressDownstreamRequests: false },
options: BuildQueryPlanOptions = { autoFragmentization: false },
): QueryPlan {
const context = buildQueryPlanningContext(operationContext, options);

Expand Down Expand Up @@ -559,7 +559,7 @@ function completeField(
let definition: FragmentDefinitionNode;
let selectionSet = selectionSetFromFieldSet(subGroup.fields, returnType);

if (context.compressDownstreamRequests && subGroup.fields.length > 2) {
if (context.autoFragmentization && subGroup.fields.length > 2) {
({ definition, selectionSet } = getInternalFragment(
selectionSet,
returnType,
Expand Down Expand Up @@ -821,7 +821,7 @@ export function buildQueryPlanningContext(
schema,
operation,
fragments,
options.compressDownstreamRequests,
options.autoFragmentization,
);
}

Expand All @@ -845,7 +845,7 @@ export class QueryPlanningContext {
public readonly schema: GraphQLSchema,
public readonly operation: OperationDefinitionNode,
public readonly fragments: FragmentMap,
public readonly compressDownstreamRequests: boolean,
public readonly autoFragmentization: boolean,
) {
this.variableDefinitions = Object.create(null);
visit(operation, {
Expand Down
6 changes: 3 additions & 3 deletions packages/apollo-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface GatewayConfigBase {
experimental_didUpdateComposition?: Experimental_DidUpdateCompositionCallback;
experimental_pollInterval?: number;
experimental_approximateQueryPlanStoreMiB?: number;
experimental_compressDownstreamRequests?: boolean;
experimental_autoFragmentization?: boolean;
}

interface RemoteGatewayConfig extends GatewayConfigBase {
Expand Down Expand Up @@ -514,8 +514,8 @@ export class ApolloGateway implements GraphQLService {

if (!queryPlan) {
queryPlan = buildQueryPlan(operationContext, {
compressDownstreamRequests: Boolean(
this.config.experimental_compressDownstreamRequests,
autoFragmentization: Boolean(
this.config.experimental_autoFragmentization,
),
});
if (this.queryPlanStore) {
Expand Down

0 comments on commit 98bdb30

Please sign in to comment.