The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: enforce event type defs (#32595)
Long Hoang038c52dd9a31
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsxindex 3d90ab978d5..51499cce162 100644--- a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx@@ -264,15 +264,23 @@ export const CreateCronJobSheet = ({toast.success(`Successfully created cron job ${name}`)}- sendEvent({- action: isEditing- ? TelemetryActions.CRON_JOB_UPDATED- : TelemetryActions.CRON_JOB_CREATED,- properties: {- type: values.type,- schedule: schedule,- },- })+ if (isEditing) {+ sendEvent({+ action: TelemetryActions.CRON_JOB_UPDATED,+ properties: {+ type: values.type,+ schedule: schedule,+ },+ })+ } else {+ sendEvent({+ action: TelemetryActions.CRON_JOB_CREATED,+ properties: {+ type: values.type,+ schedule: schedule,+ },+ })+ }onClose()},diff --git a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsxindex d1835325c94..508da8bc13a 100644--- a/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx+++ b/apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx@@ -118,12 +118,6 @@ export const AIAssistant = ({const currentSchema = searchParams?.get('schema') ?? 'public'const { mutate: sendEvent } = useSendEventMutation()- const sendTelemetryEvent = (action: TelemetryActions) => {- sendEvent({- action,- properties: { contextAdded: (sqlSnippets ?? []).length > 0 },- })- }const {messages: chatMessages,@@ -194,9 +188,13 @@ export const AIAssistant = ({setLastSentMessage(payload)if (content.includes('Help me to debug')) {- sendTelemetryEvent(TelemetryActions.ASSISTANT_DEBUG_SUBMITTED)+ sendEvent({+ action: TelemetryActions.ASSISTANT_DEBUG_SUBMITTED,+ })} else {- sendTelemetryEvent(TelemetryActions.ASSISTANT_PROMPT_SUBMITTED)+ sendEvent({+ action: TelemetryActions.ASSISTANT_PROMPT_SUBMITTED,+ })}}diff --git a/apps/studio/components/ui/AIAssistantPanel/SqlSnippet.tsx b/apps/studio/components/ui/AIAssistantPanel/SqlSnippet.tsxindex 87701f56f12..0c66f91f7ac 100644--- a/apps/studio/components/ui/AIAssistantPanel/SqlSnippet.tsx+++ b/apps/studio/components/ui/AIAssistantPanel/SqlSnippet.tsx@@ -215,7 +215,7 @@ export const SqlCard = ({sendEvent({action: TelemetryActions.ASSISTANT_SUGGESTION_RUN_QUERY_CLICKED,properties: {- type: 'mutation',+ queryType: 'mutation',category: identifyQueryType(sql) ?? 'unknown',},})@@ -313,7 +313,7 @@ export const SqlCard = ({if (isReadOnlySelect(sql)) {sendEvent({action: TelemetryActions.ASSISTANT_SUGGESTION_RUN_QUERY_CLICKED,- properties: { type: 'select' },+ properties: { queryType: 'select' },})}}}diff --git a/apps/studio/data/telemetry/send-event-mutation.ts b/apps/studio/data/telemetry/send-event-mutation.tsindex ed38f2d7a76..fc9b17384c8 100644--- a/apps/studio/data/telemetry/send-event-mutation.ts+++ b/apps/studio/data/telemetry/send-event-mutation.ts@@ -21,7 +21,6 @@ import {SqlEditorResultDownloadCsvClickedEvent,SqlEditorResultCopyMarkdownClickedEvent,SqlEditorResultCopyJsonClickedEvent,- TelemetryActions,SignUpEvent,SignInEvent,RealtimeInspectorListenChannelClickedEvent,@@ -70,12 +69,6 @@ export type SendEventVariables =| AssistantSqlDiffHandlerEvaluatedEvent| AssistantEditInSqlEditorClickedEvent- // TODO remove this once all events are documented- | {- action: TelemetryActions- properties?: Record<string, any> // Is arbitrary, but always aim to be self-explanatory with custom properties- }-type SendEventPayload = components['schemas']['TelemetryEventBodyV2']export async function sendEvent({ body }: { body: SendEventPayload }) {diff --git a/apps/studio/lib/constants/telemetry.ts b/apps/studio/lib/constants/telemetry.tsindex 4d636fe8abd..a1c0bc0e0ac 100644--- a/apps/studio/lib/constants/telemetry.ts+++ b/apps/studio/lib/constants/telemetry.ts@@ -106,7 +106,7 @@ export interface CronJobCreatedEvent {/*** What the cron job executes, e.g. sql_function or sql_snippet*/- type: 'sql_function' | 'sql_snippet'+ type: 'sql_function' | 'sql_snippet' | 'edge_function' | 'http_request'/*** Schedule of the cron job in the format of * * * * **/@@ -127,7 +127,7 @@ export interface CronJobUpdatedEvent {/*** What the cron job executes, e.g. sql_function or sql_snippet*/- type: 'sql_function' | 'sql_snippet'+ type: 'sql_function' | 'sql_snippet' | 'edge_function' | 'http_request'/*** Schedule of the cron job in the format of * * * * **/