import * as FirebaseHttps from 'firebase-functions/https'; import * as express from 'express'; import { BasePayload, FunctionTypes, InsertPayload, Operation, Payload, UpdatePayload } from './common'; export type SupabaseWebhookRequest = Omit & { body: TBody; }; /** * Validates the request by returning true/false and sends a 400 response if invalid. * @param req The request. * @param res The response we can send. * @param tableName The name of the table. * @param functionType The operation on the table to subscribe to. * @returns If the request is valid or not. Sends a 400 response if invalid. */ export declare const validateRequest: (req: SupabaseWebhookRequest>, res: express.Response, tableName: string, operation: Operation) => boolean; type OperationPayload = TOperation extends Operation.Create ? InsertPayload : TOperation extends Operation.Update ? UpdatePayload : BasePayload; /** * Creates a "Supabase" function which performs all of the wiring to bridge Supabase with Firebase. * Sends status 200 on success (if you don't send it yourself). * Sends status 500 on any error. * @param tableName The table to subscribe to. * @param functionType The operation to subscribe to (INSERT/UPDATE). * @param body The function body. * @param options Firebase function options like memory limit, etc. * @returns A Firebase HTTP function. */ export declare const createSupabaseFunction: (tableName: string, operation: TOperation | FunctionTypes, body: (request: SupabaseWebhookRequest>, response: express.Response) => void | Promise, options?: FirebaseHttps.HttpsOptions, sqlCondition?: string) => FirebaseHttps.HttpsFunction; export * from './common';