Chore(medusa,utils,types,inventory,stock-location): remove core dependency modules (#3531)
This commit is contained in:
@@ -25,4 +25,3 @@ export default moduleDefinition
|
||||
|
||||
export * from "./initialize"
|
||||
export * from "./types"
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { IInventoryService } from "@medusajs/medusa"
|
||||
import {
|
||||
ExternalModuleDeclaration,
|
||||
InternalModuleDeclaration,
|
||||
MedusaModule
|
||||
MedusaModule,
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { EventBusTypes } from "@medusajs/types"
|
||||
import { IEventBusService, IInventoryService } from "@medusajs/types"
|
||||
import { InventoryServiceInitializeOptions } from "../types"
|
||||
|
||||
export const initialize = async (
|
||||
options?: InventoryServiceInitializeOptions | ExternalModuleDeclaration,
|
||||
injectedDependencies?: {
|
||||
eventBusService: EventBusTypes.IEventBusService
|
||||
eventBusService: IEventBusService
|
||||
}
|
||||
): Promise<IInventoryService> => {
|
||||
const serviceKey = "inventoryService"
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { DataSource, DataSourceOptions } from "typeorm"
|
||||
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import { asValue } from "awilix"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import * as InventoryModels from "../models"
|
||||
import { InventoryServiceInitializeOptions } from "../types"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { InternalModuleDeclaration, LoaderOptions } from "@medusajs/modules-sdk"
|
||||
import {
|
||||
InventoryItemService,
|
||||
InventoryLevelService,
|
||||
ReservationItemService
|
||||
ReservationItemService,
|
||||
} from "../services"
|
||||
|
||||
import { asClass } from "awilix"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Index, BeforeInsert, Column, Entity } from "typeorm"
|
||||
import { SoftDeletableEntity, generateEntityId } from "@medusajs/medusa"
|
||||
import { generateEntityId, SoftDeletableEntity } from "@medusajs/utils"
|
||||
import { BeforeInsert, Column, Entity, Index } from "typeorm"
|
||||
|
||||
@Entity()
|
||||
export class InventoryItem extends SoftDeletableEntity {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Index, Unique, BeforeInsert, Column, Entity } from "typeorm"
|
||||
import { SoftDeletableEntity, generateEntityId } from "@medusajs/medusa"
|
||||
import { generateEntityId, SoftDeletableEntity } from "@medusajs/utils"
|
||||
import { BeforeInsert, Column, Entity, Index } from "typeorm"
|
||||
|
||||
@Entity()
|
||||
@Index(["inventory_item_id", "location_id"], { unique: true })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Index, BeforeInsert, Column, Entity } from "typeorm"
|
||||
import { SoftDeletableEntity, generateEntityId } from "@medusajs/medusa"
|
||||
import { generateEntityId, SoftDeletableEntity } from "@medusajs/utils"
|
||||
import { BeforeInsert, Column, Entity, Index } from "typeorm"
|
||||
|
||||
@Entity()
|
||||
export class ReservationItem extends SoftDeletableEntity {
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
import {
|
||||
buildQuery,
|
||||
CreateInventoryItemInput,
|
||||
FilterableInventoryItemProps,
|
||||
FindConfig,
|
||||
InventoryItemDTO
|
||||
} from "@medusajs/medusa"
|
||||
import { EventBusTypes, SharedContext } from "@medusajs/types"
|
||||
import { InjectEntityManager, MedusaContext } from "@medusajs/utils"
|
||||
import { isDefined, MedusaError } from "medusa-core-utils"
|
||||
IEventBusService,
|
||||
InventoryItemDTO,
|
||||
SharedContext,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
buildQuery,
|
||||
InjectEntityManager,
|
||||
isDefined,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
} from "@medusajs/utils"
|
||||
import { DeepPartial, EntityManager, FindManyOptions } from "typeorm"
|
||||
import { InventoryItem } from "../models"
|
||||
import { getListQuery } from "../utils/query"
|
||||
|
||||
type InjectedDependencies = {
|
||||
eventBusService: EventBusTypes.IEventBusService
|
||||
eventBusService: IEventBusService
|
||||
manager: EntityManager
|
||||
}
|
||||
|
||||
@@ -25,7 +30,7 @@ export default class InventoryItemService {
|
||||
}
|
||||
|
||||
protected readonly manager_: EntityManager
|
||||
protected readonly eventBusService_: EventBusTypes.IEventBusService | undefined
|
||||
protected readonly eventBusService_: IEventBusService | undefined
|
||||
|
||||
constructor({ eventBusService, manager }: InjectedDependencies) {
|
||||
this.manager_ = manager
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import {
|
||||
buildQuery,
|
||||
CreateInventoryLevelInput,
|
||||
FilterableInventoryLevelProps,
|
||||
FindConfig
|
||||
} from "@medusajs/medusa"
|
||||
import { EventBusTypes, SharedContext } from "@medusajs/types"
|
||||
import { InjectEntityManager, MedusaContext } from "@medusajs/utils"
|
||||
import { isDefined, MedusaError } from "medusa-core-utils"
|
||||
FindConfig,
|
||||
IEventBusService,
|
||||
SharedContext,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
buildQuery,
|
||||
InjectEntityManager,
|
||||
isDefined,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
} from "@medusajs/utils"
|
||||
import { DeepPartial, EntityManager, FindManyOptions, In } from "typeorm"
|
||||
import { InventoryLevel } from "../models"
|
||||
|
||||
type InjectedDependencies = {
|
||||
eventBusService: EventBusTypes.IEventBusService
|
||||
eventBusService: IEventBusService
|
||||
manager: EntityManager
|
||||
}
|
||||
|
||||
@@ -23,7 +28,7 @@ export default class InventoryLevelService {
|
||||
}
|
||||
|
||||
protected readonly manager_: EntityManager
|
||||
protected readonly eventBusService_: EventBusTypes.IEventBusService | undefined
|
||||
protected readonly eventBusService_: IEventBusService | undefined
|
||||
|
||||
constructor({ eventBusService, manager }: InjectedDependencies) {
|
||||
this.manager_ = manager
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { InternalModuleDeclaration } from "@medusajs/modules-sdk"
|
||||
|
||||
import {
|
||||
CreateInventoryItemInput,
|
||||
CreateInventoryLevelInput,
|
||||
@@ -8,33 +7,35 @@ import {
|
||||
FilterableInventoryLevelProps,
|
||||
FilterableReservationItemProps,
|
||||
FindConfig,
|
||||
IEventBusService,
|
||||
IInventoryService,
|
||||
InventoryItemDTO,
|
||||
InventoryLevelDTO,
|
||||
ReservationItemDTO,
|
||||
SharedContext,
|
||||
UpdateInventoryLevelInput,
|
||||
UpdateReservationItemInput
|
||||
} from "@medusajs/medusa"
|
||||
import { EventBusTypes, SharedContext } from "@medusajs/types"
|
||||
import { InjectEntityManager, MedusaContext } from "@medusajs/utils"
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
UpdateReservationItemInput,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
InventoryItemService,
|
||||
InventoryLevelService,
|
||||
ReservationItemService
|
||||
} from "./"
|
||||
InjectEntityManager,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
} from "@medusajs/utils"
|
||||
import { EntityManager } from "typeorm"
|
||||
import InventoryItemService from "./inventory-item"
|
||||
import InventoryLevelService from "./inventory-level"
|
||||
import ReservationItemService from "./reservation-item"
|
||||
|
||||
type InjectedDependencies = {
|
||||
manager: EntityManager
|
||||
eventBusService: EventBusTypes.IEventBusService
|
||||
eventBusService: IEventBusService
|
||||
inventoryItemService: InventoryItemService
|
||||
inventoryLevelService: InventoryLevelService
|
||||
reservationItemService: ReservationItemService
|
||||
}
|
||||
export default class InventoryService implements IInventoryService {
|
||||
protected readonly manager_: EntityManager
|
||||
protected readonly eventBusService_: EventBusTypes.IEventBusService | undefined
|
||||
protected readonly eventBusService_: IEventBusService | undefined
|
||||
protected readonly inventoryItemService_: InventoryItemService
|
||||
protected readonly reservationItemService_: ReservationItemService
|
||||
protected readonly inventoryLevelService_: InventoryLevelService
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
import {
|
||||
buildQuery,
|
||||
CreateReservationItemInput,
|
||||
FilterableReservationItemProps,
|
||||
FindConfig, UpdateReservationItemInput
|
||||
} from "@medusajs/medusa"
|
||||
import { EventBusTypes, SharedContext } from "@medusajs/types"
|
||||
import { InjectEntityManager, MedusaContext } from "@medusajs/utils"
|
||||
import { isDefined, MedusaError } from "medusa-core-utils"
|
||||
FindConfig,
|
||||
IEventBusService,
|
||||
SharedContext,
|
||||
UpdateReservationItemInput,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
buildQuery,
|
||||
InjectEntityManager,
|
||||
isDefined,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
} from "@medusajs/utils"
|
||||
import { EntityManager, FindManyOptions } from "typeorm"
|
||||
import { InventoryLevelService } from "."
|
||||
import { ReservationItem } from "../models"
|
||||
|
||||
type InjectedDependencies = {
|
||||
eventBusService: EventBusTypes.IEventBusService
|
||||
eventBusService: IEventBusService
|
||||
manager: EntityManager
|
||||
inventoryLevelService: InventoryLevelService
|
||||
}
|
||||
@@ -25,7 +31,7 @@ export default class ReservationItemService {
|
||||
}
|
||||
|
||||
protected readonly manager_: EntityManager
|
||||
protected readonly eventBusService_: EventBusTypes.IEventBusService | undefined
|
||||
protected readonly eventBusService_: IEventBusService | undefined
|
||||
protected readonly inventoryLevelService_: InventoryLevelService
|
||||
|
||||
constructor({
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { EntityManager, FindOptionsWhere, ILike } from "typeorm"
|
||||
import {
|
||||
buildLegacyFieldsListFrom,
|
||||
buildQuery,
|
||||
ExtendedFindConfig,
|
||||
FilterableInventoryItemProps,
|
||||
FindConfig,
|
||||
} from "@medusajs/medusa"
|
||||
} from "@medusajs/types"
|
||||
import { buildLegacyFieldsListFrom, buildQuery } from "@medusajs/utils"
|
||||
import { EntityManager, FindOptionsWhere, ILike } from "typeorm"
|
||||
import { InventoryItem } from "../models"
|
||||
|
||||
export function getListQuery(
|
||||
|
||||
Reference in New Issue
Block a user