chore: cleanup inspection (#6358)
This commit is contained in:
committed by
GitHub
parent
94062d28be
commit
b91a1ca5b8
6
.changeset/calm-countries-exercise.md
Normal file
6
.changeset/calm-countries-exercise.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/pricing": patch
|
||||
"@medusajs/product": patch
|
||||
---
|
||||
|
||||
chore: cleanup inspection
|
||||
@@ -1,13 +1,13 @@
|
||||
import {
|
||||
ExternalModuleDeclaration,
|
||||
InternalModuleDeclaration,
|
||||
MODULE_PACKAGE_NAMES,
|
||||
MedusaModule,
|
||||
MODULE_PACKAGE_NAMES,
|
||||
Modules,
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { IAuthModuleService, ModulesSdkTypes } from "@medusajs/types"
|
||||
|
||||
import { InitializeModuleInjectableDependencies } from "../types"
|
||||
import { InitializeModuleInjectableDependencies } from "@types"
|
||||
import { moduleDefinition } from "../module-definition"
|
||||
|
||||
export const initialize = async (
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import {
|
||||
BeforeCreate,
|
||||
Cascade,
|
||||
Entity,
|
||||
Index,
|
||||
ManyToOne,
|
||||
OnInit,
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { AbstractAuthModuleProvider, MedusaError } from "@medusajs/utils"
|
||||
import {
|
||||
AuthProviderScope,
|
||||
AuthenticationInput,
|
||||
AuthenticationResponse,
|
||||
ModulesSdkTypes,
|
||||
|
||||
@@ -19,7 +19,6 @@ import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
|
||||
import {
|
||||
AbstractAuthModuleProvider,
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
ModulesSdkUtils,
|
||||
@@ -74,13 +73,12 @@ export default class AuthModuleService<TAuthUser extends AuthUser = AuthUser>
|
||||
): Promise<AuthTypes.AuthUserDTO | AuthTypes.AuthUserDTO[]> {
|
||||
const authUsers = await this.authUserService_.create(data, sharedContext)
|
||||
|
||||
const serializedUsers = await this.baseRepository_.serialize<
|
||||
AuthTypes.AuthUserDTO[]
|
||||
>(authUsers, {
|
||||
populate: true,
|
||||
})
|
||||
|
||||
return serializedUsers
|
||||
return await this.baseRepository_.serialize<AuthTypes.AuthUserDTO[]>(
|
||||
authUsers,
|
||||
{
|
||||
populate: true,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
update(
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { ICartModuleService, ModulesSdkTypes } from "@medusajs/types"
|
||||
import { moduleDefinition } from "../module-definition"
|
||||
import { InitializeModuleInjectableDependencies } from "../types"
|
||||
import { InitializeModuleInjectableDependencies } from "@types"
|
||||
|
||||
export const initialize = async (
|
||||
options?:
|
||||
|
||||
@@ -403,7 +403,8 @@ export default class CartModuleService<
|
||||
itemIdsOrSelector: string | string[] | Partial<CartTypes.CartLineItemDTO>,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
let toDelete: string[] = []
|
||||
let toDelete: string[]
|
||||
|
||||
if (isObject(itemIdsOrSelector)) {
|
||||
const items = await this.listLineItems(
|
||||
{ ...itemIdsOrSelector } as Partial<CartTypes.CartLineItemDTO>,
|
||||
@@ -518,7 +519,7 @@ export default class CartModuleService<
|
||||
): Promise<
|
||||
CartTypes.CartShippingMethodDTO[] | CartTypes.CartShippingMethodDTO
|
||||
> {
|
||||
let methods: ShippingMethod[] = []
|
||||
let methods: ShippingMethod[]
|
||||
if (isString(cartIdOrData)) {
|
||||
methods = await this.addShippingMethods_(
|
||||
cartIdOrData,
|
||||
@@ -588,7 +589,7 @@ export default class CartModuleService<
|
||||
| Partial<CartTypes.CartShippingMethodDTO>,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
let toDelete: string[] = []
|
||||
let toDelete: string[]
|
||||
if (isObject(methodIdsOrSelector)) {
|
||||
const methods = await this.listShippingMethods(
|
||||
{
|
||||
@@ -742,7 +743,7 @@ export default class CartModuleService<
|
||||
| Partial<CartTypes.LineItemAdjustmentDTO>,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
let ids: string[] = []
|
||||
let ids: string[]
|
||||
if (isObject(adjustmentIdsOrSelector)) {
|
||||
const adjustments = await this.listLineItemAdjustments(
|
||||
{
|
||||
@@ -911,7 +912,7 @@ export default class CartModuleService<
|
||||
| Partial<CartTypes.ShippingMethodAdjustmentDTO>,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
let ids: string[] = []
|
||||
let ids: string[]
|
||||
if (isObject(adjustmentIdsOrSelector)) {
|
||||
const adjustments = await this.listShippingMethodAdjustments(
|
||||
{
|
||||
@@ -956,7 +957,7 @@ export default class CartModuleService<
|
||||
| CartTypes.CreateLineItemTaxLineDTO,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<CartTypes.LineItemTaxLineDTO[] | CartTypes.LineItemTaxLineDTO> {
|
||||
let addedTaxLines: LineItemTaxLine[] = []
|
||||
let addedTaxLines: LineItemTaxLine[]
|
||||
if (isString(cartIdOrData)) {
|
||||
// existence check
|
||||
await this.retrieve(cartIdOrData, { select: ["id"] }, sharedContext)
|
||||
@@ -1065,7 +1066,7 @@ export default class CartModuleService<
|
||||
| CartTypes.FilterableShippingMethodTaxLineProps,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
let ids: string[] = []
|
||||
let ids: string[]
|
||||
if (isObject(taxLineIdsOrSelector)) {
|
||||
const taxLines = await this.listLineItemTaxLines(
|
||||
{
|
||||
@@ -1112,7 +1113,7 @@ export default class CartModuleService<
|
||||
): Promise<
|
||||
CartTypes.ShippingMethodTaxLineDTO[] | CartTypes.ShippingMethodTaxLineDTO
|
||||
> {
|
||||
let addedTaxLines: ShippingMethodTaxLine[] = []
|
||||
let addedTaxLines: ShippingMethodTaxLine[]
|
||||
if (isString(cartIdOrData)) {
|
||||
// existence check
|
||||
await this.retrieve(cartIdOrData, { select: ["id"] }, sharedContext)
|
||||
@@ -1222,7 +1223,7 @@ export default class CartModuleService<
|
||||
| CartTypes.FilterableShippingMethodTaxLineProps,
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
): Promise<void> {
|
||||
let ids: string[] = []
|
||||
let ids: string[]
|
||||
if (isObject(taxLineIdsOrSelector)) {
|
||||
const taxLines = await this.listShippingMethodTaxLines(
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { ICustomerModuleService, ModulesSdkTypes } from "@medusajs/types"
|
||||
import { moduleDefinition } from "../module-definition"
|
||||
import { InitializeModuleInjectableDependencies } from "../types"
|
||||
import { InitializeModuleInjectableDependencies } from "@types"
|
||||
|
||||
export const initialize = async (
|
||||
options?:
|
||||
|
||||
@@ -6,11 +6,9 @@ import {
|
||||
Collection,
|
||||
Entity,
|
||||
Filter,
|
||||
Index,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
OnInit,
|
||||
OneToMany,
|
||||
OnInit,
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
|
||||
@@ -176,7 +176,7 @@ export default class CustomerModuleService<
|
||||
| {
|
||||
selector: CustomerTypes.FilterableCustomerProps
|
||||
data: CustomerTypes.CustomerUpdatableFields
|
||||
} = []
|
||||
}
|
||||
|
||||
if (isString(idsOrSelector)) {
|
||||
updateData = {
|
||||
@@ -269,7 +269,7 @@ export default class CustomerModuleService<
|
||||
| {
|
||||
selector: CustomerTypes.FilterableCustomerGroupProps
|
||||
data: CustomerTypes.CustomerGroupUpdatableFields
|
||||
} = []
|
||||
}
|
||||
|
||||
if (isString(groupIdOrSelector) || Array.isArray(groupIdOrSelector)) {
|
||||
const groupIdOrSelectorArray = Array.isArray(groupIdOrSelector)
|
||||
@@ -373,12 +373,10 @@ export default class CustomerModuleService<
|
||||
| CustomerTypes.CreateCustomerAddressDTO[],
|
||||
@MedusaContext() sharedContext: Context = {}
|
||||
) {
|
||||
const addresses = await this.addressService_.create(
|
||||
return await this.addressService_.create(
|
||||
Array.isArray(data) ? data : [data],
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return addresses
|
||||
}
|
||||
|
||||
async updateAddresses(
|
||||
@@ -411,7 +409,7 @@ export default class CustomerModuleService<
|
||||
| {
|
||||
selector: CustomerTypes.FilterableCustomerAddressProps
|
||||
data: CustomerTypes.UpdateCustomerAddressDTO
|
||||
} = []
|
||||
}
|
||||
if (isString(addressIdOrSelector)) {
|
||||
updateData = [
|
||||
{
|
||||
|
||||
@@ -4,11 +4,10 @@ import {
|
||||
Collection,
|
||||
Entity,
|
||||
Filter,
|
||||
Index,
|
||||
ManyToOne,
|
||||
OnInit,
|
||||
OneToMany,
|
||||
OneToOne,
|
||||
OnInit,
|
||||
OptionalProps,
|
||||
PrimaryKey,
|
||||
PrimaryKeyType,
|
||||
@@ -84,7 +83,11 @@ export default class PriceSetMoneyAmount {
|
||||
})
|
||||
updated_at: Date
|
||||
|
||||
@Property({ columnType: "timestamptz", nullable: true , index: "IDX_price_set_money_amount_deleted_at"})
|
||||
@Property({
|
||||
columnType: "timestamptz",
|
||||
nullable: true,
|
||||
index: "IDX_price_set_money_amount_deleted_at",
|
||||
})
|
||||
deleted_at: Date | null
|
||||
|
||||
@BeforeCreate()
|
||||
|
||||
@@ -48,9 +48,9 @@ import {
|
||||
PriceRuleService,
|
||||
RuleTypeService,
|
||||
} from "@services"
|
||||
import {entityNameToLinkableKeysMap, joinerConfig} from "../joiner-config"
|
||||
import {validatePriceListDates} from "@utils"
|
||||
import {ServiceTypes} from "@types"
|
||||
import { entityNameToLinkableKeysMap, joinerConfig } from "../joiner-config"
|
||||
import { validatePriceListDates } from "@utils"
|
||||
import { ServiceTypes } from "@types"
|
||||
|
||||
type InjectedDependencies = {
|
||||
baseRepository: DAL.RepositoryService
|
||||
@@ -950,7 +950,7 @@ export default class PricingModuleService<
|
||||
priceListsToCreate
|
||||
)) as unknown as PricingTypes.PriceListDTO[]
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const { rules = {}, prices = [] } = data[i]
|
||||
const priceList = priceLists[i]
|
||||
|
||||
@@ -1167,12 +1167,11 @@ export default class PricingModuleService<
|
||||
): Promise<PricingTypes.PriceListRuleDTO[]> {
|
||||
const priceLists = await this.createPriceListRules_(data, sharedContext)
|
||||
|
||||
return await this.baseRepository_.serialize<PricingTypes.PriceListRuleDTO[]>(
|
||||
priceLists,
|
||||
{
|
||||
populate: true,
|
||||
}
|
||||
)
|
||||
return await this.baseRepository_.serialize<
|
||||
PricingTypes.PriceListRuleDTO[]
|
||||
>(priceLists, {
|
||||
populate: true,
|
||||
})
|
||||
}
|
||||
|
||||
@InjectTransactionManager("baseRepository_")
|
||||
@@ -1193,12 +1192,11 @@ export default class PricingModuleService<
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return await this.baseRepository_.serialize<PricingTypes.PriceListRuleDTO[]>(
|
||||
priceLists,
|
||||
{
|
||||
populate: true,
|
||||
}
|
||||
)
|
||||
return await this.baseRepository_.serialize<
|
||||
PricingTypes.PriceListRuleDTO[]
|
||||
>(priceLists, {
|
||||
populate: true,
|
||||
})
|
||||
}
|
||||
|
||||
@InjectManager("baseRepository_")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { PriceSet, PriceSetMoneyAmount, RuleType } from "@models"
|
||||
import { PriceSetDTO, PriceSetMoneyAmountDTO, RuleTypeDTO } from "@medusajs/types"
|
||||
|
||||
export interface CreatePriceRuleDTO {
|
||||
id?: string
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseFilterable, PriceSetDTO, PriceSetMoneyAmountDTO, RuleTypeDTO } from "@medusajs/types"
|
||||
import { BaseFilterable, PriceSetDTO, RuleTypeDTO } from "@medusajs/types"
|
||||
import { PriceSet, PriceSetMoneyAmount, RuleType } from "@models"
|
||||
|
||||
export interface CreatePriceRuleDTO {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { IProductModuleService, ModulesSdkTypes } from "@medusajs/types"
|
||||
|
||||
import { InitializeModuleInjectableDependencies } from "../types"
|
||||
import { InitializeModuleInjectableDependencies } from "@types"
|
||||
import { moduleDefinition } from "../module-definition"
|
||||
|
||||
export const initialize = async (
|
||||
|
||||
@@ -751,7 +751,7 @@ export default class PromotionModuleService<
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return this.retrieve(
|
||||
return await this.retrieve(
|
||||
promotionId,
|
||||
{ relations: ["rules", "rules.values"] },
|
||||
sharedContext
|
||||
@@ -784,7 +784,7 @@ export default class PromotionModuleService<
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return this.retrieve(
|
||||
return await this.retrieve(
|
||||
promotionId,
|
||||
{
|
||||
relations: [
|
||||
@@ -825,7 +825,7 @@ export default class PromotionModuleService<
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return this.retrieve(
|
||||
return await this.retrieve(
|
||||
promotionId,
|
||||
{
|
||||
relations: [
|
||||
@@ -882,7 +882,7 @@ export default class PromotionModuleService<
|
||||
): Promise<PromotionTypes.PromotionDTO> {
|
||||
await this.removePromotionRules_(promotionId, rulesData, sharedContext)
|
||||
|
||||
return this.retrieve(
|
||||
return await this.retrieve(
|
||||
promotionId,
|
||||
{ relations: ["rules", "rules.values"] },
|
||||
sharedContext
|
||||
@@ -926,7 +926,7 @@ export default class PromotionModuleService<
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return this.retrieve(
|
||||
return await this.retrieve(
|
||||
promotionId,
|
||||
{
|
||||
relations: [
|
||||
@@ -954,7 +954,7 @@ export default class PromotionModuleService<
|
||||
sharedContext
|
||||
)
|
||||
|
||||
return this.retrieve(
|
||||
return await this.retrieve(
|
||||
promotionId,
|
||||
{
|
||||
relations: [
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
MedusaError,
|
||||
PromotionType,
|
||||
} from "@medusajs/utils"
|
||||
import { areRulesValidForContext } from "../validations/promotion-rule"
|
||||
import { areRulesValidForContext } from "../validations"
|
||||
import { computeActionForBudgetExceeded } from "./usage"
|
||||
|
||||
export function getComputedActionsForBuyGet(
|
||||
|
||||
@@ -2,16 +2,13 @@ import {
|
||||
ApplicationMethodAllocation,
|
||||
ApplicationMethodTargetType,
|
||||
ApplicationMethodType,
|
||||
MedusaError,
|
||||
PromotionType,
|
||||
isDefined,
|
||||
isPresent,
|
||||
MedusaError,
|
||||
PromotionType,
|
||||
} from "@medusajs/utils"
|
||||
import { Promotion } from "@models"
|
||||
import {
|
||||
CreateApplicationMethodDTO,
|
||||
UpdateApplicationMethodDTO,
|
||||
} from "../../types"
|
||||
import { CreateApplicationMethodDTO, UpdateApplicationMethodDTO } from "@types"
|
||||
|
||||
export const allowedAllocationTargetTypes: string[] = [
|
||||
ApplicationMethodTargetType.SHIPPING_METHODS,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { PromotionRuleDTO, PromotionRuleOperatorValues } from "@medusajs/types"
|
||||
import {
|
||||
MedusaError,
|
||||
PromotionRuleOperator,
|
||||
isPresent,
|
||||
isString,
|
||||
MedusaError,
|
||||
pickValueFromObject,
|
||||
PromotionRuleOperator,
|
||||
} from "@medusajs/utils"
|
||||
import { CreatePromotionRuleDTO } from "../../types"
|
||||
import { CreatePromotionRuleDTO } from "@types"
|
||||
|
||||
export function validatePromotionRuleAttributes(
|
||||
promotionRulesData: CreatePromotionRuleDTO[]
|
||||
|
||||
Reference in New Issue
Block a user