Commit Graph

1081 Commits

Author SHA1 Message Date
Carlos R. L. Rodrigues
7dbec10b3b fix(order): summary raw totals (#11712) 2025-03-04 11:01:12 +00:00
Avia-Code
cc829185f4 feat: added hook for createStockLocationsWorkflow (#11491)
What
This commit introduces the `stockLocationsCreated` hook to the `createStockLocationsWorkflow`.

Why
The hook was missing and necessary to improve the workflow's extensibility.

How
Added the `stockLocationsCreated` hook and updated related logic within the workflow.

Testing

1. Create new medusa project via create-medusa-app
2. Connect this custom branch of medusa to it
3. Create `src/workflows/hooks/stock-locations-created.ts` file with the following content:

```
import { createStockLocationsWorkflow } from "@medusajs/medusa/core-flows"

createStockLocationsWorkflow.hooks.stockLocationsCreated(
  (async ({ stockLocations, additional_data }, { container }) => {
    console.log({stockLocations})
  })
)
```
4. Create new admin account and create there a new stock location
5. The log should be displayed in terminal
2025-03-04 10:53:39 +00:00
Frane Polić
e23f204b7c fix(dashboard, core-flows, medusa): prevent creation of empty fulfillments (#11664) 2025-03-03 16:54:20 +00:00
Riqwan Thamir
ab96ad3b82 feat(utils): add error message when manager is not found in context (#11693) 2025-03-03 15:50:34 +01:00
Riqwan Thamir
51b0af193c fix(types,medusa): calculate taxes for original price (#11692) 2025-03-03 14:20:48 +01:00
Shahed Nasser
61a0e4f3cf chore(workflows-sdk): fix examples in TSDocs (#11689) 2025-03-03 12:20:21 +02:00
Adrien de Peretti
d1efad9bf0 chore(): Improve cart update line items (#11666)
**What**
Currently, we are potentially providing an array of selector/data leading to fetching data sequentially before running on update which will fetch data again in batch and perform the update. Now we can pass the data directly which includes the id already and only perform one bulk fetch + one bulk update.

This pr also include a fix on the inventory validation, currently, only the item to update inventory is being checked, with this pr we also check the inventory for the items that needs to be created
2025-03-03 10:06:40 +00:00
Frane Polić
bdf9723239 fix(dashboard): filter outbound shipping options in RMA (#11629)
**What**
- filter out return shipping options for Claims/Exchanges
- fix the incorrect display of "missing inventory" warning

---

CLOSES CMRC-946
CLOSES CMRC-947
2025-02-28 14:55:35 +00:00
Frane Polić
c50487ccab fix(core-flows): return created order return from workflow (#11642)
* fix: return created order return from workflow

* fix: type

* fix: middeware export
2025-02-28 10:15:13 +01:00
Stevche Radevski
93dc10332d fix: Exclude the health endpoint from being logged (#11650) 2025-02-27 16:22:50 +01:00
Adrien de Peretti
c250de7919 chore(): Prevent sub workflow events release early + redis unlink (#11641)
**What**
- Prevent event release when a workflow is run as step and finish
- Use `unlink` instead of `del` when removing keys from redist to push the execution to async thread
2025-02-27 10:33:30 +00:00
Adrien de Peretti
ca6a15717d chore(): Add support for extra pool configuration (#11636)
**What**
Support more pool configuration
2025-02-27 10:33:08 +00:00
Harminder Virk
b0a16488e0 feat: add middleware-file-loader (#11638)
Fixes: FRMW-2920

The feature is called `middleware-file-loader`, because it does more than just collecting middlewares. It also collects the bodyParser config for routes
2025-02-27 09:42:29 +00:00
Frane Polić
090d15b1e4 fix(core-flows): unsafe access to a variant property (#11588)
**What**
- fix unsafe access `manage_inventory` flag if variant doesn't exist for the item

---

CLOSES https://github.com/medusajs/medusa/issues/11587
2025-02-27 07:58:47 +00:00
Riqwan Thamir
38beeb157e fix(core-flows): support 0 as a valid unit price for custom line items (#11631) 2025-02-26 19:32:35 +01:00
Adrien de Peretti
d254b2ddba chore(): Improve cascade soft deletetion/restoration and update (#11618)
**What**
- Fix soft deletion and restoration emitted events
- Improve soft deleted/restore algorithm
- Fix big number field handling null value during partial hydration from mikro orm
2025-02-26 18:01:36 +00:00
Adrien de Peretti
caf83cf78c chore: prevent workflow steps to call modules when not necessary (#11632)
**What**
Some steps were calling the modules even when nothing was needed which for some operations would create transaction for nothing leading to extra execution time that add up very quickly on cloud network

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-02-26 17:42:48 +00:00
Oli Juhl
54a6ef91ac chore: Move token from params to headers (#11281)
* chore: Move token from params to body

* chore: Add type

* wip

* chore: clean up

* clean ip
2025-02-26 17:41:16 +01:00
Shahed Nasser
d2d6a29a4a chore(types): improvements to tax provider tsdocs 2025-02-26 16:14:15 +02:00
Carlos R. L. Rodrigues
65eb3aa6c8 chore(core-flows): use cart id when force_refresh is true (#11625) 2025-02-26 11:01:05 -03:00
BOUAZZA Ayyoub
93cbc6b669 Fix/add additionl data to product categories hook (#11226)
* fix: add additional_data to categoriesCreated hooks

* fix: restore yarn.lock

* fix: add additional_data param in the http validators

* fix: add additional_data to updateProductCategoriesWorkflow

* Update yarn.lock

* fix: fix merge

* fix: refert yarn.lock

* fix: revert tarn.lock

* Create clean-poets-promise.md

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2025-02-26 14:58:01 +01:00
Carlos R. L. Rodrigues
322d108c03 chore(core-flows): pass cart as reference to subflows (#11617) 2025-02-26 08:26:44 -03:00
Carlos R. L. Rodrigues
fa1793e8e9 chore(core-utils): avoid overfetching to refresh cart (#11602)
What:
 * Not all Cart operations need a full refresh updating items. This PR introduces a flag to force the refresh for special ocasions, like updating the Cart's region, or transfering the Cart to another customer. For all other flows it will update only promotions, taxes and payment collection if needed.
2025-02-26 10:00:04 +00:00
Adrien de Peretti
eeebb35758 chore(product): revamp upsertWithReplace and Remove its usage from product creation (#11585)
**What**
- Move create product to use native create by structuring the data appropriately, it means no more `upsertWithReplace` being very poorly performant and got 20x better performances on staging
- Improvements in `upsertWithReplace` to still get performance boost for places that still relies on it. Mostly bulking the operations when possible

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-02-26 09:53:13 +00:00
Carlos R. L. Rodrigues
03731c7660 chore(core-flows): reserve inventory from available location (#11538) 2025-02-26 06:10:41 -03:00
Harminder Virk
9e2af4801d feat: add routes loader (#11592)
Fixes: FRMW-2919

This PR adds a new routes loader with a single responsibility of scanning the filesystem and collecting routes. Sorting of routes, merging middleware and registering them with express are going to separate implementations.

The new `RoutesLoader` class allows overriding routes as-well (not recommended though) and this is how routes are de-duplicated.

- When two routes for the exact route pattern/matcher are discovered, the routes loader will only keep the last one.

- Routes files can also override handlers for specific HTTP methods. For example, the original route file exported handlers for `GET` and `POST`, but the overriding one only defines `GET`. In that case, we will continue using the original implementation for the `POST` handler.

- If an overriding route file exports additional configuration like `export const AUTHENTICATION=false`, then this will only impact the handlers exported from this file and not the original handlers.

Routes sorting has been already been implemented in a separate PR and you can visualize it using this URL. https://routes-visualizer.fly.dev/
2025-02-26 07:24:10 +00:00
Adrien de Peretti
b42f151be3 chore(): Improve internal repository delete algo (#11601)
* chore(): Improve internal repository delete algo

* chore(): Improve internal repository delete algo

* chore(): Improve internal repository delete algo

* update tests

* Create purple-donkeys-learn.md

* update tests
2025-02-25 19:59:57 +01:00
Kasper Fabricius Kristensen
d814d9540e fix(types): Allow providing either vite@5 or vite@6 for the peer dependency (#11581)
**What**
- The types package has an optional peerDep on vite@5. This causes issues if the package is installed in a repo that has vite@6 installed. An example could be a `react-router/remix` storefront.
- Loosen the dependency to accept either vite@5 or vite@6.

Resolves SUP-970
2025-02-25 18:59:38 +00:00
Shahed Nasser
8bb0a25f57 fix(types, medusa): remove fulfillment and payment status filters from validator + http types (#11604) 2025-02-25 19:42:53 +01:00
Shahed Nasser
698a520729 chore(types): change payment provider types to interfaces (#11597)
* chore(types): change payment provider types to interfaces

* add changeset
2025-02-25 14:30:18 +02:00
Riqwan Thamir
fb2e86484a feat(core-flows,types,cart): add credit lines to cart (#11419)
* feat(core-flows,types,cart): add credit lines to cart

* chore: fix specs

* chore: credit lines hook

* chore: update types

* chore: added credit line totals

* chore: add totals fields to query config

* chore: add complete cart hook

* chore: add credit lines creation to order

* chore: pr ready for review

* chore: fix tests

* Apply suggestions from code review

* chore: fix types

* chore: adjust summary calculations with new totals
2025-02-24 14:34:36 +01:00
olivermrbl
3f7470022c chore: Version packages 2025-02-24 11:36:46 +01:00
Shahed Nasser
5071001aea chore: update TSDocs of account holder additions (#11576) 2025-02-24 12:21:31 +02:00
Harminder Virk
feec0243ab feat: add middleware and routes sorter (#11526)
Fixes: FRMW-2918
2025-02-24 10:17:15 +00:00
Kasper Fabricius Kristensen
f00e6bf660 fix(js-sdk): Export Draft Order methods (#11572) 2025-02-24 10:30:07 +01:00
Kasper Fabricius Kristensen
efd66c0d59 fix(core-flows): Allow adding shipping methods through order edits (#11504)
* fix(core-flows): Allow adding shipping methods through order edits

* fix(core-flows): Allow adding shipping methods through order edits

* update test description

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-02-23 16:06:54 +01:00
Oli Juhl
215553792b chore: Force select-in strategy by passing pagination through (#11556)
* chore: Force select-in by passing pagination through

* chore: Force select-in by passing pagination through
2025-02-23 14:42:19 +01:00
Carlos R. L. Rodrigues
0c957350a6 fix(order): calculate taxes on order edit flows (#11518)
* fix(order): calcualte taxes on order edit flows

* merge summary

* tests

* fix pending difference

* comments

* claim test

* revert method
2025-02-21 15:27:40 +01:00
Adrien de Peretti
065df75e7d fix(): handle empty q filters - allow to query deleted records from graph API - staled_at fixes (#11544)
* fix(): Allow to query deleted records from graph API

* fix(): Allow to query deleted records from graph API

* handle empty q value

* update staled at sync

* rename integration tests file

* Create strong-houses-marry.md

* try to fix flacky tests

* fix pricing context

* update changeset

* update changeset

* fix import

* skip test for now

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-02-21 13:24:12 +01:00
Kasper Fabricius Kristensen
3b4997840e fix(medusa,js-sdk,types): Add basic draft order operations to js-sdk (#11514)
**What**
- Exposes `sdk.admin.draftOrder.create/update/retrieve/list` functions from the js-sdk
- Implements the necessary types in the types package.
- Adds missing endpoints to admin API.
2025-02-20 16:05:21 +00:00
Oli Juhl
dbd06fd41d fix(utils): Handle 0 correctly in build query (#11525)
**What**

Remove truthy/falsy check for `take` and `skip`

**Why**

To ensure `{ take: 0, skip: 0 }` is not converted to `{ take: undefined, skip: undefined }`
2025-02-19 19:04:48 +00:00
Stevche Radevski
3281613e22 fix: typings for list payment method were incorrect (#11523) 2025-02-19 09:15:42 +00:00
Frane Polić
0c530e90c5 feat(core-flows, types): add has missing inventory flag when listing shipping options (#11493)
**What**
- add `insufficient_inventory` flag when listing shipping options for a cart
- add `enabled_in_store` flag when creating/editing pickup options
2025-02-19 08:08:25 +00:00
Riqwan Thamir
30171f3dc4 fix(core-flows): add no_notification to fulfillment created event (#11507)
what:

- passes no notification toggle to events - fulfillment created and canceled

fixes https://github.com/medusajs/medusa/issues/11505
2025-02-19 08:05:52 +00:00
Shahed Nasser
b60e1c855e fix(framework): add missing storefrontUrl from configuration type (#11511)
The `storefrontUrl` is defined in the `packages/core/types/src/common/config-module.ts` file, but for many purposes, including the documentation, we use the types defined in `packages/core/framework/src/config/types.ts`. This PR adds the `storefrontUrl` to the framework type
2025-02-18 17:29:59 +00:00
Adrien de Peretti
448dbcb596 feat(medusa): Rollout index engine behind feature flag (#11431)
**What**
- Add index engine feature flag
- apply it to the `store/products` end point as well as `admin/products`
- Query builder various fixes
- search capabilities on full data of every entities. The `q` search will be applied to all involved joined table for selection/where clauses

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-02-18 13:49:57 +00:00
Stevche Radevski
99a6ecc12d feat: Add support to update account holder (#11499) 2025-02-18 11:04:25 +01:00
Ranjith kumar
32ad13813b feat(js-sdk): implement custom storage config to support react native (#11467)
* feat(js-sdk): implement custom storage config to support react native

* chore: add changeset

* feat(js-sdk): implement custom storage config to support react native

* chore: add changeset

* test:  add unit tests for custom storage
2025-02-18 08:38:23 +01:00
Frane Polić
ee848bf0f4 feat(core-flows, dashboard, medusa, types): optional shipping profile (#11434)
* feat: create product flow changes

* feat: allow unsetting SP on product update

* feat: update prepare line item helper

* test: add testcase

* wip: fix tests

* fix: update module tests

* fix: cart module test
2025-02-17 19:08:59 +01:00
Adrien de Peretti
3b7856e8f5 feat(framework): Improve production structured logging with more valuable information as well (#11489)
* feat(framework): Improve production structured logging with more valuable information as well

* feat(framework): Improve production structured logging with more valuable information as well

* feat(framework): Improve production structured logging with more valuable information as well

* feat(framework): Improve production structured logging with more valuable information as well

* fix typo

* update trust proxy

* Create new-ligers-heal.md

* revert trust proxy
2025-02-17 18:16:33 +01:00