Commit Graph

84 Commits

Author SHA1 Message Date
Harminder Virk
b0a16488e0 feat: add middleware-file-loader (#11638)
Fixes: FRMW-2920

The feature is called `middleware-file-loader`, because it does more than just collecting middlewares. It also collects the bodyParser config for routes
2025-02-27 09:42:29 +00: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
Harminder Virk
9e2af4801d feat: add routes loader (#11592)
Fixes: FRMW-2919

This PR adds a new routes loader with a single responsibility of scanning the filesystem and collecting routes. Sorting of routes, merging middleware and registering them with express are going to separate implementations.

The new `RoutesLoader` class allows overriding routes as-well (not recommended though) and this is how routes are de-duplicated.

- When two routes for the exact route pattern/matcher are discovered, the routes loader will only keep the last one.

- Routes files can also override handlers for specific HTTP methods. For example, the original route file exported handlers for `GET` and `POST`, but the overriding one only defines `GET`. In that case, we will continue using the original implementation for the `POST` handler.

- If an overriding route file exports additional configuration like `export const AUTHENTICATION=false`, then this will only impact the handlers exported from this file and not the original handlers.

Routes sorting has been already been implemented in a separate PR and you can visualize it using this URL. https://routes-visualizer.fly.dev/
2025-02-26 07:24:10 +00:00
olivermrbl
3f7470022c chore: Version packages 2025-02-24 11:36:46 +01:00
Harminder Virk
feec0243ab feat: add middleware and routes sorter (#11526)
Fixes: FRMW-2918
2025-02-24 10:17:15 +00:00
Shahed Nasser
b60e1c855e fix(framework): add missing storefrontUrl from configuration type (#11511)
The `storefrontUrl` is defined in the `packages/core/types/src/common/config-module.ts` file, but for many purposes, including the documentation, we use the types defined in `packages/core/framework/src/config/types.ts`. This PR adds the `storefrontUrl` to the framework type
2025-02-18 17:29:59 +00:00
Adrien de Peretti
3b7856e8f5 feat(framework): Improve production structured logging with more valuable information as well (#11489)
* feat(framework): Improve production structured logging with more valuable information as well

* feat(framework): Improve production structured logging with more valuable information as well

* feat(framework): Improve production structured logging with more valuable information as well

* feat(framework): Improve production structured logging with more valuable information as well

* fix typo

* update trust proxy

* Create new-ligers-heal.md

* revert trust proxy
2025-02-17 18:16:33 +01: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
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
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
e98d3c615e chore(orchestration): validate PK when throwIfKeyNotFound (#11190)
CLOSES: FRMW-2895
2025-01-29 19:17:36 +00:00
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
olivermrbl
986ee8008e chore: Version packages 2025-01-27 09:35:06 +01: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
Carlos R. L. Rodrigues
cc73802ab3 chore(order): dml (#10292)
* ../../core/types/src/dml/index.ts

* ../../core/types/src/dml/index.ts

* fix: relationships mapping

* handle nullable foreign keys types

* handle nullable foreign keys types

* handle nullable foreign keys types

* continue to update product category repository

* fix all product category repositories issues

* fix product category service types

* fix product module service types

* fix product module service types

* fix repository template type

* refactor: use a singleton DMLToMikroORM factory instance

Since the MikroORM MetadataStorage is global, we will also have to turn DML
to MikroORM entities conversion use a global bucket as well

* refactor: update product module to use DML in tests

* wip: tests

* WIP product linkable fixes

* continue type fixing and start test fixing

* test: fix more tests

* fix repository

* fix pivot table computaion + fix mikro orm repository

* fix many to many management and configuration

* fix many to many management and configuration

* fix many to many management and configuration

* update product tag relation configuration

* Introduce experimental dml hooks to fix some issues with categories

* more fixes

* fix product tests

* add missing id prefixes

* fix product category handle management

* test: fix more failing tests

* test: make it all green

* test: fix breaking tests

* fix: build issues

* fix: build issues

* fix: more breaking tests

* refactor: fix issues after merge

* refactor: fix issues after merge

* refactor: surpress types error

* test: fix DML failing tests

* improve many to many inference + tests

* Wip fix columns from product entity

* remove product model before create hook and manage handle validation and transformation at the service level

* test: fix breaking unit tests

* fix: product module service to not update handle on product update

* fix define link and joiner config

* test: fix joiner config test

* test: fix joiner config test

* fix joiner config primary keys

* Fix joiner config builder

* Fix joiner config builder

* test: remove only modifier from test

* refactor: remove hooks usage from product collection

* refactor: remove hooks usage from product-option

* refactor: remove hooks usage for computing category handle

* refactor: remove hooks usage from productCategory model

* refactor: remove hooks from DML

* refactor: remove cruft

* order dml

* cleanup

* re add foerign key indexes

* wip

* chore: remove unused types

* wip

* changes

* rm raw

* autoincrement

* wip

* rel

* refactor: cleanup

* migration and models configuration adjustments

* cleanup

* number searchable

* fix random ordering

* fix

* test: fix product-category tests

* test: update breaking DML tests

* test: array assertion to not care about ordering

* fix: temporarily apply id ordering for products

* types

* wip

* WIP type improvements

* update order models

* partially fix types temporarely

* rel

* fix: recursive type issue

* improve type inference breaks

* improve type inference breaks

* update models

* rm nullable

* default value

* repository

* update default value handling

* fix unit tests

* WIP

* toMikroORM

* fix relations

* cascades

* fix

* experimental dml hooks

* rm migration

* serial

* nullable autoincrement

* fix model

* model changes

* fix one to one DML

* order test

* fix addresses

* fix unit tests

* Re align dml entity name inference

* update model table name config

* update model table name config

* revert

* update return relation

* WIP

* hasOne

* models

* fix

* model

* initial commit

* cart service

* order module

* utils unit test

* index engine

* changeset

* merge

* fix hasOne with fk

* update

* free text filter per entity

* tests

* prod category

* property string many to many

* fix big number

* link modules migration set names

* merge

* shipping option rules

* serializer

* unit test

* fix test mikro orm init

* fix test mikro orm init

* Maintain merge object properties

* fix test mikro orm init

* prevent unit test from connecting to db

* wip

* fix test

* fix test

* link test

* schema

* models

* auto increment

* hook

* model hooks

* order

* wip

* orm version

* request return field

* fix return configuration on order model

* workflows

* core flows

* unit test

* test

* base repo

* test

* base repo

* test fix

* inventory move

* locking inventory

* test

* free text fix

* rm timeout mock

* migrate fulfillment values

* v6.4.3

* cleanup

* link-modules update sql

* revert test

* remove fake timers

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
Co-authored-by: Harminder Virk <virk.officials@gmail.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-01-21 08:04:47 -05:00
Adrien de Peretti
13fe2f6776 fix(framework): migration scripts regexp (#11072)
FIXES FRMW-2879

**What**
The exclusion regexp was broken and instead use the ignore options of the glob sync function to properly ignore definition files
2025-01-21 09:34:57 +00:00
olivermrbl
57e9a7a5bf chore: Version packages 2025-01-20 07:41:15 -05:00
Harminder Virk
171088b47a fix: missing dependencies in the framework package (#11049)
In the framework package we are directly importing many uninstalled dependencies. The issue does not occur for transitive dependencies. However, the `glob` package is not a transitive dependency of any production dependency and hence it fails.

Fixes: #11044
Fixes: FRMW-2877
2025-01-20 11:51:44 +00:00
Shahed Nasser
f15fb4d4fa chore(framework): update the TSDocs for a plugin in the medusa config (#10991)
* chore(framework): update the TSDocs for a plugin in the medusa config

* change version
2025-01-17 17:41:05 +02:00
olivermrbl
efe141f54b chore: Version packages 2025-01-17 10:29:04 -05:00
Adrien de Peretti
9a742911fe fix(framework): Exclude .d.ts files from the glob search and fix insert query (#10990)
**What**
- Exclude definition file from the glob search string
- Properly generate the insert query string
2025-01-16 14:29:09 +00:00
Harminder Virk
c75678d6d4 feat: add support for loading admin extensions from the source (#10975) 2025-01-16 11:06:56 +05:30
Adrien de Peretti
0924164e86 feat(core, medusa, cli): Enable migration scripts (#10960)
* feat(core, medusa): Enable migration scripts

* spacing

* rm unnecessary import

* Allow to skip script migration

* fix missing options

* add options

* add tests and small changes

* update

* add checks

* add lock mechanism to be extra safe

* Create six-bears-vanish.md

* update queries

* fix tests

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2025-01-15 12:51:37 -05:00
Kasper Fabricius Kristensen
4bc3f5b845 feat(medusa,framework,cli,admin-bundler): Integrate admin extensions into medusa build:plugin (#10941)
**What**
Calls the `plugin` script from `@medusajs/admin-bundler` as part of `medusa plugin:build`.
2025-01-13 20:48:55 +00:00
Harminder Virk
b0f581cc7c feat: add plugin build command (#10935)
Fixes: FRMW-2863

Adds the `plugin:build` command that is used to compile the source code of a plugin for publishing it to a package registry. The command is similar to the `build` command, except it does not copy the `package.json` and the `lock` files to the build output
2025-01-13 13:33:54 +00:00
Harminder Virk
69e2a6d695 Feat/plugin develop (#10926)
Fixes: FRMW-2865

In this PR we add support for developing a plugin in watch mode. During the file change, we re-compile the source code (incrementally), publishes the package, and updates the installations of the plugin. 

We are using `yalc` under the hood and it must be installed as a dev dependency in the plugin project and the main Medusa app.
2025-01-13 13:08:02 +00:00
Harminder Virk
428fce5313 chore: move build utilities to Compiler class (#10904)
Fixes: FRMW-2866
2025-01-10 11:30:48 +00:00
olivermrbl
3919b26eb6 chore: Version packages 2025-01-07 13:31:40 +01:00
Shahed Nasser
a989c50051 chore: fix version number in tsdocs (#10856) 2025-01-07 10:52:44 +02:00
Shahed Nasser
c440068d49 chore: small tsdoc changes for remoteLink and remoteQueryConfig (#10837) 2025-01-06 14:01:46 +02:00
Harminder Virk
5e9d86d75d feat: deprecate remoteQueryConfig in favor of queryConfig (#10773)
Fixes: FRMW-2783
2025-01-03 08:46:23 +00:00
Harminder Virk
bbf790ea44 feat: deprecate remote link (#10768)
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-12-30 14:57:43 +05:30
Stevche Radevski
c8f9938865 feat(medusa): Add health endpoint for all running modes of medusa (#10737) 2024-12-26 13:53:12 +08:00
olivermrbl
348f866ffe chore: Version packages 2024-12-20 11:25:36 +01:00
olivermrbl
a391a29aa8 chore: Version packages 2024-12-17 14:41:05 +01:00
olivermrbl
0e342b491d chore: Version packages 2024-12-10 14:01:50 +01:00
Shahed Nasser
597bffaab3 fix(framework): add missing query type argument in request types (#10456)
* fix(framework): add missing query type argument in request types

* fix types
2024-12-06 09:53:34 +02:00
olivermrbl
4723acd949 chore: Version packages 2024-12-04 18:36:57 +01:00
Kasper Fabricius Kristensen
a5263083fa fix(framework): Ensure that CORS and Auth middleware is applied for routes only defined in middlewares.ts (#10339) 2024-12-04 14:49:43 +01:00
Riqwan Thamir
11bd556133 feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context (#10374)
* feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context

* chore: add test for shipping options returning free shipping
2024-12-01 20:59:26 +01:00
olivermrbl
e9c1b1127e chore: Version packages 2024-11-27 15:40:07 +01:00
olivermrbl
ccf4e801f3 chore: Version packages 2024-11-25 12:14:36 +01:00
olivermrbl
4245312d8d chore: Version packages 2024-11-25 09:57:00 +01:00
Carlos R. L. Rodrigues
42c08fa8e0 fix(framework): handle deprecated Dirent path (#10179)
What:

- `Dirent` class from `NodeJS` has different properties in different versions, causing issues in our loaders.
- Util `readDirRecursive` was introduced, avoiding old node versions to break

FIXES: https://github.com/medusajs/medusa/issues/8419
2024-11-20 20:25:48 +00:00
Riqwan Thamir
85f9c2b85a fix(framework,types): correct example of database driver options (#10166) 2024-11-19 16:32:31 +00:00
olivermrbl
d5605656ae chore: Version packages 2024-11-12 10:10:07 +01:00