fix(workflow-engine-*): pass container to flow (#9180)
This commit is contained in:
@@ -166,17 +166,14 @@ export class WorkflowOrchestratorService {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const flow = exportedWorkflow(
|
const ret = await exportedWorkflow.run({
|
||||||
(container as MedusaContainer) ?? this.container_
|
|
||||||
)
|
|
||||||
|
|
||||||
const ret = await flow.run({
|
|
||||||
input,
|
input,
|
||||||
throwOnError,
|
throwOnError,
|
||||||
logOnError,
|
logOnError,
|
||||||
resultFrom,
|
resultFrom,
|
||||||
context,
|
context,
|
||||||
events,
|
events,
|
||||||
|
container: container ?? this.container_,
|
||||||
})
|
})
|
||||||
|
|
||||||
const hasFinished = ret.transaction.hasFinished()
|
const hasFinished = ret.transaction.hasFinished()
|
||||||
@@ -276,17 +273,13 @@ export class WorkflowOrchestratorService {
|
|||||||
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const flow = exportedWorkflow(
|
|
||||||
(container as MedusaContainer) ?? this.container_
|
|
||||||
)
|
|
||||||
|
|
||||||
const events = this.buildWorkflowEvents({
|
const events = this.buildWorkflowEvents({
|
||||||
customEventHandlers: eventHandlers,
|
customEventHandlers: eventHandlers,
|
||||||
transactionId,
|
transactionId,
|
||||||
workflowId,
|
workflowId,
|
||||||
})
|
})
|
||||||
|
|
||||||
const ret = await flow.registerStepSuccess({
|
const ret = await exportedWorkflow.registerStepSuccess({
|
||||||
idempotencyKey: idempotencyKey_,
|
idempotencyKey: idempotencyKey_,
|
||||||
context,
|
context,
|
||||||
resultFrom,
|
resultFrom,
|
||||||
@@ -294,6 +287,7 @@ export class WorkflowOrchestratorService {
|
|||||||
logOnError,
|
logOnError,
|
||||||
events,
|
events,
|
||||||
response: stepResponse,
|
response: stepResponse,
|
||||||
|
container: container ?? this.container_,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (ret.transaction.hasFinished()) {
|
if (ret.transaction.hasFinished()) {
|
||||||
@@ -343,17 +337,13 @@ export class WorkflowOrchestratorService {
|
|||||||
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const flow = exportedWorkflow(
|
|
||||||
(container as MedusaContainer) ?? this.container_
|
|
||||||
)
|
|
||||||
|
|
||||||
const events = this.buildWorkflowEvents({
|
const events = this.buildWorkflowEvents({
|
||||||
customEventHandlers: eventHandlers,
|
customEventHandlers: eventHandlers,
|
||||||
transactionId,
|
transactionId,
|
||||||
workflowId,
|
workflowId,
|
||||||
})
|
})
|
||||||
|
|
||||||
const ret = await flow.registerStepFailure({
|
const ret = await exportedWorkflow.registerStepFailure({
|
||||||
idempotencyKey: idempotencyKey_,
|
idempotencyKey: idempotencyKey_,
|
||||||
context,
|
context,
|
||||||
resultFrom,
|
resultFrom,
|
||||||
@@ -361,6 +351,7 @@ export class WorkflowOrchestratorService {
|
|||||||
logOnError,
|
logOnError,
|
||||||
events,
|
events,
|
||||||
response: stepResponse,
|
response: stepResponse,
|
||||||
|
container: container ?? this.container_,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (ret.transaction.hasFinished()) {
|
if (ret.transaction.hasFinished()) {
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ export class WorkflowOrchestratorService {
|
|||||||
resultFrom,
|
resultFrom,
|
||||||
context,
|
context,
|
||||||
events,
|
events,
|
||||||
|
container: container ?? this.container_,
|
||||||
})
|
})
|
||||||
|
|
||||||
const hasFinished = ret.transaction.hasFinished()
|
const hasFinished = ret.transaction.hasFinished()
|
||||||
@@ -332,6 +333,7 @@ export class WorkflowOrchestratorService {
|
|||||||
logOnError,
|
logOnError,
|
||||||
events,
|
events,
|
||||||
response: stepResponse,
|
response: stepResponse,
|
||||||
|
container: container ?? this.container_,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (ret.transaction.hasFinished()) {
|
if (ret.transaction.hasFinished()) {
|
||||||
@@ -381,17 +383,13 @@ export class WorkflowOrchestratorService {
|
|||||||
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
throw new Error(`Workflow with id "${workflowId}" not found.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const flow = exportedWorkflow(
|
|
||||||
(container as MedusaContainer) ?? this.container_
|
|
||||||
)
|
|
||||||
|
|
||||||
const events = this.buildWorkflowEvents({
|
const events = this.buildWorkflowEvents({
|
||||||
customEventHandlers: eventHandlers,
|
customEventHandlers: eventHandlers,
|
||||||
transactionId,
|
transactionId,
|
||||||
workflowId,
|
workflowId,
|
||||||
})
|
})
|
||||||
|
|
||||||
const ret = await flow.registerStepFailure({
|
const ret = await exportedWorkflow.registerStepFailure({
|
||||||
idempotencyKey: idempotencyKey_,
|
idempotencyKey: idempotencyKey_,
|
||||||
context,
|
context,
|
||||||
resultFrom,
|
resultFrom,
|
||||||
@@ -399,6 +397,7 @@ export class WorkflowOrchestratorService {
|
|||||||
logOnError,
|
logOnError,
|
||||||
events,
|
events,
|
||||||
response: stepResponse,
|
response: stepResponse,
|
||||||
|
container: container ?? this.container_,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (ret.transaction.hasFinished()) {
|
if (ret.transaction.hasFinished()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user