"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildSelectionArgs = buildSelectionArgs;
exports.buildListSelectionArgs = buildListSelectionArgs;
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 } } }');
    }
}
function buildSelectionArgs(selection) {
    ensureSelectionFields(selection);
    return { select: selection.fields };
}
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,
    };
}
