Commit Graph

839 Commits

Author SHA1 Message Date
Adrien de Peretti
1347698876 feat(): improve module typings in medusa config (#14478)
* feat(events): Allow priority configuration

* feat(events): Allow priority configuration

* wip

* wip

* wip

* fix typings

* Create cold-lamps-search.md

* implement priority config usage

* comment out #1

* fixes

* fixes
2026-01-14 18:39:57 +01:00
Nicolas Gorga
d60ea7268a feat(translation,fulfillment,customer,product,region,tax,core-flows,medusa,types): Implement dynamic translation settings management (#14536)
* Add is_active field to translation_settings model

* Types

* Workflows

* Api layer

* Tests

* Add changeset

* Add comment

* Hook to create or deactivate translatable entities on startup

* Cleanup old code

* Configure translatable option for core entities

* Validation step and snake case correction

* Cleanup

* Tests

* Comment in PR

* Update changeset

* Mock DmlEntity.getTranslatableEntities

* Move validation to module service layer

* Remove validation from remaining workflow

* Return object directly

* Type improvements

* Remove .only from tests

* Apply snakeCase

* Fix tests

* Fix tests

* Remove unnecessary map and use set instead

* Fix tests

* Comments

* Include translatable product properties

* Avoid race condition in translations tests

* Update test
2026-01-14 07:09:49 -03:00
Adrien de Peretti
7307a5e63f feat(events): Implement default priority-based event processing (#14476)
* feat(events): Set internal events default priority to lowest, default events to 100 and order placed to 10

* Create swift-months-rush.md

* improvements

* improvements

* improvements

* fix condition

* doc

* fix tests

* fix tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2026-01-12 16:05:42 +01:00
erbold-bu
514cc329f8 feat: added mn-MN to the default list of locales (#14487)
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2026-01-12 09:14:17 +01:00
Lukas Krisikaitis
e91ce2ee4b feat(locales): add lt-LT to the default list of locales (#14518) 2026-01-12 09:07:00 +01:00
Nicolas Gorga
6cbbd033e4 chore(order): Add missing OrderItem GraphQL schema fields (#14459)
* Add missing grapqhl schema fields to order item

* Add changeset
2026-01-10 13:22:24 -03:00
github-actions[bot]
8fee89d622 chore: Version Packages (#14483)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-09 12:52:13 +01:00
Adrien de Peretti
233ec261be fix: Add schema only flag on Medusa app loader (#14502)
* fix(build): Introduce a schema only flag for more heavy light weight loading

* fix(build): cleanup and tests

* Create shy-snails-raise.md

* fix(build): cleanup
2026-01-09 12:21:28 +01:00
Adrien de Peretti
bb599a26de feat(medusa-app): Link initialization should respect migrationOnly flag (#14493)
* feat(medusa-app): Link initialization should respect migrationOnly flag

* Create cyan-taxis-behave.md
2026-01-08 15:13:32 +01:00
Adrien de Peretti
568742826f feat(): Add modules options autocomplete to medusa config (#14465)
* feat(): Add modules options autocomplete to medusa config

* feat(): Add modules options autocomplete to medusa config

* Create great-lies-decide.md

* feat(): Add modules options autocomplete to medusa config
2026-01-07 21:24:35 +01:00
Carlos R. L. Rodrigues
b2245cc672 chore(rbac): user link and utils (#14320) 2026-01-07 10:40:15 -03:00
Carlos R. L. Rodrigues
1bfde8dc57 feat(rbac): role-based access control module (#14310) 2026-01-07 05:36:39 -03:00
github-actions[bot]
229fc6f8fd chore: Version Packages (#14331)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-06 16:21:52 +01:00
Shahed Nasser
60f68ff492 chore: update TSDocs + export getTranslatedShippingOptionsStep from core-flows (#14460) 2026-01-06 15:26:23 +02:00
Adrien de Peretti
9d2c78db4e fix(translation): omit id from types properties (#14445)
* fix(translation): omit id from types properties

* Create dry-toes-lay.md
2026-01-05 20:24:37 +01:00
Nicolas Gorga
11de7e3e34 feat(translation,core-flows): translate remaining core entities and sync shipping option <> method translations (#14358)
* Get translated shipping options step

* Apply translations on shipping options list methods.

* Pass shipping option naem when refreshing cart shipping methods, so if locale changed, we update the name

* Update translatable fields config

* Cart shipping method update translation tests

* Shipping options translations tests

* Add changeset

* Update order shipping method translations on update

* Remove unnecessary workflow and use step instead

* Translate shipping method on order edit

* Use new update shipping methods tranlsations step

* Draft order shipping method translation sync

* Translate shipping method on order exchange

* Translate returns shipping methods

* Translate claims shipping methods

* Remove unnecessary check

* Early return

* Fix import

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2026-01-02 11:26:06 +01:00
Oli Juhl
5f807ee657 chore: Ensure isolated order deletion (#14405)
## Summary

Ensure that address deletion during order deletion is handled correctly with respect to cascading deletes. Currently, when deleting an order that does not have a shipping or billing address, we incorrectly attempt to delete all order addresses. This happens because `undefined` address IDs are not handled properly during deletion.

More specifically, when deleting an order without addresses, the following method is called with these arguments:
```ts
await deleteOrderAddresses([undefined, undefined])
```
This triggers deletion of all order addresses.

To make matters worse, because we have a cascade delete defined from order addresses to orders, the same call also deletes all associated orders.

The root cause is the following filtering logic:
```ts
const orderAddressIds = orders
      .map((order) => [order.shipping_address_id, order.billing_address_id])
      .flat(1)
```

For orders without addresses, this produces `[undefined, undefined]` as input filter, which our delete methods interpret as:
```ts
await delete({ '$or': [ { id: undefined }, { id: undefined } ] })
```

This effectively translates to “delete all addresses.”

In this PR, we make two changes to prevent this going forward:
1. Filter out undefined address IDs before attempting deletion
2. Remove the cascade delete from address to order, as this is an aggressive constraint

The latter change is open for discussion, but cascading deletes from a child entity to a parent is slightly off IMO. Let me know your thoughts.

## Checklist

Please ensure the following before requesting a review:

- [x] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [x] The changes are covered by relevant **tests**
- [x] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


---

> [!NOTE]
> Strengthens order deletion to avoid unintended cascades and validates behavior with tests.
> 
> - Update FK constraints in migration to `ON DELETE SET NULL` for `order.shipping_address_id` and `order.billing_address_id` (was `CASCADE`)
> - In `order-module-service.ts` `deleteOrders`, filter falsy address IDs and conditionally batch-delete `order_address`/`order_change` via `promiseAll`
> - Add integration tests `integration-tests/__tests__/delete-order.spec.ts` covering deletion of orders and associated entities, deleting orders without addresses (no cross-order impact), and address deletion setting `NULL` on the order
> - Add changeset marking `@medusajs/order` patch
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8e4ab59af407ec865f73fbf286ec93e710915c8e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2026-01-02 10:16:29 +00:00
Pedro Guzman
001923da2b feat: add Medusa Cloud OAuth provider (#14395)
* feat: add Medusa Cloud OAuth provider

* add Cloud login button

* fetch whether cloud auth is enabled through api

* allow unregistered to get session

* handle existing users

* address PR comments

* prevent double execution

* a few more fixes

* fix callback url

* fix spelling

* refresh session

* 200 instead of 201

* only allow cloud identities to create user

* fix condition
2025-12-30 17:30:10 +01:00
Adrien de Peretti
b21a599d11 feat(): Translation settings + user configuration + admin hook and js sdk + dashboard (#14355)
* feat(): Translation settings + user configuration

* feat(): Translation settings + user configuration

* Create gentle-bees-grow.md

* add entities end point

* add entities end point

* add admin hook and js sdk method

* update changeset

* fix tests

* fix tests

* rm unnecessary copy

* update dashboard to use the new resources

* update dashboard to use the new resources

* update dashboard to use the new resources

* allow type inference through interface augmentation in the defineConfig of medusa-config

* allow type inference through interface augmentation in the defineConfig of medusa-config

* exclude id and _id props

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-19 15:29:48 +01:00
Irakli
1c89acc536 feat: added ka-GE to the default list of locales (#14364) 2025-12-19 12:48:57 +01:00
Adrien de Peretti
fb6a6b52fa fix(order): Prevent fetching all db adjustments when no items are pre… (#14351)
* fix(order): Prevent fetching all db adjustments when no items are present

* Create funny-suns-think.md
2025-12-18 15:21:32 +01:00
0xFl4g
0277062fec fix(translation): prevent duplicate locale error on server restart (#14345)
The translation module's defaults loader throws a warning on every server
restart after the first run because the upsert method uses `id` as the
unique key, but defaultLocales only contains `code` and `name`.

This causes the upsert to always attempt creation, which fails on the
unique `code` constraint with: "Locale with code: en-US, already exists."

Fix: Fetch existing locales first and map their IDs into defaultLocales
so upsert can properly identify existing records and update them.
2025-12-18 11:56:18 +01:00
github-actions[bot]
cfa38871cb Version Packages (#13978)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-17 13:55:25 +01:00
Nicolas Gorga
b5edbb9940 fix(pricing,dashboard): update min_quantity/max_quantity to decimal in price model (#14045) 2025-12-16 13:38:53 -03:00
Adrien de Peretti
8c29d85f0f feat(): remove status from translatable fields (#14321)
* feat(): remove status from translatable fields

* Create tender-mugs-shave.md

* feat(): remove status from translatable fields
2025-12-16 14:57:06 +01:00
Shahed Nasser
88a3cf7172 chore: TSDocs for Translation Module (#14280)
* tsdocs for translation module

* fixes
2025-12-16 13:30:26 +02:00
Adrien de Peretti
f5ec359c4c fix: Readonly link feature flag conditional (#14316)
* chore(): Improve readonly link disability

* chore(): Improve readonly link disability

* Create soft-rockets-chew.md

* fix
2025-12-16 11:25:56 +01:00
Adrien de Peretti
d813fc4ff9 chore(): Migration generator fix generated import (#14315)
* chore(): Migration generator fix generated import

* Create two-olives-try.md

* feedback
2025-12-16 11:11:02 +01:00
Adrien de Peretti
e94e1a4676 feat(): Add more translatable core entity (#14311)
* feat(): Add product type and collection translation support

* Create sharp-poets-give.md

* feat(): Add product type and collection translation support

* feat(): Add product type and collection translation support

* options

* options

* shipping options/type

* return reason

* fix

* leave out shipping and return reason

* leave out shipping and return reason

* leave out shipping and return reason
2025-12-15 17:13:32 +01:00
Adrien de Peretti
ba6ed8d9dd feat(): Translation statistics (#14299)
* chore(): Translation statistics

* chore(): improve statistics performances

* add end point to get statistics

* add tests

* Create spicy-games-unite.md

* feat(): add material and fix tests

* feat(): add translatable api

* feat(): add translatable api

* fix tests

* fix tests

* fix tests

* feedback
2025-12-15 14:11:49 +01:00
Adrien de Peretti
0f1566c644 feat(): Add support for store locales end point (#14307)
**What**
Add support for `store/locales` which return the configured supported locales
2025-12-15 13:10:43 +00:00
Nicolas Gorga
8964a03fa1 chore(): Remove default_locale from StoreLocale (#14300)
## Summary

**What** — What changes are introduced in this PR?

Remove `default_locale` from Store <> Locale relation

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.


Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-15 09:05:46 +00:00
Nicolas Gorga
dd3eb10b1a fix(link-modules): export store locale link definition (#14293)
## Summary

**What** — What changes are introduced in this PR?

Export missing store locale link definition.

**Why** — Why are these changes relevant or necessary?  

*Please provide answer here*

**How** — How have these changes been implemented?

*Please provide answer here*

**Testing** — How have these changes been tested, or how can the reviewer test the feature?

*Please provide answer here*

---

## Examples

Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.  
This helps with documentation and ensures maintainers can quickly understand and verify the change.

```ts
// Example usage
```

---

## Checklist

Please ensure the following before requesting a review:

- [ ] I have added a **changeset** for this PR
    - Every non-breaking change should be marked as a **patch**
    - To add a changeset, run `yarn changeset` and follow the prompts
- [ ] The changes are covered by relevant **tests**
- [ ] I have verified the code works as intended locally
- [ ] I have linked the related issue(s) if applicable

---

## Additional Context

Add any additional context, related issues, or references that might help the reviewer understand this PR.
2025-12-14 11:15:44 +00:00
Carlos R. L. Rodrigues
9366c6d468 feat: order export and upload stream (#14243)
* feat: order export

* Merge branch 'develop' of https://github.com/medusajs/medusa into feat/order-export

* normalize status

* rm util

* serialize totals

* test

* lock

* comments

* configurable order list
2025-12-14 12:02:53 +01:00
Carlos R. L. Rodrigues
e199f1eb01 fix(index): detect enum field (#14298)
## Summary

**What** — What changes are introduced in this PR?

Fixes Enum fields detection on Index module
2025-12-13 20:35:07 +00:00
Shahed Nasser
a4ca4ef170 fix(translation): add index file for models (#14272) 2025-12-12 10:10:16 +01:00
Adrien de Peretti
f13c23a4b7 feat(): Sync order translations (#14267)
* feat(): Sync order translations

* feat(): Sync order translations

* tests

* Create tender-melons-develop.md

* fix tests

* cleanup

* cleanup
2025-12-11 15:40:11 +01:00
olivermrbl
237b472e73 chore: Version packages 2025-12-11 14:10:54 +01:00
Adrien de Peretti
9852a7c74d fix(): Improve store currency readonly link (#14276)
* fix(): Improve store currency readonly link

* fix(): Improve store currency readonly link

* fix(): Improve store currency readonly link

* Create wicked-rabbits-sparkle.md
2025-12-11 10:47:44 +01:00
Adrien de Peretti
d7398736e8 fix(): Improve store supported locale -> locale readonly link (#14269)
* fix(): store supported locales read only link

* fix(): store supported locales read only link

* Create two-books-reply.md

* remove unnecessary links

* remove unnecessary links

* remove unnecessary links

* fix(): store supported locales read only link

* fix(): store supported locales read only link

* improve link
2025-12-11 10:00:12 +01:00
Nicolas Gorga
8bd1d22765 chore(order): Remove unique index on item_id:version for order_item (#14268)
* Remove unique index

* Add changeset

* Remove previous migration file

* Remove down method
2025-12-10 13:51:08 +01:00
Adrien de Peretti
e4877616c3 feat(): sync cart translation synced (#14226)
ref: https://github.com/medusajs/medusa/pull/14189

  **Summary**

  This PR extends the translation module to support automatic translation syncing for cart line items based on the cart's locale.

  Key changes:
  - Added locale field to the Cart model to store the cart's locale preference
  - Created new workflow steps:
    - getTranslatedLineItemsStep - Translates line items when adding to cart or creating a cart
    - updateCartItemsTranslationsStep - Re-translates all cart items when the cart's locale changes
  - Integrated translation logic into cart workflows:
    - createCartWorkflow - Applies translations to initial line items
    - addToCartWorkflow - Applies translations when adding new items
    - updateCartWorkflow - Re-translates all items when locale_code is updated
    - refreshCartItemsWorkflow - Maintains translations during cart refresh
  - Added applyTranslationsToItems utility to map variant/product/type/collection translations to line item fields (title, subtitle, description, etc.)
2025-12-10 08:37:30 +00:00
Adrien de Peretti
356283c359 chore(): Accept an extra agument 'all-or-nothing' on the migrate command (#14262)
* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* Create rich-camels-brush.md

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): fix broken down migrations

* chore(): update changeset
2025-12-10 09:23:41 +01:00
Adrien de Peretti
bff0142e7a chore(): Move event bus local logging (#14244)
**what**
Log only when actually processing events
2025-12-09 18:27:38 +00:00
Adrien de Peretti
6dc0b8bed8 feat(): Introduce translation module and preliminary application of them (#14189)
* feat(): Translation first steps

* feat(): locale middleware

* feat(): readonly links

* feat(): feature flag

* feat(): modules sdk

* feat(): translation module re export

* start adding workflows

* update typings

* update typings

* test(): Add integration tests

* test(): centralize filters preparation

* test(): centralize filters preparation

* remove unnecessary importy

* fix workflows

* Define StoreLocale inside Store Module

* Link definition to extend Store with supported_locales

* store_locale migration

* Add supported_locales handling in Store Module

* Tests

* Accept supported_locales in Store endpoints

* Add locales to js-sdk

* Include locale list and default locale in Store Detail section

* Initialize local namespace in js-sdk

* Add locales route

* Make code primary key of locale table to facilitate upserts

* Add locales routes

* Show locale code as is

* Add list translations api route

* Batch endpoint

* Types

* New batchTranslationsWorkflow and various updates to existent ones

* Edit default locale UI

* WIP

* Apply translation agnostically

* middleware

* Apply translation agnostically

* fix Apply translation agnostically

* apply translations to product list

* Add feature flag

* fetch translations by batches of 250 max

* fix apply

* improve and test util

* apply to product list

* dont manage translations if no locale

* normalize locale

* potential todo

* Protect translations routes with feature flag

* Extract normalize locale util to core/utils

* Normalize locale on write

* Normalize locale for read

* Use feature flag to guard translations UI across the board

* Avoid throwing incorrectly when locale_code not present in partial updates

* move applyTranslations util

* remove old tests

* fix util tests

* fix(): product end points

* cleanup

* update lock

* remove unused var

* cleanup

* fix apply locale

* missing new dep for test utils

* Change entity_type, entity_id to reference, reference_id

* Remove comment

* Avoid registering translations route if ff not enabled

* Prevent registering express handler for disabled route via defineFileConfig

* Add tests

* Add changeset

* Update test

* fix integration tests, module and internals

* Add locale id plus fixed

* Allow to pass array of reference_id

* fix unit tests

* fix link loading

* fix store route

* fix sales channel test

* fix tests

---------

Co-authored-by: Nicolas Gorga <nicogorga11@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-12-08 19:33:08 +01:00
Frane Polić
6176f93ac5 fix(dashboard,order): preview pending diff summary (#14221)
* wip: preview pending diff summary

* fix: return test

* fix: rm return calc from processAction_

* chore: cleanup

* chore: changeset

* feat: add estimated diff for return,claim,exchange forms

* chore: changeset
2025-12-08 09:57:13 +01:00
Adrien de Peretti
fe49b567d6 chore: Backend HMR (expriemental) (#14074)
**What**

 This PR introduces experimental Hot Module Replacement (HMR) for the Medusa backend, enabling developers to see code changes reflected immediately without restarting the server. This significantly improves the development experience by reducing iteration time.

### Key Features

  - Hot reload support for:
    - API Routes
    - Workflows & Steps
    - Scheduled Jobs
    - Event Subscribers
    - Modules
  - IPC-based architecture: The dev server runs in a child process, communicating with the parent watcher via IPC. When HMR fails, the child process is killed and restarted, ensuring
  clean resource cleanup.
  - Recovery mechanism: Automatically recovers from broken module states without manual intervention.
  - Graceful fallback: When HMR cannot handle a change (e.g., medusa-config.ts, .env), the server restarts completely.


### Architecture
```mermaid
  flowchart TB
      subgraph Parent["develop.ts (File Watcher)"]
          W[Watch Files]
      end

      subgraph Child["start.ts (HTTP Server)"]
          R[reloadResources]
          R --> MR[ModuleReloader]
          R --> WR[WorkflowReloader]
          R --> RR[RouteReloader]
          R --> SR[SubscriberReloader]
          R --> JR[JobReloader]
      end

      W -->|"hmr-reload"| R
      R -->|"hmr-result"| W
```

### How to enable it

Backend HMR is behind a feature flag. Enable it by setting:

```ts
  // medusa-config.ts
  module.exports = defineConfig({
    featureFlags: {
      backend_hmr: true
    }
  })
```

or

```bash
export MEDUSA_FF_BACKEND_HMR=true
```

or

```
// .env
MEDUSA_FF_BACKEND_HMR=true
```

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-12-08 08:48:36 +00:00
Adrien de Peretti
144f0f4e2e chore(event-bus, workflow-engine): Enable more granualar queues configuration (#14201)
Summary

  This PR adds BullMQ queue and worker configuration options to the workflow-engine-redis module, bringing feature parity with the event-bus-redis module. It also introduces per-queue
  configuration options for fine-grained control over the three internal queues (main, job, and cleaner).

  Key changes:
  - Added per-queue BullMQ configuration options (mainQueueOptions, jobQueueOptions, cleanerQueueOptions and their worker counterparts) with shared defaults
  - Unified Redis option naming across modules: deprecated url → redisUrl, options → redisOptions (with backward compatibility)
  - Moved configuration resolution to the loader and registered options in the DI container
  - Added comprehensive JSDoc documentation for all configuration options
  - Added unit tests for option merging and queue/worker configuration

  Configuration Example

```ts
  // Simple configuration - same options for all queues
  {
    redisUrl: "redis://localhost:6379",
    queueOptions: { defaultJobOptions: { removeOnComplete: 1000 } },
    workerOptions: { concurrency: 10 }
  }
```

```ts
  // Advanced configuration - per-queue overrides
  {
    redisUrl: "redis://localhost:6379",
    workerOptions: { concurrency: 10 },        // shared default
    jobWorkerOptions: { concurrency: 5 },      // override for scheduled workflows
    cleanerWorkerOptions: { concurrency: 1 }   // override for cleanup (low priority)
  }
```
2025-12-05 12:03:12 +00:00
Pedro Guzman
56ed9cf9f7 fix S3 URL escaping (#14220) 2025-12-04 22:03:17 +01:00
Pedro Guzman
b7adfb225b fix: escape non-ascii characters in filenames in s3 file provider (#14209)
* escape non-ascii characters in filenames in s3 file provider

* fix url encoding
2025-12-04 18:37:56 +01:00