Commit Graph

1021 Commits

Author SHA1 Message Date
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
Martin Repta
1b6d8b9f7a docs: Fix typos in productsCreated hook (#11276) 2025-02-12 18:37:34 +02: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
Kasper Fabricius Kristensen
47edd01dee fix(admin-vite-plugin,admin-bundler,ui,icons,dashboard,framework,types): Update Vite dependencies (#11414)
**What**
- Bumps the versions of Vite across the entire stack, to prevent an issue similar to what is described here: https://github.com/vitejs/vite/discussions/18271

Not entirely sure what was happening as I couldn't reproduce the issue, but Adrien faced the issue yesterday when working with local versions of our packages. It does appear as if the range we had before could lead to a version of Vite to be installed with said bug.
2025-02-12 10:09:39 +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
IgorKhomenko
1bf8766826 feat: added hook for createApiKeysWorkflow (#10909)
* added hook for createApiKeysWorkflow

* fix types

* fixed typings for createApiKeysWorkflow
2025-02-11 13:02:57 +01:00
olivermrbl
682dcf6507 chore: Version packages 2025-02-11 12:00:43 +01:00
Oli Juhl
db03738b5f chore: Revert version range to ^ (#11390) 2025-02-11 11:35:25 +01:00
Riqwan Thamir
cf788ec49e chore(types,framework): pick ssl types from tls lib (#11381)
* chore(types,framework): pick ssl types from tls lib

* chore: call from node:tls directly
2025-02-11 09:52:33 +01:00
Harminder Virk
244cd714b2 fix: add foreign keys to the generated query types output (#11388) 2025-02-11 14:16:10 +05:30
Frane Polić
17e9673769 fix(core-flows): variants update unsets prices (#11349)
* fix: update variant flow for prices

* fix: import add test

* fix: test name
2025-02-10 09:13:47 +01:00
Stevche Radevski
702d338284 fix: Minor fixes and cleanup to the payments setup (#11356)
This PR adds a couple new statuses to the payment collection and payment webhook results. The payment collection will now be marked as "completed" once the captured amount is the full amount of the payment collection.

There are several things left to improve the payment setup, so non-happy-path cases are handled correctly.
1. Currently the payment session and payment models serve a very similar purpose. Part of the information is found on one, and the other part on the other model, without any clear reason for doing so. We can simplify the payment module and the data models simply by merging the two.
2. We need to handle failures more gracefully, such as setting the payment session status to failed when such a webhook comes in.
3. We should convert the payment collection status and the different amounts to calculated fields from the payment session, captures, and refunds, as they can easily be a source of inconsistencies.
2025-02-09 15:42:02 +00:00
Kasper Fabricius Kristensen
acefcd7d80 fix(core-flows): Fix broken import of MedusaError (#11362) 2025-02-07 16:17:52 +00:00
Shahed Nasser
cb0f065c9d fix(utils): add static identifier to AbstractNotificationProviderService (#11344) 2025-02-07 17:30:08 +02:00
Shahed Nasser
d7342c6f82 chore(types): add TSDocs for retentionTime (#11345) 2025-02-06 15:22:32 +02:00
Adrien de Peretti
a33aebd895 feat(index): full sync operations (#11178)
Closes: FRMW-2892, FRMW-2893

**What**
Wired up the building block that we merged previously in order to manage data synchronization. The flow is as follow
- On application start
  - Build schema object representation from configuration
  - Check configuration changes
    - if new entities configured
      - Data synchronizer initialize orchestrator and start sync
        - for each entity
          - acquire lock
          - mark existing data as staled
          - sync all data by batch
          - marked them not staled anymore
          - acknowledge each processed batch and renew lock
          - update metadata with last synced cursor for entity X
          - release lock
      - remove all remaining staled data
    - if any entities removed from last configuration
      - remove the index data and relations

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2025-02-05 16:49:18 +00:00
Frane Polić
742babfe3f fix(core-flows): shipping profile update (#11322)
**What**
- prevent unsetting shipping profile on product update
2025-02-05 14:37:43 +00:00
Shahed Nasser
da25980d24 chore(core-flows): update the TSDocs of new steps (#11315) 2025-02-05 16:20:23 +02:00
Kasper Fabricius Kristensen
6db96c80d0 fix(ui,types): Add Metadata form for collection (#11300)
**What**
- Adds missing Metadata form for collections
- Fixes type of metadata in update payload
- Fixes an issue where deleting the last row of a metadata form would prevent adding new ones.

Resolves SUP-784
2025-02-05 12:53:30 +00:00
Shahed Nasser
4be327819f chore(types): add @version to new payment provider methods (#11316) 2025-02-05 12:51:08 +02:00
Shahed Nasser
9f1a3b2a42 fix(medusa, types): fix promotion HTTP types in cart (#11304) 2025-02-05 12:31:24 +02:00
Harminder Virk
3c51709daf feat: map container types for core services to interface (#11295) 2025-02-04 15:47:55 +05:30
Frane Polić
462c3e8057 feat(core-flows): cart complete shipping validate (#10984)
**What**
- validate that there is a shipping method if any of the line items have requires_shipping=true
- validate that products shipping profile is supported by a shipping method on the cart
- update tests

---

CLOSES CMRC-683
2025-02-04 10:10:08 +00:00
Kasper Fabricius Kristensen
f07af7b93c fix(dashboard,core-flows,types,medusa): Allow editing Order metadata (#11285)
Resolves SUP-780
2025-02-04 10:08:20 +00:00
Harminder Virk
016e332e9b feat: make AbstractModuleService create method type-safe (#11216) 2025-02-03 21:25:01 +05:30
Shahed Nasser
c366ae3b61 chore(framework): add example of admin's vite configurations (#11283) 2025-02-03 16:30:06 +02:00
Carlos R. L. Rodrigues
65fae943c9 feat(orchestration): hydrate resultset (#11263)
What:
* Add support for aggregating data into existing resultset.
* `query.graph` new option `initialData` containing the resultset to be hydrated
* It fetches data where the requested fields are not present and merge with the existing resultset
2025-02-03 11:24:57 +00:00
Shahed Nasser
18f7b71b1b chore(core-flows,types): update TSDocs following latest payment changes (#11241) 2025-01-31 11:39:10 +02:00
Jay Kanjia
356c877878 fix: complete cart workflow (#10780)
cart metadata not assigned to order metadata,
added metadata field in completeCartFields (core-workflow)
2025-01-31 08:18:48 +00:00
Carlos R. L. Rodrigues
e98d3c615e chore(orchestration): validate PK when throwIfKeyNotFound (#11190)
CLOSES: FRMW-2895
2025-01-29 19:17:36 +00:00
Stevche Radevski
614ff2907f fix: Add missing typings around creating a payment method (#11209) 2025-01-29 10:55:36 +01:00
Harminder Virk
c982117186 fix: always load .env file alongside the environment specific file (#11188) 2025-01-29 14:22:50 +05:30
Harminder Virk
716de2cb3a fix: exit process with a status code when build fails (#11206)
Fixes: FRMW-2897
CLOSES CLO-434

Still need the frontend Admin bundler to provide some way to know if the build has failed or not.
2025-01-29 08:34:47 +00:00
Oli Juhl
ae3292c98b chore(js-sdk): Remove create user method from SDK (#11186)
Endpoint doesn't exist. Admin users can only be created through invites at the HTTP level.
2025-01-28 12:11:58 +00:00
Riqwan Thamir
8af4fb0ba7 feat(medusa): add sku to variant query params (#11151)
what:

- adds sku to variant query params
2025-01-28 10:26:29 +00:00
Stevche Radevski
59cbc0ec77 feat: Add support for managing account holder in payment module (#11015) 2025-01-28 08:55:15 +01:00
Oli Juhl
961ad4723e fix(dashboard): Matching product profile with shipping profile (#11183) 2025-01-27 17:13:07 +00:00
Kasper Fabricius Kristensen
65d8d6dc0e fix(js-sdk,admin-bundler): Fix qs import (#11172) 2025-01-27 15:00:18 +00:00
Adrien de Peretti
ea402875a5 Feat/index sync data (#11169)
**what**
Synchronisation process  implementation for configured entity to be indexed
2025-01-27 13:56:12 +00:00
Frane Polić
864d772e34 feat(core-flows, dashboard, link-modules,medusa, types, utils): fulfillment shipping changes (#10902)
**What**
- product <> shipping profile link
- create and update product workflows/endpoints accepts shipping profile
- pass shipping option id when creating fulfillment to allow overriding customer selected SO
- validate shipping profile delete
- dashboard
  - set shipping profile on product create
  - manage shipping profile for a product
  - **update the create fulfillment form**
- other
  - fix create product form infinite rerenders
 
---

CLOSES CMRC-831 CMRC-834 CMRC-836 CMRC-837 CMRC-838 CMRC-857 TRI-761
2025-01-27 12:00:20 +00:00
Dano Alexander
956a50e934 Added currency symbol for Turkish lira (#11150) 2025-01-27 09:47:51 +01:00
olivermrbl
986ee8008e chore: Version packages 2025-01-27 09:35:06 +01:00
Frane Polić
d4cbc6218c feat(medusa,product,types): product type & tag store missing endpoints (#11057)
* wip: tag endpoints

* feat: types, product types

* feat: tests

* fix: update product type schema
2025-01-26 14:16:49 +01:00
Carlos R. L. Rodrigues
a76208ed02 chore(utils): patch unique index migration (#11136) 2025-01-24 13:48:37 -03:00
Roman Shuper
c1ae373967 product categories hooks (#11093)
* hooks

* workflow result fixed
2025-01-24 10:48:37 +01:00
Frane Polić
6e5912612c fix(core-flows, dashboard): handling fulfillment rules (#11111)
**What**
- fix storing "true" | "false" strings from admin
- use strings instead of booleans for context filtering
2025-01-23 16:32:25 +00:00
Harminder Virk
0deffe7b9b fix: switch from tsc watch to chokidar (#11110) 2025-01-23 19:12:07 +05:30
Adrien de Peretti
9321920227 fix: Medusa package version should use ~ instead of ^ (#11077)
RESOLVES FRMW-2859
2025-01-22 15:15:30 +00:00
Harminder Virk
e53b8b0a97 fix: Flaky behavior of Yalc (#11084) 2025-01-22 14:26:07 +05:30
Shahed Nasser
2d0e50624f fix(core-flows): change some types to interfaces (#11061) 2025-01-22 10:29:31 +02:00