* initial code push
* update metadata and only merge if the existing line item allows merging
* update should_merge check
* undo changes to taxrate service
* update results with unit pricing corresponding to the db values after update
* add should_merge property to line_item creation
* add should_merge property to line_item creation
* fix unit tests
* undo adding "should_merge" to create-line-item
* undo change to "addOrUpdateLineItem"
* :wqh_merge from generate method
* undo changes to unit tests
* revert to adding pricing in updateLineItem method
* update cart service test
* Create funny-radios-juggle.md
---------
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
**What**
- Add integration test suite for database options
- Expose integration tests DB to additional options
- Add test for `idle_in_transaction_session_timeout`
### What
Leverage yarn workspaces and Turborepo for integration-tests in order to accelerate development and reduce DevX complexity.
### Why
The current solution for running integration tests requires using `medusa-dev-cli` in order to publish packages to a local npm repository. The package where the command is executed will have its package.json altered for any known medusa dependency in order to install from the local npm. The process is taxing on the host machine resources and prevents rapid iterations when working with integration tests.
For more information, see documentation: f0cc1b324c/docs/content/usage/local-development.md (run-api-integration-tests)
### How
By declaring `integeration-tests/**/*` as a workspace, Turborepo can now be leveraged to build and run integration test as if there were packages. The build process will take care of interdependency between package in order to ensure local dependency are met.
In addition, within each integration-tests "packages", we can declare local dependencies as "*" which will translate to using the one that is part of the current build, regardless of the dependency's version number. No more fiddling with version numbers.
Github actions pertaining to integration-tests have been streamlined to use the new behavior.
The integration-tests packages have been marked as `private:true` in order to avoid publishing them to the public npm registry.
### Testing
```
cd root-of-medusajs-medusa-repo/
yarn install
yarn build
yarn test:integration:api
yarn test:integration:plugins
```
After a code change, `yarn build` must be run before re-running an integration test, which is the same procedure as for unit tests.
Resolves: CORE-845
**What**
I have created a new method on the cart service which is `addLineItems`, allowing a user to add one or multiple items in an optimized way. Also updated the `generate` method from the line item service which now also accept a object data or a collection of data which. Various places have been optimized and cache support has been added to the price selection strategy.
The overall optimization allows to reach another 9000% improvement in the response time as a median (Creating a cart with 6 items):
| | Min (ms) | Median (ms) | Max (ms) | Median Improvement (%)
|---|:-:|---|---|---|
| Before optimisation | 1200 | 9999 | 12698 | N/A
| After optimisation | 63 | 252 | 500 | 39x
| After re optimisation | 56 | 82 | 399 | 121x
| After including addressed feedback | 65 | 202 | 495 | 49x
FIXES CORE-722
**What**
- add support for specifying sales channel with import strategy
- additional:
- refactor SC service to use `retrieve_` pattern
- fix: pass arguments from `startServerWithEnvironment` to setup server
- fix: minio undefined resolve/reject calls
- fix: csv parser - detect missing columns from schema only if the column is required
**How**
- extending schema to expect sales channels columns in an import CSV file
RESOLVES CORE-304
* init: copy PI files
* feat: add subscribers, refactor strategies folder
* wip: strategies integration tests package
* fix: rename
* wip: use redis
* wip: use redis deps, redis setup in local tests
* fix: naming collision, medusa config
* fix: typing, update apply changes for new event ordering and reimplement interface
* feat: make redis container run in integration tests
* fix: missing yarn lock
* feat: redis setup v2
* fix: setup server imports
* fix: a lot of integration issues
* fix: a lot of integration issues v2, transform tags, fix `ops` object parsing
* wip: parsing product options
* feat: ✨creating product and variants works, processing product/variant options, update schema
* fix: query keys, logic for finding existing variant
* fix: types
* feat: update product variant's options
* feat: parse MA records
* feat: creating/updating MA records, region detection, error handling
* feat: throw an error when creating an MA for nonexistent region
* refactor: remove unused methods
* refactor: use provided ids to track records, extract a couple of methods
* refactor: remove unused method
* refactor/wip: add initial comment for main methods
* refactor: replace usage of RedisJSON functionality with basic k/v api
* feat: async progress report
* types: define more precise types, cleanup
* feat: error handling
* feat: unit testing preprocessing
* feat: integration testing for CI, fix legacy bug where user is unable to create a variant if regional price is also sent as payload, add csv for integration tests
* fix: error throw for logs
* feat: add product endpoint snap
* refactor: remove log
* feat: add snaps, rebase
* refactor: add comments
* feat: snap update
* refactor: typo
* refactor: change error handler
* feat: Redis cleanup after the job is done
* testing :fix product unit test, remove integration snap, add inline object matcher
* testing: fix obsolete snaps
* refactor: update comments
* fix: rebase issue
* fix: rebase issue v2, remove log form an integration test
* fix: try reverting setup server
* fix: insert variants test
* refactor: don't pass tx manager, refactor methods
* refactor: don't use regionRepo, add `retrieveByName` to region repo
* refactor: don't use productRepo
* refactor: don't use `productVariantRepo`
* refactor: remove repo mocks from unit tests
* fix: product import unit tests
* feat: file cleanup on finalize, kill test logs
* wip: use files to persist ops instead of redis, move strategy class into `batch-job` folder
* fix: minio delete method, add file cleanup method to import, fix promise coordination
* fix: replace redis methods
* feat: store import ops as a file instead of Redis
* feat: test cleanup
* fix: change unit tests after Redis logic removal
* feat: use `results` for progress reporting, add `stat_descriptors` info after preprocessing, remove redis mentions
* feat: extract to other files, use directory from property, fix strategy loader to allow other files in `strategies` directory
* feat: fix instance progress counter
* fix: mock services types
* fix: update snaps
* fix: error handling stream, fix test file service name generation
* fix: remove dir with tmp files after testing
* fix: new yarn.lock after rebase
* fix: remove log, change object shape
* fix: add DI types
* refactor: remove container as a csv parser dep
* fix: remove seeder, change typings
* refactor: reimplement `retrieveByName` in the region service
* fix: unit tests typings
* fix: remove ts-ignore, complete typings for csv parser validators
* fix: don't keep track of progress since it is redundant and only keep track of `advancement_count`
* fix: return of the batch job seeder
* fix: update find region by name method
* fix: update types for service typings
* fix: update redis type usage
* fix: update unit tests file
* fix: unit tests
* fix: remove redis from integration test
* feat: refactor region retrieval by name
* feat: refactor product option update
* fix: remove repo import
* fix: return redis in test
* fix: handle stream error
* fix: tmp data cleanup
Co-authored-by: fPolic <frane@medusajs.com>
**What**
- Add `transformQuery` to get endpoints for product, order and cart
- ensure that the default relations (when getting a singular entity) includes sales channels when enabled
- Add `EmptyQueryParams` class in common types to prevent query parameters while using `transformQuery`
- update product-, order- and cartFactory to include sales channels if provided
- remove `packages/medusa/src/controllers/products/admin-list-products.ts`
**Testing**
- expands sales channel for single order
- expands sales channels for orders with expand parameter
- returns single product with sales channel
- expands sales channels for products with expand parameter
- returns cart with sales channel for single cart
Fixes CORE-293
Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
* feat: add feature flag loading in projects
* fix: make feature flag consume itself
* fix: rename container registration to featureFlagRouter
* fix: refactor
* behavioral feature flags
* add environment to server
* limit "useTemplateDb" to non feature flagged migrations
* filter migrations and entities according to those which are enabled in the environment
* run only migrations that are enabled when running 'medusa migrations run'
* add logging to the featureflag loader
* initial implementation of featureFlagEntity
* column descriptors
* initial startServerWithEnv (to be refactored)
* update commands
* final touches
* update loaders to fix unit tests
* enable all batch job tests
* update seed method
* add api test capabilities
* revert batch job test
* revert formatting changes
* pr feedback
* pr feedback
* remove unused imports
* rename feature flag decorators
* pr feedback
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* Modifies schema to allow SQLite as a DB driver. SQLite is preinstalled in most OSes allowing for minimal prerequisites in the installation process.
* Removes Redis dependency and replaces "real" redis instance with ioredis-mock this is not feature complete and errors are expected.
* Updates medusa new command to only ask for Postgres credentials if the starter template has database_type === "postgres" in medusa-config.js
* Small improvements to bin resolution
* Improvements to endpoint stability
- Adds a context field to Cart
- context is automatically populated with ip + user agent
- context can be updated via POST /store/cart/:id or set when creating via POST /store/cart