Commit Graph

94 Commits

Author SHA1 Message Date
Adrien de Peretti
9cc787cac4 feat(workflows-sdk): Configurable retries upon step creation (#5728)
**What**
- Allow to create step that can be configured to have a max retry
- Step end retry mechanism on permanent failure

Also added an API to override a step configuration from within the createWorkflow
```ts
const step = createStep({ name: "step", maxRetries: 3 }, async (_, context) => {
  return new StepResponse({ output: "output" })
})

const workflow = createWorkflow("workflow", function () {
  const res = step().config({ maxRetries: 5 }) // This will override the original maxRetries of 3
})
```

**NOTE**
We can maybe find another name than config on the step workflow data to override the step config.
2023-12-19 09:38:27 +00:00
Frane Polić
1d7888afca feat(medusa, link-modules): sales channel <> product module link (#5450)
* feat: sales channel joiner config

* feat: product sales channel link config, SC list method

* feat: migration

* fix: refactor list SC

* refactor: SC repo api

* chore: changeset

* feat: add dedicated FF

* feat: product<> sc join entity

* fix: update case

* fix: add FF on in the repository, fix tests

* fix: assign id when FF is on

* fix: target table

* feat: product service - fetch SC with RQ

* feat: admin list products & SC with isolated product domain

* feat: get admin product

* feat: store endpoints

* fix: remove duplicate import

* fix: remove "name" prop

* feat: refactor

* fix: product seeder if FF is on

* fix: env

* refactor: workflow product handlers to handle remote links

* fix: condition

* fix: use correct method

* fix: build

* wip: update FF

* fix: update FF in the handlers

* chore: migrate to medusav2 FF

* chore: uncomment test

* fix: product factory

* fix: unlinking SC and product

* fix: use module name variable

* refactor: cleanup query definitions

* fix: add constraint

* chore: rename prop

* fix: add hook

* fix: address comments

* fix: temp sc filtering

* fix: use RQ to filter by SC

* fix: add sc to filter to list

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2023-12-15 13:43:00 +01:00
Riqwan Thamir
07107f3565 feat(orchestration,core-flows,medusa,product,types,utils): product import/export uses workflows (#5811) 2023-12-12 12:09:25 +00:00
Riqwan Thamir
079f0da83f feat(core-flows,pricing,medusa,pricing,types,utils): Price List Prices can have their own rules (#5752)
**What**
- Add price-rules for prices in price-lists
- make rules object optional when creating prices

**Why**
- more price granularity

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
2023-12-12 08:20:21 +00:00
Adrien de Peretti
6975eacb33 feat(medusa): Improve add line item to cart perf and transaction management + clustering start command (#5701) 2023-12-06 08:53:35 +01:00
Adrien de Peretti
ddbeed4ea6 chore(workflows, core-flows): Split workflows tooling and definitions (#5705) 2023-11-24 13:55:48 +00:00
Riqwan Thamir
fc1ef29ed9 fix(medusa,pricing,types): rules only gets updated/deleted upon passing an explicit object (#5711) 2023-11-24 13:54:23 +00:00
Philip Korsholm
a39ce125cc fix(product, types, workflows): Update product variant workflow (#5668)
**What**
- Fix issues with update-variant workflow: 
  - other variants than the updated variant are no longer removed 
  - options are updated properly


Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com>
2023-11-23 14:35:01 +00:00
Adrien de Peretti
010560fd2a fix(workflows): compensation handling (#5691) 2023-11-23 09:11:03 +00:00
Carlos R. L. Rodrigues
9f9db39698 feat(workflows): Workflow DX (#5607) 2023-11-22 17:23:39 +00:00
Philip Korsholm
dc5750dd66 feat(medusa,types,workflows,utils,product): PricingModule Integration of PriceLists into Core (#5536) 2023-11-21 17:42:37 +00:00
Riqwan Thamir
cedab58339 feat(workflows,medusa,utils): add medusa v2 feature flag (#5603)
* chore: add medusa v2 feature flag

* chore: cleanup more FF

* chore: cleanup workflows FF

* chore: add comments on broken specs

* chore: added check for package registration

* chore: reenable workflows FF for create order workflow

* chore: disable FF on test cli db

* chore: hide loader validation behind FF

* chore: use medusa v2 enabled

* chore: register feature flag router in use-db

* chore: change to minro
2023-11-13 16:18:05 +01:00
Adrien de Peretti
f88d75b0a7 feat(product, pricing, utils): Transaction issues and reference issues (#5533)
* feat(product, pricing, utils): Transaction issues and reference issues

* fixes decorators

* cleanup

* fix product module upsert

* fix missing active manager

* increase timeout

* revert package.json

* WIP

* try another node version based on findings with memory issues with jest introduced after 16.11 but fixed in 21

* re add bail

* fix variant options

* chore: bulk create pricing

* chore: workflow bulk

* Create big-chefs-dream.md

* fix missing update for upserty

* Add integration tests for product options upsert

* rm unnecessary return

* fix product prices workflow issue

* cleanup

* fix flag

* fix model

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2023-11-06 12:24:29 +01:00
Adrien de Peretti
80fe362f33 fix(integration): setup (#5511)
* fix(integration): setup
2023-11-01 13:56:12 -04:00
Riqwan Thamir
03c7a3949c chore(integration-tests): skip create product workflow test (#5504) 2023-10-31 11:43:42 +00:00
Philip Korsholm
9ff22110a6 fix(medusa): Add inventory decoration for cart endpoints (#5187)
**What**
- decorate item totals for `cart.item.variant` when adding a line-item and retrieving a cart

closes #5181
2023-10-31 09:55:30 +00:00
Philip Korsholm
4d52082bf0 feat(medusa): variant creation with prices in productservice.create (#5410) 2023-10-30 17:22:57 +01:00
Philip Korsholm
148f537b47 feat(medusa): integrate pricing module to core (#5304)
* add pricing integraiton feature flag

* init

* first endpoint

* cleanup

* remove console.logs

* refactor to util and implement across endpoints

* add changeset

* rename variables

* remove mistype

* feat(medusa): move price module integration to pricing service (#5322)

* initial changes

* chore: make product service always internal for pricing module

* add notes

---------

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

* nit

* cleanup

* update to object querying

* update cart integration test

* remove uppercase currency_code

* nit

* Feat/admin product pricing module reads (#5354)

* initial changes to list prices for admin

* working price module implementation of list prices

* nit

* variant pricing

* redo integration test changes

* cleanup

* cleanup

* fix unit tests

* [wip] Core <> Pricing - price updates  (#5364)

* chore: update medusa-app

* wip

* get links and modules working with migration

* wip

* chore: make test pass

* Feat/rule type utils (#5371)

* initial rule type utils

* update migration script

* chore: cleanup

* ensure prices are always decorated

* chore: use seed instead

* chore: fix oas conflict

* region id add to admin price read!

---------

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

* pr feedback

* create remoteQueryFunction type

* fix merge

* fix loaders issue

* Feat(medusa, types, pricing): pricing module migration script (#5409)

* add migration script for money amounts in pricing module

* add changeset

* rename file

* cleanup imports

* update changeset

* add check for pricing module and ff

* feat(medusa,workflows,types): update prices on product and variant update (#5412)

* wip

* chore: update product prices through workflow

* chore: cleanup

* chore: update product handler updates prices for variants

* chore: handle reverts

* chore: address pr comments

* chore: scope workflow handlers to flag handlers

* chore: update return

* chore: update db url

* chore: remove migration

* chore: increase jest timeout

* Feat(medusa): update migration and initDb to run link-migrations (#5437)

* initial

* loader update

* more progress on loaders

* update integration tests and remote-query loader

* remove helper

* migrate isolated modules

* fix test

* fix integration test

* update with pr feedback

* unregister medusa-app

* re-register medusaApp

* fix featureflag

* set timeout

* set timeout

* conditionally run link-module migrations

* pr feedback 1

* add driver options for db

* throw if link is not defined in migration script

* pass config module directly

* include container in migrate command

* chore: increase timeout

* rm redis from api integration tests to test

* chore: temporarily skip tests

* chore: undo skips + add timeout for workflow tests

* chore: increase timeout for order edits

* re-add redis

* include final resolution

* add sharedcontainer to medusaapp loader

* chore: move migration under run command

* try removing redis_url from api tests

* chore: cleanup server on process exit

* chore: clear container on exit

* chore: adjustments

* chore: remove consoles

* chore: close express app on finish

* chore: destroy pg connection on shutdown

* chore: skip

* chore: unskip test

* chore: cleanup container pg connection

* chore: skip

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2023-10-30 14:42:17 +01:00
Frane Polić
aba9ded2a3 feat(workflows): update product workflow (#4982)
**What**
- added "update product" workflow

Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com>
2023-10-19 12:02:40 +00:00
Oli Juhl
9c362f7214 chore(integration-tests): Add jest timeout to workflow tests (#5401) 2023-10-18 08:45:50 +02:00
Sebastian Rindom
66413d094e feat: move create inventory to @medusajs/workflows (#5301)
**Why**
- We have some workflow-like flows in @medusajs/medusa. These should be moved over to the workflows package.
- Inventory Items <> Variant currently assume a 1-1 mapping. There should be support for a many-to-many mapping.

**What**
- PR introduces a feature flag for supporting many-to-many mappings for inventory and variants.
- Deletes legacy transaction handler in @medusajs/medusa.
- Adjusts existing createInventoryItems handler to remove dependency on variant data.

**Unkowns**
~~1. Couldn't find an existing test for the CreateProduct workflow. It should be tested that this still works as expected.~~
2. Have removed transaction managers as we should move to handling consistency through orchestration tooling. Are we ready for that?
2023-10-11 18:01:56 +00:00
Sebastian Rindom
4ebcd3af6a chore: adds test for inventory item creation as part of product creation (#5312)
* chore: adds test for inventory item creation as part of product creation

* chore: remove only
2023-10-09 14:24:11 -07:00
Adrien de Peretti
240c439beb fix(medusa): Product model before insert hook (#5200)
**What**
When the id is provided, the rest of the hook should still apply. At the moment, when the id is provided the hook is skipped
2023-09-26 09:48:26 +00:00
David Preininger
2caff2efc7 feat(medusa): Authentication overhaul (#4064)
* implemented bearer auth

* changed naming strat

* changed session auth to not use jwt

* typo

* changed auth header prefix for admin api token auth

* fixed supporting functions to work with new session type

* removed database calls for bearer auth improving performance

* removed unused deps

* changed auth in tests

* added integration tests

* Accepted suggested change

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* Typo

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

* more typos

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

* proper formatting

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

* removed endregion

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

* removed startregion

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

* fixed admin JWT integration test

* added more fixes to integration tests

* Update OAS

* Create fluffy-donkeys-hope.md

* created API reference for new auth

* implemented getToken in medusa-js

* Apply suggestions from code review

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* Apply suggestions from code review

Co-authored-by: Shahed Nasser <shahednasser@gmail.com>

* deleted files which should be autogenerated

* Update fluffy-donkeys-hope.md

* JSDoc update

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

* added missing route exports

* implemented runtime domain safety in jwt token manager

* fixed jwt manager

* lint get-token files

* Update fluffy-donkeys-hope.md

* Revert "deleted files which should be autogenerated"

This reverts commit cd5e86623b822e6a6ac37322b952143ccc493df9.

* Revert "Apply suggestions from code review"

This reverts commit f02f07ce58fd9fcc2dfc80cadbb9df2665108d65.

* Revert "created API reference for new auth"

This reverts commit c9eafbb36453f5cf8047c79e94f470cb2d023c7d.

* renamed header for sending api access tokens

* medusa-js - changed apiKey header

---------

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>
Co-authored-by: olivermrbl <oliver@mrbltech.com>
Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
2023-09-25 13:57:44 -04:00
Philip Korsholm
5d10c46bb1 feat(medusa): Separate money amount and variant (#4906)
* initial changes

* working test

* final changes to product tests

* update integration tests

* update price list integration tests

* update integration tests

* update unit tests

* update plugin integration tests

* remove catch from integration test

* undo change

* add andWhere

* update upsertCurrencyMoneyAmount method

* undo line item changes

* undo changes

* update deprecated method

* Update packages/medusa/src/migrations/1692953518123-drop_money_amount_constraints_for_pricing_module.ts

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>

* rename joinTable

* update with joinTable entity

* update load methods

* remove await create

* re-add context test

* update price list behavior for prices

* update price list snapshots

* re-add admin seeder

* pr feedback

* fix unit tests

* fix plugin integration tests

* initial review changes

* redo changes to variant creation

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-09-13 13:26:20 +02:00
Philip Korsholm
2b078f06d9 fix(medusa): default sales channel for store variant endpoints (#4556)
* add changeset

* include default sales channel when querying variant endpoints

* make parameter optional

* update default values

* add integraiton tests
2023-09-11 14:05:47 +02:00
Carlos R. L. Rodrigues
4d16acf5f0 feat(link-modules,modules-sdk, utils, types, products) - Remote Link and Link modules (#4695)
What:
- Definition of all Modules links
- `link-modules` package to manage the creation of all pre-defined link or custom ones

```typescript
import { initialize as iniInventory } from "@medusajs/inventory";
import { initialize as iniProduct } from "@medusajs/product";

import {
  initialize as iniLinks,
  runMigrations as migrateLinks
} from "@medusajs/link-modules";

await Promise.all([iniInventory(), iniProduct()]);


await migrateLinks(); // create tables based on previous loaded modules

await iniLinks(); // load link based on previous loaded modules

await iniLinks(undefined, [
  {
    serviceName: "product_custom_translation_service_link",
    isLink: true,
    databaseConfig: {
      tableName: "product_transalations",
    },
    alias: [
      {
        name: "translations",
      },
    ],
    primaryKeys: ["id", "product_id", "translation_id"],
    relationships: [
      {
        serviceName: Modules.PRODUCT,
        primaryKey: "id",
        foreignKey: "product_id",
        alias: "product",
      },
      {
        serviceName: "custom_translation_service",
        primaryKey: "id",
        foreignKey: "translation_id",
        alias: "transalation",
        deleteCascade: true,
      },
    ],
    extends: [
      {
        serviceName: Modules.PRODUCT,
        relationship: {
          serviceName: "product_custom_translation_service_link",
          primaryKey: "product_id",
          foreignKey: "id",
          alias: "translations",
          isList: true,
        },
      },
      {
        serviceName: "custom_translation_service",
        relationship: {
          serviceName: "product_custom_translation_service_link",
          primaryKey: "product_id",
          foreignKey: "id",
          alias: "product_link",
        },
      },
    ],
  },
]); // custom links
```

Remote Link

```typescript
import { RemoteLink, Modules } from "@medusajs/modules-sdk";

// [...] initialize modules and links

const remoteLink = new RemoteLink();

// upsert the relationship
await remoteLink.create({ // one (object) or many (array)
  [Modules.PRODUCT]: {
    variant_id: "var_abc",
  },
  [Modules.INVENTORY]: {
    inventory_item_id: "iitem_abc",
  },
  data: { // optional additional fields
    required_quantity: 5
  }
});

// dismiss (doesn't cascade)
await remoteLink.dismiss({ // one (object) or many (array)
  [Modules.PRODUCT]: {
    variant_id: "var_abc",
  },
  [Modules.INVENTORY]: {
    inventory_item_id: "iitem_abc",
  },
});

// delete
await remoteLink.delete({
  // every key is a module
  [Modules.PRODUCT]: {
    // every key is a linkable field
    variant_id: "var_abc", // single or multiple values
  },
});

// restore
await remoteLink.restore({
  // every key is a module
  [Modules.PRODUCT]: {
    // every key is a linkable field
    variant_id: "var_abc", // single or multiple values
  },
});

```

Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com>
2023-08-30 14:31:32 +00:00
Sebastian Rindom
819d27e774 chore(tests): add integration test of canceling order with many items (#4776)
What

- Adds an integration test to check if canceling an order with many items succeeds.

Related to #4763
2023-08-25 09:00:47 +00:00
Carlos R. L. Rodrigues
c53fa6cd3b fix(utils,product): mikro orm connection loader (#4825)
Fix shared connection property check
2023-08-22 12:35:52 +00:00
Adrien de Peretti
ac866ebb51 test(): Test the create product workflow compensation (#4716)
**What**
Integration tests to validate the workflow compensation.
Also, fix the transaction state when the workflow is compensating and some steps does not have any compensation
2023-08-09 14:33:04 +00:00
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
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
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
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
Frane Polić
0c58ead6d8 fix(medusa): Validate customer_id when completing a cart (#3967) 2023-05-07 13:12:06 +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
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