hook-engine
Version:
Production-grade webhook engine with comprehensive adapter support, security, reliability, structured logging, and CLI tools.
73 lines (72 loc) • 2.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeoutError = exports.WebhookDuplicateError = exports.WebhookAdapterError = exports.WebhookRateLimitError = exports.WebhookValidationError = exports.WebhookProcessingError = exports.WebhookParseError = exports.WebhookSignatureError = void 0;
const base_1 = require("./base");
/**
* Webhook signature verification failed
*/
class WebhookSignatureError extends base_1.HookEngineError {
constructor(source, context = {}) {
super(`Webhook signature verification failed for source: ${source}`, 'WEBHOOK_SIGNATURE_ERROR', { source, ...context }, false);
}
}
exports.WebhookSignatureError = WebhookSignatureError;
/**
* Webhook payload parsing failed
*/
class WebhookParseError extends base_1.HookEngineError {
constructor(message, context = {}) {
super(message, 'WEBHOOK_PARSE_ERROR', context, false);
}
}
exports.WebhookParseError = WebhookParseError;
/**
* Webhook processing failed (retryable)
*/
class WebhookProcessingError extends base_1.HookEngineError {
constructor(message, context = {}) {
super(message, 'WEBHOOK_PROCESSING_ERROR', context, true);
}
}
exports.WebhookProcessingError = WebhookProcessingError;
/**
* Webhook validation failed
*/
class WebhookValidationError extends base_1.HookEngineError {
constructor(message, context = {}) {
super(message, 'WEBHOOK_VALIDATION_ERROR', context, false);
}
}
exports.WebhookValidationError = WebhookValidationError;
/**
* Rate limit exceeded
*/
class WebhookRateLimitError extends base_1.HookEngineError {
constructor(limit, windowMs, context = {}) {
super(`Rate limit exceeded: ${limit} requests per ${windowMs}ms`, 'WEBHOOK_RATE_LIMIT_ERROR', { limit, windowMs, ...context }, true);
}
}
exports.WebhookRateLimitError = WebhookRateLimitError;
/**
* Adapter not found or supported
*/
class WebhookAdapterError extends base_1.HookEngineError {
constructor(source, context = {}) {
super(`Unsupported webhook source: ${source}`, 'WEBHOOK_ADAPTER_ERROR', { source, ...context }, false);
}
}
exports.WebhookAdapterError = WebhookAdapterError;
/**
* Duplicate webhook event (not really an error, but useful for tracking)
*/
class WebhookDuplicateError extends base_1.HookEngineError {
constructor(eventId, context = {}) {
super(`Duplicate webhook event: ${eventId}`, 'WEBHOOK_DUPLICATE_ERROR', { eventId, ...context }, false);
}
}
exports.WebhookDuplicateError = WebhookDuplicateError;
/**
* Re-export TimeoutError for convenience
*/
var base_2 = require("./base");
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return base_2.TimeoutError; } });