this repo has no description www.baileykane.co/

Convert to typescript. Add Papaparse typing

+2 -40
-9
lib/bskyApi.js
··· 1 - import { AtpAgent } from "@atproto/api"; 2 - 3 - export const agent = new AtpAgent({ 4 - // App View URL 5 - service: "https://api.bsky.app", 6 - // If you were making an authenticated client, you would 7 - // use the PDS URL here instead - the main one is bsky.social 8 - // service: "https://bsky.social", 9 - });
-29
lib/sheetsConnector.js
··· 1 - import Papa from "papaparse"; 2 - 3 - /**Fetch the CSV data from the provided Google Sheets URL. */ 4 - export async function getSheetsCSV(url) { 5 - const response = await fetch(url); 6 - 7 - if (!response.ok) { 8 - throw new Error(`Failed to fetch data from ${url}`); 9 - } 10 - 11 - const csv = await response.text(); 12 - return csv; 13 - } 14 - 15 - /**Parse the provided CSV data into an array of JSON objects. */ 16 - export function parseCSV(csvData) { 17 - return Papa.parse(csvData, { header: true }); 18 - } 19 - 20 - /**Convenience function to fetch CSV data from the provided Google Sheets URL 21 - * and parse it into an array of JSON objects, all in one. 22 - * 23 - * Combines getSheetsCSV and parseCSV. 24 - */ 25 - export async function importCSVDataAsJson(url) { 26 - const csv = await getSheetsCSV(url); 27 - const json = parseCSV(csv); 28 - return json; 29 - }
+2 -2
lib/sheetsConnector.ts
··· 14 14 } 15 15 16 16 /**Parse the provided CSV data into an array of JSON objects. */ 17 - function parseCSV(csvData: string): ParseResult<string> { 17 + function parseCSV(csvData: string): ParseResult<any> { 18 18 return Papa.parse(csvData, { header: true }); 19 19 } 20 20 ··· 25 25 */ 26 26 export async function importCSVDataAsJson( 27 27 url: string 28 - ): Promise<ParseResult<string>> { 28 + ): Promise<ParseResult<any>> { 29 29 const urlObj = new URL(url); 30 30 31 31 const csv = await getSheetsCSV(urlObj);