feat(product, types, modules-sdk): added event bus events for products (#4654)

what:

- adds an eventbus dependency to product module.
- emits events on product, category and collection CUD

RESOLVES CORE-1450
This commit is contained in:
Riqwan Thamir authored and GitHub committed 2023-08-04 09:26:02 +00:00
1 parent 43f34866c8
commit 8af55aed87
16 files changed
+616 -23

No files matched your search

@@ -0,0 +1,36 @@
import {
EmitData,
EventBusTypes,
Subscriber,
IEventBusModuleService
} from "@medusajs/types"
export class EventBusService implements IEventBusModuleService {
async emit<T>(
eventName: string,
data: T,
options: Record<string, unknown>
): Promise<void>
async emit<T>(data: EventBusTypes.EmitData<T>[]): Promise<void>
async emit<T, TInput extends string | EventBusTypes.EmitData<T>[] = string>(
eventOrData: TInput,
data?: T,
options: Record<string, unknown> = {}
): Promise<void> {}
subscribe(event: string | symbol, subscriber: Subscriber): this {
return this
}
unsubscribe(
event: string | symbol,
subscriber: Subscriber,
context?: EventBusTypes.SubscriberContext
): this {
return this
}
withTransaction() {
}
}