70 Commits

Author SHA1 Message Date
Adrien de Peretti
9d9d0397a8 fix(): Index integration tests flackyness (#13953)
* fix(): Index integration tests flackyness

* fix

* Create twenty-eels-remain.md

* fix

* fix

* fix

* fix

* finalize

* finalize

* finalize

* finalize

* finalize

* finalize

* chore: empty commit

* finalize

* finalize

* chore: empty commit

* finalize

* finalize
2025-11-05 10:40:12 +01:00
Adrien de Peretti
516f5a3896 fix: workflow async concurrency (#13769)
* executeAsync

* || 1

* wip

* stepId

* stepId

* wip

* wip

* continue versioning management changes

* fix and improve concurrency

* update in memory engine

* remove duplicated test

* fix script

* Create weak-drinks-confess.md

* fixes

* fix

* fix

* continuation

* centralize merge checkepoint

* centralize merge checkpoint

* fix locking

* rm only

* Continue improvements and fixes

* fixes

* fixes

* hasAwaiting will be recomputed

* fix orchestrator engine

* bump version on async parallel steps only

* mark as delivered fix

* changeset

* check partitions

* avoid saving when having parent step

* cart test

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-10-20 15:29:19 +02:00
Adrien de Peretti
b43b285125 fix(): Workflow save to db + index integration instability (#13707)
**What**
- Fix index integration tests instability
- Fix workflow engine storage save to db
2025-10-08 08:45:15 +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
Adrien de Peretti
d517dbd66a feat(): Add support for jwt asymetric keys (#12813)
* feat(): Add support for jwt asymetric keys

* Create early-chefs-chew.md

* fix unit tests

* Add verify options support

* feedback

* fix unit tests
2025-06-25 10:29:32 +02:00
Carlos R. L. Rodrigues
f615ebb7e8 chore: retry util on tests (#12126) 2025-04-09 16:07:05 +00:00
Adrien de Peretti
a8e19faf8d chore: use framework sub paths everywhere (#9253) 2024-09-26 16:38:38 +05:30
Carlos R. L. Rodrigues
950cf9af79 chore: remove container registration name (#9137) 2024-09-16 06:22:24 -03:00
Riqwan Thamir
a729fb3fbb feat(utils,types,framework,medusa): store endpoints should require publishable key (#9068)
* feat(utils,types,framework,medusa): store endpoints should require publishable key

* chore: fix specs

* chore: fix more specs

* chore: update js-sdk

* chore: fix specs wrt to default SC

* chore: revert custom headers + change error message

* chore: fix specs

* chore: fix new store specs
2024-09-11 15:08:37 +02:00
Oli Juhl
4bf42f7889 fix: Update auth app_metadata when deleting users + customers (#9041)
* wip

* more work

* working on stuff

* more

* fix test

* remove incorrect test

* fix test

* fix: Only allow deletion of yourself

* remove redundant tests
2024-09-10 19:58:16 +02:00
Stevche Radevski
62e0c593c8 feat: Add support for refreshing JWT tokens (#9013)
* feat: Add support for refreshing JWT tokens

* feat: Add refresh method to the auth SDK
2024-09-06 12:58:57 +02:00
Riqwan Thamir
0573bb924a chore: Remove typeORM (#9005)
* chore: rename js files to txt

* chore: rename ts files to txt

* chore: delete environment helpers

* chore: convert global setup & teardown to txt

* chore: rename helper js/ts files to txt

* chore: rename seeder js/ts files to txt

* chore: remove typeorm

* chore: reintroduce used helpers
2024-09-05 15:45:30 +02:00
Stevche Radevski
3a068c6b27 feat: Use tag ids instead of values wherever possible (#8394) 2024-08-02 09:22:03 +02:00
Stevche Radevski
1c3ef13371 feat: Add necessary middlewares for tax inclusive pricing (#7827)
We are adding tax inclusive pricing calculation when listing products.

Two things to keep in mind:
- `region_id` will be required if you request calculated prices.
- We won't accept `currency_code` anymore, as that will come from the region info (since ultimately a cart and its currency are tied to a region)

REF CORE-2376
DEPENDS ON #8003
2024-07-09 09:37:13 +00:00
Carlos R. L. Rodrigues
a7844efd09 chore: move ModuleRegistrationName to utils (#7911) 2024-07-03 06:30:56 -03:00
Stevche Radevski
e8d6025374 Add support for tax inclusivity to region and store (#7808)
This also includes rework of the currency model for the Store module.

This change is breaking as existing stores won't have any supported currencies set, so users would need to go to the store settings again and choose the supported currencies there.
2024-06-24 15:25:44 +00:00
Adrien de Peretti
48963f55ef Chore/rm main entity concept (#7709)
**What**
Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate.
This pr also includes various fixes in different modules

Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-06-19 13:02:16 +00:00
Stevche Radevski
a62a8be016 chore: Move price list tests to HTTP folder (#7632)
* chore: Move price list tests to HTTP folder

* chore: Remove several unused helpers
2024-06-06 17:17:41 +02:00
Stevche Radevski
e44fe78b96 fix: Several fixes to store product endpoints, moved several test suites to HTTP (#7601)
* chore: Move publishable api key tests to HTTP

* chore: Move store tests to HTTP folder

* fix: Add tests for store products, fix several bugs around publishable keys
2024-06-04 21:00:07 +02:00
Oli Juhl
ce40fe88f5 chore: Move admin invites + user tests to HTTP (#7596) 2024-06-04 10:53:01 +02:00
Stevche Radevski
135772b27b feat: Revert to using app_metadata for authentication (#7433) 2024-05-23 22:01:41 +02:00
Stevche Radevski
8a070d5d85 Revamp the authentication setup (#7419)
* feat: Add email pass authentication provider package

* feat: Revamp auth module and remove concept of scope

* feat: Revamp the auth module to be more standardized in how providers are loaded

* feat: Switch from scope to actor type for authentication

* feat: Add support for per-actor auth methods

* feat: Add emailpass auth provider by default

* fix: Add back app_metadata in auth module
2024-05-23 20:56:40 +02:00
Stevche Radevski
5ede560f70 feat(auth): Revamp authentication setup (#7387)
* chore: Clean up authentication middlewares

* chore: Rename AuthUser to AuthIdentity

* feat: Define link between user, customer, and auth identity

* feat: Use links for auth, update auth context content

* fix: Adjust user create command with new auth setup

* fix: Make auth login more dynamic, review fixes

* fix: Change test assertions for created by
2024-05-22 10:27:32 +02:00
Riqwan Thamir
43613f3f58 chore: pick the default store region (#7369)
* chore: pick the default store region

* chore: fix test

* chore: remove from defaults workflow and move to seeds

* chore: undo payment provider change

* chore: rearrange conditionals
2024-05-21 12:05:01 +02:00
Stevche Radevski
d680c7ee4c Remove v1-related code from medusa app (#7326)
* chore: Remove unused validations and utilities

* chore: Remove all resources that are not being loaded

* chore: Remove unused dependencies, typeorm related code and fix tests

* chore: Use createAdminUser in all module tests
2024-05-14 13:21:30 +02:00
Adrien de Peretti
71f4f46cb9 chore(medusa): cleanup medusa package (#7206) 2024-05-07 12:48:49 +02:00
Stevche Radevski
cbb5e6bd99 feat: Refactor the product module definitions and implementation (#6866)
There are several things done in this PR, namely:

Unify the service endpoints API to always work with a model rather than allowing to pass both ID and model (eg. both type_id and type being available in the request to create).
Start using upsertWithReplace to simplify the code and fix some deassociation bugs
Apply some changes to tests to deal with the pricing breaking changes
Correctly define the model relationships (with both ID and entity fields available)
All tests for the product are passing, which should bring us back to a great baseline.
2024-03-29 09:03:41 +00:00
Oli Juhl
0deb2776ad feat: Add successRedirectUrl to auth options (#6792) 2024-03-25 08:55:21 +01:00
Stevche Radevski
12b035cb18 chore(tests): Try to use the api integration tests for v2 (#6588)
Few things to keep in mind:
1. You need to set MEDUSA_FF_MEDUSA_V2 to true before running the tests to run with the v2 API
2. You can use the `breaking` function to differentiate between v1 and v2 differences. This can help us identify what was breaking pretty quickly afterwards
3. You will need to run specific tests for now instead of all if you want to target v2. I think that's fine though, as we don't really need these to run on every PR until we have feature parity (and by then, all tests would be both v1 and v2 compatible)


**note: Adrien** 
- add a new way to load modules only to run their loaders comparable to the way to run the migrations only
- improve tests runner to cleanup the data properly as well as re running all loaders and core defaults

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-03-07 08:05:43 +00:00
Adrien de Peretti
f0ef0a8784 fix: integration-tests/modules (#6595) 2024-03-06 11:45:34 +00:00
Stevche Radevski
a6736c7ee0 fix: Add some tests and test cleanup for product module (#6586) 2024-03-05 17:18:46 +01:00
Adrien de Peretti
6975eacb33 feat(medusa): Improve add line item to cart perf and transaction management + clustering start command (#5701) 2023-12-06 08:53:35 +01:00
Philip Korsholm
90e24c593f Fix/pricing update fixes (#5275)
* fix for merging line items and quantity prices

* add changeset

* fix draft order unit_price calculation

* update test to reflect only quantity change

* fix unit tests

* update conditional
2023-10-03 11:20:49 +02:00
Philip Korsholm
2b91049f58 fix(medusa): quantity prices for line item updates (#5137)
* initial code push

* update metadata and only merge if the existing line item allows merging

* update should_merge check

* undo changes to taxrate service

* update results with unit pricing corresponding to the db values after update

* add should_merge property to line_item creation

* add should_merge property to line_item creation

* fix unit tests

* undo adding "should_merge" to create-line-item

* undo change to "addOrUpdateLineItem"

* :wqh_merge from generate method

* undo changes to unit tests

* revert to adding pricing in updateLineItem method

* update cart service test

* Create funny-radios-juggle.md

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-09-28 14:26:58 +02:00
David Preininger
2caff2efc7 feat(medusa): Authentication overhaul (#4064)
* implemented bearer auth

* changed naming strat

* changed session auth to not use jwt

* typo

* changed auth header prefix for admin api token auth

* fixed supporting functions to work with new session type

* removed database calls for bearer auth improving performance

* removed unused deps

* changed auth in tests

* added integration tests

* Accepted suggested change

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

* Typo

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* more typos

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* proper formatting

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* removed endregion

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* removed startregion

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* fixed admin JWT integration test

* added more fixes to integration tests

* Update OAS

* Create fluffy-donkeys-hope.md

* created API reference for new auth

* implemented getToken in medusa-js

* Apply suggestions from code review

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* Apply suggestions from code review

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* deleted files which should be autogenerated

* Update fluffy-donkeys-hope.md

* JSDoc update

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

* added missing route exports

* implemented runtime domain safety in jwt token manager

* fixed jwt manager

* lint get-token files

* Update fluffy-donkeys-hope.md

* Revert "deleted files which should be autogenerated"

This reverts commit cd5e86623b822e6a6ac37322b952143ccc493df9.

* Revert "Apply suggestions from code review"

This reverts commit f02f07ce58fd9fcc2dfc80cadbb9df2665108d65.

* Revert "created API reference for new auth"

This reverts commit c9eafbb36453f5cf8047c79e94f470cb2d023c7d.

* renamed header for sending api access tokens

* medusa-js - changed apiKey header

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: olivermrbl <oliver@mrbltech.com>
Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
2023-09-25 13:57:44 -04:00
Philip Korsholm
5d10c46bb1 feat(medusa): Separate money amount and variant (#4906)
* initial changes

* working test

* final changes to product tests

* update integration tests

* update price list integration tests

* update integration tests

* update unit tests

* update plugin integration tests

* remove catch from integration test

* undo change

* add andWhere

* update upsertCurrencyMoneyAmount method

* undo line item changes

* undo changes

* update deprecated method

* Update packages/medusa/src/migrations/1692953518123-drop_money_amount_constraints_for_pricing_module.ts

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

* rename joinTable

* update with joinTable entity

* update load methods

* remove await create

* re-add context test

* update price list behavior for prices

* update price list snapshots

* re-add admin seeder

* pr feedback

* fix unit tests

* fix plugin integration tests

* initial review changes

* redo changes to variant creation

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-09-13 13:26:20 +02:00
Carlos R. L. Rodrigues
4b0e3fb2a7 feat(medusa,orchestration): Decouple Product in Cart domain (#4945) 2023-09-08 17:24:46 +02:00
Oli Juhl
a2d7540e40 fix(medusa): Remove shipping on updates to cart.items (#4715)
* rm shipping on line item updates

* Add tests

* remove verbose flag

* Create real-items-rhyme.md
2023-08-08 14:53:47 +02:00
Adrien de Peretti
d2a8cf0378 feat(medusa): Continue create product workflow changes (#4473) 2023-07-24 13:30:24 +02:00
Philip Korsholm
c9989529ed fix(medusa): Price selection strategy bug with customer groups without customers (#4578)
* change up condition for joining price lists

* add changeset

* naming

* update tests
2023-07-24 11:10:17 +02:00
Adrien de Peretti
4d326fbbdf chore: Move factories and helpers to a better place (#4551)
* chore: Move factories and helpers to a better place

* align factory product variant

* fix factory cart

* add simple store fac

* fix tests

* fix tests

* fix

* fix cart seeder
2023-07-20 13:16:04 +02:00
Oliver Windall Juhl
a91987fab3 feat(medusa): Remove sqlite support (#4026) 2023-05-17 12:13:36 +02:00
Carlos R. L. Rodrigues
77d46220c2 Feat(modules-sdk,inventory,stock-location): modules isolated connection (#3329)
* feat: scoped container for modules
2023-03-15 12:09:45 -03:00
Frane Polić
f97b3d7cce feat(medusa): Cache modules (#3187) 2023-03-10 15:09:26 +01:00
Riqwan Thamir
121b42acfe chore(medusa): Typeorm upgrade to 0.3.11 (#3041) 2023-02-15 16:25:30 +01:00
Carlos R. L. Rodrigues
f776ed234f feat(medusa): Run shared module migrations (#3109) 2023-02-01 08:10:59 -03:00
Oliver Windall Juhl
9e3beaf531 chore(feature-flags): Remove OrderEditing feature flag (#3006) 2023-01-13 11:10:09 +00:00
Oliver Windall Juhl
8ba0addea3 chore(integration-tests): Add test for database options (#2707)
**What**
- Add integration test suite for database options
- Expose integration tests DB to additional options
- Add test for `idle_in_transaction_session_timeout`
2023-01-06 13:41:05 +00:00
Patrick
86f9455d00 test: allow integration-tests to leverage workspaces optimizations (#2727)
### What
Leverage yarn workspaces and Turborepo for integration-tests in order to accelerate development and reduce DevX complexity.

### Why
The current solution for running integration tests requires using `medusa-dev-cli` in order to publish packages to a local npm repository. The package where the command is executed will have its package.json altered for any known medusa dependency in order to install from the local npm. The process is taxing on the host machine resources and prevents rapid iterations when working with integration tests.

For more information, see documentation: f0cc1b324c/docs/content/usage/local-development.md (run-api-integration-tests)

### How
By declaring `integeration-tests/**/*` as a workspace, Turborepo can now be leveraged to build and run integration test as if there were packages. The build process will take care of interdependency between package in order to ensure local dependency are met.

In addition, within each integration-tests "packages", we can declare local dependencies as "*" which will translate to using the one that is part of the current build, regardless of the dependency's version number. No more fiddling with version numbers.

Github actions pertaining to integration-tests have been streamlined to use the new behavior.

The integration-tests packages have been marked as `private:true` in order to avoid publishing them to the public npm registry.

### Testing
```
cd root-of-medusajs-medusa-repo/
yarn install
yarn build
yarn test:integration:api
yarn test:integration:plugins
```

After a code change, `yarn build` must be run before re-running an integration test, which is the same procedure as for unit tests.

Resolves: CORE-845
2022-12-08 14:57:16 +00:00
Adrien de Peretti
42d9c7222b feat(medusa): Performance improvements of Carts domain (#2648)
**What**

I have created a new method on the cart service which is `addLineItems`, allowing a user to add one or multiple items in an optimized way. Also updated the `generate` method from the line item service which now also accept a object data or a collection of data which. Various places have been optimized and cache support has been added to the price selection strategy.

The overall optimization allows to reach another 9000% improvement in the response time as a median (Creating a cart with 6 items):

|   | Min (ms)  | Median (ms)  | Max (ms)  | Median Improvement (%)
|---|:-:|---|---|---|
| Before optimisation  | 1200  | 9999 | 12698  |  N/A
| After optimisation | 63  | 252  | 500  | 39x
| After re optimisation | 56 | 82  | 399  | 121x
| After including addressed feedback | 65 | 202  | 495  | 49x

FIXES CORE-722
2022-12-07 14:39:12 +00:00