Commit Graph

1949 Commits

Author SHA1 Message Date
Adrien de Peretti
dc156861d4 fix(medusa): ShippingOption type on listAndCount (#2040)
**What**
Fix typing issue

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-06 13:00:32 +00:00
Carlos R. L. Rodrigues
923ccece24 feat(medusa,stock-location,inventory): Integration tests (#3149) 2023-02-06 09:02:43 -03:00
Oliver Windall Juhl
71fdd28198 fix(medusa-payment-stripe): Prevent Stripe events from retrying (#3160) 2023-02-06 11:23:39 +01:00
Riqwan Thamir
28697e1bd0 chore(medusa): refactor service test for product categories (#3161)
Refactor:

- Moves the mocks to a separate file under
- Re-uses existing mocks
- Use actual IDs instead of id string in mocks

RESOLVES CORE-977
2023-02-06 09:55:25 +00:00
Oliver Windall Juhl
9ebb50104c feat(medusa): Expose session options (#3162) 2023-02-03 13:36:59 +01:00
Carlos R. L. Rodrigues
d50db84a33 Feat: TO variant creation (#3097) 2023-02-02 09:01:10 -03:00
Riqwan Thamir
a049987215 chore: recommended meaningful oas fixes (#3159) 2023-02-02 10:45:57 +01:00
Riqwan Thamir
be0d36432a feat(medusa-js): added resources for product categories (#3157)
What:

JS client resources for product categories

Why:

To manage product categories and managing product-category relationship

How:

- adds a JS client resource for product categories.

RESOLVES CORE-1066
RESOLVES CORE-969
RESOLVES CORE-1061
2023-02-01 17:52:39 +00:00
Riqwan Thamir
4105405f28 feat(medusa): Filter products by category params in store/admin (#3155)
What:

Products can be filtered through the API by category parameters

Why:

To filter products by category

How:

- adds 2 params in admin/store route
- updates repository to accept 2 new parameters

RESOLVES CORE-1032
RESOLVES CORE-1033
2023-02-01 17:25:07 +00:00
Kasper Fabricius Kristensen
4fbf6b7ad3 fix(medusa-react): Fix production.min.js causing invalid hook usage error in CJS environments (#3144) 2023-02-01 14:07:02 +01:00
Oliver Windall Juhl
b242e22326 fix(medusa): Upsert addresses on Orders (#3153) 2023-02-01 13:57:24 +01:00
Carlos R. L. Rodrigues
f776ed234f feat(medusa): Run shared module migrations (#3109) 2023-02-01 08:10:59 -03:00
olivermrbl
0326d6cfa3 Merge branch 'master' into develop 2023-01-31 12:10:52 +01:00
Riqwan Thamir
5ec6d438fb feat(medusa): batch remove products from a category (#3141)
* chore: added batch endpoint to remove products from categories

* chore: remove consoles

* Apply suggestions from code review

Co-authored-by: Patrick <116003638+patrick-medusajs@users.noreply.github.com>

* chore: added oas changes

---------

Co-authored-by: Patrick <116003638+patrick-medusajs@users.noreply.github.com>
2023-01-31 10:23:03 +01:00
Shahed Nasser
771c54952a chore: fixed OAS using incorrect store resource (#3138) (#3140) 2023-01-30 15:24:26 +02:00
Shahed Nasser
e3dcf4fd75 chore: fixed OAS using incorrect store resource (#3138) 2023-01-30 14:41:22 +02:00
RegisHubelia
2551fe0b93 fix(medusa-plugin-sendgrid): Inject GiftCardService to eliminate undefined error (#2941) 2023-01-30 13:11:03 +01:00
Adrien de Peretti
e581d3bd90 chore(integration-tests): Flaky tests (#3126) 2023-01-27 17:45:54 +01:00
Riqwan Thamir
4f0d8992a0 feat(medusa): Products can be added to categories in batch request (#3123)
* wip

* chore: fix issues with join table

* chore: fix issues

* chore: fix ordering issue on random failing test

* chore: revert table name

* chore: added oas for category

* chore: update categories for a product

* chore: add remove category test

* chore: added changeset

* chore: address review comments

* chore: Products can be added to categories in batch request

* chore: address review comments + add unit specs

* chore: make template optional
2023-01-27 15:58:58 +01:00
Riqwan Thamir
ee42b60a20 feat(medusa): add or remove categories from products (#3114)
* wip

* chore: fix issues with join table

* chore: fix issues

* chore: fix ordering issue on random failing test

* chore: revert table name

* chore: added oas for category

* chore: update categories for a product

* chore: add remove category test

* chore: added changeset

* chore: address review comments

* Apply suggestions from code review

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
2023-01-27 15:25:46 +01:00
Patrick
d8ffbe25b0 feat(oas): declare x-codegen on Admin routes - S to V (#3102)
### What

Declare `x-codegen` in OAS for Admin routes - S to V.

### Why

We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators.

In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. 
E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value.

We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. 
E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` 

### How

Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths.

Match method and queryParams values with equivalent ones from our current JS client package.

### Test

* Ran OAS validator.
* Ran docs build script.

Expect no visible changes to the documentation.
2023-01-25 13:58:48 +00:00
Oliver Windall Juhl
0009da0261 fix(medusa-payment-stripe): Resend capture event to ensure auto-capture (#3100) 2023-01-25 10:10:31 +01:00
Riqwan Thamir
2e7e16b917 feat(medusa): Added models + repo for products in multiple categories (#3083)
* chore: Added models + repo for products in multiple categories

* chore: remove join table model + repo

* chore: add foreign key constraints

* Update packages/medusa/src/migrations/1674455083104-product_category_product.ts

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* chore: cascade on delete

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-01-25 07:24:39 +01:00
Patrick
d25a531045 feat(oas): declare x-codegen on Admin routes - PRO to R (#3093)
### What

Declare `x-codegen` in OAS for Admin routes - PRO to R.

### Why

We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators.

In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. 
E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value.

We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. 
E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` 

### How

Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths.

Match method and queryParams values with equivalent ones from our current JS client package.

### Test

* Ran OAS validator.
* Ran docs build script.

Expect no visible changes to the documentation.
2023-01-24 15:11:34 +00:00
olivermrbl
8f07738d88 chore(release): Publish 2023-01-24 13:58:41 +01:00
Kasper Fabricius Kristensen
6293fccc65 hotfix(medusa-react): Invalidate query keys on successful mutations (#3099)
**What**
- Fixes an issue where query keys weren't invalidated on successful mutations.

**How**
- Update `buildOptions` function to be called per `QueryKey` instead of passing them all as a single query key, resulting in no matches found.
- Fixes imports that aren't compatible with ESM modules.
2023-01-24 12:55:24 +00:00
Patrick
8e41c69966 feat(oas): declare x-codegen on Admin routes - D to PRI (#3092)
### What

Declare `x-codegen` in OAS for Admin routes - D to PRI.

### Why

We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators.

In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. 
E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value.

We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. 
E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` 

### How

Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths.

Match method and queryParams values with equivalent ones from our current JS client package.

### Test

* Ran OAS validator.
* Ran docs build script.

Expect no visible changes to the documentation.
2023-01-24 12:10:20 +00:00
Philip Korsholm
8f4c84121b feat(medusa): Add inventory for variants (#2970)
* initial get-inventory impl

* add inventory management to create-variant

* update create-variant endpoint

* move if statement

* use middleware for module checking

* add endpoint to medusa-js

* export return type from get-inventory

* add jsdoc

* revert create variant

* rename variable

* initial setInventoryPattern for variant and product endpoints

* remove cache

* sort imports

* add sales channel info to inventory calculations

* add missing import

* remove promise.all from single promise

* update oas

* initial feedback

* checkout joinLevels from develop

* add variant middleware

* add comments
2023-01-24 11:10:33 +01:00
Patrick
09dc9c6677 feat(oas): declare x-codegen on Admin routes - A to D (#3090)
### What

Declare `x-codegen` in OAS for Admin routes - A to D.

### Why

We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators.

In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. 
E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value.

We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. 
E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` 

### How

Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths.

Match method and queryParams values with equivalent ones from our current JS client package.

### Test

* Ran OAS validator.
* Ran docs build script.

Expect no visible changes to the documentation.
2023-01-23 20:32:20 +00:00
Patrick
6e89d94df8 feat(oas): declare x-codegen on Store routes (#3074)
### What

Declare `x-codegen` in OAS for Store routes.

### Why

We are introducing a new `x-codegen` OpenApi extension, also known as _vendor extension_, in order to help with passing information down to code generators.

In our case, we wish to declare the `method` name that we would expect to call on a client. This mimics our current JS client package. 
E.g. `medusaClient.product.list` where `product` is the tag of the route and `list` is the x-codegen.method value.

We are also defining the name of a potential typed object for query parameters. OAS 3.0 does not allow to bundle query parameters under a single definition but it is not uncommon to see API clients handle all query parameters as a single typed object, like our JS client package. With x-codegen.queryParams, a code generator can create a named and typed object to bundle all query parameters for a given route. 
E.g. `medusaClient.customer.retrieve(id: string, queryParams: AdminGetCustomerParams)` 

### How

Declare `x-codegen` as an object with fields `method` and `queryParams` on all paths.

Match method and queryParams values with equivalent ones from our current JS client package.

### Test

* Ran OAS validator.
* Ran docs build script.

Expect no visible changes to the documentation.
2023-01-23 15:47:51 +00:00
Carlos R. L. Rodrigues
2d525237b6 fix(stock-location): Stock location address required (#3065)
What:
- Removes the requirement to have an address id while creating a new stock location.
- Add field company to Location Address

FIXES: CORE-1018

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-01-23 12:47:04 +00:00
Carlos R. L. Rodrigues
f65f590a27 feat: inventory items api (#2971)
What:
Admin endpoints to handle inventory items and their stock levels per location

FIXES: CORE-975

Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com>
2023-01-23 12:06:23 +00:00
olivermrbl
7152073b00 Merge branch 'master' into develop 2023-01-19 18:30:44 +01:00
olivermrbl
a48c533bec chore(release): Publish 2023-01-19 18:29:07 +01:00
olivermrbl
15bea8d49e Merge branch 'master' into develop 2023-01-19 18:26:34 +01:00
Oliver Windall Juhl
9c2169422d fix(medusa): Only add Sales Channel relation + field when enabled (#3069) 2023-01-19 18:26:10 +01:00
Oliver Windall Juhl
9427bc7f25 fix(medusa): Move migration to correct folder (#3067) 2023-01-19 17:34:59 +01:00
Shahed Nasser
7cafff14b9 docs: added migration guide for Medusa React (#3066)
* docs: added migration guide for Medusa React

* docs: fixed vale error
2023-01-19 16:59:49 +02:00
Kasper Fabricius Kristensen
fcba705701 fix(medusa): Allow deleting metadata fields (#3055) 2023-01-19 11:34:13 +01:00
olivermrbl
6481b0c357 chore(release): Publish 2023-01-18 18:48:57 +01:00
Philip Korsholm
9c4647383e Feat/reservations endpoints (#2995)
**What**
- add reservation endpoints: 
 - `create-reservation`
 - `update-reservation`
 - `delete-reservation`
 - `get-reservation`
 - `list-reservations`
 - `orders/create-reservation-for-line-item`
 - `orders/get-reservations`

Fixes CORE-979
2023-01-18 16:39:33 +00:00
Carlos R. L. Rodrigues
aa54d902e5 chore: added missing withTransacton, create-variant using TO (#3047)
Create variant integrated with Inventory modules
2023-01-18 09:29:06 -03:00
Kasper Fabricius Kristensen
150696de99 feat(medusa, medusa-js, medusa-react): Add endpoint to retrieve product tags from the storefront (#3051) 2023-01-18 10:47:15 +01:00
olivermrbl
ab580066ae fix: Merge conflicts with master 2023-01-18 10:17:39 +01:00
Philip Korsholm
76d1752310 fix(medusa): Draft order inventory management (#3040)
* reserve quantities when creating a draft order

* only adjust quantities if a location is provided on a fulfillment

* initial fix for fulfillments

* changeset

* add check for inventory service when cancelling fulfillment

* update test-request with module loaders

* remove unused variable
2023-01-17 16:14:58 +01:00
Patrick
cb1ec0076b chore(oas): replace response with $ref class JSDoc (Store PRO-V) (#3044)
### Scope

Store routes directories PRO to V.

### What

Move inline OAS response schema declaration under their respective class declarations in order to expose them through  `#/components/schemas`. Replace inline OAS response schema with a `$ref` reference pointing to the newly declared schema.

### Why

Having response declared as its own "named" schema will allow OAS code generators to output typed entities/DTO that can be consumed without having to reference the route/operation.

### How

Declare a new @schema JSDoc for each "Res" class used to parse and validate request body. Move the current inline requestBody to the new @schema.

### Test

- Ran OAS validator.
- Ran docs build script.

Expect no visible changes to the documentation.
2023-01-17 14:22:10 +00:00
Carlos R. L. Rodrigues
0175388835 feat(medusa): Transaction Orchestrator (#2861)
* chore: transaction orchestrator
2023-01-16 20:16:41 -03:00
Riqwan Thamir
7d4b8b9cc5 feat(medusa): List (service + controller) product categories #3004 (#3023)
**What:**

Introduces a store endpoint to retrieve a list of product categories

**Why:**

This is part of a greater goal of allowing products to be added to multiple categories.

**How:**

- Creates an endpoint in store routes

RESOLVES CORE-968
2023-01-16 19:20:42 +00:00
Patrick
1ec1a78dfa Merge branch 'develop' into chore/oas-res-schema-AtoPAY 2023-01-16 11:59:19 -05:00
Patrick
b791e34589 chore(oas): replace response with $ref class JSDoc (Store A-PAY)
chore(oas): replace response with $ref class JSDoc (Store A-PAY)
2023-01-16 11:54:48 -05:00