UNPKG

@message-queue-toolkit/sns

Version:
35 lines (34 loc) 2.15 kB
import { type CreateTopicCommandInput, type SNSClient } from '@aws-sdk/client-sns'; import type { STSClient } from '@aws-sdk/client-sts'; import { type Either } from '@lokalise/node-core'; import type { ExtraSNSCreationParams } from '../sns/AbstractSnsService.ts'; 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>; /** * 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; /** * Checks if a topic name indicates a FIFO topic (ends with .fifo) */ export declare function isFifoTopicName(topicName: string): boolean; /** * Validates that topic name matches the FIFO configuration flag */ export declare function validateFifoTopicName(topicName: string, isFifoTopic: boolean): void; export {};