chore(): Remove default limit from the build query (#9257)
* chore(): Remove default limit from the build query * rm take: null * fix tests * fix tests * fix db usage * fix typo * rm unsused template arg * fixes * fixes * fixes * fixes * fixes * fixes * fixes
This commit is contained in:
@@ -42,7 +42,7 @@ export const getPromotionCodesToApply = createStep(
|
||||
(
|
||||
await promotionService.listPromotions(
|
||||
{ code: adjustmentCodes },
|
||||
{ select: ["code"], take: null }
|
||||
{ select: ["code"] }
|
||||
)
|
||||
).map((p) => p.code!)
|
||||
)
|
||||
|
||||
@@ -31,7 +31,6 @@ async function getCurrentShippingOptionPriceSetsLinks(
|
||||
service: LINKS.ShippingOptionPriceSet,
|
||||
variables: {
|
||||
filters: { shipping_option_id: shippingOptionIds },
|
||||
take: null,
|
||||
},
|
||||
fields: ["shipping_option_id", "price_set_id"],
|
||||
} as any)) as {
|
||||
|
||||
@@ -36,7 +36,6 @@ async function getCurrentShippingOptionPrices(
|
||||
service: LINKS.ShippingOptionPriceSet,
|
||||
variables: {
|
||||
filters: { shipping_option_id: shippingOptionIds },
|
||||
take: null,
|
||||
},
|
||||
fields: ["shipping_option_id", "price_set_id", "price_set.prices.*"],
|
||||
} as any)) as {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
MedusaError,
|
||||
Modules,
|
||||
} from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||
|
||||
export type FulfillmentProviderValidationWorkflowInput = {
|
||||
id?: string
|
||||
@@ -36,7 +36,6 @@ export const validateFulfillmentProvidersStep = createStep(
|
||||
},
|
||||
{
|
||||
select: ["id", "service_zone_id", "provider_id"],
|
||||
take: null,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export const getExistingPriceListsPriceIdsStep = createStep(
|
||||
const existingPrices = priceListIds.length
|
||||
? await pricingModule.listPrices(
|
||||
{ price_list_id: priceListIds },
|
||||
{ relations: ["price_list"], take: null }
|
||||
{ relations: ["price_list"] }
|
||||
)
|
||||
: []
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export const validateVariantPriceLinksStep = createStep(
|
||||
const links = await remoteQuery({
|
||||
entryPoint: "product_variant_price_set",
|
||||
fields: ["variant_id", "price_set_id"],
|
||||
variables: { variant_id: variantIds, take: null },
|
||||
variables: { variant_id: variantIds },
|
||||
})
|
||||
const variantPriceSetMap: Record<string, string> = {}
|
||||
|
||||
|
||||
@@ -16,19 +16,16 @@ export const updatePricePreferencesAsArrayStep = createStep(
|
||||
const service = container.resolve<IPricingModuleService>(Modules.PRICING)
|
||||
|
||||
const prevData = await service.listPricePreferences({
|
||||
$or: input.map(
|
||||
(entry) => {
|
||||
if (!entry.attribute || !entry.value) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
"Attribute and value must be provided when updating price preferences"
|
||||
)
|
||||
}
|
||||
$or: input.map((entry) => {
|
||||
if (!entry.attribute || !entry.value) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
"Attribute and value must be provided when updating price preferences"
|
||||
)
|
||||
}
|
||||
|
||||
return { attribute: entry.attribute, value: entry.value }
|
||||
},
|
||||
{ take: null }
|
||||
),
|
||||
return { attribute: entry.attribute, value: entry.value }
|
||||
}, {}),
|
||||
})
|
||||
|
||||
const toUpsert = input.map((entry) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IProductModuleService, LinkWorkflowInput } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||
|
||||
export const batchLinkProductsToCollectionStepId =
|
||||
"batch-link-products-to-collection"
|
||||
@@ -17,7 +17,6 @@ export const batchLinkProductsToCollectionStep = createStep(
|
||||
}
|
||||
|
||||
const dbCollection = await service.retrieveProductCollection(data.id, {
|
||||
take: null,
|
||||
select: ["id", "products.id"],
|
||||
relations: ["products"],
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IProductModuleService, ProductCategoryWorkflow } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
|
||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||
|
||||
export const batchLinkProductsToCategoryStepId =
|
||||
"batch-link-products-to-category"
|
||||
@@ -23,7 +23,6 @@ export const batchLinkProductsToCategoryStep = createStep(
|
||||
const dbProducts = await service.listProducts(
|
||||
{ id: [...(data.add ?? []), ...(data.remove ?? [])] },
|
||||
{
|
||||
take: null,
|
||||
select: ["id", "categories"],
|
||||
}
|
||||
)
|
||||
@@ -63,7 +62,6 @@ export const batchLinkProductsToCategoryStep = createStep(
|
||||
const dbProducts = await service.listProducts(
|
||||
{ id: prevData.productIds },
|
||||
{
|
||||
take: null,
|
||||
select: ["id", "categories"],
|
||||
}
|
||||
)
|
||||
|
||||
@@ -71,7 +71,7 @@ export const generateProductCsvStep = createStep(
|
||||
|
||||
const regions = await regionService.listRegions(
|
||||
{},
|
||||
{ select: ["id", "name", "currency_code"], take: null }
|
||||
{ select: ["id", "name", "currency_code"] }
|
||||
)
|
||||
|
||||
const normalizedData = normalizeForExport(products, { regions })
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getProductsStep = createStep(
|
||||
|
||||
const products = await service.listProducts(
|
||||
{ id: data.ids },
|
||||
{ relations: ["variants"], take: null }
|
||||
{ relations: ["variants"] }
|
||||
)
|
||||
return new StepResponse(products, products)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export const groupProductsForBatchStep = createStep(
|
||||
// We use the ID to do product updates
|
||||
id: data.map((product) => product.id).filter(Boolean) as string[],
|
||||
},
|
||||
{ take: null, select: ["handle"] }
|
||||
{ select: ["handle"] }
|
||||
)
|
||||
const existingProductsSet = new Set(existingProducts.map((p) => p.id))
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ export const parseProductCsvStep = createStep(
|
||||
|
||||
const [productTypes, productCollections, salesChannels] = await Promise.all(
|
||||
[
|
||||
productService.listProductTypes({}, { take: null }),
|
||||
productService.listProductCollections({}, { take: null }),
|
||||
salesChannelService.listSalesChannels({}, { take: null }),
|
||||
productService.listProductTypes({}, {}),
|
||||
productService.listProductCollections({}, {}),
|
||||
salesChannelService.listSalesChannels({}, {}),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -55,12 +55,9 @@ export const parseProductCsvStep = createStep(
|
||||
const [allRegions, allTags] = await Promise.all([
|
||||
regionService.listRegions(
|
||||
{},
|
||||
{ select: ["id", "name", "currency_code"], take: null }
|
||||
),
|
||||
productService.listProductTags(
|
||||
{},
|
||||
{ select: ["id", "value"], take: null }
|
||||
{ select: ["id", "name", "currency_code"] }
|
||||
),
|
||||
productService.listProductTags({}, { select: ["id", "value"] }),
|
||||
])
|
||||
|
||||
const normalizedData = normalizeForImport(v1Normalized, {
|
||||
|
||||
@@ -66,7 +66,6 @@ async function getCurrentRegionPaymentProvidersLinks(
|
||||
service: LINKS.RegionPaymentProvider,
|
||||
variables: {
|
||||
filters: { region_id: regionIds },
|
||||
take: null,
|
||||
},
|
||||
fields: ["region_id", "payment_provider_id"],
|
||||
} as any)) as {
|
||||
|
||||
Reference in New Issue
Block a user