UNPKG

medusa-event-bus-aws

Version:

A Medusa module for seamless integration with AWS EventBridge, enabling real-time event handling in headless e-commerce applications.

18 lines (17 loc) 824 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const client_eventbridge_1 = require("@aws-sdk/client-eventbridge"); const awilix_1 = require("awilix"); const os_1 = require("os"); exports.default = async ({ container, logger, options, }) => { const client = new client_eventbridge_1.EventBridgeClient(options); const command = new client_eventbridge_1.ListEventBusesCommand({}); try { await client.send(command); logger?.info("Connection to AWS Event Bridge in module 'medusa-event-bus-aws' established"); } catch (error) { logger?.error(`An error occurred while connecting to AWS Event Bridge in module 'medusa-event-bus-aws':${os_1.EOL} ${error?.toString()}`); } container.register({ eventBridgeClient: (0, awilix_1.asValue)(client) }); };