import type { ComputedRef, Ref } from 'vue'; import type eponymeConfig from '#eponyme/config'; import type { EponymeCollectionDataByName, EponymeCollectionFilter, EponymeCollectionName, EponymeSchema } from '../types/index.js'; import type { EponymePopulateDepth, EponymePopulatedData, EponymeSchemaByName } from '../types/relations.js'; import type { EponymeCollectionEntry, EponymeSortDirection, EponymeStatus, EponymeVersionSelector } from '../server/services/eponyme-store.js'; type ConfigCollectionName = EponymeCollectionName; /** A collection entry's data with its relations resolved `Depth` levels deep; `0` is the stored shape. */ export type EponymePopulatedCollectionData = Depth extends 0 ? EponymeCollectionDataByName : EponymeSchemaByName extends infer Schema extends EponymeSchema ? EponymePopulatedData : never; /** Sortable keys: the entry metadata plus every field of the collection. */ export type EponymeCollectionSortKey = 'updatedAt' | 'publishedAt' | 'title' | 'slug' | (keyof EponymeCollectionDataByName & string); /** * The `where` a collection accepts: only the fields stored in a form the index can compare, each with the * values that field can actually hold. */ export type EponymeCollectionFilterInput = EponymeCollectionFilter; export interface UseEponymeCollectionOptions { /** Levels of relations to resolve: each relation then holds its target rather than its slug. */ depth?: Depth; take?: number; skip?: number; orderBy?: EponymeCollectionSortKey; order?: EponymeSortDirection; /** Keeps only the entries matching every key. */ where?: EponymeCollectionFilterInput; } export type UseEponymeCollectionReturn> = UseEponymeCollectionResult & Promise>; export type UseEponymeCollectionEntryReturn> = UseEponymeCollectionEntryResult & Promise>; export interface UseEponymeCollectionResult> { entries: ComputedRef[]>; /** Matching entries before `take` and `skip`, for building a pager. */ total: ComputedRef; pending: Ref; error: Ref; refresh: () => Promise; } export interface UseEponymeCollectionEntryOptions { version?: EponymeVersionSelector; /** Levels of relations to resolve: each relation then holds its target rather than its slug. */ depth?: Depth; } export interface UseEponymeCollectionEntryResult> { data: Ref<{ data: Data; } | undefined>; status: ComputedRef; publishedAt: ComputedRef; pending: Ref; error: Ref; refresh: () => Promise; } export declare function useEponymeCollection(name: Name, options?: UseEponymeCollectionOptions): UseEponymeCollectionReturn>; export declare function useEponymeCollectionEntry(name: Name, slug: string, options?: UseEponymeCollectionEntryOptions): UseEponymeCollectionEntryReturn>; export {};