"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isProviderSupported = exports.search = exports.getProvidersInfo = void 0;
const providers_1 = require("./providers");
async function getProvidersInfo() {
    return Promise.all(Object.entries(providers_1.providers).map(async ([name, provider]) => ({
        name,
        ...(await provider.getMeta()),
    })));
}
exports.getProvidersInfo = getProvidersInfo;
async function search(searchProviders, query, options) {
    const provider = searchProviders[0];
    if (!provider || searchProviders.length !== 1) {
        throw new Error('Only 1 provider search is supported at the moment');
    }
    return providers_1.providers[provider].search(query, options);
}
exports.search = search;
function isProviderSupported(name) {
    return typeof name === 'string' && name in providers_1.providers;
}
exports.isProviderSupported = isProviderSupported;
