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
**What**
- Uses derived state in DataTable, to prevent the state in the URL and component from going out of sync.
- Introduces a way for RouteModals to restore URL params on close.
Resolves CMRC-936
**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
**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
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
**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
**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>
what:
- scopes uniqueness index to only non deleted records
- explicit sorting of buy get promotions
- This error popped up as we removed the uniqueness constraint which seems to have kept a specific order.
RESOLVES https://github.com/medusajs/medusa/issues/11606
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.
**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>
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/
**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
* 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>