import type { QueryNode } from '../../query-tree/base.js'; import type { VariableQueryNode } from '../../query-tree/variables.js'; import type { CollectFieldConfig } from '../config/field.js'; import type { MessageLocation } from '../validation/location.js'; import type { ValidationContext } from '../validation/validation-context.js'; import type { Field } from './field.js'; import type { RelationSide } from './relation.js'; import type { RootEntityType } from './root-entity-type.js'; import type { ObjectType, Type } from './type.js'; interface PathSegmentBase { readonly kind: 'field' | 'relation' | 'collect'; readonly field: Field; readonly resultingType: Type; readonly isListSegment: boolean; readonly resultIsList: boolean; readonly isNullableSegment: boolean; readonly resultIsNullable: boolean; /** * If true, the result can contain an entity multiple times. This e.g. happens when following a m-to-n relation. */ readonly resultMayContainDuplicateEntities: boolean; location?: MessageLocation; } export interface FieldSegment extends PathSegmentBase { readonly kind: 'field'; } export interface RelationSegment extends PathSegmentBase { readonly kind: 'relation'; readonly relationSide: RelationSide; readonly resultingType: RootEntityType; readonly minDepth: number; readonly maxDepth: number; /** * Will be evaluated on all vertices on the path, even those eliminated by minDepth */ readonly vertexFilter?: QueryNode; readonly vertexFilterVariable?: VariableQueryNode; } export interface CollectSegment extends PathSegmentBase { readonly kind: 'collect'; readonly path: CollectPath; } export type CollectPathSegment = FieldSegment | RelationSegment | CollectSegment; export declare class CollectPath { readonly declaringType: ObjectType; readonly path: string; private readonly astNode; constructor(config: CollectFieldConfig, declaringType: ObjectType); get segments(): ReadonlyArray; getFlatSegments(): ReadonlyArray; get resultingType(): Type | undefined; get resultIsList(): boolean; get resultIsNullable(): boolean; /** * If true, the result can contain the same item multiple times. This e.g. happens when following a m-to-n relation. */ get resultMayContainDuplicateEntities(): boolean; get traversesRootEntityTypes(): boolean; /** * @return true if valid, false if invalid */ validate(context: ValidationContext): boolean; private traversePath; } export declare function getEffectiveCollectSegments(path: CollectPath): { readonly relationSegments: ReadonlyArray; readonly fieldSegments: ReadonlyArray; }; export {};