Releases: medusajs/medusa
v1.18.0
Highlights
Subscriber API + Scheduled Jobs API
This release comes with an improved Subscriber API and a new Scheduled Jobs API. These are drastic improvements of the developer experience of setting up event subscribers and cron jobs.
Subscriber API
// src/subscribers/product-update-handler.ts
import type { SubscriberConfig, SubscriberArgs, ProductService } from "@medusajs/medusa"
export default async function productUpdateHandler({ data, eventName, container, pluginOptions }: SubscriberArgs) {
const productService: ProductService = container.resolve("productService")
const { id } = data
const product = await productService.retrieve(id)
// do something with the product...
}
export const config: SubscriberConfig = {
event: ProductService.Events.UPDATE
}
Scheduled Jobs API
// src/jobs/once-a-minute.ts
import type { ProductService, ScheduledJobConfig, ScheduledJobArgs } from "@medusajs/medusa"
export default async function handler({ container, data, pluginOptions }: ScheduledJobArgs) {
const productService: ProductService = container.resolve("productService")
const count = await productService.count()
console.log(`You have ${count} products`)
}
export const config: ScheduledJobConfig = {
name: "every-minute",
schedule: "* * * * *"
}
Read more about the new APIs in the PR details.
Breaking changes
Changes to feature flags
This version significantly changes the feature flags in our core @medusajs/medusa
. We've decided to replace all module-specific feature flags with one that encapsulates all the work around modularizing Medusa further.
The following feature flags no longer exist:
Name | Flag | Environment variable |
---|---|---|
Product Module | isolate_product_domain |
MEDUSA_FF_ISOLATE_PRODUCT_DOMAIN |
Pricing Module | isolate_pricing_domain |
MEDUSA_FF_ISOLATE_PRICING_DOMAIN |
These feature flags have been replaced with one capturing all work for Medusa V2, releasing next year:
Name | Flag | Environment variable |
---|---|---|
Medusa V2 | medusa_v2 |
MEDUSA_FF_MEDUSA_V2 |
Creating a NotificationService
The introduction of the new Subscriber API changes the recommended way to define the subscribers of a NotificationService. The recommended approach is to use a loader until our Subscriber API natively supports NotificationServices or we introduce a mechanism dedicated towards it.
Read more here.
Features
- feat(pricing,types): price list API + price calculations with price lists by @riqwan in #5498
- feat(workflows,medusa,utils): add medusa v2 feature flag by @riqwan in #5603
- feat(medusa): Alternative Subscriber API and new ScheduledJobs API by @kasperkristensen in #5624
- feat(medusa): Add metadata to Product Category by @bqst in #5599
Bugs
- fix: minor fixes to IconButton and Button documentation by @kasperkristensen in #5636
- fix(admin-ui): Preserve decimal numbers when locale uses commas by @kasperkristensen in #5641
- fix(admin-ui): sort supported languages alphabetically by @VariableVic in #5479
- fix(medusa): Add missing promiseAll import by @chemicalkosek in #5635
- fix(medusa): Error handling middleware should be applied when no config is exported by @kasperkristensen in #5634
- fix(medusa): Update wrapHandler so it also passes errors in non-async route handlers to the errorHandler middleware by @kasperkristensen in #5597
- fix(ui): Fixed CodeBlock line number width by @kasperkristensen in #5640
- fix(product): when running migrations, prevent exploding on isolated case by @riqwan in #5643
Chores
- chore: add missing error responses to currency OAS by @shahednasser in #5627
- chore: change code owners of docs-util directory by @shahednasser in #5626
- chore: add TSDocs for IStockLocationService by @shahednasser in #5631
- chore(types): Add TSDoc comments to IInventoryService by @shahednasser in #5630
Documentation
- docs: update docusaurus to v3 by @shahednasser in #5625
- docs: added troubleshooting for postgres docker container by @shahednasser in #5629
- docs: add note about ttl in redis cache module by @shahednasser in #5617
- docs: generate inventory and stock location references by @shahednasser in #5645
New Contributors
- @VariableVic made their first contribution in #5479
Full Changelog: v1.17.4...v1.18.0
v1.17.4
Highlights
Custom promiseAll
util
Transactions in Typeorm do not play well with Promise.all
when the operations contain nested promises. In case one of the operations fail i.e. reject the promise, all other operations are not guaranteed to be rolled back properly.
See #5529 for more context.
To mitigate this issue, we've introduced the promiseAll
util in @medusajs/utils
. It uses Promise.allSettled
under the hood, but has been wrapped to work like Promise.all
with a transaction rollback guarantee. See here.
You will use it like so:
import { promiseAll } from "@medusajs/utils"
import { TransactionBaseService } from "@medusajs/medusa"
class MyService extends TransactionBaseService {
async performTransactions() {
return await promiseAll([
// your operations....
])
}
}
API Routes BodyParser configuration
API Routes now support body-parser configuration.
You can opt-out:
export config = {
routes: [
{
matcher: "/webhooks/*",
bodyParser: false,
middlewares: [raw({ type: "application/json" })]
}
]
}
Or configure it with options:
export config = {
routes: [
{
matcher: "/webhooks/*",
bodyParser: { sizeLimit: 2000 } // in bytes
middlewares: [raw({ type: "application/json" })]
}
]
}
Design packages moved to monorepo
Our design packages, @medusajs/ui
, @medusajs/icons
, @medusajs/ui-preset
, have been moved to our monorepo to centralize issues and PRs.
Breaking changes
#5511 contains breaking changes in @medusajs/cache-redis
.
If option ttl
is 0 when calling .set
the attempt to add a cache entry is skipped.
Features
- feat(medusa, modules-sdk, types, utils): Re work modules loading and remove legacy functions by @adrien2p in #5496
- feat(product, pricing, utils): Transaction issues and reference issues by @adrien2p in #5533
- feat(utils): Introduce promiseAll util by @adrien2p in #5543
- feat(create-medusa-app): print error message for failed db connection by @egormkn in #5547
- feat(medusa): API routes body parser config by @kasperkristensen in #5537
- feat(medusa): Include Product Collections in Seed command by @adamlamaa in #5510
Bugs
- fix(integration): setup by @adrien2p in #5511
- fix(admin-ui): Make regions in tax setting scrollable by @kasperkristensen in #5530
- fix(admin-ui): Prevent oversized product request in Price List domain by @kasperkristensen in #5535
- fix(admin-ui): Prevent comma decimal separator from converting inputs to NaN by @kasperkristensen in #5566
- fix(admin-ui, ui): Align @types/react versions across UI packages by @kasperkristensen in #5596
- fix(medusa): Load legacy modules entities by @adrien2p in #5594
- fix(admin-ui): Admin UI: Invalid Request Header by @rick-lam in #5548
Chores
- chore(docs-util): fix freshness check script by @shahednasser in #5518
- chore: Update README.md by @srindom in #5517
- chore(docs): Removed Docs Announcement Bar (automated) by @github-actions in #5574
- chore(ui,icons,ui-preset,toolbox): Move design system packages to monorepo by @kasperkristensen in #5470
Documentation
- docs(create-scheduled-job): rewrote sentence by @stefanoschalkidis in #5525
- docs(create-events-module): fixed typos by @stefanoschalkidis in #5524
- docs(create tax provider): tax line code required by @nickmonad in #5540
- docs(api-reference): added local server to list of servers by @shahednasser in #5572
- docs: add missing mime_type in digital products recipe by @shahednasser in #5569
New Contributors
- @stefanoschalkidis made their first contribution in #5525
- @egormkn made their first contribution in #5547
- @nickmonad made their first contribution in #5540
- @rick-lam made their first contribution in #5548
- @adamlamaa made their first contribution in #5510
Full Changelog: v1.17.3...v1.17.4
v1.17.3
Highlights
API Routes compatible with Windows
An issue with path parsing on Windows for API Routes registration has been resolved (#5497).
Custom batch jobs support in Admin activity drawer
Custom batch jobs can now be rendered in the activity drawer in Medusa Admin (#5288)
Use format [entity]-[operation]
for your batch job type to render a human-readable activity title. For example, product-import
.
Translations
Vietnamese, Ukrainian, Tamil, Russian, and Hindi translations added to Medusa Admin.
Removed source-map-plugin
from @medusajs/admin-ui
Removed source-map-plugin
to make Webpack more fault tolerant. The plugin would cause admin builds to throw if a dependency had no source maps (#5484)
Features
- feat(admin-ui): add Tamil translation by @prajjwalkumar17 in #5463
- feat(admin-ui): Add Ukrainian translation by @andriinuts in #5084
- feat(medusa): integrate pricing module to core by @pKorsholm in #5304
- feat(admin-ui): Add Russian translation by @yersultanur in #5142
- feat(medusa): variant creation with prices in productservice.create by @pKorsholm in #5410
- feat(create-medusa-app): improve spinner style by @shahednasser in #5474
- feat(medusa-oas-cli,oas-github-ci): new options + added download of OAS in api reference by @shahednasser in #5453
- feat(admin-ui): add Vietnamese translation bt @huuduc2312 in #5442
- feat(admin-ui): add Hindi Translation by @its-kunal in #5452
Bugs
- fix(orchestration): field alias should represent the isList in the result by @adrien2p in #5449
- fix(admin-ui): fix analytics config not being saved in invite form by @shahednasser in #5467
- fix(medusa): totals calculation with gift card by @adrien2p in #5075
- fix(medusa): Revert status type in API by @olivermrbl in #5428
- fix(admin-ui): PriceList bulk editor fixes by @kasperkristensen in #5456
- fix(medusa, modules-sdk, modules): Module loading missing dependencies + remote query reference issue by @adrien2p in #5468
- fix(admin-ui): modify webpack config to prevent throwing sourcemap errors by @kasperkristensen in #5484
- fix(admin-ui): TIP in shipping option creation by @olivermrbl in #5356
- fix(medusa): admin get product should return prices when expected by @adrien2p in #5480
- fix(medusa): Add admin get product tests by @adrien2p in #5480
- fix(medusa): Add inventory decoration for cart endpoints by @pKorsholm in #5187
- fix(admin-ui) Custom batch job activity card by @pepijn-vanvlaanderen in #5288
- fix(admin-ui): Enhanced 'activity-drawer' visibility with z-index adjustment by @ram-you in #5315
- fix(medusa): Make file based routing compatible with Windows pathing by @kasperkristensen in #5497
Chores
- chore(oas): update order OAS schema to include new fields by @shahednasser in #5436
- chore(oas): Fix OAS related to JWT authentication by @shahednasser in #5448
- chore(docs): Removed Docs Announcement Bar (automated) by @github-actions in #5466
- chore(docs-util): Improve generate references script and action by @shahednasser in #5472
Documentation
- docs: update endpoints to use file-routing approach by @shahednasser in #5397
- docs: fix parameters display in module reference by @shahednasser in #5425
- docs: general fixes and enhancements by @shahednasser in #5429
- docs: update override price selection strategy documentation by @shahednasser in #5438
- docs: improved create-medusa-app structure by @shahednasser in #5458
- docs: added documentation for logging by @shahednasser in #5469
- docs: improve UX of recipe learning path by @shahednasser in #5477
New Contributors
- @prajjwalkumar17 made their first contribution in #5463
- @andriinuts made their first contribution in #5084
- @yersultanur made their first contribution in #5142
Full Changelog: v1.17.2...v1.17.3
v1.17.2
Highlights
API Routes
Version 1.17.2 of @medusajs/medusa
introduces API Routes - a massive improvement of the developer experience of creating custom endpoints in Medusa.
Custom API endpoints can now be implemented using similar patterns to frameworks like Next.js and Svelte.
// api/admin/products/route.ts
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
export async function GET(req: MedusaRequest, res: MedusaResponse) {
const productService = req.scope.resolve("productService")
const products = await productService.list()
res.json({ products })
}
In the above example, we create the endpoint GET /admin/products
. The example illustrates a few key points:
- Endpoint paths are inferred from the file path of the route
route.{ts|js}
is a new special file that contains the route handlers- HTTP methods of route handlers are defined by the handler name (above
GET
)
Read more about the API Routes in the PR and announcement post.
Features
- feat(medusa): support file based routing by @kasperkristensen in #5365
- feat(create-medusa-app): add tracking for selected options by @shahednasser in #5404
- feat(medusa): add pricing integration feature flag by @pKorsholm in #5287
- feat(link-modules,modules-sdk,pricing): Medusa App Migrations + Core compatible migrations by @riqwan in #5317
- feat(pricing,types,utils): Move calculate pricing query to a repository + rule type validation by @riqwan in #5294
- feat(medusa-file-s3): Added S3 directory config by @pepijn-vanvlaanderen in #5291
- feat: move create inventory to @medusajs/workflows by @srindom in #5301
- feat(workflows): update product workflow by @fPolic in #4982
Bugs
- fix(medusa-plugin-brightpearl): Missing discounts rule relation by @josipmatichr in #5390
- fix(medusa-js): JwtTokenManager.registerJwt for store domain by @dPreininger in #5406
- fix(admin-ui): Remove t() on product.status update by @olivermrbl in #5394
- fix(admin-ui): Create analytics if FF is enabled by @olivermrbl in #5367
- fix(admin-ui): alias design system packages by @kasperkristensen in #5358
- fix(medusa, types): Mark properties as nullable to reflect their correct types by @adrien2p in #5281
- fix(admin-ui): Price list domain fixes by @kasperkristensen in #5339
- fix(medusa): Filter statement in
partitionItems_ method
of Fulfillment Service by @DidierGuyon in #5247 - fix(medusa-js): Types for bundler by @dwene in #5400
- feat(medusa): Add item and shipping tax totals to order by @pepijn-vanvlaanderen in #5385
- feat(admin-ui): Correct some German translations by @springstan in #5375
- feat(admin-ui): Add Croatian translation by @anamarijapapic in #5377
- feat(admin-ui): add Bosnian translation by @samiralibabic in #5395
- fix(medusa): Dont set cache if ignore_cache option is true by @FlorentQuienne42 in #5408
Chores
- chore: fix OAS of batch delete product prices endpoint by @shahednasser in #5318
- chore: fix generate reference command name in action by @shahednasser in #5320
- chore: fix path prefix of reference generation scripts by @shahednasser in #5324
- chore: fix tsconfig in utils by @shahednasser in #5328
- chore: adds test for inventory item creation as part of product creation by @srindom in #5312
- chore: added and improved TSDoc of pricing module by @shahednasser in #5335
- chore(oas): fix typo in product variant's OAS by @shahednasser in #5352
- chore(oas): add note about returned fields in list product variants endpoint by @shahednasser in #5360
- chore: Remove PH link by @MedusaNick in #5295
- chore: fix interfaces for product module by @riqwan in #5387
- chore: fix OAS for User Login JWT by @shahednasser in #5403
- chore(orchestration): prevent throwing on already defined workflow by @adrien2p in #5337
- chore(integration-tests): Add jest timeout to workflow tests by @olivermrbl in #5401
Docs
- docs: link not shown correctly by @MedusaNick in #5373
- docs: fix links to create notification provider by @shahednasser in #5380
- docs: resdesign and restructure modules references by @shahednasser in #5372
- docs: added a note about official translations by @shahednasser in #5398
- docs: fix q parameter in search products section by @shahednasser in #5399
- docs: fix beta tag by @shahednasser in #5321
- docs: update price list's user guide by @shahednasser in #5323
- docs: generate pricing module reference by @shahednasser in #5349
- docs: fix entity file path in Create Entity documentation by @shahednasser in #5351
- docs: add a note about yarn version support in Medusa Dev CLI guide by @shahednasser in #5355
- docs: added a note about typescript declaration file by @shahednasser in #5361
Full Changelog: v1.17.1...v1.17.2
v1.17.1
Highlights
Pricing UI + UX upgrade
The Price List domain in @medusajs/admin
has been revamped to improve merchants' experience in creating promotional sales and customer-specific prices.
The update includes:
- New UI implemented using Medusa UI
- Bulk Editor for editing multiple prices on the Products part of the Price List
price-list-editor.mp4
We will incrementally migrate Medusa Admin to use our UI components library. Therefore, you can expect to find UI inconsistencies in the foreseeable future.
The next iteration of the Price List revamp will introduce minimum and maximum requirements support (in the UI), as well as the ability to import and export Price List to/from CSV files.
AI Assistant
We've introduced an AI Assistant to our documentation, helping you on your journey building digital commerce experiences.
Screen.Recording.2023-10-05.at.10.40.10.AM.mov
Added translations
Spanish, Italian, and German translations have been added to Medusa Admin.
Features
- feat(admin-ui, medusa, medusa-react, medusa-js): Price List UI revamp by @kasperkristensen in #5233
- feat(pricing,types): addPrice and removePricreRules APIs by @riqwan in #5237
- feat(utils): Utils to create an object select, relation from a string[] by @adrien2p in #5213
- feat(utils,modules-sdk): Remote query object to string array by @adrien2p in #5216
- feat(*): modules export entities and fields by @carlos-r-l-rodrigues in #5242
- feat(admin-ui): Add Spanish translations by @ChrisGV04 in #5264
- feat(admin-ui): Add Italian translation by @ALonghi in #5282
- feat(admin-ui): Add German translation by @springstan in #5267
Bugs
- fix(medusa): Pricing update fixes by @pKorsholm in #5275
- fix(medusa): Accept invite should not require first/last name by @adrien2p in #5279
- fix(medusa): Send INSUFFICIENT_INVENTORY code with error by @chemicalkosek in #5265
Documentation
- docs(medusa): Authentication overhaul by @dPreininger in #5156
- docs: fix usage of non-existing repository in digital products recipe by @shahednasser in #5280
- docs: fix preserve-symlink command for yarn in plugin docs by @shahednasser in #5285
- docs: add AI Assistant by @shahednasser in #5249
- docs: Update Sendgrid Plugin Documentation by @annalbirena in #5284
- docs: fix horizontal scroll by @shahednasser in #5300
- docs: create typedoc theme and plugins for references by @shahednasser in #5297
New Contributors
- @ChrisGV04 made their first contribution in #5264
- @ALonghi made their first contribution in #5282
- @springstan made their first contribution in #5267
Full Changelog: v1.17.0...v1.17.1
v1.17.0
Highlights
New and improved authentication methods
Version 1.17.0 of @medusajs/medusa
ships new and improved authentication methods. A contribution by @dPreininger.
Medusa supports three authentication methods:
Sessions
Our session cookie authentication remains unchanged. However, the strategy name has been updated in both the store and admin API, making existing cookie sessions invalid.
⚠️ We will not convert existing sessions to work with this update. Make sure to plan your upgrade accordingly.
API tokens (
The header for API token authentication has changed from a Bearer authorization scheme to a custom header scheme specific to Medusa, x-medusa-access-token
.
Previously, you would use API tokens like so:
curl -L GET '<BACKEND_URL>/admin/products' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {api_token}'
This has changed to:
curl -L GET '<BACKEND_URL>/admin/products' \
-H 'Content-Type: application/json' \
-H 'x-medusa-access-token: {api_token}'
Bearer tokens
Bearer token authentication is a "new" method that utilizes JWT tokens and the Bearer scheme. Request a token from a client and attach it to subsequent requests to keep the authenticated session alive. The approach is identical to that of the old API authentication but uses a different token type.
First, request a token:
curl -L POST 'http://localhost:9000/admin/auth/token' \
-H 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "supersecret"
}'
Then, hit an authenticated route:
curl -L GET 'http://localhost:9000/admin/products?limit=1' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer some_access_token'
Arabic translations
Thanks to @PeterAbdalla, you can now operate Medusa Admin in Arabic.
Medusa UI 2.0
Version 2.0 of @medusajs/ui
is out. To upgrade, run the following command in your project:
yarn add @medusajs/[email protected]
The release includes:
- New components, including CurrencyInput, Tabs, and CommandBar
- New icons
- Updated API of Button, Badge, and CodeBlock (
⚠️ breaking changes)
And much more.
Check out all changes and the upgrade guide in our documentation: https://docs.medusajs.com/upgrade-guides
Features
- feat(utils): Provide an utils that allows to convert an array of fields to a complete remote query object by @adrien2p in #5161
- feat(medusa): Migrate remote query usage in store product domain to use an object by @adrien2p in #5131
- feat(medusa): Admin get product with isolated module by @adrien2p in #5054
- feat(medusa): Admin list product with product isolated module by @adrien2p in #5046
- feat(medusa): Remove create product unnecessary input config workflow by @adrien2p in #5196
- feat(medusa): Authentication overhaul by @dPreininger in #4064
- feat(pricing): add price rule entity by @pKorsholm in #5050
- feat(medusa): Add product isolation FF to update cart by @adrien2p in #5168
- feat(admin-ui): Add Arabic translations by @PeterAbdalla in #5140
- feat(pricing, types, utils): Exact match based on context + fallback on rule priority if not by @riqwan in #5214
Bugs
- fix(medusa, workflows): Create product workflow with Isolated modules + module registration by @adrien2p in #5081
- fix(admin-ui): translation pt by @carlos-r-l-rodrigues in #5176
- fix(medusa-payment-stripe): adds missing undefined check by @srindom in #5177
- fix(admin-ui): Allow nullish values in update variant by @olivermrbl in #5173
- fix(admin-ui): typos in text by @gempain in #5032
- fix(medusa): Product model before insert hook by @adrien2p in #5200
- fix(medusa-react):
@medusajs/medusa-js
import by @olivermrbl in #5207 - fix(medusa): In product isolation, throw if product not found by @adrien2p in #5224
- fix(medusa): quantity prices for line item updates by @pKorsholm in #5137
- fix(create-medusa-app): fix inconsistency in checking errors in migrations by @shahednasser in #5189
Chores
- chore(medusa): link modules as medusa dependency by @carlos-r-l-rodrigues in #5208
Documentation
- docs: fix code in digital product recipe by @shahednasser in #5172
- docs: create docs workspace by @shahednasser in #5174
- docs: fix error related to Key type by @shahednasser in #5178
- docs: general fixes for docs workspace by @shahednasser in #5184
- docs: update contribution guideline by @shahednasser in #5188
- docs(ui): dark mode fixes by @shahednasser in #5204
- docs: Improve Loaders documentation by @shahednasser in #5205
- docs: improve tailwind configuration by @shahednasser in #5215
- docs: fix z-index across projects by @shahednasser in #5234
- docs: fix code block's usage of z-index by @shahednasser in #5238
- docs(ui,docs): Add documentation for Medusa UI 2.0.0 by @kasperkristensen in #5227
- docs: fix irregular scrolling in code tabs by @shahednasser in #5239
- docs(ui,docs): added upgrade guides link to UI docs by @shahednasser in #5240
- docs: add Next.js steps to digital product recipe by @shahednasser in #5231
- docs: fix details component + other styling fixes by @shahednasser in #5217
- docs: expanded rating form + UI docs improvement by @shahednasser in #5211
New Contributors
- @dPreininger made their first contribution in #4064
- @PeterAbdalla made their first contribution in #5140
Full Changelog: v1.16.1...v1.17.0
v1.16.1
Highlights
Polish translations added to Medusa Admin
Huge thanks to @chemicalkosek for the contribution!
Important bugs related to Multi-language support resolved
Upgrade to the latest version of Medusa Admin:
yarn add @medusajs/admin@latest
Solves:
Features
- feat(admin-ui): Add Polish translation by @chemicalkosek in #5101
- feat(admin-ui): Add missing attributes translations by @adrien2p in #5155
Bugs
- fix(modules-sdk): medusa app default module by @carlos-r-l-rodrigues in #5114
- fix(admin-ui): modal pointer events by @fPolic in #5113
- fix(medusa-test-utils): Fixed
count
serialization and incorrect function call by @adevinwild in #5090 - fix(admin-ui): Wraps invite route correctly with analytics by @olivermrbl in #5118
- fix(admin-ui): Typo in Return Reasons subtitle by @DidierGuyon in #5027
- fix(admin-ui): fix template expression by @fPolic in #5103
- fix(orchestration): ToRemoteJoinerHelper property building by @adrien2p in #5130
- fix(admin-ui): Patch admin path issue by @olivermrbl in #5154
- fix(medusa): Handle variant error during line item generation by @adrien2p in #5145
- fix(modules-sdk): medusa app load legacy modules by @carlos-r-l-rodrigues in #5115
Documentation
- docs: fix retrieve order by display ID code block by @shahednasser in #5106
- docs(medusa-file-s3): update aws config object name by @bacarybruno in #5098
- docs: updated recipes by @shahednasser in #5138
- docs: fix card title in digital products recipe by @shahednasser in #5147
New Contributors
- @bacarybruno made their first contribution in #5098
- @adevinwild made their first contribution in #5090
- @S-IR made their first contribution in #5035
Full Changelog: v1.16.0...v1.16.1
v1.16.0
Highlights
Multi-language support in Medusa Admin
We are excited to announce multi-language support in Medusa Admin, allowing merchants to manage products, orders, customers, etc. in their preferred language.
This release ships English, Portuguese (Brazil), and French translations.
Check it out by upgrading to the latest version of Medusa Admin:
yarn add @medusajs/admin@latest
Huge thanks to @gempain and @mj-mehdizadeh for this amazing contribution. And thanks @dahorarodrigo for contributing with Portuguese translations.
If you want to help us translate Admin to other languages, see the contribution guide in our documentation.
Your efforts are highly appreciated!
Pricing Module
This release introduces the first iteration of our new standalone Pricing Module, which ships on npm under @medusajs/pricing
. This version of the module comes with limited functionality as we've focused on putting down a solid foundation for follow-up work.
You can think of the Pricing Module as a way to assign a price to any type of resource, for example, ProductVariants.
We will share an announcement article soon, describing the module's features and what you can expect from follow-up iterations.
Breaking changes
Database schema changes
In our effort to build Standalone Commerce Modules, we will incrementally be dropping foreign key constraints across many business domains and change relationships between entities in the core, @medusajs/medusa
.
Right now, we are focused on finalizing the Product (@medusajs/product
) and Pricing (@medusajs/pricing
) module, which has led to the following database changes.
The relationship between MoneyAmounts and ProductVariants has been changed from a Many-to-One to a Many-to-Many in package @medusajs/medusa
. Therefore, you are required to apply the new migration by running the following command in your Medusa project:
npx @medusajs/medusa-cli migrations run
You can no longer create prices for variants as part of creating a product using only the ProductService
.
await ProductService.create({ variants [ { prices: [ ... ] } ] }) // <-- This will throw an error, due to the change in DB schema mentioned above
Instead, you should create products and variants separately. For example, you can do:
const product = await ProductService.create({ ... })
const variants = await ProductVariantService.create(product.id, variants)
Additionally, the following foreign key constraints have been dropped:
These changes are only relevant if you are using the feature flag
isolate_product_domain
. Please be careful about enabling this flag, as it will introduce experimental changes and work in progress.
- ProductTaxRate to Product
- ProductTypeTaxRate to ProductType
- ClaimItem to ProductVariant
- DiscountConditionProduct to Product
- DiscountConditionProductCollection to ProductCollection
- DiscountConditionProductTag to ProductTag
- DiscountConditionProductType to ProductType
- DiscountRule to Product
Features
- feat(medusa,orchestration): Decouple Product in Cart domain by @carlos-r-l-rodrigues in #4945
- feat(utils, module-sdk, medusa): Extract pg connection utils to utils package by @adrien2p in #4961
- feat(admin): add ProductCollectionDetailsWidgetProps type by @tekloon in #5012
- feat(pricing, types): PriceSets as entry point to pricing module by @riqwan in #4978
- feat(orchestration): remote joiner - field alias by @carlos-r-l-rodrigues in #5013
- feat(admin-ui): Multi-language support by @gempain in #4962
- feat(medusa): List products with Remote Query by @adrien2p in #4969
- feat(admin-ui): Add display name + pull supported languages from config by @olivermrbl in #5028
- feat(medusa): Get product with isolated product module by @adrien2p in #5010
- feat(medusa): Drop FKs to isolate products by @carlos-r-l-rodrigues in #5042
- feat(medusa): Separate money amount and variant by @pKorsholm in #4906
- feat(medusa): Prevent default SC to be assign if the isolated product flag is enabled by @adrien2p in #5037
- feat(pricing) Add Price Set Rule Type by @pKorsholm in #4977
- feat(admin-ui): Add French translations by @gempain in #5031
Bugs
- fix(medusa): Type in AbstractFulfillmentService by @pepijn-vanvlaanderen in #5003
- fix(link-modules): Fix link module initialization by @adrien2p in #4990
- fix(admin-ui): disabling analytics when opted out by @jporsay in #4939
- fix(medusa): default sales channel for store variant endpoints by @pKorsholm in #4556
- fix(link-modules): fix link configuration for product shipping profile by @riqwan in #5014
- fix(orchestration): Infinite loop by reference update by @adrien2p in #5023
- fix(medusa): duplicated migration by @carlos-r-l-rodrigues in #5029
- fix(orchestration,link-modules,pricing,types): fix shippingprofile error outside of core + change link alias name by @riqwan in #5025
- fix(medusa): Support fields param in list-variants by @olivermrbl in #5053
- fix(create-medusa-app): fix command for windows OS by @shahednasser in #5061
- fix(admin,admin-ui): copy public folder as part of admin build by @kasperkristensen in #5057
- fix(medusa-react): fix useAdminAddStoreCurrency hook by @shahednasser in #5074
- fix(medusa): Money amount detached migration by @adrien2p in #5079
- fix(admin-ui): Load translations from path by @olivermrbl in #5064
- feat(admin-ui): pt-BR translations and en version text fixes by @dahorarodrigo in #5066
Chores
- chore(modules-sdk,orchestration): to remote joiner query by @carlos-r-l-rodrigues in #4974
- chore(admin-ui): Add pt-BR to supported languages by @olivermrbl in #5080
Documentation
- docs: fix S3 plugin options section by @shahednasser in #5007
- docs: add create-medusa-app option in Next.js starter by @shahednasser in #5008
- docs: added new recipes by @shahednasser in #4964
- docs: fix steps in create entity documentation by @shahednasser in #5011
- docs: added troubleshooting for Next.js with NPX by @shahednasser in #5016
- docs: added ecommerce recipe by @shahednasser in #5017
- docs: updated the add fulfillment provider docs by @shahednasser in #4986
- docs: update create-medusa-app to add details about Next.js option by @shahednasser in #4991
- docs: add documentation for remaining plugins by @shahednasser in #4994
- docs,api-ref: fix kbd styling by @shahednasser in #4995
- docs: fix environment variable names for Railway guide by @shahednasser in #5077
New Contributors
- @jporsay made their first contribution in #4939
- @tekloon made their first contribution in #5012
- @gempain made their first contribution in #4962
Full Changelog: v1.15.1...v1.16.0
v1.15.1
Highlights
Updated create-medusa-app
onboarding
We've updated the create-medusa-app
command with a new option, allowing you to get started with a Next.js storefront right away.
Try the new step in the flow yourself:
npx create-medusa-app@latest
Or pass the argument --with-nextjs-starter
when running the command:
npx create-medusa-app@latest --with-nextjs-starter
AbstractFulfillmentService
We've done some housekeeping around fulfillment plugins, introducing a new interface and an abstract class correctly typed with added documentation.
As a result, fulfillment plugin services will now need to extend the AbstractFulfillmentService
from @medusajs/medusa
. Rest assured, the changes are backward compatible, so you are in no rush to migrate your implementation or plugin.
The deprecated fulfillment service will be removed in a future release. We will announce these changes beforehand so you can take the proper precautions.
Improvements to S3 file plugin
The AWS SDK used in medusa-file-s3
has been upgraded to V3, as V2 will enter maintenance mode later this year.
Cache-control has been added to the plugin options, allowing you to optimize your storage more granularly.
Solves:
EventBus enqueuer reconnection
We've introduced a mechanism to ensure the EventBus will not stop processing events in case the database connection momentarily dies.
If the connection is lost, we will try to reestablish the connection every 3rd second until successful. Changes was added in #4855 and further improved in #4963.
Additionally, logs have been added to inform the user in case this should happen.
Solves:
Breaking changes
Product Module
In #4965, we introduced breaking changes in the list
and listAndCount
methods of the ProductService in package @medusajs/product
.
Specifically, the category filter has changed from category_ids
to category_id
:
// before
ProductService.list({ category_ids: ["pcat_123", "pcat_345"] })
ProductService.listAndCount({ category_ids: ["pcat_123", "pcat_345"] })
// after
ProductService.list({ category_id: ["pcat_123", "pcat_345"] })
ProductService.listAndCount({ category_id: ["pcat_123", "pcat_345"] })
Features
- feat(create-medusa-app): add install Next.js storefront option by @shahednasser in #4968
- feat(pricing, utils, types): adds money amount to pricing module by @riqwan in #4909
- feat(medusa): Add AbstractFulfillmentService by @olivermrbl in #4922
- feat(admin-ui): batch job completed notification by @fPolic in #4886
- feat(medusa-file-s3): Add cache-control option + update to sdk v3 by @pevey in #4884
- feat(pricing, types, utils, medusa-sdk): Pricing Module Setup + Currency by @riqwan in #4860
- feat(link-modules,modules-sdk, utils, types, products) - Remote Link and Link modules by @carlos-r-l-rodrigues in #4695
- feat(medusa, admin-ui): Improve gift card application by @mortenengel in #4944
- feat(medusa-fulfillment-webshipper): Create webshipper return order by @josipmatichr in #4846
- feat(products,types,pricing): allow scoping products by collection_id + pricing by currency_code by @riqwan in #4965
- feat(medusa): Event bus db failure handling by @adrien2p in #4963
Bugs
- fix(medusa-file-*): Add types as devDeps by @olivermrbl in #4871
- fix(medusa): category_id and q params for list products endpoint ld work by @riqwan in #4889
- fix(admin-ui): currency input exception by @fPolic in #4888
- fix(admin-ui): delete customer group by @fPolic in #4893
- fix(ci): Increase memory allocation for plugin tests by @olivermrbl in #4898
- fix(medusa): Make event enqueuer reconnect the database when it lost the connection by @hanam1ni in #4855
- fix(medusa, admin-ui): Add
deleted_at
to Return Reason unique constraint by @StephixOne in #4834 - fix(utils, product, pricing, link-modules): add missing dependencies for utils + fix migration path issue by @riqwan in #4915
- fix(medusa): csv parser check
match
prop on column by @fPolic in #4913 - fix(medusa-payment-stripe): api endpoint for getStripePayments by @zulianrizki in #4928
- fix(medusa): Double tax issue on return refund amount by @josipmatichr in #4899
- fix(admin): Export RouteProps and SettingProps by @kasperkristensen in #4950
- fix(medusa-plugin-brightpearl): Inventory sync for OOS items in brightpearl by @josipmatichr in #4966
Chores
- chore: pipeline node version by @carlos-r-l-rodrigues in #4896
- chore: Bump GitHub workflows to run on node 16 by @deining in #4876
- chore(medusa,orchestration,link-modules,modules-sdk): internal services as modules by @carlos-r-l-rodrigues in #4925
- chore: Fix typos by @deining in #4877
Documentation
- docs: fix edit button links by @jhony112 in #4883
- docs: updated create file service guide by @shahednasser in #4887
- docs: added RBAC recipe by @shahednasser in #4895
- docs: fix customer_id name in create endpoints docs by @shahednasser in #4900
- docs: added B2B recipe by @shahednasser in #4901
- docs: added section on using the product module in Next.js by @shahednasser in #4924
- docs: added multi-region recipe by @shahednasser in #4926
- docs: updated file-service s3 guide by @habibullahturkmen in #4921
- docs: updated digitalocean deployment guide by @shahednasser in #4923
- docs: update Create Fulfillment Provider guide by @shahednasser in #4911
- docs: update admin CLI configurations by @shahednasser in #4910
- docs: added expected columns for imports by @shahednasser in #4908
New Contributors
- @deining made their first contribution in #4876
- @jhony112 made their first contribution in #4883
- @hanam1ni made their first contribution in #4855
- @zulianrizki made their first contribution in #4928
- @habibullahturkmen made their first contribution in #4921
Full Changelog: v1.15.0...v1.16.0
v1.15.0
Highlights
Import and Export support in @medusajs/file-local
The file plugin, @medusajs/file-local,
used for local development, now supports uploads and downloads via streaming, making it possible to import products right after setting up a project, among other things.
New Search UI in Medusa Documentation
You can now filter the search results to view specific results such as plugins, API reference, UI, and other areas of the documentation.
Check it out here.
Breaking changes
Reading and writing streams with file plugins now default to a private bucket across all providers.
The file plugin streaming API to upload to public/private buckets has been updated to be consistent across all providers.
// before
// MinIO
fileService.getUploadStreamDescriptor({..., usePrivateBucket: false})
// S3 & Spaces
fileService.getUploadStreamDescriptor({..., acl: "public-read"})
// after
fileService.getUploadStreamDescriptor({..., isPrivate: true}) // private bucket (default)
fileService.getUploadStreamDescriptor({..., isPrivate: false}) // public bucket
The following method signatures in the Price List and Product import strategies have been updated:
// before
downloadImportOpsFile(batchJobId: string, op: OperationType)
deleteOpsFiles(batchJobId: string)
// after
downloadImportOpsFile(batchJob: BatchJob, op: OperationType)
deleteOpsFiles(batchJob: BatchJob)
The following types specific to file services have moved from @medusajs/medusa
to @medusajs/types
:
export type FileServiceUploadResult = {
url: string
key: string
}
export type FileServiceGetUploadStreamResult = {
writeStream: stream.PassThrough
promise: Promise<any>
url: string
fileKey: string
[x: string]: unknown
}
export type GetUploadedFileType = {
fileKey: string
isPrivate?: boolean
[x: string]: unknown
}
export type DeleteFileType = {
fileKey: string
[x: string]: unknown
}
export type UploadStreamDescriptorType = {
name: string
ext?: string
isPrivate?: boolean
[x: string]: unknown
}
Features
- feat(api-reference): Add rewrite to UI docs by @kasperkristensen in #4791
- feat(medusa-file-local): implement missing streaming methods by @fPolic in #4788
- feat(medusa):
PriceListImportStrategy
descriptive errors by @fPolic in #4842
Bugs
- fix(medusa-interfaces, medusa-file-*): flag for streaming to a private bucket by @fPolic in #4771
- fix(utils,product): mikro orm connection loader by @carlos-r-l-rodrigues in #4825
- fix(medusa-telemetry): added missing babel dependencies by @shahednasser in #4817
- fix(admin-ui): Fix sign out in admin panel not redirecting correctly by @StephixOne in #4837
- fix(admin-ui): Fix variant creation when no stock locations provided by @StephixOne in #4843
- fix(admin-ui): Typo for should in the "Create Region" form by @ vfrunza in #4854
Docs
- docs: added beta features documentation by @shahednasser in #4859
- docs,api-ref: added search filters by @shahednasser in #4830
Full Changelog: v1.14.0...v1.15.0