Releases: medusajs/medusa
v2.0.6-preview
Highlights
Introduced identity registration in auth domain
π§ Breaking change
We have separated identity registration from authentication. For context about why this decision was made see #8683.
Introduced endpoint /auth/[scope]/[provider]/register
We have added an endpoint specifically for registering new identities. This change will only be used by providers that require registration, such as email-password.
Introduced method register
in auth provider and auth module
We have introduced a new method register
to the auth provider and auth module interfaces. This change will only be used by providers that require registration, such as email-password.
Examples of new authentication flows
Sign up with email-password:
POST /admin/invites -> admin creates invite
POST /auth/user/emailpass/register -> user registers identity
POST /admin/invites/accept -> invite is accepted passing the invite + auth token
Sign in with email-password:
POST /auth/user/emailpass -> authenticate with email-password
GET /admin/users/me -> get authenticated user
Sign up with Google:
POST /auth/user/google -> redirects to Google auth
POST /auth/user/google/callback -> Google hits callback URL, authenticates, and responds with user
POST /admin/invites/accept -> invite is accepted passing the invite + auth token
Sign up with Google:
POST /auth/user/google -> redirects to Google auth
POST /auth/user/google/callback -> Google hits callback URL, authenticates, and responds with user
GET /admin/users/me -> get authenticated user
Sign up as customer with email-password:
POST /auth/customer/emailpass/register -> customer registers identity
POST /store/customers -> customer is created
Sign in with email-password:
POST /auth/customer/emailpass -> authenticate customer with email-password
CLI commands to manage database operations
We have added a new namespace to our CLI specifically for database operations db:
.
Alongside the namespace, a range of new commands have been introduced:
db:create
: The command creates the database (if it is missing) and updates the .env filedb:migrate
: This command will run the migrations and sync the links, unless --skip-links flag is specifieddb:rollback
: Rolls-back last batch of migrations for one or more selected modulesdb:generate:
Generates migrations for one or more selected modulesdb:sync-links
: Ensures links between modules are in sync
Events
We have (re)introduced events in the product domain:
"product-category.created"
"product-category.updated"
"product-category.deleted"
"product-collection.created"
"product-collection.updated"
"product-collection.deleted"
"product-variant.updated"
"product-variant.created"
"product-variant.deleted"
"product.updated"
"product.created"
"product.deleted"
Documentation: Redesign completed
We have completed redesigning our documentation for Medusa 2.0, which includes an updated layout and a range of new components improving the overall user experience.
Explore the updated documentation here.
Documentation: Re-introduced AI assistant (beta)
We have (re)introduced our AI assistant for Medusa 2.0 to help guide you through our documentation and find what you are looking for as fast as possible.
Try out the new AI assistant here.
Features
- feat(dashboard): Hitting escape restores previous value by @kasperkristensen in #8654
- feat(workflows-sdk): log on error by @carlos-r-l-rodrigues in #8666
- feat(dashboard,core-flows,js-sdk,types,link-modules,payment): ability to copy payment link by @riqwan in #8630
- feat(dashboard): Wrap each route in an ErrorBoundary by @kasperkristensen in #8674
- feat(core-flows): create or update payment collections in RMA flows by @riqwan in #8676
- feat(dashboard,core-flows,js-sdk,types): ability to mark payment as paid by @riqwan in #8679
- feat(dashboard,core-flows): ability to refund payment post RMA flow by @riqwan in #8685
- fix(core-flows): account for unfulfilled items while generating order status by @riqwan in #8698
- feat(dashboard): add activities for order - claim, exchange, payment by @riqwan in #8702
- feat(core-flows): order edit request by @carlos-r-l-rodrigues in #8705
- chore(order): align mikroorm <> order module by @riqwan in #8710
- feat(fulfillment,order): add created_by fields to fulfillment, return, claim, exchange by @riqwan in #8711
- feat(medusa,types,core-flows): apply created_by values - claims, exchanges, returns, fulfillment by @riqwan in #8712
- feat: add missing crud to provider identity service by @christiananese in #8717
- feat(utils): use dotenv-expand to allow variables within env by @shahednasser in #8720
- feat(dashboard): order edit UI by @fPolic in #8700
- feat(core-flows,dashboard): adds item validations for claims, returns and exchanges by @riqwan in #8735
- feat(create-medusa-app): set database name to project name by @shahednasser in #8727
- feat(dashboard,types): add active order change panel - claims, exchanges & returns by @riqwan in #8738
- feat: add env editor utility to edit update .env files by @thetutlage in #8741
- feature: add db:create command by @thetutlage in #8760
- fix(dashboard): summary section return fixes by @fPolic in #8770
- feat: add sync links command by @thetutlage in #8775
- feat: move migrations commands to the new db namespace by @thetutlage in #8810
- feat: create auth provider identity by @christiananese in #8675
- feat: Separate registration from authentication in auth domain by @olivermrbl in #8683
- feat(dashboard): cancel return request by @fPolic in #8761
Bugs
- fix(dashboard): Use proper heading size by @kasperkristensen in #8658
- fix(promotion): validate rules accurately when attribute is scoped by context by @riqwan in #8655
- fix(payment-stripe): fix smallest unit calculation by @carlos-r-l-rodrigues in #8663
- fix: maintain connections pool by @thetutlage in #8670
- fix(dashboard): Fix minor issues with Reservations and Inventroy Create forms by @kasperkristensen in #8657
- chore(order): preview removed items by @carlos-r-l-rodrigues in #8680
- fix(dashboard): bust order preview cache to reset fulfilled quantity by @riqwan in #8687
- fix(types): pluralize by @carlos-r-l-rodrigues in #8709
- fix: enable next actions bar when refund is available by @riqwan in #8719
- fix(core-flows): allow backorder by @carlos-r-l-rodrigues in #8721
- fix: Log on error by default in async workflow executions by @sradevski in #8723
- chore(core-flows): test allow backorder by @carlos-r-l-rodrigues in #8725
- fix(admin-next,types): fixes order page from breaking in admin server by @riqwan in #8730
- fix(payment-stripe): fix rounding by @carlos-r-l-rodrigues in #8753
- fix: Doing update to cart with shipping options set removes them by @sradevski in #8752
- fix(orchestration, workflow-sdk): Local workflow separated orchestrator by @adrien2p in #8765
- fix: add missing typings to create provider identity by @christiananese in #8677
- fix: Cleanup error output and do not add red color to help output by @thetutlage in #8778
- fix(core-flows,order): return damaged items by @carlos-r-l-rodrigues in #8818
- fix(product): Add metadata to property to product category data model by @Alexnortung in #8766
Documentation
- docs: improve main docs and resources sidebar by @shahednasser in #8664
- docs: remove link to events reference by @shahednasser in #8669
- breaking: remove POSTGRES prefix env variables in favor of DATABASE prefix by @thetutlage in #8672
- docs: redesign notes by @shahednasser in #8661
- docs: redesign tables by @shahednasser in #8653
- docs: redesign footer by @shahednasser in https://github.com/...
v1.20.10
Bugs
- fix: Pass in data to PATCH call so cart amount is updated on quantity change by @Arsenalist in #8456
- fix(admin-ui): Fixed DropdownMenu inside a Modal zIndex issues by @adevinwild in #8358
- fix: Check if the SalesChannels FF is enabled on
/admin/products
by @adevinwild in #8357
Docs
- docs: fix service crud example by @MuhammadElsaeed in #8439
New Contributors
- @MuhammadElsaeed made their first contribution in #8439
Full Changelog: v1.20.9...1.20.10
v2.0.5-preview
Highlights
Product Category organizer component
We've polished the Product Category organizer component for a smoother drag-and-drop experience. As part of the polish, we've also fixed an issue with a dependency.
Email-pass as default authentication provider
π§ Breaking change
We've updated the default modules config to include email-password as a default authentication provider. This is a breaking change. To ensure your application will continue to run, you should install the preview version of the email-password provider package:
yarn add @medusajs/auth-emailpass@preview
Workflows Reference
We've introduced a reference of all workflows used in Medusa's core. It includes a visual representation of steps, hooks, and conditionals.
Explore the reference here.
Features
- feat: admin return reason list by @christiananese in #8482
- feat(medusa): filter shipping options by location by @riqwan in #8511
- feat(dashboard,js-sdk,types): ability to add refund reason and note by @riqwan in #8466
- feat(types,dashboard): ability to set shipping methods for claim by @riqwan in #8533
- feat: create return reason by @christiananese in #8516
- feat(create-medusa-app): prompt for database name with credentials by @shahednasser in #8552
- feat(core-flows,dashboard,medusa): fixes set of tiny bugs in claims flow by @riqwan in #8551
- feat(dashboard): BulkEditor Boolean cell behaviour by @kasperkristensen in #8418
- feat: Move userpass default definition to defineConfig instead of a hard-coded value by @sradevski in #8557
- feat(core-flows): introduce a generic create entities step by @riqwan in #8553
- feat(medusa-oas-cli): automatically fix missing circular references by @shahednasser in #8600
- feat(core-flow): order edit endpoints by @carlos-r-l-rodrigues in #8596
- feat(dashboard,core-flows,js-sdk,types,medusa): Add exchange UI + fixes by @riqwan in #8606
- feat(medusa,core-flows,types): API to create payment collections for order by @riqwan in #8617
Bugs
- fix(dashboard): Delete product media by @olivermrbl in #8506
- fix: Use local notification provider for feed channel by default by @sradevski in #8518
- fix(core-flows): fixes duplicate fulfillment issue by @riqwan in #8581
- fix(core-flows): fixes build fails by @riqwan in #8584
- fix(core-flows): add order transaction on capture by @carlos-r-l-rodrigues in #8591
- fix(chore-flows): update shipping method price by @carlos-r-l-rodrigues in #8592
- feat(core-flows,dashboard): add fixes to allow only outbound or inbound claims by @riqwan in #8590
- fix(notification): Disable notification providers by @olivermrbl in #8607
- fix(payment): Partial refunds by @olivermrbl in #8603
- fix(order): summary original_total by @carlos-r-l-rodrigues in #8616
- fix(pricing): Calculate price sets with amount 0 by @olivermrbl in #8622
- fix(order): order summary on order creation by @carlos-r-l-rodrigues in #8624
- fix: Remove the endpoint to create a user by @sradevski in #8629
- fix(order): update order summary when transactions change by @carlos-r-l-rodrigues in #8633
- chore: Remove create user tests that are no longer relevant by @sradevski in #8638
- fix(dashboard): Replace
react-nestable
with new SortableTree component by @kasperkristensen in #8599 - fix(dashboard): Check for displaying placeholder value by @kasperkristensen in #8649
- fix(dashboard): disable RMAs if there is no shipped items by @fPolic in #8652
Documentation
- docs-util: add support for workflows in markdown theme by @shahednasser in #8485
- docs: fix build errors + update medusa docs link by @shahednasser in #8550
- docs: added troubleshooting for using pnpm by @shahednasser in #8537
- docs: improve the workflow hooks guide by @shahednasser in #8538
- docs-util: associate an API route with the workflow it uses by @shahednasser in #8554
- docs: fixes and preparations for workflows reference by @shahednasser in #8579
- docs-util: fix OAS generation error by @shahednasser in #8577
- docs: redesign sidebar by @shahednasser in #8408
- docs: change from showing required to showing optional in types references by @shahednasser in #8593
- docs: add a section in the main docs on how to retrieve a relationship by @shahednasser in #8594
- docs: fix $lt and $gt in api reference by @shahednasser in #8580
- docs: change workflow diagram to list by @shahednasser in #8602
- docs: redesign pagination by @shahednasser in #8614
- docs: add associated workflow badge in api reference by @shahednasser in #8613
- docs: fix expand badge by @shahednasser in #8611
- docs: fix scroll top margin by @shahednasser in #8605
- docs: update colors and typography by @shahednasser in #8604
- docs: fix usage of AdminCreateProduct in validation of digital product recipe by @shahednasser in #8601
- docs: collapse sidebar by default in main docs + persist state by @shahednasser in #8608
- docs: redesign help button by @shahednasser in #8610
- docs-util: fix update OAS schema by @shahednasser in #8556
- docs: remove steps from workflows reference overview by @shahednasser in #8595
- docs: bug fixes for copy and color mode by @shahednasser in #8626
- docs: added edit date by @shahednasser in #8623
- docs: update algolia by @shahednasser in #8625
- docs: redesign code highlights + add default code titles by @shahednasser in #8628
Chores
- chore: normalize packages version by @carlos-r-l-rodrigues in #8492
- chore(core-flows): [4] export types and types, add basic TSDocs by @shahednasser in #8509
- chore(core-flows): [3] export types and types, add basic TSDocs by @shahednasser in #8507
- chore(core-flows): [2] export types and types, add basic TSDocs by @shahednasser in #8505
- chore(core-flows): [5] export types and types, add basic TSDocs by @shahednasser in #8510
- chore(core-flows): [6] export types and types, add basic TSDocs by @shahednasser in #8512
- chore(core-flows): [7] export types and types, add basic TSDocs by @shahednasser in #8514
- chore(core-flows): [8] export types and types, add basic TSDocs by @shahednasser in #8517
- chore(core-flows): [9] export types and types, add basic TSDocs by @shahednasser in #8519
- chore(core-flows): [11] export types and types, add basic TSDocs by @shahednasser in #8521
- chore(core-flows): [12] export types and types, add basic TSDocs by @shahednasser in #8522
- chore(core-flows): [14] export types and steps, add basic TSDocs by @shahednasser in #8524
- chore(core-flows): [16] export types and steps, add basic TSDocs by @shahednasser in #8527
- chore(core-flows): [17] export types and steps, add basic TSDocs by @shahednasser in #8528
- chore(core-flows): [18/18] export types and types, add basic TSDocs by @shahednasser in #8529
- chore(order): item update quantity by @carlos-r-l-rodrigue...
v2.0.4-preview
Highlights
Domain-specific Workflow Hooks
We recently introduced Workflow Hooks, allowing you to expose injection points in workflows for the consumer to perform custom logic.
Among Medusa's core workflows, you will find available hooks in the following domains:
- Products: create, update, and delete
- Orders: create, cancel, complete, create fulfillment, cancel fulfillment, and create shipment
- Promotions: create, update, delete, create campaign, update campaign, and delete campaign
- Carts: create and update
- Customers: create, update, delete, create address, update address, and delete address
Workflow hooks are consumed by registering a hook handler on the workflow. The hook handlers should be placed and registered in the /workflows/hooks
folder of your Medusa project. For example, here's how to use the product-created hook:
// workflows/hooks/product-created.ts
import { createProductsWorkflow } from "@medusajs/core-flows"
createProductsWorkflow.hooks.productCreated(( { products, additional_data }) => {
// run custom business logic
})
This hook receives the created products
and arbitrary additional_data
. The latter should be passed to the workflow upon running it:
await createProductsWorkflow(req.scope).run({
input: { products: [ ... ], additional_data: { ... } },
})
In combination with extending the request payload to receive additional data, you can achieve a range of different use cases with Workflow Hooks, e.g. linking a product with another resource. We will share recipes for many of these cases in the near future.
We will continuously add more Workflow Hooks to our core workflow, e.g. a hook to transform line item data and price before it's added to the cart. Keep an eye out for our preview release updates, as they will contain an overview of the new hooks.
Features
- feature: introduce additional_data to the product endpoints by @thetutlage in #8405
- feature: add hooks to customers modules workflows by @thetutlage in #8442
- feat(create-medusa-app, medusa): check Node.js version before installation. by @shahednasser in #8452
- feat(core-flows,order,medusa): exchange endpoints by @carlos-r-l-rodrigues in #8396
- feature: add hooks to campaigns by @thetutlage in #8450
- feat(core-flows,payment,medusa,types): Refund reasons management API by @riqwan in #8436
- feat: add claims/:id endpoint to admin api by @christiananese in #8465
- feature: add create and update cart hooks by @thetutlage in #8481
- feat(core-flows): manage inventory reservation of claims and exchanges by @carlos-r-l-rodrigues in #8448
- feat(dashboard): claims first implementation by @riqwan in #8468
- feat(core-flows,dashboard,medusa): ability to add and remove items to claim inbound by @riqwan in #8480
- feat(adshboard,types,medusa): enable adding notes/return reason to inbound claims by @riqwan in #8488
- feature: add workflows hooks to the order module by @thetutlage in #8496
- feature: share execution context with hook handlers by @thetutlage in #8501
Bugs
- fix(payment): validate total amount when refunding payment by @riqwan in #8437
- fix: Upgrade bullmq and adjust to breaking changes in repeatable jobs by @sradevski in #8446
- fix(order): return migration enum by @carlos-r-l-rodrigues in #8449
- fix(medusa): plus sign to space by @carlos-r-l-rodrigues in #8454
- fix: Use a global reference to distributed transaction and scheduler by @sradevski in #8462
- fix(core-flows): copy line items attribute by @carlos-r-l-rodrigues in #8471
- fix(core-flows): Unsetting reason on return items by @olivermrbl in #8470
- fix(core-flows): Allow return requests with no shipping by @olivermrbl in #8472
- fix(event-bus-redis): Consume job correct in worker by @olivermrbl in #8444
Documentation
- Update page.mdx by @420coupe in #8425
- docs: fix helloWorldLoader function definition by @letalumil in #8429
- docs: fix deployment link by @letalumil in #8431
- docs: fix ModuleRegistrationName import by @letalumil in #8434
- docs: fix node version in create-medusa-app reference by @shahednasser in #8443
- docs: added a chapter on how to emit an event by @shahednasser in #8414
- docs: added a section on sending requests to api routes in admin by @shahednasser in #8412
- docs: fix sidebar not updating when api reference path changes by @shahednasser in #8409
- docs: merge allOf in OAS to show all object types by @shahednasser in #8453
- docs: fixes to notification and file module guides by @shahednasser in #8451
- docs: added a note about admin customizations as arrow functions by @shahednasser in #8387
- docs-util: added workflows typedoc plugin by @shahednasser in #8463
- docs-util: added a namespaces plugin by @shahednasser in #8500
Chores
- chore(core-flows): add TSDocs to the emitEventStep by @shahednasser in #8413
- chore(utils): add missing imports in notification TSDocs by @shahednasser in #8447
- chore: added and updated TSDocs of order module service by @shahednasser in #8246
- chore(medusa,core-flows): cart payment collection link by @carlos-r-l-rodrigues in #8457
- chore: update notifcations drawer design by @christiananese in #8469
- chore(utils): improve to handle util by @carlos-r-l-rodrigues in #8487
- chore(core-flows): util to format inventory input by @carlos-r-l-rodrigues in #8483
- chore: fix actions generating docs by @shahednasser in #8486
- chore: use WithAdditionalData helper everywhere by @thetutlage in #8499
- chore(core-flows): [1] export types and types, add basic TSDocs by @shahednasser in #8504
New Contributors
- @420coupe made their first contribution in #8425
- @letalumil made their first contribution in #8429
- @christiananese made their first contribution in #8465
Full Changelog: v2.0.3-preview...v2.0.4-preview
v2.0.3-preview
Get started with a new project
To get started using the preview release, run the following command:
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.
Highlights
Workflow Hooks
π§ Breaking change
We have added a new helper, createHook
, to the workflows-sdk
. The createHook
helper exposes a hook from a workflow. Later (after the workflow has been composed), the workflow consumers can bind a handler to the hook to run custom logic.
Note
As of now, you can only register one hook handler, and the workflow orchestrator ignores the return value.
Exposing hook via createHook
import {
createStep,
createHook,
createWorkflow,
WorkflowResponse
} from '@medusajs/workflows-sdk'
const createProductStep = createStep('createProduct', function () {
// business logic for "createProduct"
})
const workflow = createWorkflow('name', function (input) {
createProductStep(input)
const productCreatedHook = createHook('productCreated', { productId: input.id })
return new WorkflowResponse(input, {
hooks: [productCreatedHook]
})
})
Points to note
- Unlike the
createStep
function, thecreateHook
method is called within the workflow composition callback. - You must return the created hooks from the composition callback. Returning of hooks is needed for the TypeScript engine to provide intellisense when registering a handler for the hook.
- Hooks are executed in the same position as they are defined within the composition callback
Registering the hook handler
The workflow user must register a hook handler to run custom logic within a workflow. They can do that as follows.
workflow.hooks.productCreated(() => {
// run custom business logic
})
Points to note
- The hook handler behaves similarly to a workflow step. It can run async code, will be retried, and can also have compensation behavior (defined as the 2nd parameter)
- There can only be one handler for a hook. If you need multiple handlers, you should create another workflow and register that as the hook handler (not supported yet).
- The return value of the hook handler is ignored in this first iteration.
Introducing the WorkflowResponse
class and breaking changes
The introduction of hooks has changed the return value of the createWorkflow
composition callback. Now, we must return both the workflow results and the configured hooks.
Instead of manually composing the return value, you can use the WorkflowResponse
class to construct the current response. The WorkflowResponse
class accepts the following parameters.
- The first parameter is the result of the workflow.
- The second parameter (optional) is a config object with configured hooks.
Product Import and Export
We have re-introduced Product Import and Export and simultaneously redesigned the notifications drawer in the dashboard.
Right now, we are polling for new notifications every third second, but we intend to introduce SSE (or a similar tech.) to enable real-time notifications.
Product Tag management UI
We have added Product Tag management in the dashboard. Find it in "Settings > Product Tags".
New Recipes: Subscriptions and Digital Products
We have added two new recipes covering how to add support for Subscriptions and Digital Product respectively. They both come with an example repository.
Check out the Subscription recipe here.
Check out the Digital Products recipe here.
Features
- feat(medusa): add stock_location_id filter to providers api by @riqwan in #8319
- Chore/order claims 2 by @carlos-r-l-rodrigues in #8312
- feat:Allow updating prices through product update workflow by @sradevski in #8316
- feat(orchestration,workflows-sdk): Skip step by @carlos-r-l-rodrigues in #8334
- feat: Add support for product export in UI by @sradevski in #8281
- feat(dashboard,icons,types,js-sdk): add providers to location UI by @riqwan in #8328
- feat: Add support for product imports by @sradevski in #8298
- breaking: implement workflow hooks (first iteration) by @thetutlage in #8346
- feat: Make product import v1 compatible by @sradevski in #8362
- feat(dashboard, types, js-sdk): Claims client, hooks and types by @fPolic in #8370
- feat: Cart API should also return billing_address.province by default by @josetr in #8293
- feat(core-flows, fulfillment): validate shipping options to stock locations by @riqwan in #8291
- feat(core-flows,medusa): add endpoint to add/remove fulfillment providers to location by @riqwan in #8299
- feat: update return request by @olivermrbl in #8302
- feat(dashboard,medusa,types): Add Product Tag management by @kasperkristensen in #8349
- feat(dashboard,js-sdk,types): add ability to capture payment from order page by @riqwan in #8368
- chore(core-flows): Order Exchange - initial workflows by @carlos-r-l-rodrigues in #8374
- feat: Add support for sorting export headers by @sradevski in #8386
- feat: Add
requested_at
+open
status to return by @olivermrbl in #8391 - feat: Show notice on new notifications by @sradevski in #8390
- feat: add hooks to product module's workflows by @thetutlage in #8389
- feat(dashboard,types,js-sdk,payment): ability to refund payment in order page by @riqwan in #8385
- feat(dashboard, js-sdk, types): receive return e2e by @fPolic in #8305
- feat: Use tag ids instead of values wherever possible by @sradevski in #8394
- feat: Add support for categories in product import and export by @sradevski in #8375
Bugs
- fix: Store private files in the static directory by default by @sradevski in #8325
- fix(core-flows,order): update action by @carlos-r-l-rodrigues in #8333
- fix(dashboard,types,js-sdk): Cleanup
settings/store
by @kasperkristensen in #8336 - fix(core-flows): delete receive return action by @carlos-r-l-rodrigues in #8350
- fix: Added more tests and fixed a couple of issues with product import by @sradevski in #8341
- fix(dashboard): Fix spacing, media, and missing tip in product create form by @kasperkristensen in #8338
- fix: Use region name in product pricing exports by @sradevski in #8373
- fix(framework): prepublish script by @adrien2p in #8377
- fix(framework): telemetry package version by @adrien2p in #8378
- fix: Correctly associate options to variants when variants for multiple products are created by @sradevski in #8285
- fix(core-flows): update receive returned item by @carlos-r-l-rodrigues in #8295
- fix(dashboard): Fix CountrySelect by @kasperkristensen in #8301
- fix(dashboard): Cell behaviour in DataGrid by @kasperkristensen in #8183
- fix: Updating product prices removed existing prices by @sradevski in #8388
- fix: Pass updatedCollections to the hook and not the step by @thetutlage in #8402
- fix(core-flows,utils,medusa): fix bug where payment collection across orders were getting updated by @riqwan in #8401
- fix: Check for existence of modules when seeding default data by @sradevski in #8406
- fix(framework/config): Properly resolve env variables by @adrien2p in #8411
- fix: Don't remove pricing if no variant is passed to update by @sradevski in #8416
Documentation
- docs: added guide on how to get product variant prices by @shahednasser in #8282
- docs: remove js client and medusa react references by @shahednasser in #8270
- docs: update deployment guides for storefront and admin by @shahednasser in #8279
- docs: added a service factory reference by @shahednasser in #8292
- docs-util: add docblock generator for models built with DML by @shahednasser in https:/...
v1.20.9
Fixes
- fix: Add fix for Stripe paid amount by @pepijn-vanvlaanderen in #8234
- fix: Pass cart_id so that prices can be calculated correctly. by @Arsenalist in #7554
- fix(admin): Allow
backend
to pass through in development by @kasperkristensen in #8231
Full Changelog: v1.20.8...v1.20.9
v2.0.2-preview
Get started with a new project
To get started using the preview release, run the following command:
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:
{
"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:
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 and Linking CLI
We have introduced new CLI commands for generating migrations and managing links between modules. The latter is used to ensure links are in sync.
To generate migrations in your module, you can run the following command:
npx medusa migrations generate <name of module>
To sync the links between modules, you can run the following command:
npx medusa links sync
In case your links are out of sync, you'll be guided through possible actions to take.
Explore our full CLI reference in our documentation.
New Middlewares API
π§ Breaking change
We have introduced a new way of defining middlewares for API Routes. This is a breaking change.
Instead of exporting a config from middlewares.ts
, you will now need to use a new utility function defineMiddlewares
.
To upgrade your project, you should apply the following changes:
- import { MiddlewareConfig } from '@medusajs/medusa'
+ import { defineMiddlewares } from '@medusajs/medusa'
- export const config: MiddlewareConfig = {
- routes: []
- }
+ export default defineMiddlewares({
+ routes: []
+ })
Read more about the new Middlewares API in our documentation.
Tax-inclusive Pricing
We have re-introduced tax-inclusive pricing. Tax-Inclusive pricing allows you to set the final prices for products and shipping options regardless of the customer's applicable tax rates. When tax-inclusive prices are used, Medusa automatically calculates the tax amount for a given price.
Read more about tax-inclusive pricing in our documentation.
Coming soon
The following are work-in-progress and will be released soon:
- Returns, Exchanges, and Claims of Orders
- Export and Import of Products
- Bulk Editor improvements
- Digital Products and Subscription Recipes
Features
- feat(core-flows,types): adds workflow to request item return by @riqwan in #8098
- feat(dashboard): allocate items by @fPolic in #8021
- feat(migrations): CLI generate command by @adrien2p in #8103
- feat(core-flows): request return on order exchanges and claims by @carlos-r-l-rodrigues in #8107
- feat: Add return shipping by @olivermrbl in #8106
- feat: Add tax inclusivity management to currenices by @sradevski in #8112
- feat: Admin Returns API by @olivermrbl in #8117
- feat: Add exchange return shipping by @olivermrbl in #8108
- feat: Returns order previews by @olivermrbl in #8135
- feat(core-flows,medusa,order): remove return shipping by @carlos-r-l-rodrigues in #8137
- feat(medusa): Order preview endpoint by @olivermrbl in #8144
- feat: Ensure async workflow executions have access to shared container by @sradevski in #8157
- feat: Add support for private files to file module by @sradevski in #8169
- feat(core-flows, medusa): remove request item return by @carlos-r-l-rodrigues in #8146
- feat(pricing): big number support by @carlos-r-l-rodrigues in #8113
- feat(core-flows,order): exchange/claim add item by @carlos-r-l-rodrigues in #8126
- feat: rework how links database migrations are managed by @adrien2p in #8162
- feat: Add product export endpoint and a dummy workflow by @sradevski in #8178
- feat: Add notification endpoints for admin by @sradevski in #8196
- feat(dashboard,js-sdk,types): Update app layout, and add user sdk methods by @kasperkristensen in #8182
- feat: Add support for exporting products in backend by @sradevski in #8214
- feat(medusa): allow filtering returns by
order_id
by @fPolic in #8225 - feat: Add skeleton for supporting product imports in BE by @sradevski in #8232
- feat: Extending API routes validators by @thetutlage in #8254
- feat: add extend router helper by @thetutlage in #8263
- feat(dashboard, order, medusa, types, js-sdk): Request return e2e flow by @fPolic in #7848
- feat(utils,link-modules): link between fulfillment provider and stock location by @riqwan in #8275
- feat: remove loading middlewares file in favor of routes-config files by @thetutlage in #8274
- feat: Implement notifications feed by @sradevski in #8224
- feat: Add basic support for importing products by @sradevski in #8266
Bugs
- fix: Migration generator and generated migrations by @adrien2p in #8090
- fix: Handle multiple id prop generation by @adrien2p in #8097
- fix: product module joiner config by @adrien2p in #8170
- fix(dashboard): product create input focus by @fPolic in #8095
- fix(utils): error message when isQueryable is possibly not enabled. by @shahednasser in #8096
- fix(dashboard): promotions disable conditions by @fPolic in #8104
- fix(payment, stripe) stripe payment cannot be captured by @silenaker in #8075
- fix(dashboard): reservation and price list fixes by @fPolic in #8110
- fix: defineMikroOrmCliConfig helper to provide default db credentials by @thetutlage in #8131
- fix: workflow return type inf missing type by @adrien2p in #8133
- fix(dashboard): create variant remove inventory quantity by @fPolic in #8129
- fix: install modules-sdk for test-utils to work by @adrien2p in #8142
- fix(core-flow): request item return reason by @carlos-r-l-rodrigues in #8152
- fix: Log error if a scheduled job handler throws by @sradevski in #8164
- fix(medusa): normalize build path by @carlos-r-l-rodrigues in #8166
- fix(dashboard): create SO modal by @fPolic in #8167
- fix: Remove the option to pass a container to workflow engine API by @sradevski in #8165
- fix: normalize path before consuming it while loading models by @adrien2p in #8194
- fix(medusa): rm default created at field by @adrien2p in #8213
- fix(utils): Fix inferrence of public method name and service registration name based on configuration by @adrien2p in #8237
- fix: Dont restart server if static file is added to the private folder by @sradevski in #8181
- fix: workflow 'when' should return T or undefined instead of Partial by @adrien2p in #8195
- fix(utils): totals calculation by @carlos-r-l-rodrigues in #8190
- fix(dashboard): fix header in create tax region form by @shahednasser in #8197
- fix(create-medusa-app): run links sync during setup by @shahednasser in #8215
- fix(admin-shared): Fix autocomplete for InjectionZones by @kasperkristensen in #8219
- fix(medusa): GET return/:id by @carlos-r-l-rodrigues in #8226
- fix(core-flows): create return items by @carlos-r-l-rodrigues in #8227
- fix: Event emitter not cleared in export tests by @sradevski in https...
v1.20.8
Features
- feat: add default remove options for scheduled jobs by @u11d-bartlomiej-galezowski in #8156
Bugs
- fix(create-medusa-app): ensure the latest create-next-app version is used by @shahednasser in #7806
- fix: remove products from product collection type in generated references by @shahednasser in #7812
- fix: Check if the SalesChannel FF is enabled before using it on the /admin/products/:id route by @adevinwild in #8120
Documentation
- docs: update admin auth api by @lekterable in #7710
- docs: store api ref reset password response tag by @ank-2222 in #7817
- docs: Update currencies.md by @gulshankumardev in #7843
- docs: prepare for v2 docs by @shahednasser in #7878
- docs: fix payment processor reference by @shahednasser in #7965
- docs: cancel building new docs on v1.x branch by @shahednasser in #7966
- docs: fix build:server command in plugin documentation by @shahednasser in #7970
- docs: fixed a typo in development docs by @yakin-ts in #7680
- docs(development): update typescript code examples by @ikhvost in #6195
- docs(development): fix yarn version by @xyzones in #6186
- docs: fixes to deployments of new docs on v1.x branch by @shahednasser in #7971
- docs: regenerate OAS + references to fix products in product collection by @shahednasser in #7976
- docs: added a note about retrieving the cart using Medusa React by @shahednasser in #7978
- docs(v1.x): fix page crashing when using google translate by @shahednasser in #8010
Chores
- chore(v1.x): remove docs actions no longer relevant by @shahednasser in #7686
- chore: Update create.mdx by @martinomancino in #7772
- chore(oas): fix inventory level titles in OAS by @shahednasser in #7890
- chore(utils): added declarationMap option to tsconfig by @shahednasser in #6937
- chore: fix CLI test by adding resolution for glob by @shahednasser in #8029
New Contributors
- @lekterable made their first contribution in #7710
- @martinomancino made their first contribution in #7772
- @ank-2222 made their first contribution in #7817
- @gulshankumardev made their first contribution in #7843
- @yakin-ts made their first contribution in #7680
- @ikhvost made their first contribution in #6195
- @u11d-bartlomiej-galezowski made their first contribution in #8156
Full Changelog: v1.20.7...v1.20.8
v2.0.1-preview
Get started with new project
To get started using the preview release, run the following command:
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:
{
"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:
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:
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 #7912
- feat(core-flows, types): add workflow to update order change actions by @riqwan in #8080
- feat(core-flows, types): workflow to delete order change actions by @riqwan in #8064
- feat(core-flows, order): add workflow to create change order actions by @riqwan in #8056
- feat(dashboard,types,js-sdk,ui): Tax Regions UI by @kasperkristensen in #7935
- feat: Update toast design by @kasperkristensen in #8018
- feat(core-flows,types): cancel order changes workflow by @riqwan in #8035
- feat(order,core-flows): added order change create workflow by @riqwan in #8033
- feat: Add support in BE for setting tax inclusivity on currency by @sradevski in #8037
- feat: Plug tax inclusivity in cart and order workflows by @sradevski in #8013
- feat: Add necessary middlewares for tax inclusive pricing by @sradevski in #7827
- Feat: Add tax inclusivity to admin by @sradevski in #8003
- feat: Add static server and adjust file local to work out of the box by @sradevski in #8019
- feat: Add types to the workflow conditional by @adrien2p in #7979
- feat: Add HTTP endpoints and workflows for price preference management by @sradevski in #7960
- feat: Initial implementation with programmatic APIs by @thetutlage in #7973
- feat: Improvements to the migrations CLI and workflow by @thetutlage in #8060
- feat(core-flows): begin returns, claims and exchanges by @carlos-r-l-rodrigues in #8088
- feat(dashboard,medusa): Add updated Metadata Form by @kasperkristensen in #8084
Bugs
- fix: Improve get caller file path util by @adrien2p in #7974
- fix: error 4082 when using defineLink by @adrien2p in #8014
- fix(create-medusa-app): remove glob-related warnings by @shahednasser in #7985
- fix(notification): fix notification loader error by @riqwan in #7969
- fix(vite-plugin-admin): Ensure UI Routes are HMR by @kasperkristensen in #7982
- fix(dashboard): Hide edit rank button when no categories exist by @kasperkristensen in #7986
- fix(dashboard): StockLocations overview sidebar by @kasperkristensen in #7984
- fix(docs) : Fix wrong model names in the Marketplace recipe by @adevinwild in #8002
- fix: Modules providers loading mechanism to infer the source dir by @adrien2p in #8015
- fix(notification): fix notification loader error by @riqwan in #7969
- fix(vite-plugin-admin): Ensure UI Routes are HMR by @kasperkristensen in #7982
- fix(dashboard): Hide edit rank button when no categories exist by @kasperkristensen in #7986
- fix(dashboard): StockLocations overview sidebar by @kasperkristensen in #7984
- fix(docs) : Fix wrong model names in the Marketplace recipe by @adevinwild in #8002
- fix: Modules providers loading mechanism to infer the source dir by @adrien2p in #8015
- fix: Test failing after recent changes by @sradevski in #8031
- fix: Have shipping options open by default by @sradevski in #8040
- fix(dashboard): JSON view by @kasperkristensen in #8038
- fix(dashboard): Shipping Type tooltip by @kasperkristensen in #8042
- fix(admin-vite-plugin): ensure forward slashes are used for paths by @kasperkristensen in #8023
- fix(dashboard): Allow cmd+click on table rows by @kasperkristensen in #8045
- fix(core-flows): order partial fulfillment by @carlos-r-l-rodrigues in #8047
- fix(dashboard): Add safe zone around link Table rows by @kasperkristensen in #8058
- fix(ui): Use correct text style for primary button by @kasperkristensen in #8059
- fix(dashboard, medusa): mark shipped flow by @fPolic in #8065
- fix(dashboard): stock location hook cache invalidation by @fPolic in #8049
- fix(tax): Add indexes to enforce unique constraint on tax region by @olivermrbl in #8067
- fix(utils): define link alias + pluralize by @carlos-r-l-rodrigues in #8070
- fix: Investigate geo zones with address checks by @adrien2p in #8066
- fix(migrations): small fix to the text by @shahednasser in #8091
- fix: Gracefully handle migrations that cannot be reverted by @thetutlage in #8087
Documentation
- docs: restructure api-reference to allow base path by @shahednasser in #7954
- docs: remove limitation on arrow functions in workflows by @shahednasser in #7958
- docs: fix URL of Algolia cron job by @shahednasser in #7957
- docs: fix edit button on resources homepage by @shahednasser in #7967
- docs: fix pagination on mobile devices by @shahednasser in #7968
- docs: fix page crashing when using google translate by @shahednasser in #8009
- docs: fix type in module path by @shahednasser in #8011
- docs: rename property when defining a list link by @shahednasser in #8017
- docs: fix download button + other fixes by @shahednasser in #8032
- docs: added chapter on managing relationships by @shahednasser in #8043
- docs: update order module's conceptual guides by @shahednasser in #7893
- docs: updates to local file module provider documentation by @shahednasser in #8030
- docs: add a section about constraints on step return value by @shahednasser in #8036
- docs: add a need he...
v2.0.0-preview
Medusa 2.0 Public Preview Release
Today, weβre excited to share a Preview Release of Medusa 2.0.
The following document covers resources, guides, and things to know about the first preview release of Medusa 2.0. It will help you get started and give you a high-level overview of your new Medusa 2.0 application and whatβs still to be done.
The preview release is not ready for production and is only intended for experimentation and development of new projects.
The release candidate later this year will include more fully-fledged resources for 2.0, including an overview of breaking changes, migration guides, and much more that will ensure a smoother onboarding.
We advise against upgrading your project to 2.0 at this point, as we are still working on documentating the best possible path.
These release notes are only intended to help you start and introduce you to your new Medusa 2.0 project. For a more in-depth exploration of the major upgrade, refer to our new documentation.
We are publishing this release to solicit early user and community feedback. Please file Issues for bug reports and/or submit Discussions with input or questions.
We thank you all very much in advance.
Get started
To get started using the preview release, run the following command:
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.
The folder structure of Medusa projects has changed:
my-project
βββ src
β βββ admin
β βββ api
β βββ jobs
β βββ subscribers
-β βββ services
-β βββ models
-β βββ migrations
-β βββ loaders
+β βββ modules
+β β βββ my-module
+β β βββ loaders
+β β βββ migrations
+β β βββ models
+β β βββ index.ts
+β β βββ service.ts
+β βββ workflows
βββ medusa-config.ts
The modules
folder replaces a lot of folders from a 1.0 project and will contain most business logic customizations in your Medusa 2.0 application. We highly encourage you to read the section of our docs covering this new concept in detail.
The workflows
folder holds your custom workflows. Workflows are a fundamental concept in cross-module operations and a core element of Medusa 2.0. Read more about workflows here.
Additionally, medusa-config.js
has been cleaned up and improved with a new type-safe utility function for defining the config for your Medusa project. The file can also now live as both a JS and TS file.
export default defineConfig({
projectConfig: {
http: {
storeCors: "<STORE_CORS>",
adminCors: "<ADMIN_CORS>",
authCors: "<AUTH_CORS>"
},
redisUrl: "<REDIS URL>",
databaseUrl: "<DATABASE_URL>",
},
admin: {
backendUrl: "https://my-medusa-server.medusajs.app",
},
})
You are now ready to explore all the new features in the preview release. However, we recommend reading through our documentation to fully understand what is new in 2.0 and how it differs from 1.0.
Additionally, you can find references and code snippets for our tools in our Learning Resources.
Keeping up with preview releases
We release preview versions every three hours. We recommend setting the version of your Medusa dependencies to preview
, so you can regularly update without knowing specific version numbers.
All your Medusa dependencies in package.json
should look something like this:
{
"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:
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
Whatβs new?
Medusa 2.0 is a huge upgrade, in fact, the biggest upgrade since we open-sourced the project four years ago. The upgrade comes with many new features and improvements, some of which are still work-in-progress. In the following sections, we will briefly cover these features and the parts of the product still subject to change. A more detailed changelog will be released as part of the release candidate and, subsequently, the official release later this year.
Admin dashboard
Our admin dashboard has been completely overhauled, improving its overall look and feel to provide end-users with a more cohesive and consistent experience.
Additionally, we have migrated away from Webpack to Vite, which improves the developer experience with features like HMR and allows us and our users to tap into a rich and flourishing community and plugin ecosystem.
Read more about the admin dashboard and its extension capabilities here.
A few admin flows have yet to be built. This is primarily around returns, exchanges, claims, and order edits. We expect to finalize these in the coming weeks.
Modules architecture
Our modules foundation has been re-architected to entirely decouple modules from one another, enabling greater composability, a new standalone usage mode, and a more approachable incremental adoption of Medusa.
Read more about the architecture refactor in our 2.0 announcement from earlier this year.
New commerce features
We saw reworking the module's architecture as an opportunity to rethink the feature set of some of the business domains in Medusa 1.x. As a result, we are excited to introduce a range of advanced capabilities across a series of modules. Here are a few noteworthy improvements:
- Stock location: Build omnichannel experiences with new stock location features, including βBuy online, pick up in-storeβ options.
- Inventory: Compose multi-part variants and share inventory across products with our new inventory management features
- Authentication: Enable authentication with external providers, such as Google, with our new authentication and user management features
- Promotion: Create granular promotions with our new rules engine. Use conditions to create bundled discounts, buy-get, spend-get, temporary campaigns, and more
Many other modules have also seen improvements. Browse through all of them in our learning resources.
Data modeling language
A core feature of Medusa is the ability to extend the default commerce application with additional business logic to cater to a specific use case, natively integrate with third-party providers, replace existing domains, and more.
At the core of extensions in Medusa 2.0 are modules, and at the core of modules are data models. Data models define the concepts living within your application. In our commerce modules, you find orders, products, customers, promotions, etc. By introducing your own data models, you extend this semantic layer of your application, enabling you to build features and custom workflows by integrating existing and new concepts. Because data models are at the core of every customization, we decided to make them easier to work with.
We are excited to announce a new data modeling language in Medusa 2.0 that will improve the experience of defining and working with data in your application. You can read more about the new feature here.
Below is a simple example of what data models will look like in 2.0:
Long-running Workflows
We are excited to extend our existing workflow capabilities with Long-running Workflows for processing long-running operations in the background. Instead of synchronously receiving a workflow's result, Long-running Workflows are subscribed to for status changes and execution progress. Additionally, the Long-running Workflows comes with an API for programmatically moving from one step to the next. These features make Long-running Workflows a great fit for use cases that require a human-in-the-loop or operations with a varying long-running execution time.
For example, we use Long-running Workflows extensively to build the infrastructure provisioning of Medusa Cloud.
Alongside the Long-running Workflows, we are also introducing a new admin section for managing them. Here, you can see currently executing and completed workflows, providing full transparency into your long-running operations.
Medusa 2.0 comes with much more than what is highlighted in this post. We will cover everything in-depth in the official release notes.
These release notes are published as a GitHub Discussion as well for comments and questions on the preview release.