Commit Graph

9051 Commits

Author SHA1 Message Date
Shahed Nasser
f85df8fcdc chore: updated TSDocs of the Caching Module service + provider (#13696) 2025-10-06 18:06:46 +03:00
Shahed Nasser
54cf8811af docs: show badge for community integrations (#13691) 2025-10-06 11:18:51 +03:00
Adrien de Peretti
62d340b897 fix(): caching better identify default provider (#13675) 2025-10-03 21:04:27 +02:00
Shahed Nasser
80371a4344 docs: fix client error in UI docs (#13686) 2025-10-03 21:42:09 +03:00
William Bouchard
8acfb88c2b fix(core-flows): lock draft order workflows (#13668)
I added a lock in all workflows of the draft order. I don't think there are drawbacks and it will make sure we don't run into concurrency issues in with draft orders. I don't see why we would not add this in the order workflows, let me know and I can add it too.

I also didn't see any workflow that is long enough to justify adding a timeout of more than 2 seconds, but let me know if you think otherwise, we can discuss adjustments :)

CLOSES-1228
2025-10-03 18:05:22 +00:00
Mayuresh-1306
2d43a498cf docs: Add note on LF endings for Docker setup (#13650)
Resolves #13602


---

> [!NOTE]
> Adds a Windows-specific note instructing to use LF line endings for `start.sh` in the Docker setup to prevent container script errors.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 662beb3d53769741a3a320512162ddf7ea5b561b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>


Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2025-10-03 16:11:53 +00:00
Adrien de Peretti
4165172145 chore(): Downgrade mikro orm (performance regression) (#13680)
**What**
After lot of investigation, we finally found one of our performance regerssion point (see [here](https://github.com/mikro-orm/mikro-orm/issues/6905)), this pr downgrade mikro orm and move the strategy back to select in where needed
2025-10-03 15:31:40 +00:00
Nicolas Gorga
8a996a82a7 docs(): Add local development instructions in CONTRIBUTING.md (#13651)
* Add local development instructions in CONTRIBUTING.md

* Changes suggested by Shahed

* Update CONTRIBUTING.md

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

* Update CONTRIBUTING.md

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

* Update CONTRIBUTING.md

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

---------

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
2025-10-03 11:01:13 -04:00
Nicolas Gorga
40e396d5c3 docs(resources): Improve third party login (#13606)
* Remove harcoded email in create user payload, use user_metadata instead to resolve the field

* Execute prep command on book and resources projects

* Improve user_metadata comment as per Shahed's suggestion
2025-10-03 10:47:28 -04:00
Shahed Nasser
74fcc367c0 docs: add guide on storefront production optimization tips (#13682)
* docs: add guide on storefront production optimization tips

* add vale exception
2025-10-03 17:24:10 +03:00
Shahed Nasser
ad46a86a8f docs: fix error when translating page (#13681) 2025-10-03 16:03:33 +03:00
Shahed Nasser
fcb977a989 docs: remove mention of base64 requirement for api keys (#13679) 2025-10-03 14:10:16 +03:00
Shahed Nasser
dd4b3315f3 docs: added refund details related to transactions (#13677) 2025-10-03 14:09:59 +03:00
Shahed Nasser
a4757d462d docs: fixes to github solutions componen (#13676)
* docs: fixes to github solutions componen

* remove octokit dependency
2025-10-03 14:09:43 +03:00
Shahed Nasser
6ea97443de docs: improved analytics and tracking (#13671)
* docs: improved analytics and tracking

* remove detailed feedback component

* remove ignore build script for api reference

* improvements

* fix pathname
2025-10-03 13:33:48 +03:00
Shahed Nasser
50c1417378 docs: improve troubleshooting guide for pnpm (#13673)
* docs: improve troubleshooting guide for pnpm

* added pnpm link to installation guide
2025-10-03 13:09:01 +03:00
Adrien de Peretti
d58462c9c9 chore(): Caching improvements (#13660)
* chore(): Caching improvements

* Create proud-windows-sleep.md

* naming

* fix tests

* address feedback
2025-10-03 10:05:44 +02:00
Shahed Nasser
1789f3e257 docs: agentic commerce guide (#13657) 2025-10-03 08:54:39 +03:00
Shahed Nasser
d29c2abbba docs: fix cursor MCP link (#13664)
* docs: fix cursor MCP link

* fix error

* fix vale error
2025-10-03 08:54:12 +03:00
Nicolas Gorga
907fbc89a2 feat(medusa): include user_metadata in auth routes jwt (#13597)
**What**

Return provider specific user_metadata in jwt token returned by auth/[actor_type]/[auth_provider] routes.

**Why**

When implementing thrid party auth flows, to create the Medusa entity representing the actor type, you will need information obtained from the callback after the user consents. For google for example, you need the email, which so far is stored in the provider user_metadata property but is never returned in the http response.

This causes one to circumvent around this issue by creating an additional http route which gets the auth_identity from the auth_context object, to access the providers array and then look for the specific element matching the current auth_provider route.

**How**

Pass the auth_provider obtained from the route path param and pass it down to `generateJwtTokenForAuthIdentity` and inside it, find the provider matching the auth provider passed from route handler inside the auth identity `provider_identities` property. If found, assign its `user_metadata` value to the property of the same name in the payload of the token to be generated.

Now the user has the user_metadata property included in the obtained token and can use it's information to create the corresponding Medusa entity for the actor type in context. In the case of google and customer actor type, they would use `user_metadata.email` to call the create customer api endpoint.

**Testing**

Haven't found anywhere in the codebase where the http layer of /auth functionality is tested, but tested locally with debugger and test storefront to guarantee the user_metadata is returned as expected, all working correctly.

Fixes #13584 
CLOSES CORE-437 


---

> [!NOTE]
> Propagates auth provider to JWT generation and embeds provider-specific user_metadata in tokens returned by auth routes.
> 
> - **Auth JWT Payload**:
>   - `generateJwtTokenForAuthIdentity` now accepts optional `authProvider` and injects matching provider `user_metadata` into JWT payload.
> - **Auth Routes** (`auth/[actor_type]/[auth_provider]/*`):
>   - Pass `authProvider` from route params to JWT generator in `authenticate`, `register`, and `callback` handlers.
> - **Release**:
>   - Changeset adds patch for `@medusajs/medusa`.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4833faf84533ce7438bc37c15bd572f991988e69. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 18:21:50 +00:00
Shahed Nasser
4717ad9a59 docs: document preview limits in Cloud + general updates (#13661) 2025-10-02 19:17:50 +03:00
Adrien de Peretti
8734866eb1 fix(): Transform map (#13655)
**What**
It seems that for some reason the weak map fail in some scenario, but after investigation, the usage of map would not have a bad impact as it will be released after the Distributed transaction if finished. Therefore, falling back to Map instead

FIXES https://github.com/medusajs/medusa/issues/13654

NOTE: Waiting for the user feedback as he is also using node 18. We also use the exact same pattern in all our core flows without issues 🤔
2025-10-02 15:54:11 +00:00
Leonardo Benini
ea3d0100a9 feat(admin-bundler): forward env vars to plugin admin extensions (#13634)
* forward plugin envs

* mock process.env

* remove normalizedName

* strip prefix
2025-10-02 16:19:13 +02:00
Adrien de Peretti
76aa4a48b3 fix(): workflows concurrency (#13645) 2025-10-02 11:11:38 -03:00
Nicolas Gorga
ca334b7cc1 fix(inventory): delete reservation item inventory level required quantity (#13633)
Fixes #13625


---

> [!NOTE]
> Ensure `reserved_quantity` is adjusted when deleting reservation items via `deleteReservationItems`, with new integration tests covering deletion and inventory updates.
> 
> - **Inventory Module Service (`packages/modules/inventory/src/services/inventory-module.ts`)**:
>   - Add `deleteReservationItems` API (and transactional `_` variant) that hard-deletes reservations, then updates related inventory levels via `adjustInventoryLevelsForReservationsDeletion`.
>   - Wire through event emission/manager decorators consistent with existing patterns.
> - **Integration Tests (`packages/modules/inventory/integration-tests/__tests__/inventory-module-service.spec.ts`)**:
>   - Add tests for `deleteReservationItems` to verify deletion by id and `reserved_quantity` adjustments on inventory levels.
>   - Minor import update to include `ReservationItemDTO`.
> - **Changeset**:
>   - Patch release note for `@medusajs/inventory` documenting the fix.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ac6641a9ec9543115504407f708f81bd427c3444. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 12:59:13 +00:00
Leonardo Benini
9c957e1da0 chore(core-flows): only allow published products in addToCartWorkflow (#13182)
Closes #13163 

I have a few questions about expected behaviour, since this currently breaks some tests:

- Many tests use the productModule to create products, with default status == "draft", and use the addToCart workflow which now throws. Should I change all breaking tests to specify status == "published" whne creating the product? The alternative would be to check the status in the store API route before the workflow but 1. it would be an extra query and 2. the addToCart workflow is only used in the store currently, and even if it was to be used admin-side, it still doesn't make sense to add a draft product to cart

- After this PR an unpublished product would give the same error as a variant that doesn't exist. While imho this is correct, the thrown error (for both) is "Items  do not have a price" which doesn't make much sense(i believe the workflows goes through with an empty variants list and then errors at the price check point). Should I throw a different error when a variant doesn't exists/isn't published?


---

> [!NOTE]
> Enforces that only variants from published products can be added to carts, adds status fetching, refines errors, and updates tests to use ProductStatus.PUBLISHED.
> 
> - **Core Flows**:
>   - addToCart: Validate variants exist and belong to `product.status = PUBLISHED`; throw clear `INVALID_DATA` when not found/unpublished.
>   - Data fetching: Include `product.status` in `cart` and `order` variant field selections.
> - **Tests/Fixtures**:
>   - Update integration tests to set `status: ProductStatus.PUBLISHED` when creating products and import `ProductStatus` where needed.
>   - Add cases for unpublished products and non-existent variants producing the new error message.
> 
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ca72532e957964d2d8e6bcecbb0905054c677ded. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
2025-10-02 12:31:53 +00:00
William Bouchard
bb08edd41f fix(medusa,file-local,file-s3,core-flows): fix csv parsing special characters (#13649)
* fix(): fix csv parsing special characters

* remove other tries

* tweak

* remove comments

* Create rude-mirrors-hang.md
2025-10-02 08:24:18 -04:00
Leonardo Benini
5c77b10fa6 fix(medusa): plugin:db:generate skip modules with no data models (#13652)
Currently the plugin:db:generate command panics if one of the modules doesn't define any data models. This makes it impossible to generate migrations if you have a mix of modules with and without data models.   
I added a simple check to skip these modules when creating the migrations.

Steps to repro:
```
npx create-medusa-app --plugin
cd my-medusa-plugin
# create a module with an empty service and no data models
npx medusa db:plugin:generate
```

Full error:
```
info:    Generating migrations...
info:    Generating migrations for module postmarkModuleService...
info:    ----------------------------------------------------------------------------
error:   defineMikroOrmCliConfig failed with: entities is required
Error: defineMikroOrmCliConfig failed with: entities is required
    at defineMikroOrmCliConfig (/Users/leonardo/dev/medusa-plugin-postmark/node_modules/@medusajs/utils/src/modules-sdk/mikro-orm-cli-config-builder.ts:41:11)
    at generateMigrations (/Users/leonardo/dev/medusa-plugin-postmark/node_modules/@medusajs/medusa/src/commands/plugin/db/generate.ts:124:26)
    at main (/Users/leonardo/dev/medusa-plugin-postmark/node_modules/@medusajs/medusa/src/commands/plugin/db/generate.ts:49:11)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
```

I didnt bother with writing an issue since I had the fix ready and it's very small, but lmk if I should in the future
2025-10-02 12:05:40 +00:00
Adrien de Peretti
8fb7e04be7 fix(): Fulfillment custom schema error on provider (#13656) 2025-10-02 14:01:54 +02:00
Riqwan Thamir
71014bafa6 fix(medusa): fixes db setup command to not load connection before creating db (#13653) 2025-10-02 13:49:22 +02:00
Shahed Nasser
762cd445e0 docs: setup PostHog (#13659) 2025-10-02 14:45:10 +03:00
Shahed Nasser
be651dd708 docs: fix typo in product feed guide (#13658) 2025-10-02 14:17:50 +03:00
martinerko
9361f9c25a fix(index): preserve existing fields configuration (#13639) (#13640)
Co-authored-by: William Bouchard <46496014+willbouch@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2025-10-02 11:53:56 +02:00
Adrien de Peretti
02b6d01382 chore(): Add instrumentation to deps (#13646)
* chore(): Add instrumentation to deps

* deps

* Create two-bikes-compare.md
2025-10-02 11:29:26 +02:00
Nicklas Gellner
0aad694e64 docs: update costs description (#13647) 2025-10-01 17:43:59 +03:00
Shahed Nasser
d1bbd8a7c1 docs: fix typo (#13643) 2025-10-01 17:41:18 +03:00
Shahed Nasser
01ac822e6b docs: update Cloud sign up link (#13648) 2025-10-01 17:29:17 +03:00
Shahed Nasser
30215e7292 docs: fix details about maximum quantity for promotions (#13642) 2025-10-01 13:37:28 +03:00
Shahed Nasser
05af008911 docs: add details about updating index module's data source (#13637)
* docs: add details about updating index module's data source

* small change
2025-10-01 10:26:11 +03:00
William Bouchard
d30806533c fix(dashboard): create refund form broken when no payment id defined (#13631)
* fix(dashboard): create refund form broken when no payment id defined

* Create funny-donuts-destroy.md
2025-09-30 13:17:43 -04:00
Adrien de Peretti
b9d6f73320 Feat(): distributed caching (#13435)
RESOLVES CORE-1153

**What**
- This pr mainly lay the foundation the caching layer. It comes with a modules (built in memory cache) and a redis provider.
- Apply caching to few touch point to test

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-09-30 16:19:06 +00:00
Adrien de Peretti
5b135a41fe fix(): workflow engine migration issue (#13629)
**What**
The extension creation have been pushed by mistake
2025-09-30 15:41:09 +00:00
Shahed Nasser
0c7cbfb2e7 feat(payment-stripe): Allow passing shared payment token in Stripe (#13632)
* feat(@medusajs/payment-stripe): Allow passing shared payment token in Stripe

* fix changeset
2025-09-30 18:40:36 +03:00
Shahed Nasser
a1dd2de0de docs: general changes to Cloud docs (#13616)
* docs: document self serve

* docs: Cloud docs changes

* vale fixes

* vale error fix

* fixes

* added new sections

* generate
2025-09-30 18:37:04 +03:00
Adrien de Peretti
70d855bd1b fix(): Module test runner lifecycle does not shutdown properly (#13628)
* fix(): Module test runner lifecycle does not shutdown properly

* Create late-feet-think.md
2025-09-30 17:06:05 +02:00
Adrien de Peretti
9c7c1d48c7 fix(): Pricing preference context loss (#13626)
**What**
The context reference is being mutated by the repository leading to an empty context. Also, the filter is built from the pricing context instead of pricing context -> context leading to always fetch all preferences all the time
2025-09-30 12:38:04 +00:00
William Bouchard
087887fefb feat(core-flows): support ad hoc returns (#13598)
* feat(core-flows): support ad hoc returns

* fix: missing transform

* handle edge case

* refactor

* replace gte for gt

* cleanup

* weird bug fix

* add test

* Create quick-nails-kick.md

* stop sending empty strings

* add code to refund reason

* fix build

* fix tests

* handle code in dashboard

* fix tests

* more tests failing

* add reference and reference id to credit lieng

* rework create refund form
2025-09-30 07:38:50 -04:00
Shahed Nasser
bd9ecd5e66 docs: updates to custom columns and build guides (#13624) 2025-09-30 10:01:58 +03:00
William Bouchard
9d3c71fefd fix(medusa): cart now returns 404 when not found (#13622)
FIXES #10218 
FIXES CORE-739
2025-09-30 06:49:17 +00:00
Shahed Nasser
f970e1355a docs: general updates and fixes (#13620) 2025-09-30 08:45:30 +03:00