v2.0.6-preview

medusajs/medusav2.0.6-previewAug 27, 2024by olivermrbl

AI Summary

This release separates identity registration from authentication, introduces new CLI database commands, and reintroduces product domain events.

Key Highlights

  • Separated identity registration from authentication (new `/auth/[scope]/[provider]/register` endpoint)
  • New `db:` namespace for CLI database commands
  • Reintroduced product domain events
  • Completed documentation redesign for v2

Breaking Changes

  • Introduced identity registration in auth domain (changes to auth flows)
  • Removed POSTGRES prefix env variables in favor of DATABASE prefix

New Features

  • Product Category organizer component polish
  • Workflow SDK error logging
  • Copy payment link ability
  • Wrap routes in ErrorBoundary
  • Create/update payment collections in RMA flows

Full Release Notes

<!-- 
![image](https://github.com/user-attachments/assets/e856dacd-8865-4dd0-b220-e3d7fc73b1ad)

# Medusa Preview Release update #6

CMS_BREAK -->

## 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:
```ts
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:
```ts
POST /auth/user/emailpass -> authenticate with email-password
GET /admin/users/me -> get authenticated user
```

Sign up with Google:
```ts
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:
```ts
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:
```ts
POST /auth/customer/emailpass/register -> customer registers identity
POST /store/customers -> customer is created
```

Sign in with email-password:
```ts
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 file
- `db:migrate`: This command will run the migrations and sync the links, unless --skip-links flag is specified
- `db:rollback`: Rolls-back last batch of migrations for one or more selected modules
- `db:generate:` Generates migrations for one or more selected modules
- `db:sync-links`: Ensures links between modules are in sync

### Events

We have (re)introduced events in the product domain:

```javascript
"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](https://docs.medusajs.com/v2). 

### 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](https://docs.medusajs.com/v2).

## Features
* feat(dashboard): Hitting escape restores previous value by @kasperkristensen in https://github.com/medusajs/medusa/pull/8654
* feat(workflows-sdk): log on error by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8666
* feat(dashboard,core-flows,js-sdk,types,link-modules,payment): ability to copy payment link by @riqwan in https://github.com/medusajs/medusa/pull/8630
* feat(dashboard): Wrap each route in an ErrorBoundary by @kasperkristensen in https://github.com/medusajs/medusa/pull/8674
* feat(core-flows): create or update payment collections in RMA flows by @riqwan in https://github.com/medusajs/medusa/pull/8676
* feat(dashboard,core-flows,js-sdk,types): ability to mark payment as paid by @riqwan in https://github.com/medusajs/medusa/pull/8679
* feat(dashboard,core-flows): ability to refund payment post RMA flow by @riqwan in https://github.com/medusajs/medusa/pull/8685
* fix(core-flows): account for unfulfilled items while generating order status by @riqwan in https://github.com/medusajs/medusa/pull/8698
* feat(dashboard): add activities for order - claim, exchange, payment by @riqwan in https://github.com/medusajs/medusa/pull/8702
* feat(core-flows): order edit request by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8705
* chore(order): align mikroorm <> order module by @riqwan in https://github.com/medusajs/medusa/pull/8710
* feat(fulfillment,order): add created_by fields to fulfillment, return, claim, exchange by @riqwan in https://github.com/medusajs/medusa/pull/8711
* feat(medusa,types,core-flows): apply created_by values - claims, exchanges, returns, fulfillment by @riqwan in https://github.com/medusajs/medusa/pull/8712
* feat: add missing crud to provider identity service by @christiananese in https://github.com/medusajs/medusa/pull/8717
* feat(utils): use dotenv-expand to allow variables within env by @shahednasser in https://github.com/medusajs/medusa/pull/8720
* feat(dashboard): order edit UI by @fPolic in https://github.com/medusajs/medusa/pull/8700
* feat(core-flows,dashboard): adds item validations for claims, returns and exchanges by @riqwan in https://github.com/medusajs/medusa/pull/8735
* feat(create-medusa-app): set database name to project name by @shahednasser in https://github.com/medusajs/medusa/pull/8727
* feat(dashboard,types): add active order change panel - claims, exchanges & returns by @riqwan in https://github.com/medusajs/medusa/pull/8738
* feat: add env editor utility to edit update .env files by @thetutlage in https://github.com/medusajs/medusa/pull/8741
* feature: add db:create command by @thetutlage in https://github.com/medusajs/medusa/pull/8760
* fix(dashboard): summary section return fixes by @fPolic in https://github.com/medusajs/medusa/pull/8770
* feat: add sync links command by @thetutlage in https://github.com/medusajs/medusa/pull/8775
* feat: move migrations commands to the new db namespace by @thetutlage in https://github.com/medusajs/medusa/pull/8810
* feat: create auth provider identity by @christiananese in https://github.com/medusajs/medusa/pull/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 https://github.com/medusajs/medusa/pull/8658
* fix(promotion): validate rules accurately when attribute is scoped by context by @riqwan in https://github.com/medusajs/medusa/pull/8655
* fix(payment-stripe): fix smallest unit calculation by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8663
* fix: maintain connections pool by @thetutlage in https://github.com/medusajs/medusa/pull/8670
* fix(dashboard): Fix minor issues with Reservations and Inventroy Create forms by @kasperkristensen in https://github.com/medusajs/medusa/pull/8657
* chore(order): preview removed items by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8680
* fix(dashboard): bust order preview cache to reset fulfilled quantity by @riqwan in https://github.com/medusajs/medusa/pull/8687
* fix(types): pluralize by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8709
* fix: enable next actions bar when refund is available by @riqwan in https://github.com/medusajs/medusa/pull/8719
* fix(core-flows): allow backorder by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8721
* fix: Log on error by default in async workflow executions by @sradevski in https://github.com/medusajs/medusa/pull/8723
* chore(core-flows): test allow backorder by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8725
* fix(admin-next,types): fixes order page from breaking in admin server by @riqwan in https://github.com/medusajs/medusa/pull/8730
* fix(payment-stripe): fix rounding by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8753
* fix: Doing update to cart with shipping options set removes them by @sradevski in https://github.com/medusajs/medusa/pull/8752
* fix(orchestration, workflow-sdk): Local workflow separated orchestrator by @adrien2p in https://github.com/medusajs/medusa/pull/8765
* fix: add missing typings to create provider identity by @christiananese in https://github.com/medusajs/medusa/pull/8677
* fix: Cleanup error output and do not add red color to help output by @thetutlage in https://github.com/medusajs/medusa/pull/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 https://github.com/medusajs/medusa/pull/8664
* docs: remove link to events reference by @shahednasser in https://github.com/medusajs/medusa/pull/8669
* breaking: remove POSTGRES prefix env variables in favor of DATABASE prefix by @thetutlage in https://github.com/medusajs/medusa/pull/8672
* docs: redesign notes by @shahednasser in https://github.com/medusajs/medusa/pull/8661
* docs: redesign tables by @shahednasser in https://github.com/medusajs/medusa/pull/8653
* docs: redesign footer by @shahednasser in https://github.com/medusajs/medusa/pull/8651
* docs: redesign vertical tabs by @shahednasser in https://github.com/medusajs/medusa/pull/8673
* docs: redesign cards by @shahednasser in https://github.com/medusajs/medusa/pull/8671
* docs: fix category not opening in api reference from algolia search by @shahednasser in https://github.com/medusajs/medusa/pull/8690
* docs: fix response code snippet in api reference by @shahednasser in https://github.com/medusajs/medusa/pull/8689
* docs: fix broken pages due to remark plugin by @shahednasser in https://github.com/medusajs/medusa/pull/8694
* chore: update the medusa config TSDocs + options by @shahednasser in https://github.com/medusajs/medusa/pull/8697
* docs: redesign API runner by @shahednasser in https://github.com/medusajs/medusa/pull/8688
* docs: fix tooltip placement and width in workflows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8691
* docs: fix algolia cron script by @shahednasser in https://github.com/medusajs/medusa/pull/8701
* docs: design polish by @shahednasser in https://github.com/medusajs/medusa/pull/8696
* docs: fix link to payment concept guide in sidebar by @shahednasser in https://github.com/medusajs/medusa/pull/8708
* docs: add a note about installing preview version by @shahednasser in https://github.com/medusajs/medusa/pull/8648
* docs: refactor medusa workflows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8692
* docs: fix link href for Cart module by @ahrbil in https://github.com/medusajs/medusa/pull/8713
* docs: second round of polishing by @shahednasser in https://github.com/medusajs/medusa/pull/8724
* docs: redesign search + re-introduce ai assistant in v2 docs by @shahednasser in https://github.com/medusajs/medusa/pull/8678
* docs: change notes across docs based on redesign by @shahednasser in https://github.com/medusajs/medusa/pull/8662
* docs: update to include Supabase S3 File Provider by @420coupe in https://github.com/medusajs/medusa/pull/8715
* docs(ui): update 3.4 Modules & Services v2 documentation by @WEEFAA in https://github.com/medusajs/medusa/pull/8751
* docs: delete all core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8777
* chore: Remove `prepublishOnly` script by @olivermrbl in https://github.com/medusajs/medusa/pull/8699
* docs: added new guides and troubleshooting related to admin development by @shahednasser in https://github.com/medusajs/medusa/pull/8739
* docs: update create payment collection route usage in store development by @shahednasser in https://github.com/medusajs/medusa/pull/8736
* docs: add a note about the middleware regular expression by @shahednasser in https://github.com/medusajs/medusa/pull/8742
* docs: [3/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8784
* docs: [5/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8786
* docs: [4/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8785
* docs: [1/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8782
* docs: [2/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8783
* docs: [6/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8787
* docs: [7/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8788
* docs: [8/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8789
* docs: [9/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8790
* docs: [10/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8791
* docs: [11/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8792
* docs: [12/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8793
* docs: [13/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8794
* docs: [14/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8795
* docs: [15/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8796
* docs: [16/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8799
* docs: [17/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8800
* docs: [18/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8801
* docs: [19/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8802
* docs: [20/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8803
* docs: [21/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8804
* docs: [22/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8805
* docs: [23/n] generate core-flows reference by @shahednasser in https://github.com/medusajs/medusa/pull/8807
* docs: [24/24] generate core-flows references by @shahednasser in https://github.com/medusajs/medusa/pull/8809
* docs: generate sidebar and other data related to core-flows reference by @shahednasser in #8811
* docs: updates following authentication flow changes by @shahednasser in #8706

## Chores
* chore(core-flows): set packed_at when fulfillment is created by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8665
* chore(core-flows): order update item quantity by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8659
* chore(core-flows): move cart and line item flows outside definition by @shahednasser in https://github.com/medusajs/medusa/pull/8703
* chore(core-flows): order edit - remove item update action by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8722
* chore: dependecies reorg by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8535
* chore: dependencies reorg by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8744
* chore: peer dependency version by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8771
* chore(core-flows): product workflows events by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/8769

## New Contributors
* @ahrbil made their first contribution in https://github.com/medusajs/medusa/pull/8713
* @WEEFAA made their first contribution in https://github.com/medusajs/medusa/pull/8751
* @Alexnortung made their first contribution in https://github.com/medusajs/medusa/pull/8766

**Full Changelog**: https://github.com/medusajs/medusa/compare/v2.0.5-preview...v2.0.6-preview