What:
- `Dirent` class from `NodeJS` has different properties in different versions, causing issues in our loaders.
- Util `readDirRecursive` was introduced, avoiding old node versions to break
FIXES: https://github.com/medusajs/medusa/issues/8419
RESOLVES SUP-185
**What**
The cart fields to be fetched for the promotion workflow was not including the sales_channel_id, making any rules being constraint to that fields not being validated against this property.
**What**
- add request order transfer workflow
- add admin endpoint for transferring an order to a customer
- accept order transfer storefront endpoint
- accept transfer workflow
- changes in the order module to introduce new change and action types
---
**Note**
- we return 400 instead 409 currently if there is already an active order edit, I will revisit this in a followup
- endpoint for requesting order transfer from the storefront will be added in a separate PR
---
RESOLVES CMRC-701
RESOLVES CMRC-703
RESOLVES CMRC-704
RESOLVES CMRC-705
FIXES CMRC-691
**What**
`Date` is something that get executed, since workflows are meant to compose the definition of what will be executed, the date where always having the same value as they was executed once during composition.
Instead wrap those into transformer that will be executed when needed and fix the Date issues
Initially I thought that we will have to add special checks to allow relationships referencing itself. However, it turned out that not to be the case. Instead, it had more to do with how self relationships are defined in Mikro ORM.
In case of `belongsTo` relationship we have to define the other side as well either as a `hasMany` or `hasOne`. For example:
**❌ The following code will fail, because no children are defined for the parent**
```ts
const user = model.define("user", {
id: model.number(),
username: model.text(),
parent: model.belongsTo(() => user)
})
```
**✅ Addition of children relationship will make things work**
```ts
const user = model.define("user", {
id: model.number(),
username: model.text(),
parent: model.belongsTo(() => user, { mappedBy: "children" }),
children: model.hasMany(() => user, { mappedBy: "parent" }),
})
```
We can see the similar setup here with our `ProductCategory` MikroORM entity. https://github.com/medusajs/medusa/blob/develop/packages/modules/product/src/models/product-category.ts#L87-L94
@adrien2p Correct me if I am wrong. But I have added the tests for now so that we know the behavior of self relationships
What:
When `autocapture` is enabled, the webhook is processed before the order was created.
The payment processing workflows were merged into a single one
FIXES: SUP-118, SUP-9
https://github.com/medusajs/medusa/issues/9998
What:
- copy data before saving checkpoint
- removed unused data format function
- properly handle registerStepFailure to not throw
- emit onFinish event even when execution failed
**What**
- fix prefix for table search which caused the other table rendered on the page to fire query
- additionally, fix a typo in js SDK and only format the file
---
FIXES SUP-112
CLOSES https://github.com/medusajs/medusa/issues/9968
### What
Include `region_id` when retrieving shipping options for a cart
### Why
Otherwise, region-specific prices will never show in the Store API
Closes CMRC-655 https://github.com/medusajs/medusa/issues/9906
**What**
Currently, when setting a `belongsTo` relationship on the DML with the otherside being `hasMany` it result in a wrongly generated gql output making the belongs to being a collection of the relation instead of the relation directly. This pr fixes this issue
**What**
The values are wrongly set which can lead to infinite depth iteration
**Note**
This will change on how we manage those cases in the future but currently it fixes an issue
* fix: correctly update stock location when partial fulfillemnt is created
* fix: update test
* fix: count reserved quantity of the item as available quantity for fulfillment
* fix: refresh reservations when order fulfillment is created
* feat: add check for reservation quantity
* feat: add a test case