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