Commit Graph

265 Commits

Author SHA1 Message Date
olivermrbl
2fbebb60e3 chore: Release 2024-10-22 20:43:47 +02:00
Adrien de Peretti
29d9f90fbf Feat/validate query enhancement (#9705)
* feat(framework): Enhance query validation

* feat(framework): Enhance query validation

* feat(framework): Enhance query validation

* feat(framework): Enhance query validation

* fix

* split restriction per http domain

* fix

* fix unit tests

* fix middleware

* cleanup allowed fields

* update docs

* missing allowed

* export

* missing allowed

* missing fields

* improvements

* rm unnecessary fields

* wip

* update symbol support

* update symbol support

* update allowed

* update allowed
2024-10-22 16:47:05 +02:00
Carlos R. L. Rodrigues
d8e3e04895 feat(core-flows): order events (#9702) 2024-10-21 15:26:44 -03:00
Adrien de Peretti
45df24f707 fix(product): Category repository missing ontext (#9688)
**What**
- Fix product category repository missing context passed to down level methods
- Ensure the base repository when getting the active manager returns a fresh one if possible instead of the global one in order to prevent shared entity map by mistake
2024-10-21 11:42:17 +00:00
Shahed Nasser
30659b077a chore(utils): update tsdocs for provider identifiers (#9656) 2024-10-18 17:32:15 +03:00
Adrien de Peretti
876d8072e7 chore: Update modules providers configuration with 'identifier' and 'PROVIDER' (#9636)
* chore: Update modules providers configuration with 'identifier' and 'PROVIDER'

* update check

* fix tests

* type

* normalize auth provider

* emailpass

* providers

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-10-18 09:24:15 +02:00
Carlos R. L. Rodrigues
902ac12f73 chore: remove internal module resources option (#9582)
What:
* removes resouces type "shared" or "isolated" from internal modules.
* modules can have an isolated database connection by providing a database config as part of their options on `medusa-config`

CLOSES: FRMW-2593
2024-10-17 21:31:46 +00:00
Carlos R. L. Rodrigues
f7fbc2f97c feat(core-flows): cart events (#9585) 2024-10-16 14:27:24 -03:00
Harminder Virk
68560787e5 breaking: rename package names to be consistent and under @medusajs scope (#9580) 2024-10-16 22:28:09 +05:30
Adrien de Peretti
cc1a25abb2 fix(utils): Mikro orm joined selection issue when select-in strategy (#9615)
* fix(utils): Mikro orm joined selection issue when select-in strategy

* fix types

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-10-16 17:43:18 +02:00
Adrien de Peretti
84fa6ccde5 chore: Update admin build/serve configuration (#9584)
**Breaking changes**

The `outDir` has been deprecated and wont be used anymore, instead all the path are computed internally following these rules
- if admin is not `disabled` and the `build` command is run without the `--admin-only` flag, then the admin output dir will be `.medusa/server/public/admin` and it will be served from that same location from the medusa instance.
- if admin is not `disabled` and the `build` command is run with the `--admin-only` flag, then the admin output dir will be `.medusa/admin` with the purpose of deploying the admin separately. ⚠️ (expect to receive a warning log)
- if the admin is `disabled` and the `build` command is run with the `--admin-only` flag, then fallback to rule number 2

| admin enabled  | medusa build --admin-only  | output dir |
|---|---|---|
| true  | true  | `.medusa/admin` ⚠️ (expect to receive a warning log) |
| true  | false  | `.medusa/server/public/admin`  |
| false  | true  | `.medusa/admin`  |
| false  | false  | none |

```diff
// medusa-config.ts

{
  // ...
  admin: {
-    outDir: 'some/path'
  }
}
```


cc @kasperkristensen @sradevski @olivermrbl
2024-10-15 15:59:47 +00:00
Carlos R. L. Rodrigues
4a03bdbb86 feat(providers): locking redis (#9544) 2024-10-15 12:40:24 -03:00
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
Adrien de Peretti
827b32cffd chore: Remove Query Filter (#9403)
**What**
Cleanup old QueryFilter
2024-10-15 10:41:53 +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
Adrien de Peretti
d8b7f90689 chore(product): Update the events emitted from the product module (#9557) 2024-10-14 09:19:32 -03: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
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
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
Adrien de Peretti
1d8939df3a chore(): Allow to register modules through array (#9522) 2024-10-11 15:17:00 +02:00
Adrien de Peretti
34d57870ad chore: workflow internals improvementss (#9455) 2024-10-10 09:11:56 +02: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
Carlos R. L. Rodrigues
8fbef8a667 fix(order): searchable fields (#9493)
FIXES: TRI-353
2024-10-07 17:45:20 +00:00
Harminder Virk
2d8ce6fd5b refactor: convert modules enum to a const (#9486) 2024-10-07 14:42:59 +05:30
Riqwan Thamir
2d1f4bcabc feat(dashboard,core-flows,types,order): change order accepts price updates (#9476)
* chore: change order can accept price updates

* chore: add changes to transformed order

* chore: fix transform

* chore: transform raw unit price
2024-10-07 10:54:21 +02:00
Adrien de Peretti
ffc35f2b6e fix: Remove extra saving on serialization which breaks the chain (#9465)
**What**
The extra serialization check hapen to break the serialization chain by reusing already serialized entities when they have been serialized from a different parents sequence
2024-10-05 07:53:56 +00:00
Harminder Virk
d98f22c7d6 Feat: Move container bindings declaration merging within the framework (#9467) 2024-10-04 15:47:06 +05:30
Stevche Radevski
a461e21ae7 fix: Get backend URL from environment variable if available (#9450) 2024-10-03 11:50:28 +00:00
Harminder Virk
48e00169d2 breaking: move shared HTTP utils to the framework (#9402)
Fixes: FRMW-2728, FRMW-2729

After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path.

- applyParamsAsFilters
- clearFiltersByKey
- applyDefaultFilters
- setContext
- getQueryConfig
- httpCompression
- maybeApplyLinkFilter
- refetchEntities
- unlessPath
- validateBody
- validateQuery

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-10-03 09:42:00 +00:00
Adrien de Peretti
225d00cd09 chore: improve mikro orm serializer circular ref and link serialization (#9411) 2024-10-03 08:22:11 +02:00
Zaid Rashid
c4f26120b0 docs: Fix typo. Use instead yuse (#9431)
Fix typo. Use instead of use. I found this while reading through the documents here https://docs.medusajs.com/v2/resources/references/auth/provider#validatecallback
2024-10-02 16:01:14 +00:00
Shahed Nasser
7ce9121095 chore(types, utils): update the TSDocs of AbstractFulfillmentProviderService (#9349)
Updates the `AbstractFulfillmentProviderService` with TSDocs for more useful information and examples

Closes DOCS-950
2024-10-02 09:01:01 +00:00
Adrien de Peretti
13a3c1bd77 fix(utils): knex import (#9408) 2024-10-01 16:34:48 +02:00
Shahed Nasser
20943902f9 chore: update imports in tsdocs (#9379) 2024-10-01 11:04:03 +02:00
Adrien de Peretti
b9e772b530 chore: Add import from framework types at the top of ay generated types file (#9389) 2024-10-01 08:53:52 +02:00
Harminder Virk
a578313db9 feature: bundle all modules (#9324) 2024-09-30 09:04:03 +02:00
Adrien de Peretti
6854feaf50 chore(utils): Cleanup and improve message aggregator (#9300)
* chore(utils): Cleanup and improve message aggregator

* fix
2024-09-26 17:00:03 +02:00
Harminder Virk
48bea267dc chore: perform dependencies scan and fix all dependencies (#9296) 2024-09-26 14:14:38 +05:30
Adrien de Peretti
fba78c0fb1 chore: remove direct usage from graphql (#9316)
**What**
Remove direct usage of graphql toold and instead consume it from utils to have a single entry point to graphql tooling
2024-09-26 08:18:26 +00:00
Adrien de Peretti
ae320ac73f fix: base tsconfig (#9309)
* fix: base tsconfig

* WIP

* wi[]

* update integration typescript version

* update lock file

* fix deps

* fix medusa tests runner
2024-09-25 16:31:57 +02:00
Adrien de Peretti
6e5d007837 fix: Generated types interface name (#9307)
**What**
Fix interface name in the output generated types
2024-09-25 12:32:07 +00:00
Adrien de Peretti
358435d715 chore: Move graphl to a single place (#9303)
* chore: Move graphl to a single place

* add new line
2024-09-25 12:04:25 +02:00
Harminder Virk
1d3a60023a fix: add missing dependency to utils package (#9297) 2024-09-25 08:18:13 +02:00
Adrien de Peretti
802f204d31 fix(orchestration): Throw if not exists using filters (#9275) 2024-09-24 17:12:04 +02:00
Carlos R. L. Rodrigues
b4b1a48987 feat(utils): define read only link (#9254) 2024-09-24 12:00:38 -03:00
Adrien de Peretti
90d530565b chore(): Remove default limit from the build query (#9257)
* chore(): Remove default limit from the build query

* rm take: null

* fix tests

* fix tests

* fix db usage

* fix typo

* rm unsused template arg

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes
2024-09-24 16:06:45 +02:00
Harminder Virk
9e711720dd chore: upgrade moduleResolution to Node16 (#9269) 2024-09-24 17:19:20 +05:30