Commit Graph

935 Commits

Author SHA1 Message Date
Oli Juhl
ea8d9d4d42 feat: API key sales channel link (#6851)
What
- Add link between API key and sales channels
- Add API route for batch adding sales channels to a publishable API key
- Clean up API key API routes responses
- Move API key test suite from `integration-tests/modules` to `integration-tests/api`
2024-03-28 10:15:11 +00:00
Riqwan Thamir
f176aa2b7b chore: remove noop tests (#6855) 2024-03-28 09:40:34 +01:00
Philip Korsholm
ff84f749d5 feat(medusa): add list location levels endpoint in api v2 (#6741) 2024-03-27 18:59:38 +01:00
Adrien de Peretti
d4d1f9b2f2 fix: integration tests modules expectations (#6848)
**What**
- fix tests
- cleanup deprecated jest conf
2024-03-27 15:39:20 +00:00
Adrien de Peretti
5d9aea053c fix(utils): Mikro orm prop filtering should check existence (#6842)
**What**
- Should return non decorated but visible properties.
- Should only prevent circular on non scalar fields
2024-03-27 14:31:26 +00:00
Philip Korsholm
4cf71af07d feat(core-flows, medusa): add update stock location endpoint to api-v2 (#6800)
* initial create

* add changeset

* redo changes for stock locatino module'

* initial update

* add changeset

* move integration tests

* update update method

* fix integration tests

* Update packages/stock-location-next/src/services/stock-location.ts

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

* update service

* initial fixes

* pr feedback

* update types

* expand revert clause for update

* update versioning

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-03-27 10:31:17 +01:00
Oli Juhl
0b23e7efb8 feat: Support invites in CLI for V2 (#6798)
**What**

- Add invite support to cli for 2.0
- Allow email to be passed upon accepting an invite
2024-03-26 20:02:56 +00:00
Oli Juhl
7bc7adeeb4 feat: Create user account (#6819) 2024-03-26 10:07:38 +01:00
Riqwan Thamir
509ddf9a56 feat(medusa): migrate medusa unit tests / plugins integration tests to swc jest (#6820)
what:

- migrates medusa package to swc/jest
- migrates plugins integration tests to swc/jest
- parallelises a few of the heavy test packages
- fixes typeorm circular dependencies

**Unit Tests**

Before: 1 job => ~30 mins
After: 2 jobs => ~5 mins


<img width="260" alt="Screenshot 2024-03-25 at 15 11 49" src="https://github.com/medusajs/medusa/assets/5105988/e1df6985-5bd6-48d0-b87b-336d3c77d0cf">

**Plugins**

Before: 1 job => ~10 mins
After: 1 job => ~5 mins

<img width="254" alt="Screenshot 2024-03-25 at 15 26 03" src="https://github.com/medusajs/medusa/assets/5105988/c1cec0e2-a1c3-41d1-9372-46d114d804c6">



Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-03-25 17:55:34 +00:00
Philip Korsholm
20132d7cea feat(medusa, core-flows): add retrieve stock location endpoint to api-v2 (#6791)
* initial create

* add changeset

* redo changes for stock locatino module'

* add get endpoint

* add changeset

* add exception if location is not found

* remove only

* initial delete stock location

* add changeset

* add changeset

* pr prep

* remote duplicate changeset

* propagate deletion with common step

* move integration tests

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2024-03-25 16:58:23 +01:00
Philip Korsholm
deab12e27e feat(types, medusa, core-flows): add delete-stock-location endpoint to api-v2 (#6801)
* initial create

* add changeset

* redo changes for stock locatino module'

* initial delete stock location

* add changeset

* pr prep

* propagate deletion with common step

* move integration tests

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2024-03-25 16:29:36 +01:00
Riqwan Thamir
9073d7aba3 feat(core-flows,medusa,types,utils): rename psma to prices (#6796)
What:

Renames pricesetmoneyamount to prices

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-03-25 13:15:25 +00:00
Philip Korsholm
68b9812aa1 feat(core-flows, medusa): add create stock location endpoint for api-v2 (#6787) 2024-03-25 12:53:09 +01:00
Oli Juhl
0deb2776ad feat: Add successRedirectUrl to auth options (#6792) 2024-03-25 08:55:21 +01:00
Philip Korsholm
aa154665de feat(core-flows, types, medusa): Add Update location level endpoint for api-v2 (#6743)
* initialize update-location-level

* update middlewares

* readd middleware

* pr feedback
2024-03-25 07:43:41 +01:00
Carlos R. L. Rodrigues
7e93eda1a4 feat(orchestration,workflows-sdk,core-flows): workflow cancel (#6778) 2024-03-22 15:03:06 +01:00
Oli Juhl
9e25e0c42e feat: List products middleware (#6769) 2024-03-22 14:59:21 +01:00
Riqwan Thamir
4c98545ab3 feat: shard modules and API integration tests (#6775)
what:

- runs module and api integration tests in matrix strategy
  - v28 of jest comes with sharding support, which we can utilize when we upgrade
- splits the tests by number of matrix jobs and run them in parallel
  - This introduced some flakiness in some specs, but couldn't reproduce locally. Those have been skipped for now.
- uses swc/jest for added performance
  - Locally, a chunk took 90 seconds with babel and 30 seconds with swc. 
  - This translated to 2 mins saved per shard in CI, but haven't tested this enough.
2024-03-22 11:15:01 +00:00
Riqwan Thamir
b792c4cab5 chore: merge money amounts and price set money amounts (#6768)
what: 

- merges price set money amounts and money amount
2024-03-21 16:10:13 +00:00
Riqwan Thamir
cf8b5ce85b chore: pricing models uses standardized relationships attributes (#6767)
what:

- all relationships under all models are standardized
2024-03-21 10:01:52 +00:00
Carlos R. L. Rodrigues
60070fb65f fix(link-modules): recreate dismissed link (#6764)
* fix(link-modules): recreate dismissed link

* rm type

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-03-20 19:12:48 +01:00
Riqwan Thamir
20243e22ee feat(pricing): pricing models are made soft deletable (#6732)
what:

- pricing models are made soft deletable
- adds missing timestamp attributes
- removes unwanted relationships + cascade cleanup
2024-03-20 16:03:17 +00:00
Stevche Radevski
70859397c0 feat: Align the product module HTTP API to follow our conventions (#6759) 2024-03-20 16:18:13 +01:00
Philip Korsholm
64c2731e46 feat(medusa, core-flows): add ppdate inventory item endpoint (#6735)
* init update inventory item

* prep for pr
2024-03-20 14:45:06 +01:00
Oli Juhl
8155e2cfad feat: Init. v2 implementation in admin (#6715) 2024-03-20 14:28:28 +01:00
Stevche Radevski
db9c460490 feat: Add product and pricing link on create and delete operations (#6740)
Things that remain to be done:
1. Handle product and variant updates
2. Add tests for the workflows independently
3. Align the endpoints to the new code conventions we defined
4. Finish up the update/upsert endpoints for variants

All of those can be done in a separate PR, as this is quite large already.
2024-03-19 17:14:02 +00:00
Oli Juhl
3062605bce feat: Add products to sales channel (#6725)
Depends on #6722
2024-03-19 10:24:37 +00:00
Philip Korsholm
62d5803b20 Feat(core-flows, medusa): delete inventory item (#6708)
* initial get-inventory-item

* add exception throw test

* remove console log

* add changeset

* remove inventory item

* add changeset

* fix pr feedback

* use links

* use modules instead of property names
2024-03-19 10:40:18 +01:00
Philip Korsholm
c20eb15cd9 Feat(core-flows, medusa, types): Add delete location level api-v2 endpoint (#6727)
* add delete inventory level endpoint

* add changeset

* rename step

* rename step
2024-03-19 10:06:37 +01:00
Philip Korsholm
390bc3e72f Feat(core-flows, inventory-next, medusa, types): Add create inventory item endpoint (#6693)
* init create inventory item

* fix integration tests

* pr feedback

* rename to validate

* pr feedback

* bulk delete

* undo change w/ naming

* update dto body

* move integration test

* pr fixes

* fix for pr review

* revert medusa-config changes

* pr feedback

* fix build
2024-03-19 09:20:30 +01:00
Oli Juhl
0219a8677b feat: Sales Channels API routes + workflows (#6722)
**What**
- Admin sales channels API routes
- Workflows for creating, updating, and deleting sales channels
- Align `ISalesChannelModuleService` interface with update + upsert conventions
- Integrate v2 tests into v1 sales channels integration test suite
- Add metadata to sales channel entity

Sales channel <> Product management will come in a follow-up PR.

On the integration tests, creating, updating, and deleting are passing with the V2 flag enabled. You'll have to take my word for it (or run them yourself), as they are not included in the CI.
2024-03-18 20:57:29 +00:00
Riqwan Thamir
0c705d7bd4 feat(core-flows,medusa,types): create/update workflows to create and update PriceList prices (#6711)
what:

- create and update workflows for price list prices
- update price list endpoint does a "set"
2024-03-18 14:14:28 +00:00
Philip Korsholm
84b8836cbf Feat(core-flows, inventory-next, medusa, types): Add create location level endpoint (#6695)
* initialize create location levels

* add enough from pr to make code build and test

* fix integration tests

* pr feedback

* fix errors

* rm dto

* Update packages/core-flows/src/inventory/steps/validate-inventory-locations.ts

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

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-03-18 10:28:57 +01:00
Adrien de Peretti
e77a02aca5 feat(): Update transformer middleware and API (#6647)
**What**
Update all transform middleware to support the new API
- deprecate `defaultRelations`
- deprecate `allowedRelations`
- Add `defaults` and `allowed` in replacement for `defaultFields` and `allowedFields` respectively
- in the `defaults` it is possible to specify a field such as `*variants` in order to be recognized as a relation only without specifying any property
- add support for `remoteQueryConfig` assigned to req like we have for `listConfig` and `retrieveConfig`
- add support to override `allowed|allowedFields` if a previous middleware have set it up on the req.allowed
- The api now accepts `fields` as the only accepted fields to manage the requested props and relations, the `expand` property have been deprecated. New supported symbols have been added in complement of the fields
  - `+` (e.g `/store/products?fields=+description`) to specify that description should be added as part of the returned data among the other defined fields
  - `-` (e.g `/store/products?fields=-description`) to specify that description should be removed as part of the returned data
  - `*` (e.g `/store/products?fields=*variants`) to specify that the variants relations should be added as part of the returned data among the other defined fields without having to specify which property of the variants should be returned. In the `defaults` config of the transform middleware it is also possible to use this symbol
  - In the case no symbol is provided, it will replace the default fields and mean that only the specified fields must be returned

About the allowed validation, all fields in the `defaults` configuration must be present in the `allowed` configuration. 
In case the `defaults` contains full relation selection (e.g `*product.variants`) it should be present in the `allowed` as `product.variants`. In case in the `defaults` you add `product.variants.id`, it will be allowed if the `allowed` configuration includes either `product.variants.id` as full match or `product.variants` as it means that we allow all properties from `product.variants`

Also, support for `*` selection on the remote query/joiner have been added


**Note**
All v2 end points refactoring can be done separately
2024-03-18 08:37:59 +00:00
Philip Korsholm
56a6ec0227 feat(medusa): Add get inventory item endpoint (#6704)
* initial get-inventory-item

* add exception throw test

* remove console log

* add changeset

* remove unused import
2024-03-15 16:00:27 +01:00
Adrien de Peretti
3188e703b3 feat(fulfillment): Separate list and context rules validation (#6674)
**What**

- Add method to validate fulfillment option from the provider
- Separate list/list and count from context rules validation and add listShippingOptionsForContext

FIXES CORE-1861
2024-03-15 13:25:51 +00:00
Stevche Radevski
1956dce80a feat: Update the product options model and refactor the product module (#6685)
The changes in this PR are:
1. Change how product options are created and stored. The relationship changed from
`options --> option values <-- variants`
to
`options --> option values --> variant options <-- variants`

Now we can enforce non-duplicate option values, easier creation and updates of options, and more.

2. Refactors the product module. The product module did a lot of things in a non-ideal approach, and this is a step towards a more consistent usage of the base repository and methods exposed by a module. There is still work left to improve the module, but a large chunk of the changes are included in this PR


Things to do as a follow-up:
1. Remove many-to-many relationships  if an empty list is passed in the base repository.
2. Improve the typings of the module
3. Further cleanup and improvements (there are few questions that I need answered before I can improve the API)
2024-03-15 12:35:46 +00:00
Riqwan Thamir
9288f53327 feat(core-flows,medusa,pricing,types,utils): added price list workflows + endpoints (#6648)
Apologies for the giant PR in advance, but most of these are removing of files and migrations from old workflows and routes to new.

What:

- Adds CRUD endpoints for price lists
- Migrate workflows from old sdk to new
- Added missing updatePriceListPrices method to pricing module
2024-03-15 11:09:02 +00:00
Riqwan Thamir
e5945479e0 feat(medusa,core-flows,types): adds update promotion rule endpoint + workflow (#6702)
what:

- adds endpoint + workflow to update promotion rule
- adds method in promotion to update promotion rules
2024-03-14 20:04:53 +00:00
Riqwan Thamir
7be0a2cf6d chore(medusa): use batch/add and batch/remove endpoints for promotion rules (#6701) 2024-03-14 19:07:48 +01:00
Riqwan Thamir
cc1b66842c feat(core-flows,medusa,types,utils): add/remove fulfillment shipping option rules (#6698)
what:

- adds fulfillment shipping option rules batch endpoint
- remove fulfillment shipping option rules batch endpoint
- breaks my British based education to not call it fulfilment with a single "l"
2024-03-14 16:02:50 +00:00
Riqwan Thamir
1a661adf3e feat(medusa,types): GET admin promotion endpoint to fetch by code (#6697)
what:

- GET admin promotion endpoint will search for a promotion either through ID or code
2024-03-14 15:13:53 +00:00
Philip Korsholm
c3f8c30ba6 Feat(inventory-next, medusa): Add List inventory items endpoint (#6694)
* code for list inventory items

* fix integration tests

* move integration test

* calculate reserved and stocked quantities in db

* update lockfile
2024-03-14 14:48:34 +01:00
Riqwan Thamir
04a532e5ef feat(core-flows,medusa,types): remove rules from promotion endpoints + workflows (#6696) 2024-03-14 09:19:05 +01:00
Riqwan Thamir
640eccd5dd feat(core-flows,medusa,types,utils): add rules to promotion endpoints + workflow (#6692)
* feat(core-flows,medusa,types,utils): add rules to promotion endpoints + workflow

* chore: fix specs

* chore: move input type to types package
2024-03-13 21:19:24 +01:00
Oli Juhl
02e784ce78 feat: Confirm inventory in create cart workflow (#6635) 2024-03-13 18:24:08 +01:00
Riqwan Thamir
b78f863d80 feat(core-flows,medusa): added api + workflows for rule types CRUD (#6684) 2024-03-13 16:43:30 +01:00
Oli Juhl
25d176b851 feat: List shipping options for cart (#6677) 2024-03-13 09:08:47 +00:00
Oli Juhl
db26dafa85 chore: Use module test runner in Carts API test suite (#6679)
Nothing but migrating to our new module test runner. Hopefully, that'll make the actual test PRs easier to digest.
2024-03-13 07:32:58 +00:00
Riqwan Thamir
d4b921f3db feat(medusa,pricing,types): added get endpoints for pricing rule types (#6678)
what:

- adds list endpoint for rule types
- adds get endpoint for rule types
2024-03-12 17:35:24 +00:00