fix(workflow-engine-*): pass container to flow (#9180)

This commit is contained in:
Carlos R. L. Rodrigues
2024-09-18 08:44:11 -03:00
committed by GitHub
parent 1c4d3f32cb
commit adbeb9cc1d
2 changed files with 10 additions and 20 deletions

View File

@@ -166,17 +166,14 @@ export class WorkflowOrchestratorService {
)
}
const flow = exportedWorkflow(
(container as MedusaContainer) ?? this.container_
)
const ret = await flow.run({
const ret = await exportedWorkflow.run({
input,
throwOnError,
logOnError,
resultFrom,
context,
events,
container: container ?? this.container_,
})
const hasFinished = ret.transaction.hasFinished()
@@ -276,17 +273,13 @@ export class WorkflowOrchestratorService {
throw new Error(`Workflow with id "${workflowId}" not found.`)
}
const flow = exportedWorkflow(
(container as MedusaContainer) ?? this.container_
)
const events = this.buildWorkflowEvents({
customEventHandlers: eventHandlers,
transactionId,
workflowId,
})
const ret = await flow.registerStepSuccess({
const ret = await exportedWorkflow.registerStepSuccess({
idempotencyKey: idempotencyKey_,
context,
resultFrom,
@@ -294,6 +287,7 @@ export class WorkflowOrchestratorService {
logOnError,
events,
response: stepResponse,
container: container ?? this.container_,
})
if (ret.transaction.hasFinished()) {
@@ -343,17 +337,13 @@ export class WorkflowOrchestratorService {
throw new Error(`Workflow with id "${workflowId}" not found.`)
}
const flow = exportedWorkflow(
(container as MedusaContainer) ?? this.container_
)
const events = this.buildWorkflowEvents({
customEventHandlers: eventHandlers,
transactionId,
workflowId,
})
const ret = await flow.registerStepFailure({
const ret = await exportedWorkflow.registerStepFailure({
idempotencyKey: idempotencyKey_,
context,
resultFrom,
@@ -361,6 +351,7 @@ export class WorkflowOrchestratorService {
logOnError,
events,
response: stepResponse,
container: container ?? this.container_,
})
if (ret.transaction.hasFinished()) {

View File

@@ -220,6 +220,7 @@ export class WorkflowOrchestratorService {
resultFrom,
context,
events,
container: container ?? this.container_,
})
const hasFinished = ret.transaction.hasFinished()
@@ -332,6 +333,7 @@ export class WorkflowOrchestratorService {
logOnError,
events,
response: stepResponse,
container: container ?? this.container_,
})
if (ret.transaction.hasFinished()) {
@@ -381,17 +383,13 @@ export class WorkflowOrchestratorService {
throw new Error(`Workflow with id "${workflowId}" not found.`)
}
const flow = exportedWorkflow(
(container as MedusaContainer) ?? this.container_
)
const events = this.buildWorkflowEvents({
customEventHandlers: eventHandlers,
transactionId,
workflowId,
})
const ret = await flow.registerStepFailure({
const ret = await exportedWorkflow.registerStepFailure({
idempotencyKey: idempotencyKey_,
context,
resultFrom,
@@ -399,6 +397,7 @@ export class WorkflowOrchestratorService {
logOnError,
events,
response: stepResponse,
container: container ?? this.container_,
})
if (ret.transaction.hasFinished()) {