/** * Represents a notification message to be sent through fire-signal. */ interface FSMessage { /** * Title/subject of the notification. * Not all providers support titles (e.g., some webhooks may ignore it). */ title?: string; /** * Main body/content of the notification. * This is the only required field. */ body: string; /** * Optional attachments to include with the notification. */ attachments?: FSAttachment[]; /** * Interactive actions (buttons) to display with the message. * Note: Support varies by provider. */ actions?: FSAction[]; /** * Additional metadata that providers can use for custom behavior. */ metadata?: Record; } /** * Represents an interactive action (button). */ interface FSAction { /** Label text to display on the button. */ label: string; /** URL to open when clicked. */ url: string; /** Visual style of the button. @default 'secondary' */ style?: 'primary' | 'secondary' | 'danger'; } /** * Represents an attachment to be sent with a notification. * * @example * ```typescript * // Using URL * { url: 'https://example.com/file.pdf', name: 'report.pdf' } * * // Using Buffer content * { content: fs.readFileSync('./file.pdf'), name: 'report.pdf' } * * // Using base64 string * { content: 'base64string...', name: 'image.png', contentType: 'image/png' } * ``` */ interface FSAttachment { /** * URL to the attachment (http, https, or file://). * Either url or content must be provided. */ url?: string; /** * File content as Buffer or base64 string. * Either url or content must be provided. */ content?: Buffer | string; /** * Display name for the attachment (required for content, optional for url). */ name?: string; /** * MIME type of the attachment (e.g., 'application/pdf', 'image/png'). */ contentType?: string; } /** * Custom error types for fire-signal. */ /** * Base error class for all fire-signal errors. */ declare class FSError extends Error { readonly code: string; constructor(message: string, code: string); } /** * Error thrown when a provider fails to send a notification. */ declare class FSProviderError extends FSError { readonly providerId: string; readonly cause?: Error | undefined; constructor(message: string, providerId: string, cause?: Error | undefined); } /** * Error thrown when parsing a notification URL fails. */ declare class FSParseError extends FSError { readonly url: string; constructor(message: string, url: string); } /** * Error thrown when loading configuration fails. */ declare class FSConfigError extends FSError { readonly path?: string | undefined; constructor(message: string, path?: string | undefined); } /** * Error thrown when a required provider is not found. */ declare class FSProviderNotFoundError extends FSError { readonly schema: string; constructor(schema: string); } /** * Error thrown when URL validation fails with specific field errors. */ declare class FSValidationError extends FSError { readonly field: string; readonly url: string; readonly suggestion?: string | undefined; constructor(message: string, field: string, url: string, suggestion?: string | undefined); } /** * Error thrown when credentials are missing or invalid. */ declare class FSCredentialsError extends FSError { readonly schema: string; readonly missingFields?: string[] | undefined; constructor(message: string, schema: string, missingFields?: string[] | undefined); } /** * Error thrown when a network/HTTP request fails. */ declare class FSNetworkError extends FSError { readonly statusCode?: number | undefined; readonly providerId?: string | undefined; constructor(message: string, statusCode?: number | undefined, providerId?: string | undefined); /** * Creates a human-readable error from HTTP status code. */ static fromStatus(status: number, providerId?: string): FSNetworkError; } /** * Error thrown when platform ingestion/evaluate request fails. */ declare class FSPlatformError extends FSError { readonly category: 'auth' | 'validation' | 'transient' | 'network' | 'configuration'; readonly statusCode?: number | undefined; readonly retryable: boolean; readonly details?: string | undefined; constructor(message: string, category: 'auth' | 'validation' | 'transient' | 'network' | 'configuration', statusCode?: number | undefined, retryable?: boolean, details?: string | undefined); } /** * Circuit breaker states. */ declare enum CircuitState { /** Normal operation, requests allowed. */ CLOSED = "CLOSED", /** Failing, requests blocked. */ OPEN = "OPEN", /** Testing if service recovered. */ HALF_OPEN = "HALF_OPEN" } /** * Error thrown when resilience controls block a request. */ declare class ResilienceError extends FSError { readonly reason: 'rate_limit' | 'circuit_breaker'; readonly providerId: string; readonly retryAfterMs?: number | undefined; constructor(message: string, reason: 'rate_limit' | 'circuit_breaker', providerId: string, retryAfterMs?: number | undefined); } /** * Resilience configuration options. */ interface ResilienceConfig { /** * Rate limiting configuration. */ rateLimit?: { /** Maximum number of requests allowed. */ requests: number; /** Time period in milliseconds. */ periodMs: number; }; /** * Circuit breaker configuration. */ circuitBreaker?: { /** Number of consecutive failures before opening the circuit. */ failureThreshold: number; /** Time in milliseconds before attempting to close the circuit. */ resetTimeoutMs: number; }; } /** * Represents a parsed notification URL. */ interface FSParsedUrl$1 { /** The URL schema/protocol (e.g., 'mailto', 'discord', 'slack'). */ schema: string; /** Hostname portion of the URL. */ hostname?: string; /** Port number if specified. */ port?: number; /** Username for authentication. */ username?: string; /** Password for authentication. */ password?: string; /** Path portion of the URL (without leading slash). */ path?: string; /** Path split into segments. */ segments: string[]; /** Query parameters parsed from the URL. */ params: Record; /** The original raw URL string. */ raw: string; } /** * Context provided to a provider when sending a notification. */ interface FSProviderContext { url: string; parsed: FSParsedUrl$1; tags?: string[]; audience?: string[]; segmentId?: string; templateKey?: string; } /** * Result of a provider send operation. */ interface FSProviderResult { success: boolean; providerId: string; raw?: unknown; error?: Error; /** Number of attempts made (1 = no retries, >1 = retried). */ attempts?: number; /** Total duration including retries in milliseconds. */ durationMs?: number; /** Whether this result came after retrying. */ retried?: boolean; } /** * Interface for notification providers. */ interface FSProvider { /** Unique identifier for this provider. */ id: string; /** URL schemas this provider handles (e.g., ['discord']). */ schemas: string[]; /** Parses a URL into components specific to this provider. */ parseUrl(raw: string): FSParsedUrl$1; /** Sends a notification message. */ send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Base class for notification providers with common helper methods. */ declare abstract class BaseProvider implements FSProvider { abstract readonly id: string; abstract readonly schemas: string[]; abstract parseUrl(raw: string): FSParsedUrl$1; abstract send(message: FSMessage, ctx: FSProviderContext): Promise; /** Creates a success result. */ protected success(raw?: unknown): FSProviderResult; /** Creates a failure result. */ protected failure(error: Error, raw?: unknown): FSProviderResult; /** * Creates an HTTP failure result with human-readable error description. * Use this for API/webhook errors. * * @param providerName - Display name for the provider (e.g., "Discord", "Slack") * @param response - The HTTP Response object * @param responseText - Optional response body text */ protected httpFailure(providerName: string, response: Response, responseText?: string): Promise; /** Gets the first value from a param that may be an array. */ protected getParam(value: string | string[] | undefined): string | undefined; /** Extracts the schema from a URL string. */ protected extractSchema(url: string): string; /** Parses a query string into a params object. */ protected parseQueryParams(queryString: string): Record; } /** * Tag filtering utilities for fire-signal. */ /** * Represents a URL entry with optional tags. */ interface TaggedUrl { url: string; tags: string[]; } /** * Filters URLs by tags. * If no filter tags are provided, all URLs are returned. * If filter tags are provided, only URLs with at least one matching tag are returned. * * @param entries - Array of tagged URL entries * @param filterTags - Tags to filter by (optional) * @returns Filtered array of URL strings */ declare function filterByTags(entries: TaggedUrl[], filterTags?: string[]): string[]; /** * Parses a comma-separated tag string into an array. * * @param tagString - Comma or space separated tags * @returns Array of tags */ declare function parseTags(tagString: string): string[]; /** * Simple logger utility for fire-signal. */ /** * Available log levels. * - silent: No output * - error: Only errors * - warn: Errors and warnings * - info: Errors, warnings, and info * - debug: All output including debug */ type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug'; type LoggerFn = (message: string, level?: LogLevel) => void; /** * Creates a console logger. * * @param minLevel - Minimum log level to output * @returns A logger function */ declare function createConsoleLogger(minLevel?: LogLevel): LoggerFn; /** * A no-op logger that does nothing. */ declare const silentLogger: LoggerFn; /** * Context passed to onError handlers. */ interface FSErrorContext { /** The provider ID that failed */ providerId: string; /** The URL that was being used */ url: string; /** The original message being sent */ message: FSMessage; /** Tags used in this send operation */ tags?: string[]; } /** * Error handler configuration. */ interface FSOnErrorConfig { /** * Tags to automatically notify when a send fails. * These tags will not be used if they caused the original failure (to prevent loops). */ fallbackTags?: string[]; /** * Custom message function for fallback notifications. */ message?: (error: Error, context: FSErrorContext) => string; /** * External callback for additional error handling (e.g., send to Sentry). */ callback?: (error: Error, context: FSErrorContext) => void | Promise; } /** * Options for creating a FireSignal instance. */ interface FireSignalOptions { /** Initial URLs to add. */ urls?: string[]; /** Custom providers to register (in addition to built-in ones). */ providers?: FSProvider[]; /** Logger function for debugging. */ logger?: LoggerFn; /** * Log level. Uses console logger at this level. * Overridden if custom `logger` is provided. * @default 'silent' */ logLevel?: LogLevel; /** Additional config file paths to load. */ configPaths?: string[]; /** Whether to automatically load config from default paths. @default true */ autoLoadConfig?: boolean; /** Whether to skip registering built-in providers. @default false */ skipDefaultProviders?: boolean; /** * Error handler configuration. * Called when a provider fails to send a notification. */ onError?: FSOnErrorConfig; /** * Resilience configuration for rate limiting and circuit breaker. */ resilience?: ResilienceConfig; /** * Notification mode. * - 'enabled': Normal operation, sends notifications (default) * - 'disabled': Silent, skips all sends * - 'dryRun': Logs but doesn't send * @default 'enabled' */ mode?: 'enabled' | 'disabled' | 'dryRun'; /** * When true, platform-only APIs throw if fire:// provider is not configured. * When false (default), they warn and no-op. */ strictPlatformProvider?: boolean; /** Request timeout for platform ingestion/evaluate API calls. */ platformTimeoutMs?: number; /** Max retries for transient platform request failures. */ platformMaxRetries?: number; /** Track batching configuration. */ trackBatch?: { enabled?: boolean; flushIntervalMs?: number; maxBatchSize?: number; maxQueueSize?: number; autoFlushOnExit?: boolean; flushOnExitTimeoutMs?: number; }; } /** * Options for sending a notification. */ interface SendOptions { /** Tags to filter URLs. Only URLs with matching tags will receive the notification. */ tags?: string[]; /** * Fire Platform audience labels (forwarded only by FireProvider). * This is independent from `tags`, which are used for provider routing. */ audience?: string[]; /** * Fire Platform segment identifier (forwarded only by FireProvider). * When provided, Fire Platform routes by segment. */ segmentId?: string; /** * Fire Platform template key (forwarded only by FireProvider). * Fire Platform resolves this key to the corresponding server-side template. */ templateKey?: string; /** * Parameters to replace placeholders in URLs. * Placeholders use {name} format and will be replaced with the corresponding value. * @example * ```typescript * fire.add('mailto://...?to={email}', ['user']); * await fire.send(msg, { params: { email: 'user@example.com' } }); * ``` */ params?: Record; } interface PlatformCallOptions { tags?: string[]; params?: Record; } interface TrackPayload { occurredAt?: string; user?: { id: string; }; company?: { id: string; }; properties?: Record; [key: string]: unknown; } interface IdentifyTraits { [key: string]: unknown; } interface IncidentReportPayload { title?: string; code: string; fingerprint: string; severity: 'P1' | 'P2' | 'P3' | 'P4'; message?: string; metadata?: Record; occurredAt?: string; } interface FlagsContext { user?: { id: string; }; company?: { id: string; }; traits?: Record; } interface FlagDecision { key: string; enabled: boolean; variantKey?: string; value?: T; reason?: string; fetchedAt: string; } /** * FireSignal - Unified notification sender. * * @example * ```typescript * const fs = new FireSignal({ * urls: ['discord://webhookId/webhookToken', 'mailto://user:pass@smtp.example.com'] * }); * * await fs.send({ title: 'Hello', body: 'World!' }); * ``` */ declare class FireSignal { private entries; private providers; private logger; private configPaths; private configLoaded; private onErrorConfig?; private templateManager; private resilienceManager?; private mode; private strictPlatformProvider; private platformTimeoutMs; private platformMaxRetries; private trackBatchEnabled; private trackBatchFlushIntervalMs; private trackBatchMaxBatchSize; private trackBatchMaxQueueSize; private trackBatchAutoFlushOnExit; private trackBatchFlushOnExitTimeoutMs; private trackQueue; private trackFlushTimer; private trackExitHandlersRegistered; private trackExitInProgress; private beforeExitHandler?; private sigintHandler?; private sigtermHandler?; readonly incident: { report: (payload: IncidentReportPayload, options?: PlatformCallOptions) => Promise; }; readonly flags: { evaluate: (key: string, context?: FlagsContext, options?: PlatformCallOptions) => Promise>; isEnabled: (key: string, context?: FlagsContext, options?: PlatformCallOptions) => Promise; getVariantValue: (key: string, context?: FlagsContext, options?: PlatformCallOptions) => Promise; }; constructor(options?: FireSignalOptions); /** * Registers a provider for its supported schemas. */ registerProvider(provider: FSProvider): void; /** * Adds one or more URLs to send notifications to. * * @param urlOrUrls - URL string or array of URLs * @param tags - Optional tags to associate with these URLs */ add(urlOrUrls: string | string[], tags?: string[]): void; /** * Register a message template from a file. * * Template files support frontmatter for title: * ``` * --- * title: Hello {{name}}! * --- * Welcome to our service, {{name}}. * ``` * * @param name - Unique template identifier. * @param filePath - Path to the template file. */ registerTemplate(name: string, filePath: string): Promise; /** * Register a message template inline (no file). * * @param name - Unique template identifier. * @param template - Object with title (optional) and body Handlebars templates. */ registerTemplateInline(name: string, template: { title?: string; body: string; }): void; /** * Send a message using a registered template. * * @param templateName - Name of the registered template. * @param data - Data object for variable substitution. * @param options - Send options (tags, params). * @returns Array of results from each provider. * * @example * ```typescript * fire.registerTemplateInline('alert', { * title: 'Alert: {{severity}}', * body: 'Service {{service}} is {{status}}.', * }); * * await fire.sendTemplate('alert', { * severity: 'HIGH', * service: 'API Gateway', * status: 'DOWN', * }, { tags: ['ops'] }); * ``` */ sendTemplate(templateName: string, data: Record, options?: SendOptions): Promise; private addFromConfig; /** * Loads configuration from files and environment variables. * * @param path - Optional path to a specific config file. If provided, loads only that file. * If not provided, auto-detects environment config (fire-signal.{NODE_ENV}.yml). */ loadConfig(path?: string): Promise; /** Returns all registered URLs. */ getUrls(): string[]; /** Returns all entries with tags. */ getEntries(): TaggedUrl[]; /** Gets a provider by schema. */ getProvider(schema: string): FSProvider | undefined; private extractSchema; /** * Sends a notification to all configured URLs. * * @param message - The message to send * @param options - Send options (e.g., tag filtering) * @returns Array of results from each provider */ send(message: FSMessage, options?: SendOptions): Promise; track(eventName: string, payload?: TrackPayload, options?: PlatformCallOptions): Promise; flush(): Promise; dispose(): Promise; private enqueueTrack; private registerTrackExitHandlers; private unregisterTrackExitHandlers; private handleTrackSignalExit; private flushTrackQueueWithTimeout; private flushTrackQueue; identify(externalId: string, traits?: IdentifyTraits, options?: PlatformCallOptions): Promise; private reportIncident; private evaluateFlag; private normalizeTrackPayload; private resolvePlatformTarget; private platformPost; private shouldRetryStatus; private isTransientError; private sleepWithJitter; /** * Handles errors by calling fallback notifications and/or external callback. */ private handleError; /** * Internal send that doesn't trigger error handlers (to avoid infinite loops). */ private sendInternal; } /** * Represents a parsed notification URL. */ interface FSParsedUrl { /** * The URL schema/protocol (e.g., 'mailto', 'discord', 'slack'). */ schema: string; /** * Hostname portion of the URL. */ hostname?: string; /** * Port number if specified. */ port?: number; /** * Username for authentication. */ username?: string; /** * Password for authentication. */ password?: string; /** * Path portion of the URL (without leading slash). */ path?: string; /** * Path split into segments. */ segments: string[]; /** * Query parameters parsed from the URL. * Values can be strings or arrays for repeated params. */ params: Record; /** * The original raw URL string. */ raw: string; } /** * URL Validator for Fire-Signal. * * Provides surgical validation errors with specific field information * and suggestions for fixing common issues. */ /** * Validation error with contextual information. */ interface ValidationError { code: string; message: string; field?: string; suggestion?: string; } /** * Validation warning (non-blocking). */ interface ValidationWarning { code: string; message: string; field?: string; } /** * Result of URL validation. */ interface ValidationResult { valid: boolean; parsed?: FSParsedUrl; errors: ValidationError[]; warnings: ValidationWarning[]; } /** * Validates a fire-signal URL with surgical error messages. * * @param url - The URL to validate * @returns Validation result with parsed URL, errors, and warnings */ declare function validateFSUrl(url: string): ValidationResult; /** * Throws appropriate error if URL validation fails. * * @param url - The URL to validate * @returns Parsed URL if valid * @throws FSValidationError or FSCredentialsError if invalid */ declare function validateAndParseFSUrl(url: string): FSParsedUrl; /** * Checks if URL is valid without throwing. */ declare function isValidUrl(url: string): boolean; /** * Template definition structure. */ interface FSTemplate { /** Unique template name for reference. */ name: string; /** Path to .hbs file OR inline template string. */ source: string; /** Whether source is inline content (true) or file path (false). */ inline?: boolean; } /** * TemplateManager handles registration, loading, and rendering of message templates. * * Templates use Handlebars syntax for variable substitution. * * @example * ```typescript * const manager = new TemplateManager(); * * // Register from file * await manager.register('welcome', 'templates/welcome.hbs'); * * // Register inline * manager.registerInline('alert', { * title: 'Alert: {{severity}}', * body: 'Service {{service}} is {{status}}.', * }); * * // Render * const message = await manager.render('welcome', { name: 'John' }); * ``` */ declare class TemplateManager { private templates; /** * Register a template from a file path. * * File format (JSON or YAML-like): * ``` * --- * title: Welcome, {{name}}! * --- * Hello {{name}}, * * Thank you for joining us! * ``` * * @param name - Unique template identifier. * @param filePath - Path to the template file (.hbs or .md). */ register(name: string, filePath: string): Promise; /** * Register a template inline (no file). * * @param name - Unique template identifier. * @param template - Object with title (optional) and body template strings. */ registerInline(name: string, template: { title?: string; body: string; }): void; /** * Check if a template is registered. */ has(name: string): boolean; /** * Render a template with data. * * @param name - Template name to render. * @param data - Data object for variable substitution. * @returns FSMessage with rendered title and body. */ render(name: string, data?: Record): FSMessage; /** * Parse a template file with frontmatter-style title. * * Supported formats: * 1. Frontmatter (---): * ``` * --- * title: Hello {{name}} * --- * Body content here. * ``` * * 2. Plain body (no title): * ``` * Just body content. * ``` */ private parseTemplateFile; /** * List all registered template names. */ list(): string[]; /** * Clear all registered templates. */ clear(): void; } /** * Configuration options for providers. */ interface FSProviderConfig { /** * Timeout in milliseconds for provider operations. * @default 30000 */ timeout?: number; /** * Number of retry attempts on failure. * @default 0 */ retries?: number; /** * Initial delay between retries in milliseconds. * @default 1000 */ retryDelay?: number; /** * Backoff multiplier for exponential retry delay. * @default 2 */ backoffMultiplier?: number; /** * Maximum delay between retries in milliseconds. * @default 30000 */ maxRetryDelay?: number; /** * HTTP status codes that should trigger a retry. * @default [429, 500, 502, 503, 504] */ retryableStatuses?: number[]; } /** * Default provider configuration values. */ declare const DEFAULT_PROVIDER_CONFIG: Required; /** * SMTP Email Provider. * * URL Format: mailto://user:pass@smtp.example.com:port * * Query params: * - to: Recipient email(s), comma-separated * - from: Sender email (optional, defaults to user) * - cc: CC recipients * - bcc: BCC recipients * - secure: Use TLS (true/false, default based on port) */ declare class SmtpProvider extends BaseProvider { readonly id = "smtp"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; private formatHtml; } /** * Discord Webhook Provider. * * URL Format: discord://webhookId/webhookToken * * Query params: * - avatar_url: URL to avatar image * - username: Bot username * - tts: Text-to-speech (true/false) */ declare class DiscordWebhookProvider extends BaseProvider { readonly id = "discord"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; private formatContent; } /** * Rocket.Chat Webhook Provider. * * URL Format: rocketchat://hostname/webhookToken * * Query params: * - channel: Channel to post to (e.g., #general or @username) * - alias: Bot alias/username * - avatar: URL to avatar image * - emoji: Emoji to use as avatar (e.g., :rocket:) */ declare class RocketChatWebhookProvider extends BaseProvider { readonly id = "rocketchat"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; private formatContent; } /** * Slack Webhook Provider. * * URL Format: slack://T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX * * Query params: * - channel: Channel to post to (e.g., #general or @username) * - username: Bot username * - icon_emoji: Emoji to use as icon (e.g., :robot:) * - icon_url: URL to icon image */ declare class SlackWebhookProvider extends BaseProvider { readonly id = "slack"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; private formatContent; } /** * Telegram Bot Provider. * * URL Format: tgram://botToken/chatId * * Query params: * - parse_mode: Message format (HTML, Markdown, MarkdownV2) * - disable_web_page_preview: Disable link previews (true/false) * - disable_notification: Send silently (true/false) */ declare class TelegramBotProvider extends BaseProvider { readonly id = "telegram"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; private formatContent; } /** * JSON Webhook Provider - Generic JSON POST webhook. * * URL Format: json://hostname/path or jsons://hostname/path (HTTPS) * * Query params: * - method: HTTP method (default: POST) * - content_type: Content-Type header (default: application/json) */ declare class JsonWebhookProvider extends BaseProvider { readonly id = "json"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * ntfy Provider - Self-hosted push notifications. * * URL Format: ntfy://host/topic or ntfys://host/topic (HTTPS) * * Query params: * - priority: Message priority (min, low, default, high, urgent) * - tags: Comma-separated emoji tags (e.g., warning,skull) * - click: URL to open when notification is clicked * - attach: URL of attachment * - icon: URL of notification icon * - email: Email address for email notifications * - delay: Delay before sending (e.g., 30min, 2h) */ declare class NtfyProvider extends BaseProvider { readonly id = "ntfy"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Gotify Provider - Self-hosted push notifications. * * URL Format: gotify://host/token or gotifys://host/token (HTTPS) * * Query params: * - priority: Message priority (1-10, default 5) */ declare class GotifyProvider extends BaseProvider { readonly id = "gotify"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Google Chat Provider - Workspace chat via webhooks. * * URL Format: gchat://chat.googleapis.com/v1/spaces/SPACE/messages?key=KEY&token=TOKEN * * The webhook URL from Google Chat is: * https://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN * * Convert to fire-signal format: * gchat://chat.googleapis.com/v1/spaces/SPACE_ID/messages?key=KEY&token=TOKEN * * Or simpler (just the webhook path after the host): * gchat://SPACE_ID/KEY/TOKEN */ declare class GoogleChatProvider extends BaseProvider { readonly id = "gchat"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Mattermost Provider - Incoming webhooks. * * URL Format: mmost://host/hook_id or mmosts://host/hook_id (HTTPS) * * The webhook URL from Mattermost is: * https://mattermost.example.com/hooks/HOOK_ID * * Convert to fire-signal format: * mmosts://mattermost.example.com/HOOK_ID * * Query params: * - channel: Override the default channel (e.g., #general, @username) * - username: Override the webhook username * - icon_url: Override the webhook icon */ declare class MattermostProvider extends BaseProvider { readonly id = "mattermost"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Microsoft Teams Provider - Incoming webhooks. * * URL Format: msteams://WEBHOOK_URL_ENCODED or the full webhook URL * * MS Teams webhook URLs look like: * https://tenant.webhook.office.com/webhookb2/GUID@GUID/IncomingWebhook/GUID/GUID * * Convert to fire-signal format: * msteams://tenant.webhook.office.com/webhookb2/GUID@GUID/IncomingWebhook/GUID/GUID * * Query params: * - theme_color: Hex color for the message card (without #) */ declare class MSTeamsProvider extends BaseProvider { readonly id = "msteams"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * OneSignal Provider - Push notifications via OneSignal. * * URL Format (Apprise-compatible): * onesignal://app_id@api_key/ * onesignal://template_id:app_id@api_key/ * onesignal://app_id@api_key/{player_id}/{player_id2}/ * onesignal://app_id@api_key/#{segment}/ * onesignal://app_id@api_key/@{user_id}/ * onesignal://app_id@api_key/{email}/ * * Path targets: * - {player_id} - Target by OneSignal player ID * - #{segment} - Target by segment (e.g., #Subscribed%20Users) * - @{user_id} - Target by external user ID * - {email} - Target by email address * * Query params: * - subtitle: Subtitle for iOS * - language: 2-char language code (default: en) * - image: yes/no to include image (default: yes) * - batch: yes/no for batch mode (default: no) */ declare class OneSignalProvider extends BaseProvider { readonly id = "onesignal"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Pushover Provider - Push notifications via Pushover. * * URL Format: * pover://user_key@api_token/ * pover://user_key@api_token/{device}/ * pover://user_key@api_token/{device1}/{device2}/ * * Path targets: * - {device} - Target specific device(s) * * Query params: * - priority: -2 (lowest) to 2 (emergency) * - sound: Notification sound * - url: Supplementary URL * - url_title: Title for the URL * - html: yes/no for HTML formatting * - ttl: Time to live in seconds */ declare class PushoverProvider extends BaseProvider { readonly id = "pushover"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Twilio Provider - SMS and WhatsApp messages via Twilio. * * URL Format: * twilio://AccountSID:AuthToken@FromPhone/ToPhone * twilio://AccountSID:AuthToken@FromPhone/ToPhone1/ToPhone2 * twilio://AccountSID:AuthToken@FromPhone/w:ToWhatsApp * * Phone numbers must include country code (e.g., +5511999999999) * WhatsApp recipients use w: prefix (e.g., w:+5511999999999) */ declare class TwilioProvider extends BaseProvider { readonly id = "twilio"; readonly schemas: string[]; parseUrl(raw: string): FSParsedUrl$1; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Fire Platform Provider * * Delegates notification delivery to Fire Platform (the SaaS). * Fire Platform then distributes to configured channels (Discord, Slack, Email, etc.) * * @example * ```typescript * fire.add('fire://fp_live_xyz123@api.fire-signal.com'); * ``` */ declare class FireProvider extends BaseProvider { readonly id = "fire"; readonly schemas: string[]; static readonly DEFAULT_HOST = "api.fire-signal.com"; parseUrl(raw: string): { schema: string; hostname: string; port: number | undefined; username: string | undefined; password: undefined; path: string; params: {}; segments: never[]; raw: string; }; send(message: FSMessage, ctx: FSProviderContext): Promise; } /** * Provider registry - exports all built-in providers. */ /** * Creates instances of all built-in providers. * * @returns Array of provider instances */ declare function createDefaultProviders(): FSProvider[]; /** * Provider schema to provider class mapping. */ declare const PROVIDER_SCHEMAS: { readonly mailto: typeof SmtpProvider; readonly mailtos: typeof SmtpProvider; readonly discord: typeof DiscordWebhookProvider; readonly rocketchat: typeof RocketChatWebhookProvider; readonly rocket: typeof RocketChatWebhookProvider; readonly slack: typeof SlackWebhookProvider; readonly tgram: typeof TelegramBotProvider; readonly telegram: typeof TelegramBotProvider; readonly json: typeof JsonWebhookProvider; readonly jsons: typeof JsonWebhookProvider; readonly ntfy: typeof NtfyProvider; readonly ntfys: typeof NtfyProvider; readonly gotify: typeof GotifyProvider; readonly gotifys: typeof GotifyProvider; readonly gchat: typeof GoogleChatProvider; readonly googlechat: typeof GoogleChatProvider; readonly mmost: typeof MattermostProvider; readonly mmosts: typeof MattermostProvider; readonly msteams: typeof MSTeamsProvider; readonly onesignal: typeof OneSignalProvider; readonly pover: typeof PushoverProvider; readonly pushover: typeof PushoverProvider; readonly twilio: typeof TwilioProvider; readonly fire: typeof FireProvider; }; /** * Configuration file loader for fire-signal. */ /** * Represents a single URL entry from configuration. */ interface FSConfigEntry { url: string; tags?: string[]; } /** * Loaded configuration data. */ interface FSLoadedConfig { entries: FSConfigEntry[]; } /** * Default configuration file paths. */ declare const DEFAULT_CONFIG_PATHS: string[]; /** * Loads configuration from the default and specified paths. * * @param paths - Additional paths to check * @returns Loaded configuration */ declare function loadFSConfig(paths?: string[]): Promise; /** * Writes a configuration file. * * @param filePath - Path to write to * @param entries - Entries to write */ declare function writeFSConfig(filePath: string, entries: FSConfigEntry[]): Promise; /** * Environment variable utilities for fire-signal. */ /** * Environment variable names used by fire-signal. */ declare const ENV_VARS: { readonly URLS: "FIRE_SIGNAL_URLS"; readonly CONFIG_PATH: "FIRE_SIGNAL_CONFIG_PATH"; }; /** * Loads notification URLs from the FIRE_SIGNAL_URLS environment variable. * URLs can be separated by commas, spaces, or newlines. * * @returns Array of URL strings */ declare function loadUrlsFromEnv(): string[]; /** * Loads configuration file paths from the FIRE_SIGNAL_CONFIG_PATH environment variable. * Paths can be separated by colons, semicolons, or newlines. * * @returns Array of file paths */ declare function loadConfigPathsFromEnv(): string[]; /** * Retry utility with exponential backoff. */ interface RetryOptions { /** * Maximum number of retry attempts. * @default 3 */ maxAttempts?: number; /** * Initial delay in milliseconds before first retry. * @default 1000 */ initialDelay?: number; /** * Multiplier for exponential backoff. * @default 2 */ backoffMultiplier?: number; /** * Maximum delay between retries in milliseconds. * @default 30000 */ maxDelay?: number; /** * Optional callback when a retry occurs. */ onRetry?: (attempt: number, error: Error, delay: number) => void; } /** * Executes a function with retry logic. * * @param fn - Async function to execute * @param options - Retry options * @returns Result of the function */ declare function withRetry(fn: () => Promise, options?: RetryOptions): Promise; /** * Sleep for a given number of milliseconds. */ declare function sleep(ms: number): Promise; /** * Validation utilities for fire-signal. */ /** * Validates that a message has the required fields. * * @param message - Message to validate * @returns true if valid * @throws Error if invalid */ declare function validateMessage(message: FSMessage): boolean; /** * Validates an array of URLs. * * @param urls - URLs to validate * @returns Array of valid URLs */ declare function validateUrls(urls: string[]): string[]; /** * Checks if a value is a non-empty string. */ declare function isNonEmptyString(value: unknown): value is string; export { BaseProvider, CircuitState, DEFAULT_CONFIG_PATHS, DEFAULT_PROVIDER_CONFIG, DiscordWebhookProvider, ENV_VARS, type FSAction, type FSAttachment, type FSConfigEntry, FSConfigError, FSCredentialsError, FSError, type FSLoadedConfig, type FSMessage, FSNetworkError, FSParseError, type FSParsedUrl$1 as FSParsedUrl, FSPlatformError, type FSProvider, type FSProviderConfig, type FSProviderContext, FSProviderError, FSProviderNotFoundError, type FSProviderResult, type FSTemplate, FSValidationError, FireSignal, type FireSignalOptions, type FlagDecision, type FlagsContext, type IdentifyTraits, type IncidentReportPayload, JsonWebhookProvider, type LogLevel, type LoggerFn, PROVIDER_SCHEMAS, type PlatformCallOptions, type ResilienceConfig, ResilienceError, type RetryOptions, RocketChatWebhookProvider, type SendOptions, SlackWebhookProvider, SmtpProvider, type TaggedUrl, TelegramBotProvider, TemplateManager, type TrackPayload, type ValidationError, type ValidationResult, type ValidationWarning, createConsoleLogger, createDefaultProviders, filterByTags, isNonEmptyString, isValidUrl, loadConfigPathsFromEnv, loadFSConfig, loadUrlsFromEnv, parseTags, silentLogger, sleep, validateAndParseFSUrl, validateFSUrl, validateMessage, validateUrls, withRetry, writeFSConfig };