@apollo/query-planner
Advanced tools
Comparing version 2.1.0-alpha.0 to 2.1.0-alpha.1
import { Operation, Schema } from "@apollo/federation-internals"; | ||
import { QueryGraph } from "@apollo/query-graphs"; | ||
import { QueryPlannerConfig } from "./config"; | ||
import { QueryPlan } from "./QueryPlan"; | ||
export declare const MAX_COMPUTED_PLANS = 10000; | ||
export declare function computeQueryPlan(supergraphSchema: Schema, federatedQueryGraph: QueryGraph, operation: Operation): QueryPlan; | ||
export declare function computeQueryPlan(queryPlannerConfig: QueryPlannerConfig, supergraphSchema: Schema, federatedQueryGraph: QueryGraph, operation: Operation): QueryPlan; | ||
//# sourceMappingURL=buildPlan.d.ts.map |
@@ -6,8 +6,10 @@ export { queryPlanSerializer, astSerializer } from './snapshotSerializers'; | ||
import { Schema, Operation } from '@apollo/federation-internals'; | ||
import { QueryPlannerConfig } from './config'; | ||
export declare class QueryPlanner { | ||
readonly supergraphSchema: Schema; | ||
private readonly config; | ||
private readonly federatedQueryGraph; | ||
constructor(supergraphSchema: Schema); | ||
constructor(supergraphSchema: Schema, config?: QueryPlannerConfig); | ||
buildQueryPlan(operation: Operation): QueryPlan; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -27,4 +27,8 @@ "use strict"; | ||
class QueryPlanner { | ||
constructor(supergraphSchema) { | ||
constructor(supergraphSchema, config) { | ||
this.supergraphSchema = supergraphSchema; | ||
this.config = { | ||
exposeDocumentNodeInFetchNode: true, | ||
...config | ||
}; | ||
this.federatedQueryGraph = (0, query_graphs_1.buildFederatedQueryGraph)(supergraphSchema, true); | ||
@@ -36,3 +40,3 @@ } | ||
} | ||
return (0, buildPlan_1.computeQueryPlan)(this.supergraphSchema, this.federatedQueryGraph, operation); | ||
return (0, buildPlan_1.computeQueryPlan)(this.config, this.supergraphSchema, this.federatedQueryGraph, operation); | ||
} | ||
@@ -39,0 +43,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { SelectionNode as GraphQLJSSelectionNode, OperationTypeNode } from 'graphql'; | ||
import { SelectionNode as GraphQLJSSelectionNode, OperationTypeNode, DocumentNode } from 'graphql'; | ||
export declare type ResponsePath = (string | number)[]; | ||
@@ -24,2 +24,3 @@ export interface QueryPlan { | ||
operationKind: OperationTypeNode; | ||
operationDocumentNode?: DocumentNode; | ||
} | ||
@@ -26,0 +27,0 @@ export interface FlattenNode { |
{ | ||
"name": "@apollo/query-planner", | ||
"version": "2.1.0-alpha.0", | ||
"version": "2.1.0-alpha.1", | ||
"description": "Apollo Query Planner", | ||
@@ -28,7 +28,7 @@ "author": "Apollo <packages@apollographql.com>", | ||
"dependencies": { | ||
"@apollo/federation-internals": "^2.1.0-alpha.0", | ||
"@apollo/query-graphs": "^2.1.0-alpha.0", | ||
"@apollo/federation-internals": "^2.1.0-alpha.1", | ||
"@apollo/query-graphs": "^2.1.0-alpha.1", | ||
"chalk": "^4.1.0", | ||
"deep-equal": "^2.0.5", | ||
"pretty-format": "^27.0.0" | ||
"pretty-format": "^28.0.0" | ||
}, | ||
@@ -38,3 +38,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "721a0143e418d64e538082b301862ca9417e830c" | ||
"gitHead": "d8df6aecd716a9e2dc1f1596b0f114d0ef57fe74" | ||
} |
@@ -43,3 +43,4 @@ import fs from 'fs'; | ||
schema = buildSchema(supergraphSdl); | ||
queryPlanner = new QueryPlanner(schema); | ||
const exposeDocumentNodeInFetchNode = feature.title.endsWith("(with ExposeDocumentNodeInFetchNode)"); | ||
queryPlanner = new QueryPlanner(schema, { exposeDocumentNodeInFetchNode: exposeDocumentNodeInFetchNode}); | ||
}); | ||
@@ -69,3 +70,2 @@ | ||
const expectedQueryPlan = JSON.parse(expectedQueryPlanString); | ||
expect(queryPlan).toMatchQueryPlan(expectedQueryPlan); | ||
@@ -72,0 +72,0 @@ }); |
@@ -10,2 +10,3 @@ export { queryPlanSerializer, astSerializer } from './snapshotSerializers'; | ||
import { computeQueryPlan } from './buildPlan'; | ||
import { QueryPlannerConfig } from './config'; | ||
@@ -20,6 +21,12 @@ // There isn't much in this class yet, and I didn't want to make too many | ||
export class QueryPlanner { | ||
private readonly config: QueryPlannerConfig; | ||
private readonly federatedQueryGraph: QueryGraph; | ||
constructor(public readonly supergraphSchema: Schema) { | ||
this.federatedQueryGraph = buildFederatedQueryGraph(supergraphSchema, true); | ||
constructor(public readonly supergraphSchema: Schema, | ||
config?: QueryPlannerConfig) { | ||
this.config = { | ||
exposeDocumentNodeInFetchNode: true, | ||
...config | ||
} | ||
this.federatedQueryGraph = buildFederatedQueryGraph(supergraphSchema, true); | ||
} | ||
@@ -32,4 +39,4 @@ | ||
return computeQueryPlan(this.supergraphSchema, this.federatedQueryGraph, operation); | ||
return computeQueryPlan(this.config, this.supergraphSchema, this.federatedQueryGraph, operation); | ||
} | ||
} |
@@ -5,2 +5,3 @@ import { | ||
OperationTypeNode, | ||
DocumentNode, | ||
} from 'graphql'; | ||
@@ -37,2 +38,3 @@ import prettyFormat from 'pretty-format'; | ||
operationKind: OperationTypeNode; | ||
operationDocumentNode?: DocumentNode; | ||
} | ||
@@ -39,0 +41,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
538235
97
7872
+ Added@jest/schemas@28.1.3(transitive)
+ Added@sinclair/typebox@0.24.51(transitive)
+ Addedpretty-format@28.1.3(transitive)
+ Addedreact-is@18.3.1(transitive)
- Removedpretty-format@27.5.1(transitive)
- Removedreact-is@17.0.2(transitive)
Updatedpretty-format@^28.0.0