v2.0.1-preview
medusajs/medusav2.0.1-previewJul 11, 2024by olivermrbl
AI Summary
Preview release introducing the When-then utility for conditional step execution in workflows, improvements to the Migrations CLI, and a revamped Tax Regions UI.
Key Highlights
- New `when-then` utility for conditional execution of steps in workflows.
- Migrations CLI improvements and breaking changes (revert requires module name).
- Tax Regions domain revamped in the Medusa Admin UI.
Breaking Changes
- The `medusa migrations revert` command now requires one or more module names.
New Features
- Step conditional execution in workflows
- Workflow to update/delete/create order change actions
- Tax Regions UI
- Update toast design
- Cancel order changes workflow
- Add tax inclusivity management to currency
- Plug tax inclusivity in cart and order workflows
- Add static server and adjust file local to work out of the box
- Add types to the workflow conditional
- HTTP endpoints and workflows for price preference management
- Improvements to the migrations CLI and workflow
- Begin returns, claims and exchanges
- Add updated Metadata Form
Full Release Notes
<!--

# Medusa Preview Release update #1
CMS_BREAK -->
## Get started with new project
To get started using the preview release, run the following command:
```bash
npx create-medusa-app@preview
```
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
## Update existing project
Ensure your **Medusa** dependencies in `package.json` are using the `preview` tag:
```json
{
"dependencies": {
"@medusajs/medusa": "preview",
"@medusajs/pricing": "preview",
"@medusajs/product": "preview",
...
}
}
```
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
```tsx
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
```
## Highlights
### Migrations CLI
🚧 Breaking change
The migrations workflow and CLI output have changed. Here's a summary of the changes.
- The commands remain the same as npx medusa migrations run and npx medusa migrations revert
- The CLI output has been changed to be more visually appealing and add separate migrations logs for each module with a line break
**Breaking changes**
The revert command has a breaking change that it requires one or more module names to perform the revert. It means, the action revert is not valid at the global/app level. It must be executed on a specific module.
If you are developing a custom module, you can run the revert command for it as follows:
```
# helloWorld is the moduleName
npx medusa migrations revert helloWorld
```
### When-then utility for conditional execution of steps in Workflows
We have added a new when-then utility to execute steps conditionally.
Here's a basic example of its usage within a workflow:
```ts
const workflow = createWorkflow("workflow", function (input) {
const result = when(input, (input) => {
return input.someConditionalData
}).then(() => {
const otherResult = someStep({ ... })
return otherResult
})
return someOtherStep(result)
}
)
```
### Tax Regions UI update
The Tax Regions domain in Medusa Admin has been revamped, improving the overall UI and UX.
## Features
* feat(workflows-sdk): step conditional by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/7912
* feat(core-flows, types): add workflow to update order change actions by @riqwan in https://github.com/medusajs/medusa/pull/8080
* feat(core-flows, types): workflow to delete order change actions by @riqwan in https://github.com/medusajs/medusa/pull/8064
* feat(core-flows, order): add workflow to create change order actions by @riqwan in https://github.com/medusajs/medusa/pull/8056
* feat(dashboard,types,js-sdk,ui): Tax Regions UI by @kasperkristensen in https://github.com/medusajs/medusa/pull/7935
* feat: Update toast design by @kasperkristensen in https://github.com/medusajs/medusa/pull/8018
* feat(core-flows,types): cancel order changes workflow by @riqwan in https://github.com/medusajs/medusa/pull/8035
* feat(order,core-flows): added order change create workflow by @riqwan in https://github.com/medusajs/medusa/pull/8033
* feat: Add support in BE for setting tax inclusivity on currency by @sradevski in https://github.com/medusajs/medusa/pull/8037
* feat: Plug tax inclusivity in cart and order workflows by @sradevski in https://github.com/medusajs/medusa/pull/8013
* feat: Add necessary middlewares for tax inclusive pricing by @sradevski in https://github.com/medusajs/medusa/pull/7827
* Feat: Add tax inclusivity to admin by @sradevski in https://github.com/medusajs/medusa/pull/8003
* feat: Add static server and adjust file local to work out of the box by @sradevski in https://github.com/medusajs/medusa/pull/8019
* feat: Add types to the workflow conditional by @adrien2p in https://github.com/medusajs/medusa/pull/7979
* feat: Add HTTP endpoints and workflows for price preference management by @sradevski in https://github.com/medusajs/medusa/pull/7960
* feat: Initial implementation with programmatic APIs by @thetutlage in https://github.com/medusajs/medusa/pull/7973
* feat: Improvements to the migrations CLI and workflow by @thetutlage in https://github.com/medusajs/medusa/pull/8060
* feat(core-flows): begin returns, claims and exchanges by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8088
* feat(dashboard,medusa): Add updated Metadata Form by @kasperkristensen in https://github.com/medusajs/medusa/pull/8084
## Bugs
* fix: Improve get caller file path util by @adrien2p in https://github.com/medusajs/medusa/pull/7974
* fix: error 4082 when using defineLink by @adrien2p in https://github.com/medusajs/medusa/pull/8014
* fix(create-medusa-app): remove glob-related warnings by @shahednasser in https://github.com/medusajs/medusa/pull/7985
* fix(notification): fix notification loader error by @riqwan in https://github.com/medusajs/medusa/pull/7969
* fix(vite-plugin-admin): Ensure UI Routes are HMR by @kasperkristensen in https://github.com/medusajs/medusa/pull/7982
* fix(dashboard): Hide edit rank button when no categories exist by @kasperkristensen in https://github.com/medusajs/medusa/pull/7986
* fix(dashboard): StockLocations overview sidebar by @kasperkristensen in https://github.com/medusajs/medusa/pull/7984
* fix(docs) : Fix wrong model names in the Marketplace recipe by @adevinwild in https://github.com/medusajs/medusa/pull/8002
* fix: Modules providers loading mechanism to infer the source dir by @adrien2p in https://github.com/medusajs/medusa/pull/8015
* fix(notification): fix notification loader error by @riqwan in https://github.com/medusajs/medusa/pull/7969
* fix(vite-plugin-admin): Ensure UI Routes are HMR by @kasperkristensen in https://github.com/medusajs/medusa/pull/7982
* fix(dashboard): Hide edit rank button when no categories exist by @kasperkristensen in https://github.com/medusajs/medusa/pull/7986
* fix(dashboard): StockLocations overview sidebar by @kasperkristensen in https://github.com/medusajs/medusa/pull/7984
* fix(docs) : Fix wrong model names in the Marketplace recipe by @adevinwild in https://github.com/medusajs/medusa/pull/8002
* fix: Modules providers loading mechanism to infer the source dir by @adrien2p in https://github.com/medusajs/medusa/pull/8015
* fix: Test failing after recent changes by @sradevski in https://github.com/medusajs/medusa/pull/8031
* fix: Have shipping options open by default by @sradevski in https://github.com/medusajs/medusa/pull/8040
* fix(dashboard): JSON view by @kasperkristensen in https://github.com/medusajs/medusa/pull/8038
* fix(dashboard): Shipping Type tooltip by @kasperkristensen in https://github.com/medusajs/medusa/pull/8042
* fix(admin-vite-plugin): ensure forward slashes are used for paths by @kasperkristensen in https://github.com/medusajs/medusa/pull/8023
* fix(dashboard): Allow cmd+click on table rows by @kasperkristensen in https://github.com/medusajs/medusa/pull/8045
* fix(core-flows): order partial fulfillment by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8047
* fix(dashboard): Add safe zone around link Table rows by @kasperkristensen in https://github.com/medusajs/medusa/pull/8058
* fix(ui): Use correct text style for primary button by @kasperkristensen in https://github.com/medusajs/medusa/pull/8059
* fix(dashboard, medusa): mark shipped flow by @fPolic in https://github.com/medusajs/medusa/pull/8065
* fix(dashboard): stock location hook cache invalidation by @fPolic in https://github.com/medusajs/medusa/pull/8049
* fix(tax): Add indexes to enforce unique constraint on tax region by @olivermrbl in https://github.com/medusajs/medusa/pull/8067
* fix(utils): define link alias + pluralize by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8070
* fix: Investigate geo zones with address checks by @adrien2p in https://github.com/medusajs/medusa/pull/8066
* fix(migrations): small fix to the text by @shahednasser in https://github.com/medusajs/medusa/pull/8091
* fix: Gracefully handle migrations that cannot be reverted by @thetutlage in https://github.com/medusajs/medusa/pull/8087
## Documentation
* docs: restructure api-reference to allow base path by @shahednasser in https://github.com/medusajs/medusa/pull/7954
* docs: remove limitation on arrow functions in workflows by @shahednasser in https://github.com/medusajs/medusa/pull/7958
* docs: fix URL of Algolia cron job by @shahednasser in https://github.com/medusajs/medusa/pull/7957
* docs: fix edit button on resources homepage by @shahednasser in https://github.com/medusajs/medusa/pull/7967
* docs: fix pagination on mobile devices by @shahednasser in https://github.com/medusajs/medusa/pull/7968
* docs: fix page crashing when using google translate by @shahednasser in https://github.com/medusajs/medusa/pull/8009
* docs: fix type in module path by @shahednasser in https://github.com/medusajs/medusa/pull/8011
* docs: rename property when defining a list link by @shahednasser in https://github.com/medusajs/medusa/pull/8017
* docs: fix download button + other fixes by @shahednasser in https://github.com/medusajs/medusa/pull/8032
* docs: added chapter on managing relationships by @shahednasser in https://github.com/medusajs/medusa/pull/8043
* docs: update order module's conceptual guides by @shahednasser in https://github.com/medusajs/medusa/pull/7893
* docs: updates to local file module provider documentation by @shahednasser in https://github.com/medusajs/medusa/pull/8030
* docs: add a section about constraints on step return value by @shahednasser in https://github.com/medusajs/medusa/pull/8036
* docs: add a need help button by @shahednasser in https://github.com/medusajs/medusa/pull/8069
* docs: fix typo in curl command example by @MustafaM257 in https://github.com/medusajs/medusa/pull/8071
* docs: change event payload handling in subscribers by @shahednasser in https://github.com/medusajs/medusa/pull/8078
* docs: improvements to module and data model documentation by @shahednasser in https://github.com/medusajs/medusa/pull/8062
* docs: document when-then + migrations revert change by @shahednasser in https://github.com/medusajs/medusa/pull/8089
### Chores
* chore: rm database extra by @adrien2p in https://github.com/medusajs/medusa/pull/7963
* chore: Apply defineMikroOrmCliConfig by @adrien2p in https://github.com/medusajs/medusa/pull/7975
* chore: Rename entity to model by @adrien2p in https://github.com/medusajs/medusa/pull/7977
* chore: update docs issue template by @shahednasser in https://github.com/medusajs/medusa/pull/8012
* chore: rename source to linkable in defineLink options by @adrien2p in https://github.com/medusajs/medusa/pull/8016
* chore: Ensure the events are emitted with the same shape all accross by @adrien2p in https://github.com/medusajs/medusa/pull/8063
* chore: Migrate modules to use the Module util by @adrien2p in https://github.com/medusajs/medusa/pull/7964
* chore: Attempt to fix flaky migration tests by @thetutlage in https://github.com/medusajs/medusa/pull/8034
* chore(order): preview order change by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8025
* chore: properly infer return type from model config by @adrien2p in https://github.com/medusajs/medusa/pull/8079
* chore(dashboard): text changes and fixes by @shahednasser in https://github.com/medusajs/medusa/pull/7925
* chore: rename return flow by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8050
* chore: Ensure the events are emitted with the same shape all accross by @adrien2p in https://github.com/medusajs/medusa/pull/8063
## New Contributors
* @MustafaM257 made their first contribution in https://github.com/medusajs/medusa/pull/8071
**Full Changelog**: https://github.com/medusajs/medusa/compare/v2.0-preview...v2.0.1-preview