feat: make AbstractModuleService create method type-safe (#11216)
This commit is contained in:
23
.changeset/green-insects-invite.md
Normal file
23
.changeset/green-insects-invite.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
"@medusajs/api-key": patch
|
||||
"@medusajs/auth": patch
|
||||
"@medusajs/cart": patch
|
||||
"@medusajs/customer": patch
|
||||
"@medusajs/fulfillment": patch
|
||||
"@medusajs/inventory": patch
|
||||
"@medusajs/notification": patch
|
||||
"@medusajs/order": patch
|
||||
"@medusajs/payment": patch
|
||||
"@medusajs/pricing": patch
|
||||
"@medusajs/product": patch
|
||||
"@medusajs/promotion": patch
|
||||
"@medusajs/region": patch
|
||||
"@medusajs/sales-channel": patch
|
||||
"@medusajs/stock-location": patch
|
||||
"@medusajs/store": patch
|
||||
"@medusajs/tax": patch
|
||||
"@medusajs/user": patch
|
||||
"@medusajs/utils": patch
|
||||
---
|
||||
|
||||
feat: make AbstractModuleService create method type-safe
|
||||
@@ -0,0 +1,275 @@
|
||||
import { expectTypeOf } from "expect-type"
|
||||
import { model } from "../../dml"
|
||||
import { MedusaService } from "../medusa-service"
|
||||
import { InferTypeOf } from "@medusajs/types"
|
||||
|
||||
const Blog = model.define("Blog", {
|
||||
id: model.text(),
|
||||
title: model.text(),
|
||||
description: model.text().nullable(),
|
||||
})
|
||||
|
||||
type BlogDTO = {
|
||||
id: number
|
||||
title: string
|
||||
}
|
||||
|
||||
type CreateBlogDTO = {
|
||||
title: string | null
|
||||
}
|
||||
|
||||
const baseRepoMock = {
|
||||
serialize: jest.fn().mockImplementation((item) => item),
|
||||
transaction: (task) => task("transactionManager"),
|
||||
getFreshManager: jest.fn().mockReturnThis(),
|
||||
}
|
||||
|
||||
const containerMock = {
|
||||
baseRepository: baseRepoMock,
|
||||
mainModelMockRepository: baseRepoMock,
|
||||
otherModelMock1Repository: baseRepoMock,
|
||||
otherModelMock2Repository: baseRepoMock,
|
||||
mainModelMockService: {
|
||||
retrieve: jest.fn().mockResolvedValue({ id: "1", name: "Item" }),
|
||||
list: jest.fn().mockResolvedValue([{ id: "1", name: "Item" }]),
|
||||
delete: jest.fn().mockResolvedValue(undefined),
|
||||
softDelete: jest.fn().mockResolvedValue([[], {}]),
|
||||
restore: jest.fn().mockResolvedValue([[], {}]),
|
||||
},
|
||||
otherModelMock1Service: {
|
||||
retrieve: jest.fn().mockResolvedValue({ id: "1", name: "Item" }),
|
||||
list: jest.fn().mockResolvedValue([{ id: "1", name: "Item" }]),
|
||||
delete: jest.fn().mockResolvedValue(undefined),
|
||||
softDelete: jest.fn().mockResolvedValue([[], {}]),
|
||||
restore: jest.fn().mockResolvedValue([[], {}]),
|
||||
},
|
||||
otherModelMock2Service: {
|
||||
retrieve: jest.fn().mockResolvedValue({ id: "1", name: "Item" }),
|
||||
list: jest.fn().mockResolvedValue([{ id: "1", name: "Item" }]),
|
||||
delete: jest.fn().mockResolvedValue(undefined),
|
||||
softDelete: jest.fn().mockResolvedValue([[], {}]),
|
||||
restore: jest.fn().mockResolvedValue([[], {}]),
|
||||
},
|
||||
}
|
||||
|
||||
describe("Medusa Service typings", () => {
|
||||
describe("create<Service>", () => {
|
||||
test("type-hint model properties", () => {
|
||||
class BlogService extends MedusaService({ Blog }) {}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.createBlogs).parameters.toEqualTypeOf<
|
||||
| [
|
||||
Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>,
|
||||
...rest: any[]
|
||||
]
|
||||
| [
|
||||
Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>[],
|
||||
...rest: any[]
|
||||
]
|
||||
>()
|
||||
expectTypeOf(blogService.createBlogs).returns.toEqualTypeOf<
|
||||
Promise<InferTypeOf<typeof Blog>> | Promise<InferTypeOf<typeof Blog>[]>
|
||||
>()
|
||||
})
|
||||
|
||||
test("type-hint DTO properties", () => {
|
||||
class BlogService extends MedusaService<{ Blog: { dto: BlogDTO } }>({
|
||||
Blog,
|
||||
}) {}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.createBlogs).parameters.toEqualTypeOf<
|
||||
| [Partial<BlogDTO>, ...rest: any[]]
|
||||
| [Partial<BlogDTO>[], ...rest: any[]]
|
||||
>()
|
||||
expectTypeOf(blogService.createBlogs).returns.toEqualTypeOf<
|
||||
Promise<BlogDTO> | Promise<BlogDTO[]>
|
||||
>()
|
||||
})
|
||||
|
||||
test("type-hint force overridden properties", () => {
|
||||
class BlogService extends MedusaService<{ Blog: { dto: BlogDTO } }>({
|
||||
Blog,
|
||||
}) {
|
||||
// @ts-expect-error
|
||||
async createBlogs(_: CreateBlogDTO): Promise<BlogDTO> {
|
||||
return {} as BlogDTO
|
||||
}
|
||||
}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.createBlogs).parameters.toEqualTypeOf<
|
||||
[CreateBlogDTO]
|
||||
>()
|
||||
expectTypeOf(blogService.createBlogs).returns.toEqualTypeOf<
|
||||
Promise<BlogDTO>
|
||||
>()
|
||||
})
|
||||
|
||||
test("define custom DTO for inputs", () => {
|
||||
class BlogService extends MedusaService<{
|
||||
Blog: { dto: BlogDTO; inputDto: Omit<BlogDTO, "id"> }
|
||||
}>({
|
||||
Blog,
|
||||
}) {}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.createBlogs).parameters.toEqualTypeOf<
|
||||
| [Partial<{ title: string | undefined }>, ...rest: any[]]
|
||||
| [Partial<{ title: string | undefined }>[], ...rest: any[]]
|
||||
>()
|
||||
expectTypeOf(blogService.createBlogs).returns.toEqualTypeOf<
|
||||
Promise<BlogDTO> | Promise<BlogDTO[]>
|
||||
>()
|
||||
})
|
||||
})
|
||||
|
||||
describe("update<Service>", () => {
|
||||
test("type-hint model properties", () => {
|
||||
class BlogService extends MedusaService({ Blog }) {}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.updateBlogs).parameters.toEqualTypeOf<
|
||||
| [
|
||||
Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>,
|
||||
...rest: any[]
|
||||
]
|
||||
| [
|
||||
(
|
||||
| Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>[]
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data:
|
||||
| Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>
|
||||
| Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>[]
|
||||
}
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data:
|
||||
| Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>
|
||||
| Partial<{
|
||||
id: string | undefined
|
||||
title: string | undefined
|
||||
description: string | null | undefined
|
||||
}>[]
|
||||
}[]
|
||||
),
|
||||
...rest: any[]
|
||||
]
|
||||
>()
|
||||
expectTypeOf(blogService.updateBlogs).returns.toEqualTypeOf<
|
||||
Promise<InferTypeOf<typeof Blog>> | Promise<InferTypeOf<typeof Blog>[]>
|
||||
>()
|
||||
})
|
||||
|
||||
test("type-hint DTO properties", () => {
|
||||
class BlogService extends MedusaService<{ Blog: { dto: BlogDTO } }>({
|
||||
Blog,
|
||||
}) {}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.updateBlogs).parameters.toEqualTypeOf<
|
||||
| [Partial<BlogDTO>, ...rest: any[]]
|
||||
| [
|
||||
(
|
||||
| Partial<BlogDTO>[]
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data: Partial<BlogDTO> | Partial<BlogDTO>[]
|
||||
}
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data: Partial<BlogDTO> | Partial<BlogDTO>[]
|
||||
}[]
|
||||
),
|
||||
...rest: any[]
|
||||
]
|
||||
>()
|
||||
expectTypeOf(blogService.updateBlogs).returns.toEqualTypeOf<
|
||||
Promise<BlogDTO> | Promise<BlogDTO[]>
|
||||
>()
|
||||
})
|
||||
|
||||
test("type-hint force overridden properties", () => {
|
||||
class BlogService extends MedusaService<{ Blog: { dto: BlogDTO } }>({
|
||||
Blog,
|
||||
}) {
|
||||
// @ts-expect-error
|
||||
async updateBlogs(_: string, __: CreateBlogDTO): Promise<BlogDTO> {
|
||||
return {} as BlogDTO
|
||||
}
|
||||
}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.updateBlogs).parameters.toEqualTypeOf<
|
||||
[id: string, data: CreateBlogDTO]
|
||||
>()
|
||||
expectTypeOf(blogService.updateBlogs).returns.toEqualTypeOf<
|
||||
Promise<BlogDTO>
|
||||
>()
|
||||
})
|
||||
|
||||
test("define custom DTO for inputs", () => {
|
||||
class BlogService extends MedusaService<{
|
||||
Blog: { dto: BlogDTO; inputDto: Omit<BlogDTO, "id"> }
|
||||
}>({
|
||||
Blog,
|
||||
}) {}
|
||||
const blogService = new BlogService(containerMock)
|
||||
|
||||
expectTypeOf(blogService.updateBlogs).parameters.toEqualTypeOf<
|
||||
| [Partial<{ title: string | undefined }>, ...rest: any[]]
|
||||
| [
|
||||
(
|
||||
| Partial<{ title: string | undefined }>[]
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data:
|
||||
| Partial<{ title: string | undefined }>
|
||||
| Partial<{ title: string | undefined }>[]
|
||||
}
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data:
|
||||
| Partial<{ title: string | undefined }>
|
||||
| Partial<{ title: string | undefined }>[]
|
||||
}[]
|
||||
),
|
||||
...rest: any[]
|
||||
]
|
||||
>()
|
||||
expectTypeOf(blogService.createBlogs).returns.toEqualTypeOf<
|
||||
Promise<BlogDTO> | Promise<BlogDTO[]>
|
||||
>()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
IDmlEntity,
|
||||
InferEntityType,
|
||||
Pluralize,
|
||||
Prettify,
|
||||
RestoreReturn,
|
||||
SoftDeleteReturn,
|
||||
} from "@medusajs/types"
|
||||
@@ -29,6 +30,13 @@ export type ModelDTOConfig = {
|
||||
|
||||
export type ModelsConfigTemplate = { [key: string]: ModelDTOConfig }
|
||||
|
||||
/**
|
||||
* We do not want the DML DTO to accept auto-managed timestamps
|
||||
* as part of the input for the "create" and the "update"
|
||||
* methods
|
||||
*/
|
||||
type DMLDTOExcludeProperties = "created_at" | "updated_at" | "deleted_at"
|
||||
|
||||
export type ModelConfigurationsToConfigTemplate<T extends ModelEntries> = {
|
||||
[Key in keyof T]: {
|
||||
dto: T[Key] extends DmlEntity<any, any>
|
||||
@@ -36,6 +44,11 @@ export type ModelConfigurationsToConfigTemplate<T extends ModelEntries> = {
|
||||
: T[Key] extends Constructor<any>
|
||||
? InstanceType<T[Key]>
|
||||
: any
|
||||
inputDto: T[Key] extends DmlEntity<any, any>
|
||||
? Omit<InferEntityType<T[Key]>, DMLDTOExcludeProperties>
|
||||
: T[Key] extends Constructor<any>
|
||||
? InstanceType<T[Key]>
|
||||
: any
|
||||
model: T[Key] extends { model: infer MODEL }
|
||||
? MODEL
|
||||
: T[Key] extends IDmlEntity<any, any>
|
||||
@@ -83,6 +96,16 @@ export type ModelEntries<Keys = string> = Record<
|
||||
| { name?: string; singular?: string; plural?: string }
|
||||
>
|
||||
|
||||
/**
|
||||
* Returns the input DTO for the servide
|
||||
*/
|
||||
type GetServiceInput<ModelConfig extends { dto: any; inputDto?: any }> =
|
||||
Partial<
|
||||
[undefined] extends ModelConfig["inputDto"]
|
||||
? ModelConfig["dto"]
|
||||
: ModelConfig["inputDto"]
|
||||
>
|
||||
|
||||
export type ExtractKeysFromConfig<ModelsConfig> = ModelsConfig extends {
|
||||
__empty: any
|
||||
}
|
||||
@@ -90,7 +113,7 @@ export type ExtractKeysFromConfig<ModelsConfig> = ModelsConfig extends {
|
||||
: keyof ModelsConfig
|
||||
|
||||
export type AbstractModuleService<
|
||||
TModelsDtoConfig extends Record<string, any>
|
||||
TModelsDtoConfig extends Record<string, { dto: any; inputDto?: any }>
|
||||
> = {
|
||||
[TModelName in keyof TModelsDtoConfig as `retrieve${ExtractSingularName<
|
||||
TModelsDtoConfig,
|
||||
@@ -155,14 +178,41 @@ export type AbstractModuleService<
|
||||
TModelsDtoConfig,
|
||||
TModelName
|
||||
>}`]: {
|
||||
(...args: any[]): Promise<any>
|
||||
(
|
||||
data: Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>,
|
||||
...rest: any[]
|
||||
): Promise<TModelsDtoConfig[TModelName]["dto"]>
|
||||
(
|
||||
data: Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>[],
|
||||
...rest: any[]
|
||||
): Promise<TModelsDtoConfig[TModelName]["dto"][]>
|
||||
}
|
||||
} & {
|
||||
[TModelName in keyof TModelsDtoConfig as `update${ExtractPluralName<
|
||||
TModelsDtoConfig,
|
||||
TModelName
|
||||
>}`]: {
|
||||
(...args: any[]): Promise<any>
|
||||
(
|
||||
data: Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>,
|
||||
...rest: any[]
|
||||
): Promise<TModelsDtoConfig[TModelName]["dto"]>
|
||||
(
|
||||
dataOrOptions:
|
||||
| Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>[]
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data:
|
||||
| Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>
|
||||
| Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>[]
|
||||
}
|
||||
| {
|
||||
selector: Record<string, any>
|
||||
data:
|
||||
| Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>
|
||||
| Prettify<GetServiceInput<TModelsDtoConfig[TModelName]>>[]
|
||||
}[],
|
||||
...rest: any[]
|
||||
): Promise<TModelsDtoConfig[TModelName]["dto"][]>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ const eventBaseNames: [
|
||||
"product",
|
||||
"productVariant",
|
||||
"productOption",
|
||||
"productOptionValue",
|
||||
"productType",
|
||||
"productTag",
|
||||
"productCategory",
|
||||
@@ -13,10 +14,11 @@ const eventBaseNames: [
|
||||
"product",
|
||||
"productVariant",
|
||||
"productOption",
|
||||
"productOptionValue",
|
||||
"productType",
|
||||
"productTag",
|
||||
"productCategory",
|
||||
"productCollection"
|
||||
"productCollection",
|
||||
]
|
||||
|
||||
export const ProductEvents = buildEventNamesFromEntityName(
|
||||
|
||||
@@ -104,12 +104,14 @@ export class ApiKeyModuleService
|
||||
data: ApiKeyTypes.CreateApiKeyDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ApiKeyTypes.ApiKeyDTO[]>
|
||||
//@ts-expect-error
|
||||
createApiKeys(
|
||||
data: ApiKeyTypes.CreateApiKeyDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ApiKeyTypes.ApiKeyDTO>
|
||||
|
||||
@InjectManager()
|
||||
//@ts-expect-error
|
||||
async createApiKeys(
|
||||
data: ApiKeyTypes.CreateApiKeyDTO | ApiKeyTypes.CreateApiKeyDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -243,6 +245,7 @@ export class ApiKeyModuleService
|
||||
data: ApiKeyTypes.UpdateApiKeyDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ApiKeyTypes.ApiKeyDTO>
|
||||
//@ts-expect-error
|
||||
async updateApiKeys(
|
||||
selector: FilterableApiKeyProps,
|
||||
data: ApiKeyTypes.UpdateApiKeyDTO,
|
||||
@@ -250,6 +253,7 @@ export class ApiKeyModuleService
|
||||
): Promise<ApiKeyTypes.ApiKeyDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
//@ts-expect-error
|
||||
async updateApiKeys(
|
||||
idOrSelector: string | FilterableApiKeyProps,
|
||||
data: ApiKeyTypes.UpdateApiKeyDTO,
|
||||
|
||||
@@ -106,12 +106,14 @@ export default class AuthModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<AuthTypes.AuthIdentityDTO[]>
|
||||
|
||||
// @ts-expect-error
|
||||
updateAuthIdentities(
|
||||
data: AuthTypes.UpdateAuthIdentityDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<AuthTypes.AuthIdentityDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateAuthIdentities(
|
||||
data: AuthTypes.UpdateAuthIdentityDTO | AuthTypes.UpdateAuthIdentityDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -151,12 +153,14 @@ export default class AuthModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<AuthTypes.ProviderIdentityDTO[]>
|
||||
|
||||
// @ts-expect-error
|
||||
createProviderIdentities(
|
||||
data: AuthTypes.CreateProviderIdentityDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<AuthTypes.ProviderIdentityDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createProviderIdentities(
|
||||
data:
|
||||
| AuthTypes.CreateProviderIdentityDTO[]
|
||||
@@ -179,12 +183,14 @@ export default class AuthModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<AuthTypes.ProviderIdentityDTO[]>
|
||||
|
||||
// @ts-expect-error
|
||||
updateProviderIdentities(
|
||||
data: AuthTypes.UpdateProviderIdentityDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<AuthTypes.ProviderIdentityDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateProviderIdentities(
|
||||
data:
|
||||
| AuthTypes.UpdateProviderIdentityDTO
|
||||
|
||||
@@ -258,12 +258,14 @@ export default class CartModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartDTO[]>
|
||||
|
||||
// @ts-expect-error
|
||||
async createCarts(
|
||||
data: CartTypes.CreateCartDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createCarts(
|
||||
data: CartTypes.CreateCartDTO[] | CartTypes.CreateCartDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -320,11 +322,13 @@ export default class CartModuleService
|
||||
async updateCarts(
|
||||
data: CartTypes.UpdateCartDTO[]
|
||||
): Promise<CartTypes.CartDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateCarts(
|
||||
cartId: string,
|
||||
data: CartTypes.UpdateCartDataDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartDTO>
|
||||
// @ts-expect-error
|
||||
async updateCarts(
|
||||
selector: Partial<CartTypes.CartDTO>,
|
||||
data: CartTypes.UpdateCartDataDTO,
|
||||
@@ -332,6 +336,7 @@ export default class CartModuleService
|
||||
): Promise<CartTypes.CartDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateCarts(
|
||||
dataOrIdOrSelector:
|
||||
| CartTypes.UpdateCartDTO[]
|
||||
@@ -393,6 +398,18 @@ export default class CartModuleService
|
||||
return result
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateShippingMethods(
|
||||
data: CartTypes.UpdateShippingMethodDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartShippingMethodDTO[]> {
|
||||
return super.updateShippingMethods(
|
||||
data as unknown as CartTypes.CartShippingMethodDTO[],
|
||||
sharedContext
|
||||
) as unknown as Promise<CartTypes.CartShippingMethodDTO[]>
|
||||
}
|
||||
|
||||
addLineItems(
|
||||
data: CartTypes.CreateLineItemForCartDTO
|
||||
): Promise<CartTypes.CartLineItemDTO[]>
|
||||
@@ -468,11 +485,13 @@ export default class CartModuleService
|
||||
updateLineItems(
|
||||
data: CartTypes.UpdateLineItemWithSelectorDTO[]
|
||||
): Promise<CartTypes.CartLineItemDTO[]>
|
||||
// @ts-expect-error
|
||||
updateLineItems(
|
||||
selector: Partial<CartTypes.CartLineItemDTO>,
|
||||
data: CartTypes.UpdateLineItemDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartLineItemDTO[]>
|
||||
// @ts-expect-error
|
||||
updateLineItems(
|
||||
lineItemId: string,
|
||||
data: Partial<CartTypes.UpdateLineItemDTO>,
|
||||
@@ -480,6 +499,7 @@ export default class CartModuleService
|
||||
): Promise<CartTypes.CartLineItemDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateLineItems(
|
||||
lineItemIdOrDataOrSelector:
|
||||
| string
|
||||
@@ -562,12 +582,14 @@ export default class CartModuleService
|
||||
data: CartTypes.CreateAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartAddressDTO>
|
||||
// @ts-expect-error
|
||||
async createAddresses(
|
||||
data: CartTypes.CreateAddressDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartAddressDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createAddresses(
|
||||
data: CartTypes.CreateAddressDTO[] | CartTypes.CreateAddressDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -599,12 +621,14 @@ export default class CartModuleService
|
||||
data: CartTypes.UpdateAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartAddressDTO>
|
||||
// @ts-expect-error
|
||||
async updateAddresses(
|
||||
data: CartTypes.UpdateAddressDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<CartTypes.CartAddressDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateAddresses(
|
||||
data: CartTypes.UpdateAddressDTO[] | CartTypes.UpdateAddressDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
|
||||
@@ -162,11 +162,13 @@ export default class CustomerModuleService
|
||||
data: CustomerTypes.CustomerUpdatableFields,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerDTO>
|
||||
// @ts-expect-error
|
||||
updateCustomers(
|
||||
customerIds: string[],
|
||||
data: CustomerTypes.CustomerUpdatableFields,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerDTO[]>
|
||||
// @ts-expect-error
|
||||
updateCustomers(
|
||||
selector: CustomerTypes.FilterableCustomerProps,
|
||||
data: CustomerTypes.CustomerUpdatableFields,
|
||||
@@ -174,6 +176,7 @@ export default class CustomerModuleService
|
||||
): Promise<CustomerTypes.CustomerDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async updateCustomers(
|
||||
idsOrSelector: string | string[] | CustomerTypes.FilterableCustomerProps,
|
||||
data: CustomerTypes.CustomerUpdatableFields,
|
||||
@@ -224,12 +227,14 @@ export default class CustomerModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerGroupDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createCustomerGroups(
|
||||
dataOrArrayOfData: CustomerTypes.CreateCustomerGroupDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerGroupDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createCustomerGroups(
|
||||
dataOrArrayOfData:
|
||||
| CustomerTypes.CreateCustomerGroupDTO
|
||||
@@ -254,11 +259,13 @@ export default class CustomerModuleService
|
||||
data: CustomerTypes.CustomerGroupUpdatableFields,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerGroupDTO>
|
||||
// @ts-expect-error
|
||||
async updateCustomerGroups(
|
||||
groupIds: string[],
|
||||
data: CustomerTypes.CustomerGroupUpdatableFields,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerGroupDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateCustomerGroups(
|
||||
selector: CustomerTypes.FilterableCustomerGroupProps,
|
||||
data: CustomerTypes.CustomerGroupUpdatableFields,
|
||||
@@ -266,6 +273,7 @@ export default class CustomerModuleService
|
||||
): Promise<CustomerTypes.CustomerGroupDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async updateCustomerGroups(
|
||||
groupIdOrSelector:
|
||||
| string
|
||||
@@ -350,12 +358,14 @@ export default class CustomerModuleService
|
||||
addresses: CustomerTypes.CreateCustomerAddressDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerAddressDTO[]>
|
||||
// @ts-expect-error
|
||||
async createCustomerAddresses(
|
||||
address: CustomerTypes.CreateCustomerAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerAddressDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createCustomerAddresses(
|
||||
data:
|
||||
| CustomerTypes.CreateCustomerAddressDTO
|
||||
@@ -396,11 +406,13 @@ export default class CustomerModuleService
|
||||
data: CustomerTypes.UpdateCustomerAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerAddressDTO>
|
||||
// @ts-expect-error
|
||||
async updateCustomerAddresses(
|
||||
addressIds: string[],
|
||||
data: CustomerTypes.UpdateCustomerAddressDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<CustomerTypes.CustomerAddressDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateCustomerAddresses(
|
||||
selector: CustomerTypes.FilterableCustomerAddressProps,
|
||||
data: CustomerTypes.UpdateCustomerAddressDTO,
|
||||
@@ -408,6 +420,7 @@ export default class CustomerModuleService
|
||||
): Promise<CustomerTypes.CustomerAddressDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async updateCustomerAddresses(
|
||||
addressIdOrSelector:
|
||||
| string
|
||||
|
||||
@@ -279,6 +279,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.CreateFulfillmentSetDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.FulfillmentSetDTO[]>
|
||||
// @ts-expect-error
|
||||
createFulfillmentSets(
|
||||
data: FulfillmentTypes.CreateFulfillmentSetDTO,
|
||||
sharedContext?: Context
|
||||
@@ -286,6 +287,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createFulfillmentSets(
|
||||
data:
|
||||
| FulfillmentTypes.CreateFulfillmentSetDTO
|
||||
@@ -349,6 +351,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.CreateServiceZoneDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ServiceZoneDTO[]>
|
||||
// @ts-expect-error
|
||||
createServiceZones(
|
||||
data: FulfillmentTypes.CreateServiceZoneDTO,
|
||||
sharedContext?: Context
|
||||
@@ -356,6 +359,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createServiceZones(
|
||||
data:
|
||||
| FulfillmentTypes.CreateServiceZoneDTO[]
|
||||
@@ -413,6 +417,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.CreateShippingOptionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ShippingOptionDTO[]>
|
||||
// @ts-expect-error
|
||||
createShippingOptions(
|
||||
data: FulfillmentTypes.CreateShippingOptionDTO,
|
||||
sharedContext?: Context
|
||||
@@ -420,6 +425,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createShippingOptions(
|
||||
data:
|
||||
| FulfillmentTypes.CreateShippingOptionDTO[]
|
||||
@@ -474,6 +480,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.CreateShippingProfileDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ShippingProfileDTO[]>
|
||||
// @ts-expect-error
|
||||
createShippingProfiles(
|
||||
data: FulfillmentTypes.CreateShippingProfileDTO,
|
||||
sharedContext?: Context
|
||||
@@ -481,6 +488,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectTransactionManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createShippingProfiles(
|
||||
data:
|
||||
| FulfillmentTypes.CreateShippingProfileDTO[]
|
||||
@@ -523,11 +531,12 @@ export default class FulfillmentModuleService
|
||||
return await this.shippingProfileService_.create(data_, sharedContext)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createGeoZones(
|
||||
data: FulfillmentTypes.CreateGeoZoneDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.GeoZoneDTO[]>
|
||||
// @ts-expect-error
|
||||
createGeoZones(
|
||||
data: FulfillmentTypes.CreateGeoZoneDTO,
|
||||
sharedContext?: Context
|
||||
@@ -535,6 +544,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createGeoZones(
|
||||
data:
|
||||
| FulfillmentTypes.CreateGeoZoneDTO
|
||||
@@ -560,11 +570,12 @@ export default class FulfillmentModuleService
|
||||
)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async createShippingOptionRules(
|
||||
data: FulfillmentTypes.CreateShippingOptionRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ShippingOptionRuleDTO[]>
|
||||
// @ts-expect-error
|
||||
async createShippingOptionRules(
|
||||
data: FulfillmentTypes.CreateShippingOptionRuleDTO,
|
||||
sharedContext?: Context
|
||||
@@ -572,6 +583,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createShippingOptionRules(
|
||||
data:
|
||||
| FulfillmentTypes.CreateShippingOptionRuleDTO[]
|
||||
@@ -756,6 +768,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.UpdateFulfillmentSetDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.FulfillmentSetDTO[]>
|
||||
// @ts-expect-error
|
||||
updateFulfillmentSets(
|
||||
data: FulfillmentTypes.UpdateFulfillmentSetDTO,
|
||||
sharedContext?: Context
|
||||
@@ -763,6 +776,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateFulfillmentSets(
|
||||
data: UpdateFulfillmentSetDTO[] | UpdateFulfillmentSetDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -995,6 +1009,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.UpdateServiceZoneDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ServiceZoneDTO>
|
||||
// @ts-expect-error
|
||||
updateServiceZones(
|
||||
selector: FulfillmentTypes.FilterableServiceZoneProps,
|
||||
data: FulfillmentTypes.UpdateServiceZoneDTO,
|
||||
@@ -1003,6 +1018,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateServiceZones(
|
||||
idOrSelector: string | FulfillmentTypes.FilterableServiceZoneProps,
|
||||
data: FulfillmentTypes.UpdateServiceZoneDTO,
|
||||
@@ -1299,6 +1315,7 @@ export default class FulfillmentModuleService
|
||||
data: FulfillmentTypes.UpdateShippingOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ShippingOptionDTO>
|
||||
// @ts-expect-error
|
||||
updateShippingOptions(
|
||||
selector: FulfillmentTypes.FilterableShippingOptionProps,
|
||||
data: FulfillmentTypes.UpdateShippingOptionDTO,
|
||||
@@ -1307,6 +1324,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateShippingOptions(
|
||||
idOrSelector: string | FulfillmentTypes.FilterableShippingOptionProps,
|
||||
data: FulfillmentTypes.UpdateShippingOptionDTO,
|
||||
@@ -1624,12 +1642,13 @@ export default class FulfillmentModuleService
|
||||
return [...created, ...updated]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateShippingProfiles(
|
||||
selector: FulfillmentTypes.FilterableShippingProfileProps,
|
||||
data: FulfillmentTypes.UpdateShippingProfileDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ShippingProfileDTO[]>
|
||||
// @ts-expect-error
|
||||
updateShippingProfiles(
|
||||
id: string,
|
||||
data: FulfillmentTypes.UpdateShippingProfileDTO,
|
||||
@@ -1637,6 +1656,7 @@ export default class FulfillmentModuleService
|
||||
): Promise<FulfillmentTypes.ShippingProfileDTO>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async updateShippingProfiles(
|
||||
idOrSelector: string | FulfillmentTypes.FilterableShippingProfileProps,
|
||||
data: FulfillmentTypes.UpdateShippingProfileDTO,
|
||||
@@ -1728,11 +1748,12 @@ export default class FulfillmentModuleService
|
||||
return Array.isArray(data) ? allProfiles : allProfiles[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateGeoZones(
|
||||
data: FulfillmentTypes.UpdateGeoZoneDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.GeoZoneDTO[]>
|
||||
// @ts-expect-error
|
||||
updateGeoZones(
|
||||
data: FulfillmentTypes.UpdateGeoZoneDTO,
|
||||
sharedContext?: Context
|
||||
@@ -1740,6 +1761,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateGeoZones(
|
||||
data:
|
||||
| FulfillmentTypes.UpdateGeoZoneDTO
|
||||
@@ -1771,11 +1793,12 @@ export default class FulfillmentModuleService
|
||||
return Array.isArray(data) ? serialized : serialized[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateShippingOptionRules(
|
||||
data: FulfillmentTypes.UpdateShippingOptionRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<FulfillmentTypes.ShippingOptionRuleDTO[]>
|
||||
// @ts-expect-error
|
||||
updateShippingOptionRules(
|
||||
data: FulfillmentTypes.UpdateShippingOptionRuleDTO,
|
||||
sharedContext?: Context
|
||||
@@ -1783,6 +1806,7 @@ export default class FulfillmentModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateShippingOptionRules(
|
||||
data:
|
||||
| FulfillmentTypes.UpdateShippingOptionRuleDTO[]
|
||||
|
||||
@@ -222,11 +222,12 @@ export default class InventoryModuleService
|
||||
})
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async createReservationItems(
|
||||
input: InventoryTypes.CreateReservationItemInput[],
|
||||
context?: Context
|
||||
): Promise<InventoryTypes.ReservationItemDTO[]>
|
||||
// @ts-expect-error
|
||||
async createReservationItems(
|
||||
input: InventoryTypes.CreateReservationItemInput,
|
||||
context?: Context
|
||||
@@ -234,6 +235,7 @@ export default class InventoryModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createReservationItems(
|
||||
input:
|
||||
| InventoryTypes.CreateReservationItemInput[]
|
||||
@@ -380,6 +382,7 @@ export default class InventoryModuleService
|
||||
input: InventoryTypes.CreateInventoryLevelInput,
|
||||
context?: Context
|
||||
): Promise<InventoryTypes.InventoryLevelDTO>
|
||||
// @ts-expect-error
|
||||
createInventoryLevels(
|
||||
input: InventoryTypes.CreateInventoryLevelInput[],
|
||||
context?: Context
|
||||
@@ -387,6 +390,7 @@ export default class InventoryModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createInventoryLevels(
|
||||
input:
|
||||
| InventoryTypes.CreateInventoryLevelInput[]
|
||||
@@ -434,6 +438,7 @@ export default class InventoryModuleService
|
||||
input: InventoryTypes.UpdateInventoryItemInput[],
|
||||
context?: Context
|
||||
): Promise<InventoryTypes.InventoryItemDTO[]>
|
||||
// @ts-expect-error
|
||||
updateInventoryItems(
|
||||
input: InventoryTypes.UpdateInventoryItemInput,
|
||||
context?: Context
|
||||
@@ -441,6 +446,7 @@ export default class InventoryModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateInventoryItems(
|
||||
input:
|
||||
| InventoryTypes.UpdateInventoryItemInput
|
||||
@@ -549,6 +555,7 @@ export default class InventoryModuleService
|
||||
updates: InventoryTypes.UpdateInventoryLevelInput[],
|
||||
context?: Context
|
||||
): Promise<InventoryTypes.InventoryLevelDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateInventoryLevels(
|
||||
updates: InventoryTypes.UpdateInventoryLevelInput,
|
||||
context?: Context
|
||||
@@ -556,6 +563,7 @@ export default class InventoryModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateInventoryLevels(
|
||||
updates:
|
||||
| InventoryTypes.UpdateInventoryLevelInput[]
|
||||
@@ -628,11 +636,12 @@ export default class InventoryModuleService
|
||||
* @param context
|
||||
* @return The updated inventory level
|
||||
*/
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async updateReservationItems(
|
||||
input: InventoryTypes.UpdateReservationItemInput[],
|
||||
context?: Context
|
||||
): Promise<InventoryTypes.ReservationItemDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateReservationItems(
|
||||
input: InventoryTypes.UpdateReservationItemInput,
|
||||
context?: Context
|
||||
@@ -640,6 +649,7 @@ export default class InventoryModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateReservationItems(
|
||||
input:
|
||||
| InventoryTypes.UpdateReservationItemInput
|
||||
|
||||
@@ -63,6 +63,7 @@ export default class NotificationModuleService
|
||||
data: NotificationTypes.CreateNotificationDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<NotificationTypes.NotificationDTO[]>
|
||||
// @ts-expect-error
|
||||
createNotifications(
|
||||
data: NotificationTypes.CreateNotificationDTO,
|
||||
sharedContext?: Context
|
||||
@@ -70,6 +71,7 @@ export default class NotificationModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createNotifications(
|
||||
data:
|
||||
| NotificationTypes.CreateNotificationDTO
|
||||
|
||||
@@ -663,13 +663,14 @@ export default class OrderModuleService
|
||||
data: OrderTypes.CreateOrderDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderDTO[]>
|
||||
|
||||
// @ts-expect-error
|
||||
async createOrders(
|
||||
data: OrderTypes.CreateOrderDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createOrders(
|
||||
data: OrderTypes.CreateOrderDTO[] | OrderTypes.CreateOrderDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -814,11 +815,13 @@ export default class OrderModuleService
|
||||
async updateOrders(
|
||||
data: OrderTypes.UpdateOrderDTO[]
|
||||
): Promise<OrderTypes.OrderDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateOrders(
|
||||
orderId: string,
|
||||
data: OrderTypes.UpdateOrderDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderDTO>
|
||||
// @ts-expect-error
|
||||
async updateOrders(
|
||||
selector: Partial<OrderTypes.FilterableOrderProps>,
|
||||
data: OrderTypes.UpdateOrderDTO,
|
||||
@@ -826,6 +829,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateOrders(
|
||||
dataOrIdOrSelector:
|
||||
| OrderTypes.UpdateOrderDTO[]
|
||||
@@ -891,9 +895,11 @@ export default class OrderModuleService
|
||||
createOrderLineItems(
|
||||
data: OrderTypes.CreateOrderLineItemForOrderDTO
|
||||
): Promise<OrderTypes.OrderLineItemDTO[]>
|
||||
// @ts-expect-error
|
||||
createOrderLineItems(
|
||||
data: OrderTypes.CreateOrderLineItemForOrderDTO[]
|
||||
): Promise<OrderTypes.OrderLineItemDTO[]>
|
||||
// @ts-expect-error
|
||||
createOrderLineItems(
|
||||
orderId: string,
|
||||
items: OrderTypes.CreateOrderLineItemDTO[],
|
||||
@@ -901,6 +907,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderLineItemDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createOrderLineItems(
|
||||
orderIdOrData:
|
||||
| string
|
||||
@@ -1012,11 +1019,13 @@ export default class OrderModuleService
|
||||
updateOrderLineItems(
|
||||
data: OrderTypes.UpdateOrderLineItemWithSelectorDTO[]
|
||||
): Promise<OrderTypes.OrderLineItemDTO[]>
|
||||
// @ts-expect-error
|
||||
updateOrderLineItems(
|
||||
selector: Partial<OrderTypes.FilterableOrderLineItemProps>,
|
||||
data: OrderTypes.UpdateOrderLineItemDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderLineItemDTO[]>
|
||||
// @ts-expect-error
|
||||
updateOrderLineItems(
|
||||
lineItemId: string,
|
||||
data: Partial<OrderTypes.UpdateOrderLineItemDTO>,
|
||||
@@ -1024,6 +1033,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderLineItemDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateOrderLineItems(
|
||||
lineItemIdOrDataOrSelector:
|
||||
| string
|
||||
@@ -1229,13 +1239,15 @@ export default class OrderModuleService
|
||||
return await this.orderItemService_.update(toUpdate, sharedContext)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethods(
|
||||
data: OrderTypes.CreateOrderShippingMethodDTO
|
||||
): Promise<OrderTypes.OrderShippingMethodDTO>
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethods(
|
||||
data: OrderTypes.CreateOrderShippingMethodDTO[]
|
||||
): Promise<OrderTypes.OrderShippingMethodDTO[]>
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethods(
|
||||
orderId: string,
|
||||
methods: OrderTypes.CreateOrderShippingMethodDTO[],
|
||||
@@ -1243,6 +1255,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderShippingMethodDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethods(
|
||||
orderIdOrData:
|
||||
| string
|
||||
@@ -1394,9 +1407,11 @@ export default class OrderModuleService
|
||||
async createOrderLineItemAdjustments(
|
||||
adjustments: OrderTypes.CreateOrderLineItemAdjustmentDTO[]
|
||||
): Promise<OrderTypes.OrderLineItemAdjustmentDTO[]>
|
||||
// @ts-expect-error
|
||||
async createOrderLineItemAdjustments(
|
||||
adjustment: OrderTypes.CreateOrderLineItemAdjustmentDTO
|
||||
): Promise<OrderTypes.OrderLineItemAdjustmentDTO[]>
|
||||
// @ts-expect-error
|
||||
async createOrderLineItemAdjustments(
|
||||
orderId: string,
|
||||
adjustments: OrderTypes.CreateOrderLineItemAdjustmentDTO[],
|
||||
@@ -1404,6 +1419,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderLineItemAdjustmentDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createOrderLineItemAdjustments(
|
||||
orderIdOrData:
|
||||
| string
|
||||
@@ -1564,9 +1580,11 @@ export default class OrderModuleService
|
||||
async createOrderShippingMethodAdjustments(
|
||||
adjustments: OrderTypes.CreateOrderShippingMethodAdjustmentDTO[]
|
||||
): Promise<OrderTypes.OrderShippingMethodAdjustmentDTO[]>
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethodAdjustments(
|
||||
adjustment: OrderTypes.CreateOrderShippingMethodAdjustmentDTO
|
||||
): Promise<OrderTypes.OrderShippingMethodAdjustmentDTO>
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethodAdjustments(
|
||||
orderId: string,
|
||||
adjustments: OrderTypes.CreateOrderShippingMethodAdjustmentDTO[],
|
||||
@@ -1574,6 +1592,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderShippingMethodAdjustmentDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethodAdjustments(
|
||||
orderIdOrData:
|
||||
| string
|
||||
@@ -1643,9 +1662,11 @@ export default class OrderModuleService
|
||||
createOrderLineItemTaxLines(
|
||||
taxLines: OrderTypes.CreateOrderLineItemTaxLineDTO[]
|
||||
): Promise<OrderTypes.OrderLineItemTaxLineDTO[]>
|
||||
// @ts-expect-error
|
||||
createOrderLineItemTaxLines(
|
||||
taxLine: OrderTypes.CreateOrderLineItemTaxLineDTO
|
||||
): Promise<OrderTypes.OrderLineItemTaxLineDTO>
|
||||
// @ts-expect-error
|
||||
createOrderLineItemTaxLines(
|
||||
orderId: string,
|
||||
taxLines:
|
||||
@@ -1655,6 +1676,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderLineItemTaxLineDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createOrderLineItemTaxLines(
|
||||
orderIdOrData:
|
||||
| string
|
||||
@@ -1754,9 +1776,11 @@ export default class OrderModuleService
|
||||
createOrderShippingMethodTaxLines(
|
||||
taxLines: OrderTypes.CreateOrderShippingMethodTaxLineDTO[]
|
||||
): Promise<OrderTypes.OrderShippingMethodTaxLineDTO[]>
|
||||
// @ts-expect-error
|
||||
createOrderShippingMethodTaxLines(
|
||||
taxLine: OrderTypes.CreateOrderShippingMethodTaxLineDTO
|
||||
): Promise<OrderTypes.OrderShippingMethodTaxLineDTO>
|
||||
// @ts-expect-error
|
||||
createOrderShippingMethodTaxLines(
|
||||
orderId: string,
|
||||
taxLines:
|
||||
@@ -1766,6 +1790,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderTypes.OrderShippingMethodTaxLineDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createOrderShippingMethodTaxLines(
|
||||
orderIdOrData:
|
||||
| string
|
||||
@@ -1870,12 +1895,14 @@ export default class OrderModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.ReturnDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createReturns(
|
||||
data: OrderTypes.CreateOrderReturnDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.ReturnDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createReturns(
|
||||
data: OrderTypes.CreateOrderReturnDTO | OrderTypes.CreateOrderReturnDTO[],
|
||||
@MedusaContext() sharedContext?: Context
|
||||
@@ -1900,12 +1927,14 @@ export default class OrderModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderClaimDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createOrderClaims(
|
||||
data: OrderTypes.CreateOrderClaimDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderClaimDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createOrderClaims(
|
||||
data: OrderTypes.CreateOrderClaimDTO | OrderTypes.CreateOrderClaimDTO[],
|
||||
@MedusaContext() sharedContext?: Context
|
||||
@@ -1930,12 +1959,14 @@ export default class OrderModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderExchangeDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createOrderExchanges(
|
||||
data: OrderTypes.CreateOrderExchangeDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderExchangeDTO[]>
|
||||
|
||||
@InjectTransactionManager()
|
||||
// @ts-expect-error
|
||||
async createOrderExchanges(
|
||||
data:
|
||||
| OrderTypes.CreateOrderExchangeDTO
|
||||
@@ -3537,12 +3568,13 @@ export default class OrderModuleService
|
||||
)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateReturnReasons(
|
||||
id: string,
|
||||
data: UpdateOrderReturnReasonDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderReturnReasonDTO>
|
||||
// @ts-expect-error
|
||||
updateReturnReasons(
|
||||
selector: FilterableOrderReturnReasonProps,
|
||||
data: Partial<UpdateOrderReturnReasonDTO>,
|
||||
@@ -3550,6 +3582,7 @@ export default class OrderModuleService
|
||||
): Promise<OrderReturnReasonDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateReturnReasons(
|
||||
idOrSelector: string | FilterableOrderReturnReasonProps,
|
||||
data: UpdateOrderReturnReasonDTO,
|
||||
@@ -3652,4 +3685,16 @@ export default class OrderModuleService
|
||||
): Promise<void> {
|
||||
return await BundledActions.registerDelivery.bind(this)(data, sharedContext)
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createReturnItems(
|
||||
data: OrderTypes.CreateOrderReturnItemDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<OrderTypes.OrderReturnItemDTO> {
|
||||
return super.createReturnItems(
|
||||
data as unknown as OrderTypes.OrderReturnItemDTO,
|
||||
sharedContext
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,17 +151,20 @@ export default class PaymentModuleService
|
||||
return joinerConfig
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createPaymentCollections(
|
||||
data: CreatePaymentCollectionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<PaymentCollectionDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
createPaymentCollections(
|
||||
data: CreatePaymentCollectionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PaymentCollectionDTO[]>
|
||||
@InjectManager()
|
||||
|
||||
// @ts-expect-error
|
||||
async createPaymentCollections(
|
||||
data: CreatePaymentCollectionDTO | CreatePaymentCollectionDTO[],
|
||||
@MedusaContext() sharedContext?: Context
|
||||
@@ -189,12 +192,13 @@ export default class PaymentModuleService
|
||||
return await this.paymentCollectionService_.create(data, sharedContext)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updatePaymentCollections(
|
||||
paymentCollectionId: string,
|
||||
data: PaymentCollectionUpdatableFields,
|
||||
sharedContext?: Context
|
||||
): Promise<PaymentCollectionDTO>
|
||||
// @ts-expect-error
|
||||
updatePaymentCollections(
|
||||
selector: FilterablePaymentCollectionProps,
|
||||
data: PaymentCollectionUpdatableFields,
|
||||
@@ -202,6 +206,7 @@ export default class PaymentModuleService
|
||||
): Promise<PaymentCollectionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updatePaymentCollections(
|
||||
idOrSelector: string | FilterablePaymentCollectionProps,
|
||||
data: PaymentCollectionUpdatableFields,
|
||||
|
||||
@@ -427,6 +427,7 @@ export default class PricingModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<PriceSetDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createPriceSets(
|
||||
data: PricingTypes.CreatePriceSetDTO[],
|
||||
sharedContext?: Context
|
||||
@@ -434,6 +435,7 @@ export default class PricingModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createPriceSets(
|
||||
data: PricingTypes.CreatePriceSetDTO | PricingTypes.CreatePriceSetDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -503,6 +505,7 @@ export default class PricingModuleService
|
||||
data: PricingTypes.UpdatePriceSetDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<PriceSetDTO>
|
||||
// @ts-expect-error
|
||||
async updatePriceSets(
|
||||
selector: PricingTypes.FilterablePriceSetProps,
|
||||
data: PricingTypes.UpdatePriceSetDTO,
|
||||
@@ -510,6 +513,7 @@ export default class PricingModuleService
|
||||
): Promise<PriceSetDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updatePriceSets(
|
||||
idOrSelector: string | PricingTypes.FilterablePriceSetProps,
|
||||
data: PricingTypes.UpdatePriceSetDTO,
|
||||
@@ -885,6 +889,7 @@ export default class PricingModuleService
|
||||
data: PricingTypes.UpdatePricePreferenceDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<PricePreferenceDTO>
|
||||
// @ts-expect-error
|
||||
async updatePricePreferences(
|
||||
selector: PricingTypes.FilterablePricePreferenceProps,
|
||||
data: PricingTypes.UpdatePricePreferenceDTO,
|
||||
@@ -892,6 +897,7 @@ export default class PricingModuleService
|
||||
): Promise<PricePreferenceDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updatePricePreferences(
|
||||
idOrSelector: string | PricingTypes.FilterablePricePreferenceProps,
|
||||
data: PricingTypes.UpdatePricePreferenceDTO,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Context,
|
||||
DAL,
|
||||
FilterableProductOptionValueProps,
|
||||
FindConfig,
|
||||
IEventBusModuleService,
|
||||
InferEntityType,
|
||||
@@ -242,11 +243,12 @@ export default class ProductModuleService
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createProductVariants(
|
||||
data: ProductTypes.CreateProductVariantDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductVariantDTO[]>
|
||||
// @ts-expect-error
|
||||
createProductVariants(
|
||||
data: ProductTypes.CreateProductVariantDTO,
|
||||
sharedContext?: Context
|
||||
@@ -254,6 +256,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createProductVariants(
|
||||
data:
|
||||
| ProductTypes.CreateProductVariantDTO[]
|
||||
@@ -371,12 +374,13 @@ export default class ProductModuleService
|
||||
return Array.isArray(data) ? allVariants : allVariants[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateProductVariants(
|
||||
id: string,
|
||||
data: ProductTypes.UpdateProductVariantDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductVariantDTO>
|
||||
// @ts-expect-error
|
||||
updateProductVariants(
|
||||
selector: ProductTypes.FilterableProductVariantProps,
|
||||
data: ProductTypes.UpdateProductVariantDTO,
|
||||
@@ -385,6 +389,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateProductVariants(
|
||||
idOrSelector: string | ProductTypes.FilterableProductVariantProps,
|
||||
data: ProductTypes.UpdateProductVariantDTO,
|
||||
@@ -503,11 +508,12 @@ export default class ProductModuleService
|
||||
return productVariants
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createProductTags(
|
||||
data: ProductTypes.CreateProductTagDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductTagDTO[]>
|
||||
// @ts-expect-error
|
||||
createProductTags(
|
||||
data: ProductTypes.CreateProductTagDTO,
|
||||
sharedContext?: Context
|
||||
@@ -515,6 +521,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createProductTags(
|
||||
data: ProductTypes.CreateProductTagDTO[] | ProductTypes.CreateProductTagDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -582,12 +589,13 @@ export default class ProductModuleService
|
||||
return Array.isArray(data) ? allTags : allTags[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateProductTags(
|
||||
id: string,
|
||||
data: ProductTypes.UpdateProductTagDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductTagDTO>
|
||||
// @ts-expect-error
|
||||
updateProductTags(
|
||||
selector: ProductTypes.FilterableProductTagProps,
|
||||
data: ProductTypes.UpdateProductTagDTO,
|
||||
@@ -596,6 +604,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateProductTags(
|
||||
idOrSelector: string | ProductTypes.FilterableProductTagProps,
|
||||
data: ProductTypes.UpdateProductTagDTO,
|
||||
@@ -636,17 +645,19 @@ export default class ProductModuleService
|
||||
return isString(idOrSelector) ? updatedTags[0] : updatedTags
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createProductTypes(
|
||||
data: ProductTypes.CreateProductTypeDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductTypeDTO[]>
|
||||
// @ts-expect-error
|
||||
createProductTypes(
|
||||
data: ProductTypes.CreateProductTypeDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductTypeDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createProductTypes(
|
||||
data:
|
||||
| ProductTypes.CreateProductTypeDTO[]
|
||||
@@ -704,12 +715,13 @@ export default class ProductModuleService
|
||||
return Array.isArray(data) ? allTypes : allTypes[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateProductTypes(
|
||||
id: string,
|
||||
data: ProductTypes.UpdateProductTypeDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductTypeDTO>
|
||||
// @ts-expect-error
|
||||
updateProductTypes(
|
||||
selector: ProductTypes.FilterableProductTypeProps,
|
||||
data: ProductTypes.UpdateProductTypeDTO,
|
||||
@@ -717,6 +729,7 @@ export default class ProductModuleService
|
||||
): Promise<ProductTypes.ProductTypeDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateProductTypes(
|
||||
idOrSelector: string | ProductTypes.FilterableProductTypeProps,
|
||||
data: ProductTypes.UpdateProductTypeDTO,
|
||||
@@ -752,17 +765,19 @@ export default class ProductModuleService
|
||||
return isString(idOrSelector) ? updatedTypes[0] : updatedTypes
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createProductOptions(
|
||||
data: ProductTypes.CreateProductOptionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductOptionDTO[]>
|
||||
// @ts-expect-error
|
||||
createProductOptions(
|
||||
data: ProductTypes.CreateProductOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductOptionDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createProductOptions(
|
||||
data:
|
||||
| ProductTypes.CreateProductOptionDTO[]
|
||||
@@ -849,12 +864,13 @@ export default class ProductModuleService
|
||||
return Array.isArray(data) ? allOptions : allOptions[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateProductOptions(
|
||||
id: string,
|
||||
data: ProductTypes.UpdateProductOptionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductOptionDTO>
|
||||
// @ts-expect-error
|
||||
updateProductOptions(
|
||||
selector: ProductTypes.FilterableProductOptionProps,
|
||||
data: ProductTypes.UpdateProductOptionDTO,
|
||||
@@ -862,6 +878,7 @@ export default class ProductModuleService
|
||||
): Promise<ProductTypes.ProductOptionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateProductOptions(
|
||||
idOrSelector: string | ProductTypes.FilterableProductOptionProps,
|
||||
data: ProductTypes.UpdateProductOptionDTO,
|
||||
@@ -966,11 +983,12 @@ export default class ProductModuleService
|
||||
return productOptions
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createProductCollections(
|
||||
data: ProductTypes.CreateProductCollectionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductCollectionDTO[]>
|
||||
// @ts-expect-error
|
||||
createProductCollections(
|
||||
data: ProductTypes.CreateProductCollectionDTO,
|
||||
sharedContext?: Context
|
||||
@@ -978,6 +996,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createProductCollections(
|
||||
data:
|
||||
| ProductTypes.CreateProductCollectionDTO[]
|
||||
@@ -1084,12 +1103,13 @@ export default class ProductModuleService
|
||||
return Array.isArray(data) ? allCollections : allCollections[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateProductCollections(
|
||||
id: string,
|
||||
data: ProductTypes.UpdateProductCollectionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductCollectionDTO>
|
||||
// @ts-expect-error
|
||||
updateProductCollections(
|
||||
selector: ProductTypes.FilterableProductCollectionProps,
|
||||
data: ProductTypes.UpdateProductCollectionDTO,
|
||||
@@ -1098,6 +1118,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateProductCollections(
|
||||
idOrSelector: string | ProductTypes.FilterableProductCollectionProps,
|
||||
data: ProductTypes.UpdateProductCollectionDTO,
|
||||
@@ -1216,11 +1237,12 @@ export default class ProductModuleService
|
||||
return collections
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createProductCategories(
|
||||
data: ProductTypes.CreateProductCategoryDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductCategoryDTO[]>
|
||||
// @ts-expect-error
|
||||
createProductCategories(
|
||||
data: ProductTypes.CreateProductCategoryDTO,
|
||||
sharedContext?: Context
|
||||
@@ -1228,6 +1250,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createProductCategories(
|
||||
data:
|
||||
| ProductTypes.CreateProductCategoryDTO[]
|
||||
@@ -1325,12 +1348,13 @@ export default class ProductModuleService
|
||||
return Array.isArray(data) ? result : result[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
updateProductCategories(
|
||||
id: string,
|
||||
data: ProductTypes.UpdateProductCategoryDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductCategoryDTO>
|
||||
// @ts-expect-error
|
||||
updateProductCategories(
|
||||
selector: ProductTypes.FilterableProductTypeProps,
|
||||
data: ProductTypes.UpdateProductCategoryDTO,
|
||||
@@ -1339,6 +1363,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateProductCategories(
|
||||
idOrSelector: string | ProductTypes.FilterableProductTypeProps,
|
||||
data: ProductTypes.UpdateProductCategoryDTO,
|
||||
@@ -1390,6 +1415,7 @@ export default class ProductModuleService
|
||||
data: ProductTypes.CreateProductDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductDTO[]>
|
||||
// @ts-expect-error
|
||||
createProducts(
|
||||
data: ProductTypes.CreateProductDTO,
|
||||
sharedContext?: Context
|
||||
@@ -1397,6 +1423,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createProducts(
|
||||
data: ProductTypes.CreateProductDTO[] | ProductTypes.CreateProductDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -1477,6 +1504,7 @@ export default class ProductModuleService
|
||||
data: ProductTypes.UpdateProductDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductDTO>
|
||||
// @ts-expect-error
|
||||
updateProducts(
|
||||
selector: ProductTypes.FilterableProductProps,
|
||||
data: ProductTypes.UpdateProductDTO,
|
||||
@@ -1485,6 +1513,7 @@ export default class ProductModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateProducts(
|
||||
idOrSelector: string | ProductTypes.FilterableProductProps,
|
||||
data: ProductTypes.UpdateProductDTO,
|
||||
@@ -1746,6 +1775,70 @@ export default class ProductModuleService
|
||||
return productData
|
||||
}
|
||||
|
||||
// @ts-expect-error
|
||||
updateProductOptionValues(
|
||||
idOrSelector: string,
|
||||
data: ProductTypes.UpdateProductOptionValueDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductOptionValueDTO>
|
||||
// @ts-expect-error
|
||||
updateProductOptionValues(
|
||||
selector: FilterableProductOptionValueProps,
|
||||
data: ProductTypes.UpdateProductOptionValueDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProductTypes.ProductOptionValueDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateProductOptionValues(
|
||||
idOrSelector: string | FilterableProductOptionValueProps,
|
||||
data: ProductTypes.UpdateProductOptionValueDTO,
|
||||
sharedContext: Context = {}
|
||||
): Promise<
|
||||
ProductTypes.ProductOptionValueDTO | ProductTypes.ProductOptionValueDTO[]
|
||||
> {
|
||||
let normalizedInput: ({
|
||||
id: string
|
||||
} & ProductTypes.UpdateProductOptionValueDTO)[] = []
|
||||
if (isString(idOrSelector)) {
|
||||
// This will throw if the product option value does not exist
|
||||
await this.productOptionValueService_.retrieve(
|
||||
idOrSelector,
|
||||
{},
|
||||
sharedContext
|
||||
)
|
||||
|
||||
normalizedInput = [{ id: idOrSelector, ...data }]
|
||||
} else {
|
||||
const productOptionValues = await this.productOptionValueService_.list(
|
||||
idOrSelector,
|
||||
{},
|
||||
sharedContext
|
||||
)
|
||||
|
||||
normalizedInput = productOptionValues.map((product) => ({
|
||||
id: product.id,
|
||||
...data,
|
||||
}))
|
||||
}
|
||||
|
||||
const productOptionValues = await super.updateProductOptionValues(
|
||||
normalizedInput,
|
||||
sharedContext
|
||||
)
|
||||
|
||||
const updatedProductOptionValues = await this.baseRepository_.serialize<
|
||||
ProductTypes.ProductOptionValueDTO[]
|
||||
>(productOptionValues)
|
||||
|
||||
eventBuilders.updatedProductOptionValue({
|
||||
data: updatedProductOptionValues,
|
||||
sharedContext: sharedContext,
|
||||
})
|
||||
|
||||
return isString(idOrSelector)
|
||||
? updatedProductOptionValues[0]
|
||||
: updatedProductOptionValues
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the manually provided handle value of the product
|
||||
* to be URL-safe
|
||||
|
||||
@@ -132,4 +132,22 @@ export const eventBuilders = {
|
||||
object: "product_collection",
|
||||
eventName: ProductEvents.PRODUCT_COLLECTION_DELETED,
|
||||
}),
|
||||
createdProductOptionValue: moduleEventBuilderFactory({
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "product_option_value",
|
||||
eventName: ProductEvents.PRODUCT_OPTION_VALUE_CREATED,
|
||||
}),
|
||||
updatedProductOptionValue: moduleEventBuilderFactory({
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "product_option_value",
|
||||
eventName: ProductEvents.PRODUCT_OPTION_VALUE_UPDATED,
|
||||
}),
|
||||
deletedProductOptionValue: moduleEventBuilderFactory({
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "product_option_value",
|
||||
eventName: ProductEvents.PRODUCT_OPTION_VALUE_DELETED,
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -574,12 +574,14 @@ export default class PromotionModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.PromotionDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createPromotions(
|
||||
data: PromotionTypes.CreatePromotionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.PromotionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createPromotions(
|
||||
data:
|
||||
| PromotionTypes.CreatePromotionDTO
|
||||
@@ -841,12 +843,14 @@ export default class PromotionModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.PromotionDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async updatePromotions(
|
||||
data: PromotionTypes.UpdatePromotionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.PromotionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updatePromotions(
|
||||
data:
|
||||
| PromotionTypes.UpdatePromotionDTO
|
||||
@@ -1295,18 +1299,20 @@ export default class PromotionModuleService
|
||||
)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async createCampaigns(
|
||||
data: PromotionTypes.CreateCampaignDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.CampaignDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async createCampaigns(
|
||||
data: PromotionTypes.CreateCampaignDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.CampaignDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createCampaigns(
|
||||
data: PromotionTypes.CreateCampaignDTO | PromotionTypes.CreateCampaignDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -1404,18 +1410,20 @@ export default class PromotionModuleService
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async updateCampaigns(
|
||||
data: PromotionTypes.UpdateCampaignDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.CampaignDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
async updateCampaigns(
|
||||
data: PromotionTypes.UpdateCampaignDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PromotionTypes.CampaignDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateCampaigns(
|
||||
data: PromotionTypes.UpdateCampaignDTO | PromotionTypes.UpdateCampaignDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
|
||||
@@ -71,12 +71,14 @@ export default class RegionModuleService
|
||||
data: CreateRegionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<RegionDTO[]>
|
||||
// @ts-expect-error
|
||||
async createRegions(
|
||||
data: CreateRegionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<RegionDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createRegions(
|
||||
data: CreateRegionDTO | CreateRegionDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -130,7 +132,7 @@ export default class RegionModuleService
|
||||
}
|
||||
|
||||
@InjectManager()
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
async softDeleteRegions(
|
||||
ids: string | object | string[] | object[],
|
||||
config?: SoftDeleteReturn<string>,
|
||||
@@ -141,7 +143,7 @@ export default class RegionModuleService
|
||||
await super.updateCountries(
|
||||
{
|
||||
selector: { region_id: ids },
|
||||
data: { region_id: null },
|
||||
data: { region_id: null } as any,
|
||||
},
|
||||
sharedContext
|
||||
)
|
||||
@@ -192,6 +194,7 @@ export default class RegionModuleService
|
||||
data: UpdateRegionDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<RegionDTO>
|
||||
// @ts-expect-error
|
||||
async updateRegions(
|
||||
selector: FilterableRegionProps,
|
||||
data: UpdateRegionDTO,
|
||||
@@ -199,6 +202,7 @@ export default class RegionModuleService
|
||||
): Promise<RegionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateRegions(
|
||||
idOrSelector: string | FilterableRegionProps,
|
||||
data: UpdateRegionDTO,
|
||||
|
||||
@@ -60,12 +60,14 @@ export default class SalesChannelModuleService
|
||||
data: CreateSalesChannelDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<SalesChannelDTO[]>
|
||||
// @ts-expect-error
|
||||
async createSalesChannels(
|
||||
data: CreateSalesChannelDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<SalesChannelDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createSalesChannels(
|
||||
data: CreateSalesChannelDTO | CreateSalesChannelDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -96,6 +98,7 @@ export default class SalesChannelModuleService
|
||||
data: UpdateSalesChannelDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<SalesChannelDTO>
|
||||
// @ts-expect-error
|
||||
async updateSalesChannels(
|
||||
selector: FilterableSalesChannelProps,
|
||||
data: UpdateSalesChannelDTO,
|
||||
@@ -103,6 +106,7 @@ export default class SalesChannelModuleService
|
||||
): Promise<SalesChannelDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateSalesChannels(
|
||||
idOrSelector: string | FilterableSalesChannelProps,
|
||||
data: UpdateSalesChannelDTO | UpdateSalesChannelDTO[],
|
||||
|
||||
@@ -81,12 +81,13 @@ export default class StockLocationModuleService
|
||||
data: CreateStockLocationInput,
|
||||
context: Context
|
||||
): Promise<StockLocationTypes.StockLocationDTO>
|
||||
// @ts-expect-error
|
||||
createStockLocations(
|
||||
data: CreateStockLocationInput[],
|
||||
context: Context
|
||||
): Promise<StockLocationTypes.StockLocationDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createStockLocations(
|
||||
data: CreateStockLocationInput | CreateStockLocationInput[],
|
||||
@MedusaContext() context: Context = {}
|
||||
@@ -172,6 +173,7 @@ export default class StockLocationModuleService
|
||||
input: UpdateStockLocationInput,
|
||||
context?: Context
|
||||
): Promise<StockLocationTypes.StockLocationDTO>
|
||||
// @ts-expect-error
|
||||
updateStockLocations(
|
||||
selector: FilterableStockLocationProps,
|
||||
input: UpdateStockLocationInput,
|
||||
@@ -185,6 +187,7 @@ export default class StockLocationModuleService
|
||||
* @returns The updated stock location.
|
||||
*/
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateStockLocations(
|
||||
idOrSelector: string | FilterableStockLocationProps,
|
||||
data: UpdateStockLocationInput | UpdateStockLocationInput[],
|
||||
@@ -229,12 +232,14 @@ export default class StockLocationModuleService
|
||||
data: StockLocationAddressInput & { id: string },
|
||||
context?: Context
|
||||
): Promise<StockLocationTypes.StockLocationAddressDTO>
|
||||
// @ts-expect-error
|
||||
updateStockLocationAddresses(
|
||||
data: (StockLocationAddressInput & { id: string })[],
|
||||
context?: Context
|
||||
): Promise<StockLocationTypes.StockLocationAddressDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateStockLocationAddresses(
|
||||
data:
|
||||
| (StockLocationAddressInput & { id: string })
|
||||
|
||||
@@ -54,11 +54,13 @@ export default class StoreModuleService
|
||||
data: StoreTypes.CreateStoreDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<StoreTypes.StoreDTO[]>
|
||||
// @ts-expect-error
|
||||
async createStores(
|
||||
data: StoreTypes.CreateStoreDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<StoreTypes.StoreDTO>
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createStores(
|
||||
data: StoreTypes.CreateStoreDTO | StoreTypes.CreateStoreDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -131,12 +133,14 @@ export default class StoreModuleService
|
||||
data: StoreTypes.UpdateStoreDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<StoreTypes.StoreDTO>
|
||||
// @ts-expect-error
|
||||
async updateStores(
|
||||
selector: StoreTypes.FilterableStoreProps,
|
||||
data: StoreTypes.UpdateStoreDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<StoreTypes.StoreDTO[]>
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateStores(
|
||||
idOrSelector: string | StoreTypes.FilterableStoreProps,
|
||||
data: StoreTypes.UpdateStoreDTO,
|
||||
|
||||
@@ -88,12 +88,14 @@ export default class TaxModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<TaxTypes.TaxRateDTO[]>
|
||||
|
||||
// @ts-expect-error
|
||||
async createTaxRates(
|
||||
data: TaxTypes.CreateTaxRateDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<TaxTypes.TaxRateDTO>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createTaxRates(
|
||||
data: TaxTypes.CreateTaxRateDTO[] | TaxTypes.CreateTaxRateDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -155,11 +157,13 @@ export default class TaxModuleService
|
||||
data: TaxTypes.UpdateTaxRateDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<TaxTypes.TaxRateDTO>
|
||||
// @ts-expect-error
|
||||
async updateTaxRates(
|
||||
ids: string[],
|
||||
data: TaxTypes.UpdateTaxRateDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<TaxTypes.TaxRateDTO[]>
|
||||
// @ts-expect-error
|
||||
async updateTaxRates(
|
||||
selector: TaxTypes.FilterableTaxRateProps,
|
||||
data: TaxTypes.UpdateTaxRateDTO,
|
||||
@@ -167,6 +171,7 @@ export default class TaxModuleService
|
||||
): Promise<TaxTypes.TaxRateDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async updateTaxRates(
|
||||
selector: string | string[] | TaxTypes.FilterableTaxRateProps,
|
||||
data: TaxTypes.UpdateTaxRateDTO,
|
||||
@@ -296,12 +301,14 @@ export default class TaxModuleService
|
||||
sharedContext?: Context
|
||||
): Promise<TaxRegionDTO>
|
||||
|
||||
// @ts-expect-error
|
||||
createTaxRegions(
|
||||
data: TaxTypes.CreateTaxRegionDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<TaxRegionDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createTaxRegions(
|
||||
data: TaxTypes.CreateTaxRegionDTO | TaxTypes.CreateTaxRegionDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -347,17 +354,19 @@ export default class TaxModuleService
|
||||
)
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createTaxRateRules(
|
||||
data: TaxTypes.CreateTaxRateRuleDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<TaxTypes.TaxRateRuleDTO>
|
||||
// @ts-expect-error
|
||||
createTaxRateRules(
|
||||
data: TaxTypes.CreateTaxRateRuleDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<TaxTypes.TaxRateRuleDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
// @ts-expect-error
|
||||
async createTaxRateRules(
|
||||
data: TaxTypes.CreateTaxRateRuleDTO | TaxTypes.CreateTaxRateRuleDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
|
||||
@@ -170,6 +170,7 @@ export default class UserModuleService
|
||||
data: UserTypes.CreateUserDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<UserTypes.UserDTO[]>
|
||||
// @ts-expect-error
|
||||
createUsers(
|
||||
data: UserTypes.CreateUserDTO,
|
||||
sharedContext?: Context
|
||||
@@ -177,6 +178,7 @@ export default class UserModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createUsers(
|
||||
data: UserTypes.CreateUserDTO[] | UserTypes.CreateUserDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -210,6 +212,7 @@ export default class UserModuleService
|
||||
data: UserTypes.UpdateUserDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<UserTypes.UserDTO[]>
|
||||
// @ts-expect-error
|
||||
updateUsers(
|
||||
data: UserTypes.UpdateUserDTO,
|
||||
sharedContext?: Context
|
||||
@@ -217,6 +220,7 @@ export default class UserModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateUsers(
|
||||
data: UserTypes.UpdateUserDTO | UserTypes.UpdateUserDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -245,11 +249,12 @@ export default class UserModuleService
|
||||
return Array.isArray(data) ? serializedUsers : serializedUsers[0]
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
// @ts-expect-error
|
||||
createInvites(
|
||||
data: UserTypes.CreateInviteDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<UserTypes.InviteDTO[]>
|
||||
// @ts-expect-error
|
||||
createInvites(
|
||||
data: UserTypes.CreateInviteDTO,
|
||||
sharedContext?: Context
|
||||
@@ -257,6 +262,7 @@ export default class UserModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createInvites(
|
||||
data: UserTypes.CreateInviteDTO[] | UserTypes.CreateInviteDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
@@ -332,6 +338,7 @@ export default class UserModuleService
|
||||
data: UserTypes.UpdateInviteDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<UserTypes.InviteDTO[]>
|
||||
// @ts-expect-error
|
||||
updateInvites(
|
||||
data: UserTypes.UpdateInviteDTO,
|
||||
sharedContext?: Context
|
||||
@@ -339,6 +346,7 @@ export default class UserModuleService
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateInvites(
|
||||
data: UserTypes.UpdateInviteDTO | UserTypes.UpdateInviteDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
|
||||
Reference in New Issue
Block a user