Releases: medusajs/medusa
Medusa v2.0 Release Candidate #1
We’re excited to share the first Release Candidate (RC) of Medusa 2.0. By definition, release candidates are not production-ready. There are likely still minor issues across our packages, which is part of the reason for publishing a pre-release of the official version.
We welcome feedback, questions, and bug reports. Please use Issues to submit your input.
Get started with a new project
To get started using the RC, run the following command:
npx create-medusa-app@rc
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
Please note, the following highlights are based on changes that have landed between the last preview release update and this release candidate.
We will cover all new changes to Medusa 2.0 in the official release notes. For now, you can refer to previous preview release updates to see what's new.
Package restructuring
Warning
Breaking change
With the announcement of the first Release Candidate, we decided to perform some housekeeping tasks and arrange our packages/dependencies. This is the last larger breaking change before the official release of 2.0.
Our goal with this change is to reduce the footprint of multiple packages within your application. Instead, we expose all the core-level utilities via the @medusajs/framework
package and all commerce features via the @medusajs/medusa
package.
As a result, you will have fewer dependencies to install and upgrade with every change. We will also be able to restructure things internally without impacting outside usage.
Dependencies
Moving forward, the dependencies inside a fresh Medusa application's package.json
file will look as follows:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"pg": "^8.13.0"
},
"devDependencies": {
"@mikro-orm/cli": "5.9.7",
"@swc/jest": "^0.2.36",
"medusa-test-utils": "rc",
"jest": "^29.7.0",
"@types/node": "^20.0.0",
"@swc/core": "1.5.7",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite": "^5.2.11"
},
}
You don't have to install individual modules since they are all bundled and distributed via the @medusajs/medusa
package.
TSConfig file changes
Now that most packages have been bundled into @medusajs/medusa
and `@medusajs/framework, importing from the transitive dependencies should be done with subpaths.
For example, this is how a link definition will look like:
import HelloModule from "../modules/hello"
- import ProductModule from "@medusajs/product"
+ import ProductModule from "@medusajs/medusa/product"
- import { defineLink } from "@medusajs/utils"
+ import { defineLink } from "@medusajs/framework/utils"
export default defineLink(
ProductModule.linkable.product,
HelloModule.linkable.myCustom
)
In the above example, we import the product
module from the @medusajs/medusa/product
subpath and the defineLink
from the @medusajs/framework/utils
subpath.
To use subpath imports, the moduleResolution
should be set to Node16 inside the tsconfig.json file:
{
"module": "Node16",
"moduleResolution": "Node16",
}
medusa-config.js
file changes
With the introduction of subpath imports, the module registration in medusa-config.js
should similarly use subpaths instead of top-level paths.
For example, this is how you would register the authentication module:
defineConfig({
// ...
modules: {
- resolve: "@medusajs/auth",
+ resolve: "@medusajs/medusa/auth",
options: {
providers: [
{
- resolve: "@medusajs/auth-emailpass",
+ resolve: "@medusajs/medusa/auth-emailpass",
id: "emailpass",
options: {
// provider options...
},
},
],
},
},
})
Notice the change from @medusajs/auth
to @medusajs/medusa/auth
and @medusajs/auth-emailpass
to @medusajs/medusa/auth-emailpass
.
Features
- feat(index): Index module foundation by @adrien2p in #9095
- feat(dashboard): manage inventory placeholder by @fPolic in #9190
- feat(index): Provide a similar API to Query by @adrien2p in #9193
- feat(dashboard): login and invite redesign by @fPolic in #9214
- feat(core-flows,dashboard,types,fulfillment,medusa): uses requires shipping throughout lifecycle by @riqwan in #9170
- feat(utils): define read only link by @carlos-r-l-rodrigues in #9254
- feat(medusa,fulfillment): pass stock location data to fulfillment provider by @srindom in #9322
- feature: bundle all modules by @thetutlage in #9324
Bugs
- fix(workflow-sdk): Use the correct event group ID from the flow metadata by @adrien2p in #9177
- fix(workflow-engine-*): pass container to flow by @carlos-r-l-rodrigues in #9180
- fix(medusa-test-utils): get port should a deps for now by @adrien2p in #9198
- fix(dashboard): open edit variant modal in current context by @fPolic in #9203
- fix(types): fixes to HTTP types by @shahednasser in #9189
- fix(oas): support additional props, fix circular references patch, and other fixes by @shahednasser in #9213
- fix(oas): handle new keys in circular reference patch by @shahednasser in #9218
- fix(user): check if user account with email already exist on invite create by @fPolic in #9243
- fix(dashboard): PL creation - customers table customers count by @fPolic in #9237
- fix(dashboard): prices validation in PL bulk editor by @fPolic in #9245
- fix(dashboard): minor collection bugs by @fPolic in #9255
- fix(dashboard): customer groups table fileds by @fPolic in #9262
- fix(dashboard): customer groups fixes by @fPolic in #9258
- fix(dashboard): pagination in invite table by @fPolic in #9259
- fix(core-flows): line item type collection by @carlos-r-l-rodrigues in #9251
- fix(pricing): calculate pricing repository query by @fPolic in #9265
- fix: Add missing await when refetching region by @sradevski in #9283
- fix(orchestration): Throw if not exists using filters by @adrien2p in #9275
- fix: add missing dependency to utils package by @thetutlage in #9297
- fix: Add actor type to password reset event by @sradevski in #9301
- fix(modules-sdk): Fix dynamic import usage by @adrien2p in #9304
- fix(dashboard): login alert background by @fPolic in #9305
- fix(types): remove BigNumberValue usages in http types by @shahednasser in #9285
- fix: Generated types interface name by @adrien2p in #9307
- fix: base tsconfig by @adrien2p in #9309
- fix(types, medusa): fixes to HTTP types by @shahednasser in #9273
- fix(modules-sdk): default db options by @carlos-r-l-rodrigues in #9313
- fix(dashboard): set/unset automatic taxes on a region by @fPolic in #9315
- fix(types): fix order DTO types by @shahednasser in #9323
- fix(dashboard): variant update success toast by @fPolic in #9325
- fix(create-medusa-app): fix publishable api key not saving in .env.local by @shahednasser in #9328
- fix: Bind abort controller to abort in sdk by @sradevski in #9341
- fix: remove dist access for modules in integration tests by @adrien2p in #9336
- fix(core-flows): shipping options for cart by @carlos-r-l-rodrigues in #9343
- fix: validate regions exist for shipping option price update by @srindom in #9364
- fix: Tax region + rates clean up by @olivermrbl in #9279
- fix: force string compare by @srindom in #9360
- fix(medusa): Instrumentation ...
Preview Release Update #10
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
Introduced a new query tool
We have introduced a new tool, Query, for querying data across modules in your application. Over time, it will replace Remote Query, which has been deprecated in the latest version. The underlying query engine of Query and Remote Query is the same, but we have changed the query API and eliminated redundant configurations that had built up over time.
There are two significant differences between the two tools:
- The result returned by Query takes the same shape regardless of the query input, which is different from that of Remote Query's that differed depending on whether pagination was applied or not.
- The call signature of Query is
query.graph({ ... })
, which is different from Remote Query'squery({ ... })
Query Result
With Query, you will always receive a result with data
and metadata
. The data contains your requested resources and the metadata contains information about the applied pagination. We recommend consuming it like so:
const { data, metadata } = await query...
Call signature
With Query, you query data across your modules with query.graph({ ... })
.
For example, in an API Route, the difference between how you consume Query vs. Remote Query is as follows:
// API Route
-const query = req.container.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
-
-const result = await query({ ... })
+const query = req.container.resolve(ContainerRegistrationKeys.QUERY)
+
+const { data, metadata } = await query.graph({ ... })
Migrating to Query
To migrate from Remote Query to Query, the following changes are needed:
- Resolve
query
instead ofremoteQuery
from the dependency container - Use
query.graph({ ... })
instead ofquery({ .. })
- Update query options to fit the new format*
*The changes to the query options format are:
- Entrypoint has been renamed:
entryPoint
->entity
- Filters has been moved to a top-level option:
variables: { filters: { ... } }
->filters: { ... }
- Pagination has been moved to a top-level option:
variables: { pagination: { ... } }
->pagination: { ... }
- Context has been moved to a top-level option:
variables: { context: { ... } }
->context: { ... }
- Variables has been removed entirely from the API
Here's an example using all options:
const { data, metadata } = await query.graph({
entity: "product",
fields: ["id", "title", "variants.calculated_price"],
filters: {
variants: {
sku: "SHIRT-1234"
},
},
pagination: { take: 10, skip: 0 },
context: {
variants: {
calculated_price: QueryContext({ currency_code: "usd" })
}
}
})
In this example, we:
- Retrieve the first 10 products that match our query
- Only with the fields:
id
,title
, and the calculated price of variants,variants.calculated_price
- Filtered by product variants
sku
- With computed variant prices based on a dynamic
QueryContext
Alongside the tool, we have shipped a new option, types
, to our CLI commands start
and develop
. If specified, we will attempt to generate types for all data models in existing and custom modules in your project and place them in a new top-level folder .medusa
in your project. The types should significantly improve the developer experience of Query by giving you intellisense of the data you can query in your application.
You can read more about Query in our documentation.
Remote Query will be removed in a later preview version and will not be part of the official release of Medusa 2.0. However, because the required changes are minimal, we recommend upgrading now to avoid issues in the future.
Introduced observability
We have introduced observability into our framework, enabling traces for HTTP requests, workflow executions, and database queries. Our instrumentation is built on top of OpenTelemetry, which allows you to export traces to any platform compatible with OpenTelemetry events.
Read more about tracing in Medusa and how to get started in our documentation.
Features
- feat: run nested async workflows by @carlos-r-l-rodrigues in #9119
- feat(dashboard,types): added inbound shipping placeholder + shipping summary details by @riqwan in #9150
- feat: add tracing to workflow steps by @thetutlage in #9140
- feat(modules-sdk): Parse filters based on loaded modules graph by @adrien2p in #9158
- feat(dashboard): rework create variant flow by @fPolic in #9132
Bugs
- fix(link-modules): table name by @carlos-r-l-rodrigues in #9151
- fix(core-flows): fixes case where inventory attempts delete when input is empty by @riqwan in #9156
- fix: migrate old links tables before performing a sync by @thetutlage in #9164
- fix: import open telemetry dependencies lazily by @thetutlage in #9161
Documentation
- docs: replace ModuleRegistrationName with Modules by @shahednasser in #9142
- docs: update store cURL examples in OAS by @shahednasser in #9099
- docs: update query usage across docs by @shahednasser in #9120
- docs: update docs across projects following publishable API key change in store routes by @shahednasser in #9098
- docs: use require instead of import in medusa-config.js by @shahednasser in #9102
- oas: update authorization header in cURL examples by @shahednasser in #9100
- docs-util: fixes for circular references, PAK in examples, namespaces by @shahednasser in #9091
- docs: added documentation on instrumentation by @shahednasser in #9160
- chore(oas): [8/n] improve oas schemas by @shahednasser in #9163
- chore(oas): [7/n] improve oas schemas by @shahednasser in #9162
- chore(oas): [9/n] improve oas schemas by @shahednasser in #9166
Other Changes
- docs: Rename remoteQuery to query and add db instrumentation flag by @thetutlage in #9159
Full Changelog: v2.0.9-preview...v2.0.10
Preview Release Update #9
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
Deprecated ModuleRegistrationName
Warning
Breaking change
We have deprecated ModuleRegistrationName
in favor of Modules
. ModuleRegistrationName
will be removed in a later preview release.
Modules are registered in the dependency container using these keys and are now resolved as follows:
import { Modules } from "@medusajs/utils"
const productModule = container.resolve(Modules.PRODUCT)
This is a breaking change if you have used strings for module resolution instead of ModuleRegistrationName
.
For example, if you have resolved the product module using its previous string resolution key, you will need to change it as follows:
-const productModule = container.resolve("productModuleService")
+const productModule = container.resolve(Modules.PRODUCT)
Enforced Publishable API Key in Store API
Warning
Breaking change
In the latest preview release, we require a Publishable API key header to access the Store API, i.e., all endpoints under the /store
resource. This will ensure your requests are scoped to at least one Sales Channel associated with the Publishable API key. Sales Channels are used to retrieve products, retrieve correct inventory quantities, create carts, and place orders.
The requirement has been introduced to ensure you can perform these operations without experiencing issues.
Disabled automatic MikroORM casing change
Warning
Breaking change
Refer to #9058 for a description of the issue, solution, and the minimal breaking change.
Fixed issue with many-to-many relations
Warning
Breaking change
In #9075, a bug with our many-to-many relation definition was identified. The solution to the problem lead to a minimal breaking change to the way many-to-many relations are defined when using our model
tool from @medusajs/framework
.
We now require the many-to-many relation to be defined on both sides and a mappedBy
definition on at least one side.
Features
- feat(create-medusa-app): add publishable API key environment variable to Next.js storefront by @shahednasser in #9029
- feat: Application types generation from project GQL schema's by @adrien2p in #8995
- feat: Reset password by @olivermrbl in #8962
- feat: Add support for refreshing JWT tokens by @sradevski in #9013
- feature: introduce types for query.graph method by @thetutlage in #9031
- feat: Add support for fetch streaming to js SDK by @sradevski in #9065
- fix(utils,medusa,order,cart): fix totals when promotions are included by @riqwan in #9014
- feat(payment): Payment providers are upserted upon loading by @riqwan in #9090
- feat(dashboard) modal search autofocus by @fPolic in #9038
- feat(utils,types,framework,medusa): store endpoints should require publishable key by @riqwan in #9068
- feat(core-flows): product type, option and tag events by @carlos-r-l-rodrigues in #9105
- feat(core-flows,dashboard,types,medusa): delete shipping methods when all inbound/outbound items are deleted by @riqwan in #9106
- feat(core-flows,types,medusa): validate deleting location level when quantities exist by @riqwan in #9086
- feat: introduce a thin wrapper on top of OpenTelemetry by @thetutlage in #9109
- feat(api-key,js-sdk,dashboard): allow deleting api keys only once its revoked by @riqwan in #9118
- feature: add telemetry to the HTTP layer by @thetutlage in #9116
- feature: add tracing to remote query by @thetutlage in #9128
- feat(core-flows,medusa,utils,types): adds delivered_quantity to order by @riqwan in #9130
Bugs
- fix(types): add inventory_quantity to http variant type by @shahednasser in #9030
- fix: Check for star actor types when allowing unregistered access by @sradevski in #9037
- fix(orchestration): filter out undefined items by @carlos-r-l-rodrigues in #9046
- fix(types, medusa): request / response types clean-up by @shahednasser in #9043
- fix: Allow specifying PORT for tests through environment by @sradevski in #9055
- breaking: turn off Mikro-ORM casing change with DML properties by @thetutlage in #9058
- fix(dashboard): rq cache and pending flag by @fPolic in #9063
- fix: JSON stringify DML json property default value by @thetutlage in #9074
- fix(dashboard): refresh order list when fulfilment status changes by @fPolic in #9076
- fix(medusa-test-utils): Run with modules without models by @adrien2p in #9062
- fix(core-flows): fix emitted event for deleting sales channel by @shahednasser in #9081
- fix(promotion): handle promotion buy X get X scenario by @riqwan in #9002
- fix(dashboard): campaign fixes by @fPolic in #9082
- fix: broken order page due to missing inventory by @riqwan in #9083
- fix: Update auth
app_metadata
when deleting users + customers by @olivermrbl in #9041 - fix: product options event names by @carlos-r-l-rodrigues in #9108
- fix(dashboard): product create - ignored variants in datagrid by @fPolic in #9087
- fix: wrap ModuleImplementations so that all methods are async by @Alexnortung in #9012
- fix:
instanceof MedusaError
does not work by @McTom234 in #9094 - fix(dml): Throw when many to many are not configured properly by @adrien2p in #9085
- fix: Remove test listeners after the event has happened by @sradevski in #9115
- fix(types, medusa): fix http type of exchanges and claims by @shahednasser in #9123
- fix(): Query Missing bindings by @adrien2p in #9131
- fix(core-flows): item id in reservations by @fPolic in #9097
- fix(dashboard): max call error onKeyDown handler by @kasperkristensen in #9141
- fix: OrderDTO add first class discount_subtotal var by @420coupe in #9112
- fix: Fixed misleading LinkDefinition import from the wrong package by @erickirt in #9139
Documentation
- chore: fix incorrect oas property name by @shahednasser in #9009
- docs: update auth docs + add new storefront guides by @shahednasser in #9020
- docs: fix admin actor type -> user by @shahednasser in #9028
- docs: document star actor types by @shahednasser in #9044
- oas: [2/2] improve store OAS by @shahednasser in #9035
- oas: [1/n] improve oas schemas by @shahednasser in #9039
- oas: [2/n] improve schema oas by @shahednasser in #9040
- oas: [1/n] improve store oas by @shahednasser in #8993
- oas: [3/n] improve oas schemas by @shahednasser in #9042
- docs: fix pricing query params in storefront guide + modules restructure by @shahednasser in #9021
- docs: added storefront development guide on retrieving variant inventory details by @shahednasser in #9032
- chore(utils): update auth provider TSDocs + fix errors stopping references build by @shahednasser in #9023
- chore: fix build errors in OAS by @shahednasser in #9059
- docs: add prerequisites link for test guides by @shahednasser in #9057
- oas:...
v1.20.10
Bugs
- fix: assign scheduled job worker to JobSchedulerService class by @u11d-bartlomiej-galezowski in #8891
- fix: Renamed the
JobSchedulerService
queue's name by @adevinwild in #9000 - fix(admin-ui): product category state in edit modal by @ikhvost in #9051
- fix:
instanceof MedusaError
does not work by @McTom234 in #9107
Documentation
- docs(v1): fix link to regions API reference by @shahednasser in #8867
- docs(v1.x): update PostgreSQL plan in heroku deployment guide by @shahednasser in #8931
Full Changelog: 1.20.10...v1.20.11
Preview Release Update #8
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
Restructured admin packages
| 🚧 Breaking change
Our admin packages have been restructured in #8988. This is a breaking change, as our extensions tool has been moved to a new package.
More specifically, defineWidgetConfig
and defineRouteConfig
should be imported from @medusajs/admin-sdk
instead of @medusajs/admin-shared
.
- import { defineRouteConfig, defineWidgetConfig } from "@medusajs/admin-shared"
+ import { defineRouteConfig, defineWidgetConfig } from "@medusajs/admin-sdk"
Additionally, the new admin package needs to be an explicit dependency in your project, so you should install it with your preferred package manager:
yarn add @medusajs/admin-sdk@preview
Features
- feat(dashboard,types): split damaged activity from received by @riqwan in #8859
- feat(medusa): order changes endpoint by @carlos-r-l-rodrigues in #8728
- feat(dashboard): order edits in timeline by @fPolic in #8899
- feat(notification): Handle long running transaction and add status support by @adrien2p in #8900
- feat(dashboard): allow custom shopping prices for claims/exchanges by @fPolic in #8912
- feat(core-flows,types): Refunds can only be performed when order is imbalanced by @riqwan in #8944
- chore(medusa): remove promotions in campaign validators + move tests to http by @riqwan in #8965
- feat(dashboard): Cancel claims and exchanges by @fPolic in #8958
- feat(dashboard): update create fulfillment UI part 1 by @fPolic in #8972
- feat(utils): dml to graphql by @carlos-r-l-rodrigues in #8951
- feat: Add github authentication provider by @sradevski in #8980
- feat: added totals tests for end 2 end RMA flow by @riqwan in #8906
- feat(types,medusa): add acknowledgement typing by @shahednasser in #8991
- feat(admin-sdk,admin-bundler,admin-shared,medusa): Restructure admin packages by @kasperkristensen in #8988
- feat(core-flows): custom price flag for order line items and shipping methods by @carlos-r-l-rodrigues in #8969
- feat(core-flows,types,promotion): register promotion campaign usage upon cart completion by @riqwan in #8970
- feat(product): product option value methods by @carlos-r-l-rodrigues in #9004
- feat(dashboard, user): prefill invite email by @fPolic in #9016
- feat(dashboard): add inventory kit info in order summary by @fPolic in #8990
Bugs
- fix(dashboard) RMAs shipping pricing by @fPolic in #8848
- fix(link-module): Migration planner not closing connection correctly by @adrien2p in #8881
- fix(order): populate version entities by @carlos-r-l-rodrigues in #8884
- feat(dashboard): refactor dismissed quantity by @fPolic in #8842
- fix(dashboard): Fetch tags + types in product forms by @olivermrbl in #8887
- fix(dashboard, js-sdk, types, medusa): separate between delete response with and without parent by @shahednasser in #8852
- fix: ignore metadata when computing relationships from payload by @thetutlage in #8895
- fix(dashboard): rma shipping floats by @fPolic in #8892
- fix: Shipping profile deletion with options by @adrien2p in #8910
- fix: Customer registration by @olivermrbl in #8896
- fix(medusa, types): fix more query types by @shahednasser in #8907
- fix(dashboard): Fix copy invite link by @kasperkristensen in #8933
- fix(dashboard): fix campaign end date by @riqwan in #8935
- fix: handle case where product to be updated does not exist by @thetutlage in #8897
- fix(dashboard): product option delete message by @fPolic in #8934
- fix(dashboard): format currency sign by @fPolic in #8936
- fix(medusa): Allow filtering customers by
has_account
by @kasperkristensen in #8947 - fix(core-flows): Handle variant creation duplicate inventory item ids by @adrien2p in #8937
- fix(dashboard): Product create price columns race condition by @kasperkristensen in #8943
- fix(types, medusa): fixes to draft order request types by @shahednasser in #8949
- fix(dashboard,admin-shared): Fixes to inventory page by @kasperkristensen in #8941
- fix(dashboard): receive return form by @fPolic in #8955
- fix(js-sdk): fix invite resend request being sent as GET instead of POST by @shahednasser in #8960
- fix(medusa): fix complete order API route to remove duplicate params by @shahednasser in #8961
- fix(medusa): change the request type of removing products from price list by @shahednasser in #8964
- fix(medusa): fix update promotion's request type by @shahednasser in #8966
- fix(order,utils): fix outstanding amount stuck on long orders by @riqwan in #8968
- fix(dashboard): Tab behaviour in DataGrid by @kasperkristensen in #8973
- fix(dashboard): Align product organization badges with design by @kasperkristensen in #8975
- fix(dashboard): Display breadcrumbs for variant route by @kasperkristensen in #8983
- fix(utils): graphql enum options by @carlos-r-l-rodrigues in #8985
- fix: Check actor type on account creation, fix github entity id by @sradevski in #8996
- fix: Remove deprecated method, generalize typings in auth by @sradevski in #8998
- fix(dashboard): import products labels by @fPolic in #9001
- fix(types,medusa): fix query types for some store routes by @shahednasser in #8994
- chore(core-flows): Add invite resent event by @olivermrbl in #8986
- fix(core-flows, types, medusa): fix batch delete types in workflows and routes by @shahednasser in #8974
- fix(dashboard): Fixes to campaign and promotions domains by @kasperkristensen in #9022
- fix: move get-port to main dependencies list by @thetutlage in #8938
- fix: Workflow always print "error:" even if there are none by @matteoxplo in #8978
Documentation
- docs: incorrect link fixes by @shahednasser in #8868
- docs-util: fixes in schema factory + other improvements by @shahednasser in #8874
- docs-util: include types in workflows.ts in generated references by @shahednasser in #8882
- docs: fix overflowing card description hidden by @shahednasser in #8871
- docs: fix tag filters in search by @shahednasser in #8862
- oas: [2/n] Improve admin OAS by @shahednasser in #8866
- oas: [1/n] Improve admin OAS by @shahednasser in #8850
- docs: use new x-sidebar-summary for sidebar items in api-reference if available by @shahednasser in #8865
- oas: [3/n] Improve admin OAS by @shahednasser in #8875
- docs: replace usages of migrations and links commands by @shahednasser in #8894
- Update page.mdx by @atistrcsn in #8908
- docs-util: fix clean script removing Auth tags by @shahednasser in #8911
- docs: fixe...
Preview Release Update #7
Highlights
Bulk Editor improvements
We have added error handling to our bulk editor to make bulk editing of resources more manageable.
error-bulk-editor.mp4
Order Exchanges, Returns, and Claims
We have finished the first iteration of Order Exchanges, Returns, and Claims. There is still some polishing to do on these flows, so please report any issues you find.
Recipe: Food-Delivery platform
We have published a new recipe taking you though building a food-delivery platform like UberEats.
We also have a demo project and repository if you are curious to dig into how this recipe is used in practice: https://github.com/medusajs/medusa-eats
Remote Joiner alias conflict
🚧 Breaking change
Several models were named the same across modules, causing conflicts for our Remote Joiner engine. To resolve the issues with Remote Joiner, the name-clashing models have been renamed to be specific to the module they belong to.
Only the ORM models have been renamed – not the underlying tables.
Order Module:
- Address -> OrderAddress
- LineItem -> OrderLineItem
- LineItemAdjustment -> OrderLineItemAdjustment
- LineItemTaxLine -> OrderLineItemTaxLine
- ShippingMethod -> OrderShippingMethod
- ShippingMethodAdjustment -> OrderShippingMethodAdjustment
- ShippingMethodTaxLine -> OrderShippingMethodTaxLine
- Transaction -> OrderTransaction
Fulfillment Module:
- Address -> FulfillmentAddress
These changes affect the modules' methods since we auto-generate methods based on the model names. For example, createLineItem
in the Order Module is now createOrderLineItem
. More specifically, this change affects the models mentioned above, and the following methods of those:
- retrieve[ModelName]
- list[ModelName]
- listAndCount[ModelName]
- create[ModelName]
- update[ModelName]
- delete[ModelName]
- softDelete[ModelName]
- restore[ModelName]
Internal module events
We have decided to hide the logs of internal module events. These events are currently only emitted in a few modules and are not supposed to be used by end-users for subscribers and such. You should always use Workflow Events, which have replaced the event concept from V1.
Features
- feat(dashboard): summary shipping breakdown by @fPolic in #8779
- feature: add db:setup command by @thetutlage in #8830
- feat(js-sdk): Add API key by @olivermrbl in #8838
- feat(dashboard): DataGrid improvements [4/4] by @kasperkristensen in #8798
- feat: Add support for providers to validate their options at loading time by @adrien2p in #8853
- feat(notification-sendgrid): include ability to handle attachments by @420coupe in #8729
Bugs
- fix(order): run migration before setting not null by @riqwan in #8831
- fix(dashboard,js-sdk): fixes from rma flows testing by @riqwan in #8826
- fix(medusa): use correct request type for create cart API route by @shahednasser in #8820
- fix: Validate boolean query params by @olivermrbl in #8834
- fix(order): order change references by @carlos-r-l-rodrigues in #8845
- fix(medusa-oas-cli): fix download url for public OAS by @shahednasser in #8763
- fix(dashboard): align items inside quick view popover by @riqwan in #8847
- fix(dashboard,types): fix some http type names by @shahednasser in #8836
- fix(core-flows): use unit price of item in create cart and add to cart flows by @shahednasser in #8841
- fix(orchestration): remote joiner alias conflict by @carlos-r-l-rodrigues in #8844
- fix(dashboard): active RMA section border by @fPolic in #8849
- fix(utils): DML hasOne - belongsTo not behaving correctly by @adrien2p in #8813
- fix(dashboard): active rma z-index by @fPolic in #8854
- fix: product category types by @Alexnortung in #8833
- fix(dashboard): Pass query params to list SC request by @kasperkristensen in #8863
Documentation
- docs-util: fix for product type schemas by @shahednasser in #8837
- docs: improvements to base OAS by @shahednasser in #8835
- docs: uppercase HTTP methods in api reference by @shahednasser in #8821
- docs: add tracking for navigation usage by @shahednasser in #8819
- docs-util: fix removal of manually-added schemas in clean script by @shahednasser in #8840
- docs: add restaurant-delivery marketplace recipe by @shahednasser in #8817
Chores
- chore(medusa): Re enable plugin loading by @adrien2p in #8843
- chore: Treat internal event differently, primarely do not display info logs for those events by @adrien2p in #8767
- chore: Remove unused clients in admin + clean up js-sdk by @olivermrbl in #8839
Full Changelog: v2.0.6-preview...v2.0.7-preview
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