import { encodeCursorChunk, type MaybePromise, type SchemaTypes } from '@pothos/core'; import { type Column, type SQL, type Table, type TableRelationalConfig } from 'drizzle-orm'; import type { ConnectionOrderBy, QueryForDrizzleConnection } from '../types.js'; import type { DrizzlePlan } from './adapter.js'; import type { PothosDrizzleSchemaConfig } from './config.js'; import { type SelectionMap } from './selections.js'; export declare const formatCursorChunk: typeof encodeCursorChunk; export declare function formatDrizzleCursor(record: Record, fields: Column[], config: PothosDrizzleSchemaConfig): string; export declare function formatIDChunk(value: unknown): string; export declare function getIDSerializer(fields: Column[], config: PothosDrizzleSchemaConfig, typeName: string): (value: Record) => string; export type CursorField = Column | string; export declare function cursorFieldKey(field: CursorField, config: PothosDrizzleSchemaConfig): string; export declare function getColumnSerializer(fields: readonly CursorField[], config: PothosDrizzleSchemaConfig): (value: Record) => string; export declare function getCursorFormatter(fields: readonly CursorField[], config: PothosDrizzleSchemaConfig): (value: Record) => string; export declare function getIDParser(fields: readonly Column[], config: PothosDrizzleSchemaConfig, typeName: string): (value: string) => { [x: string]: unknown; }; /** * Reads a cursor into the values of the ordering it was issued for. `columns` holds the column * of each key that is one, and each value is checked against it; a key ordered by an expression * has none, and its value is passed on as it is. */ export declare function getCursorParser(keys: readonly string[], columns: readonly (Column | undefined)[]): (cursor: unknown) => Record; export interface DrizzleCursorConnectionQueryOptions { args: PothosSchemaTypes.DefaultConnectionArguments; ctx: {}; defaultSize?: number | ((args: {}, ctx: {}) => number); maxSize?: number | ((args: {}, ctx: {}) => number); orderBy: ConnectionOrderBy; extras?: Record; where?: SQL; config: PothosDrizzleSchemaConfig; table: TableRelationalConfig; } export type OrderByExpression = SQL | ((table: never, operators: never) => SQL); export declare function drizzleCursorConnectionQuery({ args, ctx, maxSize, defaultSize, orderBy, extras, where, config, table, }: DrizzleCursorConnectionQueryOptions): { cursorFields: (string | Column, object>)[]; columns: Record; orderBy: { [k: string]: "asc" | "desc"; } | ((t: Table) => SQL[]); limit: number; where: {}; }; export declare function wrapConnectionResult(results: readonly T[], args: PothosSchemaTypes.DefaultConnectionArguments, limit: number, cursor: (node: T) => string, resolveNode?: (node: Record) => unknown, parent?: unknown, totalCount?: number | (() => MaybePromise) | null): { parent: unknown; args: PothosSchemaTypes.DefaultConnectionArguments; totalCount: number | (() => MaybePromise) | null | undefined; edges: ({ cursor: string; node: unknown; } | null)[]; pageInfo: { startCursor: string | null; endCursor: string | null; hasPreviousPage: boolean; hasNextPage: boolean; }; }; export declare function resolveDrizzleCursorConnection(tableName: string, plan: DrizzlePlan | undefined, config: PothosDrizzleSchemaConfig, options: Omit & { totalCount?: () => MaybePromise; }, resolve: (queryFn: (query: QueryForDrizzleConnection) => SelectionMap) => MaybePromise, parent: unknown): Promise<{ parent: unknown; args: PothosSchemaTypes.DefaultConnectionArguments; totalCount: number | (() => MaybePromise) | null | undefined; edges: ({ cursor: string; node: unknown; } | null)[]; pageInfo: { startCursor: string | null; endCursor: string | null; hasPreviousPage: boolean; hasNextPage: boolean; }; }>; //# sourceMappingURL=cursors.d.ts.map