Example of a Typeform-like dynamic form made with Windmill. Tutorial at https://www.youtube.com/watch?v=MTGZTO1AduM
import { createClient } from "npm:@supabase/supabase-js";
// Define the Supabase resource type as specified
type Supabase = {
key: string;
url: string;
};
export async function main(
supabaseResource: Supabase,
tableName: string,
rowData: Record<string, any>,
) {
// Initialize the Supabase client
const supabase = createClient(supabaseResource.url, supabaseResource.key);
// Insert a row into the specified table
const { data, error } = await supabase
.from(tableName)
.insert([rowData]);
// Return the result or throw an error if the operation failed
if (error) {
throw error;
}
return data;
}