breaking: remove deprecated commands and code (#9521)

* breaking: remove deprecated commands

* feat: remove deprecated code and usages

* refactor: remove more logic around default relations

* fix tests

* remove log

* fix: remove defaultFields usage

* fix: add back accidentally removed code

* refactor: implement feedback

* feat: add --cluster flag to the start command

* refactor: assign limit to defaultLimit property

* fix: breaking code because of removed check

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
This commit is contained in:
Harminder Virk
2024-10-14 20:11:34 +05:30
committed by GitHub
parent cea4cdc8d7
commit ad322f2760
37 changed files with 162 additions and 679 deletions
@@ -1,4 +1,4 @@
import { Context, SharedContext } from "@medusajs/types"
import { Context } from "@medusajs/types"
import { MedusaContextType } from "./context-parameter"
export function InjectSharedContext(): MethodDecorator {
@@ -17,7 +17,7 @@ export function InjectSharedContext(): MethodDecorator {
const argIndex = target.MedusaContextIndex_[propertyKey]
descriptor.value = function (...args: any[]) {
const context: SharedContext | Context = {
const context: Context = {
...(args[argIndex] ?? { __type: MedusaContextType }),
}
args[argIndex] = context
@@ -1,5 +1,5 @@
import { Context, EventBusTypes } from "@medusajs/types"
import { buildModuleResourceEventName } from "../event-bus"
import { buildModuleResourceEventName } from "../event-bus/utils"
// TODO should that move closer to the event bus? and maybe be rename to modulemoduleEventBuilderFactory
@@ -28,16 +28,11 @@ import { buildModuleResourceEventName } from "../event-bus"
export function moduleEventBuilderFactory({
action,
object,
eventsEnum,
eventName,
source,
}: {
action: string
object: string
/**
* @deprecated use eventName instead
*/
eventsEnum?: Record<string, string>
eventName?: string
source: string
}) {
@@ -57,14 +52,8 @@ export function moduleEventBuilderFactory({
const aggregator = sharedContext.messageAggregator!
const messages: EventBusTypes.RawMessageFormat[] = []
// The event enums contains event formatted like so [object]_[action] e.g. PRODUCT_CREATED
// We expect the keys of events to be fully uppercased
let eventName_ = eventsEnum
? eventsEnum[`${object.toUpperCase()}_${action.toUpperCase()}`]
: eventName
if (!eventName_) {
eventName_ = buildModuleResourceEventName({
if (!eventName) {
eventName = buildModuleResourceEventName({
prefix: source,
objectName: object,
action,
@@ -77,7 +66,7 @@ export function moduleEventBuilderFactory({
action,
context: sharedContext,
data: { id: dataItem.id },
eventName: eventName_,
eventName: eventName!,
object,
})
})
@@ -25,16 +25,6 @@ export type ModelDTOConfig = {
model?: DmlEntity<any, any>
create?: any
update?: any
/**
* @internal
* @deprecated
*/
singular?: string
/**
* @internal
* @deprecated
*/
plural?: string
}
export type ModelsConfigTemplate = { [key: string]: ModelDTOConfig }
@@ -51,21 +41,6 @@ export type ModelConfigurationsToConfigTemplate<T extends ModelEntries> = {
: T[Key] extends IDmlEntity<any, any>
? T[Key]
: never
/**
* @deprecated
*/
create: any
update: any
/**
* @deprecated
*/
singular: T[Key] extends { singular: string } ? T[Key]["singular"] : Key
/**
* @deprecated
*/
plural: T[Key] extends { plural: string }
? T[Key]["plural"]
: Pluralize<Key & string>
}
}