Feature: Receptor de webhooks interno para debug
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m3s
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
This commit is contained in:
41
server/services/debug/webhook-store.ts
Normal file
41
server/services/debug/webhook-store.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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()
|
||||
Reference in New Issue
Block a user