UNPKG

@message-queue-toolkit/sns

Version:
28 lines 1.07 kB
import { AbstractQueueService } from '@message-queue-toolkit/core'; import { deleteSns, initSns } from "../utils/snsInitter.js"; // https://docs.aws.amazon.com/general/latest/gr/sns.html export const SNS_MESSAGE_MAX_SIZE = 256 * 1024; // 256KB export class AbstractSnsService extends AbstractQueueService { snsClient; stsClient; // @ts-ignore topicArn; constructor(dependencies, options) { super(dependencies, options); this.snsClient = dependencies.snsClient; this.stsClient = dependencies.stsClient; } async init() { if (this.deletionConfig && this.creationConfig) { await deleteSns(this.snsClient, this.stsClient, this.deletionConfig, this.creationConfig); } const initResult = await initSns(this.snsClient, this.stsClient, this.locatorConfig, this.creationConfig); this.topicArn = initResult.topicArn; this.isInitted = true; } close() { this.isInitted = false; return Promise.resolve(); } } //# sourceMappingURL=AbstractSnsService.js.map