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:
committed by
GitHub
parent
cbc9f3d059
commit
1347698876
10
.changeset/cold-lamps-search.md
Normal file
10
.changeset/cold-lamps-search.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/event-bus-redis": patch
|
||||||
|
"@medusajs/draft-order": patch
|
||||||
|
"@medusajs/framework": patch
|
||||||
|
"@medusajs/types": patch
|
||||||
|
"@medusajs/utils": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Feat/enable event configuration in medusa config
|
||||||
|
enables event priority configuration through the Medusa config, allowing users to configure event processing options (like priority) for specific events at the module level.
|
||||||
@@ -27,7 +27,10 @@
|
|||||||
"./telemetry": "./dist/telemetry/index.js",
|
"./telemetry": "./dist/telemetry/index.js",
|
||||||
"./feature-flags": "./dist/feature-flags/index.js",
|
"./feature-flags": "./dist/feature-flags/index.js",
|
||||||
"./utils": "./dist/utils/index.js",
|
"./utils": "./dist/utils/index.js",
|
||||||
"./types": "./dist/types/index.js",
|
"./types": {
|
||||||
|
"types": "./dist/types/index.d.ts",
|
||||||
|
"default": "./dist/types/index.js"
|
||||||
|
},
|
||||||
"./build-tools": "./dist/build-tools/index.js",
|
"./build-tools": "./dist/build-tools/index.js",
|
||||||
"./orchestration": "./dist/orchestration/index.js",
|
"./orchestration": "./dist/orchestration/index.js",
|
||||||
"./workflows-sdk": "./dist/workflows-sdk/index.js",
|
"./workflows-sdk": "./dist/workflows-sdk/index.js",
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
|
import "@medusajs/utils"
|
||||||
export * from "@medusajs/types"
|
export * from "@medusajs/types"
|
||||||
|
|
||||||
|
import type { ModuleOptions as ModuleOptionsType } from "@medusajs/types"
|
||||||
|
|
||||||
|
// Re-declare ModuleOptions to enable augmentation from @medusajs/framework/types
|
||||||
|
// EventBusEventsOptions is exported via "export *" and gets augmentations from @medusajs/utils
|
||||||
|
export interface ModuleOptions extends ModuleOptionsType {}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import "@medusajs/types"
|
||||||
|
import "@medusajs/utils"
|
||||||
import "../types/container"
|
import "../types/container"
|
||||||
|
|
||||||
export * from "@medusajs/utils"
|
export * from "@medusajs/utils"
|
||||||
|
|||||||
@@ -1139,32 +1139,30 @@ type ExternalModuleDeclarationOverride = ExternalModuleDeclaration & {
|
|||||||
disable?: boolean
|
disable?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
type ModuleConfigForResolve<R extends string> = R extends keyof ModuleOptions
|
||||||
* Generates a union of typed module configs for all known modules in the ModuleOptions registry.
|
? {
|
||||||
* This enables automatic type inference when using registered module resolve strings.
|
resolve: R
|
||||||
*/
|
|
||||||
type KnownModuleConfigs = {
|
|
||||||
[K in keyof ModuleOptions]: Partial<
|
|
||||||
Omit<InternalModuleDeclaration, "options"> & {
|
|
||||||
key?: string
|
key?: string
|
||||||
disable?: boolean
|
disable?: boolean
|
||||||
resolve: K
|
options?: ModuleOptions[R]
|
||||||
options?: ModuleOptions[K]
|
} & Partial<Omit<InternalModuleDeclaration, "options" | "resolve">>
|
||||||
}
|
: {
|
||||||
>
|
resolve?: string
|
||||||
}[keyof ModuleOptions]
|
key?: string
|
||||||
|
disable?: boolean
|
||||||
|
options?: object
|
||||||
|
} & Partial<Omit<InternalModuleDeclaration, "options" | "resolve">>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a union of typed module configs for all known modules in the ModuleOptions registry.
|
||||||
|
* This distributes over all keys in ModuleOptions to create specific config types for each.
|
||||||
|
*/
|
||||||
|
type KnownModuleConfigs = ModuleConfigForResolve<keyof ModuleOptions & string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic module config for modules not registered in ModuleOptions.
|
* Generic module config for modules not registered in ModuleOptions.
|
||||||
*/
|
*/
|
||||||
type GenericModuleConfig = Partial<
|
type GenericModuleConfig = ModuleConfigForResolve<string & {}>
|
||||||
Omit<InternalModuleDeclaration, "options"> & {
|
|
||||||
key?: string
|
|
||||||
disable?: boolean
|
|
||||||
resolve?: string
|
|
||||||
options?: Record<string, unknown>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modules accepted by the defineConfig function.
|
* Modules accepted by the defineConfig function.
|
||||||
@@ -1177,20 +1175,36 @@ export type InputConfigModules = (
|
|||||||
)[]
|
)[]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration accepted by the "defineConfig" helper
|
* Base configuration type without modules
|
||||||
*/
|
*/
|
||||||
export type InputConfig = Partial<
|
type InputConfigBase = Partial<
|
||||||
Omit<ConfigModule, "admin" | "modules"> & {
|
Omit<ConfigModule, "admin" | "modules"> & {
|
||||||
admin?: Partial<ConfigModule["admin"]>
|
admin?: Partial<ConfigModule["admin"]>
|
||||||
modules:
|
|
||||||
| InputConfigModules
|
|
||||||
/**
|
|
||||||
* @deprecated use the array instead
|
|
||||||
*/
|
|
||||||
| ConfigModule["modules"]
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration with array-based modules (recommended)
|
||||||
|
*/
|
||||||
|
export type InputConfigWithArrayModules = InputConfigBase & {
|
||||||
|
modules?: InputConfigModules
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration with object-based modules (deprecated)
|
||||||
|
* @deprecated Use array-based modules instead
|
||||||
|
*/
|
||||||
|
export type InputConfigWithObjectModules = InputConfigBase & {
|
||||||
|
modules?: ConfigModule["modules"]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The configuration accepted by the "defineConfig" helper
|
||||||
|
*/
|
||||||
|
export type InputConfig =
|
||||||
|
| InputConfigWithArrayModules
|
||||||
|
| InputConfigWithObjectModules
|
||||||
|
|
||||||
type PluginAdminDetails = {
|
type PluginAdminDetails = {
|
||||||
type: "local" | "package"
|
type: "local" | "package"
|
||||||
resolve: string
|
resolve: string
|
||||||
|
|||||||
@@ -1,5 +1,27 @@
|
|||||||
import { Context } from "../shared-context"
|
import { Context } from "../shared-context"
|
||||||
|
|
||||||
|
// TODO: Comment temporarely and we will re enable it in the near future #14478
|
||||||
|
// /**
|
||||||
|
// * Configuration options for individual events.
|
||||||
|
// */
|
||||||
|
// export interface EventOptions {
|
||||||
|
// /**
|
||||||
|
// * Priority level for the event processing.
|
||||||
|
// * Lower numbers indicate higher priority.
|
||||||
|
// */
|
||||||
|
// priority?: number
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Registry for event bus events options types.
|
||||||
|
// * Events will be added to this registry to serve as a global configuration for all events
|
||||||
|
// * as part of the event bus module service module options.
|
||||||
|
// *
|
||||||
|
// * Modules augment this interface using declaration merging to register their event configurations.
|
||||||
|
// * Custom events can be added via declaration merging in your project.
|
||||||
|
// */
|
||||||
|
// export interface EventBusEventsOptions {}
|
||||||
|
|
||||||
export type Subscriber<TData = unknown> = (data: Event<TData>) => Promise<void>
|
export type Subscriber<TData = unknown> = (data: Event<TData>) => Promise<void>
|
||||||
|
|
||||||
export type SubscriberContext = {
|
export type SubscriberContext = {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import {
|
|||||||
ConfigModule,
|
ConfigModule,
|
||||||
InputConfig,
|
InputConfig,
|
||||||
InputConfigModules,
|
InputConfigModules,
|
||||||
|
InputConfigWithArrayModules,
|
||||||
|
InputConfigWithObjectModules,
|
||||||
InternalModuleDeclaration,
|
InternalModuleDeclaration,
|
||||||
MedusaCloudOptions,
|
MedusaCloudOptions,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
@@ -43,6 +45,15 @@ export const DEFAULT_STORE_RESTRICTED_FIELDS = [
|
|||||||
* make an application work seamlessly, but still provide you the ability
|
* make an application work seamlessly, but still provide you the ability
|
||||||
* to override configuration as needed.
|
* 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 {
|
export function defineConfig(config: InputConfig = {}): ConfigModule {
|
||||||
const options = {
|
const options = {
|
||||||
isCloud: process.env.EXECUTION_CONTEXT === MEDUSA_CLOUD_EXECUTION_CONTEXT,
|
isCloud: process.env.EXECUTION_CONTEXT === MEDUSA_CLOUD_EXECUTION_CONTEXT,
|
||||||
|
|||||||
@@ -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
|
* @category Cart
|
||||||
* @customNamespace Cart
|
* @customNamespace Cart
|
||||||
@@ -63,7 +66,7 @@ export const CartWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
CUSTOMER_TRANSFERRED: "cart.customer_transferred",
|
CUSTOMER_TRANSFERRED: "cart.customer_transferred",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Customer
|
* @category Customer
|
||||||
@@ -103,7 +106,7 @@ export const CustomerWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "customer.deleted",
|
DELETED: "customer.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Order
|
* @category Order
|
||||||
@@ -259,7 +262,7 @@ export const OrderWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
TRANSFER_REQUESTED: "order.transfer_requested",
|
TRANSFER_REQUESTED: "order.transfer_requested",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Order Edit
|
* @category Order Edit
|
||||||
@@ -308,7 +311,7 @@ export const OrderEditWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
CANCELED: "order-edit.canceled",
|
CANCELED: "order-edit.canceled",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category User
|
* @category User
|
||||||
@@ -348,7 +351,7 @@ export const UserWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "user.deleted",
|
DELETED: "user.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Auth
|
* @category Auth
|
||||||
@@ -370,7 +373,7 @@ export const AuthWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
PASSWORD_RESET: "auth.password_reset",
|
PASSWORD_RESET: "auth.password_reset",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Sales Channel
|
* @category Sales Channel
|
||||||
@@ -410,7 +413,7 @@ export const SalesChannelWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "sales-channel.deleted",
|
DELETED: "sales-channel.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product Category
|
* @category Product Category
|
||||||
@@ -450,7 +453,7 @@ export const ProductCategoryWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product-category.deleted",
|
DELETED: "product-category.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product Collection
|
* @category Product Collection
|
||||||
@@ -490,7 +493,7 @@ export const ProductCollectionWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product-collection.deleted",
|
DELETED: "product-collection.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product Variant
|
* @category Product Variant
|
||||||
@@ -530,7 +533,7 @@ export const ProductVariantWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product-variant.deleted",
|
DELETED: "product-variant.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product
|
* @category Product
|
||||||
@@ -570,7 +573,7 @@ export const ProductWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product.deleted",
|
DELETED: "product.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product Type
|
* @category Product Type
|
||||||
@@ -610,7 +613,7 @@ export const ProductTypeWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product-type.deleted",
|
DELETED: "product-type.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product Tag
|
* @category Product Tag
|
||||||
@@ -650,7 +653,7 @@ export const ProductTagWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product-tag.deleted",
|
DELETED: "product-tag.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Product Option
|
* @category Product Option
|
||||||
@@ -690,7 +693,7 @@ export const ProductOptionWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "product-option.deleted",
|
DELETED: "product-option.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Invite
|
* @category Invite
|
||||||
@@ -744,7 +747,7 @@ export const InviteWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
RESENT: "invite.resent",
|
RESENT: "invite.resent",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Region
|
* @category Region
|
||||||
@@ -784,7 +787,7 @@ export const RegionWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "region.deleted",
|
DELETED: "region.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Fulfillment
|
* @category Fulfillment
|
||||||
@@ -814,7 +817,7 @@ export const FulfillmentWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELIVERY_CREATED: "delivery.created",
|
DELIVERY_CREATED: "delivery.created",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Shipping Option Type
|
* @category Shipping Option Type
|
||||||
@@ -860,7 +863,7 @@ export const ShippingOptionTypeWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "shipping-option-type.deleted",
|
DELETED: "shipping-option-type.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Shipping Option
|
* @category Shipping Option
|
||||||
@@ -906,7 +909,7 @@ export const ShippingOptionWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "shipping-option.deleted",
|
DELETED: "shipping-option.deleted",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Payment
|
* @category Payment
|
||||||
@@ -935,7 +938,7 @@ export const PaymentEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
REFUNDED: "payment.refunded",
|
REFUNDED: "payment.refunded",
|
||||||
}
|
} as const
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Translation
|
* @category Translation
|
||||||
@@ -981,4 +984,122 @@ export const TranslationWorkflowEvents = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
DELETED: "translation.deleted",
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -2,30 +2,42 @@ import { KebabCase, SnakeCase } from "@medusajs/types"
|
|||||||
import { camelToSnakeCase, kebabCase, lowerCaseFirst } from "../common"
|
import { camelToSnakeCase, kebabCase, lowerCaseFirst } from "../common"
|
||||||
import { CommonEvents } from "./common-events"
|
import { CommonEvents } from "./common-events"
|
||||||
|
|
||||||
type ReturnType<TNames extends string[]> = {
|
type ReturnType<TNames extends string[], TPrefix extends string = ""> = {
|
||||||
[K in TNames[number] as `${Uppercase<
|
[K in TNames[number] as `${Uppercase<
|
||||||
SnakeCase<K & string>
|
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<
|
[K in TNames[number] as `${Uppercase<
|
||||||
SnakeCase<K & string>
|
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<
|
[K in TNames[number] as `${Uppercase<
|
||||||
SnakeCase<K & string>
|
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<
|
[K in TNames[number] as `${Uppercase<
|
||||||
SnakeCase<K & string>
|
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<
|
[K in TNames[number] as `${Uppercase<
|
||||||
SnakeCase<K & string>
|
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<
|
[K in TNames[number] as `${Uppercase<
|
||||||
SnakeCase<K & string>
|
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 names
|
||||||
* @param prefix
|
* @param prefix
|
||||||
*/
|
*/
|
||||||
export function buildEventNamesFromEntityName<TNames extends string[]>(
|
export function buildEventNamesFromEntityName<
|
||||||
names: TNames,
|
TNames extends string[],
|
||||||
prefix?: string
|
TPrefix extends string = ""
|
||||||
): ReturnType<TNames> {
|
>(names: TNames, prefix?: TPrefix): ReturnType<TNames, TPrefix> {
|
||||||
const events = {}
|
const events = {}
|
||||||
|
|
||||||
for (let i = 0; i < names.length; i++) {
|
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 = {
|
export const EventPriority = {
|
||||||
|
|||||||
@@ -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 { buildEventNamesFromEntityName } from "../event-bus"
|
||||||
import { Modules } from "../modules-sdk"
|
import { Modules } from "../modules-sdk"
|
||||||
|
|
||||||
@@ -37,4 +39,101 @@ export const FulfillmentEvents = {
|
|||||||
* @deprecated use `FulfillmentWorkflowEvents.DELIVERY_CREATED` instead
|
* @deprecated use `FulfillmentWorkflowEvents.DELIVERY_CREATED` instead
|
||||||
*/
|
*/
|
||||||
DELIVERY_CREATED: "delivery.created",
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -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 { buildEventNamesFromEntityName } from "../event-bus"
|
||||||
import { Modules } from "../modules-sdk"
|
import { Modules } from "../modules-sdk"
|
||||||
|
|
||||||
@@ -11,3 +13,32 @@ export const InventoryEvents = buildEventNamesFromEntityName(
|
|||||||
eventBaseNames,
|
eventBaseNames,
|
||||||
Modules.INVENTORY
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -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 { buildEventNamesFromEntityName } from "../event-bus"
|
||||||
import { Modules } from "../modules-sdk"
|
import { Modules } from "../modules-sdk"
|
||||||
|
|
||||||
@@ -7,3 +9,16 @@ export const NotificationEvents = buildEventNamesFromEntityName(
|
|||||||
eventBaseNames,
|
eventBaseNames,
|
||||||
Modules.NOTIFICATION
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -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 { buildEventNamesFromEntityName } from "../event-bus"
|
||||||
import { Modules } from "../modules-sdk"
|
import { Modules } from "../modules-sdk"
|
||||||
|
|
||||||
@@ -13,3 +15,48 @@ export const PricingEvents = buildEventNamesFromEntityName(
|
|||||||
eventBaseNames,
|
eventBaseNames,
|
||||||
Modules.PRICING
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -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 { buildEventNamesFromEntityName } from "../event-bus"
|
||||||
import { Modules } from "../modules-sdk"
|
import { Modules } from "../modules-sdk"
|
||||||
|
|
||||||
@@ -27,3 +29,80 @@ export const ProductEvents = buildEventNamesFromEntityName(
|
|||||||
eventBaseNames,
|
eventBaseNames,
|
||||||
Modules.PRODUCT
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -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 { buildEventNamesFromEntityName } from "../event-bus"
|
||||||
import { Modules } from "../modules-sdk"
|
import { Modules } from "../modules-sdk"
|
||||||
|
|
||||||
@@ -6,4 +8,28 @@ const eventBaseNames: ["user", "invite"] = ["user", "invite"]
|
|||||||
export const UserEvents = {
|
export const UserEvents = {
|
||||||
...buildEventNamesFromEntityName(eventBaseNames, Modules.USER),
|
...buildEventNamesFromEntityName(eventBaseNames, Modules.USER),
|
||||||
INVITE_TOKEN_GENERATED: `${Modules.USER}.user.invite.token_generated`,
|
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
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
"author": "Medusa",
|
"author": "Medusa",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@medusajs/framework": "2.12.5"
|
"@medusajs/framework": "2.12.5",
|
||||||
|
"@medusajs/types": "2.12.5",
|
||||||
|
"@medusajs/utils": "2.12.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "yarn run -T tsc --build --watch",
|
"watch": "yarn run -T tsc --build --watch",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Event,
|
Event,
|
||||||
|
// TODO: Comment temporarely and we will re enable it in the near future #14478
|
||||||
|
// EventBusEventsOptions,
|
||||||
InternalModuleDeclaration,
|
InternalModuleDeclaration,
|
||||||
Logger,
|
Logger,
|
||||||
Message,
|
Message,
|
||||||
@@ -53,6 +55,8 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
|
|||||||
protected readonly queueOptions_: Omit<QueueOptions, "connection">
|
protected readonly queueOptions_: Omit<QueueOptions, "connection">
|
||||||
protected readonly workerOptions_: Omit<WorkerOptions, "connection">
|
protected readonly workerOptions_: Omit<WorkerOptions, "connection">
|
||||||
protected readonly jobOptions_: EmitOptions
|
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 queue_: Queue
|
||||||
protected bullWorker_: Worker
|
protected bullWorker_: Worker
|
||||||
@@ -79,6 +83,11 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
|
|||||||
this.queueOptions_ = eventBusRedisQueueOptions ?? {}
|
this.queueOptions_ = eventBusRedisQueueOptions ?? {}
|
||||||
this.workerOptions_ = eventBusRedisWorkerOptions ?? {}
|
this.workerOptions_ = eventBusRedisWorkerOptions ?? {}
|
||||||
this.jobOptions_ = eventBusRedisJobOptions ?? {}
|
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_, {
|
this.queue_ = new Queue(this.queueName_, {
|
||||||
prefix: `${this.constructor.name}`,
|
prefix: `${this.constructor.name}`,
|
||||||
@@ -153,6 +162,11 @@ export default class RedisEventBusService extends AbstractEventBusModuleService
|
|||||||
...eventData.options,
|
...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 (
|
if (
|
||||||
finalOptions.priority != undefined &&
|
finalOptions.priority != undefined &&
|
||||||
(finalOptions.priority < 1 ||
|
(finalOptions.priority < 1 ||
|
||||||
|
|||||||
@@ -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 {
|
import {
|
||||||
BulkJobOptions,
|
BulkJobOptions,
|
||||||
Job,
|
Job,
|
||||||
@@ -68,6 +75,8 @@ export type EventBusRedisModuleOptions = {
|
|||||||
* @see https://api.docs.bullmq.io/interfaces/BaseJobOptions.html
|
* @see https://api.docs.bullmq.io/interfaces/BaseJobOptions.html
|
||||||
*/
|
*/
|
||||||
jobOptions?: EmitOptions
|
jobOptions?: EmitOptions
|
||||||
|
|
||||||
|
// eventOptions?: EventBusEventsOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "@medusajs/types" {
|
declare module "@medusajs/types" {
|
||||||
|
|||||||
1
packages/plugins/draft-order/index.d.ts
vendored
Normal file
1
packages/plugins/draft-order/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// noop for typeRoots in compiler options
|
||||||
1
packages/plugins/draft-order/src/index.ts
Normal file
1
packages/plugins/draft-order/src/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// noop, for compiler options
|
||||||
@@ -3575,6 +3575,8 @@ __metadata:
|
|||||||
resolution: "@medusajs/event-bus-redis@workspace:packages/modules/event-bus-redis"
|
resolution: "@medusajs/event-bus-redis@workspace:packages/modules/event-bus-redis"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@medusajs/framework": 2.12.5
|
"@medusajs/framework": 2.12.5
|
||||||
|
"@medusajs/types": 2.12.5
|
||||||
|
"@medusajs/utils": 2.12.5
|
||||||
bullmq: 5.13.0
|
bullmq: 5.13.0
|
||||||
ioredis: ^5.4.1
|
ioredis: ^5.4.1
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user