Commit Graph

1252 Commits

Author SHA1 Message Date
Harminder Virk
84f58f9058 feat: implement direct upload (#12328)
* feat: implement direct upload

* feat: add direct-upload endpoint

* refactor: implement feedback

* refactor: have a dedicated endpoint for direct uploads

* refactor: convert responses to snakecase

* refactor: rename method to createImport

* test: add tests for the presigned-urls endpoint
2025-05-04 12:58:10 +02:00
Carlos R. L. Rodrigues
b868a4ef4d feat(index): add filterable fields to link definition (#11898)
* feat(index): add filterable fields to link definition

* rm comment

* break recursion

* validate read only links

* validate filterable

* gql schema array

* link parents

* isInverse

* push id when not present

* Fix ciruclar relationships and add tests to ensure proper behaviour (part 1)

* log and fallback to entity.alias

* cleanup and fixes

* cleanup and fixes

* cleanup and fixes

* fix get attributes

* gql type

* unit test

* array inference

* rm only

* package.json

* pacvkage.json

* fix link retrieval on duplicated entity type and aliases + tests

* link parents as array

* Match only parent entity

* rm comment

* remove hard coded schema

* extend types

* unit test

* test

* types

* pagination type

* type

* fix integration tests

* Improve performance of in selection

* use @@ to filter property

* escape jsonPath

* add Event Bus by default

* changeset

* rm postgres analyze

* estimate count

* new query

* parent aliases

* inner query w/ filter and sort relations

* address comments

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-04-29 12:10:31 +02:00
Harminder Virk
552dc52228 test: use shared as integration-tests level (#12278) 2025-04-28 18:41:19 +05:30
Frane Polić
d7a273ff2d fix(core-flows): handle inventory kit items in mark-as-shipped/delivered flows (#12269)
* fix(core-flows): handle invetory kit items in mark-as-shipped and mark-as-delivered flows

* fix: typo

* chore: more assertion

* chore: fix comment

* Update packages/core/core-flows/src/order/workflows/create-shipment.ts

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

* fix: undo comment

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-04-26 19:38:00 +02:00
Riqwan Thamir
db9483140a fix(medusa): Fix store return API (#12284)
what:

- fixes the middleware to point to the right API route
- adds a test to store return API
2025-04-24 13:25:22 +00:00
olivermrbl
2fec5f4aa0 chore: Version packages 2025-04-23 09:27:02 +02:00
Frane Polić
ad74ba2ca4 fix(core-flows, link-modules): return fulfillment creation (#12227)
* fix: return fulfillment creation

* chore: changeset

* fix: link

* fix: cancel claim flow

* chore: test fulfillment creation as a part of return lifecycle test

* fix: exchanges cancle flow

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-04-22 14:33:46 +02:00
Adrien de Peretti
49c526399e fix(medusa): sales_channel_id middleware manipulation (#12234)
* fix(medusa): sales_channel_id middleware manipulation leading to lost of the sc

* fix(medusa): sales_channel_id middleware manipulation leading to lost of the sc

* add unit tests

* add unit tests

* improve

* integration tests
2025-04-20 17:42:59 +02:00
Frane Polić
01542f6973 feat(core-flows, js-sdk, medusa): draft order shipping removal (#12124)
**What**
- allow removal of a shipping method

---

CLOSES CMRC-1013
2025-04-16 06:10:24 +00:00
Adrien de Peretti
2f6963a5fb fix(): Event group id propagation and event managements (#12157) 2025-04-14 15:57:52 -03:00
Frane Polić
413a0da26c fix(core-flows): draft order reservations (#12115)
* fix: draft order reservations

* feat: add test case

* fix: assert item ids
2025-04-13 17:40:16 +02:00
olivermrbl
d61694385d chore: Version packages 2025-04-11 10:25:36 +02:00
Carlos R. L. Rodrigues
31abba8cde fix(orchestrator): save checkpoint before async step (#12138) 2025-04-10 15:36:36 +00:00
Pedro Guzman
8804ca2f9c fix: allow backorder variants to be added to cart even if no locations (#12083)
* fix: allow backorder variants to be added to cart even if no locations

* document and unit test prepareConfirmInventoryInput
2025-04-09 19:15:42 +02:00
Carlos R. L. Rodrigues
f615ebb7e8 chore: retry util on tests (#12126) 2025-04-09 16:07:05 +00:00
Adrien de Peretti
13e159d8ad fix(workflow-engine-*): Prevent passing shared context reference (#11873)
* fix(workflow-engine-*): Prevent passing shared context reference

* fix(workflow-engine-*): Prevent passing shared context reference

* prevent tests from hanging

* fix event handling

* add integration tests

* use interval for scheduled in tests

* skip tests for now

* Create silent-glasses-enjoy.md

* fix cancel

* changeset

* push multiple aliases

* test multiple field alias

* increase wait time to index on test

---------

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>
2025-04-09 10:39:29 +02:00
Frane Polić
a8513019db fix(core-flows,dashboard): handling authorized payment collection on OE (#11958)
* wip: handling authorized payment collection on OE

* fix: update condition

* fix: condition for creation

* chore: remove commented code

* chore: changeset, refactor

* chore: typo, comments

* fix: add a test case

* fix: reorg workflows, partially captured

* fix: status enum type
2025-04-02 13:57:44 +02:00
Harminder Virk
d3e725a907 feat: add hasMany flag to enforce in app link uniqueness (#12039)
* feat: add createMultiple flag to enforce inApp link uniqueness

* changes

* mocks

* default

* many to many

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
2025-04-02 10:46:51 +02:00
Kasper Fabricius Kristensen
f441362f4a feat(medusa,core-flows,types,js-sdk): Draft Order workflows and API endpoints (#11805) 2025-04-02 10:23:33 +02:00
Harminder Virk
b1b3b48474 feat: Set pricing context hook (#11891) 2025-03-28 15:17:52 +05:30
Riqwan Thamir
1f8fab3636 feat(core-flows,types,order,cart): assign tax lines only to regular products (#11994)
what:

- assign tax lines only to regular products
2025-03-26 22:26:34 +00:00
Frane Polić
de8c034d1b feat(core-flows, types): calculated shipping in RMA flows (#11533)
* wip: calculated SO pricing in RMA flows

* fix: types

* chore: small refactor

* feat: caluclated shipping in return flow

* fix: module integrations

* fix: array containing

* feat: refresh shipping on update item quantity

* rm: log

* rm: log2

* feat: update interface, remove flag

* fix: revert change on OE for now

* fix: import

* feat: refactor flwos, cleanup cacluation cotext data model, wip exchanges

* feat: refreshing inbound/outbound shipping on items change

* feat: refresh exchange shipping on return item add, test

* feat: refresh shipping on exchange/return item remove

* fix: check optional

* feat: test recalculation on quantity update

* feat: calculated shipping on claims

* fix: comment

* wip: address comments

* fix: more remote query, fix build

* refactor: claim refresh workflow

* fix: remove throw option

* fix: deconstruct param

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-03-24 07:07:47 +01:00
Frane Polić
8385a5e34d feat(core-flows): revisit fulfillment flow reservations and support inventory kit (#11790)
* feat: fulfillment flow with reservations and inventory kit

* fix: account for custom line items

* chore: cleanup, changeset

* fix: revert action check

* fix: deduplicate, test item qunatities, compute line item quantity from fulfillment items

* fix:

* fix: improve types

* fix: optimize fetched fileds in cancel fulfillment workflow

* fix: add a test case

* chore: update type
2025-03-19 13:15:24 +01:00
Riqwan Thamir
9dd62d93bd feat(core-flows,types,utils): make payment optional when cart balance is 0 (#11872)
what:

- make payment optional when cart balance is 0
2025-03-17 19:03:22 +00:00
Riqwan Thamir
cb6249320e fix(types,order,medusa): Create credit lines + hooks (#11569)
what:

- api/workflows to create credit lines
- hooks to enable extending credit lines
2025-03-17 15:20:59 +00:00
Harminder Virk
cae47d9e49 feat: add check for uniqueness when creating links with isList=false (#11767) 2025-03-17 13:23:18 +05:30
Adrien de Peretti
72d2cf9207 fix(workflow-engines): race condition when retry interval is used (#11771) 2025-03-12 09:53:34 -03:00
Frane Polić
70eaaa9196 fix(core-flows): fulfillment reservation check (#11735) 2025-03-09 13:47:10 +01:00
Riqwan Thamir
f00bb8efcf fix(core-flows): conditionally create, update or delete products when input is present (#11758)
what:

- runs create / update /delete workflows for bulk workflow conditionally

FIXES https://github.com/medusajs/medusa/issues/11749
depends on https://github.com/medusajs/medusa/pull/11756
2025-03-06 13:41:20 +00:00
olivermrbl
5d74ac3cc3 chore: Version packages 2025-03-04 14:11:37 +01:00
Riqwan Thamir
51b0af193c fix(types,medusa): calculate taxes for original price (#11692) 2025-03-03 14:20:48 +01:00
Riqwan Thamir
38beeb157e fix(core-flows): support 0 as a valid unit price for custom line items (#11631) 2025-02-26 19:32:35 +01:00
Oli Juhl
54a6ef91ac chore: Move token from params to headers (#11281)
* chore: Move token from params to body

* chore: Add type

* wip

* chore: clean up

* clean ip
2025-02-26 17:41:16 +01:00
Carlos R. L. Rodrigues
fa1793e8e9 chore(core-utils): avoid overfetching to refresh cart (#11602)
What:
 * Not all Cart operations need a full refresh updating items. This PR introduces a flag to force the refresh for special ocasions, like updating the Cart's region, or transfering the Cart to another customer. For all other flows it will update only promotions, taxes and payment collection if needed.
2025-02-26 10:00:04 +00:00
Adrien de Peretti
eeebb35758 chore(product): revamp upsertWithReplace and Remove its usage from product creation (#11585)
**What**
- Move create product to use native create by structuring the data appropriately, it means no more `upsertWithReplace` being very poorly performant and got 20x better performances on staging
- Improvements in `upsertWithReplace` to still get performance boost for places that still relies on it. Mostly bulking the operations when possible

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-02-26 09:53:13 +00:00
Carlos R. L. Rodrigues
03731c7660 chore(core-flows): reserve inventory from available location (#11538) 2025-02-26 06:10:41 -03:00
Riqwan Thamir
fb2e86484a feat(core-flows,types,cart): add credit lines to cart (#11419)
* feat(core-flows,types,cart): add credit lines to cart

* chore: fix specs

* chore: credit lines hook

* chore: update types

* chore: added credit line totals

* chore: add totals fields to query config

* chore: add complete cart hook

* chore: add credit lines creation to order

* chore: pr ready for review

* chore: fix tests

* Apply suggestions from code review

* chore: fix types

* chore: adjust summary calculations with new totals
2025-02-24 14:34:36 +01:00
Kasper Fabricius Kristensen
efd66c0d59 fix(core-flows): Allow adding shipping methods through order edits (#11504)
* fix(core-flows): Allow adding shipping methods through order edits

* fix(core-flows): Allow adding shipping methods through order edits

* update test description

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-02-23 16:06:54 +01:00
Carlos R. L. Rodrigues
0c957350a6 fix(order): calculate taxes on order edit flows (#11518)
* fix(order): calcualte taxes on order edit flows

* merge summary

* tests

* fix pending difference

* comments

* claim test

* revert method
2025-02-21 15:27:40 +01:00
Adrien de Peretti
065df75e7d fix(): handle empty q filters - allow to query deleted records from graph API - staled_at fixes (#11544)
* fix(): Allow to query deleted records from graph API

* fix(): Allow to query deleted records from graph API

* handle empty q value

* update staled at sync

* rename integration tests file

* Create strong-houses-marry.md

* try to fix flacky tests

* fix pricing context

* update changeset

* update changeset

* fix import

* skip test for now

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-02-21 13:24:12 +01:00
Kasper Fabricius Kristensen
3b4997840e fix(medusa,js-sdk,types): Add basic draft order operations to js-sdk (#11514)
**What**
- Exposes `sdk.admin.draftOrder.create/update/retrieve/list` functions from the js-sdk
- Implements the necessary types in the types package.
- Adds missing endpoints to admin API.
2025-02-20 16:05:21 +00:00
Frane Polić
0c530e90c5 feat(core-flows, types): add has missing inventory flag when listing shipping options (#11493)
**What**
- add `insufficient_inventory` flag when listing shipping options for a cart
- add `enabled_in_store` flag when creating/editing pickup options
2025-02-19 08:08:25 +00:00
Adrien de Peretti
448dbcb596 feat(medusa): Rollout index engine behind feature flag (#11431)
**What**
- Add index engine feature flag
- apply it to the `store/products` end point as well as `admin/products`
- Query builder various fixes
- search capabilities on full data of every entities. The `q` search will be applied to all involved joined table for selection/where clauses

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-02-18 13:49:57 +00:00
Frane Polić
ee848bf0f4 feat(core-flows, dashboard, medusa, types): optional shipping profile (#11434)
* feat: create product flow changes

* feat: allow unsetting SP on product update

* feat: update prepare line item helper

* test: add testcase

* wip: fix tests

* fix: update module tests

* fix: cart module test
2025-02-17 19:08:59 +01:00
Adrien de Peretti
63f0774569 feat(): Backport metadata management (#11469)
FIXES FRMW-2915

**What**
Backport metadata management. all the metadata get preserved unless a specific empty string is provided for the key which in turn would remove that key from the metadata
2025-02-17 09:14:53 +00:00
Kasper Fabricius Kristensen
825b8ad260 fix(medusa): Allow filtering by handle and title as arrays (#11472)
**What**
- Allows filtering products in the Store API with an array value for both `handle` and `title`.

RESOLVES SUP-893
2025-02-14 14:10:32 +00:00
Frane Polić
bbef0da5dd fix(core-flows, types): reservation of shared inventory item (#11403)
**What**
- if a cart contains variants that share inventory items, reservation of the item would fail also causing complete cart to fail
- include `completed_at` when compensating cart update
- account for multiple reservations of the same item when creating the locking key

---

CLOSES SUP-587
2025-02-13 08:03:53 +00:00
Carlos R. L. Rodrigues
22276648ad feat: query.index (#11348)
What:
 - `query.index` helper. It queries the index module, and aggregate the rest of requested fields/relations if needed like `query.graph`.
 
Not covered in this PR:
 - Hydrate only sub entities returned by the query. Example: 1 out of 5 variants have returned, it should only hydrate the data of the single entity, currently it will merge all the variants of the product.
 - Generate types of indexed data
 
 example:
 ```ts
 const query = container.resolve(ContainerRegistrationKeys.QUERY)
        
 await query.index({
  entity: "product",
  fields: [
    "id",
    "description",
    "status",
    "variants.sku",
    "variants.barcode",
    "variants.material",
    "variants.options.value",
    "variants.prices.amount",
    "variants.prices.currency_code",
    "variants.inventory_items.inventory.sku",
    "variants.inventory_items.inventory.description",
  ],
  filters: {
    "variants.sku": { $like: "%-1" },
    "variants.prices.amount": { $gt: 30 },
  },
  pagination: {
    order: {
      "variants.prices.amount": "DESC",
    },
  },
})
```
This query return all products where at least one variant has the title ending in `-1` and at least one price bigger than `30`.
 
The Index Module only hold the data used to paginate and filter, and the returned object is:
```json
{
  "id": "prod_01JKEAM2GJZ14K64R0DHK0JE72",
  "title": null,
  "variants": [
    {
      "id": "variant_01JKEAM2HC89GWS95F6GF9C6YA",
      "sku": "extra-variant-1",
      "prices": [
        {
          "id": "price_01JKEAM2JADEWWX72F8QDP6QXT",
          "amount": 80,
          "currency_code": "USD"
        }
      ]
    }
  ]
}
```

All the rest of the fields will be hydrated from their respective modules, and the final result will be:

```json
{
  "id": "prod_01JKEAY2RJTF8TW9A23KTGY1GD",
  "description": "extra description",
  "status": "draft",
  "variants": [
    {
      "sku": "extra-variant-1",
      "barcode": null,
      "material": null,
      "id": "variant_01JKEAY2S945CRZ6X4QZJ7GVBJ",
      "options": [
        {
          "value": "Red"
        }
      ],
      "prices": [
        {
          "amount": 20,
          "currency_code": "CAD",
          "id": "price_01JKEAY2T2EEYSWZHPGG11B7W7"
        },
        {
          "amount": 80,
          "currency_code": "USD",
          "id": "price_01JKEAY2T2NJK2E5468RK84CAR"
        }
      ],
      "inventory_items": [
        {
          "variant_id": "variant_01JKEAY2S945CRZ6X4QZJ7GVBJ",
          "inventory_item_id": "iitem_01JKEAY2SNY2AWEHPZN0DDXVW6",
          "inventory": {
            "sku": "extra-variant-1",
            "description": "extra variant 1",
            "id": "iitem_01JKEAY2SNY2AWEHPZN0DDXVW6"
          }
        }
      ]
    }
  ]
}
```

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2025-02-12 12:55:09 +00:00
Carlos R. L. Rodrigues
d6c03ee542 fix(utils): custom linkable keys (#11400)
**What**
Fix linkable generation when there is no dml models and models are provided as virtual to the joiner config and therefore the linkable are inferred
2025-02-11 16:59:21 +00:00
olivermrbl
682dcf6507 chore: Version packages 2025-02-11 12:00:43 +01:00