Commit Graph
79 Commits
Author SHA1 Message Date
Adrien de Peretti 110c995a6a feat(medusa): Allow to query order/product by SC (#1867)
**What**

Allow to query the products and orders by sales channels

**How**

Updating the existing end points and repositories  (if necessary) to take a new query params that is sales_channel_id as an array of string

**Tests**

Add new integration tests

Fixes CORE-295
Fixes CORE-288
2022-07-19 16:54:20 +00:00
Adrien de Peretti f35ea5156a feat(medusa, medusa-js, medusa-react): Bulk add Products to a SalesChannel (#1833) 2022-07-14 16:39:44 +02:00
Adrien de Peretti cdd91974f9 feat(medusa, medusa-js, medusa-react): Start implementing remove batch products on a sales channel (#1842)
What
Support sales channel remove product batch in medusa, medusa-js and medusa-react

How
By implementing a new endpoint and the associated service method as well as the repository methods.

Medusa-js new removeProductd method in the resource

Medusa-react new hook in the mutations

Tests

Endpoint test
Service test
Integration test
Hook tests

Fixes CORE-292
2022-07-13 19:40:23 +00:00
Adrien de Peretti a1a5848827 feat(medusa, medusa-js, medusa-react): Implement Sales Channel list (#1815)
**What**
Support sales channel list in medusa, medusa-js and medusa-react

**How**

By implementing a new endpoint and the associated service method as well as the repository methods.

Medusa-js new list method in the resource

Medusa-react new hook in the queries

**Tests**

Endpoint test
Service test
Integration test
Hook tests

Fixes CORE-280
2022-07-13 10:28:53 +00:00
Adrien de Peretti b402b9f159 feat(medusa): Create default sales channel associated to the store (#1830)
**What**
Add support for default sales channel

**How**
- Implement a new method in the salesChannelService `createDefault`
- call the new method above in the default loader

**Test**
- Unit tests of the sales channel service method createDefaulta
- Init default loader unit tests

Fixes CORE-316
2022-07-11 21:05:28 +00:00
Adrien de Peretti 6715eb11de fix(medusa): Export data should always provide a file_key (#1785) 2022-07-10 11:38:27 +02:00
Adrien de Peretti 2d03634cfc feat(medusa, medusa-js, medusa-react): Implement Sales Channel deletion (#1804) 2022-07-07 10:47:51 +02:00
Adrien de Peretti 263a661031 feat(medusa, medusa-js, medusa-react): Implement Sales Channel retrieval (#1793) 2022-07-06 12:17:26 +02:00
Adrien de Peretti e53c06eab8 feat(medusa): Apply query transformers to Collection and CustomerGroups (#1667) 2022-07-02 13:01:52 +02:00
Adrien de Peretti fc1cbe72c7 feat(medusa-js): Create utils to stringify null values and respect object types (#1748)
### What

At the moment it is not possible to pass explicitly null on a property since the qs.stringify will transform it as `url?property=` which is then interpreted on the backend side as `""` value which is not what we expect.
The actual way to pass null value is to set the property as `{ prop: "null" }` in order to get the stringify method to send it correctly.

### How

I just created a small util that loop through the input object and transform all null values to "null" before being passed to the qs.stringify method.

The new util is only applied on the list batch job since this is for now the only place that require that behaviour.
2022-06-30 09:17:57 +00:00
Adrien de Peretti 9e0f65dee3 fix(medusa-react): Allow to not invalidate any cache (#1756)
### What
At the moment, it is not possible to not invalidate any queries>
Example, when we want to Create a new signed url, it does not require to invalidate any of the queries.
But the way it is done in the buildOptions, require to give either a key or an array of keys. 

### How
The behaviour for empty array is to invalidate all the queries and here we would like to be able to just pass undefined in order to not trigger the invalidation. The update allow the arg to be optional and check for undefined explicitly before choosing the invalidation
2022-06-30 09:01:31 +00:00
Adrien de Peretti c0f624ad3b feat(medusa): Allow to filter the batch jobs with nullable date (#1747) 2022-06-29 09:44:56 +02:00
Adrien de Peretti fb7abbf407 feat(medusa): Add file size calculation for product export (#1726) 2022-06-28 15:27:36 +02:00
Adrien de Peretti 89cb717461 fix(medusa): Product export strategy (#1713) 2022-06-27 10:48:56 +02:00
Adrien de Peretti 7b09b8c36c feat(medusa/product-export-strategy): Implement the Product export strategy (#1688) 2022-06-22 23:42:31 +02:00
Adrien de Peretti 0e34800573 refactor(medusa): cleanup, fix, migrate baseService and therefore fix errors (#1701)
* refactor(medusa): cleanup, fix, migrate baseService and therefore fix errors for ts version > 4.5

* test(medusa): Fix discount tests

* fix(medusa): build

* feat(medusa): Remove unnecessary await
2022-06-22 12:23:56 +02:00
Adrien de Peretti 93aaaa71bd feat(medusa): Update BuildQuery typings (#1672) 2022-06-17 10:03:51 +02:00
Adrien de PerettiPhilip KorsholmOliver Windall JuhlShahed Nasserdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
453688682c feat(medusa): Support batch-job API (#1547)
* feat(medusa): Implement confirm batch job end point

* feat(medusa): Implement confirm batch-job end point

* feat(medusa): Add create batch job end point and implementation

* feat(medusa): remove cancelled related

* feat(medusa): Remove unrelated content for batch job creation

* feat(medusa): Cleanup migration

* feat(medusa): Cleanup context

* fix(medusa): Batch-job service import

* feat(medusa): Update migration

* test(medusa): Fix batch job tests

* feat(medusa): Start batch job end point

* feat(medusa): Continue end points

* feat(medusa): Continue end points

* feat(medusa): Finalize batch-job end points

* style(medusa): Lint

* feat(medusa): Cleanup

* feat(medusa): Fix list-batch-job endpoint column selection

* feat(medusa): Batch-job feedback

* feat(medusa): Update create-batch-job endpoint doc

* test(integration-tests): Fix batch-job integration reguarding the response status code

* feat(medusa): Finalize rebase from develop

* feat(medusa): Extend batch job status with ready_at and failed_at

* feat(medusa): Update migration and tests accordingly

* feat(medusa): Update status order on batchJob

* feat(medusa): Enhance batchJobService status update

* style(medusa): Cleanup

* style(medusa): Typo

* style(medusa): Remove unnecessary comment

* cleanup(medusa): Address feedback

* test(integration-tests): Update naming and snapshots

* fix(medusa): Update validator

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>

* Fix(medusa): update validator

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>

* test(intergration-tests): Fix creates batch job

* test(integration-tests): Fix snapshot

* feat(medusa): Re-work status

* tests(integration-tests): Fix batch job

* feat(medusa): Addresses feedback

* fix(medusa): Revert package.json script

* feat(medusa/batch-job-api): Improve status management

* feat(medusa): Improve batch job status and remove some context validation from the service

* feat(medusa): BatchJob api merge params

* feat(medusa): Apply last changes on the batch job service

* Update packages/medusa/src/services/batch-job.ts

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* feat(medusa): BatchJobStrategy and loaders (#1434)

* add batch job strategy interface

* update plugin loaders

* remove comment

* make map async

* ensure that only one of each strategy is registered

* register strategies plural

* add identifier and batchType properties

* extend batch job strategy identification method

* initial test

* update loaders to accomodate different ways of accessing batch job strategies

* identifier batch type field

* redo merge in plugins

* update interface and load only js files

* use switches instead of elif

* remove comments

* use static properties for strategy registration

* update tests

* fix unit tests

* update test names

* update isBatchJobStrategy method

* add check for TransactionBaseService in services for plugins

* update interfaces export

* update batchjob strategy interface with a prepare script

* update loaders

* update batchjob strategy interface

* remove everything but public interface methods from batchJobStrategy

* add default implementation to prepareBathJobForProcessing

* remove unused import

* docs: Add Services reference (#1548)

* added events reference

* add upgrade guide for 1.3.0

* Update 1-3-0.md

* merge 1.3.0 with 1.3.1

* rename to 1.3.0

* added paypal documentation

* Improve storefront quickstart documents

* chore(deps): bump sqlite3 from 5.0.2 to 5.0.3 (#1453)

Bumps [sqlite3](https://github.com/TryGhost/node-sqlite3) from 5.0.2 to 5.0.3.
- [Release notes](https://github.com/TryGhost/node-sqlite3/releases)
- [Changelog](https://github.com/TryGhost/node-sqlite3/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TryGhost/node-sqlite3/compare/v5.0.2...v5.0.3)

* fix: Issue with cache in CI pipeline

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <shahednasser@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-16 13:57:18 +02:00
Adrien de Peretti 9a3ff32b42 refactor(medusa): Convert DraftOrderService to TS (#1259) 2022-06-13 20:29:23 +02:00
Adrien de Peretti 28ddf10446 fix(medusa): Plugin loader must also check for TransactionBaseService (#1601) 2022-06-13 17:53:52 +02:00
Adrien de Peretti 012513b6a1 feat(medusa-cli): Allow to revert migrations from the CLI (#1353) 2022-06-13 14:15:09 +02:00
Adrien de Peretti 3359e189a7 feat(medusa): Support transformQuery/Body middleware, introduction of pipe feature (#1593)
* feat(medusa): Support transformQuery middleware

* feat(medusa): Add support for transformBody

* test(medusa): Fix unit tests

* feat(medusa): Cleanup import

* feat(medusa): Update pipe required fields

* feat(medusa): Cleanup

* feat(medusa): Types cleanup

* feat(medusa): Types cleanup

* feat(medusa): Improve global typings and add one more example

* fix(medusa): Wrong wording in the error for prepareListQuery utility
2022-06-10 16:25:09 +02:00
Adrien de Peretti a605622bcb refactor(medusa): Migrate StoreService to TS (#1413) 2022-06-09 19:46:50 +01:00
Adrien de Peretti 5172b21d09 refactor(medusa): Refactor and fix EventBusService (#1377) 2022-06-09 17:18:22 +01:00
Adrien de Peretti 78bd61abe1 Refactor: claim service to TS + refactoring (#1287) 2022-06-09 10:29:44 +01:00
Adrien de Peretti 63bf684e66 refactor(medusa): Migrate middlewares to ts (#1469) 2022-06-08 14:52:45 +01:00
Adrien de Peretti d98cd85d23 feat(medusa): Migrate utils to TS (#1415) 2022-06-08 11:05:24 +01:00
Adrien de Peretti d7a3218fbe test(medusa): Add few tests on PriceListService#update method (#1554) 2022-05-31 09:26:42 +02:00
Adrien de Peretti d0c679fc7e feat(medusa): Export BaseEntity/SoftDeletableEntity from the core (#1594) 2022-05-30 17:47:20 +02:00
Adrien de Peretti fa031fd28b feat(medusa): Support deleting prices from a price list by product or variant (#1555) 2022-05-30 09:41:57 +02:00
Adrien de Peretti 3503651ff2 Refactor(medusa): Create a BaseEntity and SoftDeletableEntity base class for common columns (#1315)
* refactor(medusa): Move some column to a base entity to make it easier to add new models without forgetting some columns

* styles(medusa): Cleanup models

* fix(medusa): typings due to model typings update

* feat(medusa): Cleanup models

* fix(medusa): A model must not return the generateId as part of the entity

* fix(medusa): Plugin integration snapshot

* fix(medusa): Typings from discount-rule-migration scripts

* refactor(medusa): Introduct BaseEntity/SoftDeletableEntity that the entity extends

* styles(medusa): Fix models linting

* test(medusa): Fix integration plugin tests

* feat(medusa): Create generateEntityId standalong function utility and update config to properly supprt ts spec files

* feat(medusa): Update entities to use the new utils to generate and apply the id

* test(medusa): Fix test suits

* feat(medusa): Improve generateEntityId utility
2022-05-23 14:27:58 +02:00
Adrien de Peretti 4489b75f5a feat(medusa): List batch jobs + Introduce composable handler pattern (#1541) 2022-05-20 10:22:42 +02:00
Adrien de Peretti 58387936c9 fix(medusa-payment-paypal): Should not throw when canceling already canceled payment (#1470) 2022-05-19 18:28:51 +02:00
Adrien de Peretti edeac8ac72 feat(medusa): Add /admin/products/:id/variants end point (#1471)
* feat(medusa): Add /admin/products/:id/variants end point

* test(medusa): Fix get-variants test casees

* feat(medusa): Include the config to the ProdutService#retrieveVariants as a method parameter

* feat(medusa): Improve get-variants endpoint

* feat(medusa): Improve get-variants endpoint

* test(medusa): Fix unit tests

* test(medusa): Fix unit tests

* feat(medusa): Improve typings

* feat(medusa): Update according to feedback

* feat(medusa): Update according to feedback

* test(medusa): Fix list-variants tests

* feat(medusa): Getting the variants from the product end point should use the productVariantService

* fix(medusa): list-variants expand possibly undefined

* Fix(medusa): List-variants endpoint

* fix(medusa): Tests suite for list-variant

* test(integration-tests): Fix yarn lock

* test(integration-tests): Fix yarn lock
2022-05-16 12:19:34 +02:00
Adrien de Peretti e31fe4af16 fix(medusa): CartService fix discounts empty array check on update (#1516)
* fix(medusa): CartService fix constraint check

* test(medusa): CartService test case, remove all discount if empty array is passed
2022-05-16 10:06:50 +02:00
Adrien de Peretti 0b2a3a0f0e Merge pull request #1475 from medusajs/fix-cartServiceCreateLostShippingAddress 2022-05-11 22:02:24 +02:00
Adrien de Peretti 327614e126 feat(medusa-payment-stripe): Ability to add payment description and improve status resolution (#1404) 2022-05-10 17:34:41 +02:00
adrien2p 1c5647f69e style(medusa): Cleanup some tests case naming 2022-05-10 16:28:10 +02:00
adrien2p 1c3c62e966 test(medusa): Fix integration 2022-05-10 14:15:08 +02:00
adrien2p d9bc6b4c41 style(medusa): Remove unused dependencies 2022-05-10 14:15:08 +02:00
Adrien de Peretti 65186036b5 Merge branch 'develop' into fix-cartServiceCreateLostShippingAddress 2022-05-10 11:16:19 +02:00
adrien2p 9b5354502f test(medusa): Fix test pipelines 2022-05-10 11:09:52 +02:00
Adrien de Peretti eae37d8449 Merge pull request #1344 from adrien2p/feat-improveNewBaseService
feat(medusa): Move BaseService to the core and refactor it as part of the new TransactionBaseService
2022-05-09 17:05:18 +02:00
Adrien de Peretti 90870292c6 fix(medusa): Remove line-item.js file (#1414) 2022-05-09 09:52:15 +02:00
Adrien de Peretti c67d6bee30 fix(medusa): PluginLoaders when loading services should only look for js files (#1473) 2022-05-09 09:42:47 +02:00
Adrien de Peretti 525910f72a fix(medusa-file-spaces): Allow duplicate filenames (#1474) 2022-05-09 09:41:18 +02:00
adrien2p f5edaf51ea fix(medusa): Proper fix of the cart service 2022-05-06 10:31:02 +02:00
adrien2p 32a65d27fc test(medusa): Add a test to check that the shipping_address is not erase when an id is have been given 2022-05-05 15:28:33 +02:00
adrien2p c442be47d4 fix(medusa): CartService lost shipping address when using the id 2022-05-05 15:07:00 +02:00
Adrien de Peretti 3c75a65792 fix(medusa): MoneyAmountRepository#findManyForVariantInRegion sql statement for constraint related to price_list (#1462) 2022-05-05 07:56:34 +02:00
adrien2p 3ad91741b2 feat(medusa): Move some typings into the common types 2022-05-04 16:01:04 +02:00
adrien2p f7ef3aac36 feat(medusa): Rename base-service.spec to transaction-base-service.spec 2022-05-03 09:22:00 +02:00
adrien2p 978ee98dc3 refactor(medusa): Improve proposal in cartService use arguments to pass to the super 2022-05-02 18:08:03 +02:00
adrien2p ff9ff21487 feat(medusa): Update TransactionBaseService methods visibility 2022-05-02 13:38:15 +02:00
adrien2p b90291b18d feat(medusa): Improve buildQuery as well as refactor the cart service as an example 2022-04-21 13:48:16 +02:00
adrien2p e7e715ac17 feat(medusa): Split base service to its related TransactionBaseService and utilities methods when required 2022-04-21 13:48:16 +02:00
adrien2p 99146b7403 feat(medusa): Export transaction related methods to the transactionBaseService 2022-04-21 13:48:16 +02:00
adrien2p 1499bc52e3 feat(medusa): Add writable type 2022-04-21 13:48:16 +02:00
adrien2p bfb81b8b32 feat(medusa): Improve base-service 2022-04-21 13:48:16 +02:00
Adrien de Peretti 313cb0658b feat(medusa): Improve config loading (#1290) 2022-04-21 12:49:56 +02:00
Adrien de Peretti 89a6de4660 fix(medusa): Remove updatePaymentMethod store cart route (#1382) 2022-04-21 12:43:22 +02:00
Adrien de Peretti 530bbd4cac refactor: LineItemService migration to TS + refactoring + fix (#1254)
* refactor(medusa): LineItemService migration to TS + refactoring

* feat(medusa): Cleanup line-item service

* feat(medusa): Rebase develop

* test(medusa): Fix integration cart tests

* fix(medusa): Cart service updateUnitPrices
2022-04-14 20:53:35 +02:00
Adrien de Peretti 6830a12b46 feat(medusa): Improve exported medusa API (#1335)
* feat(medusa): Improve exported medusa API
Avoid to always have to import from @medusajs/medusa/dist/*

* feat(medusa): The Model loaders should ignore the index file

* fix(medusa): swap model typo
2022-04-14 16:01:10 +02:00
Adrien de Peretti 12c06b4c9d refactor(medusa): Cleanup and fix CartService (#1306)
* refactor(medusa): Cleanup + fix

* styles(medusa): Lint

* refactor(medusa): Finalize cleanup

* feat(medusa): Prefer the usage of bulk operations instead of sequential/conccurent operations

* feat(medusa): Improve cart service

* refactor(medusa): Explicitly specifying protected methods when needed as well as enfore the usage of the local transactionManager_ in those methods

* tests(medusa): Fix tests according to the new changes

* feat(medusa): Cleanup after rebase

* test(medusa): Fix cart service tests
2022-04-13 18:35:13 +02:00
Adrien de Peretti 3f19a3c4d5 refactor(medusa-interfaces): Migrate baseService to TS + improve the service it self (#1314)
* refactor(medusa-interfaces): Migrate baseService to TS + improve the service it self

* feat(medusa,medusa-interfaces): Cleanup and move base-service to medusa core

* medusa(medusa, medusa-interfaces): Improve typings

* medusa(medusa, medusa-interfaces): buildQuery make properties optionals

* feat(medusa-interfaces): Revert temporarly the medusa-interfaces while moving the base-service to the medusa core

* feat(medusa): Improve base-service typings

* feat(medusa): Remove template that is not necessary
2022-04-13 17:42:09 +02:00
Adrien de Peretti 5f9197a656 refactor(medusa): Loaders to TS (#1288)
* refactor(medusa): Loaders

* refactor(medusa): Improve MedusaContainer typings

* refactor(medusa): Improve MedusaContainer typings
2022-04-03 21:16:17 +02:00
Adrien de Peretti ab2d81f786 fix(medusa): Lint and missing transaction usage (#1297) 2022-04-03 21:01:43 +02:00
Adrien de PerettiandSebastian Rindom 8a2e4f74ff Feat(medusajs) Allow to pass custom headers (#1009)
* Feat(medusajs) Allow to pass custom headers

* fix: axios exprexted output

* fix: integration test cart

* refactor: Update types object > Record<string, any>

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-25 18:53:49 +01:00
Adrien de Peretti 88ac3c0785 Fix() Try to load index files (#1016) 2022-02-25 18:53:49 +01:00
Adrien de PerettiandSebastian Rindom 22d387dcce Feat(medusajs) Allow to pass custom headers (#1009)
* Feat(medusajs) Allow to pass custom headers

* fix: axios exprexted output

* fix: integration test cart

* refactor: Update types object > Record<string, any>

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2022-02-17 16:50:03 +01:00
Adrien de Peretti 6f339e366a Fix() Try to load index files (#1016) 2022-02-15 10:39:29 +01:00
Adrien de Peretti f115855282 Fix(request) retries is broken (#1005)
At the moment, when the method `shouldRetryCondition` is called, the condition are using OR which does not take in count 0 which is also considered as false
a simple fix is the usage of nullish coalescing
2022-02-01 17:25:16 +01:00
Adrien de Peretti ec7c10e446 Fix(medusa) product-option values type (#983) 2022-01-10 14:50:06 +01:00
Adrien de Peretti 0ac52b70fa fix: Type in AdminProductListTagsRes to use tags instead of types (#958) 2022-01-06 17:45:15 +01:00
Adrien de Peretti ae839513b8 Feat(plugins) Pass plugin options to the routes to be able to access specific options from the plugin configuration (#959) 2022-01-04 15:56:00 +01:00
Adrien de Peretti 77d2014ab4 Fix(admin) create product type tag (#963) 2022-01-03 18:13:04 +01:00
Adrien de Peretti 4f2d2d8b5e fix(medusa) Enforce authentication on users and invites (#953) 2021-12-29 12:56:40 +01:00
Adrien de Peretti a0b6946b5f Fix(medusa/loaders/plugins) jsdoc (#904) 2021-12-09 12:06:43 +01:00
Adrien de Peretti b212afae50 Feat() Add readme to integration-tests (#862) 2021-12-08 09:54:45 +01:00