Update dependencies and improve type safety in webhook handling
This commit updates various dependencies across the project, including a version bump for 'lucide-react' and 'prettier'. Additionally, it improves type safety in the 'database-webhook-handler.service.ts' by making the 'DatabaseChangePayload' and 'handleEvent' function more type-safe.
This commit is contained in:
@@ -11,7 +11,8 @@ import { getDatabaseWebhookVerifier } from './verifier';
|
||||
* @name DatabaseChangePayload
|
||||
* @description Payload for the database change event. Useful for handling custom webhooks.
|
||||
*/
|
||||
export type DatabaseChangePayload = RecordChange<keyof Tables>;
|
||||
export type DatabaseChangePayload<Table extends keyof Tables> =
|
||||
RecordChange<Table>;
|
||||
|
||||
export function getDatabaseWebhookHandlerService() {
|
||||
return new DatabaseWebhookHandlerService();
|
||||
@@ -33,7 +34,11 @@ class DatabaseWebhookHandlerService {
|
||||
async handleWebhook(
|
||||
request: Request,
|
||||
params?: {
|
||||
handleEvent(payload: DatabaseChangePayload): unknown;
|
||||
handleEvent<Table extends keyof Tables>(
|
||||
payload: Table extends keyof Tables
|
||||
? DatabaseChangePayload<Table>
|
||||
: never,
|
||||
): unknown;
|
||||
},
|
||||
) {
|
||||
const logger = await getLogger();
|
||||
|
||||
Reference in New Issue
Block a user