import type { SQL } from 'drizzle-orm'; import { type FlattenedJoinField, type Where } from 'payload'; import type { DrizzleAdapter } from '../types.js'; type BuildPolymorphicJoinQueryArgs = { adapter: DrizzleAdapter; currentTableName: string; field: FlattenedJoinField; limit: number; page?: number; path: string; shouldCount: boolean; sort?: string | string[]; where?: Where; }; type PolymorphicJoinQuery = { columnName: string; count?: SQL.Aliased; documents: SQL.Aliased; }; /** * Builds the correlated document and optional count projections for a join that targets multiple * collections. Every collection branch exposes the same `id`, parent, `relationTo`, and sort * columns before the branches are combined. A missing sort field resolves to SQL NULL so targets * with different schemas can still share one ordered union. * * `field.collection` must contain at least one configured collection. Each mapped table must have * an `id` column and the column named by `field.on`. The supplied `limit` is used as-is; callers can * include an extra look-ahead row when they calculate pagination. * * @returns The stable projection name, the document projection, and the count projection when * `shouldCount` is true. * @throws If the join definition, target collection, mapped table, required columns, or sort shape * cannot be represented by the polymorphic query. */ export declare const buildPolymorphicJoinQuery: ({ adapter, currentTableName, field, limit, page, path, shouldCount, sort, where, }: BuildPolymorphicJoinQueryArgs) => PolymorphicJoinQuery; export {}; //# sourceMappingURL=buildPolymorphicJoinQuery.d.ts.map