## What
Alter generated types base on `x-expanded-relations` OAS extension declared on schemaObjects.
## Why
Often, API endpoints will automatically expand a model relations by default. They can also decorate a model with calculated totals. In order to more accurately represent the API, we wish to alter the generated types based on the expanded relations information.
## How
- Follow the relation declaration signature as the backend controllers and the `expand` query param, i.e.: `items.variant.product`.
- Introduce a custom `x-expended-relations` OAS extension.
- Allow for organizing declared relations to help their maintenance.
- Use traversal algorithms in codegen to support deeply nested relationships.
- Use [type-fest](https://www.npmjs.com/package/type-fest)'s `Merge` and `SetRequired` to efficiently alter the types while enabling great intellisense for IDEs.
Extra scope:
* Added convenience yarn script to interact with the `medisa-oas` CLI within the monorepo.
## Test
Include in the PR are two implementations of the x-expanded-relations on OAS schema, a simple and a complex one.
### Step 1
* Run `yarn install`
* Run `yarn build`
* Run `yarn medusa-oas oas --type combined --out-dir ~/tmp/oas`
* Run `yarn medusa-oas client --type combined --component types --src-file ~/tmp/oas/combined.osa.json --out-dir ~/tmp/types`
* Open `~/tmp/types/models/StoreRegionsRes`
* Expect relations to be declared as required
### Step 2
* Open `~/tmp/types/models/StoreCartsRes`
* Expect relations to be declared as required
* Expect nested relations to have relations as required.
### Step 3 (optional)
* Open `~/tmp/types` in an intellisense capable IDE
* Within the `index.ts` file, attempt to declare a `const storeRegionRes: StoreRegionRes = {}`
* Expect IDE to highlight that `countries` is a required field of `StoreRegionRes`
## What
Generated client types package based on the API's OpenApi Spec.
## Why
This package aims at replacing the need to import types directly from the core `@medusajs/medusa` package which can lead to side effects like importing backend dependencies into the client's realm.
## How
* The package contains a script that is invoked during the build step.
* The script will use the `medusa-oas oas --type=combined` cli to generate a combined oas file.
* Then, `medusa-oas client --component=types` uses the oas file to generate the types based on the OAS schema definitions. The result is outputted into `/src/lib`
* `prettier` is run on the `/src/lib` directory to ensure that the generated code follows the monorepo coding style.
* Finally, with `"emitDeclarationOnly": true`, `tsc` compiles the src directory to only output types.
Until we update our CI pipeline, we will not commit the content `/src/lib`.
## Test
* Run `yarn install`
* Run `yarn build`
* Expect `packages/generated/client-types/dist/` to contain types generated from the OAS defined by `@medusajs/medusa`
**What**
- Fix `delete-reservation` endpoint to allow deletions of reservations
- remove `inventory_item_id` from reservation update call to properly update reservation
- invalidate all list caches to properly update order overview after an allocation has been created
- Fix overlap for long product titles in edit-allocation-modal
Fixes CORE-1214
## What
Replace AddressFields with actual AddressPayload schema based off the actual type used by the controllers.
## Why
AddressPayload is currently being referenced in client code. Our OAS schema should attempt to match current client usage in order to reduce friction when migrating to a OAS generated types package.
## How
* Represent AddressPayload and AddressCreatePayload in our OAS schemas.
* Replace reference to AddressFields
* Plus, fix typo in /admin/orders/ route
* add "get-variant" endpoint
* import from a different place
* fix unit test
* add changeset
* inventory management for orders
* add changeset
* initial create-fulfillment
* add changeset
* type oas and admin
* Move inv. creation and listing from admin repo
* Fix location editing bug (CORE-1216)
* Fix default warehouse on inventory table view
* remove actions from each table line
* Use feature flag hook instead of context directly
* remove manage inventory action if inventory management is not enabled
* Address review comments
* fix queries made when inventorymodules are disabled
* variant form changes for feature enabled
* move exclamation icon into warning icon
* ensure queries are not run unless feature is enabled for create-fulfillment
---------
Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com>
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
**What**
No true fix due to the same issue as [here](https://github.com/typeorm/typeorm/issues/6294) but at least the pagination works again. The ordering can't be applied on multiple columns/relation as it produce the wrong SQL.
FIXES CORE-1193
* Create cuddly-seahorses-thank.md
* add integration tests
* revert back from master to develop
* fix expand
* add new integration test
* add missing default relations
* add missing refunds relation
* re work
* fix tests
* init
* fix order page according to fixes to expand
* expand shipping on returns
* Create .changeset/cuddly-beers-tease.md
---------
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
## What
remove unused .eslintignore in medusa-react package
## Why
Some IDEs, like JetBrains, will establish the eslint working directory by finding the nearest .eslintrc or .eslintignore file. The .eslintignore in `/packages/medusa-react` adds complexity to configuring and resolving eslint for that package.
## How
.eslintignore is already declared at the root of the monorepo and /packages/medusa-react is already ignored as a whole. We can safely remove the `.eslintignore` from `/packages/medusa-react`
* chore: category list API can return all descendant
* chore: category handle is no longer required via api
* chore: added treescope to sorting
* chore: address feedback on PR
**What**
when `fields` only contain includes options, it should return the entire object plus the include options. If the fields contains the included options + other fields, it should only return the requested fields + the included options
**What**
- A series of minor fixes for admin-ui relating to managing stock locations:
- make "create location" `primary`
- add delete prompt when cancelling creation if information has been input
- avoid clipping focus border on country select when creating a stock location
- allow removals of sales channels from stock locations
Fixes CORE-1191, CORE-1192, CORE-1190, CORE-1189