/** * Sanitization and formatting pure functions. Every display/log surface of * dsh-budget goes through these: webhook URLs, alert text, token counts and * money amounts. Never log or render a raw config or wire value. * * @module dsh-budget/estimate/sanitize */ /** * Make arbitrary text safe for one-line display and logs: strip control and * invisible characters, collapse whitespace runs, truncate with an ellipsis. * * @param input - raw text (possibly hostile). * @param maxLength - output length cap (default 200). * @returns the sanitized text. */ export declare function sanitizeText(input: string, maxLength?: number): string; /** * Redact credentials from a URL for display and logs: the userinfo component * (`user:pass@`) is replaced, the rest is kept, and overlong URLs are cut. * Query parameters are preserved verbatim — a webhook URL's own secret query * tokens are the operator's responsibility to rotate, but the userinfo is * always redacted. * * @param input - raw URL (possibly hostile). * @param maxLength - output length cap (default 512). * @returns the redacted URL, or '' when it cannot be parsed. */ export declare function sanitizeUrl(input: string, maxLength?: number): string; /** Display-currency options for {@link formatMoney}. */ export interface MoneyFormat { /** Currency code placed before the amount (display only). */ code: string; /** Display-currency units per 1 USD (1 = USD). */ rate: number; /** Decimal places. */ decimals: number; } /** * Format a USD amount in the configured display currency, deterministically * (no locale-dependent grouping): converted by `rate`, rounded to `decimals` * places, grouped with commas, prefixed with the currency code. * * @param usd - amount in USD. * @param format - display options. * @returns e.g. `USD 1,234.57`; non-finite input renders as `USD 0.00`. */ export declare function formatMoney(usd: number, format: Readonly): string; /** * Format a token count compactly: `999` stays as-is, `1234` → `1.23k`, * `4_500_000` → `4.50M`. * * @param tokens - non-negative token count. * @returns the compact string. */ export declare function formatTokens(tokens: number): string; //# sourceMappingURL=sanitize.d.ts.map