The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: run prettier
dshukertjr5a58500b952c
diff --git a/apps/www/supabase/functions/hubspot-notification/index.ts b/apps/www/supabase/functions/hubspot-notification/index.tsindex 8eeb695922c..e26d917cfee 100644--- a/apps/www/supabase/functions/hubspot-notification/index.ts+++ b/apps/www/supabase/functions/hubspot-notification/index.ts@@ -1,31 +1,31 @@-import { serve } from "https://deno.land/[email protected]/http/server.ts";+import { serve } from 'https://deno.land/[email protected]/http/server.ts'-const FUNCTION_SECRET = Deno.env.get("FUNCTION_SECRET");-const HUBSPOT_PORTAL = Deno.env.get("HUBSPOT_PORTAL");-const PARTNER_FORM_ID = Deno.env.get("PARTNER_FORM_ID");-const ENTERPRISE_FORM_ID = Deno.env.get("ENTERPRISE_FORM_ID");+const FUNCTION_SECRET = Deno.env.get('FUNCTION_SECRET')+const HUBSPOT_PORTAL = Deno.env.get('HUBSPOT_PORTAL')+const PARTNER_FORM_ID = Deno.env.get('PARTNER_FORM_ID')+const ENTERPRISE_FORM_ID = Deno.env.get('ENTERPRISE_FORM_ID')serve(async (req) => {- const requestSecret = req.headers.get("x-function-secret");+ const requestSecret = req.headers.get('x-function-secret')if (FUNCTION_SECRET !== requestSecret) {- return new Response("Unauthorized", { status: 401 });+ return new Response('Unauthorized', { status: 401 })}- const input = await req.json();+ const input = await req.json()- const supabase_table_id = input.record.id;- const country = input.record.country;- const form_note = input.record.details;- const company = input.record.company_name || input.record.company;- const company_size = input.record.company_size || input.record.size;- const email = input.record.contact_email || input.record.email;- const phone = input.record.contact_phone || input.record.phone;- const lastName = input.record.contact_last_name || input.record.last;- const firstName = input.record.contact_first_name || input.record.first;- const jobtitle = input.record.title;- const website = input.record.website;- const partner_gallery_type = input.record.type;+ const supabase_table_id = input.record.id+ const country = input.record.country+ const form_note = input.record.details+ const company = input.record.company_name || input.record.company+ const company_size = input.record.company_size || input.record.size+ const email = input.record.contact_email || input.record.email+ const phone = input.record.contact_phone || input.record.phone+ const lastName = input.record.contact_last_name || input.record.last+ const firstName = input.record.contact_first_name || input.record.first+ const jobtitle = input.record.title+ const website = input.record.website+ const partner_gallery_type = input.record.typelet formData: object = {supabase_table_id,@@ -37,55 +37,50 @@ serve(async (req) => {phone,lastName,firstName,- };+ }- if (input.table === "partner_contacts") {+ if (input.table === 'partner_contacts') {formData = {...formData,jobtitle,website,partner_gallery_type,- };+ }}- const fields: { objectTypeId: "0-1"; name: string; value: string }[] = [];+ const fields: { objectTypeId: '0-1'; name: string; value: string }[] = []for (const [key, value] of Object.entries(formData)) {- fields.push({ objectTypeId: "0-1", name: key, value: value });+ fields.push({ objectTypeId: '0-1', name: key, value: value })}- const formId = input.table === "partner_contacts"- ? PARTNER_FORM_ID- : ENTERPRISE_FORM_ID;+ const formId = input.table === 'partner_contacts' ? PARTNER_FORM_ID : ENTERPRISE_FORM_ID// Using HubSpot's submit data to a form API// https://legacydocs.hubspot.com/docs/methods/forms/submit_formconst formResponse = await fetch(`https://api.hsforms.com/submissions/v3/integration/submit/${HUBSPOT_PORTAL}/${formId}`,{- method: "POST",+ method: 'POST',headers: {- Accept: "application/json",- "Content-Type": "application/json",+ Accept: 'application/json',+ 'Content-Type': 'application/json',},body: JSON.stringify({fields,}),- },- );+ }+ )// Will create a deal using HubSpot's workflow tool instead of via APIif (!formResponse.ok) {- console.log(- `Failed to submit form data to HubSpot`,- await formResponse.json(),- );+ console.log(`Failed to submit form data to HubSpot`, await formResponse.json())return new Response(`Failed to submit form data to HubSpot`, {status: 500,- });+ })}return new Response(JSON.stringify({ done: true }), {- headers: { "Content-Type": "application/json" },- });-});+ headers: { 'Content-Type': 'application/json' },+ })+})