@message-queue-toolkit/sqs
Version:
SQS adapter for message-queue-toolkit
27 lines (26 loc) • 1.74 kB
TypeScript
import type { CreateQueueCommandInput, QueueAttributeName, SQSClient, SendMessageCommandInput } from '@aws-sdk/client-sqs';
import type { Either } from '@lokalise/node-core';
import type { ExtraSQSCreationParams } from '../sqs/AbstractSqsService';
type QueueAttributesResult = {
attributes?: Partial<Record<QueueAttributeName, string>>;
};
export declare function getQueueUrl(sqsClient: SQSClient, queueName: string): Promise<Either<'not_found', string>>;
export declare function getQueueAttributes(sqsClient: SQSClient, queueUrl: string, attributeNames?: QueueAttributeName[]): Promise<Either<'not_found', QueueAttributesResult>>;
export declare function assertQueue(sqsClient: SQSClient, queueConfig: CreateQueueCommandInput, extraParams?: ExtraSQSCreationParams): Promise<{
queueUrl: string;
queueArn: string;
queueName: string | undefined;
}>;
export declare function deleteQueue(client: SQSClient, queueName: string, waitForConfirmation?: boolean): Promise<void>;
/**
* Calculates the size of an outgoing SQS message.
*
* SQS imposes a 256 KB limit on the total size of a message, which includes both the message body and any metadata (attributes).
* This function currently computes the size based solely on the message body, as no attributes are included at this time.
* For future updates, if message attributes are added, their sizes should also be considered.
*
* Reference: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-metadata.html#sqs-message-attributes
*/
export declare function calculateOutgoingMessageSize(message: unknown): number;
export declare function calculateSqsMessageBodySize(messageBody: SendMessageCommandInput['MessageBody']): number;
export {};