feat: deprecate remoteQueryConfig in favor of queryConfig (#10773)

Fixes: FRMW-2783
This commit is contained in:
Harminder Virk
2025-01-03 14:16:23 +05:30
committed by GitHub
parent 54e1e70d78
commit 5e9d86d75d
200 changed files with 375 additions and 399 deletions
@@ -24,7 +24,7 @@ export const POST = async (
const apiKey = await refetchApiKey(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ api_key: apiKey })
@@ -19,7 +19,7 @@ export const GET = async (
const apiKey = await refetchApiKey(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!apiKey) {
@@ -46,7 +46,7 @@ export const POST = async (
const apiKey = await refetchApiKey(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ api_key: apiKey })
@@ -32,7 +32,7 @@ export const POST = async (
const updatedApiKey = await refetchApiKey(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ api_key: updatedApiKey })
@@ -20,9 +20,9 @@ export const GET = async (
entryPoint: "api_key",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: apiKeys, metadata } = await remoteQuery(queryObject)
@@ -20,7 +20,7 @@ export const POST = async (
const campaign = await refetchCampaign(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ campaign })
@@ -19,7 +19,7 @@ export const GET = async (
const campaign = await refetchCampaign(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!campaign) {
@@ -62,7 +62,7 @@ export const POST = async (
const campaign = await refetchCampaign(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ campaign })
}
@@ -21,9 +21,9 @@ export const GET = async (
entryPoint: "campaign",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: campaigns, metadata } = await remoteQuery(query)
@@ -54,7 +54,7 @@ export const POST = async (
const campaign = await refetchCampaign(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ campaign })
@@ -37,7 +37,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -73,7 +73,7 @@ export const DELETE = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -30,7 +30,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -51,7 +51,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -37,7 +37,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -72,7 +72,7 @@ export const DELETE = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -31,7 +31,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -37,7 +37,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -73,7 +73,7 @@ export const DELETE = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -30,7 +30,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject)
@@ -36,7 +36,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderClaim] = await remoteQuery(queryObject, {
@@ -14,7 +14,7 @@ export const GET = async (
"order_claim",
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!claim) {
@@ -24,9 +24,9 @@ export const GET = async (
filters: {
...req.filterableFields,
},
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: claims, metadata } = await remoteQuery(queryObject)
@@ -64,7 +64,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order, orderClaim] = await promiseAll([
@@ -25,7 +25,7 @@ export const POST = async (
const collection = await refetchCollection(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -19,7 +19,7 @@ export const GET = async (
const collection = await refetchCollection(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ collection })
@@ -49,7 +49,7 @@ export const POST = async (
const collection = await refetchCollection(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ collection })
@@ -22,9 +22,9 @@ export const GET = async (
entryPoint: "product_collection",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: collections, metadata } = await remoteQuery(query)
@@ -54,7 +54,7 @@ export const POST = async (
const collection = await refetchCollection(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ collection })
@@ -17,7 +17,7 @@ export const GET = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "currency",
variables,
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [currency] = await remoteQuery(queryObject)
@@ -15,9 +15,9 @@ export const GET = async (
entryPoint: "currency",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: currencies, metadata } = await remoteQuery(queryObject)
@@ -26,7 +26,7 @@ export const POST = async (
const customerGroup = await refetchCustomerGroup(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer_group: customerGroup })
}
@@ -19,7 +19,7 @@ export const GET = async (
const customerGroup = await refetchCustomerGroup(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!customerGroup) {
@@ -58,7 +58,7 @@ export const POST = async (
const customerGroup = await refetchCustomerGroup(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer_group: customerGroup })
}
@@ -21,9 +21,9 @@ export const GET = async (
entryPoint: "customer_group",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: customer_groups, metadata } = await remoteQuery(query)
@@ -55,7 +55,7 @@ export const POST = async (
const customerGroup = await refetchCustomerGroup(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer_group: customerGroup })
@@ -25,7 +25,7 @@ export const GET = async (
variables: {
filters: { id: req.params.address_id, customer_id: req.params.id },
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [address] = await remoteQuery(queryObject)
@@ -53,7 +53,7 @@ export const POST = async (
const customer = await refetchCustomer(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer })
@@ -73,7 +73,7 @@ export const DELETE = async (
const customer = await refetchCustomer(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -22,9 +22,9 @@ export const GET = async (
entryPoint: "customer_address",
variables: {
filters: { ...req.filterableFields, customer_id: customerId },
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: addresses, metadata } = await remoteQuery(query)
@@ -60,7 +60,7 @@ export const POST = async (
const customer = await refetchCustomer(
customerId,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer })
@@ -24,11 +24,7 @@ export const POST = async (
},
})
const customer = await refetchCustomer(
id,
req.scope,
req.remoteQueryConfig.fields
)
const customer = await refetchCustomer(id, req.scope, req.queryConfig.fields)
res.status(200).json({ customer: customer })
}
@@ -18,7 +18,7 @@ export const GET = async (
const customer = await refetchCustomer(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!customer) {
@@ -58,7 +58,7 @@ export const POST = async (
const customer = await refetchCustomer(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer })
}
@@ -22,9 +22,9 @@ export const GET = async (
entryPoint: "customers",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: customers, metadata } = await remoteQuery(query)
@@ -58,7 +58,7 @@ export const POST = async (
const customer = await refetchCustomer(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ customer })
@@ -30,9 +30,9 @@ export const GET = async (
...req.filterableFields,
is_draft_order: true,
},
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: draft_orders, metadata } = await remoteQuery(queryObject)
@@ -90,7 +90,7 @@ export const POST = async (
const draftOrder = await refetchOrder(
result.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ draft_order: draftOrder })
@@ -51,7 +51,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -37,7 +37,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -73,7 +73,7 @@ export const DELETE = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -31,7 +31,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -37,7 +37,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -73,7 +73,7 @@ export const DELETE = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -30,7 +30,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject)
@@ -36,7 +36,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [orderExchange] = await remoteQuery(queryObject, {
@@ -14,7 +14,7 @@ export const GET = async (
"order_exchange",
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!exchange) {
@@ -24,9 +24,9 @@ export const GET = async (
filters: {
...req.filterableFields,
},
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: exchanges, metadata } = await remoteQuery(queryObject)
@@ -64,7 +64,7 @@ export const POST = async (
...req.filterableFields,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order, orderExchange] = await promiseAll([
@@ -17,9 +17,9 @@ export const GET = async (
entryPoint: "fulfillment_provider",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: fulfillment_providers, metadata } = await remoteQuery(
@@ -33,7 +33,7 @@ export const GET = async (
variables: {
id: req.params.zone_id,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
)
@@ -85,7 +85,7 @@ export const POST = async (
variables: {
id: req.params.id,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
)
@@ -25,7 +25,7 @@ export const POST = async (
const fulfillmentSet = await refetchFulfillmentSet(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ fulfillment_set: fulfillmentSet })
@@ -18,7 +18,7 @@ export const POST = async (
const fulfillment = await refetchFulfillment(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ fulfillment })
@@ -24,7 +24,7 @@ export const POST = async (
const fulfillment = await refetchFulfillment(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ fulfillment })
@@ -23,7 +23,7 @@ export const POST = async (
const fulfillment = await refetchFulfillment(
fullfillment.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ fulfillment })
@@ -52,7 +52,7 @@ export const DELETE = async (
const inventoryItem = await refetchInventoryItem(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -77,7 +77,7 @@ export const POST = async (
const inventoryItem = await refetchInventoryItem(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -33,7 +33,7 @@ export const POST = async (
const inventoryItem = await refetchInventoryItem(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ inventory_item: inventoryItem })
}
@@ -50,9 +50,9 @@ export const GET = async (
entryPoint: "inventory_levels",
variables: {
filters: { ...req.filterableFields, inventory_item_id: id },
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: inventory_levels, metadata } = await remoteQuery(query)
@@ -19,7 +19,7 @@ export const GET = async (
const inventoryItem = await refetchInventoryItem(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!inventoryItem) {
throw new MedusaError(
@@ -49,7 +49,7 @@ export const POST = async (
const inventoryItem = await refetchInventoryItem(
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -22,7 +22,7 @@ export const POST = async (
const inventoryItem = await refetchInventoryItem(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ inventory_item: inventoryItem })
@@ -38,9 +38,9 @@ export const GET = async (
entryPoint: "inventory_items",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: inventory_items, metadata } = await remoteQuery({
@@ -18,7 +18,7 @@ export const POST = async (
const invite = await refetchInvite(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ invite })
@@ -13,11 +13,7 @@ export const GET = async (
res: MedusaResponse<HttpTypes.AdminInviteResponse>
) => {
const { id } = req.params
const invite = await refetchInvite(
id,
req.scope,
req.remoteQueryConfig.fields
)
const invite = await refetchInvite(id, req.scope, req.queryConfig.fields)
if (!invite) {
throw new MedusaError(
@@ -20,9 +20,9 @@ export const GET = async (
entryPoint: "invite",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: invites, metadata } = await remoteQuery(queryObject)
@@ -52,7 +52,7 @@ export const POST = async (
const invite = await refetchInvite(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ invite })
@@ -14,7 +14,7 @@ export const GET = async (
"notification",
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ notification })
}
@@ -13,8 +13,8 @@ export const GET = async (
"notification",
req.filterableFields,
req.scope,
req.remoteQueryConfig.fields,
req.remoteQueryConfig.pagination
req.queryConfig.fields,
req.queryConfig.pagination
)
res.json({
@@ -23,7 +23,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables: { id },
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -29,7 +29,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -23,7 +23,7 @@ export const GET = async (
order_id: id,
},
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const order_changes = await remoteQuery(queryObject)
@@ -26,7 +26,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables: { id },
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -34,7 +34,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -20,7 +20,7 @@ export const POST = async (
"order",
orderId,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ order })
@@ -34,7 +34,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -28,7 +28,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables: { id: req.params.id },
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -22,9 +22,7 @@ export const GET = async (
...req.filterableFields,
order_id: id,
},
fields: deduplicate(
req.remoteQueryConfig.fields.concat(["item_id", "version"])
),
fields: deduplicate(req.queryConfig.fields.concat(["item_id", "version"])),
})
const data = result.data
@@ -20,7 +20,7 @@ export const GET = async (
const workflow = getOrderDetailWorkflow(req.scope)
const { result } = await workflow.run({
input: {
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
order_id: req.params.id,
version: req.validatedQuery.version as number,
},
@@ -46,7 +46,7 @@ export const POST = async (
const result = await query.graph({
entity: "order",
filters: { id: req.params.id },
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
res.status(200).json({ order: result.data[0] as AdminOrder })
@@ -26,7 +26,7 @@ export const POST = async (
const result = await query.graph({
entity: "order",
filters: { id: orderId },
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
res.status(200).json({ order: result.data[0] as AdminOrder })
@@ -31,7 +31,7 @@ export const POST = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "order",
variables,
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [order] = await remoteQuery(queryObject)
@@ -14,13 +14,13 @@ export const GET = async (
...req.filterableFields,
is_draft_order: false,
},
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
}
const workflow = getOrdersListWorkflow(req.scope)
const { result } = await workflow.run({
input: {
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
variables,
},
})
@@ -25,7 +25,7 @@ export const POST = async (
"payment_collection",
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ payment_collection: paymentCollection })
@@ -19,7 +19,7 @@ export const POST = async (
"payment_collection",
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ payment_collection: paymentCollection })
@@ -21,11 +21,7 @@ export const POST = async (
},
})
const payment = await refetchPayment(
id,
req.scope,
req.remoteQueryConfig.fields
)
const payment = await refetchPayment(id, req.scope, req.queryConfig.fields)
res.status(200).json({ payment })
}
@@ -20,11 +20,7 @@ export const POST = async (
},
})
const payment = await refetchPayment(
id,
req.scope,
req.remoteQueryConfig.fields
)
const payment = await refetchPayment(id, req.scope, req.queryConfig.fields)
res.status(200).json({ payment })
}
@@ -13,7 +13,7 @@ export const GET = async (
const payment = await refetchPayment(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ payment })
@@ -17,9 +17,9 @@ export const GET = async (
entryPoint: "payment_provider",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: payment_providers, metadata } = await remoteQuery(queryObject)
@@ -17,9 +17,9 @@ export const GET = async (
entryPoint: "payment",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: payments, metadata } = await remoteQuery(queryObject)
@@ -39,11 +39,7 @@ export const POST = async (
},
})
const priceList = await fetchPriceList(
id,
req.scope,
req.remoteQueryConfig.fields
)
const priceList = await fetchPriceList(id, req.scope, req.queryConfig.fields)
res.status(200).json({ price_list: priceList })
}
@@ -17,7 +17,7 @@ export const GET = async (
const price_list = await fetchPriceList(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ price_list })
@@ -34,11 +34,7 @@ export const POST = async (
input: { price_lists_data: [{ ...req.validatedBody, id }] },
})
const price_list = await fetchPriceList(
id,
req.scope,
req.remoteQueryConfig.fields
)
const price_list = await fetchPriceList(id, req.scope, req.queryConfig.fields)
res.status(200).json({ price_list })
}
@@ -21,9 +21,9 @@ export const GET = async (
entryPoint: "price_list",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: priceLists, metadata } = await remoteQuery(queryObject)
@@ -48,7 +48,7 @@ export const POST = async (
const price_list = await fetchPriceList(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ price_list })
@@ -18,7 +18,7 @@ export const GET = async (
"price_preference",
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ price_preference })
@@ -39,7 +39,7 @@ export const POST = async (
"price_preference",
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ price_preference })
@@ -15,8 +15,8 @@ export const GET = async (
"price_preference",
req.filterableFields,
req.scope,
req.remoteQueryConfig.fields,
req.remoteQueryConfig.pagination
req.queryConfig.fields,
req.queryConfig.pagination
)
res.json({
price_preferences: price_preferences,
@@ -39,7 +39,7 @@ export const POST = async (
"price_preference",
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ price_preference })
@@ -23,7 +23,7 @@ export const POST = async (
"product_category",
id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_category: category })
@@ -25,7 +25,7 @@ export const GET = async (
"product_category",
{ id: req.params.id, ...req.filterableFields },
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
if (!category) {
@@ -52,7 +52,7 @@ export const POST = async (
"product_category",
{ id, ...req.filterableFields },
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_category: category })
@@ -14,8 +14,8 @@ export const GET = async (
"product_category",
req.filterableFields,
req.scope,
req.remoteQueryConfig.fields,
req.remoteQueryConfig.pagination
req.queryConfig.fields,
req.queryConfig.pagination
)
res.json({
@@ -38,7 +38,7 @@ export const POST = async (
"product_category",
{ id: result[0].id, ...req.filterableFields },
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_category: category })
@@ -23,7 +23,7 @@ export const GET = async (
"product_tag",
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_tag: productTag })
@@ -58,7 +58,7 @@ export const POST = async (
"product_tag",
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_tag: productTag })
@@ -16,8 +16,8 @@ export const GET = async (
"product_tag",
req.filterableFields,
req.scope,
req.remoteQueryConfig.fields,
req.remoteQueryConfig.pagination
req.queryConfig.fields,
req.queryConfig.pagination
)
res.json({
@@ -42,7 +42,7 @@ export const POST = async (
"product_tag",
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_tag: productTag })
@@ -22,7 +22,7 @@ export const GET = async (
const productType = await refetchProductType(
req.params.id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_type: productType })
@@ -55,7 +55,7 @@ export const POST = async (
const productType = await refetchProductType(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_type: productType })
@@ -20,9 +20,9 @@ export const GET = async (
entryPoint: "product_type",
variables: {
filters: req.filterableFields,
...req.remoteQueryConfig.pagination,
...req.queryConfig.pagination,
},
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const { rows: product_types, metadata } = await remoteQuery(queryObject)
@@ -48,7 +48,7 @@ export const POST = async (
const productType = await refetchProductType(
result[0].id,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_type: productType })
@@ -11,12 +11,12 @@ export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminProductVariantParams>,
res: MedusaResponse<HttpTypes.AdminProductVariantListResponse>
) => {
const withInventoryQuantity = req.remoteQueryConfig.fields.some((field) =>
const withInventoryQuantity = req.queryConfig.fields.some((field) =>
field.includes("inventory_quantity")
)
if (withInventoryQuantity) {
req.remoteQueryConfig.fields = req.remoteQueryConfig.fields.filter(
req.queryConfig.fields = req.queryConfig.fields.filter(
(field) => !field.includes("inventory_quantity")
)
}
@@ -25,8 +25,8 @@ export const GET = async (
"variant",
{ ...req.filterableFields },
req.scope,
remapKeysForVariant(req.remoteQueryConfig.fields ?? []),
req.remoteQueryConfig.pagination
remapKeysForVariant(req.queryConfig.fields ?? []),
req.queryConfig.pagination
)
if (withInventoryQuantity) {
@@ -21,7 +21,7 @@ export const GET = async (
"product_option",
{ id: optionId, product_id: productId },
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ product_option: productOption })
@@ -49,7 +49,7 @@ export const POST = async (
"product",
productId,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({ product: remapProductResponse(product) })
@@ -71,7 +71,7 @@ export const DELETE = async (
"product",
productId,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({
@@ -18,8 +18,8 @@ export const GET = async (
"product_option",
{ ...req.filterableFields, product_id: productId },
req.scope,
req.remoteQueryConfig.fields,
req.remoteQueryConfig.pagination
req.queryConfig.fields,
req.queryConfig.pagination
)
res.json({
@@ -55,7 +55,7 @@ export const POST = async (
"product",
productId,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({ product: remapProductResponse(product) })
}
@@ -15,7 +15,7 @@ export const GET = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.AdminProductResponse>
) => {
const selectFields = remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
const selectFields = remapKeysForProduct(req.queryConfig.fields ?? [])
const product = await refetchEntity(
"product",
req.params.id,
@@ -66,7 +66,7 @@ export const POST = async (
"product",
result[0].id,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({ product: remapProductResponse(product) })
@@ -28,7 +28,7 @@ export const POST = async (
const variant = await refetchVariant(
variantId,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ variant })
@@ -55,7 +55,7 @@ export const DELETE = async (
const parent = await refetchVariant(
variantId,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -29,7 +29,7 @@ export const POST = async (
const variant = await refetchVariant(
variantId,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({ variant })
@@ -28,7 +28,7 @@ export const GET = async (
"variant",
variables,
req.scope,
remapKeysForVariant(req.remoteQueryConfig.fields ?? [])
remapKeysForVariant(req.queryConfig.fields ?? [])
)
res.status(200).json({ variant: remapVariantResponse(variant) })
@@ -56,7 +56,7 @@ export const POST = async (
"product",
productId,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({ product: remapProductResponse(product) })
@@ -78,7 +78,7 @@ export const DELETE = async (
"product",
productId,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({
@@ -31,7 +31,7 @@ export const POST = async (
const batchResults = await refetchBatchVariants(
result,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -19,12 +19,12 @@ export const GET = async (
) => {
const productId = req.params.id
const withInventoryQuantity = req.remoteQueryConfig.fields.some((field) =>
const withInventoryQuantity = req.queryConfig.fields.some((field) =>
field.includes("inventory_quantity")
)
if (withInventoryQuantity) {
req.remoteQueryConfig.fields = req.remoteQueryConfig.fields.filter(
req.queryConfig.fields = req.queryConfig.fields.filter(
(field) => !field.includes("inventory_quantity")
)
}
@@ -33,8 +33,8 @@ export const GET = async (
"variant",
{ ...req.filterableFields, product_id: productId },
req.scope,
remapKeysForVariant(req.remoteQueryConfig.fields ?? []),
req.remoteQueryConfig.pagination
remapKeysForVariant(req.queryConfig.fields ?? []),
req.queryConfig.pagination
)
if (withInventoryQuantity) {
@@ -73,7 +73,7 @@ export const POST = async (
"product",
productId,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({ product: remapProductResponse(product) })
@@ -17,7 +17,7 @@ export const POST = async (
const batchResults = await refetchBatchProducts(
result,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json({
@@ -10,7 +10,7 @@ export const POST = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<HttpTypes.AdminExportProductResponse>
) => {
const selectFields = remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
const selectFields = remapKeysForProduct(req.queryConfig.fields ?? [])
const input = { select: selectFields, filter: req.filterableFields }
const { transaction } = await exportProductsWorkflow(req.scope).run({
@@ -12,14 +12,14 @@ export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminProductListParams>,
res: MedusaResponse<HttpTypes.AdminProductListResponse>
) => {
const selectFields = remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
const selectFields = remapKeysForProduct(req.queryConfig.fields ?? [])
const { rows: products, metadata } = await refetchEntities(
"product",
req.filterableFields,
req.scope,
selectFields,
req.remoteQueryConfig.pagination
req.queryConfig.pagination
)
res.json({
@@ -46,7 +46,7 @@ export const POST = async (
"product",
result[0].id,
req.scope,
remapKeysForProduct(req.remoteQueryConfig.fields ?? [])
remapKeysForProduct(req.queryConfig.fields ?? [])
)
res.status(200).json({ product: remapProductResponse(product) })
@@ -29,7 +29,7 @@ export const GET = async (
const queryObject = remoteQueryObjectFromString({
entryPoint: "promotion",
variables: { id },
fields: req.remoteQueryConfig.fields,
fields: req.queryConfig.fields,
})
const [promotion] = await remoteQuery(queryObject)
@@ -30,7 +30,7 @@ export const POST = async (
const batchResults = await refetchBatchRules(
result,
req.scope,
req.remoteQueryConfig.fields
req.queryConfig.fields
)
res.status(200).json(batchResults)

Some files were not shown because too many files have changed in this diff Show More