// (C) 2024-2026 GoodData Corporation
import { call } from "redux-saga/effects";
import { createQueryService } from "../store/_infra/queryService.js";
export const QueryAvailableDatasetForItemsService = createQueryService("GDC.DASH/QUERY.AVAILABLE.DATA.SETS.FOR.ITEMS", queryService);
function* queryService(ctx, query) {
    const { payload: { items }, } = query;
    const { backend, workspace } = ctx;
    const catalogLoader = backend.workspace(workspace).catalog();
    const catalog = yield call([
        catalogLoader,
        catalogLoader.load,
    ]);
    const availableDateDataSetsLoader = catalog.availableItems().forItems(items);
    const loadedAvailableDateDataSets = yield call([availableDateDataSetsLoader, availableDateDataSetsLoader.load]);
    return loadedAvailableDateDataSets.availableDateDatasets();
}
//# sourceMappingURL=queryAvailableDatasetsForItems.js.map