Skip to content

Commit

Permalink
fix(core-flows): use useQueryGraphStep instead of useQueryStep (medus…
Browse files Browse the repository at this point in the history
…ajs#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`
  • Loading branch information
shahednasser authored Dec 18, 2024
1 parent 0486208 commit 9d85e66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-spies-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/core-flows": patch
---

fix(core-flows): use useQueryGraphStep instead of useQueryStep
4 changes: 2 additions & 2 deletions packages/core/core-flows/src/cart/workflows/complete-cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 },
Expand Down
21 changes: 0 additions & 21 deletions packages/core/core-flows/src/common/steps/use-query.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ 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 {}

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 },
}).config({
name: "payment-query",
})

const paymentSessionResult = useQueryStep({
const paymentSessionResult = useQueryGraphStep({
entity: "payment_session",
fields: ["payment_collection_id"],
filters: { id: input.data?.session_id },
}).config({
name: "payment-session-query",
})

const cartPaymentCollection = useQueryStep({
const cartPaymentCollection = useQueryGraphStep({
entity: "cart_payment_collection",
fields: ["cart_id"],
filters: {
Expand Down

0 comments on commit 9d85e66

Please sign in to comment.