@neo4j/graphql
Version:
A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations
75 lines • 4.13 kB
TypeScript
import Cypher from "@neo4j/cypher-builder";
import type { ConcreteEntityAdapter } from "../../../../schema-model/entity/model-adapters/ConcreteEntityAdapter";
import type { RelationshipAdapter } from "../../../../schema-model/relationship/model-adapters/RelationshipAdapter";
import type { QueryASTContext } from "../QueryASTContext";
import type { QueryASTNode } from "../QueryASTNode";
import type { ConnectionAggregationField } from "../fields/ConnectionAggregationField";
import type { Field } from "../fields/Field";
import type { Filter } from "../filters/Filter";
import type { AuthorizationFilters } from "../filters/authorization-filters/AuthorizationFilters";
import type { Pagination } from "../pagination/Pagination";
import type { EntitySelection } from "../selection/EntitySelection";
import type { Sort } from "../sort/Sort";
import type { OperationTranspileResult } from "./operations";
import { Operation } from "./operations";
export declare class ConnectionReadOperation extends Operation {
readonly relationship: RelationshipAdapter | undefined;
readonly target: ConcreteEntityAdapter;
nodeFields: Field[];
edgeFields: Field[];
filters: Filter[];
skipConnection: boolean;
protected pagination: Pagination | undefined;
protected sortFields: Array<{
node: Sort[];
edge: Sort[];
}>;
protected authFilters: AuthorizationFilters[];
protected needsPageInfo: boolean;
protected selection: EntitySelection;
private hasTotalCount;
private aggregationField;
constructor({ relationship, target, selection, }: {
relationship: RelationshipAdapter | undefined;
target: ConcreteEntityAdapter;
selection: EntitySelection;
});
setHasTotalCount(value: boolean): void;
setNeedsPageInfo(value: boolean): void;
setNodeFields(fields: Field[]): void;
addFilters(...filters: Filter[]): void;
setEdgeFields(fields: Field[]): void;
addAuthFilters(...filter: AuthorizationFilters[]): void;
addSort(sortElement: {
node: Sort[];
edge: Sort[];
}): void;
addPagination(pagination: Pagination): void;
/** Sets the aggregation field and adds the needed filters */
setAggregationField(aggregationField: ConnectionAggregationField): void;
getChildren(): QueryASTNode[];
protected getWithCollectEdgesAndTotalCount(nestedContext: QueryASTContext<Cypher.Node>, edgesVar: Cypher.Variable, totalCount: Cypher.Variable, extraColumns?: Array<[Cypher.Expr, Cypher.Variable]>): Cypher.With;
transpile(context: QueryASTContext): OperationTranspileResult;
/** Defines if the query should project edges */
protected shouldProjectEdges(): boolean;
protected getAuthFilterSubqueries(context: QueryASTContext): Cypher.Clause[];
protected getFilterSubqueries(context: QueryASTContext): Cypher.Clause[];
protected getAuthFilterPredicate(context: QueryASTContext): Cypher.Predicate[];
protected getValidations(context: QueryASTContext): Cypher.VoidProcedure[];
protected getUnwindClause(context: QueryASTContext<Cypher.Node>, edgeVar: Cypher.Variable, edgesVar: Cypher.Variable): Cypher.With;
protected createProjectionMapForNode(context: QueryASTContext<Cypher.Node>): Cypher.Map;
protected addProjectionMapForRelationshipProperties(context: QueryASTContext<Cypher.Node>, edgeProjectionMap: Cypher.Map): void;
protected createProjectionMapForEdge(context: QueryASTContext<Cypher.Node>): Cypher.Map;
protected generateProjectionMapForFields(fields: Field[], target: Cypher.Variable): Cypher.Map;
private generateSortAndPaginationClause;
private addPaginationSubclauses;
private addSortSubclause;
private addFiltersToClause;
private getSortFields;
/**
* This method resolves all the subqueries for each field and splits them into separate fields: `prePaginationSubqueries` and `postPaginationSubqueries`,
* in the `prePaginationSubqueries` are present all the subqueries required for the pagination purpose.
**/
private getPreAndPostSubqueries;
}
//# sourceMappingURL=ConnectionReadOperation.d.ts.map