Commit Graph

41 Commits

Author SHA1 Message Date
Adrien de Peretti
7a351eef09 feat(workflows-sdk): Execute workflows as step in other workflows (#7183) 2024-05-02 11:29:28 -03:00
github-actions[bot]
2c807df99d chore: Version Packages (#6839)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-01 09:48:24 +02:00
Stevche Radevski
fd83e75e4b feat: Add support for batch method for products and product variants (#7038)
* feat(products): Add batch methods for product and variants

* chore: Rename batch validator and minor changes based on PR review
2024-04-15 16:48:29 +02:00
Adrien de Peretti
eac4d2d87a fix(): workflow sdk step return function type infer (#7047) 2024-04-10 15:49:09 +02:00
Carlos R. L. Rodrigues
df0751f122 Feat: draft order api (#6797) 2024-04-06 16:35:10 +02:00
Carlos R. L. Rodrigues
d333db0842 chore(orchestration): serialize error (#6967) 2024-04-06 11:22:48 +02:00
Adrien de Peretti
71aeda7347 fix(workflows-sdk): Handle result from a trasnformer after a step fail (#6951)
* fix(workflows-sdk): Handle result from a trasnformer after a step fail

* Create plenty-ravens-lay.md

* fix
2024-04-05 08:59:28 +02:00
Carlos R. L. Rodrigues
a164c0d512 feat(workflows-sdk,orchestration): async step as background task (#6886) 2024-04-03 11:17:00 +02:00
Carlos R. L. Rodrigues
e603726985 fix(workflow-engine-*): subscribe response and error (#6869) 2024-03-29 08:23:41 +00:00
Carlos R. L. Rodrigues
45c49e89f2 chore(workflows-sdk): add idempotencyKey to shared context (#6860) 2024-03-28 17:51:29 +00:00
Adrien de Peretti
d4d1f9b2f2 fix: integration tests modules expectations (#6848)
**What**
- fix tests
- cleanup deprecated jest conf
2024-03-27 15:39:20 +00:00
github-actions[bot]
74e17ee6f9 chore: Version Packages (#6757)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-26 18:04:04 +01:00
Carlos R. L. Rodrigues
7e93eda1a4 feat(orchestration,workflows-sdk,core-flows): workflow cancel (#6778) 2024-03-22 15:03:06 +01:00
Carlos R. L. Rodrigues
3ca957ec0f feat(workflows-sdk): additional properties to context (#6760) 2024-03-20 17:59:03 +01:00
github-actions[bot]
26c9bada0a chore: Version Packages (#6360)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-20 10:21:30 +01:00
Adrien de Peretti
4b06c17dc0 fix(workflows-sdk): Value resolver should resolve non StepResponse (#6726) 2024-03-18 21:07:04 +01:00
Riqwan Thamir
9288f53327 feat(core-flows,medusa,pricing,types,utils): added price list workflows + endpoints (#6648)
Apologies for the giant PR in advance, but most of these are removing of files and migrations from old workflows and routes to new.

What:

- Adds CRUD endpoints for price lists
- Migrate workflows from old sdk to new
- Added missing updatePriceListPrices method to pricing module
2024-03-15 11:09:02 +00:00
Oli Juhl
8c57e61cb8 feat: Refresh payment collection + delete session (#6594)
### What
Add workflow for refreshing a payment collection. 

The idea is that on all cart updates, we want two things to happen (in the context of payments) 1. the currently active payment sessions should be destroyed, and 2. the payment collection should be updated with the new cart total.

We do this to ensure that we always collect the correct payment amount. 

From a customer perspective, this would mean that every time something on the cart is updated, the customer would need to enter their payment details anew. 

To me, this is a good tradeoff to avoid inconsistencies with payment collection.

Additionally, I updated the Payment Module interface with `upsert` and `updated` following our established convention.

### Note
This PR depends on a fix to the `remoteJoiner` that @carlos-r-l-rodrigues is working on.

Update: Fix merged in #6602 

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-03-07 13:32:20 +00:00
Oli Juhl
7ebe885ec9 feat: Create cart with line items (#6449)
**What**
- Add support for creating a cart with items
- Add endpoint `POST /store/carts/:id/line-items`
- Add `CreateCartWorkflow`
- Add `AddToCartWorkflow`
- Add steps for both workflows

**Testing**
- Endpoints
- Workflows

I would still call this a first iteration, as we are missing a few pieces of the full flow, such as payment sessions, discounts, and taxes.

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-02-26 13:32:16 +00:00
Riqwan Thamir
ac86362e81 feat(workflows-sdk,core-flows,medusa,types): add workflow to update promotions to cart (#6474)
what:

- adds API + workflow to add/remove promotions in a cart
- minor fixes in promotions module
- minor type fixes in cart module
- typing fix in workflows-sdk (Thanks @adrien2p)
- fix step result in workflows-sdk (Thanks @adrien2p)

RESOLVES CORE-1768

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-02-26 12:43:57 +00:00
Adrien de Peretti
f611865553 fix(workflows-sdk): Fix StepFunction typings and custom step name (#6468)
* fix(workflows=sdk): Fix StepFunction typings and custom step name

* Create smart-nails-switch.md

* fixes

* fixes

* fixes

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-02-22 11:59:53 +01:00
Carlos R. L. Rodrigues
0c2a460751 feat(medusa): workflow engine api (#6330)
What:

   Workflow Engine API.
   Endpoints for:
     - List workflow executions
     - Run a workflow
     - Set async steps as success or failure
     - Retrieve the details of a workflow run
2024-02-13 15:19:10 +00:00
github-actions[bot]
16851c557d chore: Version Packages (#6241)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-02-08 16:23:19 +01:00
Carlos R. L. Rodrigues
45134e4d11 chore: local workflow proxying methods to pass context (#6263)
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.
2024-02-01 13:37:26 +00:00
github-actions[bot]
3d0ae72887 chore: Version Packages (#6039)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-01-25 16:23:53 +01:00
Carlos R. L. Rodrigues
302323916b feat: Workflow engine modules (#6128) 2024-01-23 10:08:08 -03:00
Adrien de Peretti
738e9115ec feat(workflows-sdk): run, registerStepSuccess and registerStepFailure shortcut (#6164)
**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 
```
2024-01-22 19:14:18 +00:00
Carlos R. L. Rodrigues
19bbae61f8 fix(modules-sdk): create workflow returning step transformer (#6102) 2024-01-17 09:17:37 -03:00
github-actions[bot]
47272bf2b9 chore: Version Packages (#5880) 2024-01-09 18:41:35 +01:00
Shahed Nasser
18de90e603 docs: fix tsdocs following typedoc update + 1.20 release (#6033)
* docs: fix tsdocs following typedoc update + 1.20 release

* Fix OAS validation errors

* fixes to react-docs-generator

* fix content linting
2024-01-09 17:15:29 +02:00
Adrien de Peretti
fbee006e51 chore(medusa, orchestration, utils, workflows-sdk): add transaction options support and cleanup (#6020)
* chore(medusa, orchestration, utils, workflows-sdk): add transaction options support and cleanup
2024-01-08 10:07:12 -03:00
Adrien de Peretti
bf63c4e6a3 feat(orchestration, workflows-sdk): Add events management and implementation to manage async workflows (#5951)
* 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>
2024-01-05 14:40:58 +01:00
Adrien de Peretti
a0dd18c12a feat(workflows-sdk): Allow primitive values to be passed as well as WorkflowDataProperties (#5953)
* feat(workflows-sdk): Allow primitive values to be passed as well as WorkflowDataProperties

* feat(workflows-sdk): improve playground tests

* Create nine-shrimps-reply.md
2023-12-22 07:39:28 +01:00
Adrien de Peretti
8402f46970 feat(workflows-sdk): Allow a step to not define an expected input (#5775)
**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
  })
```
2023-12-21 13:41:58 +00:00
Adrien de Peretti
9cc787cac4 feat(workflows-sdk): Configurable retries upon step creation (#5728)
**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.
2023-12-19 09:38:27 +00:00
Adrien de Peretti
946db51a9b chore(): Add engines to all package.json if needed (#5812) 2023-12-07 17:03:50 +01:00
Shahed Nasser
892d737c1f docs: enhance how references are generated (#5805)
* 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
2023-12-05 15:29:41 +02:00
github-actions[bot]
935e9f0561 chore: Version Packages (#5673)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-27 16:43:51 +00:00
olivermrbl
285fa92876 chore(workflows-sdk): Change version for release 2023-11-27 08:10:57 +00:00
Carlos R. L. Rodrigues
ffb0c7b4cd feat(workflows-sdk): get name method (#5714) 2023-11-24 16:39:27 +00:00
Adrien de Peretti
ddbeed4ea6 chore(workflows, core-flows): Split workflows tooling and definitions (#5705) 2023-11-24 13:55:48 +00:00