function ensureSelectionFields(selection) {
    if (!selection || typeof selection !== 'object' || !('fields' in selection)) {
        throw new Error('Invalid hook params: `selection.fields` is required. Example: { selection: { fields: { id: true } } }');
    }
}
export function buildSelectionArgs(selection) {
    ensureSelectionFields(selection);
    return { select: selection.fields };
}
export function buildListSelectionArgs(selection) {
    ensureSelectionFields(selection);
    return {
        select: selection.fields,
        where: selection.where,
        orderBy: selection.orderBy,
        first: selection.first,
        last: selection.last,
        after: selection.after,
        before: selection.before,
        offset: selection.offset,
    };
}
