@message-queue-toolkit/sns
Version:
SNS adapter for message-queue-toolkit
28 lines (27 loc) • 1.94 kB
TypeScript
import { type CreateTopicCommandInput, type SNSClient } from '@aws-sdk/client-sns';
import { type Either } from '@lokalise/node-core';
import type { ExtraSNSCreationParams } from '../sns/AbstractSnsService';
import type { STSClient } from '@aws-sdk/client-sts';
type AttributesResult = {
attributes?: Record<string, string>;
};
export declare function getTopicAttributes(snsClient: SNSClient, topicArn: string): Promise<Either<'not_found', AttributesResult>>;
export declare function getSubscriptionAttributes(snsClient: SNSClient, subscriptionArn: string): Promise<Either<'not_found', AttributesResult>>;
export declare function assertTopic(snsClient: SNSClient, stsClient: STSClient, topicOptions: CreateTopicCommandInput, extraParams?: ExtraSNSCreationParams): Promise<string>;
export declare function deleteTopic(snsClient: SNSClient, stsClient: STSClient, topicName: string): Promise<void>;
export declare function deleteSubscription(client: SNSClient, subscriptionArn: string): Promise<void>;
export declare function findSubscriptionByTopicAndQueue(snsClient: SNSClient, topicArn: string, queueArn: string): Promise<import("@aws-sdk/client-sns").Subscription | undefined>;
export declare function getTopicArnByName(snsClient: SNSClient, topicName?: string): Promise<string>;
/**
* Calculates the size of an outgoing SNS message.
*
* SNS 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/sns/latest/dg/sns-message-attributes.html
*
* A wrapper around the equivalent function in the SQS package.
*/
export declare const calculateOutgoingMessageSize: (message: unknown) => number;
export {};