**What**
- Move packages for `next` version of admin to core repo
**Other**
- Since this PR introduces packages that depend on Vite 5, it also introduces @types/node@^20. We have never had a direct dependency on the types package for Node, and as far as I can see that has resulted in us using the types from Node.js@8, as those are a dependency of one of our dependencies. With the introduction of @types/node@^20, two of our packages had TS errors because they were using the NodeJS.Timer type, which was deprecated in Node.js@14. We should add specific @types/node packages to all our packages, but I haven't done so in this PR to keep it as clean as possible.
- Q: @olivermrbl I've added the new packages to the ignore list for changeset, is this enough to prevent them from being published?
## What
Allow `medusa-oas` CLI to generate API client code from an OAS json file.
## Why
Manually maintaining API clients is time consuming and error prone. We wish to automate the process by using code generation strategies.
We also wish to eliminate direct import from `@medusajs/medusa` in clients which can lead to unwanted side effects like importing unnecessary dependencies.
## How
Fork and customize an OAS code generator library that is TypeScript friendly.
Attempt to match the interface and signature of our current client packages: `@medusajs/medusa-js`, `medusa-react`
Add a new `client` command to the `medusa-oas` CLI as the main interface to interact with the code generation tooling.
## Test
### Prerequisites
* From the root of the monorepo:
* `yarn install`
* `yarn build`
### Case - all in one build
* From the root of the monorepo:
* Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store`
* Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-store --type store`
* Expect `~/tmp/client-store` to contain the following files and directories:
```
core/
hooks/
models/
services/
index.ts
MedusaStore.ts
useMedusaStore.tsx
```
### Case - types only
* From the root of the monorepo:
* Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store`
* Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-types --type store --component types`
* Expect `~/tmp/client-types` to contain the following files and directories:
```
models/
index.ts
```
### Case - client only
* From the root of the monorepo:
* Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store`
* Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-only --type store --component client --types-package @medusajs/client-types`
* Expect `~/tmp/client-only` to contain the following files and directories:
```
core/
services/
index.ts
MedusaStore.ts
```
**what**
The goal of that PR is to first refactor the payment provider and payment plugin to support the new API that removes the data mutation from within the plugin to be done by the core instead. In any case, this pr does not include the steps of the deeper refactoring. The last part will come in later pr.
**How**
- The payment plugin is now capable to handle both the deprecated and new API and the plugin works the same as it use to works.
- The mutation made by the plugin have been moved into the core as well as the subscriber
- The tests have been updated to reflect the changed
- Remove all new methods introduced by the payment collections
- Mutualise types
- Update provider and payment collection services
- cleanup around all those refactoring including cleanup of the payment collection
- refactor stripe payment plugin
FIXES CORE-887
**What**
- add error handling when loading project config
**How**
- Add error parameter to get-medusa-config result if an error was thrown (previously we returned an empty config)
- Discussion:
A different, but equally valid approach could be just throwing the error rather than creating an error parameter. This causes a more ugly output without warnings and changes the api a bit but it would force error handling. wdyt?
**Why**
- cli would fail with database error `databaseMissingDriverError` if config was invalid, ex. missing a comma
### example (missing `,` in config)
**old output**
```
Successfully compiled 2 files with Babel (143ms).
[medusa-config] ⚠️ redis_url not found. A fake redis instance will be used.
[medusa-config] ⚠️ database_type not found. fallback to default sqlite.
info: Using flag MEDUSA_FF_ORDER_EDITING from environment with value true
info: Using flag MEDUSA_FF_SALES_CHANNELS from environment with value true
info: Using flag MEDUSA_FF_TAX_INCLUSIVE_PRICING from environment with value true
info: Using fake Redis
✔ Models initialized – 13ms
✔ Plugin models initialized – 0ms
✔ Repositories initialized – 17ms
⠋ Initializing databaseMissingDriverError: Wrong driver: "undefined" given. Supported drivers are: "aurora-data-api", "aurora-data-api-pg", "better-sqlite3", "capacitor", "cockroachdb", "cordova", "expo", "mariadb", "mongodb", "mssql", "mysql", "nativescript", "oracle", "postgres", "react-native", "sap", "sqlite", "sqljs".
```
**new output**
```
Successfully compiled 2 files with Babel (185ms).
error: Error in loading config: Unexpected identifier
error: /Users/phko/projects/community/my-medusa-store/medusa-config.js:129
plugins,
^^^^^^^
SyntaxError: Unexpected identifier
at compileFunction (<anonymous>)
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at getConfigFile (/Users/phko/projects/community/my-medusa-store/node_modules/medusa-core-utils/dist/get-config-file.js:26:20)
```
* feat(medusa): Migrate the idempotency key service to ts + fix
* feat(medusa): Finalise idempotency migration
* Create late-owls-pump.md
* feat(medusa): Polish
* feat(medusa): Add case to the error handler
* feat(medusa): Add case to the error handler
Co-authored-by: olivermrbl <oliver@mrbltech.com>
* fix: caching deps + add true parallelization to integration tests api
* fix: github action
* chore: upgrade to yarn berry (#1762)
* init migration
* remove: yarn.lock from all pkgs
* fix: build script in pkgs
* adjust yarn config
* fix: yarn.lock and yarnrc.yml
* fix: github actions
* fix: wrong type
* fix (medusa-react): use dts-cli instead of tsdx
* fix: yarn.lock
* fix: yarn v
* fix: prepare script
* add: comment on why we need to downgrade yarn before medusa-dev
* chore: move to Turborepo (#1763)
* increase number of parallel nodes
* fix (medusa-fulfillment-webshipper): build script
* fix: use new version of medusa-dev
* fix: rename cache-bootstrap to cache-deps
* added statuses to product + unit test for updating status
* add update to product model
* added integration tests
* added integration test to validate that updating status to null results in invalid_data error
* removed comment
* update GET /store/products integration test
* fixed unit test with IdMap
* init plugin
* changed dbehaviour on invalid status input on admin list products
* mprices
* updated migration to add status = published on all existing products + added integration test on GET /admin/products when status null is provided
* merged product status
* init ShopifyService
* made requested changes to migration and GET /store/products
* fixed test
* made requested changes to migration
* push progress on source plugin
* add webhook product/create handler
* fixed normalization of variant weight
* removed weight func
* work on events
* finished product hooks (error on new variant needs to be fixed)
* fixed order status
* create fulfillments
* update fulfillment on cancel
* refactored services, handle returns though medusa, helper methods
* order updates
* removed dist
* update gitignore
* emit cahnges to product
* added redis ignore check to prevent update loops
* fixed product-variant.deleted event
* fix more events
* fix test
* fix: order taxes
* added refund with no items
* fixes to hooks
* fixed handling refunds and returns issued from Shopify
* added unit tests to ShopifyProductService and ShopifyCollectionService
* linting fix
* prepared loader PR
* fix: jsDocs
* fix: pager
* fix: build output and babelrc
* chore: linting
* fix: address type
* fix: migration clean up
* fix: update snapshots with ext_ids
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* fix: migrate cart service to typescript
* fix: jsdoc inventory service
* fix: revert route unit test change
* fix: typo
* fix: revert integration test packages
* fix: cleanup
* fix: tests
* fix: integration tests
* fix: create props type guards
* fix: move total field to common types