Commit Graph

1412 Commits

Author SHA1 Message Date
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
Shahed Nasser
aa7ea4d9a6 chore: add tsdocs for latest changes (#13539) 2025-09-18 18:04:24 +03:00
Oli Juhl
76497fd40a fix(core-flows): Lock cart on shipping update (#13535) 2025-09-17 21:29:45 +02:00
William Bouchard
1071296236 feat(core-flows): hook to set shipping opt context when listing (#13468)
* feat(core-flows): add hook to set shipping option context when listing them

* changeset

* add integration test

* add it to other workflow

* missing hook in workflow response

* rework workflow

* rework workflow

* typing issue

* comment from oli

* cursor the goat

* tests

* save lines

* move code around

* missing additional params in many places

* smal fix

* smal fix
2025-09-17 19:20:02 +02:00
Frane Polić
8565dcfc46 fix(core-flows, medusa): don't allow negative line item quantity (#13508)
* fix(core-flows,medusa): don't allow negative line item quantity

* fix: greater than 0

* feat: add test

* wip: update update item flow to remove item when qty is 0

* fix: paralelize

* fix: when argument

* fix: emit event
2025-09-16 11:54:20 +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
Shahed Nasser
4af1815c5b chore: add a link to the storefront docs for cart item totals type (#13514) 2025-09-15 16:18:20 +00:00
William Bouchard
88748ba09d fix(types): pluralize words ending in s like status (#13461)
* fix(types): pluralize words ending in s like status

* changeset
2025-09-15 11:27:13 -04:00
William Bouchard
2a29c6f82c fix(types): cart item totals optional (#13509)
Totals are not returned by default, so they should be marked as optional
2025-09-15 13:28:34 +00:00
Shahed Nasser
040fbf3220 chore(core-flows): use directory convention for locking steps (#13501) 2025-09-15 14:46:08 +03:00
Shahed Nasser
b1d068197b chore: update TSDocs of JS SDK store methods to clarify required auth (#13507) 2025-09-15 14:33:11 +03: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
Shahed Nasser
21c6e8600f chore(js-sdk): add ignore tag to views (#13503) 2025-09-15 13:30:11 +03:00
Sebastian Rindom
23d5a902b1 feat(dashboard): reusable config datatable (#13389)
* feat: add a reusable configurable data table

* fix: cleanup

* fix: cleanup

* fix: cache invalidation

* fix: test

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-09-15 10:59:00 +02:00
Leonardo Benini
1b30b656b3 fix(js-sdk): skip null values in query qs.stringify (#13460)
* escape null values in qs.stringify

* skip null values

---------

Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-09-12 12:07:56 -04: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
Adrien de Peretti
29dca1ca48 fix(): update cart line item route fetching (#13477)
**What**
Remove cart fetching before workflow which fetch the cart as well
2025-09-11 10:12:13 +00:00
Adrien de Peretti
a4b72f9a21 fix(): prepare list query for list (#13476)
* fix(): prepare list query for list

* Create two-bulldogs-scream.md
2025-09-11 11:50:33 +02:00
Adrien de Peretti
0079464f32 fix(): temporary transform cached data (#13467)
**What**
Properly store key obj reference for weak map usage
2025-09-11 07:31:01 +00:00
Adrien de Peretti
0700a2448c chore(): Remove extra manager fork (#13458)
RESOLVE CORE-1182

**What**
Remove unnecessary extra manager fork that need reconciliation under the hood
2025-09-11 07:29:47 +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
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
0b55295fc7 Revert "chore(): Upgrade mikro orm (#13390)" (#13449)
This reverts commit a095245d71.
2025-09-09 20:06:31 +02:00
SteelRazor47
6634765ced fix(types): add missing retrieveProductOptionValue to module interface (#12313)
* fix(types): add missing retrieveProductOptionValue to module interface

* changeset

* Update tsdoc

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-09 13:43:53 -04: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
Carlos R. L. Rodrigues
b776fd55dc chore(core-flows): lock on cart operations (#13424)
What:
 - acquire a lock before cart mutations to avoid concurrent changes, e.g applying promotions.
2025-09-08 18:05:09 +00:00
Adrien de Peretti
8e5c22a8e8 chore(): Improve workflows sdk tooling (#13421)
RESOLVES CORE-1171

**What**
 - Reduced async overhead for objects with mixed sync/async properties
 - Lower memory pressure from eliminated promise allocations
 - Faster primitive value processing with early returns
 - Better concurrency through selective batching of truly async operations
 - Event loop friendly behavior preventing artificial delays
 - Reduced memory allocation from eliminated duplicate processing
 - Decreased GC pressure from WeakMap-based caching instead of map

**note**
Now, `resolveValue`always treat every resoltion as sync operation unless it is not, meaning we do not create promise overhead when not necessary and only when actually treating with promises
2025-09-08 16:24:10 +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
Patryk Spychalski
ca471eb8f4 feat: Add return type in createPaymentCollectionForCartWorkflow (#13385)
* return created payment collection in createPaymentCollectionForCartWorkflow

* changeset

* Update .changeset/tasty-ghosts-work.md

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* declare return type

* return single payment collection instead of array

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-09-07 19:24:09 +02:00
Adrien de Peretti
2fe68a975b chore(): Improve some cart operation flows to remove extraneous operations when not required (#13418)
RESOLVES CORE-1155

**What**
- prevent update payment collection worklow to fetch data and call steps when there is no payment collection
- prevent refresh Cart Shipping Methods Workflow to fetch data and call steps when there is no shipping methods
- update promotion step to remove extraneous module call
2025-09-07 12:52:36 +00:00
Frane Polić
0000ed6998 fix(draft-order, medusa, types): ui polish (#13376)
**What**
- ensure unique promotion changes are displayed in the activity section
- check linked promotions by id and not code
- list promotions - add id param
- make address payload fields nullish
- Add items view UI tweaks

---

CLOSES SUP-2400
2025-09-05 06:55:07 +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
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
b85a46e85b chore(): faster serialization (#13325)
* chore(): Improve serialization perf

* better optimization with monomorphic approach and consistent object shape and array operations

* cleanup

* cleanup

* fix

* Create short-birds-help.md

* ref work

* ref work

* address feedback

* save intermediary changes

* save intermediary changes
2025-09-02 10:19:59 +02:00
Frane Polić
fb71bc6405 fix(core-flows): handle cacluated shipping options on draft orders gracefully (#13353)
* fix(core-flows): handle calculated shipping options on draft orders gracefully

* fix: throw medusa error
2025-09-02 10:06:31 +02:00
Sebastian Rindom
c717535ca2 feat(admin): add configurable order views (#13211)
Adds support for configurable order views.

https://github.com/user-attachments/assets/ed4a5f61-1667-4ed7-9478-423894f3eba6
2025-09-01 17:04:18 +00: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
Sebastian Rindom
2a94dbd243 feat(ui): add column visibility and drag-and-drop reordering support (#13198) 2025-09-01 12:03:56 +00:00
Sebastian Rindom
5a46372afd Feat/datatable core enhancements (#13193)
**What**

This PR adds core DataTable enhancements to support view configurations in the admin dashboard. This is part of a set of stacked PRs to add the feature to Medusa.

- Puts handlers in place to update the visible columns in a table and the order in which they appear.
- Adds a ViewPills component for displaying and switching between saved view configurations
- Integrated view configuration hooks (useViewConfigurations) with the DataTable

Note: Column drag-and-drop reordering and the column visibility UI controls are not included in this PR as they require additional UI library updates - which will come in the next PR.

Example of what this looks like with the feature flag turned on - note the view pills with "default" in the top. This will expand when the data table behavior adds configuration.
<img width="2492" height="758" alt="CleanShot 2025-08-13 at 2  31 35@2x" src="https://github.com/user-attachments/assets/ee770f1c-dae1-49da-b255-1a6d615789de" />
2025-09-01 10:30:05 +00:00
Sebastian Rindom
fa10c78ed3 feat(admin): add view configuration client infrastructure (#13186)
This is part of stacked PRs to add a view configuration feature which will allow users to customize the columns seen in tables in the Medusa Admin dashboard.

**What**
- Adds client providers, sdk methods and hooks for interacting with the views api.
2025-09-01 09:20:37 +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
Shahed Nasser
ad71eef38c chore: add since tag to shipping option type events (#13331) 2025-08-28 20:58:01 +03: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
e2213448ac feat: custom logger (#13156)
* feat: custom logger

* mock log

* unit test

* FF and jobs loader

* unit test

* add to ResourceLoader

* get from container

* mock

* rm log

* default logger mock

* link loaders, express

* comments

* initialize container as first step

* db conn

* test

* initialize start

* plugin build using default logger

* ignore .medusa

* revert ignroe

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-08-28 15:31:19 +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