Commit Graph

100 Commits

Author SHA1 Message Date
Riqwan Thamir
281b0746cf feat(medusa,workflows) Create cart workflow (#4685)
* chore: add baseline test for create cart

* chore: add basic paths into handlers + make first tests pass

* chore: move input alias to cart specific workflow

* chore: move data around into buckets

* chore: normalize handlers and introduce types

* chore: move aliases to handlers concern

* chore: add compensation step for create cart

* chore: merge with latest develop

* chore: handle error manually + type inputs

* chore: handle error manually

* chore: added types for each handler

* chore: remove addresses

* chore: added changset

* chore: undo package changes

* chore: added config settings to retreieve, cleanup of types

* chore: capitalize cart handlers

* chore: rename todo

* chore: add feature flag for workflow

* chore: reorder handlers

* chore: add logger to route handler

* chore: removed weird vscode moving around things

* chore: refactor handlers

* chore: refactor compensate step

* chore: changed poistion

* chore: aggregate config data

* chore: moved handlers to their own domain + pr review addressing

* chore: address pr reviews

* chore: move types to type package

* chore: update type to include config

* chore: remove error scoping
2023-08-08 12:10:27 +02:00
Oli Juhl
5c60aad177 feat(medusa, utils): Allow object feature flags (#4701)
Feature flags can be set as follows:

**Environment variables**
```
MEDUSA_FF_ANALYTICS=true
MEDUSA_FF_WORKFLOWS=createProducts,addShippingMethods
```

**Project config**
```
{
  featureFlags: {
    analytics: true,
    workflows: {
      createProducts: true,
      addShippingMethods: true,
    }
  }
}
```
2023-08-07 09:38:25 +00:00
Adrien de Peretti
dc46927bc6 feat(medusa, types, utils, workflow): Migrate medusa workflow to the workflow package (#4682) 2023-08-05 16:03:45 +02:00
Adrien de Peretti
4b80ba8a35 fix(product, integration-tests): Fix integration tests (#4674)
* fix(product, integration-tests): Fix integration tests

* improve test

* Create dirty-eagles-shop.md
2023-08-02 13:44:53 +02:00
Adrien de Peretti
379c83933e fix(module-sdk): Shared modules loading (#4611)
* WIP

* tests wording

* Create nasty-files-type.md

* cleanup
2023-07-27 12:53:31 +02:00
Carlos R. L. Rodrigues
f12299deb1 Feat: @medusajs/workflows (#4553)
feat: medusa workflows
2023-07-25 10:13:14 -03:00
Adrien de Peretti
d2a8cf0378 feat(medusa): Continue create product workflow changes (#4473) 2023-07-24 13:30:24 +02:00
Adrien de Peretti
4d326fbbdf chore: Move factories and helpers to a better place (#4551)
* chore: Move factories and helpers to a better place

* align factory product variant

* fix factory cart

* add simple store fac

* fix tests

* fix tests

* fix

* fix cart seeder
2023-07-20 13:16:04 +02:00
Philip Korsholm
d184d23c63 Feat/bulk operations for inventory service (#4503)
* initial push

* bulk delete reservations by location ids

* add method to interface (not implemented yet)

* bulk update

* delete reservations by location id bulk

* add create bulk for inventory item

* refactor attach inventory item method

* add changeset

* verbose false

* method override instead of multiple methods

* change up method signature

* redo changes when updating interface

* update createInventoryLevel method

* rename variables

* fix feedback

* return correct string array when emitting event

* refactor inventory service

* redo order changes

* snapshot

* move prep methods
2023-07-18 11:17:57 +02:00
Adrien de Peretti
befc2f1c80 feat(product): Create (+ workflow), delete, restore (#4459)
* Feat: create product with product module

* feat: create product wip

* feat: create product wip

* feat: update product relation and generate image migration

* lint

* conitnue implementation

* continue implementation and add integration tests for produceService.create

* Add integration tests for product creation at the module level for the complete flow

* only use persist since write operations are always wrapped in a transaction which will be committed and flushed

* simplify the transaction wrapper to make future changes easier

* feat: move some utils to the utils package to simplify its usage

* tests: fix unit tests

* feat: create variants along side the product

* Add more integration tests an update migrations

* chore: Update actions workflow to include packages integration tests

* small types and utils cleanup

* chore: Add support for database debug option

* chore: Add missing types in package.json from types and util, validate that all the models are sync with medusa

* expose retrieve method

* fix types issues

* fix unit tests and move integration tests workflow with the plugins integration tests

* chore: remove migration function export from the definition to prevent them to be ran by the medusa cli just in case

* fix package.json script

* chore: workflows

* feat: start creating the create product workflow

* feat: add empty step for prices and sales channel

* tests: update scripts and action envs

* fix imports

* feat: Add proper soft deleted support + add product deletion service public api

* chore: update migrations

* chore: update migrations

* chore: update todo

* feat: Add product deletion to the create-product workflow as compensation

* chore: cleanup product utils

* feat: Add support for cascade soft-remove

* feat: refactor repository to take into account withDeleted

* fix integration tests

* Add support for force delete -> delete, cleanup repositories and improvements

* Add support for restoring a product and add integration tests

* cleaup + tests

* types

* fix integration tests

* remove unnecessary comments

* move specific mikro orm usage to the DAL

* Cleanup workflow functions

* Make deleted_at optional at the property level and add url index for the images

* address feedback + cleanup

* fix export

* merge migrations into one

* feat(product, types): added missing product variant methods (#4475)

* chore: added missing product variant methods

* chore: address PR feedback

* chore: catch undefined case for retrieve + specs for variant service

* chore: align TEntity + add changeset

* chore: revert changeset, TEntity to ProductVariant

* chore: write tests for pagination, unskip the test

* Create chilled-mice-deliver.md

* update integration fixtuers

* update pipeline node version

* rename github action

* fix pipeline

* feat(medusa, types): added missing category tests and service methods (#4499)

* chore: added missing category tests and service methods

* chore: added type changes to module service

* chore: address pr feedback

* update repositories manager usage and serialisation from the write public API

* move serializisation to the DAL

* rename template args

* chore: added collection methods for module and collection service (#4505)

* chore: added collection methods for module and collection service

* Create fresh-islands-teach.md

* chore: move retrieve entity to utils package

* chore: make products optional in DTO type

---------

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

* feat(product): Apply transaction decorators to the services (#4512)

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2023-07-16 20:19:23 +02:00
Adrien de Peretti
9dcdc0041a fix(medusa, utils): fix the way selects are consumed alongside the relations (#4389)
**What**
There is actually an issue with using the `fields` query params with the way the repositories are using our custom query strategy. This pr aims to fix this issue by reworking the strategy.

What we had to do was to rework the way the selects are built for each subquery in order to follow the aliasing convention and to be taken into consideration. Alongside these changes, the join used to always select everything, this needed to be changed so that if there are any selects provided for a join, the join should not select everything and let the query select the fields that are requested.

Another notable change is that all the repositories are now using the repository util in order to centralize the customization and to have a single place to update when this kind of issue arises. This means that the eager relations when using the query builder are not necessarily taken into account. For that reason, I have removed the `shipping_option` eager option in favor of explicitly asking for the relations like we started to do it in some places.

FIXES CORE-1413
2023-06-29 13:26:41 +00:00
Adrien de Peretti
30d89044f1 fix(product): The bin scripts should include a shebang and import in the body (#4296) 2023-06-15 19:42:49 +02:00
Oliver Windall Juhl
afd1b67f1c chore: Clean up deps, devDeps, and peerDeps across all packages (#4276)
* chore: Use caret for all Medusa deps

* Create wild-balloons-push.md

* Address PR feedback

* force build order

* add missing dep

* add missing dev deps

* addresses last comments
2023-06-14 15:18:11 +02:00
Philip Korsholm
eadf13cb21 feat(medusa): variants expand inventory_items (#4203)
* add expand params for inventory items to product and variant endpoints in store

* add changeset

* update integration test naming

* make priceSeelctionParams extends findParams and adjust api accordingly
2023-06-05 20:14:05 +02:00
github-actions[bot]
8f8f6332b7 chore: Version Packages (#4114)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-30 12:11:45 +02:00
Philip Korsholm
0a35f21af7 feat(medusa, inventory): Search inventory items by title and description (#4154)
* initial filtering based on query

* add changeset

* add expect clause to ensure other items are not inluded
2023-05-24 11:52:25 +01:00
Philip Korsholm
3a38c84f88 feat(medusa,inventory,types): Expand list-reservation capabilities (#3979)
**What**
- Add filter capabilities to reservation items based on: 
  - description query: "contains", "startsWith", "endsWith", "equals"
  - date querying

**How**
- Introducing a new filtering primitive: "StringSearchOperator" resembling the "dateComparisonOperator"

Fixes CORE-1373
2023-05-24 09:54:25 +00:00
Philip Korsholm
4f3c8f5d70 feat(admin-ui,medusa): Reservations management (#4081)
* add location filtering to list-location levels

* cleanup

* add location filtering to list-location levels

* cleanup

* Initial work on route,table,new reservation form

* generated types

* add block

* udpate clients

* initial create reservation

* update actionables for reservation table

* update edit-allocation modal

* misc naming updates

* update reservations table

* add expand capabilities for list-reservations

* expand fields and show columns

* update oas

* make remove item work in focus modal

* add yarn lock

* add integration test

* Fix display when label doesn't match search term

* remove unused file

* Update packages/admin-ui/ui/src/components/templates/reservations-table/components/reservation-form/index.tsx

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

* Update packages/admin-ui/ui/src/domain/orders/details/allocations/edit-allocation-modal.tsx

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

* Update packages/admin-ui/ui/src/components/templates/reservations-table/new/index.tsx

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

* initial changes

* add changeset

* update font size

* cleanup reservations table + select

* add decorated inventory item type

* use type

* feedback changes

* Update packages/admin-ui/ui/src/components/molecules/item-search/index.tsx

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>

* decorate response for list inventory item to include total quantities

* update decorated properties

* decorate type

* adrien feedback

* Update packages/generated/client-types/src/lib/models/DecoratedInventoryItemDTO.ts

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

* update join-utils

* fix caching

---------

Co-authored-by: Rares Capilnar <rares.capilnar@gmail.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2023-05-23 05:24:28 +02:00
Philip Korsholm
4fb443c0ea feat(medusa): Add location id filtering to list location levels (#4066)
**What**
- add capabilities for filtering locations by id when listing locations for an inventory item
2023-05-16 12:21:53 +00:00
github-actions[bot]
0be70113f9 chore: Version Packages (#4074)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-16 11:03:47 +02:00
Oliver Windall Juhl
6511959e23 chore: Revert to official Typeorm package (#4072) 2023-05-11 13:08:38 +02:00
github-actions[bot]
a8f43055db chore: Version Packages (#4020)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-09 15:49:04 +02:00
Frane Polić
0c58ead6d8 fix(medusa): Validate customer_id when completing a cart (#3967) 2023-05-07 13:12:06 +02:00
github-actions[bot]
6b2bcc1a36 chore: Version Packages (#3942)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-04 10:51:13 +02:00
Philip Korsholm
9838723192 fix(medusa): Performance improvement for variant availability (#3921)
**What**
- refactor availability invocations to only do one call to the inventory module

@adrien2p would love to run through some tests of this with you and get your take on approach
2023-05-03 09:17:55 +00:00
Riqwan Thamir
4e8045a0ac fix(medusa): Use query relation load strategy on Products (#3926)
* fix(medusa): products retrieve uses query strategy for performance

* chore: packaged version of medusa typeorm fix

* chore: update path

* chore: stock locations uses typeorm version

* chore: resolve typeorm to medusa package

* chore: Update medusa project in CI action

* chore: temp disable transaction timeout for plugins

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: olivermrbl <oliver@mrbltech.com>
2023-05-02 19:37:44 +02:00
Oliver Windall Juhl
d539c6feeb chore: Bump Typeorm to Medusa fork (#3981)
* chore: Bump typeorm to medusa fork

* Update types + utils

* Bump integration test suites

* Create good-parents-prove.md
2023-05-02 14:37:19 +02:00
github-actions[bot]
b41b6303cc chore: Release (#3856)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-26 19:09:01 +02:00
Oliver Windall Juhl
3b3236cc01 fix(medusa): Reduce joins in cart retrieval (#3909)
* fix(medusa): Remove discounts.regions relation from cart retrieval

* Create violet-poets-rule.md

* fix service test

* update snapshot

---------

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
2023-04-25 12:51:33 +02:00
Philip Korsholm
2be144ff05 feat(medusa): Add purchasable prop on variants when setting availability (#3811)
* write integration tests

* update variant inventory decorator

* update types

* add changeset

* feedback comments

* add yaml schemas

* different oas approach

* pr feedback

* update oas

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-04-20 08:54:26 +02:00
github-actions[bot]
0f51e3a400 chore: Release (#3818)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-04-14 11:18:39 +02:00
github-actions[bot]
3efe13eefd chore: Release (#3782)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-04-12 11:32:05 +02:00
Oliver Windall Juhl
654a546223 chore: Bump Typeorm (#3778) 2023-04-11 18:43:40 +02:00
Oliver Windall Juhl
085fedb1f7 chore(medusa): Upgrade ioredis-mock (#3704)
* chore(medusa): Upgrade ioredis-mock

* Create .changeset/old-spoons-bow.md

* chore: Increas jest timeout

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-09 16:10:04 +02:00
olivermrbl
4c268238a4 Merge branch 'master' into develop 2023-04-05 09:18:48 +02:00
olivermrbl
66c59d54ff chore(release): v1.8.0 2023-04-04 18:35:27 +02:00
olivermrbl
f0d37b4d2d chore(release): v1.8.0-rc.8 2023-04-04 17:37:13 +02:00
olivermrbl
7a3194c313 chore(release): v1.8.0-rc.7 2023-04-04 16:07:48 +02:00
Patrick
089f1eb19e feat(tests): harmonize and clean-up yarn test commands convention (#3695)
## What

Harmonize and clean-up yarn test commands convention.

## Why

Current strategy to filter integration tests from unit tests was cumbersome to maintain. Also, some packages declared `test:unit` which ended up being an alias to `test`.

## How

* Remove all occurrences of `test:unit`
* Rename all `test` commands under `/integration-tests/**/package.json` to `test:integration`
* In the root `package.json`, rewrite `test:integration` command to run `turbo run test:integration`
* In the root `package.json`, remove filtering on the `test` command
* Introduce a new `test:integration` task in the Turborepo config.
2023-04-04 13:47:54 +00:00
Philip Korsholm
748833383f hotfix(medusa): Temporary multi-warehouse support for draft orders (#3665)
* remove reservations from draft order creation and show correct inventory

* add changeset

* add integration tests

* adjust inventory on payment if no inventory service is installed
2023-04-04 11:36:51 +02:00
olivermrbl
bb9df09e37 chore(release): v1.8.0-rc.6 2023-04-03 18:05:12 +02:00
Philip Korsholm
0cca13779d Fix(medusa): stocked quantity counting when listing products (#3684)
* count stocked quantity correctly when listing products

* add integration test

* add changeset
2023-04-03 11:07:56 +02:00
olivermrbl
6f85a3d366 chore(release): v1.8.0-rc.5 2023-03-31 13:27:14 +02:00
Oliver Windall Juhl
809ab2e0eb chore: Merge master to develop (#3653) 2023-03-31 13:09:57 +02:00
olivermrbl
89d4d84666 chore(release): v1.8.0-rc.4 2023-03-30 17:12:37 +02:00
Philip Korsholm
5e405be02c feat(medusa): Remove reservations for all line items when an order edit is accepted (#3544)
**What**
- Remove all allocations to line items once an order edit is confirmed

**Why**
- Since all line items of an order are discarded once an order edit is confirmed it will orphan the reservations causing inconsistencies with the stock
2023-03-30 09:56:10 +00:00
Philip Korsholm
5fd74b38ae feat(medusa): remove created reservations on subsequent failure for cart completion (#3554)
**What**
- If cart completion fails after creating reservations, remove those reservations

**Why**
- To avoid hanging reservations if something fails at a later point
2023-03-29 17:03:53 +00:00
olivermrbl
15a43c1cc0 chore(release): v1.8.0-rc.3 2023-03-29 13:42:11 +02:00
olivermrbl
8ddb3952c0 chore(release): v1.8.0-rc.2 2023-03-28 21:04:57 +02:00
olivermrbl
990c79d2d5 chore(release): v1.8.0-rc.1 2023-03-28 19:32:36 +02:00