import { Collection, QueryFilter } from '@tomic/lib'; export type CollectionItemProps = { collection: Collection; index: number; }; export type UseCollectionResult = { collection: Collection; invalidateCollection: () => Promise; /** * Helper function for rendering a list of all a collections members. * @example * ```tsx * const List = () => { * const { mapAll } = useCollection(queryFilter); * * return ( * * ); * } * * const Item = ({ index, collection }) => { * const member = useMemberFromCollection(collection, index); * * return
{member.title}
; * } * ``` */ mapAll: (func: (props: CollectionItemProps) => T) => T[]; }; export type UseCollectionOptions = { /** The max number of members on one page, defaults to 30 */ pageSize?: number; /** URL of the server that should be queried. defaults to the store's serverURL */ server?: string; }; /** * Creates a collection resource that is rebuild when the query filter changes or `invalidateCollection` is called. * @param queryFilter * @param pageSize number of items per collection resource, defaults to 30. */ export declare function useCollection(queryFilter: QueryFilter, { pageSize, server }?: UseCollectionOptions): UseCollectionResult; //# sourceMappingURL=useCollection.d.ts.map