Commit Graph

6761 Commits

Author SHA1 Message Date
Adrien de Peretti
e77a2ff032 fix(utils): Reversed module package missing references (#9589)
**What**
When resolving the modules through an array, if the module does not have a joiner config to rely on (not `queryable`, not using the `Module` util), then the key should be provided to register the module in the container. Eventually, the module author should provide that key to be used.

The only exception is for the medusa modules where we have a map that allows us to resolve that key automatically from the path of the resolve value
2024-10-15 15:28:45 +00:00
Adrien de Peretti
e9383f25e0 fix(utils): update medusa config resolution for consistency (#9591) 2024-10-15 11:52:06 -03:00
Riqwan Thamir
537567b679 chore: add compare_at_unit_price when price list price is retrieved (#9564)
* chore: add compare_at_unit_price when price list price is retrieved

* chore: add test for update item + more fixes along the way

* chore: fix tests

* chore: add refresh spec

* Apply suggestions from code review

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>

* chore: use undefined checker

* chore: switch to map

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2024-10-15 13:05:14 +02:00
Adrien de Peretti
827b32cffd chore: Remove Query Filter (#9403)
**What**
Cleanup old QueryFilter
2024-10-15 10:41:53 +00:00
Frane Polić
48cc00e991 feat(core-flows, product): options checks on product create/update (#9171)
**What**
- validate that variants are unique with respect to options on product update/create and variant update/create
- validate that the product has options upon creation
- ensure variants have the same number of option values as the product has options
- admin error handling
- update tests

---

FIXES FRMW-2707 CC-556
2024-10-15 09:06:51 +00:00
Riqwan Thamir
20d19c1d67 chore: update slack message (#9290) 2024-10-15 07:47:13 +00:00
Frane Polić
75475f7b28 fix(dashboard): reservation inventory details (#9535)
**What**
- display data in inventory details section of the reservation details page

---

FIXES CC-595
2024-10-14 17:59:52 +00:00
github-actions[bot]
f2d662efca chore(docs): Generated References (automated) (#9567)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2024-10-14 19:59:14 +02:00
Harminder Virk
f8e8b276bd fix: remove default value for the cluster flag (#9570)
Defining the default value applies the flag automatically and hence activates the cluster mode.
2024-10-14 16:54:13 +00:00
Frane Polić
809c851865 fix(core-flows, link-module): product <> inventory delete cascades (#9528)
**What**
- remove cascade delete of inventory items on product delete
- implement inventory deletion in product/variant delete workflows with checks:
  - product/variant cannot be deleted if there are reservations associated with their inventory items
  - inventory item will be cascade deleted if it's not used by other variants (that are not being deleted in the current flow)

---

FIXES CC-581 CC-582
2024-10-14 16:22:31 +00:00
Shahed Nasser
86f744cf3b fix(create-medusa-app): use db:migrate to run migrations (#9565) 2024-10-14 15:54:05 +00:00
Kasper Fabricius Kristensen
ebb16d6020 fix(dashboard): Translate breadcrumbs (#9561)
**What**
- Adds translated keys for all static breadcrumbs.
2024-10-14 14:42:59 +00:00
Harminder Virk
ad322f2760 breaking: remove deprecated commands and code (#9521)
* breaking: remove deprecated commands

* feat: remove deprecated code and usages

* refactor: remove more logic around default relations

* fix tests

* remove log

* fix: remove defaultFields usage

* fix: add back accidentally removed code

* refactor: implement feedback

* feat: add --cluster flag to the start command

* refactor: assign limit to defaultLimit property

* fix: breaking code because of removed check

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
2024-10-14 20:11:34 +05:30
Adrien de Peretti
cea4cdc8d7 fix: Link migration descriptor case changes and hash computation (#9560)
**What**
The module service name case has changed and the hash generation was performed on the non lower cased version of it while after the hash generation everything is based on the lower case version of the generated table name form the service names leading to different hash computation. This pr update the link migration table to adjust the to/from module value with its new value as well as generating the hash from the lower case version of the computed table name

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-10-14 14:32:50 +00:00
Kasper Fabricius Kristensen
170b3a08b7 fix(dashboard): Prevent category names from overflowing in organize section (#9562)
**What**
- Prevents the name of parent and children categories from overflowing in the Organize section.

Resolves CC-586
2024-10-14 14:24:22 +00:00
Kasper Fabricius Kristensen
56135b9750 fix(dashboard): Change icon of Shipping Profiles card (#9563)
Resolves CC-156
2024-10-14 14:23:07 +00:00
Adrien de Peretti
d8b7f90689 chore(product): Update the events emitted from the product module (#9557) 2024-10-14 09:19:32 -03:00
github-actions[bot]
b40fa6353e chore(docs): Updated API Reference (v2) (#9552)
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2024-10-14 11:00:04 +00:00
Oli Juhl
43324b9294 fix: Add shipping method data validation (#9542)
* fix: Add shipping method data validation

* fix: return type
2024-10-14 12:55:01 +02:00
Shahed Nasser
6829d3b162 chore(framework): update TSDocs for medusa config (#9559)
* chore(framework): update TSDocs for medusa config

* update modules tsdocs
2024-10-14 13:45:50 +03:00
Shahed Nasser
b6df24463d docs: updates for breaking changes (#9558)
- Update modules registration
- Update `medusa-config.js` to `medusa-config.ts`
- Update the out directory in the admin deployment guide
- Update logger imports
- Other fixes

Note: will need to re-generate references afterwards

Closes #9548
2024-10-14 10:40:30 +00:00
Kasper Fabricius Kristensen
2a9fc0e514 fix(dashboard): Show progress on tabs in create form (#9553)
**What**
- Shows progress on tabs in create promotion form. This is a bit of a band-aid fix, the promotion form and domain needs some proper cleanup, but this will work for now.
- Adds missing translation of "Method" field.

Resolves CC-113
2024-10-14 10:36:31 +00:00
github-actions[bot]
224e530453 chore(docs): Generated References (#9551)
Generated the following references:
- `api_key`
- `auth`
- `cart`
- `core_flows`
- `currency`
- `customer`
- `fulfillment`
- `inventory_next`
- `modules`
- `modules_sdk`
- `order`
- `order_models`
- `payment`
- `payment_provider`
- `pricing`
- `product`
- `promotion`
- `region`
- `sales_channel`
- `search`
- `stock_location_next`
- `store`
- `tax`
- `types`
- `user`
- `utils`
- `workflows`

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-10-14 10:33:21 +00:00
Kasper Fabricius Kristensen
089d4af301 fix(dashboard): Hide note input on orders (#9555)
**What**
- Hides the input for notes on the order details page.
- Should be re-added once we have support, so I have just commented out the component.
2024-10-14 10:10:33 +00:00
Kasper Fabricius Kristensen
3edb5d3470 fix(dashboard): Show SO name in DataGrid (#9554)
**What**
- Adds a Readonly cell with the SO name in the pricing DataGrid.

Resolves CC-555
2024-10-14 10:05:21 +00:00
Adrien de Peretti
5a60a2a329 fix(utils): Cascade soft deletion management (#9534)
* fix(utils): Cascade sOCoft deletion management

* fix(utils): Cascade sOCoft deletion management
2024-10-14 11:35:38 +02:00
Kasper Fabricius Kristensen
1b82f7a814 fix(dashboard): Adds routes for handling tax overrides for provinces (#9549) 2024-10-14 11:34:15 +02:00
Shahed Nasser
11120a8b7e docs: improve commerce modules [3/n] (#9510)
Improve and add docs for Order and Payment modules

[3/n]

Closes DOCS-966
Closes #9485
2024-10-14 07:20:35 +00:00
Shahed Nasser
74b286b701 docs: added documentation for admin components (#9491)
- Documented common admin components with design that matches the admin.
- Updated existing admin customization snippets to match the admin's design.

Closes DOCS-964
2024-10-14 07:18:38 +00:00
Shahed Nasser
e3dc9eaf0c docs: add guide on how to seed data (#9449)
Add a guide on how to seed data using a custom CLI script, with an example to seed products

Closes DOCS-953
2024-10-14 07:08:05 +00:00
Shahed Nasser
c9ce918982 docs: small structure fixed to db command reference (#9446) 2024-10-14 08:58:39 +02:00
Kasper Fabricius Kristensen
1f682daf5c fix(dashboard,ui): Fixes to Combobox and CategoryCombobox (#9537)
**What**
- Fixes the Combobox to keep the width of the content constant.
- Brings CategoryCombobox inline with the other Combobox component
- Adds keyboard navigation to the CategoryCombobox: You can now navigate options using ArrowUp and ArrowDown, and if an option has children you can use ArrowRight to see the children options.
- Add "outline-none" to the Drawer component to stop it from flashing whenever focus is dropped.
- Removes a dependency that was added to the UI package by mistake

Resolves CC-155
2024-10-12 14:46:32 +00:00
Harminder Virk
93b38bf47b fix: do not pass additional_data to service (#9532)
Fixes: FRMW-2743

This PR extracts and removes the `additional_data` from the workflow input before calling the steps and hence the `additional_data` is not passed down to the service layer.

However, this bug has made me discover one inconsistency in the input structure of certain workflows.

 **Following is the input structure of the `updateProductsWorkflow`**. Here, we accept the `products` and the `additional_data` as two separate top-level properties.

```ts
// Shape
export type UpdateProductsWorkflowInputSelector = {
  selector: ProductTypes.FilterableProductProps
  update: Omit<ProductTypes.UpdateProductDTO, "variants"> & {
    sales_channels?: { id: string }[]
    variants?: UpdateProductVariantWorkflowInputDTO[]
  }
} & AdditionalData

// Calling the workflow
const { result } = await updateProductsWorkflow(req.scope).run({
  input: {
    selector: { id: req.params.id },
    update,
    additional_data,
  },
})
```

 **Following in the input structure of the `updateCartWorflow`**. In this case, we are accepting the cart properties at the top-level, hence the `additional_data` is merged within those properties, increasing the chance of passing it down to the service layer by mistake.

```ts
// Shape
WorkflowData<UpdateCartWorkflowInputDTO & AdditionalData>

// Calling the workflow
await workflow.run({
  input: {
    ...req.validatedBody // Additional data is part of the validatedBody,
    id: req.params.id,
  },
})
```

Ideally, the input of `updateCartWorkflow` should look as follows.

```ts
WorkflowData<{ cart: UpdateCartWorkflowInputDTO } & AdditionalData>
```
2024-10-11 23:43:13 +00:00
Carlos R. L. Rodrigues
c8b375ae2d feat(locking): Locking module (#9524)
**What**
- Locking Module to manage concurrency
- Default `in-memory` provider
2024-10-11 16:30:06 +00:00
Adrien de Peretti
5c9e289c4d fix(utils): build query conversion breaking the underlying API operator map (#9533) 2024-10-11 18:03:58 +02:00
Shahed Nasser
69b9e73be7 docs: improve commerce modules [1/n] (#9498)
Improve and add docs for API Key, Auth, and Cart Modules

[1/n]
2024-10-11 15:19:13 +00:00
Shahed Nasser
dd162d69be docs-util: fix import in generated workflow hook snippet (#9499) 2024-10-11 17:17:02 +02:00
Adrien de Peretti
1d8939df3a chore(): Allow to register modules through array (#9522) 2024-10-11 15:17:00 +02:00
Adrien de Peretti
9c73503084 chore: swc/jest source maps config to inline instead of true (#9531) 2024-10-11 09:40:51 +02:00
Kasper Fabricius Kristensen
ccd40e6548 feat(dashboard): Add global search (#9504)
**What**
- Adds the ability to do global searches from cmd + k in the admin.
- The solution is temporary, until we have a proper search API.

**Note**
I have deviated a bit from the design, due to the constraints of this temporary solution:
- We don't have nested items, such as showing variants under a product (don't think having a proper search API will make this any easier, and not entirely sure how we would handle this for cases where a query returns multiple products, which is the only case that is designed)
- I have added a "Load {{count}} more" button instead of doing infinite scrolling, I am assuming the later is the intended behaviour based on the design file, but with 20+ sources of data changing so often it was resulting in some weird behaviours, so settled for the simpler approach for this temporary solution.
- Removed the "Details" label on search results as it seemed a bit repetitive
- I haven't added icons for the different types of search results, as there are only a couple of examples in the design doc, and I wasn't sure what to pick for all the different types of results. If we want to add icons, then I think it's something we can add when we revisit this later, but think its fine to omit, as each group of results is labeled, so they are easy to tell apart.

Resolves CC-574
2024-10-11 07:38:05 +00:00
Shahed Nasser
49a91fd40e docs: redesigned navigation (#9525)
Redesign navigation bar to reflect new design and allow for dropdowns

Closes DX-943
2024-10-11 07:10:00 +00:00
Adrien de Peretti
7c5415ba3a fix(workflows-sdk):transaction id inheritence (#9507) 2024-10-10 17:08:42 +02:00
Zaid Rashid
0058338d40 docs: Fix link to the correct AuthIdentity model's page (#9519)
I think there is a bug on the link to the `AuthIdentity ` model's page. The page containing the issue can be found [here](https://docs.medusajs.com/v2/resources/commerce-modules/auth/auth-identity-and-actor-types#what-is-an-auth-identity)
2024-10-10 14:41:19 +00:00
J Kendal
0dd3d9b1c4 fix: js-sdk compilation error (#9523) 2024-10-10 13:48:47 +02:00
Shahed Nasser
bf60983b51 fix(types): fix parameter types for the order module's service (#9513)
Use correct type for the `createOrderLineItemAdjustments` method. The module uses the correct type, only the service has the incorrect one.
2024-10-10 07:20:36 +00:00
Adrien de Peretti
34d57870ad chore: workflow internals improvementss (#9455) 2024-10-10 09:11:56 +02:00
Frane Polić
1b9379be62 fix(core-flows, dashboard): inventory kit reservations (#9502)
**What**
- fix `prepareConfirmInventory` to account for inventory kit items
  - _note: this step is reused in the complete cart and all RMA flows_ 
- properly remove reservations for items that are removed from the order edit
- invalidate inventory/reservations cache when order edit is confirmed

---

https://github.com/user-attachments/assets/f12e9198-0718-4c08-bd81-efc536eca146

---

FIXES CC-565
2024-10-09 17:54:35 +00:00
Shahed Nasser
7f1f075222 docs: improvements and fixes to components in API reference (#9410)
- Change layout of parameters for clearer display
- Fix schema code blocks being longer than container
- switch between showing required to showing optional indicator
- Fixed code tabs not having copy / report buttons

Closes DOCS-936

Preview: https://api-reference-v2-git-docs-api-ref-comp-improv-medusajs.vercel.app/v2/api/store
2024-10-09 17:51:27 +00:00
Harminder Virk
8d3e7b3336 fix: provide outDir to typescript compiler (#9518) 2024-10-09 17:43:24 +00:00
Harminder Virk
1560d7ed5f breaking: Standalone builds (#9496)
Fixes: FRMW-2742

In this PR, we fix the build output of the backend source code, which eliminates a lot of magic between the development and production environments.

Right now, we only compile the source files from the `src` directory and write them within the `dist` directory.

**Here's how the `src` directory with a custom module looks like**

```
src
├── modules
│   └── hello
│       ├── index.ts
```

**Here's the build output**

```
dist
├── modules
│   └── hello
│       ├── index.js
```

Let's imagine a file at the root of your project (maybe the `medusa-config.js` file) that wants to import the `modules/hello/index` file. How can we ensure that the import will work in both the development and production environments?

If we write the import targeting the `src` directory, it will break in production because it should target the `dist` directory.

## Solution
The solution is to compile everything within the project and mimic the file structure in the build output, not just the `src` directory.

**Here's how the fixed output should look like**

```
dist
├── src
│  ├── modules
│  │   └── hello
│  │       ├── index.js
├── medusa-config.js
├── yarn.lock
├── package.json
```

If you notice carefully, we also have `medusa-config.js`, `yarn.lock`, and `package.json` within the `dist` directory. We do so to create a standalone built application, something you can copy/paste to your server and run without relying on the original source code.

- This results in small containers since you are not copying unnecessary files.
- Clear distinction between the development and the production code. If you want to run the production server, then `cd` into the `dist` directory and run it from there.

## Changes in the PR

- Breaking: Remove the `dist` and `build` folders. Instead, write them production artefacts within the `.medusa` directory as `.medusa/admin` and `.medusa/server`.
- Breaking: Change the output of the `.medusa/server` folder to mimic the root project structure.
- Refactor: Remove `Symbol.for("ts-node.register.instance")]` check to find from where to load the source code.
- Refactor: Use `tsc` for creating the production build. This ensures we respect `tsconfig` settings when creating the build and also perform type-checking.

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-10-09 15:59:08 +00:00