Commit Graph

802 Commits

Author SHA1 Message Date
Adrien de Peretti
cb716856b6 fix(engine): Always create cleaner job (#13557)
RESOLVES CORE-1206

**What**
Instead of removing cleaner repeatable job and risk to remove it while other instances are still up, we always create it, since the id of a job is unique and we give one to the job, if already present it wont get added
2025-09-19 14:38:14 +00:00
William Bouchard
0695c5844f fix(auth-emailpass): better handle identity with same email error (#13537)
* fix(auth-emailpass): better handle identity with same email error

* add test

* Create blue-laws-argue.md

* check for empty object

* trueeee

* nit

* flip condition
2025-09-18 13:05:54 -04:00
github-actions[bot]
174b5b1cb7 chore: Version Packages (#13494)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-18 18:38:07 +02:00
Carlos R. L. Rodrigues
9563ee446f fix(utils,core-flows): subtotal calculation and returns location (#13497)
* fix(utils,core-flows): subtotal calculation and returns location

* changeset

* fix test

* var

* rm extra field from test

* fix original total

* fix partial refunds and pending difference

* fix test

* fix test

* test

* extract to util

* original total and update payment when receive return

* original_subtotal

* default fields

* test

* calculate pending difference

* revert claims test

* pending difference

* creadit line fix

* if
2025-09-18 17:50:40 +02:00
Adrien de Peretti
4736c58da5 fix: Prevent promotion filtering to exceed psql limits (#13540)
* fix(): Prevent promotion filtering to exceed psql limits

* Create sour-rockets-grin.md
2025-09-18 17:50:10 +02:00
Adrien de Peretti
57897c232e feat(): prefilter top level promotion rules in db (#13524)
* feat(): promotion pre filtering rule from db

* wip

* feat(): promotion pre filtering rule from db

* improve test readability

* resolve conflict

* fix automatic flag

* add index on attribute and operator

* add index on attribute and operator

* finalize

* cleanup

* cleanup

* cleanup

* cleanup

* Create purple-cars-design.md

* fixes

* fixes

* simplify filters

* fix filter

* fix filter

* further improvements

* fixes

* fixes

* fixes

* fix exclusion

* fix comment

* fix comment
2025-09-18 14:34:03 +02:00
Adrien de Peretti
25634b0382 test(): test dynamic max workers and improve CI (#13516)
* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* test(): test dynamic max workers

* Clarify test description and improve CI
2025-09-16 11:11:03 +02:00
Adrien de Peretti
ebf33bea43 fix(): pipeline missing suites (#13457)
* fix(): pipeline missing suites

* fix tax integration tests

* fix tax integration tests

* fix pipeline

* fix link integration tests

* remove old tests and move current one

* fix workflow execution integration tests

* fix tests and orchestrator

* Fix missing suites in pipeline

Remove integration-tests-modules from patch list.
2025-09-15 12:54:57 +02:00
github-actions[bot]
6525ac5c1c chore: Version Packages (#13354)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-12 15:42:43 +02:00
William Bouchard
4fded2602b fix(medusa,product): fix ordering product categories (#13487)
CLOSES CORE-1191

cc @SteelRazor47
2025-09-11 21:18:40 +00:00
Adrien de Peretti
d828005354 chore(): improve inventory module (#13463)
RESOVLES CORE-1185

**What**
Reduce higher function call to reduce overserialization
2025-09-11 10:11:49 +00:00
Adrien de Peretti
58e20fa3fc chore(): Add missing product status index (#13475)
**What**
Add missing product status index
2025-09-11 09:54:12 +00:00
Adrien de Peretti
8dd9ae3d35 chore(): Improve cart module (#13472)
* chore(): Improve cart module

* Create giant-spoons-crash.md
2025-09-11 11:50:58 +02:00
Adrien de Peretti
de9a21a9da chore(): Improve link indexes (#13459)
RESOLVE CORE-1183

**What**
Update link indexes to include deleted_at index constraint
2025-09-11 07:44:13 +00:00
Adrien de Peretti
823a5c75ff chore(): order module index and some impl details (#13462)
* order module fixes

* order module fixes

* fixes

* revert big number

* Create wet-wombats-rule.md
2025-09-11 09:02:38 +02:00
Adrien de Peretti
368c1d1e17 fix(): product image missing index (#13466)
**What**
Add product image imssing index
2025-09-10 17:01:04 +00:00
Adrien de Peretti
8e849074e4 fix(): missing events (#13465)
**What**
Add missing create event for sales channel and fix link module to properly emit detached event with the correct data shape
2025-09-10 15:41:20 +00:00
Adrien de Peretti
e8822f3e69 chore(): Module Internal Events (#13296)
* chore(): Ensure the product module emits all necessary events

* chore(): Ensure the product module emits all necessary events

* Update events tests

* more events and fixes

* more tests and category fixes

* more tests and category fixes

* Add todo

* update updateProduct_ event emitting and adjust test

* Adjust update products implementation to rely on already computed events

* rm unnecessary update variants events

* Fix formatting in changeset for product events

* refactor: Manage event emitting automatically (WIP)

* refactor: Manage event emitting automatically (WIP)

* chore(api-key): Add missing emit events and refactoring

* chore(cart): Add missing emit events and refactoring

* chore(customer): Add missing emit events and refactoring

* chore(fufillment, utils): Add missing emit events and refactoring

* chore(fufillment, utils): Add missing emit events and refactoring

* chore(inventory): Add missing emit events and refactoring

* chore(notification): Add missing emit events and refactoring

* chore(utils): Remove medusa service event handling legacy

* chore(product): Add missing emit events and refactoring

* chore(order): Add missing emit events and refactoring

* chore(payment): Add missing emit events and refactoring

* chore(pricing, util): Add missing emit events and refactoring, fix internal service upsertWithReplace event dispatching

* chore(promotions): Add missing emit events and refactoring

* chore(region): Add missing emit events and refactoring

* chore(sales-channel): Add missing emit events and refactoring

* chore(settings): Add missing emit events and refactoring

* chore(stock-location): Add missing emit events and refactoring

* chore(store): Add missing emit events and refactoring

* chore(taxes): Add missing emit events and refactoring

* chore(user): Add missing emit events and refactoring

* fix unit tests

* rm changeset for regeneration

* Create changeset for Medusa.js patch updates

Add a changeset for patch updates to multiple Medusa.js modules.

* rm unused product event builders

* address feedback

* remove old changeset

* fix event action for token generated

* fix user module events

* fix import

* fix promotion events

* add new module integration tests shard

* fix medusa service

* revert shard

* fix event action

* fix pipeline

* fix pipeline

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-09-10 14:37:38 +02:00
Adrien de Peretti
49a4caa62d chore(): Cart fixes and opti (#13455)
**What**
- Remove overserialization
- fix wrong transaction usage
- call the right service instead of higher level methods
2025-09-10 10:53:36 +00:00
Adrien de Peretti
ac09b3cbef Chore(): localised improvement to promotion module (#13446)
**What**
- Remove overserialization withing transaction and rely more on internal service or protected method instead which does not serialize and work with Infered entity type
- Slightly rework loop complexity

Overall, this gives a good spare of resources and time spent for serialization
2025-09-10 10:20:31 +00:00
Adrien de Peretti
0b55295fc7 Revert "chore(): Upgrade mikro orm (#13390)" (#13449)
This reverts commit a095245d71.
2025-09-09 20:06:31 +02:00
Amirkhon
1b681a79da feat(dashboard,currency): added Tajikistani somoni currency (#13178)
* added Tajikistani somoni currency

* updated currencies.ts

* changeset

* updated changeset

---------

Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-09-09 13:03:39 -04:00
Adrien de Peretti
a095245d71 chore(): Upgrade mikro orm (#13390)
* chore(): Upgrade mikro orm

* handle 'null' value for big number props

* 6.5.2

* remove only

* fix pricing module rule value

* switch select in strategy for balances

* revert to select in strategy for order module

* fix defining DML ManyToOne

* fix define relationship

* test fix

* more fixes

* change order strategy to balanced

* change order strategy to balanced

* prevent unnecessary manager fork

* revert generated www changes

* remove unnecessary changes

* Create real-cobras-deny.md

* address feedback

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-09-08 21:10:44 +02:00
Adrien de Peretti
fc4d5f0ac9 chore(): Workflow engine timers and notification improvements (#13434)
RESOLVES CORE-1177

**What**
main changes are:
- not blocking execution when notifying
- timers management
- race condition checks improvements
2025-09-08 18:19:55 +00:00
Adrien de Peretti
d7692100e7 chore(orchestration): add support for autoRetry, maxAwaitingRetries, retryStep (#13391)
RESOLVES CORE-1163
RESOLVES CORE-1164

**What**

### Add support for non auto retryable steps.

When marking a step with `maxRetries`, when it will fail it will be marked as temporary failure and then retry itself automatically. Thats the default behaviour, if you now add `autoRetry: false`, when the step will fail it will be marked as temporary failure but not retry automatically. you can now call the workflow engine run to resume the workflow from the failing step to be retried.

### Add support for `maxAwaitingRetries`

When setting `retyIntervalAwaiting` a step that is awaiting will be retried after the specified interval without maximun retry. Now you can set `maxAwaitingRetries` to force a maximum awaiting retry number

### Add support to manually retry an awaiting step

In some scenario, either a machine dies while a step is executing or a step is taking longer than expected, you can now call `retryStep` on the workflow engine to force a retry of the step that is supposedly stucked
2025-09-08 12:46:30 +00:00
Carlos R. L. Rodrigues
71d8a0031f fix(index): index enum fields (#13428)
https://github.com/medusajs/medusa/issues/13372

What:
 - It handles enum fields corretly when added to filterable fields
2025-09-07 13:39:58 +00:00
Adrien de Peretti
55a35e4721 chore(workflows-sdk, utils): Prevent unnecessary serialization (#13413)
* chore(workflows-sdk, utils): Prevent unnecessary serialization

* Create poor-mugs-cheat.md
2025-09-04 16:19:35 +02:00
Adrien de Peretti
2b89510df3 chore(): only execute race execution checks and publish message only for async workflows (#13396)
* chore(): only execute race execution checks for async workflows

* chore(): workflow redis publish only for async flows

* Create cyan-gorillas-poke.md

* chore(): workflow redis publish only for async flows

* fix negative check

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-04 09:12:09 +02:00
William Bouchard
2f6edf367a feat(dashboard,cart,types,utils): refine order details summary (#13313)
* feat(dashboard,types,utils): refine order details summary

* fix tests

* changeset

* ui corrections

* tests again

* weird tests failing

* revert update to subtotal

* revert http tests too

* comments

* move credit lines so it makes more sense

* remove currency codes and add bold prices

* add new properties in default for storefront

* minor to patch

* remove bold on things that should be

* olis comment about taxes

* remove bold from shipping
2025-09-02 20:50:37 +02:00
Adrien de Peretti
bd206cb250 chore(): improve workflow engine storage (#13345)
* chore(workflow-engines): Improve race condition management

* cleanup

* cleanup

* chore(workflow-engines): Improve race condition management

* chore(workflow-engines): Improve race condition management

* chore(workflow-engines): heartbeat extend TTL

* Refactor chore title for workflow engine improvements

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* chore(): Improve workflow execution db interaction

* update tests

* revert idempotent

* add run_id index + await deletion

* improve saving

* comment

* remove only

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-02 11:18:12 +02:00
Riqwan Thamir
ca038ff583 feat(promotion): Allow buyget promotion to apply multiple times on cart (#13305)
what:

Introduces 2 new features to promotion module:

1. Introduce max quantity limit to promotion application - This will limit the application of the promotion based on the quantity of the target products in the cart. 
2. When applying buy get promotions, we will now apply buyget promotion until eligible items are exhausted or max quantity is reached. 

```
- Buy 2 t-shirts, Get 1 sweater
- Max quantity -> 1

This means you can add two t-shirts, and get 1 sweaters for free. However, if you add four t-shirts, you only get one sweater for free.
```

```
- Buy 2 t-shirts, Get 1 sweater
- Max quantity -> 3

This means you can add six t-shirts, and get three sweaters for free. However, if you add eight t-shirts, you only get three sweaters for free
```

```
- Buy 4 t-shirts, Get 2 sweater
- Max quantity -> 1

This should throw on creation, as the max quantity should as a minimum be the same value as the target rule quantity
```

RESOLVES SUP-2357 / https://github.com/medusajs/medusa/issues/13265
2025-08-31 13:35:36 +00:00
github-actions[bot]
6dca59d0a5 chore: Version Packages (#13338)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-28 22:58:13 +02:00
github-actions[bot]
08ec3ed9f2 chore: Version Packages (#13209)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-28 17:25:32 +02:00
Carlos R. L. Rodrigues
9412669e65 chore: idempotent cart operations (#13236)
* chore(core-flows): idempotent cart operations

* changeset

* add tests

* revert

* revert route

* promo test

* skip bugs

* fix test

* tests

* avoid workflow name conflict

* prevent nested workflow from being deleted until the top level parent finishes

* remove unused setTimeout

* update changeset

* rm comments

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
2025-08-28 15:04:00 +02:00
Adrien de Peretti
ff152e7ace fix(orchestration): Use the step definition max retries on set step failure (#13319)
* fix(orchestration): Use the step definition max retries on set step failure

* Create sweet-turkeys-wait.md

* allow to force permanent failure

* update changeset
2025-08-28 14:35:31 +02:00
Carlos R. L. Rodrigues
f764b3a364 feat(index): $nin and $not operators (#13289)
* feat(index): add $not and $nin operators

* logical operator

* test

* test

* types

* logical

* schema ID

* types and $ilike fix

* index type
2025-08-28 11:56:17 +02:00
William Bouchard
059bfc1475 chore(fulfillment): cleanup old auto-generatred shipping type (#13298)
* chore(fulfillment): cleanup old auto-generatred shipping type

* changeset

* integrationt ests

* random id

* wrong code

* switch steps around

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-27 11:09:31 -04:00
Frane Polić
71818e43cb fix(medusa): fetching a product without a category with categories filed passed (#13020)
**What**
- adding `categories` to `fields` param would return 404 for an existing product if the product was not associated with a category

---

CLOSES CMRC-1046
2025-08-26 16:35:41 +00:00
Carlos R. L. Rodrigues
e413cfefc2 feat(utils): define file config (#13283)
** What
 - Allow auto-loaded Medusa files to export a config object.
 - Currently supports isDisabled to control loading.
 - new instance `FeatureFlag` exported by `@medusajs/framework/utils`
 - `feature-flags` is now a supported folder for medusa projects, modules, providers and plugins. They will be loaded and added to `FeatureFlag`

** Why
 - Enables conditional loading of routes, migrations, jobs, subscribers, workflows, and other files based on feature flags.

```ts
// /src/feature-flags

import { FlagSettings } from "@medusajs/framework/feature-flags"

const CustomFeatureFlag: FlagSettings = {
  key: "custom_feature",
  default_val: false,
  env_key: "FF_MY_CUSTOM_FEATURE",
  description: "Enable xyz",
}

export default CustomFeatureFlag
```

```ts
// /src/modules/my-custom-module/migration/Migration20250822135845.ts

import { FeatureFlag } from "@medusajs/framework/utils"

export class Migration20250822135845 extends Migration {
  override async up(){ }
  override async down(){ }
}

defineFileConfig({
  isDisabled: () => !FeatureFlag.isFeatureEnabled("custom_feature")
})
```
2025-08-26 12:22:30 +00:00
William Bouchard
338a42f728 chore(promotion): cleanup old unused promotion codebase (#13294)
* chore(promotion): cleanup old unused code

* changeset
2025-08-25 09:35:17 -04:00
Adrien de Peretti
fc49253273 feat(core, event-bus): Compensate emit event step utility (#13281)
* feat(core, event-bus): Compensate emit event step utility

* tests

* Update changeset to remove integration-tests-modules

Removed integration-tests-modules from changeset.

* revert test script
2025-08-25 15:08:09 +02:00
Frane Polić
57077406f9 fix(fulfillment): don't cascade shipping option delete to shipping option type (#13280)
**What**
- don't cascade delete shipping option type when shipping option is deleted since types can be shared between options
- prevent shipping option type deletion if there are options associated with it
2025-08-25 08:00:41 +00:00
Oli Juhl
f0ef444992 fix(fulfillment): Geozone constraints builder (#13282) 2025-08-23 14:51:04 +02:00
William Bouchard
486621383a feat(dashboard,core,modules): free shipping promotion in dashboard (#13263)
* feat(dashboard,core,modules): free shipping promotion in dashboard

* self-review

* adapt for edit to work

* changeset

* integration tests

* across for each

* remove only from tests

* remove console log

* revert to across

* update wording for shipping promotions

* modify changeset

* suggestion frane

* fix i18n schema
2025-08-22 16:30:30 -04:00
Adrien de Peretti
06ef9197f8 chore(pricing): Fix excessive db queries during price sets update (#13258)
* chore(pricing): Fix excessive db queries during price sets update

* chore(pricing): Fix excessive db queries during price sets update

* finalize upsert with replace of the rules

* fix limit

* Create quiet-pumpkins-hang.md

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-22 10:51:50 +02:00
William Bouchard
67d3660abf feat(dashboard, core-flows): associate shipping option to type (#13226)
* feat(dashboard, core-flows): allow associating shipping option type to a shipping option

* edit as well

* fix translation schema

* fix some tests

* changeset

* add new test to update shipping option type

* add new test to create shipping option with shipping option type

* pr comments

* pr comments

* rename variable

* make zod great again
2025-08-19 11:02:36 -04:00
Riqwan Thamir
3cc512ef39 fix(utils): fix promotion case of each allocation not applying its total amount (#13199)
* fix(utils): fix promotion case of each allocation not applying its amount

* chore: fixed tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-17 19:11:16 +02:00
Carlos R. L. Rodrigues
83d2ce762c chore(locking-redis): default ttl to acquire lock (#13221)
* chore(locking-redis): default ttl to acquire lock

* ttl only for the method execute
2025-08-15 11:44:24 -03:00
Sebastian Rindom
f7fc05307f feat: add settings module (#13175)
* feat: add view_configurations feature flag

  - Add feature flag provider and hooks to admin dashboard
  - Add backend API endpoint for feature flags
  - Create view_configurations feature flag (disabled by default)
  - Update order list table to use legacy version when flag is disabled
  - Can be enabled with MEDUSA_FF_VIEW_CONFIGURATIONS=true env var

* fix: naming

* fix: feature flags unauthenticated

* fix: add test

* feat: add settings module

* fix: deps

* fix: cleanup

* fix: add more tetsts

* fix: rm changelog

* fix: deps

* fix: add settings module to default modules list

* fix: pr comments

* fix: deps,build

* fix: alias

* fix: tests

* fix: update snapshots
2025-08-15 10:59:54 +02:00
William Bouchard
4b3c43fe92 feat(dashboard, js-sdk): shipping option type mngmt dashboard (#13208)
* chore(types, api): support shipping option type api endpoints

* core flows

* api

* typos

* compiler errors

* integration tests

* remove metadata

* changeset

* modify test

* upsert

* change remote query

* minor to patch

* description optional

* chore(dashboard, js-sdk): shipping option type management on admin dashboard

* description optional

* woops my bad

* my bad again

* create and edit

* prettier

* build code from label

* remove metadata route

* remove some translation text that is not used

* remove unsued files

* changeset

* adapt test

* fix test

* suggestion

---------

Co-authored-by: william bouchard <williambouchard@williams-MacBook-Pro.local>
2025-08-14 15:21:33 -04:00