npm @medusajs/medusa 1.17.4
v1.17.4

latest releases: 2.0.3-preview-20241110090143, 2.0.2-preview-20241110090215, 2.0.3-preview-20241110060142...
12 months ago

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

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

New Contributors

Full Changelog: v1.17.3...v1.17.4

Don't miss a new medusa release

NewReleases is sending notifications on new releases.