@swell/cli
Version:
Swell's command line interface/utility
33 lines (32 loc) • 1.06 kB
TypeScript
interface CreateWebhookFileBody {
$schema: string;
description?: string;
enabled?: boolean;
events: string[];
url: string;
}
type ErrorHandler = (msg: string, options: {
exit: number;
}) => never;
/**
* Parse comma-separated events string to array
* Input: "payment.succeeded,payment.failed"
* Output: ["payment.succeeded", "payment.failed"]
*/
declare const parseEvents: (eventsInput: string) => string[];
/**
* Validate event format (model.action pattern)
* Valid: "product.created", "payment.succeeded"
* Invalid: "product", "created", "", ".created", "product."
*/
declare const validateEventFormat: (events: string[], onError: ErrorHandler) => void;
/**
* Validate URL format (basic check for protocol)
*/
declare const validateUrl: (url: string, onError: ErrorHandler) => void;
/**
* Convert name to webhook label
* "payment-handler" => "Payment Handler"
*/
declare const toWebhookLabel: (value: string) => string;
export { CreateWebhookFileBody, parseEvents, toWebhookLabel, validateEventFormat, validateUrl, };