UNPKG

@tokens-studio/sdk

Version:
30 lines 954 B
import { tasks } from '@tokens-studio/cli-kit'; import { error } from '../utils/messages.js'; import { getSets } from '../utils/queries.js'; import { fetchPaginatedData } from '../utils/fetch-paginated-data.js'; export async function fetchSets(client, config) { let sets = []; await tasks({ start: 'Fetching token data', end: 'Done!', }, [ { pending: 'tokens', start: 'Getting tokensets', end: 'Fetched tokensets', while: async () => { sets = await fetchPaginatedData(client, getSets, { ...config, branch: config.branch ?? 'main' }); }, onError(e) { error(e); throw e; }, }, ]); return sets.map((set) => ({ ...set, tokensObject: set.raw, ...(set.source?.graph ? { graph: set.source.graph } : {}), })); } //# sourceMappingURL=fetch-sets.js.map