/**
 * @fileoverview Generic handler to list entities from Supabase with pagination, filtering, and sorting.
 * @description Provides a reusable implementation for listing documents from PostgreSQL with advanced query capabilities.
 *
 * @version 0.1.0
 * @since 0.5.0
 * @author AMBROISE PARK Consulting
 */
import * as v from 'valibot';
import type { EntityOwnershipConfig, UserRole } from '@donotdev/core/server';
/** Request payload for listing entities with filtering, sorting, and pagination. */
export interface ListEntityRequest {
    where?: Array<[string, any, any]>;
    orderBy?: Array<[string, 'asc' | 'desc']>;
    limit?: number;
    startAfterId?: string;
    startAfterCursor?: string;
    search?: {
        field: string;
        query: string;
    };
}
/**
 * Create a Supabase Edge Function handler for listing entities.
 *
 * @param collection - The Supabase table name
 * @param documentSchema - The Valibot schema for document validation
 * @param requiredRole - Minimum role required for this operation
 * @param listFields - Optional array of field names to include (plus id)
 * @param ownership - Optional ownership config for list constraints and visibility: 'owner' masking
 * @param isListCard - When true and ownership is set, applies public condition; when false, applies "mine" filter
 * @returns A `(req: Request) => Promise<Response>` handler for Deno.serve
 */
export declare function createSupabaseListEntities(collection: string, documentSchema: v.BaseSchema<unknown, any, v.BaseIssue<unknown>>, requiredRole: UserRole, listFields?: string[], ownership?: EntityOwnershipConfig, isListCard?: boolean): (req: Request) => Promise<Response>;
