What:
- When calling a module's method inside a Local Workflow the MedusaContext is passed as the last argument to the method if not provided
- Add `requestId` to req
- A couple of fixes on Remote Joiner and the data fetcher for internal services
Why:
- The context used to initialize the workflow has to be shared with all modules. properties like transactionId will be used to emit events and requestId to trace logs for example.
**What**
Currently, when exporting a workflow using the workflowExport util, it is mandatory to first call the resulted function passing the container before being able to call run, registerStepSuccess or failure on it. Now, it is possible to either continue that way, or to directly call the run, registerStepSuccess or failure on the exported workflow and at that moment it is possible to pass a container if needed
e.g
```ts
const workflow = exportWorkflow("id" as any, "result_step", prepare)
const wfRunner = workflow(container)
wfRunner.run(...) // Here the container is not expected
```
or
```ts
const workflow = exportWorkflow("id" as any, "result_step", prepare)
workflow.run(...) // Here we can now pass an optional container
```
* feat(orchestration, workflows-sdk): Add events management and implementation to manage async workflows
* Create fresh-boxes-scream.md
* cleanup
* fix: resolveValue input ref
* resolve value recursive
* chore: resolve result value only for new api
* chore: save checkpoint before scheduling
* features
* fix: beginTransaction checking existing transaction
---------
Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
* feat(workflows-sdk): Allow primitive values to be passed as well as WorkflowDataProperties
* feat(workflows-sdk): improve playground tests
* Create nine-shrimps-reply.md
**What**
Allow a step to not define an expected input, previously even if no input was expected, an object was always expected to be passed to the stepFunction inside the workflow composition. Now
```ts
const stepWithoutArgs = createStep("step1", () => {
return new StepResponse("string")
})
const stepWithoutExepectedInput = createStep("step2", (_: {}, context) => {
console.log("input", _) // {}
return new StepResponse("string")
})
const workflow = createWorkflow("workflow1", () => {
stepWithoutArgs()
return stepWithoutExepectedInput()
})
workflow()
.run()
.then((res) => {
console.log(res.result) // string
})
```
**What**
- Allow to create step that can be configured to have a max retry
- Step end retry mechanism on permanent failure
Also added an API to override a step configuration from within the createWorkflow
```ts
const step = createStep({ name: "step", maxRetries: 3 }, async (_, context) => {
return new StepResponse({ output: "output" })
})
const workflow = createWorkflow("workflow", function () {
const res = step().config({ maxRetries: 5 }) // This will override the original maxRetries of 3
})
```
**NOTE**
We can maybe find another name than config on the step workflow data to override the step config.
* adjusted configurations
* enhancements to tool and configurations
* change reference in docs
* fixed issue in workflows reference
* added project name
* more optimizations
* fix context error
* added a types reference
* resolved missing types
* fix reference reflection types not having children
* add an expand url parameter
* added new option to the README
* added details about new option