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:
1 parent
048620884b
commit
9d85e663b8
4 files changed
+11
-27
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/core-flows": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(core-flows): use useQueryGraphStep instead of useQueryStep
|
||||||
@@ -18,9 +18,9 @@ import {
|
|||||||
import {
|
import {
|
||||||
createRemoteLinkStep,
|
createRemoteLinkStep,
|
||||||
emitEventStep,
|
emitEventStep,
|
||||||
|
useQueryGraphStep,
|
||||||
useRemoteQueryStep,
|
useRemoteQueryStep,
|
||||||
} from "../../common"
|
} from "../../common"
|
||||||
import { useQueryStep } from "../../common/steps/use-query"
|
|
||||||
import { createOrdersStep } from "../../order/steps/create-orders"
|
import { createOrdersStep } from "../../order/steps/create-orders"
|
||||||
import { authorizePaymentSessionStep } from "../../payment/steps/authorize-payment-session"
|
import { authorizePaymentSessionStep } from "../../payment/steps/authorize-payment-session"
|
||||||
import { registerUsageStep } from "../../promotion/steps/register-usage"
|
import { registerUsageStep } from "../../promotion/steps/register-usage"
|
||||||
@@ -55,7 +55,7 @@ export const completeCartWorkflow = createWorkflow(
|
|||||||
(
|
(
|
||||||
input: WorkflowData<CompleteCartWorkflowInput>
|
input: WorkflowData<CompleteCartWorkflowInput>
|
||||||
): WorkflowResponse<{ id: string }> => {
|
): WorkflowResponse<{ id: string }> => {
|
||||||
const orderCart = useQueryStep({
|
const orderCart = useQueryGraphStep({
|
||||||
entity: "order_cart",
|
entity: "order_cart",
|
||||||
fields: ["cart_id", "order_id"],
|
fields: ["cart_id", "order_id"],
|
||||||
filters: { cart_id: input.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 { PaymentActions } from "@medusajs/utils"
|
||||||
import { createWorkflow, when } from "@medusajs/workflows-sdk"
|
import { createWorkflow, when } from "@medusajs/workflows-sdk"
|
||||||
import { completeCartWorkflow } from "../../cart/workflows/complete-cart"
|
import { completeCartWorkflow } from "../../cart/workflows/complete-cart"
|
||||||
import { useQueryStep } from "../../common/steps/use-query"
|
|
||||||
import { authorizePaymentSessionStep } from "../steps"
|
import { authorizePaymentSessionStep } from "../steps"
|
||||||
import { capturePaymentWorkflow } from "./capture-payment"
|
import { capturePaymentWorkflow } from "./capture-payment"
|
||||||
|
import { useQueryGraphStep } from "../../common"
|
||||||
|
|
||||||
interface ProcessPaymentWorkflowInput extends WebhookActionResult {}
|
interface ProcessPaymentWorkflowInput extends WebhookActionResult {}
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ export const processPaymentWorkflowId = "process-payment-workflow"
|
|||||||
export const processPaymentWorkflow = createWorkflow(
|
export const processPaymentWorkflow = createWorkflow(
|
||||||
processPaymentWorkflowId,
|
processPaymentWorkflowId,
|
||||||
(input: ProcessPaymentWorkflowInput) => {
|
(input: ProcessPaymentWorkflowInput) => {
|
||||||
const paymentData = useQueryStep({
|
const paymentData = useQueryGraphStep({
|
||||||
entity: "payment",
|
entity: "payment",
|
||||||
fields: ["id"],
|
fields: ["id"],
|
||||||
filters: { payment_session_id: input.data?.session_id },
|
filters: { payment_session_id: input.data?.session_id },
|
||||||
@@ -20,7 +20,7 @@ export const processPaymentWorkflow = createWorkflow(
|
|||||||
name: "payment-query",
|
name: "payment-query",
|
||||||
})
|
})
|
||||||
|
|
||||||
const paymentSessionResult = useQueryStep({
|
const paymentSessionResult = useQueryGraphStep({
|
||||||
entity: "payment_session",
|
entity: "payment_session",
|
||||||
fields: ["payment_collection_id"],
|
fields: ["payment_collection_id"],
|
||||||
filters: { id: input.data?.session_id },
|
filters: { id: input.data?.session_id },
|
||||||
@@ -28,7 +28,7 @@ export const processPaymentWorkflow = createWorkflow(
|
|||||||
name: "payment-session-query",
|
name: "payment-session-query",
|
||||||
})
|
})
|
||||||
|
|
||||||
const cartPaymentCollection = useQueryStep({
|
const cartPaymentCollection = useQueryGraphStep({
|
||||||
entity: "cart_payment_collection",
|
entity: "cart_payment_collection",
|
||||||
fields: ["cart_id"],
|
fields: ["cart_id"],
|
||||||
filters: {
|
filters: {
|
||||||
|
|||||||
Reference in new issue
Block a user