There are several things done in this PR, namely:
Unify the service endpoints API to always work with a model rather than allowing to pass both ID and model (eg. both type_id and type being available in the request to create).
Start using upsertWithReplace to simplify the code and fix some deassociation bugs
Apply some changes to tests to deal with the pricing breaking changes
Correctly define the model relationships (with both ID and entity fields available)
All tests for the product are passing, which should bring us back to a great baseline.
* feat: Modify the abstract repository upsert method to handle subresources correctly
* fix: Preserve the upsertWithResponse order in the response, and return all the data
* fix: Create integration tests folder for mikro orm utils that run against the DB
* fix: Remove many-to-one creation and additional changes based on PR review
## What
Adds an AI generator to the docblock tool that uses OpenAI.
The generator at the moment only generates examples for functions when the `--generate-examples` option is provided.
## Note
I've included the generated examples of the `IOrderModuleService` as a reference of the type of result provided by the AI generator, with minor tweeks I've made. I haven't made any changes to descriptions in that file.
**What**
- Fixes tsconfig to ensure a declaration file is included in the build.
**Why**
- Ensure tsserver can understand things from medusa-test-utils
- Get rid of "Could not find a declaration file for module" warning in editors.
What
- Add link between API key and sales channels
- Add API route for batch adding sales channels to a publishable API key
- Clean up API key API routes responses
- Move API key test suite from `integration-tests/modules` to `integration-tests/api`
- Added new documentation page for Medusa Worker.
- Updated Railway deployment guide with details on Medusa Worker.
- Small adjustments to the `worker_mode` option's TSDocs.
**What**
- Adds Create draft order form
- Updates draft order details page to also display "custom" items.
**Note**
- Currently, the form is missing a way to input a discount code. Need to rethink this a bit, as the we can't implement the design in Figma.
- The current design is missing a way to select from a customers existing shipping addresses, we should add that to keep the features we have today.
- This PR uses `useInfiniteQuery` which does not work on our staging (due to duplicate dependencies as a result of building straight from the monorepo), so you will need to test locally.
**What**
- Adds the initial Timeline component.
- Not all events have been added, as it makes sense to add them with their respective RMA flows.
- Emoji picker is omitted from initial PR as it's a nice-to-have that we can add later.
## What
Added a `--v2` option to the `create-medusa-app` command that clones the [feat/v2](https://github.com/medusajs/medusa-starter-default/pull/150) branch of the starter default and makes minor changes to the setup process.
## Why
This option is supposed to make it easier to test out internally a Medusa setup with all the commerce modules. The starter's branch installs and configures the modules + the V2 feature flag.
## Testing
To test it out, run the snapshot with the `--v2` option.
## Notes
- I couldn't install the new admin dashboard in the starter branch as it's not on NPM yet (at the time of writing this), so at the moment, this opens the current admin dashboard instead.
- When trying to create an invite using the CLI tool I get the error `Unable to resolve inviteService`. Not sure if we should also make changes to the CLI tool to allow creating an invite when V2 is enabled (I know now invites are creating within the User Module, so maybe when the V2 feature flag is enabled that should be resolved instead), but for now I just disabled running the create invite command as this is mainly for internal testing. Let me know what the suggested approach is here.