fix(core-flows): use useQueryGraphStep instead of useQueryStep (#10643)
Replace usage of `useQueryStep` with `useGraphQueryStep` and remove `useQueryStep`, as it's not exported by the package and seems to be a duplicate of `useGraphQueryStep`
This commit is contained in:
5
.changeset/heavy-spies-thank.md
Normal file
5
.changeset/heavy-spies-thank.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/core-flows": patch
|
||||
---
|
||||
|
||||
fix(core-flows): use useQueryGraphStep instead of useQueryStep
|
||||
@@ -18,9 +18,9 @@ import {
|
||||
import {
|
||||
createRemoteLinkStep,
|
||||
emitEventStep,
|
||||
useQueryGraphStep,
|
||||
useRemoteQueryStep,
|
||||
} from "../../common"
|
||||
import { useQueryStep } from "../../common/steps/use-query"
|
||||
import { createOrdersStep } from "../../order/steps/create-orders"
|
||||
import { authorizePaymentSessionStep } from "../../payment/steps/authorize-payment-session"
|
||||
import { registerUsageStep } from "../../promotion/steps/register-usage"
|
||||
@@ -55,7 +55,7 @@ export const completeCartWorkflow = createWorkflow(
|
||||
(
|
||||
input: WorkflowData<CompleteCartWorkflowInput>
|
||||
): WorkflowResponse<{ id: string }> => {
|
||||
const orderCart = useQueryStep({
|
||||
const orderCart = useQueryGraphStep({
|
||||
entity: "order_cart",
|
||||
fields: ["cart_id", "order_id"],
|
||||
filters: { cart_id: input.id },
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { ContainerRegistrationKeys } from "@medusajs/utils"
|
||||
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
|
||||
|
||||
interface QueryInput {
|
||||
entity: string
|
||||
fields: string[]
|
||||
filters?: Record<string, unknown>
|
||||
context?: any
|
||||
}
|
||||
|
||||
export const useQueryStepId = "use-query"
|
||||
export const useQueryStep = createStep(
|
||||
useQueryStepId,
|
||||
async (data: QueryInput, { container }) => {
|
||||
const query = container.resolve(ContainerRegistrationKeys.QUERY)
|
||||
|
||||
const result = await query.graph(data)
|
||||
|
||||
return new StepResponse(result)
|
||||
}
|
||||
)
|
||||
@@ -2,9 +2,9 @@ import { WebhookActionResult } from "@medusajs/types"
|
||||
import { PaymentActions } from "@medusajs/utils"
|
||||
import { createWorkflow, when } from "@medusajs/workflows-sdk"
|
||||
import { completeCartWorkflow } from "../../cart/workflows/complete-cart"
|
||||
import { useQueryStep } from "../../common/steps/use-query"
|
||||
import { authorizePaymentSessionStep } from "../steps"
|
||||
import { capturePaymentWorkflow } from "./capture-payment"
|
||||
import { useQueryGraphStep } from "../../common"
|
||||
|
||||
interface ProcessPaymentWorkflowInput extends WebhookActionResult {}
|
||||
|
||||
@@ -12,7 +12,7 @@ export const processPaymentWorkflowId = "process-payment-workflow"
|
||||
export const processPaymentWorkflow = createWorkflow(
|
||||
processPaymentWorkflowId,
|
||||
(input: ProcessPaymentWorkflowInput) => {
|
||||
const paymentData = useQueryStep({
|
||||
const paymentData = useQueryGraphStep({
|
||||
entity: "payment",
|
||||
fields: ["id"],
|
||||
filters: { payment_session_id: input.data?.session_id },
|
||||
@@ -20,7 +20,7 @@ export const processPaymentWorkflow = createWorkflow(
|
||||
name: "payment-query",
|
||||
})
|
||||
|
||||
const paymentSessionResult = useQueryStep({
|
||||
const paymentSessionResult = useQueryGraphStep({
|
||||
entity: "payment_session",
|
||||
fields: ["payment_collection_id"],
|
||||
filters: { id: input.data?.session_id },
|
||||
@@ -28,7 +28,7 @@ export const processPaymentWorkflow = createWorkflow(
|
||||
name: "payment-session-query",
|
||||
})
|
||||
|
||||
const cartPaymentCollection = useQueryStep({
|
||||
const cartPaymentCollection = useQueryGraphStep({
|
||||
entity: "cart_payment_collection",
|
||||
fields: ["cart_id"],
|
||||
filters: {
|
||||
|
||||
Reference in New Issue
Block a user