refactor: tighten plugin sdk channel seams

This commit is contained in:
Peter Steinberger
2026-03-16 01:05:18 -07:00
parent 7a09255361
commit f11589b311
72 changed files with 319 additions and 125 deletions

View File

@@ -48,6 +48,7 @@ export type WebhookAnomalyTracker = {
clear: () => void;
};
/** Create a simple fixed-window rate limiter for in-memory webhook protection. */
export function createFixedWindowRateLimiter(options: {
windowMs: number;
maxRequests: number;
@@ -104,6 +105,7 @@ export function createFixedWindowRateLimiter(options: {
};
}
/** Count keyed events in memory with optional TTL pruning and bounded cardinality. */
export function createBoundedCounter(options: {
maxTrackedKeys: number;
ttlMs?: number;
@@ -161,6 +163,7 @@ export function createBoundedCounter(options: {
};
}
/** Track repeated webhook failures and emit sampled logs for suspicious request patterns. */
export function createWebhookAnomalyTracker(options?: {
maxTrackedKeys?: number;
ttlMs?: number;