import { type MaybePromise, type SchemaTypes } from '@pothos/core'; import { type AnyTable, type Column, type SQL, type TableRelationalConfig } from 'drizzle-orm'; import type { GraphQLResolveInfo } from 'graphql'; import { type DrizzleAdapter, type DrizzleNode, type DrizzlePlan, type DrizzlePlayedPlan } from './utils/adapter.js'; import { type PothosDrizzleSchemaConfig } from './utils/config.js'; interface ResolvablePromise { promise: Promise; resolve: (value: T) => void; reject: (err: unknown) => void; } export declare class ModelLoader { context: object; builder: PothosSchemaTypes.SchemaBuilder; modelName: string; rowCache: WeakMap>>; planCache: WeakMap>>; staged: Set<{ root: DrizzleNode; models: Map | null>>; }>; config: PothosDrizzleSchemaConfig; adapter: DrizzleAdapter; table: TableRelationalConfig; columns: Column[]; private columnNames; primaryKey: Column[]; selectSQL: (table: AnyTable<{}>) => SQL; constructor(context: object, builder: PothosSchemaTypes.SchemaBuilder, modelName: string, columns?: Column[]); static forModel(modelName: string, builder: PothosSchemaTypes.SchemaBuilder, columns?: Column[]): import("@pothos/core").ContextCache; sqlForModel(model: object): string | number | (string | number)[]; getSelection(info: GraphQLResolveInfo): MaybePromise; getSelectionForField(info: GraphQLResolveInfo, typeName: string): MaybePromise; /** * `model` reloaded with the selection of the field `info` resolves. A synchronous selection * stages synchronously, so every row resolved in a tick joins the same batch; only a selection * with an async select beneath the field waits for it. */ loadSelection(info: GraphQLResolveInfo, model: object): Promise | null>; private loadWith; /** A node loaded by id with the selection beneath the field `info` resolves, as `returnType`. */ loadSelectionForField(info: GraphQLResolveInfo, model: object, returnType: string): Promise | null>; private loadFieldWith; stageQuery(played: Pick, model: object): Promise | null>; initLoad(played: Pick, model: object): Promise | null>; } /** Matches `ScopeAuthParentLoader` in @pothos/plugin-scope-auth, which this plugin can't import. */ type ScopeAuthParentLoader = (parent: unknown, context: object, info: GraphQLResolveInfo) => MaybePromise; /** * The parent scope-auth's checks see for a type: the row when it has every top-level key of the * type's selection (`root`, planned from it), otherwise the row reloaded with it. */ export declare function typeParentLoader(loaders: (context: object) => ModelLoader, root: DrizzleNode): ScopeAuthParentLoader; export {}; //# sourceMappingURL=model-loader.d.ts.map