RowQueryBuilder type

The row-query surface of GraphQLQueryBuilder: every capability except the aggregation entry points (aggregate/groupBy), with terminal results limited to the selected fields.

The chainable row methods (select/where/orderBy/first/after) return this same type rather than the full builder, so once a query is shaped for row retrieval it can never transition into an aggregation via a later .where(). This closes the widening that a this-returning where() would otherwise reintroduce, making select(...).where(...).aggregate(...) (and the first/after/orderBy variants) compile-time errors. Runtime guards in GraphQLQueryBuilder.aggregate still back this up for callers that bypass the types.

The terminals (execute, executePaginated, findFirst) resolve to TResult, so after select() they return only the selected fields.

Subclass members are hidden unless their keys are explicitly declared in readonly projectionSafeMembers. Only opt in members that never expose a builder or reset its result type, including via promises and overloads. Implement a projection-aware select() override for custom fluent methods.

Example

class LabeledQuery extends GraphQLQueryBuilder<Schema, 'Todo'> {
  declare readonly projectionSafeMembers: 'label';
  label(): string { return 'todos'; }
}
// select(...).label() remains available without widening selected rows.
type RowQueryBuilder<TSchema, TEntity, TSelf, TResult> = ProjectionSafeMembers<TSelf> & { after(cursor: string) => RowQueryBuilder<TSchema, TEntity, TSelf, TResult>, execute() => Promise<TResult[]>, executePaginated() => Promise<PagedResult<TResult>>, findFirst() => Promise<TResult | null>, first(count: number) => RowQueryBuilder<TSchema, TEntity, TSelf, TResult>, orderBy(order: OrderByInput<TSchema[TEntity]>) => RowQueryBuilder<TSchema, TEntity, TSelf, TResult>, select(fields: TFields) => RowQueryBuilder<TSchema, TEntity, TSelf, SelectionResult<TSchema[TEntity], TFields>>, where(conditions: FilterInput<TSchema[TEntity]>) => RowQueryBuilder<TSchema, TEntity, TSelf, TResult> }