import { SQSClient } from '@aws-sdk/client-sqs'; import { EpochMS, Seconds } from '@paradoxical-io/types'; export interface SQSEvent { timestamp: EpochMS; trace?: string; data: T; republishContext?: { /** * The total times this message has be been republished */ publishCount?: number; /** * Stop re-publishing the message after this expiration time */ maxPublishExpiration?: EpochMS; /** * Always re-publish this message until this epoch occurs. Used to kick * messages past the max visibility timeout in SQS */ processAfter?: EpochMS; }; } export interface PublishOptions { delay?: { /** * Publish a message with an invisibility timeout in terms of seconds */ type: 'invisible'; seconds: Seconds; } | { /** * Publish a message not to be processed any earlier than the epoch */ type: 'processAfter'; epoch: EpochMS; /** * The max interval to kick the message down the line for. Left unset will use close to the max SQS timeout */ maxVisibilityTimeoutSeconds?: Seconds; }; } export interface Publisher { publish(data: T | T[], opts?: PublishOptions): Promise; } export declare class SQSPublisher implements Publisher { private queueUrl; private sqs; constructor(queueUrl: string, sqs?: SQSClient); publish(data: T | T[], opts?: PublishOptions): Promise; private publishBatch; } /** * Determine the visiblity timeout of a message given its options. * @param opts * @param timeProvider */ export declare function getInvisibilityDelay(opts: PublishOptions | undefined, timeProvider?: import("@paradoxical-io/common").TimeProvider): Seconds; /** * Creates a unified sqs event type * @param timestamp * @param data * @param opts */ export declare function createEvent(timestamp: Date, data: T, opts: PublishOptions | undefined): SQSEvent; //# sourceMappingURL=publisher.d.ts.map