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

@@ -3,6 +3,8 @@ import {
ConfigModule,
InputConfig,
InputConfigModules,
InputConfigWithArrayModules,
InputConfigWithObjectModules,
InternalModuleDeclaration,
MedusaCloudOptions,
} from "@medusajs/types"
@@ -43,6 +45,15 @@ export const DEFAULT_STORE_RESTRICTED_FIELDS = [
* make an application work seamlessly, but still provide you the ability
* to override configuration as needed.
*/
export function defineConfig(
config?: InputConfigWithArrayModules
): ConfigModule
/**
* @deprecated Use array-based modules configuration instead
*/
export function defineConfig(
config?: InputConfigWithObjectModules
): ConfigModule
export function defineConfig(config: InputConfig = {}): ConfigModule {
const options = {
isCloud: process.env.EXECUTION_CONTEXT === MEDUSA_CLOUD_EXECUTION_CONTEXT,

View File

@@ -1,3 +1,6 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
/**
* @category Cart
* @customNamespace Cart
@@ -63,7 +66,7 @@ export const CartWorkflowEvents = {
* ```
*/
CUSTOMER_TRANSFERRED: "cart.customer_transferred",
}
} as const
/**
* @category Customer
@@ -103,7 +106,7 @@ export const CustomerWorkflowEvents = {
* ```
*/
DELETED: "customer.deleted",
}
} as const
/**
* @category Order
@@ -259,7 +262,7 @@ export const OrderWorkflowEvents = {
* ```
*/
TRANSFER_REQUESTED: "order.transfer_requested",
}
} as const
/**
* @category Order Edit
@@ -308,7 +311,7 @@ export const OrderEditWorkflowEvents = {
* ```
*/
CANCELED: "order-edit.canceled",
}
} as const
/**
* @category User
@@ -348,7 +351,7 @@ export const UserWorkflowEvents = {
* ```
*/
DELETED: "user.deleted",
}
} as const
/**
* @category Auth
@@ -370,7 +373,7 @@ export const AuthWorkflowEvents = {
* ```
*/
PASSWORD_RESET: "auth.password_reset",
}
} as const
/**
* @category Sales Channel
@@ -410,7 +413,7 @@ export const SalesChannelWorkflowEvents = {
* ```
*/
DELETED: "sales-channel.deleted",
}
} as const
/**
* @category Product Category
@@ -450,7 +453,7 @@ export const ProductCategoryWorkflowEvents = {
* ```
*/
DELETED: "product-category.deleted",
}
} as const
/**
* @category Product Collection
@@ -490,7 +493,7 @@ export const ProductCollectionWorkflowEvents = {
* ```
*/
DELETED: "product-collection.deleted",
}
} as const
/**
* @category Product Variant
@@ -530,7 +533,7 @@ export const ProductVariantWorkflowEvents = {
* ```
*/
DELETED: "product-variant.deleted",
}
} as const
/**
* @category Product
@@ -570,7 +573,7 @@ export const ProductWorkflowEvents = {
* ```
*/
DELETED: "product.deleted",
}
} as const
/**
* @category Product Type
@@ -610,7 +613,7 @@ export const ProductTypeWorkflowEvents = {
* ```
*/
DELETED: "product-type.deleted",
}
} as const
/**
* @category Product Tag
@@ -650,7 +653,7 @@ export const ProductTagWorkflowEvents = {
* ```
*/
DELETED: "product-tag.deleted",
}
} as const
/**
* @category Product Option
@@ -690,7 +693,7 @@ export const ProductOptionWorkflowEvents = {
* ```
*/
DELETED: "product-option.deleted",
}
} as const
/**
* @category Invite
@@ -744,7 +747,7 @@ export const InviteWorkflowEvents = {
* ```
*/
RESENT: "invite.resent",
}
} as const
/**
* @category Region
@@ -784,7 +787,7 @@ export const RegionWorkflowEvents = {
* ```
*/
DELETED: "region.deleted",
}
} as const
/**
* @category Fulfillment
@@ -814,7 +817,7 @@ export const FulfillmentWorkflowEvents = {
* ```
*/
DELIVERY_CREATED: "delivery.created",
}
} as const
/**
* @category Shipping Option Type
@@ -860,7 +863,7 @@ export const ShippingOptionTypeWorkflowEvents = {
* ```
*/
DELETED: "shipping-option-type.deleted",
}
} as const
/**
* @category Shipping Option
@@ -906,7 +909,7 @@ export const ShippingOptionWorkflowEvents = {
* ```
*/
DELETED: "shipping-option.deleted",
}
} as const
/**
* @category Payment
@@ -935,7 +938,7 @@ export const PaymentEvents = {
* ```
*/
REFUNDED: "payment.refunded",
}
} as const
/**
* @category Translation
@@ -981,4 +984,122 @@ export const TranslationWorkflowEvents = {
* ```
*/
DELETED: "translation.deleted",
}
} as const
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // Cart events
// [CartWorkflowEvents.CREATED]?: EventOptions
// [CartWorkflowEvents.UPDATED]?: EventOptions
// [CartWorkflowEvents.CUSTOMER_UPDATED]?: EventOptions
// [CartWorkflowEvents.REGION_UPDATED]?: EventOptions
// [CartWorkflowEvents.CUSTOMER_TRANSFERRED]?: EventOptions
// // Customer events
// [CustomerWorkflowEvents.CREATED]?: EventOptions
// [CustomerWorkflowEvents.UPDATED]?: EventOptions
// [CustomerWorkflowEvents.DELETED]?: EventOptions
// // Order events
// [OrderWorkflowEvents.UPDATED]?: EventOptions
// [OrderWorkflowEvents.PLACED]?: EventOptions
// [OrderWorkflowEvents.CANCELED]?: EventOptions
// [OrderWorkflowEvents.COMPLETED]?: EventOptions
// [OrderWorkflowEvents.ARCHIVED]?: EventOptions
// [OrderWorkflowEvents.FULFILLMENT_CREATED]?: EventOptions
// [OrderWorkflowEvents.FULFILLMENT_CANCELED]?: EventOptions
// [OrderWorkflowEvents.RETURN_REQUESTED]?: EventOptions
// [OrderWorkflowEvents.RETURN_RECEIVED]?: EventOptions
// [OrderWorkflowEvents.CLAIM_CREATED]?: EventOptions
// [OrderWorkflowEvents.EXCHANGE_CREATED]?: EventOptions
// [OrderWorkflowEvents.TRANSFER_REQUESTED]?: EventOptions
// // Order Edit events
// [OrderEditWorkflowEvents.REQUESTED]?: EventOptions
// [OrderEditWorkflowEvents.CONFIRMED]?: EventOptions
// [OrderEditWorkflowEvents.CANCELED]?: EventOptions
// // User events
// [UserWorkflowEvents.CREATED]?: EventOptions
// [UserWorkflowEvents.UPDATED]?: EventOptions
// [UserWorkflowEvents.DELETED]?: EventOptions
// // Auth events
// [AuthWorkflowEvents.PASSWORD_RESET]?: EventOptions
// // Sales Channel events
// [SalesChannelWorkflowEvents.CREATED]?: EventOptions
// [SalesChannelWorkflowEvents.UPDATED]?: EventOptions
// [SalesChannelWorkflowEvents.DELETED]?: EventOptions
// // Product Category events
// [ProductCategoryWorkflowEvents.CREATED]?: EventOptions
// [ProductCategoryWorkflowEvents.UPDATED]?: EventOptions
// [ProductCategoryWorkflowEvents.DELETED]?: EventOptions
// // Product Collection events
// [ProductCollectionWorkflowEvents.CREATED]?: EventOptions
// [ProductCollectionWorkflowEvents.UPDATED]?: EventOptions
// [ProductCollectionWorkflowEvents.DELETED]?: EventOptions
// // Product Variant events
// [ProductVariantWorkflowEvents.CREATED]?: EventOptions
// [ProductVariantWorkflowEvents.UPDATED]?: EventOptions
// [ProductVariantWorkflowEvents.DELETED]?: EventOptions
// // Product events
// [ProductWorkflowEvents.CREATED]?: EventOptions
// [ProductWorkflowEvents.UPDATED]?: EventOptions
// [ProductWorkflowEvents.DELETED]?: EventOptions
// // Product Type events
// [ProductTypeWorkflowEvents.CREATED]?: EventOptions
// [ProductTypeWorkflowEvents.UPDATED]?: EventOptions
// [ProductTypeWorkflowEvents.DELETED]?: EventOptions
// // Product Tag events
// [ProductTagWorkflowEvents.CREATED]?: EventOptions
// [ProductTagWorkflowEvents.UPDATED]?: EventOptions
// [ProductTagWorkflowEvents.DELETED]?: EventOptions
// // Product Option events
// [ProductOptionWorkflowEvents.CREATED]?: EventOptions
// [ProductOptionWorkflowEvents.UPDATED]?: EventOptions
// [ProductOptionWorkflowEvents.DELETED]?: EventOptions
// // Invite events
// [InviteWorkflowEvents.ACCEPTED]?: EventOptions
// [InviteWorkflowEvents.CREATED]?: EventOptions
// [InviteWorkflowEvents.DELETED]?: EventOptions
// [InviteWorkflowEvents.RESENT]?: EventOptions
// // Region events
// [RegionWorkflowEvents.CREATED]?: EventOptions
// [RegionWorkflowEvents.UPDATED]?: EventOptions
// [RegionWorkflowEvents.DELETED]?: EventOptions
// // Fulfillment events
// [FulfillmentWorkflowEvents.SHIPMENT_CREATED]?: EventOptions
// [FulfillmentWorkflowEvents.DELIVERY_CREATED]?: EventOptions
// // Shipping Option Type events
// [ShippingOptionTypeWorkflowEvents.CREATED]?: EventOptions
// [ShippingOptionTypeWorkflowEvents.UPDATED]?: EventOptions
// [ShippingOptionTypeWorkflowEvents.DELETED]?: EventOptions
// // Shipping Option events
// [ShippingOptionWorkflowEvents.CREATED]?: EventOptions
// [ShippingOptionWorkflowEvents.UPDATED]?: EventOptions
// [ShippingOptionWorkflowEvents.DELETED]?: EventOptions
// // Payment events
// [PaymentEvents.CAPTURED]?: EventOptions
// [PaymentEvents.REFUNDED]?: EventOptions
// // Translation events
// [TranslationWorkflowEvents.CREATED]?: EventOptions
// [TranslationWorkflowEvents.UPDATED]?: EventOptions
// [TranslationWorkflowEvents.DELETED]?: EventOptions
// }
// }

