All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
- Endpoint POST /api/debug/webhook-receiver para recibir webhooks - Almacenamiento en memoria de ultimos 100 eventos - Endpoint GET/DELETE para consultar/limpiar eventos - Nueva tab Webhooks en seccion Debug con polling cada 5s
42 lines
794 B
TypeScript
42 lines
794 B
TypeScript
/**
|
|
* Debug Webhook Store
|
|
* Stores webhook events in memory for debugging
|
|
*/
|
|
|
|
interface WebhookEvent {
|
|
id: string
|
|
receivedAt: string
|
|
event: string
|
|
timestamp?: string
|
|
data: any
|
|
headers: Record<string, string | undefined>
|
|
}
|
|
|
|
class DebugWebhookStore {
|
|
private events: WebhookEvent[] = []
|
|
private maxEvents = 100
|
|
|
|
addEvent(event: WebhookEvent) {
|
|
this.events.unshift(event)
|
|
|
|
// Keep only the last N events
|
|
if (this.events.length > this.maxEvents) {
|
|
this.events = this.events.slice(0, this.maxEvents)
|
|
}
|
|
}
|
|
|
|
getEvents(limit: number = 50): WebhookEvent[] {
|
|
return this.events.slice(0, limit)
|
|
}
|
|
|
|
clear() {
|
|
this.events = []
|
|
}
|
|
|
|
getCount(): number {
|
|
return this.events.length
|
|
}
|
|
}
|
|
|
|
export const debugWebhookStore = new DebugWebhookStore()
|