New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ivfuture/ecomm-event-bus-local

Package Overview
Dependencies
Maintainers
0
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ivfuture/ecomm-event-bus-local - npm Package Compare versions

Comparing version 1.57.5 to 1.57.6

dist/types/index.d.ts

23

dist/services/event-bus-local.d.ts
/// <reference types="node" />
import { MedusaContainer } from "@ivfuture/ecomm-modules-sdk";
import { EventEmitter } from "events";
import { EmitData, EventBusTypes, Logger, Subscriber } from "@ivfuture/ecomm-types";
import { AbstractEventBusModuleService } from "@ivfuture/ecomm-utils";
import { EventEmitter } from "events";
type InjectedDependencies = {
logger: Logger;
};
export default class LocalEventBusService extends AbstractEventBusModuleService {
import { AbstractEventBusModuleService } from "@ivfuture/ecomm-core";
import { InjectedDependencies } from "../types";
declare class LocalEventBusService extends AbstractEventBusModuleService {
isDefault: boolean;
protected readonly logger_: Logger;
protected readonly eventEmitter_: EventEmitter;
constructor({ logger }: MedusaContainer & InjectedDependencies);
emit<T>(eventName: string, data: T, options: Record<string, unknown>): Promise<void>;
storeSubscribers: (args: {
event: string | symbol;
subscriberId: string;
subscriber: Subscriber;
}) => void;
constructor({ logger }: InjectedDependencies);
emit<T>(eventName: string, data: T, options?: Record<string, unknown>): Promise<void>;
/**

@@ -22,2 +25,2 @@ * Emit a number of events

}
export {};
export default LocalEventBusService;

@@ -12,9 +12,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const ecomm_utils_1 = require("@ivfuture/ecomm-utils");
const events_1 = require("events");
const ulid_1 = require("ulid");
const eventEmitter = new events_1.EventEmitter();
eventEmitter.setMaxListeners(Infinity);
// eslint-disable-next-line max-len
class LocalEventBusService extends ecomm_utils_1.AbstractEventBusModuleService {
const ecomm_core_1 = require("@ivfuture/ecomm-core");
class LocalEventBusService extends ecomm_core_1.AbstractEventBusModuleService {
constructor({ logger }) {

@@ -24,4 +21,15 @@ // @ts-ignore

super(...arguments);
this.isDefault = false;
this.logger_ = logger;
this.eventEmitter_ = eventEmitter;
this.eventEmitter_ = new events_1.EventEmitter();
this.eventEmitter_.setMaxListeners(Infinity);
this.storeSubscribers = ({ event, subscriberId, subscriber }) => {
var _a;
if (!this.eventToSubscribersMap.has(event)) {
this.eventToSubscribersMap.set(event, []);
}
(_a = this.eventToSubscribersMap
.get(event)) === null || _a === void 0 ? void 0 : _a.push({ id: subscriberId, subscriber });
};
this.logger_.warn("Local Event Bus installed. This is not recommended for production. ");
}

@@ -59,8 +67,7 @@ emit(eventOrData, data, options = {}) {

unsubscribe(event, subscriber, context) {
var _a;
const existingSubscribers = this.eventToSubscribersMap_.get(event);
const existingSubscribers = this.eventToSubscribersMap.get(event);
if (existingSubscribers === null || existingSubscribers === void 0 ? void 0 : existingSubscribers.length) {
const subIndex = existingSubscribers === null || existingSubscribers === void 0 ? void 0 : existingSubscribers.findIndex((sub) => sub.id === (context === null || context === void 0 ? void 0 : context.subscriberId));
if (subIndex !== -1) {
(_a = this.eventToSubscribersMap_.get(event)) === null || _a === void 0 ? void 0 : _a.splice(subIndex, 1);
existingSubscribers === null || existingSubscribers === void 0 ? void 0 : existingSubscribers.splice(subIndex, 1);
}

@@ -67,0 +74,0 @@ }

{
"name": "@ivfuture/ecomm-event-bus-local",
"version": "1.57.5",
"version": "1.57.6",
"description": "Local Event Bus Module for Medusa",

@@ -20,3 +20,3 @@ "main": "dist/index.js",

"devDependencies": {
"@ivfuture/ecomm-types": "1.57.3",
"@ivfuture/ecomm-types": "1.57.4",
"cross-env": "^7.0.3",

@@ -36,7 +36,7 @@ "jest": "^29.7.0",

"dependencies": {
"@ivfuture/ecomm-modules-sdk": "1.57.2",
"@ivfuture/ecomm-utils": "1.57.3",
"@ivfuture/ecomm-core": "2.69.15",
"@ivfuture/ecomm-utils": "1.57.4",
"ulid": "^2.3.0"
},
"gitHead": "5b674270a3916ccf9fe07e5965a90341597b118f"
"gitHead": "4ad2f13e98fa7e37a6b1b701608469ef6418ab6a"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc