import { z } from 'zod'; /** * Queue type schema for validation. * * - `worker`: Messages are consumed by workers with acknowledgment. Each message is processed by exactly one consumer. * - `pubsub`: Messages are broadcast to all subscribers. Multiple consumers can receive the same message. * * @example * ```typescript * const queueType = QueueTypeSchema.parse('worker'); // 'worker' | 'pubsub' * ``` */ export declare const QueueTypeSchema: z.ZodEnum<{ pubsub: "pubsub"; worker: "worker"; }>; /** * Queue type - either 'worker' for task queues or 'pubsub' for broadcast messaging. */ export type QueueType = z.infer; export type QueueSortField = 'name' | 'created' | 'updated' | 'message_count' | 'dlq_count'; /** * Queue settings schema for configuring queue behavior. * * These settings control message lifecycle, retry behavior, and concurrency limits. * This schema includes defaults and is used for output types and documentation. * * @example * ```typescript * const settings = QueueSettingsSchema.parse({ * default_ttl_seconds: 3600, // Messages expire after 1 hour * default_visibility_timeout_seconds: 60, // Processing timeout * default_max_retries: 3, // Retry failed messages 3 times * }); * ``` */ export declare const QueueSettingsSchema: z.ZodObject<{ default_ttl_seconds: z.ZodOptional>; default_visibility_timeout_seconds: z.ZodDefault; default_max_retries: z.ZodDefault; default_retry_backoff_ms: z.ZodDefault; default_retry_max_backoff_ms: z.ZodDefault; default_retry_multiplier: z.ZodDefault; max_in_flight_per_client: z.ZodDefault; retention_seconds: z.ZodDefault; }, z.core.$strip>; /** * Queue settings configuration type. */ export type QueueSettings = z.infer; /** * Queue statistics schema showing current queue state. */ export declare const QueueStatsSchema: z.ZodObject<{ message_count: z.ZodNumber; dlq_count: z.ZodNumber; next_offset: z.ZodNumber; }, z.core.$strip>; /** * Queue statistics type. */ export type QueueStats = z.infer; /** * Queue schema representing a message queue. * * @example * ```typescript * const queue = await getQueue(client, 'my-queue'); * console.log(`Queue ${queue.name} has ${queue.message_count} messages`); * ``` */ export declare const QueueSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodOptional>; internal: z.ZodOptional; queue_type: z.ZodEnum<{ pubsub: "pubsub"; worker: "worker"; }>; default_ttl_seconds: z.ZodOptional>; default_visibility_timeout_seconds: z.ZodOptional; default_max_retries: z.ZodOptional; default_retry_backoff_ms: z.ZodOptional; default_retry_max_backoff_ms: z.ZodOptional; default_retry_multiplier: z.ZodOptional; max_in_flight_per_client: z.ZodOptional; next_offset: z.ZodOptional; message_count: z.ZodOptional; dlq_count: z.ZodOptional; created_at: z.ZodString; updated_at: z.ZodString; paused_at: z.ZodOptional>; retention_seconds: z.ZodOptional; }, z.core.$strip>; /** * Queue type representing a message queue instance. */ export type Queue = z.infer; /** * Message state schema for tracking message lifecycle. * * - `pending`: Message is waiting to be processed. * - `leased`: Message has been received and is currently being processed by a consumer. * - `processing`: Message has been received and is being processed (legacy, equivalent to leased). * - `delivered`: Message was successfully acknowledged. * - `failed`: Message processing failed but may be retried. * - `dead`: Message exceeded retry limit and was moved to DLQ. */ export declare const MessageStateSchema: z.ZodEnum<{ dead: "dead"; delivered: "delivered"; failed: "failed"; leased: "leased"; pending: "pending"; processing: "processing"; }>; /** * Message state type. */ export type MessageState = z.infer; /** * Message schema representing a queue message. * * @example * ```typescript * const message = await publishMessage(client, 'my-queue', { payload: 'Hello' }); * console.log(`Published message ${message.id} at offset ${message.offset}`); * ``` */ export declare const MessageSchema: z.ZodObject<{ id: z.ZodString; queue_id: z.ZodString; offset: z.ZodNumber; payload: z.ZodUnknown; size: z.ZodOptional; metadata: z.ZodOptional>>; state: z.ZodOptional>; idempotency_key: z.ZodOptional>; partition_key: z.ZodOptional>; ttl_seconds: z.ZodOptional>; delivery_attempts: z.ZodOptional; max_retries: z.ZodOptional; published_at: z.ZodOptional; expires_at: z.ZodOptional>; delivered_at: z.ZodOptional>; acknowledged_at: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; source_id: z.ZodOptional>; source_name: z.ZodOptional>; }, z.core.$strip>; /** * Message type representing a queue message. */ export type Message = z.infer; /** * Destination type schema. Supports webhook, queue, sandbox, and email destinations. */ export declare const DestinationTypeSchema: z.ZodEnum<{ email: "email"; http: "http"; queue: "queue"; sandbox: "sandbox"; url: "url"; webhook: "webhook"; }>; /** * Destination type. */ export type DestinationType = z.infer; /** * HTTP destination configuration schema for webhook delivery. * * @example * ```typescript * const config: HttpDestinationConfig = { * url: 'https://api.example.com/webhook', * method: 'POST', * headers: { 'X-Custom-Header': 'value' }, * timeout_ms: 10000, * retry_policy: { max_attempts: 3 }, * }; * ``` */ export declare const HttpDestinationConfigSchema: z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; /** * HTTP destination configuration type. */ export type HttpDestinationConfig = z.infer; /** * Destination statistics schema showing delivery metrics. */ export declare const DestinationStatsSchema: z.ZodObject<{ total_deliveries: z.ZodNumber; successful_deliveries: z.ZodNumber; failed_deliveries: z.ZodNumber; last_delivery_at: z.ZodOptional>; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>; /** * Destination statistics type. */ export type DestinationStats = z.infer; /** * URL destination configuration schema. */ export declare const UrlDestinationConfigSchema: z.ZodObject<{ url: z.ZodString; }, z.core.$strip>; /** * Webhook destination configuration schema (same shape as HTTP). */ export declare const WebhookDestinationConfigSchema: z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; /** * Queue destination configuration schema. */ export declare const QueueDestinationConfigSchema: z.ZodObject<{ queue_id: z.ZodString; }, z.core.$strip>; /** * Sandbox destination configuration schema. */ export declare const SandboxDestinationConfigSchema: z.ZodObject<{ sandbox_id: z.ZodString; }, z.core.$strip>; /** * Email destination configuration schema. */ export declare const EmailDestinationConfigSchema: z.ZodObject<{ email_address: z.ZodString; }, z.core.$strip>; /** * Generic destination configuration schema for destination types not yet fully implemented. */ export declare const GenericDestinationConfigSchema: z.ZodOptional>; /** * Destination schema representing a webhook endpoint for message delivery. * * Destinations are attached to queues and automatically receive messages when published. * * @example * ```typescript * const destination = await createDestination(client, 'my-queue', { * destination_type: 'http', * config: { url: 'https://api.example.com/webhook' }, * enabled: true, * }); * ``` */ export declare const DestinationSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; description: z.ZodOptional>; queue_id: z.ZodString; destination_type: z.ZodEnum<{ email: "email"; http: "http"; queue: "queue"; sandbox: "sandbox"; url: "url"; webhook: "webhook"; }>; config: z.ZodUnion>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ queue_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ sandbox_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ email_address: z.ZodString; }, z.core.$strip>, z.ZodOptional>]>; enabled: z.ZodBoolean; stats: z.ZodOptional>; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>>; success_count: z.ZodOptional; failure_count: z.ZodOptional; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; last_failure_error: z.ZodOptional>; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>; /** * Destination type representing a webhook endpoint. */ export type Destination = z.infer; /** * Dead letter message schema for messages that failed processing. * * Messages are moved to the dead letter queue (DLQ) after exceeding the maximum * retry limit. They can be inspected, replayed, or deleted. * * @example * ```typescript * const { messages } = await listDeadLetterMessages(client, 'my-queue'); * for (const msg of messages) { * console.log(`Failed message: ${msg.failure_reason}`); * await replayDeadLetterMessage(client, 'my-queue', msg.id); * } * ``` */ export declare const DeadLetterMessageSchema: z.ZodObject<{ id: z.ZodString; queue_id: z.ZodString; original_message_id: z.ZodOptional; offset: z.ZodNumber; payload: z.ZodUnknown; metadata: z.ZodOptional>>; failure_reason: z.ZodOptional>; delivery_attempts: z.ZodNumber; moved_at: z.ZodOptional; original_published_at: z.ZodOptional; published_at: z.ZodOptional; created_at: z.ZodString; }, z.core.$strip>; /** * Dead letter message type. */ export type DeadLetterMessage = z.infer; /** * Common options for queue API calls. * * Used to pass organization context when calling from CLI or other * contexts where the org is not implicit in the authentication token. */ export declare const QueueApiOptionsSchema: z.ZodObject<{ orgId: z.ZodOptional; sync: z.ZodOptional; }, z.core.$strip>; export type QueueApiOptions = z.infer; /** * Request schema for creating a new queue. * * @example * ```typescript * const request: CreateQueueRequest = { * name: 'my-worker-queue', * queue_type: 'worker', * description: 'Processes background jobs', * settings: { default_max_retries: 3 }, * }; * ``` */ export declare const CreateQueueRequestSchema: z.ZodObject<{ name: z.ZodOptional; description: z.ZodOptional; queue_type: z.ZodEnum<{ pubsub: "pubsub"; worker: "worker"; }>; internal: z.ZodOptional; settings: z.ZodOptional>>; default_visibility_timeout_seconds: z.ZodOptional>; default_max_retries: z.ZodOptional>; default_retry_backoff_ms: z.ZodOptional>; default_retry_max_backoff_ms: z.ZodOptional>; default_retry_multiplier: z.ZodOptional>; max_in_flight_per_client: z.ZodOptional>; retention_seconds: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; /** Request type for creating a queue. */ export type CreateQueueRequest = z.infer; /** * Request schema for updating an existing queue. */ export declare const UpdateQueueRequestSchema: z.ZodObject<{ description: z.ZodOptional; settings: z.ZodOptional>>; default_visibility_timeout_seconds: z.ZodOptional>; default_max_retries: z.ZodOptional>; default_retry_backoff_ms: z.ZodOptional>; default_retry_max_backoff_ms: z.ZodOptional>; default_retry_multiplier: z.ZodOptional>; max_in_flight_per_client: z.ZodOptional>; retention_seconds: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; /** Request type for updating a queue. */ export type UpdateQueueRequest = z.infer; /** * Request schema for listing queues with pagination. */ export declare const ListQueuesRequestSchema: z.ZodObject<{ limit: z.ZodOptional; offset: z.ZodOptional; name: z.ZodOptional; queue_type: z.ZodOptional>; status: z.ZodOptional>; sort: z.ZodOptional>; direction: z.ZodOptional>; }, z.core.$strip>; /** Request type for listing queues. */ export type ListQueuesRequest = z.infer; /** * Request schema for publishing a message to a queue. * * @example * ```typescript * const request: PublishMessageRequest = { * payload: { task: 'process-order', orderId: 123 }, * metadata: { priority: 'high' }, * idempotency_key: 'order-123-v1', * ttl_seconds: 3600, * }; * ``` */ export declare const PublishMessageRequestSchema: z.ZodObject<{ payload: z.ZodUnknown; metadata: z.ZodOptional>; idempotency_key: z.ZodOptional; partition_key: z.ZodOptional; ttl_seconds: z.ZodOptional; }, z.core.$strip>; /** Request type for publishing a message. */ export type PublishMessageRequest = z.infer; /** * Request schema for batch publishing multiple messages. * * @example * ```typescript * const request: BatchPublishMessagesRequest = { * messages: [ * { payload: { task: 'a' } }, * { payload: { task: 'b' } }, * ], * }; * ``` */ export declare const BatchPublishMessagesRequestSchema: z.ZodObject<{ messages: z.ZodArray>; idempotency_key: z.ZodOptional; partition_key: z.ZodOptional; ttl_seconds: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; /** Request type for batch publishing messages. */ export type BatchPublishMessagesRequest = z.infer; /** * Request schema for listing messages with pagination and filtering. */ export declare const ListMessagesRequestSchema: z.ZodObject<{ limit: z.ZodOptional; offset: z.ZodOptional; state: z.ZodOptional>; }, z.core.$strip>; /** Request type for listing messages. */ export type ListMessagesRequest = z.infer; /** * Request schema for consuming messages from a specific offset. */ export declare const ConsumeMessagesRequestSchema: z.ZodObject<{ offset: z.ZodNumber; limit: z.ZodOptional; }, z.core.$strip>; /** Request type for consuming messages. */ export type ConsumeMessagesRequest = z.infer; /** * Request schema for creating a destination webhook. * * @example * ```typescript * const request: CreateDestinationRequest = { * destination_type: 'http', * config: { * url: 'https://api.example.com/webhook', * method: 'POST', * }, * enabled: true, * }; * ``` */ export declare const CreateDestinationRequestSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional; destination_type: z.ZodEnum<{ email: "email"; http: "http"; queue: "queue"; sandbox: "sandbox"; url: "url"; webhook: "webhook"; }>; config: z.ZodRecord; enabled: z.ZodDefault; }, z.core.$strip>; /** Request type for creating a destination. */ export type CreateDestinationRequest = z.infer; /** * Request schema for updating a destination. */ export declare const UpdateDestinationRequestSchema: z.ZodObject<{ name: z.ZodOptional; description: z.ZodOptional>; config: z.ZodOptional>; enabled: z.ZodOptional; }, z.core.$strip>; /** Request type for updating a destination. */ export type UpdateDestinationRequest = z.infer; /** * Request schema for listing dead letter queue messages with pagination. */ export declare const ListDlqRequestSchema: z.ZodObject<{ limit: z.ZodOptional; offset: z.ZodOptional; }, z.core.$strip>; /** Request type for listing DLQ messages. */ export type ListDlqRequest = z.infer; /** * Time bucket granularity for analytics queries. * * - `minute`: 1-minute buckets, max range 24 hours. Best for real-time monitoring. * - `hour`: 1-hour buckets, max range 7 days. Best for short-term trend analysis. * - `day`: 1-day buckets, max range 90 days. Best for long-term analysis. * * @example * ```typescript * const analytics = await getQueueAnalytics(client, 'my-queue', { * granularity: 'hour', * start: '2026-01-14T00:00:00Z', * }); * ``` */ export declare const AnalyticsGranularitySchema: z.ZodEnum<{ day: "day"; hour: "hour"; minute: "minute"; }>; /** * Time bucket granularity type. */ export type AnalyticsGranularity = z.infer; /** * Options for analytics queries. * * Use these options to filter and configure analytics requests by time range, * granularity, and optional filters like project or agent ID. * * @example * ```typescript * const options: AnalyticsOptions = { * start: '2026-01-14T00:00:00Z', * end: '2026-01-15T00:00:00Z', * granularity: 'hour', * projectId: 'proj_abc123', * }; * const analytics = await getQueueAnalytics(client, 'my-queue', options); * ``` */ export declare const AnalyticsOptionsSchema: z.ZodObject<{ orgId: z.ZodOptional; sync: z.ZodOptional; start: z.ZodOptional; end: z.ZodOptional; granularity: z.ZodOptional>; projectId: z.ZodOptional; agentId: z.ZodOptional; }, z.core.$strip>; export type AnalyticsOptions = z.infer; /** * Options for real-time SSE streaming analytics. * * SSE (Server-Sent Events) streams provide live updates of queue statistics * at a configurable interval. The stream stays open until closed by the client. * * @example * ```typescript * const stream = streamQueueAnalytics(client, 'my-queue', { interval: 5 }); * for await (const event of stream) { * console.log(`Backlog: ${event.backlog}`); * } * ``` */ export declare const StreamAnalyticsOptionsSchema: z.ZodObject<{ orgId: z.ZodOptional; sync: z.ZodOptional; interval: z.ZodOptional; }, z.core.$strip>; export type StreamAnalyticsOptions = z.infer; /** * Time period for analytics responses. * * Represents the time range and granularity of the analytics data. */ export declare const TimePeriodSchema: z.ZodObject<{ start: z.ZodString; end: z.ZodString; granularity: z.ZodOptional>; }, z.core.$strip>; /** * Time period type representing a date range for analytics. */ export type TimePeriod = z.infer; /** * Latency statistics with percentile distributions. * * Provides average, percentile (p50, p95, p99), and maximum latency values * for message delivery operations. * * @example * ```typescript * const { latency } = await getQueueAnalytics(client, 'my-queue'); * console.log(`Average: ${latency.avg_ms}ms, P95: ${latency.p95_ms}ms`); * ``` */ export declare const LatencyStatsSchema: z.ZodObject<{ avg_ms: z.ZodNumber; p50_ms: z.ZodOptional; p95_ms: z.ZodOptional; p99_ms: z.ZodOptional; max_ms: z.ZodOptional; }, z.core.$strip>; /** * Latency statistics type. */ export type LatencyStats = z.infer; /** * Current real-time queue state. * * Represents the instantaneous state of a queue, useful for monitoring * dashboards and alerting on queue health. * * @example * ```typescript * const { current } = await getQueueAnalytics(client, 'my-queue'); * if (current.backlog > 1000) { * console.warn('Queue backlog is high!'); * } * ``` */ export declare const QueueCurrentStatsSchema: z.ZodObject<{ backlog: z.ZodNumber; dlq_count: z.ZodNumber; messages_in_flight: z.ZodNumber; active_consumers: z.ZodNumber; oldest_message_age_seconds: z.ZodOptional>; }, z.core.$strip>; /** * Current queue state type. */ export type QueueCurrentStats = z.infer; /** * Aggregated statistics for a time period. * * Contains counts and metrics aggregated over the requested time range. * * @example * ```typescript * const { period_stats } = await getQueueAnalytics(client, 'my-queue'); * const successRate = period_stats.messages_acknowledged / period_stats.messages_published; * console.log(`Success rate: ${(successRate * 100).toFixed(1)}%`); * ``` */ export declare const QueuePeriodStatsSchema: z.ZodObject<{ messages_published: z.ZodNumber; messages_delivered: z.ZodNumber; messages_acknowledged: z.ZodNumber; messages_failed: z.ZodNumber; messages_replayed: z.ZodNumber; bytes_published: z.ZodNumber; delivery_attempts: z.ZodNumber; retry_count: z.ZodNumber; }, z.core.$strip>; /** * Period statistics type. */ export type QueuePeriodStats = z.infer; /** * Analytics for a webhook destination. * * Provides delivery statistics for a configured webhook endpoint. * * @example * ```typescript * const { destinations } = await getQueueAnalytics(client, 'my-queue'); * for (const dest of destinations ?? []) { * const successRate = dest.success_count / (dest.success_count + dest.failure_count); * console.log(`${dest.url}: ${(successRate * 100).toFixed(1)}% success`); * } * ``` */ export declare const DestinationAnalyticsSchema: z.ZodObject<{ id: z.ZodString; type: z.ZodString; url: z.ZodString; success_count: z.ZodNumber; failure_count: z.ZodNumber; avg_response_time_ms: z.ZodOptional; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>; /** * Destination analytics type. */ export type DestinationAnalytics = z.infer; /** * Complete analytics for a single queue. * * Provides comprehensive analytics including current state, period statistics, * latency metrics, and destination performance. * * @example * ```typescript * const analytics = await getQueueAnalytics(client, 'order-processing'); * console.log(`Queue: ${analytics.queue_name} (${analytics.queue_type})`); * console.log(`Backlog: ${analytics.current.backlog}`); * console.log(`Published (24h): ${analytics.period_stats.messages_published}`); * console.log(`P95 Latency: ${analytics.latency.p95_ms}ms`); * ``` */ export declare const QueueAnalyticsSchema: z.ZodObject<{ queue_id: z.ZodString; queue_name: z.ZodString; queue_type: z.ZodString; period: z.ZodObject<{ start: z.ZodString; end: z.ZodString; granularity: z.ZodOptional>; }, z.core.$strip>; current: z.ZodObject<{ backlog: z.ZodNumber; dlq_count: z.ZodNumber; messages_in_flight: z.ZodNumber; active_consumers: z.ZodNumber; oldest_message_age_seconds: z.ZodOptional>; }, z.core.$strip>; period_stats: z.ZodObject<{ messages_published: z.ZodNumber; messages_delivered: z.ZodNumber; messages_acknowledged: z.ZodNumber; messages_failed: z.ZodNumber; messages_replayed: z.ZodNumber; bytes_published: z.ZodNumber; delivery_attempts: z.ZodNumber; retry_count: z.ZodNumber; }, z.core.$strip>; latency: z.ZodObject<{ avg_ms: z.ZodNumber; p50_ms: z.ZodOptional; p95_ms: z.ZodOptional; p99_ms: z.ZodOptional; max_ms: z.ZodOptional; }, z.core.$strip>; consumer_latency: z.ZodObject<{ avg_ms: z.ZodNumber; p50_ms: z.ZodOptional; p95_ms: z.ZodOptional; p99_ms: z.ZodOptional; max_ms: z.ZodOptional; }, z.core.$strip>; destinations: z.ZodOptional; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>>>; }, z.core.$strip>; /** * Queue analytics type. */ export type QueueAnalytics = z.infer; /** * Summary statistics for a queue in org-level analytics. * * Provides a condensed view of queue metrics for listing in dashboards. */ export declare const QueueSummarySchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; queue_type: z.ZodString; messages_published: z.ZodNumber; messages_delivered: z.ZodNumber; messages_acknowledged: z.ZodNumber; backlog: z.ZodNumber; dlq_count: z.ZodNumber; avg_latency_ms: z.ZodNumber; error_rate_percent: z.ZodNumber; }, z.core.$strip>; /** * Queue summary type for org-level listings. */ export type QueueSummary = z.infer; /** * Aggregated summary across all queues in an organization. * * @example * ```typescript * const { summary } = await getOrgAnalytics(client); * console.log(`Total queues: ${summary.total_queues}`); * console.log(`Total messages: ${summary.total_messages_published}`); * console.log(`Error rate: ${summary.error_rate_percent.toFixed(2)}%`); * ``` */ export declare const OrgAnalyticsSummarySchema: z.ZodObject<{ total_queues: z.ZodNumber; total_messages_published: z.ZodNumber; total_messages_delivered: z.ZodNumber; total_messages_acknowledged: z.ZodNumber; total_dlq_messages: z.ZodNumber; total_bytes_published: z.ZodNumber; avg_latency_ms: z.ZodNumber; p95_latency_ms: z.ZodNumber; error_rate_percent: z.ZodNumber; }, z.core.$strip>; /** * Org-level analytics summary type. */ export type OrgAnalyticsSummary = z.infer; /** * Complete organization-level analytics. * * Provides an overview of all queues with aggregated metrics and per-queue summaries. * * @example * ```typescript * const analytics = await getOrgAnalytics(client); * console.log(`Org: ${analytics.org_id}`); * console.log(`Queues: ${analytics.summary.total_queues}`); * for (const queue of analytics.queues) { * console.log(` ${queue.name}: ${queue.backlog} pending`); * } * ``` */ export declare const OrgAnalyticsSchema: z.ZodObject<{ org_id: z.ZodString; period: z.ZodObject<{ start: z.ZodString; end: z.ZodString; granularity: z.ZodOptional>; }, z.core.$strip>; summary: z.ZodObject<{ total_queues: z.ZodNumber; total_messages_published: z.ZodNumber; total_messages_delivered: z.ZodNumber; total_messages_acknowledged: z.ZodNumber; total_dlq_messages: z.ZodNumber; total_bytes_published: z.ZodNumber; avg_latency_ms: z.ZodNumber; p95_latency_ms: z.ZodNumber; error_rate_percent: z.ZodNumber; }, z.core.$strip>; queues: z.ZodArray>; }, z.core.$strip>; /** * Org-level analytics type. */ export type OrgAnalytics = z.infer; /** * Single data point in a time series. * * Represents metrics for one time bucket (minute, hour, or day). * Used for building charts and visualizing trends over time. * * @example * ```typescript * const { series } = await getQueueTimeSeries(client, 'my-queue', { granularity: 'hour' }); * for (const point of series) { * console.log(`${point.timestamp}: ${point.throughput} msg/h, ${point.avg_latency_ms}ms avg`); * } * ``` */ export declare const TimeSeriesPointSchema: z.ZodObject<{ timestamp: z.ZodString; throughput: z.ZodNumber; delivery_rate: z.ZodNumber; ack_rate: z.ZodNumber; error_rate: z.ZodNumber; avg_latency_ms: z.ZodNumber; p95_latency_ms: z.ZodOptional; backlog: z.ZodOptional; messages_in_flight: z.ZodOptional; }, z.core.$strip>; /** * Time series data point type. */ export type TimeSeriesPoint = z.infer; /** * Time series analytics data for charting and visualization. * * Contains an array of data points at the requested granularity for building * time-based charts and dashboards. * * @example * ```typescript * const timeseries = await getQueueTimeSeries(client, 'order-processing', { * granularity: 'hour', * start: '2026-01-14T00:00:00Z', * end: '2026-01-15T00:00:00Z', * }); * * // Plot throughput over time * const chartData = timeseries.series.map(p => ({ * x: new Date(p.timestamp), * y: p.throughput, * })); * ``` */ export declare const TimeSeriesDataSchema: z.ZodObject<{ queue_id: z.ZodString; queue_name: z.ZodString; period: z.ZodObject<{ start: z.ZodString; end: z.ZodString; granularity: z.ZodOptional>; }, z.core.$strip>; series: z.ZodArray; backlog: z.ZodOptional; messages_in_flight: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; /** * Time series data type. */ export type TimeSeriesData = z.infer; /** * Real-time stats event from SSE stream. * * Represents a single snapshot of queue statistics delivered via Server-Sent Events. * Events are pushed at the interval specified when opening the stream. * * @example * ```typescript * const stream = streamQueueAnalytics(client, 'my-queue', { interval: 5 }); * for await (const event of stream) { * updateDashboard({ * backlog: event.backlog, * throughput: event.throughput_1m, * latency: event.avg_latency_ms, * consumers: event.active_consumers, * }); * } * ``` */ export declare const SSEStatsEventSchema: z.ZodObject<{ timestamp: z.ZodString; backlog: z.ZodNumber; messages_in_flight: z.ZodNumber; throughput_1m: z.ZodNumber; delivery_rate_1m: z.ZodNumber; error_rate_1m: z.ZodNumber; avg_latency_ms: z.ZodNumber; active_consumers: z.ZodNumber; }, z.core.$strip>; /** * SSE stats event type for real-time streaming. */ export type SSEStatsEvent = z.infer; /** * Source authentication type schema. */ export declare const SourceAuthTypeSchema: z.ZodEnum<{ basic: "basic"; header: "header"; none: "none"; }>; /** * Source authentication type. */ export type SourceAuthType = z.infer; /** * Queue source schema representing an HTTP ingestion endpoint. * * Sources provide public URLs for ingesting data into queues from external sources. * They support various authentication methods to secure access. * * @example * ```typescript * const source = await getSource(client, 'my-queue', 'qsrc_abc123'); * console.log(`Source URL: ${source.url}`); * console.log(`Success rate: ${source.success_count}/${source.request_count}`); * ``` */ export declare const SourceSchema: z.ZodObject<{ id: z.ZodString; queue_id: z.ZodString; name: z.ZodString; description: z.ZodOptional>; auth_type: z.ZodEnum<{ basic: "basic"; header: "header"; none: "none"; }>; enabled: z.ZodBoolean; url: z.ZodString; request_count: z.ZodNumber; success_count: z.ZodNumber; failure_count: z.ZodNumber; last_request_at: z.ZodOptional>; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; last_failure_error: z.ZodOptional>; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>; /** * Queue source type. */ export type Source = z.infer; /** * Create source request schema. * * @example * ```typescript * const request: CreateSourceRequest = { * name: 'webhook-ingestion', * description: 'Receives webhooks from external service', * auth_type: 'header', * auth_value: 'Bearer my-secret-token', * }; * ``` */ export declare const CreateSourceRequestSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional; auth_type: z.ZodDefault>>; auth_value: z.ZodOptional; }, z.core.$strip>; /** * Create source request type. */ export type CreateSourceRequest = z.infer; /** * Update source request schema. * * All fields are optional - only provided fields will be updated. * * @example * ```typescript * // Disable a source * const request: UpdateSourceRequest = { enabled: false }; * * // Update authentication * const request: UpdateSourceRequest = { * auth_type: 'basic', * auth_value: 'user:password', * }; * ``` */ export declare const UpdateSourceRequestSchema: z.ZodObject<{ name: z.ZodOptional; description: z.ZodOptional>; auth_type: z.ZodOptional>; auth_value: z.ZodOptional; enabled: z.ZodOptional; }, z.core.$strip>; /** * Update source request type. */ export type UpdateSourceRequest = z.infer; /** * Source event schema representing an inbound request received through a queue source. * * Source events are logged when external systems send data to a source's public endpoint. * They capture the request details, status, and resulting message (if successful). * * @example * ```typescript * const { events } = await listSourceEvents(client, 'my-queue', 'qsrc_abc123'); * for (const event of events) { * console.log(`${event.status}: ${event.message_id ?? 'no message'} at ${event.received_at}`); * } * ``` */ export declare const SourceEventSchema: z.ZodObject<{ id: z.ZodString; source_id: z.ZodString; queue_id: z.ZodString; message_id: z.ZodOptional>; payload: z.ZodOptional; headers: z.ZodOptional>; status: z.ZodEnum<{ failed: "failed"; success: "success"; }>; error: z.ZodOptional>; http_status_code: z.ZodOptional; remote_addr: z.ZodOptional; received_at: z.ZodString; created_at: z.ZodString; }, z.core.$strip>; /** Source event type. */ export type SourceEvent = z.infer; /** * Request schema for listing source events. */ export declare const ListSourceEventsRequestSchema: z.ZodObject<{ limit: z.ZodOptional; offset: z.ZodOptional; status: z.ZodOptional>; }, z.core.$strip>; /** Request type for listing source events. */ export type ListSourceEventsRequest = z.infer; /** * Delivery log schema representing a delivery attempt to a queue destination. * * Delivery logs track each attempt to deliver a message to a configured * webhook destination, including HTTP response details and timing. * * @example * ```typescript * const { deliveries } = await listDestinationDeliveries(client, 'my-queue', 'qdest_abc123'); * for (const d of deliveries) { * console.log(`${d.status} → ${d.http_status_code} (${d.duration_ms}ms)`); * } * ``` */ export declare const DeliveryLogSchema: z.ZodObject<{ id: z.ZodString; destination_id: z.ZodString; queue_id: z.ZodString; message_id: z.ZodString; payload: z.ZodOptional; status: z.ZodEnum<{ failed: "failed"; pending: "pending"; success: "success"; }>; http_status_code: z.ZodOptional>; error: z.ZodOptional>; duration_ms: z.ZodOptional; attempt_number: z.ZodOptional; request_headers: z.ZodOptional>; response_headers: z.ZodOptional>; delivered_at: z.ZodString; created_at: z.ZodString; }, z.core.$strip>; /** Delivery log type. */ export type DeliveryLog = z.infer; /** * Request schema for listing destination deliveries. */ export declare const ListDeliveryLogsRequestSchema: z.ZodObject<{ limit: z.ZodOptional; offset: z.ZodOptional; status: z.ZodOptional>; }, z.core.$strip>; /** Request type for listing delivery logs. */ export type ListDeliveryLogsRequest = z.infer; /** * Schema for a queue consumer (WebSocket connection). * * Consumers represent active or recently disconnected WebSocket connections * that receive messages from a queue in real-time. * * @example * ```typescript * const consumers = await listConsumers(client, 'my-queue'); * for (const c of consumers) { * const status = c.disconnected_at ? 'disconnected' : 'connected'; * console.log(`Consumer ${c.id}: ${status} (durable: ${c.durable})`); * } * ``` */ export declare const ConsumerSchema: z.ZodObject<{ id: z.ZodString; queue_id: z.ZodString; client_id: z.ZodOptional>; durable: z.ZodBoolean; ip_address: z.ZodOptional>; last_offset: z.ZodOptional>; connected_at: z.ZodString; disconnected_at: z.ZodOptional>; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>; /** * Queue consumer type representing a WebSocket connection. */ export type Consumer = z.infer; /** * WebSocket authentication request. * This must be the first message sent after the WebSocket connection is established. */ export declare const WebSocketAuthRequestSchema: z.ZodObject<{ authorization: z.ZodString; client_id: z.ZodOptional; last_offset: z.ZodOptional; }, z.core.$strip>; export type WebSocketAuthRequest = z.infer; /** * WebSocket authentication response from the server. */ export declare const WebSocketAuthResponseSchema: z.ZodObject<{ success: z.ZodBoolean; error: z.ZodOptional; client_id: z.ZodOptional; }, z.core.$strip>; export type WebSocketAuthResponse = z.infer; /** * WebSocket message pushed by the server. * * Messages are always delivered as an array. A single live push contains one * element (`type: "message"`), while a replay batch may contain many * (`type: "replay"`). */ export declare const WebSocketMessageSchema: z.ZodObject<{ type: z.ZodEnum<{ message: "message"; replay: "replay"; }>; queue_id: z.ZodString; messages: z.ZodArray; metadata: z.ZodOptional>>; state: z.ZodOptional>; idempotency_key: z.ZodOptional>; partition_key: z.ZodOptional>; ttl_seconds: z.ZodOptional>; delivery_attempts: z.ZodOptional; max_retries: z.ZodOptional; published_at: z.ZodOptional; expires_at: z.ZodOptional>; delivered_at: z.ZodOptional>; acknowledged_at: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; source_id: z.ZodOptional>; source_name: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; export type WebSocketMessage = z.infer; /** * Response schema for the list-queues endpoint. */ export declare const ListQueuesResponseSchema: z.ZodObject<{ queues: z.ZodArray>; internal: z.ZodOptional; queue_type: z.ZodEnum<{ pubsub: "pubsub"; worker: "worker"; }>; default_ttl_seconds: z.ZodOptional>; default_visibility_timeout_seconds: z.ZodOptional; default_max_retries: z.ZodOptional; default_retry_backoff_ms: z.ZodOptional; default_retry_max_backoff_ms: z.ZodOptional; default_retry_multiplier: z.ZodOptional; max_in_flight_per_client: z.ZodOptional; next_offset: z.ZodOptional; message_count: z.ZodOptional; dlq_count: z.ZodOptional; created_at: z.ZodString; updated_at: z.ZodString; paused_at: z.ZodOptional>; retention_seconds: z.ZodOptional; }, z.core.$strip>>; total: z.ZodOptional; }, z.core.$strip>; export type ListQueuesResponse = z.infer; /** * Response schema for the batch-publish endpoint. */ export declare const BatchPublishResponseSchema: z.ZodObject<{ messages: z.ZodArray; metadata: z.ZodOptional>>; state: z.ZodOptional>; idempotency_key: z.ZodOptional>; partition_key: z.ZodOptional>; ttl_seconds: z.ZodOptional>; delivery_attempts: z.ZodOptional; max_retries: z.ZodOptional; published_at: z.ZodOptional; expires_at: z.ZodOptional>; delivered_at: z.ZodOptional>; acknowledged_at: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; source_id: z.ZodOptional>; source_name: z.ZodOptional>; }, z.core.$strip>>; failed: z.ZodOptional>; }, z.core.$strip>; export type BatchPublishResponse = z.infer; /** * Response schema for the list-messages endpoint. */ export declare const ListMessagesResponseSchema: z.ZodObject<{ messages: z.ZodArray; metadata: z.ZodOptional>>; state: z.ZodOptional>; idempotency_key: z.ZodOptional>; partition_key: z.ZodOptional>; ttl_seconds: z.ZodOptional>; delivery_attempts: z.ZodOptional; max_retries: z.ZodOptional; published_at: z.ZodOptional; expires_at: z.ZodOptional>; delivered_at: z.ZodOptional>; acknowledged_at: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; source_id: z.ZodOptional>; source_name: z.ZodOptional>; }, z.core.$strip>>; total: z.ZodOptional; }, z.core.$strip>; export type ListMessagesResponse = z.infer; /** * Response schema for the consume-messages endpoint. */ export declare const ConsumeMessagesResponseSchema: z.ZodObject<{ messages: z.ZodArray; metadata: z.ZodOptional>>; state: z.ZodOptional>; idempotency_key: z.ZodOptional>; partition_key: z.ZodOptional>; ttl_seconds: z.ZodOptional>; delivery_attempts: z.ZodOptional; max_retries: z.ZodOptional; published_at: z.ZodOptional; expires_at: z.ZodOptional>; delivered_at: z.ZodOptional>; acknowledged_at: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; source_id: z.ZodOptional>; source_name: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; export type ConsumeMessagesResponse = z.infer; /** * Response schema for the receive-message endpoint. */ export declare const ReceiveMessageResponseSchema: z.ZodObject<{ message: z.ZodNullable; metadata: z.ZodOptional>>; state: z.ZodOptional>; idempotency_key: z.ZodOptional>; partition_key: z.ZodOptional>; ttl_seconds: z.ZodOptional>; delivery_attempts: z.ZodOptional; max_retries: z.ZodOptional; published_at: z.ZodOptional; expires_at: z.ZodOptional>; delivered_at: z.ZodOptional>; acknowledged_at: z.ZodOptional>; created_at: z.ZodOptional; updated_at: z.ZodOptional; source_id: z.ZodOptional>; source_name: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; export type ReceiveMessageResponse = z.infer; /** * Response schema for the get-queue-head endpoint. */ export declare const GetQueueHeadResponseSchema: z.ZodObject<{ offset: z.ZodNumber; }, z.core.$strip>; export type GetQueueHeadResponse = z.infer; /** * Response schema for the get-queue-tail endpoint. */ export declare const GetQueueTailResponseSchema: z.ZodObject<{ offset: z.ZodNumber; }, z.core.$strip>; export type GetQueueTailResponse = z.infer; /** * Response schema for the list-destinations endpoint. */ export declare const ListDestinationsResponseSchema: z.ZodObject<{ destinations: z.ZodArray>; queue_id: z.ZodString; destination_type: z.ZodEnum<{ email: "email"; http: "http"; queue: "queue"; sandbox: "sandbox"; url: "url"; webhook: "webhook"; }>; config: z.ZodUnion>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; }, z.core.$strip>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; method: z.ZodDefault; timeout_ms: z.ZodDefault; retry_policy: z.ZodOptional; initial_backoff_ms: z.ZodDefault; max_backoff_ms: z.ZodDefault; backoff_multiplier: z.ZodDefault; }, z.core.$strip>>; signing: z.ZodOptional; secret_key: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ queue_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ sandbox_id: z.ZodString; }, z.core.$strip>, z.ZodObject<{ email_address: z.ZodString; }, z.core.$strip>, z.ZodOptional>]>; enabled: z.ZodBoolean; stats: z.ZodOptional>; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; }, z.core.$strip>>; success_count: z.ZodOptional; failure_count: z.ZodOptional; last_success_at: z.ZodOptional>; last_failure_at: z.ZodOptional>; last_failure_error: z.ZodOptional>; created_at: z.ZodString; updated_at: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>; export type ListDestinationsResponse = z.infer; /** * Response schema for the list-delivery-logs endpoint. */ export declare const ListDeliveryLogsResponseSchema: z.ZodObject<{ deliveries: z.ZodArray; status: z.ZodEnum<{ failed: "failed"; pending: "pending"; success: "success"; }>; http_status_code: z.ZodOptional>; error: z.ZodOptional>; duration_ms: z.ZodOptional; attempt_number: z.ZodOptional; request_headers: z.ZodOptional>; response_headers: z.ZodOptional>; delivered_at: z.ZodString; created_at: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>; export type ListDeliveryLogsResponse = z.infer; /** * Response schema for the list-dlq-messages endpoint. */ export declare const ListDlqMessagesResponseSchema: z.ZodObject<{ messages: z.ZodArray; offset: z.ZodNumber; payload: z.ZodUnknown; metadata: z.ZodOptional>>; failure_reason: z.ZodOptional>; delivery_attempts: z.ZodNumber; moved_at: z.ZodOptional; original_published_at: z.ZodOptional; published_at: z.ZodOptional; created_at: z.ZodString; }, z.core.$strip>>; total: z.ZodOptional; }, z.core.$strip>; export type ListDlqMessagesResponse = z.infer; //# sourceMappingURL=types.d.ts.map