Commit Graph

482 Commits

Author SHA1 Message Date
Kasper Fabricius Kristensen
e2058683f4 chore(dashboard): Setup test and script for validating i18n (#9799)
**What**
- Adds a test that validates that en.json and $schema.json matches, this will help us catch missing translations, and prevent us from forgetting to update the schema when we delete/add new keys.
- Adds a script for validating translations against the translation schema. This can be used to validate that community PRs for i18n contain all the required keys. To use the script you can run `yarn i18n:validate <file name>` e.g. `yarn i18n:validate da.json` which will look for a da.json file in the translation folder, and validate it against the schema. We handle this with a script as we don't want to do so through a test. Doing it with a test would mean that if we update the schema, we would also have to update all translations files that we don't maintain ourselves. The purpose of the script is just to allow us to easily review community PRs and also as a tool for people opening PR's to check their translations agains the schema, as it will print missing/additional keys.
- Also adds a script to generate a schema from the en.json file. After adding/deleting keys to en.json you should run `yarn i18n:generate`.
2024-11-04 09:45:07 +00:00
olivermrbl
a3f71dcdb0 chore: Release 2024-10-25 17:23:25 +02:00
Harminder Virk
809c8a6741 fix: missing dependency in dev-cli (#9730) 2024-10-23 10:01:39 +02:00
olivermrbl
2fbebb60e3 chore: Release 2024-10-22 20:43:47 +02:00
Oli Juhl
c3418a2b93 chore: Prepare versions + changeset (#9707)
* chore: Prepare version + changeset

* chore: Bump dependencies

* chore: Update lock-file
2024-10-22 20:31:33 +02:00
Carlos R. L. Rodrigues
e9a06f4b4d fea(providers): locking postgres (#9545)
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-10-17 13:11:39 +00:00
Harminder Virk
68560787e5 breaking: rename package names to be consistent and under @medusajs scope (#9580) 2024-10-16 22:28:09 +05:30
Kasper Fabricius Kristensen
813efeae51 fix(admin-vite-plugin): Normalize file paths and add tests (#9595)
**What**
- #9338 had a regression which caused the import path in some virtual modules to be invalid on Windows.
- This PR fixes the issue so we now again create the correct import paths, and adds tests to prevent this from slipping in again.
2024-10-15 16:48:56 +00:00
Carlos R. L. Rodrigues
4a03bdbb86 feat(providers): locking redis (#9544) 2024-10-15 12:40:24 -03: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
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
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
Kasper Fabricius Kristensen
d71343d6ab feat(dashboard,admin-vite-plugin,admin-bundler,admin-sdk): Rework admin extensions and introduce custom fields API (#9338) 2024-10-09 11:44:40 +00:00
Adrien de Peretti
ad3524ffbe feat: Add useQueryStep (#9384)
* feat: Query step replacement

* fix

* fix types
2024-10-07 12:07:06 +02:00
Oli Juhl
f7472a6fa6 fix: Idempotent cart completion (#9231)
What
- Store result of cart-completion workflow for three days by default
  - This enables the built-in idempotency mechanism to kick-in, provided the same transaction ID is used on workflow executions
- Return order from cart-completion workflow if the cart has already been completed
  - In case transaction ID is not used on workflow executions, we still only want to complete a cart once
2024-10-04 12:01:09 +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
Harminder Virk
2d1cf12dac feature: Add MikroORM CLI wrapper to bypass hardcoded module system (#9426)
FIXES: FRMW-2727

MikroORM (with version 5.9) has [hardcoded the TypeScript module](https://github.com/mikro-orm/mikro-orm/blob/5.x/packages/core/src/utils/ConfigurationLoader.ts#L138-L139) system to `commonjs`, which makes it incompatible with the module system we are using, ie `Node16`.

So, in order to continue using the Mikro ORM CLI within our modules, we will have to monkey-patch the block of code responsible for configuring `ts-node`. However, the monkey-patching must be done before their CLI gets booted.

As a result of this, we have to create a wrapper CLI on top of Mikro ORM CLI that performs the following steps.

- Monkey-patch the relevant code
- Register Mikro ORM CLI as the second step.

Due do this, we will have to use this new wrapper CLI within the modules, which is exposed as `medusa-db`. Maybe, `medusa-db` is not a great name, so please send your suggestions.
2024-10-03 04:51:20 +00:00
Shahed Nasser
cb5c228a36 fix(create-medusa-app): remove warnings on installation (#9405) 2024-10-02 13:27:13 +03:00
Adrien de Peretti
7e73fe4794 chore: Improve jest config and deps (#9318) 2024-09-30 10:50:59 +02:00
Harminder Virk
a578313db9 feature: bundle all modules (#9324) 2024-09-30 09:04:03 +02:00
Adrien de Peretti
a8e19faf8d chore: use framework sub paths everywhere (#9253) 2024-09-26 16:38:38 +05:30
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
e096feb7d5 chore: Update modules deps (#9286) 2024-09-26 11:14:35 +05:30
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
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
6937d74252 chore(): Move dependencies around (#9278)
RESOLVES FRMW-2716 [1]

**What**
First stab at re organising dependencies in the modules and their usage.
2024-09-24 14:58:04 +00:00
Harminder Virk
9e711720dd chore: upgrade moduleResolution to Node16 (#9269) 2024-09-24 17:19:20 +05:30
Adrien de Peretti
8ec323b1da refactor(types): Align configuration and fixes (#9240)
RESOLVES FRMW-2712

**What**
Refactor types packages to use the latest configuration of typescript and fixes issues
2024-09-23 12:13:02 +00:00
Adrien de Peretti
94e07c8da0 refactor(framework): Align configuration and fixes (#9246)
* refactor(framework): Align configuration and fixes

* refactor(framework): Align configuration and fixes

* move framework

* rm unnecessary script

* update jest config
2024-09-23 13:07:30 +02:00
Harminder Virk
9f72fb5902 Chore: cleanup workflows SDK (#9244)
Fixes: FRMW-2712
2024-09-23 11:04:38 +00:00
Harminder Virk
97e003ef4f chore: Cleanup utils package (#9238)
Fixes: FRMW-2712

Old PR: https://github.com/medusajs/medusa/pull/9234 Closed because of incorrect branch naming

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-09-23 10:37:58 +00:00
Adrien de Peretti
79e3578932 refactor(orchestration): Align configuration and fixes (#9242)
RESOLVES FRMW-2712

**What**
Refactor orchestration packages to use the latest configuration of typescript and fixes issues
2024-09-23 10:36:05 +00:00
Adrien de Peretti
919d19095a refactor(modules-sdk): Align configuration and fixes (#9239)
* refactor(modules-sdk): Align configuration and fixes

* typo

* fix configuration
2024-09-23 12:12:26 +02:00
Adrien de Peretti
58167b5dfa feat(index): Index module foundation (#9095)
**What**
Index module foundation

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-09-18 19:04:04 +00:00
Carlos R. L. Rodrigues
ef8dc4087e feat: run nested async workflows (#9119) 2024-09-16 13:06:45 +00:00
Harminder Virk
9cf0df53b5 feature: add telemetry to the HTTP layer (#9116)
---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
2024-09-13 12:36:54 +05:30
Harminder Virk
2b8e15d2ec feat: introduce a thin wrapper on top of OpenTelemetry (#9109) 2024-09-12 12:59:49 +05:30
Adrien de Peretti
e56607c97c fix(medusa-test-utils): Run with modules without models (#9062)
* fix(medusa-test-utils): Run with modules without models

* cleanup

* rm dummy model

* rm dummy model

* improve models loading

* find models

* find models

* find models

* finalize

* cleanup

* fix deps

* fix deps

* fix deps

* fix deps

* fix deps
2024-09-10 14:22:21 +02:00
Stevche Radevski
3244067ee4 feat: Add support for fetch streaming to js SDK (#9065) 2024-09-10 09:14:10 +02:00
Adrien de Peretti
2c5e72d141 feat: Application types generation from project GQL schema's (#8995) 2024-09-06 15:15:32 +05:30
Riqwan Thamir
0573bb924a chore: Remove typeORM (#9005)
* chore: rename js files to txt

* chore: rename ts files to txt

* chore: delete environment helpers

* chore: convert global setup & teardown to txt

* chore: rename helper js/ts files to txt

* chore: rename seeder js/ts files to txt

* chore: remove typeorm

* chore: reintroduce used helpers
2024-09-05 15:45:30 +02:00
Kasper Fabricius Kristensen
0fe1201435 feat(admin-sdk,admin-bundler,admin-shared,medusa): Restructure admin packages (#8988)
**What**
- Renames /admin-next -> /admin
- Renames @medusajs/admin-sdk -> @medusajs/admin-bundler
- Creates a new package called @medusajs/admin-sdk that will hold all tooling relevant to creating admin extensions. This is currently `defineRouteConfig` and `defineWidgetConfig`, but will eventually also export methods for adding custom fields, register translation, etc. 
  - cc: @shahednasser we should update the examples in the docs so these functions are imported from `@medusajs/admin-sdk`. People will also need to install the package in their project, as it's no longer a transient dependency.
  - cc: @olivermrbl we might want to publish a changelog when this is merged, as it is a breaking change, and will require people to import the `defineXConfig` from the new package instead of `@medusajs/admin-shared`.
- Updates CODEOWNERS so /admin packages does not require a review from the UI team.
2024-09-04 19:00:25 +00:00
Stevche Radevski
af4f8811bd feat: Add github authentication provider (#8980)
* feat: Add github authentication provider

* feat: Change callback to always return a token, expect callbackUrl to point to FE

* fix: Return login redirect URLas a 200 response
2024-09-04 13:14:00 +02:00
Kasper Fabricius Kristensen
58c78a7f62 fix(dashboard): Tab behaviour in DataGrid (#8973)
* fix focus in datagrid

* cleanup

* fix keyboard commands

* cleanup

* cleanup

* always allow handler for special focus to fire

* cleanup
2024-09-03 20:54:47 +02:00
Harminder Virk
3bb6ef3735 fix: move get-port to main dependencies list (#8938) 2024-09-02 18:37:54 +05:30
Kasper Fabricius Kristensen
b8572165cb feat(dashboard): DataGrid improvements [4/4] (#8798)
**What**
- Changes cell state strategy from tracking from lazy to eager. This has required some changes to the API of the DataGrid component, and createDataGridColumnHelper function.
- Displays error messages in both affected cells and their rows. The row indicator also provides an option to quickly jump to an error.
- Allows the user to hide all rows and columns that don't have errors, to help quickly get an overview of the errors in a large grid.
- The first column of a DataGrid is now pinned, making it easier for a user to tell which entity they are editing.
- Fixes and improvements to column visibility menu.
- Adds a shortcuts modal that explains the different available keyboard commands.
- Updates `@tanstack/react-table` to the latest version.

Resolves CC-269
2024-08-28 19:06:38 +00:00
Oli Juhl
2bacf86d3c chore: Remove prepublishOnly script (#8699)
* wip

* wip

* verbose logging

* remove prepublish scripts

* chore: add back prepublish scripts

* wip

* remove prepublishOnly script

* chore: Clean up rest of build scripts

* add back build script

* feedback

---------

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2024-08-27 10:31:38 +02:00
Carlos R. L. Rodrigues
3b4eea08ef chore: peer dependency version (#8771)
* fix peer dependency version

* dotenv

* commands

* dotenv cli
2024-08-26 21:55:57 +02:00