(method: string, headers: Record<string, string> = {})
| 175 | * @returns The database operation type ('select', 'insert', 'upsert', 'update', or 'delete') |
| 176 | */ |
| 177 | export function extractOperation(method: string, headers: Record<string, string> = {}): string { |
| 178 | switch (method) { |
| 179 | case 'GET': { |
| 180 | return 'select'; |
| 181 | } |
| 182 | case 'POST': { |
| 183 | if (headers['Prefer']?.includes('resolution=')) { |
| 184 | return 'upsert'; |
| 185 | } else { |
| 186 | return 'insert'; |
| 187 | } |
| 188 | } |
| 189 | case 'PATCH': { |
| 190 | return 'update'; |
| 191 | } |
| 192 | case 'DELETE': { |
| 193 | return 'delete'; |
| 194 | } |
| 195 | default: { |
| 196 | return '<unknown-op>'; |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Translates Supabase filter parameters into readable method names for tracing |
no outgoing calls
no test coverage detected