/** * Supabase Storage Webhook Adapter * * Handles webhook events from Supabase Storage * * Supabase Storage emits events via Database Webhooks for: * - INSERT on storage.objects table (object created) * - UPDATE on storage.objects table (object updated) * - DELETE on storage.objects table (object deleted) * * @example * ```ts * const adapter = new SupabaseStorageWebhook({ * secret: process.env.SUPABASE_WEBHOOK_SECRET!, * signatureMethod: STORAGE_SIGNATURE_METHOD.HmacSha256, * signatureHeader: 'x-supabase-signature', * logger, * }); * * webhookManager.registerAdapter(adapter); * ``` */ import { BaseWebhookAdapter } from '../base/BaseWebhookAdapter'; import type { StorageWebhookPayload, ProcessedStorageWebhookEvent, SupabaseWebhookPayload, SupabaseStorageWebhookConfig } from '@plyaz/types/storage'; import { SupabaseWebhookPayloadSchema } from '@plyaz/types/storage'; /** * Supabase Storage Webhook Adapter * * Handles database webhooks from Supabase Storage (storage.objects table) */ export declare class SupabaseStorageWebhook extends BaseWebhookAdapter { readonly providerName: string; readonly eventType: string; readonly schema: typeof SupabaseWebhookPayloadSchema; constructor(config: SupabaseStorageWebhookConfig); /** * Process Supabase webhook payload */ process(payload: StorageWebhookPayload): Promise; /** * Process a single Supabase event */ private processEvent; /** * Map Supabase event type to storage event and operation */ private mapEventType; /** * Extract object key from event */ protected extractObjectKey(event: SupabaseWebhookPayload): string; /** * Extract bucket from event */ protected extractBucket(event: SupabaseWebhookPayload): string | undefined; /** * Generate idempotency key * Use object ID + event type for uniqueness */ getIdempotencyKey(payload: StorageWebhookPayload): string; /** * Check if adapter should process this webhook */ shouldProcess(payload: StorageWebhookPayload): boolean; }