···11-import { AtpAgent } from "@atproto/api";
22-33-export const agent = new AtpAgent({
44- // App View URL
55- service: "https://api.bsky.app",
66- // If you were making an authenticated client, you would
77- // use the PDS URL here instead - the main one is bsky.social
88- // service: "https://bsky.social",
99-});
-29
lib/sheetsConnector.js
···11-import Papa from "papaparse";
22-33-/**Fetch the CSV data from the provided Google Sheets URL. */
44-export async function getSheetsCSV(url) {
55- const response = await fetch(url);
66-77- if (!response.ok) {
88- throw new Error(`Failed to fetch data from ${url}`);
99- }
1010-1111- const csv = await response.text();
1212- return csv;
1313-}
1414-1515-/**Parse the provided CSV data into an array of JSON objects. */
1616-export function parseCSV(csvData) {
1717- return Papa.parse(csvData, { header: true });
1818-}
1919-2020-/**Convenience function to fetch CSV data from the provided Google Sheets URL
2121- * and parse it into an array of JSON objects, all in one.
2222- *
2323- * Combines getSheetsCSV and parseCSV.
2424- */
2525-export async function importCSVDataAsJson(url) {
2626- const csv = await getSheetsCSV(url);
2727- const json = parseCSV(csv);
2828- return json;
2929-}
+2-2
lib/sheetsConnector.ts
···1414}
15151616/**Parse the provided CSV data into an array of JSON objects. */
1717-function parseCSV(csvData: string): ParseResult<string> {
1717+function parseCSV(csvData: string): ParseResult<any> {
1818 return Papa.parse(csvData, { header: true });
1919}
2020···2525 */
2626export async function importCSVDataAsJson(
2727 url: string
2828-): Promise<ParseResult<string>> {
2828+): Promise<ParseResult<any>> {
2929 const urlObj = new URL(url);
30303131 const csv = await getSheetsCSV(urlObj);