feat(): improve module typings in medusa config (#14478)

* feat(events): Allow priority configuration

* feat(events): Allow priority configuration

* wip

* wip

* wip

* fix typings

* Create cold-lamps-search.md

* implement priority config usage

* comment out #1

* fixes

* fixes
This commit is contained in:
Adrien de Peretti
2026-01-14 18:39:57 +01:00
committed by GitHub
parent cbc9f3d059
commit 1347698876
21 changed files with 593 additions and 65 deletions

View File

@@ -23,7 +23,9 @@
"author": "Medusa",
"license": "MIT",
"devDependencies": {
"@medusajs/framework": "2.12.5"
"@medusajs/framework": "2.12.5",
"@medusajs/types": "2.12.5",
"@medusajs/utils": "2.12.5"
},
"scripts": {
"watch": "yarn run -T tsc --build --watch",

View File

@@ -1,5 +1,7 @@
import {
Event,
// TODO: Comment temporarely and we will re enable it in the near future #14478
// EventBusEventsOptions,
InternalModuleDeclaration,
Logger,
Message,
@@ -53,6 +55,8 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
protected readonly queueOptions_: Omit<QueueOptions, "connection">
protected readonly workerOptions_: Omit<WorkerOptions, "connection">
protected readonly jobOptions_: EmitOptions
// TODO: Comment temporarely and we will re enable it in the near future #14478
// private readonly eventOptions_: EventBusEventsOptions
protected queue_: Queue
protected bullWorker_: Worker
@@ -79,6 +83,11 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
this.queueOptions_ = eventBusRedisQueueOptions ?? {}
this.workerOptions_ = eventBusRedisWorkerOptions ?? {}
this.jobOptions_ = eventBusRedisJobOptions ?? {}
// TODO: Comment temporarely and we will re enable it in the near future #14478
// this.eventOptions_ =
// _moduleOptions.eventOptions ??
// _moduleDeclaration.options?.eventOptions ??
// {}
this.queue_ = new Queue(this.queueName_, {
prefix: `${this.constructor.name}`,
@@ -153,6 +162,11 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
...eventData.options,
}
// TODO: Comment temporarely and we will re enable it in the near future #14478
// finalOptions.priority =
// eventData.options?.priority ??
// this.eventOptions_[eventData.name]?.priority
if (
finalOptions.priority != undefined &&
(finalOptions.priority < 1 ||

View File

@@ -1,3 +1,10 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import type { EventBusEventsOptions } from "@medusajs/types"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import type { ModuleOptions } from "@medusajs/types"
import {
BulkJobOptions,
Job,
@@ -68,6 +75,8 @@ export type EventBusRedisModuleOptions = {
* @see https://api.docs.bullmq.io/interfaces/BaseJobOptions.html
*/
jobOptions?: EmitOptions
// eventOptions?: EventBusEventsOptions
}
declare module "@medusajs/types" {