View File

@@ -2,30 +2,42 @@ import { KebabCase, SnakeCase } from "@medusajs/types"
import { camelToSnakeCase, kebabCase, lowerCaseFirst } from "../common"
import { CommonEvents } from "./common-events"
type ReturnType<TNames extends string[]> = {
type ReturnType<TNames extends string[], TPrefix extends string = ""> = {
[K in TNames[number] as `${Uppercase<
SnakeCase<K & string>
>}_CREATED`]: `${KebabCase<K & string>}.created`
>}_CREATED`]: TPrefix extends ""
? `${KebabCase<K & string>}.created`
: `${TPrefix}.${KebabCase<K & string>}.created`
} & {
[K in TNames[number] as `${Uppercase<
SnakeCase<K & string>
>}_UPDATED`]: `${KebabCase<K & string>}.updated`
>}_UPDATED`]: TPrefix extends ""
? `${KebabCase<K & string>}.updated`
: `${TPrefix}.${KebabCase<K & string>}.updated`
} & {
[K in TNames[number] as `${Uppercase<
SnakeCase<K & string>
>}_DELETED`]: `${KebabCase<K & string>}.deleted`
>}_DELETED`]: TPrefix extends ""
? `${KebabCase<K & string>}.deleted`
: `${TPrefix}.${KebabCase<K & string>}.deleted`
} & {
[K in TNames[number] as `${Uppercase<
SnakeCase<K & string>
>}_RESTORED`]: `${KebabCase<K & string>}.restored`
>}_RESTORED`]: TPrefix extends ""
? `${KebabCase<K & string>}.restored`
: `${TPrefix}.${KebabCase<K & string>}.restored`
} & {
[K in TNames[number] as `${Uppercase<
SnakeCase<K & string>
>}_ATTACHED`]: `${KebabCase<K & string>}.attached`
>}_ATTACHED`]: TPrefix extends ""
? `${KebabCase<K & string>}.attached`
: `${TPrefix}.${KebabCase<K & string>}.attached`
} & {
[K in TNames[number] as `${Uppercase<
SnakeCase<K & string>
>}_DETACHED`]: `${KebabCase<K & string>}.detached`
>}_DETACHED`]: TPrefix extends ""
? `${KebabCase<K & string>}.detached`
: `${TPrefix}.${KebabCase<K & string>}.detached`
}
/**
@@ -64,10 +76,10 @@ export function buildModuleResourceEventName({
* @param names
* @param prefix
*/
export function buildEventNamesFromEntityName<TNames extends string[]>(
names: TNames,
prefix?: string
): ReturnType<TNames> {
export function buildEventNamesFromEntityName<
TNames extends string[],
TPrefix extends string = ""
>(names: TNames, prefix?: TPrefix): ReturnType<TNames, TPrefix> {
const events = {}
for (let i = 0; i < names.length; i++) {
@@ -85,7 +97,7 @@ export function buildEventNamesFromEntityName<TNames extends string[]>(
}
}
return events as ReturnType<TNames>
return events as ReturnType<TNames, TPrefix>
}
export const EventPriority = {

View File

@@ -1,3 +1,5 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
import { buildEventNamesFromEntityName } from "../event-bus"
import { Modules } from "../modules-sdk"
@@ -37,4 +39,101 @@ export const FulfillmentEvents = {
* @deprecated use `FulfillmentWorkflowEvents.DELIVERY_CREATED` instead
*/
DELIVERY_CREATED: "delivery.created",
}
} as const
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // Fulfillment Set events
// [FulfillmentEvents.FULFILLMENT_SET_CREATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_SET_UPDATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_SET_DELETED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_SET_RESTORED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_SET_ATTACHED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_SET_DETACHED]?: EventOptions
// // Service Zone events
// [FulfillmentEvents.SERVICE_ZONE_CREATED]?: EventOptions
// [FulfillmentEvents.SERVICE_ZONE_UPDATED]?: EventOptions
// [FulfillmentEvents.SERVICE_ZONE_DELETED]?: EventOptions
// [FulfillmentEvents.SERVICE_ZONE_RESTORED]?: EventOptions
// [FulfillmentEvents.SERVICE_ZONE_ATTACHED]?: EventOptions
// [FulfillmentEvents.SERVICE_ZONE_DETACHED]?: EventOptions
// // Geo Zone events
// [FulfillmentEvents.GEO_ZONE_CREATED]?: EventOptions
// [FulfillmentEvents.GEO_ZONE_UPDATED]?: EventOptions
// [FulfillmentEvents.GEO_ZONE_DELETED]?: EventOptions
// [FulfillmentEvents.GEO_ZONE_RESTORED]?: EventOptions
// [FulfillmentEvents.GEO_ZONE_ATTACHED]?: EventOptions
// [FulfillmentEvents.GEO_ZONE_DETACHED]?: EventOptions
// // Shipping Option events
// [FulfillmentEvents.SHIPPING_OPTION_CREATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_UPDATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_DELETED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_RESTORED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_ATTACHED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_DETACHED]?: EventOptions
// // Shipping Option Type events
// [FulfillmentEvents.SHIPPING_OPTION_TYPE_CREATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_TYPE_UPDATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_TYPE_DELETED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_TYPE_RESTORED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_TYPE_ATTACHED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_TYPE_DETACHED]?: EventOptions
// // Shipping Profile events
// [FulfillmentEvents.SHIPPING_PROFILE_CREATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_PROFILE_UPDATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_PROFILE_DELETED]?: EventOptions
// [FulfillmentEvents.SHIPPING_PROFILE_RESTORED]?: EventOptions
// [FulfillmentEvents.SHIPPING_PROFILE_ATTACHED]?: EventOptions
// [FulfillmentEvents.SHIPPING_PROFILE_DETACHED]?: EventOptions
// // Shipping Option Rule events
// [FulfillmentEvents.SHIPPING_OPTION_RULE_CREATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_RULE_UPDATED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_RULE_DELETED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_RULE_RESTORED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_RULE_ATTACHED]?: EventOptions
// [FulfillmentEvents.SHIPPING_OPTION_RULE_DETACHED]?: EventOptions
// // Fulfillment events
// [FulfillmentEvents.FULFILLMENT_CREATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_UPDATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_DELETED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_RESTORED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ATTACHED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_DETACHED]?: EventOptions
// // Fulfillment Address events
// [FulfillmentEvents.FULFILLMENT_ADDRESS_CREATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ADDRESS_UPDATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ADDRESS_DELETED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ADDRESS_RESTORED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ADDRESS_ATTACHED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ADDRESS_DETACHED]?: EventOptions
// // Fulfillment Item events
// [FulfillmentEvents.FULFILLMENT_ITEM_CREATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ITEM_UPDATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ITEM_DELETED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ITEM_RESTORED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ITEM_ATTACHED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_ITEM_DETACHED]?: EventOptions
// // Fulfillment Label events
// [FulfillmentEvents.FULFILLMENT_LABEL_CREATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_LABEL_UPDATED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_LABEL_DELETED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_LABEL_RESTORED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_LABEL_ATTACHED]?: EventOptions
// [FulfillmentEvents.FULFILLMENT_LABEL_DETACHED]?: EventOptions
// // Deprecated events
// [FulfillmentEvents.SHIPMENT_CREATED]?: EventOptions
// [FulfillmentEvents.DELIVERY_CREATED]?: EventOptions
// }
// }

View File

@@ -1,3 +1,5 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
import { buildEventNamesFromEntityName } from "../event-bus"
import { Modules } from "../modules-sdk"
@@ -11,3 +13,32 @@ export const InventoryEvents = buildEventNamesFromEntityName(
eventBaseNames,
Modules.INVENTORY
)
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // Inventory Item events
// [InventoryEvents.INVENTORY_ITEM_CREATED]?: EventOptions
// [InventoryEvents.INVENTORY_ITEM_UPDATED]?: EventOptions
// [InventoryEvents.INVENTORY_ITEM_DELETED]?: EventOptions
// [InventoryEvents.INVENTORY_ITEM_RESTORED]?: EventOptions
// [InventoryEvents.INVENTORY_ITEM_ATTACHED]?: EventOptions
// [InventoryEvents.INVENTORY_ITEM_DETACHED]?: EventOptions
// // Reservation Item events
// [InventoryEvents.RESERVATION_ITEM_CREATED]?: EventOptions
// [InventoryEvents.RESERVATION_ITEM_UPDATED]?: EventOptions
// [InventoryEvents.RESERVATION_ITEM_DELETED]?: EventOptions
// [InventoryEvents.RESERVATION_ITEM_RESTORED]?: EventOptions
// [InventoryEvents.RESERVATION_ITEM_ATTACHED]?: EventOptions
// [InventoryEvents.RESERVATION_ITEM_DETACHED]?: EventOptions
// // Inventory Level events
// [InventoryEvents.INVENTORY_LEVEL_CREATED]?: EventOptions
// [InventoryEvents.INVENTORY_LEVEL_UPDATED]?: EventOptions
// [InventoryEvents.INVENTORY_LEVEL_DELETED]?: EventOptions
// [InventoryEvents.INVENTORY_LEVEL_RESTORED]?: EventOptions
// [InventoryEvents.INVENTORY_LEVEL_ATTACHED]?: EventOptions
// [InventoryEvents.INVENTORY_LEVEL_DETACHED]?: EventOptions
// }
// }

View File

@@ -1,3 +1,5 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
import { buildEventNamesFromEntityName } from "../event-bus"
import { Modules } from "../modules-sdk"
@@ -7,3 +9,16 @@ export const NotificationEvents = buildEventNamesFromEntityName(
eventBaseNames,
Modules.NOTIFICATION
)
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // Notification events
// [NotificationEvents.NOTIFICATION_CREATED]?: EventOptions
// [NotificationEvents.NOTIFICATION_UPDATED]?: EventOptions
// [NotificationEvents.NOTIFICATION_DELETED]?: EventOptions
// [NotificationEvents.NOTIFICATION_RESTORED]?: EventOptions
// [NotificationEvents.NOTIFICATION_ATTACHED]?: EventOptions
// [NotificationEvents.NOTIFICATION_DETACHED]?: EventOptions
// }
// }

View File

@@ -1,3 +1,5 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
import { buildEventNamesFromEntityName } from "../event-bus"
import { Modules } from "../modules-sdk"
@@ -13,3 +15,48 @@ export const PricingEvents = buildEventNamesFromEntityName(
eventBaseNames,
Modules.PRICING
)
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // Price List Rule events
// [PricingEvents.PRICE_LIST_RULE_CREATED]?: EventOptions
// [PricingEvents.PRICE_LIST_RULE_UPDATED]?: EventOptions
// [PricingEvents.PRICE_LIST_RULE_DELETED]?: EventOptions
// [PricingEvents.PRICE_LIST_RULE_RESTORED]?: EventOptions
// [PricingEvents.PRICE_LIST_RULE_ATTACHED]?: EventOptions
// [PricingEvents.PRICE_LIST_RULE_DETACHED]?: EventOptions
// // Price List events
// [PricingEvents.PRICE_LIST_CREATED]?: EventOptions
// [PricingEvents.PRICE_LIST_UPDATED]?: EventOptions
// [PricingEvents.PRICE_LIST_DELETED]?: EventOptions
// [PricingEvents.PRICE_LIST_RESTORED]?: EventOptions
// [PricingEvents.PRICE_LIST_ATTACHED]?: EventOptions
// [PricingEvents.PRICE_LIST_DETACHED]?: EventOptions
// // Price Rule events
// [PricingEvents.PRICE_RULE_CREATED]?: EventOptions
// [PricingEvents.PRICE_RULE_UPDATED]?: EventOptions
// [PricingEvents.PRICE_RULE_DELETED]?: EventOptions
// [PricingEvents.PRICE_RULE_RESTORED]?: EventOptions
// [PricingEvents.PRICE_RULE_ATTACHED]?: EventOptions
// [PricingEvents.PRICE_RULE_DETACHED]?: EventOptions
// // Price Set events
// [PricingEvents.PRICE_SET_CREATED]?: EventOptions
// [PricingEvents.PRICE_SET_UPDATED]?: EventOptions
// [PricingEvents.PRICE_SET_DELETED]?: EventOptions
// [PricingEvents.PRICE_SET_RESTORED]?: EventOptions
// [PricingEvents.PRICE_SET_ATTACHED]?: EventOptions
// [PricingEvents.PRICE_SET_DETACHED]?: EventOptions
// // Price events
// [PricingEvents.PRICE_CREATED]?: EventOptions
// [PricingEvents.PRICE_UPDATED]?: EventOptions
// [PricingEvents.PRICE_DELETED]?: EventOptions
// [PricingEvents.PRICE_RESTORED]?: EventOptions
// [PricingEvents.PRICE_ATTACHED]?: EventOptions
// [PricingEvents.PRICE_DETACHED]?: EventOptions
// }
// }

View File

@@ -1,3 +1,5 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
import { buildEventNamesFromEntityName } from "../event-bus"
import { Modules } from "../modules-sdk"
@@ -27,3 +29,80 @@ export const ProductEvents = buildEventNamesFromEntityName(
eventBaseNames,
Modules.PRODUCT
)
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // Product events
// [ProductEvents.PRODUCT_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_DETACHED]?: EventOptions
// // Product Variant events
// [ProductEvents.PRODUCT_VARIANT_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_VARIANT_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_VARIANT_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_VARIANT_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_VARIANT_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_VARIANT_DETACHED]?: EventOptions
// // Product Option events
// [ProductEvents.PRODUCT_OPTION_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_DETACHED]?: EventOptions
// // Product Option Value events
// [ProductEvents.PRODUCT_OPTION_VALUE_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_VALUE_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_VALUE_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_VALUE_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_VALUE_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_OPTION_VALUE_DETACHED]?: EventOptions
// // Product Type events
// [ProductEvents.PRODUCT_TYPE_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_TYPE_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_TYPE_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_TYPE_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_TYPE_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_TYPE_DETACHED]?: EventOptions
// // Product Tag events
// [ProductEvents.PRODUCT_TAG_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_TAG_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_TAG_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_TAG_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_TAG_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_TAG_DETACHED]?: EventOptions
// // Product Category events
// [ProductEvents.PRODUCT_CATEGORY_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_CATEGORY_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_CATEGORY_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_CATEGORY_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_CATEGORY_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_CATEGORY_DETACHED]?: EventOptions
// // Product Collection events
// [ProductEvents.PRODUCT_COLLECTION_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_COLLECTION_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_COLLECTION_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_COLLECTION_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_COLLECTION_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_COLLECTION_DETACHED]?: EventOptions
// // Product Image events
// [ProductEvents.PRODUCT_IMAGE_CREATED]?: EventOptions
// [ProductEvents.PRODUCT_IMAGE_UPDATED]?: EventOptions
// [ProductEvents.PRODUCT_IMAGE_DELETED]?: EventOptions
// [ProductEvents.PRODUCT_IMAGE_RESTORED]?: EventOptions
// [ProductEvents.PRODUCT_IMAGE_ATTACHED]?: EventOptions
// [ProductEvents.PRODUCT_IMAGE_DETACHED]?: EventOptions
// }
// }

View File

@@ -1,3 +1,5 @@
// TODO: Comment temporarely and we will re enable it in the near future #14478
// import { EventOptions } from "@medusajs/types"
import { buildEventNamesFromEntityName } from "../event-bus"
import { Modules } from "../modules-sdk"
@@ -6,4 +8,28 @@ const eventBaseNames: ["user", "invite"] = ["user", "invite"]
export const UserEvents = {
...buildEventNamesFromEntityName(eventBaseNames, Modules.USER),
INVITE_TOKEN_GENERATED: `${Modules.USER}.user.invite.token_generated`,
}
} as const
// TODO: Comment temporarely and we will re enable it in the near future #14478
// declare module "@medusajs/types" {
// export interface EventBusEventsOptions {
// // User events
// [UserEvents.USER_CREATED]?: EventOptions
// [UserEvents.USER_UPDATED]?: EventOptions
// [UserEvents.USER_DELETED]?: EventOptions
// [UserEvents.USER_RESTORED]?: EventOptions
// [UserEvents.USER_ATTACHED]?: EventOptions
// [UserEvents.USER_DETACHED]?: EventOptions
// // Invite events
// [UserEvents.INVITE_CREATED]?: EventOptions
// [UserEvents.INVITE_UPDATED]?: EventOptions
// [UserEvents.INVITE_DELETED]?: EventOptions
// [UserEvents.INVITE_RESTORED]?: EventOptions
// [UserEvents.INVITE_ATTACHED]?: EventOptions
// [UserEvents.INVITE_DETACHED]?: EventOptions
// // Custom events
// [UserEvents.INVITE_TOKEN_GENERATED]?: EventOptions
// }
// }