Commit Graph

1350 Commits

Author SHA1 Message Date
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
William Bouchard
e0943f3c90 fix(medusa): stop loading entry points in exec command (#13438) 2025-09-09 18:10:56 +00: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
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
Carlos R. L. Rodrigues
bd571aca82 chore(orchestration): remote joiner query planner (#13364)
What:
 - Added query planning to the Remote Joiner, enabling phased and parallel execution of data aggregation.
- Replaced object deletes with non-enumerable property hiding to improve performance.
2025-09-04 14:18:02 +00:00
William Bouchard
faae150a58 fix(utils): big bumber should give numeric value of 0 for small numbers (#13394)
* fix(utils): big bumber should give numeric value of 0 for small numbers

* circular dep

* fix imports

* fix infinite loop

* fix test

* changeset
2025-09-03 13:45:41 -04: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
Carlos R. L. Rodrigues
b4c0f131b7 chore(framework,medusa): load custom flags before medusa config (#13312)
* chore(framework,medusa): load custom flags before medusa config

* test

* test runner

* changeset

* check manager featureFlags

* discover and register flags

* rm comments

* update changeset

* changeset

* use local cli

* execute from local medusa command

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2025-09-01 16:04:43 +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
Carlos R. L. Rodrigues
8176d0f684 chore(core-flows): revert idempotent cart (#13336) 2025-08-28 22:45:43 +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
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
Oli Juhl
b3fb0f7634 chore: Revert #13189 (#13318) 2025-08-28 11:46:01 +02:00
Frane Polić
6b04fbcc50 fix(core-flows): pass backorder flag when recreating reservations after fulfilment cancelation (#13076) 2025-08-27 21:22:03 +02: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
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
Adrien de Peretti
6264a6262b fix: Cart operation should calculate item prices accounting for quantity (#13251)
* fix(): Cart operation should calculate item prices accounting for quantity

* fix(): Cart operation should calculate item prices accounting for quantity

* fix(): Cart operation should calculate item prices accounting for quantity

* fix when call warning

* fix tests and remove unnecessary object copy

* Create warm-dancers-allow.md

* fix update line item in cart workflow

* fix changeset

* update order flows

* fix cart spec integration tests

* improve create order workflow

* fixes and tests adjustments/improvements

* configurable useQueryGraphStep return type

* revert nullable take

* cleanup useQueryGraphStep
2025-08-25 09:38:58 +02: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
Frane Polić
492e018957 feat(dashboard, core-flows, js-sdk, types, medusa): listing order's shipping options (#13242)
* feat(dashboard, core-flows,js-sdk,types,medusa): listing order's shipping option

* fix: typo

* chore: migrate claim form

* fix: cleanup rule logic

* feat: add test case, rm params

* fix: expand location name
2025-08-21 13:01:27 +02:00
William Bouchard
6602e893b8 chore(medusa): fetch shipping related attributes (#13244)
* chore(medusa): fet shipping related attributes

* some tests

* changeset

* small refactor

* typing

* adapt attribute value

* test

* test again
2025-08-20 13:03:27 -04:00
Oli Juhl
b152210554 feat(core-flows): Refresh adjustments when editing orders (#13189)
* wip

* add tests

* add more tests

* fixes buy-get promotion

* Create empty-pillows-promise.md

* chore: use query graph

* Update packages/core/core-flows/src/order/workflows/order-edit/refresh-order-edit-adjustments.ts

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>

---------

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
2025-08-20 15:04:27 +02:00
Frane Polić
2f594291ad fix(core-flows, dashboard, types): improve allocation flows on Admin (#12572)
**What**
- handle single inventory items with `required_quantity > 1` correctly in the allocate UI flow
- display correct availability amount in the create fulullment form for inventory kit items
- fix check in the create fulfillment flow that would allow negative reservation because `required_quantity` wasn't included in the check
- show the most recent reservations first in the reservations table
- display an error in the allocation form if a reservation is not created for some inventory items 
- display inventory kit in the order summary if the product has multiple same inventory items

---

CLOSES SUP-1655
2025-08-19 18:48:24 +00: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
Carlos R. L. Rodrigues
fd4e791428 fix(utils): auto generated update method return (#13225)
* fix(utils): auto generated update method return

* tests

* cleanup

* rm unused function

* Update .changeset/young-mangos-suffer.md

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-18 13:26:36 +02: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
Sebastian Rindom
d2cb9523e0 feat: add column introspection api (#13183)
This is part of a set of stacked PRs to add support for view configurations, which will allow users to customize the columns shown in admin tables.

The functionality in this PR is behind the view_configuration feature flag.

**What**
- Adds an API to introspect the remote query schema and extract columns that users can add to their table views.

**Notes**
- This is a brute forced approach to get the functionality in place and I expect it to evolve to something more elegant over time. Some ideas for things we might want to consider:
  - Compute the entity columns during build time and store as static data the API can serve quickly.
  - Offer developers more control over how their data can be exposed in this API with additional decorators in the DML.
2025-08-15 15:35:01 +00:00
Sebastian Rindom
12a38bcd2b feat(api): add view configuration API routes (#13177)
* 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

* feat(api): add view configuration API routes

- Add CRUD endpoints for view configurations
- Add active view configuration management endpoints
- Add feature flag middleware for view config routes
- Add comprehensive integration tests
- Add HTTP types for view configuration payloads and responses
- Support system defaults and user-specific configurations
- Enable setting views as active during create/update operations

* fix: test

* fix: test

* fix: test

* fix: change view configuration path

* fix: tests

* fix: remove manual settings module config from integration tests

* fix: container typing

* fix: workflows
2025-08-15 13:17:52 +02:00
Sebastian Rindom
ab795bb0a2 feat: view config feature flag (#13171)
* 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
2025-08-15 08:56:40 +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
Jan Biardzki
257e71f988 fix(core-flows): fix update tax lines to apply tax rule by product type (#13202)
* test(draft-order): add draft order creation test with tax application by product type

* fix: add `product_type.id` and `items.product_type_id` fields to order utilities

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-14 20:07:43 +02:00
William Bouchard
34c3c14e0a chore(types, api): support shipping option type api endpoints (#13191)
* 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

* description optional

* woops my bad

* my bad again

---------

Co-authored-by: william bouchard <williambouchard@williams-MacBook-Pro.local>
2025-08-14 10:15:51 -04:00
github-actions[bot]
01fa17d2ad chore: Version Packages (#13045)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-14 13:23:45 +02:00
Oli Juhl
f4ae615a3e fix(tax): Use correct rule reference for shipping (#13195)
* fix(tax): Use correct rule reference

* fix tests
2025-08-13 21:06:19 +02:00
Riqwan Thamir
224eaedf5c fix(dashboard,promotion): percentage promotions + set currency code on percentage promotions (#13161) 2025-08-07 13:07:41 +02:00
Carlos R. L. Rodrigues
9725bff25d fix(index): logical operators (#13137) 2025-08-07 07:34:50 -03:00
William Bouchard
acf6bbc2ec chore(core-flows): throw error on invalid promo code (#13140)
* chore(core-flows): throw error on invalid promo code

* add changelog

* better error handling in test

---------

Co-authored-by: william bouchard <williambouchard@williams-MacBook-Pro.local>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-08-05 09:01:41 -04:00
scherddel
51d4751d95 fix(utils): Fix on precision for high quantities for items when promotion is applied (#13131)
* Fix on precision for high quantities for items when promotion is applied

* Fix on precision for high quantities for items when promotion is applied
2025-08-03 19:16:16 +02:00
scherddel
9766570827 fix(types,utils,promotion): Move from total to original_total to resolve edge case for adjustments calculation (#13106)
* Move from total to original_total to resolve edge case in adjustment calculation

* Added changeset

* Added test case for correction

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-01 12:52:04 +02:00
tehaulp
881c8a4969 feat: added pacific franc currency (#13086) 2025-08-01 09:32:50 +02:00
scherddel
1bdf602f1c This fixes the discount_ calculation logic and promotion tax inclusiveness calculation (#12960)
* This fixes the discount_ calculation logic

* This fixes the adjustment to be handled as a subtotal value in every calculation and applies the tax inclusive logic on the promotion value itself

* Added some testcases and revoked some changes to improve testing output

* Fixed a test case based on feedback

* Corrected promotion/admin test cases

* Corrected cart/store test case

* Improved cart/store test cases for more robust promotion testing considering tax inclusion flags

* Remove unnessary changes as adjustments now automatically are subtotals and therefore the tax inclusive flag does not need to be applied again

* Remove adjustments->is_tax_inclusive usage everywhere

* Migration script to remove is_tax_inclusive in cart line item adjustment

* Forgot to adjust one more testcase

* Corrections based on fPolic feedback

* Refactored PR to consider feedback from oliver

* Added more testcases for promotion in cart

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-07-31 13:27:43 +02:00
Riqwan Thamir
75320e744f fix(promotion): check currency when computing actions for promotions (#13084)
* fix(promotion): check currency when computing actions for promotions

* chore: fix tests

* chore: fix more specs
2025-07-31 11:41:07 +02:00
Frane Polić
9fb5baa912 fix(core-flows): guest customer updates email to another guest account (#13037)
* fix(core-flows); guest customer updates email to another guest account

* wip: refactor test

* fix: refactor step, add testing

* fix: update test

* fix: string assertion in a test
2025-07-25 12:49:06 +02:00
github-actions[bot]
137ea0883d chore: Version Packages (#12924)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-24 09:41:35 +02:00
Frane Polić
439c711845 fix(dashboard, product): product attributes update with a relation update (#13019)
* fix(dashboard, product): product attributes update with a relation update

* fix: rm log

* chore: refactor
2025-07-23 21:01:50 +02:00
Frane Polić
40625c82d6 fix(core-flows): properly delete variant inventory item (#12958)
* fix(core-flows): properly delete variant inventory item

* fix: rm unused code
2025-07-16 21:16:29 +02:00
Christopher Seven Phiri
1797f0298b feat: Added Malawi kwacha to currency list (#12440)
* Add Malawi kwacha currency

* fix failing currency tests

---------

Co-authored-by: Stevche Radevski <sradevski@live.com>
2025-07-16 10:26:28 +02:00