Commit Graph

2999 Commits

Author SHA1 Message Date
Oliver Windall Juhl
f88af0c28d fix(medusa): Received quantity on return lines (#3267) 2023-02-17 10:13:50 +00:00
Kasper Fabricius Kristensen
3a911091f1 hotfix(medusa-js): Export resources classes and make client public (#3271)
* export all ressource classes and make client public

* add changeset
2023-02-16 09:03:49 +01:00
github-actions[bot]
ef148cb9f4 chore(docs): Generated Services Reference (automated) (#3261)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2023-02-14 20:32:42 +02:00
github-actions[bot]
4fb22e8ba5 chore(docs): Generated API Reference (#3262)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2023-02-14 20:32:28 +02:00
github-actions[bot]
67f9429293 chore(docs): Generated Docs Announcement Bar (automated) (#3263) 2023-02-14 17:38:21 +01:00
olivermrbl
1bfbe27b9b chore(release): Publish 2023-02-14 17:30:40 +01:00
olivermrbl
da9fb4aaa8 chore: Lint package.json 2023-02-14 17:27:43 +01:00
Oliver Windall Juhl
968eb8fc6b fix(medusa): Refund amount on returns in claim flow (#3237) 2023-02-14 12:47:06 +01:00
olivermrbl
d48606d5dd Merge branch 'master' into develop 2023-02-14 11:28:02 +01:00
Adrien de Peretti
5e0273a370 chore(medusa): New totals calc. in Swap creation (#3191)
* feat(medusa): Cleanup swap creation flow

* revert test and package

* fix unit tests

* fix swap seeder that does not include the tax lines on the return line item

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-14 10:52:45 +01:00
Carlos R. L. Rodrigues
80452332d8 fix(medusa): Default sales channel on product create (#3249)
What:
Assign the default sales channel if none is provided while creating a new product.


FIXES: CORE-1114

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-14 08:46:14 +00:00
josetr
10ff72c30a fix(medusa): Add missing scoped transaction on update currency endpoint (#3254) 2023-02-14 09:24:39 +01:00
github-actions[bot]
a2c3ba2c2c chore(docs): Removed Docs Announcement Bar (automated) (#3255)
Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
2023-02-14 09:55:40 +02:00
olivermrbl
66e7a384e3 Merge branch 'master' into develop 2023-02-13 18:53:54 +01:00
Patrick
cac13a88da feat(oas) - accurate model OAS representation - R to U (#3250)
### Scope

Models R to U

### What

Refactor OAS for models to accurately represent their shape in API responses.

### Why

About 33% of model fields are not accurately represented in the OAS. Most of the issues are:
- fields that can not be omitted in the response are not declared as `required`
- fields that could return `null` as their value are not declared as `nullable: true`

When using a code generator, these OAS issues would lead to inaccurate response shapes in the generated client.

### How

#### nullable
Fields meeting at least one of the following condition will be represented as `nullable: true` in OAS:
* The field is decorated with `@Column({ nullable: true })`
* The field is decorated with `@OneToOne`, `@ManyToOne`
* The field is decorated with `@DeleteDateColumn`

#### optional
Fields meeting at least one of the following conditions will never be listed as `required` in OAS and will be considered optional and could be omitted in the response:
* The field is decorated with `@OneToOne`, `@ManyToOne`, `@OneToMany`, `@ManyToMany`
* The field is decorated with `@FeatureFlagColumn`
* The field is decorated with `@Column({select: false})`
* The field is representing dynamic values not persisted in the database

Fields not meeting any of the conditions above will be declared as `required` and are expected to be present in the response.

### Test
* Ran OAS validator.
* Ran docs build script.

Expect OAS changes to be reflected in the API documentation.
2023-02-13 16:59:36 +00:00
Adrien de Peretti
4cb44a3a2e fix(medusa): Discount allocation precision issues (#3244) 2023-02-13 17:22:18 +01:00
Adrien de Peretti
bbbb3d8882 fix(medusa): Missing withTransaction on update in get-cart.ts (#3246) 2023-02-13 16:30:46 +01:00
Adrien de Peretti
a2cc084db8 fix(medusa): Missing withTransaction on calculateDiscountForLineItem (#3247) 2023-02-13 16:29:11 +01:00
github-actions[bot]
312b05ea5a chore(docs): Generated Services Reference (automated) (#3242)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2023-02-13 09:56:49 +02:00
Oliver Windall Juhl
8194d19b0e fix(medusa-plugin-sendgrid): Undefined order in method to build GiftCard data (#3238) 2023-02-12 19:18:36 +01:00
olivermrbl
4d2dc3c3a1 Merge branch 'master' into develop 2023-02-12 12:29:26 +01:00
Patrick
a59bd84e41 feat(oas) - accurate model OAS representation - PA to PU (#3223)
### Scope

Models PA to PU

### What

Refactor OAS for models to accurately represent their shape in API responses.

### Why

About 33% of model fields are not accurately represented in the OAS. Most of the issues are:
- fields that can not be omitted in the response are not declared as `required`
- fields that could return `null` as their value are not declared as `nullable: true`

When using a code generator, these OAS issues would lead to inaccurate response shapes in the generated client.

### How

#### nullable
Fields meeting at least one of the following condition will be represented as `nullable: true` in OAS:
* The field is decorated with `@Column({ nullable: true })`
* The field is decorated with `@OneToOne`, `@ManyToOne`
* The field is decorated with `@DeleteDateColumn`

#### optional
Fields meeting at least one of the following conditions will never be listed as `required` in OAS and will be considered optional and could be omitted in the response:
* The field is decorated with `@OneToOne`, `@ManyToOne`, `@OneToMany`, `@ManyToMany`
* The field is decorated with `@FeatureFlagColumn`
* The field is decorated with `@Column({select: false})`
* The field is representing dynamic values not persisted in the database

Fields not meeting any of the conditions above will be declared as `required` and are expected to be present in the response.

### Test
* Ran OAS validator.
* Ran docs build script.

Expect OAS changes to be reflected in the API documentation.
2023-02-10 15:35:24 +00:00
Oliver Windall Juhl
f0ab7fda80 chore: Update bug issue template 2023-02-10 10:13:48 +01:00
olivermrbl
4e4da52e8c Merge branch 'master' into develop 2023-02-10 09:27:19 +01:00
Oliver Windall Juhl
472f96d7fb fix(medusa): Missing refund amount when creating claim (#3224) 2023-02-10 09:26:54 +01:00
github-actions[bot]
91234c14b5 chore(docs): Generated Services Reference (automated) (#3227)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2023-02-09 19:55:08 +02:00
Adrien de Peretti
eee9283818 feat(medusa): Allow empty fields/expand (#3220) 2023-02-09 18:05:56 +01:00
olivermrbl
d3feb62b85 Merge branch 'master' into develop 2023-02-09 17:52:41 +01:00
Frane Polić
61b0b2f3aa fix(medusa): Pass query transformer config in storefront controllers (#3219) 2023-02-09 17:52:04 +01:00
Adrien de Peretti
8c5219a31e chore: Update ignored files for npm (#3217) 2023-02-09 17:25:14 +01:00
Adrien de Peretti
6e443dc708 feat(medusa): Improve addShippingMethod on store cart route (#3222) 2023-02-09 16:55:40 +01:00
Patrick
507ad00bec feat(oas) - accurate model OAS representation - F to O (#3210)
### Scope

Models F to O

### What

Refactor OAS for models to accurately represent their shape in API responses.

### Why

About 33% of model fields are not accurately represented in the OAS. Most of the issues are:
- fields that can not be omitted in the response are not declared as `required`
- fields that could return `null` as their value are not declared as `nullable: true`

When using a code generator, these OAS issues would lead to inaccurate response shapes in the generated client.

### How

#### nullable
Fields meeting at least one of the following condition will be represented as `nullable: true` in OAS:
* The field is decorated with `@Column({ nullable: true })`
* The field is decorated with `@OneToOne`, `@ManyToOne`
* The field is decorated with `@DeleteDateColumn`

#### optional
Fields meeting at least one of the following conditions will never be listed as `required` in OAS and will be considered optional and could be omitted in the response:
* The field is decorated with `@OneToOne`, `@ManyToOne`, `@OneToMany`, `@ManyToMany`
* The field is decorated with `@FeatureFlagColumn`
* The field is decorated with `@Column({select: false})`
* The field is representing dynamic values not persisted in the database

Fields not meeting any of the conditions above will be declared as `required` and are expected to be present in the response.

### Test
* Ran OAS validator.
* Ran docs build script.

Expect OAS changes to be reflected in the API documentation.
2023-02-09 15:03:11 +00:00
github-actions[bot]
14b2de94e2 chore(docs): Generated API Reference (#3211)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2023-02-09 09:50:55 +02:00
Carlos R. L. Rodrigues
d859ccf551 Feat(medusa) - delete cascade modules associations (#3190)
* delete cascade sales channel x locations, variant x inventory item
2023-02-08 17:23:47 -03:00
github-actions[bot]
9997485c55 chore(docs): Generated Docs Announcement Bar (automated) (#3212) 2023-02-08 20:04:13 +01:00
Shahed Nasser
cf946b26fa docs: added upgrade guide for v1.7.6 (#3207) 2023-02-08 19:51:47 +01:00
olivermrbl
3b474ec35c chore(release): Publish 2023-02-08 19:35:44 +01:00
Adrien de Peretti
bfa33f444c fix(medusa): Applying Discounts (with Conditions) on DraftOrders and Carts (#3197) 2023-02-08 19:01:23 +01:00
Patrick
4d3210bfbb feat(oas) - accurate model OAS representation - A to D (#3203)
### Scope

Models A to D

### What

Refactor OAS for models to accurately represent their shape in API responses.

### Why

About 33% of model fields are not accurately represented in the OAS. Most of the issues are:
- fields that can not be omitted in the response are not declared as `required`
- fields that could return `null` as their value are not declared as `nullable: true`

When using a code generator, these OAS issues would lead to inaccurate response shapes in the generated client.

### How

#### nullable
Fields meeting at least one of the following condition will be represented as `nullable: true` in OAS:
* The field is decorated with `@Column({ nullable: true })`
* The field is decorated with `@OneToOne`, `@ManyToOne`
* The field is decorated with `@DeleteDateColumn`

#### optional
Fields meeting at least one of the following conditions will never be listed as `required` in OAS and will be considered optional and could be omitted in the response:
* The field is decorated with `@OneToOne`, `@ManyToOne`, `@OneToMany`, `@ManyToMany`
* The field is decorated with `@FeatureFlagColumn`
* The field is decorated with `@Column({select: false})`
* The field is representing dynamic values not persisted in the database

Fields not meeting any of the conditions above will be declared as `required` and are expected to be present in the response.

### Test
* Ran OAS validator.
* Ran docs build script.

Expect OAS changes to be reflected in the API documentation.
2023-02-08 17:00:37 +00:00
Andrew Sprouse
f5dced6ad9 feat(oas): Improve OAS by adding missing type object to schemas (#3177)
This PR improves the OAS by adding `type: object` to schemas that have `properties` and no `type`. While this attribute is not required for a valid spec, omitting it opens the possibilities of non-object input. See https://stackoverflow.com/a/47390723 for a detailed description of this behavior. When generating code or schemas from an OAS with tools like takeshape.io having `type` attributes is important to get the correct behavior.
2023-02-08 16:31:39 +00:00
Patrick
53532df8d5 feat(OAS): sanitize circular reference for Redocly (#3198)
### What

Add OAS build step to patch known circular references that prevent Redocly from rendering the API documentation.

### Why

We've encountered crashing and loading issues with Redocly when the OAS contained circular references. We have been working around the limitation by omitting some known problematic $ref in our source OAS. We wish to move away from this strategy in order to always explicitly include $ref in our OAS.

### How

We are introducing a custom Redocly CLI plugin that will replace `$ref` by `type: object` base on a configurable set of instructions. These instructions can be modified in `docs-util/redocly/config.yaml`

We are adding a `redocly bundle` step in the current OAS build process in order to sanitize problematic circular references.

We updated the redocly-cli package version in order to ensure that plugins are supported.

### Test

We will use [Cart.payment](fd5c185159/packages/medusa/src/models/cart.ts (L72-L74)) to ensure that the new process is properly sanitizing.

* Run `yarn openapi:generate`
* Open `docs/api/store/components/schemas/Cart.yaml`
  * Expect the `payment` property to have been sanitized to `type: object`
* Run `yarn redocly preview-docs docs/api/store/openapi.yaml --config=docs-util/redocly/config.yaml`
* Visit http://127.0.0.1:8080/#tag/Cart/operation/GetCartsCart
  * In the response, expect cart.payment to not list the properties of the Payment schema.
2023-02-08 13:01:03 +00:00
Kasper Fabricius Kristensen
b9bda3bf4e fix(medusa): Allow method.data to be passed when creating/updating ShippingMethods in ClaimService (#3205)
**What**
- Allows passing data on shipping methods during claim creation and updates. Defaults to an empty object.

**Testing** 
- Updates a test so it also passes along shipping method data.
2023-02-08 12:37:35 +00:00
Kasper Fabricius Kristensen
86c87c7b10 fix(medusa): Deleting product prices (#3152) 2023-02-08 13:13:34 +01:00
Oliver Windall Juhl
08324355a4 chore: Patch bump all dependencies + minor bumps winston (#3185) 2023-02-07 19:15:29 +01:00
Adrien de Peretti
ce866475b4 chore(*-payment-*): Cleanup PaymentProvider plugins (#3011) 2023-02-07 12:43:24 +01:00
olivermrbl
0a2bf7845d Merge branch 'master' into develop 2023-02-06 20:01:54 +01:00
Pevey
78650ea665 feat(medusa): Include name in session options (#3186) 2023-02-06 19:26:02 +01:00
Frane Polić
5b63533c77 feat(medusa): Preserve custom adjustments when refreshing adjustments (#3085) 2023-02-06 19:22:05 +01:00
Kasper Fabricius Kristensen
d0adaf57ed fix(medusa): Shipping profile CRUD (#3154)
**What**
- Fixes wrong payload class for `POST /admin/shipping-profiles`
- Fixes wrong payload class for `POST /admin/shipping-profiles/:id`
- Fixes an issue where updating a shipping profile with products and/or shipping options would fail.
- Fixes an issue where passing `profile_id` to `ShippingOptionService.update()` would not update the shipping profile of the option.

**Testing** 
- Adds new `simpleshippingProfileFactory`
- Adds new integration test suite for shipping profiles operations.

Resolves CORE-1065
2023-02-06 16:57:12 +00:00
Frane Polić
4d6e63d68f feat(medusa): Decorate OrderEdit LineItems with totals (#3108) 2023-02-06 17:32:26 +01:00