diff --git a/.github/workflows/build-release-publish.yml b/.github/workflows/build-release-publish.yml index 93e8dfc1..e1ef9859 100644 --- a/.github/workflows/build-release-publish.yml +++ b/.github/workflows/build-release-publish.yml @@ -61,7 +61,7 @@ jobs: run: | cp .env.dist .env docker compose build - docker compose up --detach --wait + docker compose --profile cicd up --detach --wait env: DOCKER_IMAGE_PRESTASHOP: prestashop/prestashop-flashlight:${{matrix.ps_version}} working-directory: e2e-env @@ -74,7 +74,7 @@ jobs: if: failure() run: | docker compose logs cloudsync-mock - docker compose down -v + docker compose --profile cicd down -v working-directory: e2e-env upload_release_assets: diff --git a/.github/workflows/quality-check.yml b/.github/workflows/quality-check.yml index beedffd6..a53db021 100644 --- a/.github/workflows/quality-check.yml +++ b/.github/workflows/quality-check.yml @@ -56,7 +56,6 @@ jobs: strategy: fail-fast: false matrix: - # @TODO: "1.6.1.24" is temporarily disabled here ps_version: ["1.6.1.11", "1.7.8.10", "8.1.6"] steps: - name: Checkout @@ -115,6 +114,9 @@ jobs: path: vendor key: php-${{ hashFiles('composer.lock') }} + - name: install php dependencies + run: composer install + - name: Install dependencies and setup e2e run: pnpm install --no-optional --force working-directory: e2e @@ -123,7 +125,7 @@ jobs: run: | cp .env.dist .env docker compose build - docker compose up --detach --wait + docker compose --profile cicd up --detach --wait env: DOCKER_IMAGE_PRESTASHOP: prestashop/prestashop-flashlight:${{matrix.ps_version}} working-directory: e2e-env @@ -136,7 +138,7 @@ jobs: if: failure() run: | docker compose logs cloudsync-mock prestashop - docker compose down -v + docker compose --profile cicd down -v working-directory: e2e-env e2e-lint: diff --git a/.gitignore b/.gitignore index 3ccb114b..a67af851 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ e2e/dumps sonar-project.properties *.cache + +### Mytuns +credentials.json diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..3576e0c8 --- /dev/null +++ b/.htaccess @@ -0,0 +1,14 @@ +# Apache 2.2 + + + order allow,deny + deny from all + + + +# Apache 2.4 + + + Require all denied + + diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index aacacbf4..d73df30c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -9,6 +9,7 @@ ->exclude('vendor'); $config = (new PrestaShop\CodingStandards\CsFixer\Config()) + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setUsingCache(false) ->setFinder($finder); diff --git a/.zip-contents b/.zip-contents index 5d957751..49275582 100644 --- a/.zip-contents +++ b/.zip-contents @@ -11,3 +11,4 @@ LICENSE README.md composer.json composer.lock +.htaccess diff --git a/Makefile b/Makefile index 168defc4..dff473e2 100644 --- a/Makefile +++ b/Makefile @@ -151,9 +151,14 @@ docker-phpunit-cov: tools/vendor .PHONY: phpstan docker-phpstan phpstan: tools/vendor prestashop/prestashop-${PS_VERSION} phpstan analyse --memory-limit=-1 --configuration=./tests/phpstan/phpstan-local.neon; -docker-phpstan: +docker-phpstan: tools/vendor @$(call in_docker,/usr/bin/phpstan,analyse --memory-limit=-1 --configuration=./tests/phpstan/phpstan-docker.neon) +# target: header-stamp - check Headers of PHP files +.PHONY:header-stamp +header-stamp: + tools/vendor/bin/header-stamp --license=tools/vendor/prestashop/header-stamp/assets/osl3.txt --exclude=vendor,tools,e2e,e2e-env,tests,composer.json,scoper.inc.php + define COMMENT Fixme: add "allure-framework/allure-phpunit" in composer.json to solve this. Currently failing to resolve devDeps: @@ -178,6 +183,7 @@ define create_module cp -r $(shell cat .zip-contents) ${TMP_DIR}/${MODULE_NAME}; $(call replace_version,${TMP_DIR}/${MODULE_NAME},${SEM_VERSION}) ./tools/vendor/bin/autoindex prestashop:add:index ${TMP_DIR} + tools/vendor/bin/header-stamp --target=${TMP_DIR}/${MODULE_NAME} --license=tools/vendor/prestashop/header-stamp/assets/osl3.txt --exclude=vendor,e2e,e2e-env,tests,composer.json,scoper.inc.php cp $1 ${TMP_DIR}/${MODULE_NAME}/config/parameters.yml cd ${TMP_DIR}/${MODULE_NAME} && composer dump-autoload endef diff --git a/README.md b/README.md index be172d4b..4de99d30 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,24 @@ ## Compatibility matrix | PrestaShop platform | PHP | PS EventBus | -| ------------------- | ---- | ----------- | -| 8.0 | 7.1+ | From 2.x | -| 1.7.3-1.7.8 | 7.1+ | From 2.x | -| 1.6.1.11 - 1.7.2.5 | 7.1 | From 3.1 | +| ------------------- | ---- | ----------------------- | +| 8.0 | 7.1+ | From 2.x - to latest | +| 1.7.3-1.7.8 | 7.1+ | From 2.x - to latest | +| 1.6.1.11 - 1.7.2.5 | 7.1 | From 3.1 - to latest | PS Accounts compatibility matrix [can be viewed here](https://github.com/PrestaShopCorp/ps_accounts#compatibility-matrix). -### Product Images Issue in PHP 8.1 +#### Product Images Issue in PHP 8.1 Please note that starting from PHP 8.1, product images may be missing due to a known issue. This is a recognized problem and is being tracked in the PrestaShop repository. You can follow the progress and find more details about the resolution [here](https://github.com/PrestaShop/PrestaShop/issues/36836). +### BREAKING CHANGES + +Since version 4.0, all API endpoints are grouped under a single controller "apiShopContent.php" (except for the healthcheck). The route to call is now unique, and the shopContent is no longer a specific endpoint but a query parameter of the request: +```http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=products``` + ## Use ```sh @@ -99,22 +104,78 @@ Dev requirements: Or an up-to-date [Docker engine](https://docs.docker.com/engine/install). -## List of missing data in a database and why is missing - -| Object content | Reason | Added in PS version | Link with more info | -|:----------------------------------:|:--------------------:|:-------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| currency.precision | row missing in table | 1.7.6.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/37807f66b40b0cebb365ef952e919be15e9d6b2f#diff-3f41d3529ffdbfd1b994927eb91826a32a0560697025a734cf128a2c8e092a45R124) | -| employee.has_enabled_gravatar | row missing in table | 1.7.8.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/20f1d9fe8a03559dfa9d1f7109de1f70c99f1874#diff-cde6a9d4a58afb13ff068801ee09c0e712c5e90b0cbf5632a0cc965f15cb6802R107) | -| product.additional_delivery_time | row missing in table | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260) | -| product.delivery_in_stock | row missing in table | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260) | -| product.delivery_out_stock | row missing in table | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260) | -| stock.location | row missing in table | 1.7.5.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/4c7d58a905dfb61c7fb2ef4a1f9b4fab2a8d8ecb#diff-e57fb1deeaab9e9079505333394d58f0bf7bb40280b4382aad1278c08c73e2e8R58) | -| store_lang | table missing | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004) | -| wishlist¹ | table missing | n/a | [Prestashop Addons](https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html) | -| taxonomy² | table missing | n/a | [Prestashop Addons](https://addons.prestashop.com/fr/produits-sur-facebook-reseaux-sociaux/50291-prestashop-social-with-facebook-instagram.htmll) | +### How to add new shop content +Let's take the example of adding a shopContent named "plane". + +Add the shop content in the [Config.php](src/Config/Config.php) file (create a constant, and add it to the SHOP_CONTENTS array). +```PHP +const COLLECTION_PLANES = 'planes'; + +const SHOP_CONTENTS = [ + ... + self::COLLECTION_PLANES + ... +]; +``` + +Create a service "planesService.php" (in plural) in the [shop content services folder](src/Service/ShopContent/) that extends the [ShopContentAbstractService](src/Service/ShopContent/ShopContentAbstractService.php) and implements the [ShopContentServiceInterface.php](src/Service/ShopContent/ShopContentServiceInterface.php) interface. For the method structure, use the existing base on all other shop content services to maintain consistency. +```PHP +class PlanesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + ... +} +``` +_Don't missing to declare this new service to [service.yml](config/front/services.yml) file._ + +Then create a repository PlaneRepository.php (in singular) in the [Repository](src/Repository/) folder that extends the [AbstractRepository.php](src/Repository/AbstractRepository.php) class and implements the [RepositoryInterface.php](src/Repository/RepositoryInterface.php) interface. Similarly, maintain consistency with other shop content repositories. +```PHP +class PlaneRepository extends AbstractRepository implements RepositoryInterface +{ + ... +} +``` +_Don't missing to declare this new repository to [repository.yml](config/common/repository.yml) file._ + +Add your shop content in the [e2e config file](e2e/src/helpers/shop-contents.ts). +```javascript +export const shopContentMapping = { + ... + planes: 'planes' + ... +} +``` + +Run the tests once to generate the necessary dumps (they will be present in the [dump](e2e/dumps/) folder). Once the test is performed (and failed), copy the planes.json file, and paste it into the fixture folder for your given version. Do the same for each version (if the versions return different results). + +You can run the tests again and ensure everything is green. + +In case your shopContent cannot return results (missing data in the tables), please add a planes.json file in the folders of each version containing an empty array. + +### List of missing data in a database and why is missing + +| Object content | Reason | Added in PS version | Link with more info | +|:----------------------------------:|:--------------------:|:-------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| +| currency.precision | row missing in table | 1.7.6.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/37807f66b40b0cebb365ef952e919be15e9d6b2f#diff-3f41d3529ffdbfd1b994927eb91826a32a0560697025a734cf128a2c8e092a45R124) | +| employee.has_enabled_gravatar | row missing in table | 1.7.8.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/20f1d9fe8a03559dfa9d1f7109de1f70c99f1874#diff-cde6a9d4a58afb13ff068801ee09c0e712c5e90b0cbf5632a0cc965f15cb6802R107) | +| product.additional_delivery_time | row missing in table | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260) | +| product.delivery_in_stock | row missing in table | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260) | +| product.delivery_out_stock | row missing in table | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260) | +| stock.location | row missing in table | 1.7.5.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/4c7d58a905dfb61c7fb2ef4a1f9b4fab2a8d8ecb#diff-e57fb1deeaab9e9079505333394d58f0bf7bb40280b4382aad1278c08c73e2e8R58) | +| store_lang | table missing | 1.7.3.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004) | +| wishlist¹ | table missing | n/a | [Prestashop Addons](https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html) | +| taxonomy² | table missing | n/a | [Prestashop Addons](https://addons.prestashop.com/fr/produits-sur-facebook-reseaux-sociaux/50291-prestashop-social-with-facebook-instagram.htmll) | | stock_available. physical_quantity | row missing in table | 1.7.2.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/2a3269ad93b1985f2615d6604458061d4989f0ea#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2186) | | stock_available. reserved_quantity | row missing in table | 1.7.2.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/2a3269ad93b1985f2615d6604458061d4989f0ea#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2186) | -| languages.locale | row missing in table | 1.7.0.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/481111b8274ed005e1c4a8ce2cf2b3ebbeb9a270#diff-c123d3d30d9c9e012a826a21887fccce6600a2f2a848a58d5910e55f0f8f5093R41) | +| languages.locale | row missing in table | 1.7.0.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/481111b8274ed005e1c4a8ce2cf2b3ebbeb9a270#diff-c123d3d30d9c9e012a826a21887fccce6600a2f2a848a58d5910e55f0f8f5093R41) | +| products.mpn | row missing in table | 1.7.7.0 | [github](https://github.com/PrestaShop/PrestaShop/commit/75fcc335a85c4e3acb2444ef9584590a59fc2d62#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R1615) | ¹ Feature enabled only with PsWishlist module
² Feature enabled only with PsFacebook module + +### Debugging +There are 3 variables that are passed globally from the apiShopContent file to the end of the chain (repositories and errorHandler): +- PS_EVENTBUS_EXPLAIN_SQL_ENABLED +- PS_EVENTBUS_VERBOSE_ENABLED +- PS_EVENTBUS_LOGS_ENABLED + +These variables are defined via the PHP function define() and reused in the files mentioned above. The reason for this usage is to avoid having to pass these variables through the entire execution chain to retrieve them at the end of the chain (e.g., apiShopContent => frontService => shopContentService => shopContentRepository). diff --git a/composer.lock b/composer.lock index cba5142c..d7659e4b 100644 --- a/composer.lock +++ b/composer.lock @@ -1504,5 +1504,5 @@ "platform-overrides": { "php": "5.6" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/config/admin/services.yml b/config/admin/services.yml index 64714c35..521fb78a 100644 --- a/config/admin/services.yml +++ b/config/admin/services.yml @@ -1,6 +1,6 @@ imports: - - { resource: ../common.yml } - - { resource: ../front/repository.yml } + - { resource: ../common/common.yml } + - { resource: ../common/repository.yml } - { resource: ../front/services.yml } services: diff --git a/config/common.yml b/config/common.yml deleted file mode 100644 index bfabce66..00000000 --- a/config/common.yml +++ /dev/null @@ -1,28 +0,0 @@ -imports: - - { resource: parameters.yml } - - { resource: common/handler.yml } - -services: - ps_eventbus.db: - class: Db - public: true - factory: ['Db', 'getInstance'] - - ps_eventbus: - class: 'Ps_eventbus' - public: true - factory: ['Module', 'getInstanceByName'] - arguments: - - 'ps_eventbus' - - ps_eventbus.helper.module: - class: 'PrestaShop\Module\PsEventbus\Helper\ModuleHelper' - public: true - - PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService: - class: PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService - public: true - arguments: - - '@ps_eventbus.helper.module' - - diff --git a/config/common/common.yml b/config/common/common.yml new file mode 100644 index 00000000..431885cc --- /dev/null +++ b/config/common/common.yml @@ -0,0 +1,55 @@ +imports: + - { resource: ../parameters.yml } + +services: + ps_eventbus.db: + class: Db + public: true + factory: ['Db', 'getInstance'] + + ps_eventbus: + class: 'Ps_eventbus' + public: true + factory: ['Module', 'getInstanceByName'] + arguments: + - 'ps_eventbus' + + ps_eventbus.context: + class: 'Context' + public: true + factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getContext'] + + ps_eventbus.helper.module: + class: 'PrestaShop\Module\PsEventbus\Helper\ModuleHelper' + public: true + + PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService: + class: PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService + public: true + arguments: + - '@ps_eventbus.helper.module' + + PrestaShop\Module\PsEventbus\Formatter\JsonFormatter: + class: PrestaShop\Module\PsEventbus\Formatter\JsonFormatter + public: true + + PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter: + class: PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter + public: true + + PrestaShop\Module\PsEventbus\Service\ProxyService: + class: PrestaShop\Module\PsEventbus\Service\ProxyService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Api\CollectorApiClient' + - '@PrestaShop\Module\PsEventbus\Formatter\JsonFormatter' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' + + PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler: + class: PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler + public: true + arguments: + - '@ps_eventbus' + - '@PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService' + - '%ps_eventbus.sentry_dsn%' + - '%ps_eventbus.sentry_env%' diff --git a/config/common/handler.yml b/config/common/handler.yml deleted file mode 100644 index 7dd3eea9..00000000 --- a/config/common/handler.yml +++ /dev/null @@ -1,11 +0,0 @@ -services: - PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface: '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' - - PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler: - class: PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler - public: true - arguments: - - '@ps_eventbus' - - '@PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService' - - '%ps_eventbus.sentry_dsn%' - - '%ps_eventbus.sentry_env%' diff --git a/config/front/repository.yml b/config/common/repository.yml similarity index 54% rename from config/front/repository.yml rename to config/common/repository.yml index a26fee3e..3b475815 100644 --- a/config/front/repository.yml +++ b/config/common/repository.yml @@ -1,226 +1,152 @@ services: - PrestaShop\Module\PsEventbus\Repository\LanguageRepository: - class: PrestaShop\Module\PsEventbus\Repository\LanguageRepository - public: true - arguments: - - '@ps_eventbus.context' - - PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository: - class: PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository - public: true - - PrestaShop\Module\PsEventbus\Repository\EventbusSyncRepository: - class: PrestaShop\Module\PsEventbus\Repository\EventbusSyncRepository - public: true - arguments: - - '@ps_eventbus.context' - - PrestaShop\Module\PsEventbus\Repository\CategoryRepository: - class: PrestaShop\Module\PsEventbus\Repository\CategoryRepository + PrestaShop\Module\PsEventbus\Repository\SyncRepository: + class: PrestaShop\Module\PsEventbus\Repository\SyncRepository public: true arguments: - - '@ps_eventbus.context' + - '@=service("ps_eventbus").getContext()' - PrestaShop\Module\PsEventbus\Repository\CustomerRepository: - class: PrestaShop\Module\PsEventbus\Repository\CustomerRepository + PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository: + class: PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository public: true arguments: - - '@ps_eventbus.context' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' - PrestaShop\Module\PsEventbus\Repository\CurrencyRepository: - class: PrestaShop\Module\PsEventbus\Repository\CurrencyRepository - public: true - - PrestaShop\Module\PsEventbus\Repository\ModuleRepository: - class: PrestaShop\Module\PsEventbus\Repository\ModuleRepository - public: true - - PrestaShop\Module\PsEventbus\Repository\ProductRepository: - class: PrestaShop\Module\PsEventbus\Repository\ProductRepository + PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository: + class: PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\ProductCarrierRepository: - class: PrestaShop\Module\PsEventbus\Repository\ProductCarrierRepository - public: true - arguments: - - '@ps_eventbus.context' +############################################################################################################ +###################################### SHOP CONTENT REPOSITORIES ########################################### +############################################################################################################ - PrestaShop\Module\PsEventbus\Repository\ServerInformationRepository: - class: PrestaShop\Module\PsEventbus\Repository\ServerInformationRepository - public: true - arguments: - - '@ps_eventbus.context' - - '@PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService' - - '@PrestaShop\Module\PsEventbus\Repository\CurrencyRepository' - - '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository' - - '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository' - - '@PrestaShop\Module\PsEventbus\Repository\ShopRepository' - - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface' - - '%ps_eventbus.sync_api_url%' - - '%ps_eventbus.live_sync_api_url%' - - '%ps_eventbus.proxy_api_url%' - - PrestaShop\Module\PsEventbus\Repository\ThemeRepository: - class: PrestaShop\Module\PsEventbus\Repository\ThemeRepository - public: true - arguments: - - '@ps_eventbus.context' - - PrestaShop\Module\PsEventbus\Repository\OrderRepository: - class: PrestaShop\Module\PsEventbus\Repository\OrderRepository + PrestaShop\Module\PsEventbus\Repository\BundleRepository: + class: PrestaShop\Module\PsEventbus\Repository\BundleRepository public: true - PrestaShop\Module\PsEventbus\Repository\OrderDetailsRepository: - class: PrestaShop\Module\PsEventbus\Repository\OrderDetailsRepository + PrestaShop\Module\PsEventbus\Repository\CarrierRepository: + class: PrestaShop\Module\PsEventbus\Repository\CarrierRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\OrderHistoryRepository: - class: PrestaShop\Module\PsEventbus\Repository\OrderHistoryRepository + PrestaShop\Module\PsEventbus\Repository\CarrierDetailRepository: + class: PrestaShop\Module\PsEventbus\Repository\CarrierDetailRepository public: true - PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository: - class: PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository + PrestaShop\Module\PsEventbus\Repository\CarrierTaxeRepository: + class: PrestaShop\Module\PsEventbus\Repository\CarrierTaxeRepository public: true PrestaShop\Module\PsEventbus\Repository\CartRepository: class: PrestaShop\Module\PsEventbus\Repository\CartRepository public: true - arguments: - - '@ps_eventbus.context' PrestaShop\Module\PsEventbus\Repository\CartProductRepository: class: PrestaShop\Module\PsEventbus\Repository\CartProductRepository public: true - arguments: - - '@ps_eventbus.context' PrestaShop\Module\PsEventbus\Repository\CartRuleRepository: class: PrestaShop\Module\PsEventbus\Repository\CartRuleRepository public: true - PrestaShop\Module\PsEventbus\Repository\GoogleTaxonomyRepository: - class: PrestaShop\Module\PsEventbus\Repository\GoogleTaxonomyRepository + PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository: + class: PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository public: true - PrestaShop\Module\PsEventbus\Repository\DeletedObjectsRepository: - class: PrestaShop\Module\PsEventbus\Repository\DeletedObjectsRepository + PrestaShop\Module\PsEventbus\Repository\CategoryRepository: + class: PrestaShop\Module\PsEventbus\Repository\CategoryRepository + public: true + + PrestaShop\Module\PsEventbus\Repository\CustomerRepository: + class: PrestaShop\Module\PsEventbus\Repository\CustomerRepository public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface' - PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository: - class: PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository + PrestaShop\Module\PsEventbus\Repository\CurrencyRepository: + class: PrestaShop\Module\PsEventbus\Repository\CurrencyRepository public: true - arguments: - - '@ps_eventbus.context' - - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface' - PrestaShop\Module\PsEventbus\Repository\ShopRepository: - class: PrestaShop\Module\PsEventbus\Repository\ShopRepository + PrestaShop\Module\PsEventbus\Repository\EmployeeRepository: + class: PrestaShop\Module\PsEventbus\Repository\EmployeeRepository public: true - PrestaShop\Module\PsEventbus\Repository\CountryRepository: - class: PrestaShop\Module\PsEventbus\Repository\CountryRepository + PrestaShop\Module\PsEventbus\Repository\ImageRepository: + class: PrestaShop\Module\PsEventbus\Repository\ImageRepository + public: true + + PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository: + class: PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\StateRepository: - class: PrestaShop\Module\PsEventbus\Repository\StateRepository + PrestaShop\Module\PsEventbus\Repository\ModuleRepository: + class: PrestaShop\Module\PsEventbus\Repository\ModuleRepository public: true - PrestaShop\Module\PsEventbus\Repository\TaxRepository: - class: PrestaShop\Module\PsEventbus\Repository\TaxRepository + PrestaShop\Module\PsEventbus\Repository\LanguageRepository: + class: PrestaShop\Module\PsEventbus\Repository\LanguageRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\CarrierRepository: - class: PrestaShop\Module\PsEventbus\Repository\CarrierRepository + PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository: + class: PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\CustomPriceRepository: - class: PrestaShop\Module\PsEventbus\Repository\CustomPriceRepository + PrestaShop\Module\PsEventbus\Repository\OrderRepository: + class: PrestaShop\Module\PsEventbus\Repository\OrderRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\BundleRepository: - class: PrestaShop\Module\PsEventbus\Repository\BundleRepository + PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository: + class: PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository + public: true + + PrestaShop\Module\PsEventbus\Repository\OrderstatusHistoryRepository: + class: PrestaShop\Module\PsEventbus\Repository\OrderStatusHistoryRepository public: true - PrestaShop\Module\PsEventbus\Repository\WishlistRepository: - class: PrestaShop\Module\PsEventbus\Repository\WishlistRepository + PrestaShop\Module\PsEventbus\Repository\OrderDetailRepository: + class: PrestaShop\Module\PsEventbus\Repository\OrderDetailRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository: - class: PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository + PrestaShop\Module\PsEventbus\Repository\ProductRepository: + class: PrestaShop\Module\PsEventbus\Repository\ProductRepository public: true - PrestaShop\Module\PsEventbus\Repository\SpecificPriceRepository: - class: PrestaShop\Module\PsEventbus\Repository\SpecificPriceRepository + PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository: + class: PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository public: true - PrestaShop\Module\PsEventbus\Repository\StoreRepository: - class: PrestaShop\Module\PsEventbus\Repository\StoreRepository + PrestaShop\Module\PsEventbus\Repository\ShopRepository: + class: PrestaShop\Module\PsEventbus\Repository\ShopRepository public: true - arguments: - - '@ps_eventbus.context' PrestaShop\Module\PsEventbus\Repository\StockRepository: class: PrestaShop\Module\PsEventbus\Repository\StockRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\StockMvtRepository: - class: PrestaShop\Module\PsEventbus\Repository\StockMvtRepository + PrestaShop\Module\PsEventbus\Repository\StockMovementRepository: + class: PrestaShop\Module\PsEventbus\Repository\StockMovementRepository public: true - - PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository: - class: PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository + + PrestaShop\Module\PsEventbus\Repository\SpecificPriceRepository: + class: PrestaShop\Module\PsEventbus\Repository\SpecificPriceRepository public: true - arguments: - - '@ps_eventbus.context' PrestaShop\Module\PsEventbus\Repository\SupplierRepository: class: PrestaShop\Module\PsEventbus\Repository\SupplierRepository public: true - arguments: - - '@ps_eventbus.context' - PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository: - class: PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository + PrestaShop\Module\PsEventbus\Repository\StoreRepository: + class: PrestaShop\Module\PsEventbus\Repository\StoreRepository public: true - PrestaShop\Module\PsEventbus\Repository\EmployeeRepository: - class: PrestaShop\Module\PsEventbus\Repository\EmployeeRepository - public: true - arguments: - - '@ps_eventbus.context' - - PrestaShop\Module\PsEventbus\Repository\ImageRepository: - class: PrestaShop\Module\PsEventbus\Repository\ImageRepository + PrestaShop\Module\PsEventbus\Repository\TaxonomyRepository: + class: PrestaShop\Module\PsEventbus\Repository\TaxonomyRepository public: true - PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository: - class: PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository - public: true - PrestaShop\Module\PsEventbus\Repository\TranslationRepository: class: PrestaShop\Module\PsEventbus\Repository\TranslationRepository public: true - arguments: - - '@ps_eventbus.context' - - PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository: - class: PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository + + PrestaShop\Module\PsEventbus\Repository\WishlistRepository: + class: PrestaShop\Module\PsEventbus\Repository\WishlistRepository + public: true + + PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository: + class: PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository public: true diff --git a/config/front/builder.yml b/config/front/builder.yml deleted file mode 100644 index 1caea5db..00000000 --- a/config/front/builder.yml +++ /dev/null @@ -1,10 +0,0 @@ -services: - PrestaShop\Module\PsEventbus\Builder\CarrierBuilder: - class: PrestaShop\Module\PsEventbus\Builder\CarrierBuilder - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CarrierRepository' - - '@PrestaShop\Module\PsEventbus\Repository\CountryRepository' - - '@PrestaShop\Module\PsEventbus\Repository\StateRepository' - - '@PrestaShop\Module\PsEventbus\Repository\TaxRepository' - - '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository' diff --git a/config/front/context.yml b/config/front/context.yml deleted file mode 100644 index 85b9c6ea..00000000 --- a/config/front/context.yml +++ /dev/null @@ -1,40 +0,0 @@ -services: - ps_eventbus.context: - class: 'Context' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getContext'] - - ps_eventbus.controller: - class: 'Controller' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getController'] - - ps_eventbus.cookie: - class: 'Cookie' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getCookie'] - - ps_eventbus.language: - class: 'Language' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getLanguage'] - - ps_eventbus.currency: - class: 'Currency' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getCurrency'] - - ps_eventbus.smarty: - class: 'Smarty' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getSmarty'] - - ps_eventbus.shop: - class: 'Shop' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getShop'] - - ps_eventbus.link: - class: 'Link' - public: true - factory: ['PrestaShop\Module\PsEventbus\Factory\ContextFactory', 'getLink'] diff --git a/config/front/decorator.yml b/config/front/decorator.yml deleted file mode 100644 index 24bde51d..00000000 --- a/config/front/decorator.yml +++ /dev/null @@ -1,80 +0,0 @@ -services: - PrestaShop\Module\PsEventbus\Decorator\ProductDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\ProductDecorator - public: true - arguments: - - '@ps_eventbus.context' - - '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository' - - '@PrestaShop\Module\PsEventbus\Repository\ProductRepository' - - '@PrestaShop\Module\PsEventbus\Repository\CategoryRepository' - - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' - - '@PrestaShop\Module\PsEventbus\Repository\BundleRepository' - - PrestaShop\Module\PsEventbus\Decorator\CategoryDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\CategoryDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\CurrencyDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\CurrencyDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\CustomerDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\CustomerDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\PayloadDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\PayloadDecorator - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository' - - PrestaShop\Module\PsEventbus\Decorator\CustomPriceDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\CustomPriceDecorator - public: true - arguments: - - '@ps_eventbus.context' - - '@PrestaShop\Module\PsEventbus\Service\SpecificPriceService' - - PrestaShop\Module\PsEventbus\Decorator\WishlistDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\WishlistDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\StoreDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\StoreDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\StockDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\StockDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\ManufacturerDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\ManufacturerDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\SupplierDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\SupplierDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\ProductSupplierDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\ProductSupplierDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\EmployeeDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\EmployeeDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\LanguageDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\LanguageDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\ImageDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\ImageDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\ImageTypeDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\ImageTypeDecorator - public: true - - PrestaShop\Module\PsEventbus\Decorator\TranslationDecorator: - class: PrestaShop\Module\PsEventbus\Decorator\TranslationDecorator - public: true diff --git a/config/front/provider.yml b/config/front/provider.yml deleted file mode 100644 index f531a0eb..00000000 --- a/config/front/provider.yml +++ /dev/null @@ -1,173 +0,0 @@ -services: - PrestaShop\Module\PsEventbus\Provider\ModuleDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\ModuleDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ModuleRepository' - - '@PrestaShop\Module\PsEventbus\Repository\ShopRepository' - - PrestaShop\Module\PsEventbus\Provider\ProductSupplierDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\ProductSupplierDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\ProductSupplierDecorator' - - PrestaShop\Module\PsEventbus\Provider\ProductDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\ProductDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ProductRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\ProductDecorator' - - '@PrestaShop\Module\PsEventbus\Provider\ProductSupplierDataProvider' - - '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository' - - PrestaShop\Module\PsEventbus\Provider\CategoryDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CategoryDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CategoryRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\CategoryDecorator' - - PrestaShop\Module\PsEventbus\Provider\CurrencyDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CurrencyDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CurrencyRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\CurrencyDecorator' - - PrestaShop\Module\PsEventbus\Provider\CustomerDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CustomerDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CustomerRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\CustomerDecorator' - - PrestaShop\Module\PsEventbus\Provider\OrderDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\OrderDataProvider - public: true - arguments: - - "@ps_eventbus.context" - - '@PrestaShop\Module\PsEventbus\Repository\OrderRepository' - - '@PrestaShop\Module\PsEventbus\Repository\OrderDetailsRepository' - - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' - - '@PrestaShop\Module\PsEventbus\Repository\OrderHistoryRepository' - - '@PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository' - - PrestaShop\Module\PsEventbus\Provider\CartDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CartDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CartRepository' - - '@PrestaShop\Module\PsEventbus\Repository\CartProductRepository' - - PrestaShop\Module\PsEventbus\Provider\CartRuleDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CartRuleDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CartRuleRepository' - - PrestaShop\Module\PsEventbus\Provider\GoogleTaxonomyDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\GoogleTaxonomyDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\GoogleTaxonomyRepository' - - "@ps_eventbus.context" - - PrestaShop\Module\PsEventbus\Provider\CarrierDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CarrierDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository' - - '@PrestaShop\Module\PsEventbus\Builder\CarrierBuilder' - - '@PrestaShop\Module\PsEventbus\Repository\CarrierRepository' - - '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository' - - PrestaShop\Module\PsEventbus\Provider\CustomPriceDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CustomPriceDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\CustomPriceRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\CustomPriceDecorator' - - PrestaShop\Module\PsEventbus\Provider\CustomProductCarrierDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\CustomProductCarrierDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ProductCarrierRepository' - - PrestaShop\Module\PsEventbus\Provider\WishlistDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\WishlistDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\WishlistRepository' - - '@PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\WishlistDecorator' - - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' - - PrestaShop\Module\PsEventbus\Provider\StoreDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\StoreDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\StoreRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\StoreDecorator' - - PrestaShop\Module\PsEventbus\Provider\StockDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\StockDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\StockRepository' - - '@PrestaShop\Module\PsEventbus\Repository\StockMvtRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\StockDecorator' - - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' - - PrestaShop\Module\PsEventbus\Provider\ManufacturerDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\ManufacturerDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\ManufacturerDecorator' - - PrestaShop\Module\PsEventbus\Provider\SupplierDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\SupplierDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\SupplierRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\SupplierDecorator' - - PrestaShop\Module\PsEventbus\Provider\EmployeeDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\EmployeeDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\EmployeeRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\EmployeeDecorator' - - PrestaShop\Module\PsEventbus\Provider\LanguageDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\LanguageDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\LanguageDecorator' - - - PrestaShop\Module\PsEventbus\Provider\ImageDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\ImageDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ImageRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\ImageDecorator' - - PrestaShop\Module\PsEventbus\Provider\ImageTypeDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\ImageTypeDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\ImageTypeDecorator' - - PrestaShop\Module\PsEventbus\Provider\TranslationDataProvider: - class: PrestaShop\Module\PsEventbus\Provider\TranslationDataProvider - public: true - arguments: - - '@PrestaShop\Module\PsEventbus\Repository\TranslationRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\TranslationDecorator' - diff --git a/config/front/services.yml b/config/front/services.yml index a68ff670..15959e8e 100644 --- a/config/front/services.yml +++ b/config/front/services.yml @@ -1,72 +1,274 @@ imports: - - { resource: ../common.yml } - { resource: api.yml } - - { resource: decorator.yml } - - { resource: provider.yml } - - { resource: repository.yml } - - { resource: builder.yml } - - { resource: context.yml } + - { resource: ../common/common.yml } + - { resource: ../common/repository.yml } services: - PrestaShop\Module\PsEventbus\Formatter\JsonFormatter: - class: PrestaShop\Module\PsEventbus\Formatter\JsonFormatter + PrestaShop\Module\PsEventbus\Service\ApiAuthorizationService: + class: PrestaShop\Module\PsEventbus\Service\ApiAuthorizationService public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\SyncRepository' + - '@PrestaShop\Module\PsEventbus\Api\SyncApiClient' + - '@PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' - PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter: - class: PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter + PrestaShop\Module\PsEventbus\Service\SynchronizationService: + class: PrestaShop\Module\PsEventbus\Service\SynchronizationService public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Api\LiveSyncApiClient' + - '@PrestaShop\Module\PsEventbus\Repository\SyncRepository' + - '@PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository' + - '@PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository' + - '@PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService' + - '@PrestaShop\Module\PsEventbus\Service\ProxyService' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' - PrestaShop\Module\PsEventbus\Service\CacheService: - class: PrestaShop\Module\PsEventbus\Service\CacheService + PrestaShop\Module\PsEventbus\Service\PresenterService: + class: PrestaShop\Module\PsEventbus\Service\PresenterService public: true - PrestaShop\Module\PsEventbus\Service\CompressionService: - class: PrestaShop\Module\PsEventbus\Service\CompressionService + PrestaShop\Module\PsEventbus\Service\ApiShopContentService: + class: PrestaShop\Module\PsEventbus\Service\ApiShopContentService public: true arguments: - - '@PrestaShop\Module\PsEventbus\Formatter\JsonFormatter' + - '@ps_eventbus' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' + - '@PrestaShop\Module\PsEventbus\Service\ApiAuthorizationService' + - '@PrestaShop\Module\PsEventbus\Service\SynchronizationService' + - '@PrestaShop\Module\PsEventbus\Repository\SyncRepository' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' - PrestaShop\Module\PsEventbus\Service\ProxyService: - class: PrestaShop\Module\PsEventbus\Service\ProxyService + PrestaShop\Module\PsEventbus\Service\ApiHealthCheckService: + class: PrestaShop\Module\PsEventbus\Service\ApiHealthCheckService public: true arguments: - - '@PrestaShop\Module\PsEventbus\Api\CollectorApiClient' - - '@PrestaShop\Module\PsEventbus\Formatter\JsonFormatter' - - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface' + - '@PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService' + - '@PrestaShop\Module\PsEventbus\Service\ApiAuthorizationService' + - '@PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler' + - '%ps_eventbus.sync_api_url%' + - '%ps_eventbus.live_sync_api_url%' + - '%ps_eventbus.proxy_api_url%' - PrestaShop\Module\PsEventbus\Service\ApiAuthorizationService: - class: PrestaShop\Module\PsEventbus\Service\ApiAuthorizationService +############################################################################################################ +###################################### SHOP CONTENT SERVICES ############################################### +############################################################################################################ + PrestaShop\Module\PsEventbus\Service\ShopContent\AttributesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\AttributesService + public: true + + PrestaShop\Module\PsEventbus\Service\ShopContent\BundlesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\BundlesService public: true arguments: - - '@PrestaShop\Module\PsEventbus\Repository\EventbusSyncRepository' - - '@PrestaShop\Module\PsEventbus\Api\SyncApiClient' + - '@PrestaShop\Module\PsEventbus\Repository\BundleRepository' - PrestaShop\Module\PsEventbus\Service\DeletedObjectsService: - class: PrestaShop\Module\PsEventbus\Service\DeletedObjectsService + PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService public: true arguments: - - "@ps_eventbus.context" - - '@PrestaShop\Module\PsEventbus\Repository\DeletedObjectsRepository' - - '@PrestaShop\Module\PsEventbus\Service\ProxyService' + - '@PrestaShop\Module\PsEventbus\Repository\CarrierRepository' - PrestaShop\Module\PsEventbus\Service\SynchronizationService: - class: PrestaShop\Module\PsEventbus\Service\SynchronizationService + PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierDetailsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierDetailsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CarrierDetailRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierTaxesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierTaxesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CarrierTaxeRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CartsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CartRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CartProductsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartProductsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CartProductRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CartRulesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartRulesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CartRuleRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CustomProductCarriersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CustomProductCarriersService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CustomersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CustomersService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CustomerRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CategoriesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CategoriesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CategoryRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\CurrencyRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\EmployeesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\EmployeesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\EmployeeRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\ImageRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository' + + + PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService public: true arguments: - - '@ps_eventbus' - - '@PrestaShop\Module\PsEventbus\Repository\EventbusSyncRepository' - - '@PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository' - - '@PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository' - - '@PrestaShop\Module\PsEventbus\Repository\DeletedObjectsRepository' - '@PrestaShop\Module\PsEventbus\Repository\LanguageRepository' - - '@PrestaShop\Module\PsEventbus\Decorator\PayloadDecorator' - PrestaShop\Module\PsEventbus\Service\SpecificPriceService: - class: PrestaShop\Module\PsEventbus\Service\SpecificPriceService + PrestaShop\Module\PsEventbus\Service\ShopContent\ManufacturersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ManufacturersService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ModulesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ModulesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\ModuleRepository' + - '@PrestaShop\Module\PsEventbus\Repository\ShopRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\OrdersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrdersService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\OrderRepository' + - '@PrestaShop\Module\PsEventbus\Repository\OrderstatusHistoryRepository' + - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' + + PrestaShop\Module\PsEventbus\Service\ShopContent\OrderCartRulesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderCartRulesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\OrderDetailsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderDetailsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\OrderDetailRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\OrderStatusHistoryService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderStatusHistoryService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\OrderstatusHistoryRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ProductsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\ProductRepository' + - '@PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService' + - '@PrestaShop\Module\PsEventbus\Service\ShopContent\CategoriesService' + - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ProductSuppliersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductSuppliersService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ShopsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ShopsService + public: true + arguments: + - '@=service("ps_eventbus").getContext()' + - '@PrestaShop\Module\PsEventbus\Repository\ShopRepository' + - '@PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService' + - '@PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService' + + PrestaShop\Module\PsEventbus\Service\ShopContent\SpecificPricesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\SpecificPricesService + public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\SpecificPriceRepository' + - '@PrestaShop\Module\PsEventbus\Repository\ProductRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\StocksService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\StocksService public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\StockRepository' - PrestaShop\Module\PsEventbus\Service\PresenterService: - class: PrestaShop\Module\PsEventbus\Service\PresenterService + PrestaShop\Module\PsEventbus\Service\ShopContent\StockMovementsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\StockMovementsService public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\StockMovementRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\StoresService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\StoresService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\StoreRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\SuppliersService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\SuppliersService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\SupplierRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\TaxonomiesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\TaxonomiesService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\TaxonomyRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ThemesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ThemesService + public: true + arguments: + - '@=service("ps_eventbus").getContext()' + + PrestaShop\Module\PsEventbus\Service\ShopContent\TranslationsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\TranslationsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\TranslationRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\WishlistsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\WishlistsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\WishlistRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\WishlistProductsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\WishlistProductsService + public: true + arguments: + - '@PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository' diff --git a/controllers/front/apiCarriers.php b/controllers/front/apiCarriers.php deleted file mode 100644 index 2322915c..00000000 --- a/controllers/front/apiCarriers.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CarrierDataProvider::class); - - $response = $this->handleDataSync($carrierDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiCartRules.php b/controllers/front/apiCartRules.php deleted file mode 100644 index 9756bbfa..00000000 --- a/controllers/front/apiCartRules.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CartRuleDataProvider::class); - - $response = $this->handleDataSync($cartRuleDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiCarts.php b/controllers/front/apiCarts.php deleted file mode 100644 index 5389995b..00000000 --- a/controllers/front/apiCarts.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CartDataProvider::class); - - $response = $this->handleDataSync($cartDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiCategories.php b/controllers/front/apiCategories.php deleted file mode 100644 index 32de69d1..00000000 --- a/controllers/front/apiCategories.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CategoryDataProvider::class); - - $response = $this->handleDataSync($categoryDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiCurrencies.php b/controllers/front/apiCurrencies.php deleted file mode 100644 index 9e39daa3..00000000 --- a/controllers/front/apiCurrencies.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CurrencyDataProvider::class); - - $response = $this->handleDataSync($currencyDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiCustomProductCarriers.php b/controllers/front/apiCustomProductCarriers.php deleted file mode 100644 index 925ed474..00000000 --- a/controllers/front/apiCustomProductCarriers.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CustomProductCarrierDataProvider::class); - - $response = $this->handleDataSync($categoryDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiCustomers.php b/controllers/front/apiCustomers.php deleted file mode 100644 index bb334118..00000000 --- a/controllers/front/apiCustomers.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CustomerDataProvider::class); - - $response = $this->handleDataSync($customerDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiDeletedObjects.php b/controllers/front/apiDeletedObjects.php deleted file mode 100644 index 0a589df7..00000000 --- a/controllers/front/apiDeletedObjects.php +++ /dev/null @@ -1,34 +0,0 @@ -module->getService(DeletedObjectsService::class); - - try { - $response = $deletedObjectsService->handleDeletedObjectsSync($jobId, $this->startTime); - $this->exitWithResponse($response); - } catch (PrestaShopDatabaseException $exception) { - $this->exitWithExceptionMessage($exception); - } catch (EnvVarException $exception) { - $this->exitWithExceptionMessage($exception); - } - } -} diff --git a/controllers/front/apiEmployees.php b/controllers/front/apiEmployees.php deleted file mode 100644 index 0060c415..00000000 --- a/controllers/front/apiEmployees.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(EmployeeDataProvider::class); - - $response = $this->handleDataSync($employeeDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiGoogleTaxonomies.php b/controllers/front/apiGoogleTaxonomies.php deleted file mode 100644 index 01fc2316..00000000 --- a/controllers/front/apiGoogleTaxonomies.php +++ /dev/null @@ -1,29 +0,0 @@ -exitWithExceptionMessage(new Exception('Facebook module is not installed', Config::PS_FACEBOOK_NOT_INSTALLED)); - } - - /** @var GoogleTaxonomyDataProvider $categoryDataProvider */ - $categoryDataProvider = $this->module->getService(GoogleTaxonomyDataProvider::class); - - $response = $this->handleDataSync($categoryDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiHealthCheck.php b/controllers/front/apiHealthCheck.php index e2bef3ee..867364b8 100644 --- a/controllers/front/apiHealthCheck.php +++ b/controllers/front/apiHealthCheck.php @@ -1,44 +1,55 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ -use PrestaShop\Module\PsEventbus\Config\Config; -use PrestaShop\Module\PsEventbus\Controller\AbstractApiController; -use PrestaShop\Module\PsEventbus\Exception\UnauthorizedException; -use PrestaShop\Module\PsEventbus\Repository\ServerInformationRepository; +use PrestaShop\Module\PsEventbus\Service\ApiHealthCheckService; +use PrestaShop\Module\PsEventbus\Service\CommonService; -class ps_EventbusApiHealthCheckModuleFrontController extends AbstractApiController -{ - public $type = Config::COLLECTION_SHOPS; - - /** @var bool */ - private $isAuthentifiedCall = true; - - /** - * Override default method from AbstractApiController - * Get another behavior for healthcheck - * - * @return void - */ - public function init() - { - try { - parent::init(); - } catch (UnauthorizedException $exception) { - $this->isAuthentifiedCall = false; - } - } +if (!defined('_PS_VERSION_')) { + exit; +} +class ps_EventbusApiHealthCheckModuleFrontController extends ModuleFrontController +{ /** * @return void * - * @throws PrestaShopException + * @throws\PrestaShopException */ public function postProcess() { - /** @var ServerInformationRepository $serverInformationRepository */ - $serverInformationRepository = $this->module->getService(ServerInformationRepository::class); + /** @var string $jobId */ + $jobId = Tools::getValue('job_id'); + + /** @var Ps_eventbus $module */ + $module = Module::getInstanceByName('ps_eventbus'); - $status = $serverInformationRepository->getHealthCheckData($this->isAuthentifiedCall); + /** @var ApiHealthCheckService $apiHealthCheckService */ + $apiHealthCheckService = $module->getService('PrestaShop\Module\PsEventbus\Service\ApiHealthCheckService'); + $response = $apiHealthCheckService->getHealthCheck($jobId); - $this->exitWithResponse($status); + CommonService::exitWithResponse($response); } } diff --git a/controllers/front/apiImageTypes.php b/controllers/front/apiImageTypes.php deleted file mode 100644 index 1c1f1803..00000000 --- a/controllers/front/apiImageTypes.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(ImageTypeDataProvider::class); - - $response = $this->handleDataSync($imageTypeDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiImages.php b/controllers/front/apiImages.php deleted file mode 100644 index 87eea66f..00000000 --- a/controllers/front/apiImages.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(ImageDataProvider::class); - - $response = $this->handleDataSync($imageDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiInfo.php b/controllers/front/apiInfo.php deleted file mode 100644 index 7115ed53..00000000 --- a/controllers/front/apiInfo.php +++ /dev/null @@ -1,51 +0,0 @@ -module->getService(ServerInformationRepository::class); - - /** @var string $langIso */ - $langIso = Tools::getValue('lang_iso', ''); - $serverInfo = $serverInformationRepository->getServerInformation($langIso); - - /** @var bool $initFullSync */ - $initFullSync = Tools::getValue('full', 0) == 1; - - try { - $response = $this->proxyService->upload($jobId, $serverInfo, $this->startTime, $initFullSync); - } catch (Exception $exception) { - $this->exitWithExceptionMessage($exception); - } - - $this->exitWithResponse( - array_merge( - [ - 'remaining_objects' => 0, - 'total_objects' => 1, - 'job_id' => $jobId, - 'object_type' => $this->type, - 'syncType' => 'full', - ], - $response - ) - ); - } -} diff --git a/controllers/front/apiLanguages.php b/controllers/front/apiLanguages.php deleted file mode 100644 index 9873ef46..00000000 --- a/controllers/front/apiLanguages.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(LanguageDataProvider::class); - - $response = $this->handleDataSync($languageDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiManufacturers.php b/controllers/front/apiManufacturers.php deleted file mode 100644 index e4ffe227..00000000 --- a/controllers/front/apiManufacturers.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(ManufacturerDataProvider::class); - - $response = $this->handleDataSync($manufacturerDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiModules.php b/controllers/front/apiModules.php deleted file mode 100644 index f409309a..00000000 --- a/controllers/front/apiModules.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(ModuleDataProvider::class); - - $response = $this->handleDataSync($moduleDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiOrders.php b/controllers/front/apiOrders.php deleted file mode 100644 index deb0dd91..00000000 --- a/controllers/front/apiOrders.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(OrderDataProvider::class); - - $response = $this->handleDataSync($orderDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiProducts.php b/controllers/front/apiProducts.php deleted file mode 100644 index a8c835be..00000000 --- a/controllers/front/apiProducts.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(ProductDataProvider::class); - - $response = $this->handleDataSync($productDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiShopContent.php b/controllers/front/apiShopContent.php new file mode 100644 index 00000000..b44e5dbb --- /dev/null +++ b/controllers/front/apiShopContent.php @@ -0,0 +1,96 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +use PrestaShop\Module\PsEventbus\Service\ApiShopContentService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ps_EventbusApiShopContentModuleFrontController extends ModuleFrontController +{ + /** + * @return void + * + * @throws\PrestaShopException + */ + public function postProcess() + { + /** @var string $shopContent */ + $shopContent = Tools::getValue('shop_content'); + + /** @var string $jobId */ + $jobId = Tools::getValue('job_id'); + + /** @var string $langIso */ + $langIso = Tools::getValue('lang_iso'); + + /** @var int $limit */ + $limit = Tools::getValue('limit', 50); + + /** @var bool $fullSyncRequested */ + $fullSyncRequested = Tools::getValue('full', 0) == 1; + + /** @var bool $explainSql */ + $explainSql = Tools::getValue('explain_sql', 0) == 1; + + /** @var bool $verbose */ + $verbose = Tools::getValue('verbose', 0) == 1; + + /** @var bool $psLogsEnabled */ + $psLogsEnabled = Tools::getValue('ps_logs_enabled', 0) == 1; + + /** @var Ps_eventbus $module */ + $module = Module::getInstanceByName('ps_eventbus'); + + /** @var ApiShopContentService $apiShopContentService */ + $apiShopContentService = $module->getService('PrestaShop\Module\PsEventbus\Service\ApiShopContentService'); + + // Define our 3 constants here to be retrieved later in the application (errorHandler, repositories) + if (!defined('PS_EVENTBUS_EXPLAIN_SQL_ENABLED')) { + define('PS_EVENTBUS_EXPLAIN_SQL_ENABLED', $explainSql); + } + + if (!defined('PS_EVENTBUS_VERBOSE_ENABLED')) { + define('PS_EVENTBUS_VERBOSE_ENABLED', $verbose); + } + + if (!defined('PS_EVENTBUS_LOGS_ENABLED')) { + define('PS_EVENTBUS_LOGS_ENABLED', $psLogsEnabled); + } + + // edit shopContent for matching Config.php const + $shopContentEdited = str_replace('-', '_', $shopContent); + + $apiShopContentService->handleDataSync( + $shopContentEdited, + $jobId, + $langIso, + $limit, + $fullSyncRequested + ); + } +} diff --git a/controllers/front/apiSpecificPrices.php b/controllers/front/apiSpecificPrices.php deleted file mode 100644 index ead620c5..00000000 --- a/controllers/front/apiSpecificPrices.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(CustomPriceDataProvider::class); - - $response = $this->handleDataSync($productDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiStocks.php b/controllers/front/apiStocks.php deleted file mode 100644 index 99cb7359..00000000 --- a/controllers/front/apiStocks.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(StockDataProvider::class); - - $response = $this->handleDataSync($stockDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiStores.php b/controllers/front/apiStores.php deleted file mode 100644 index 2de5cc70..00000000 --- a/controllers/front/apiStores.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(StoreDataProvider::class); - - $response = $this->handleDataSync($storeDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiSuppliers.php b/controllers/front/apiSuppliers.php deleted file mode 100644 index 46101b2a..00000000 --- a/controllers/front/apiSuppliers.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(SupplierDataProvider::class); - - $response = $this->handleDataSync($supplierDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiThemes.php b/controllers/front/apiThemes.php deleted file mode 100644 index dc0e2e5d..00000000 --- a/controllers/front/apiThemes.php +++ /dev/null @@ -1,51 +0,0 @@ -module->getService(ThemeRepository::class); - - /** @var array $themeInfo */ - $themeInfo = $themeRepository->getThemes(); - - /** @var bool $initFullSync */ - $initFullSync = Tools::getValue('full', 0) == 1; - - try { - $response = $this->proxyService->upload($jobId, $themeInfo, $this->startTime, $initFullSync); - } catch (Exception $exception) { - $this->exitWithExceptionMessage($exception); - } - - $this->exitWithResponse( - array_merge( - [ - 'remaining_objects' => 0, - 'total_objects' => count($themeInfo), - 'job_id' => $jobId, - 'object_type' => $this->type, - 'syncType' => 'full', - ], - $response - ) - ); - } -} diff --git a/controllers/front/apiTranslations.php b/controllers/front/apiTranslations.php deleted file mode 100644 index 50e8dd5c..00000000 --- a/controllers/front/apiTranslations.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(TranslationDataProvider::class); - - $response = $this->handleDataSync($translationDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/controllers/front/apiWishlists.php b/controllers/front/apiWishlists.php deleted file mode 100644 index 42292c1a..00000000 --- a/controllers/front/apiWishlists.php +++ /dev/null @@ -1,25 +0,0 @@ -module->getService(WishlistDataProvider::class); - - $response = $this->handleDataSync($wishlistDataProvider); - - $this->exitWithResponse($response); - } -} diff --git a/e2e-env/.env.dist b/e2e-env/.env.dist index b99b0ede..d713ea4c 100644 --- a/e2e-env/.env.dist +++ b/e2e-env/.env.dist @@ -14,3 +14,5 @@ SYNC_API_PORT=3232 COLLECTOR_API_PORT=3333 LIVE_SYNC_API_PORT=3434 WS_PORT=8080 + +TUNNEL_NAME=replace-me.hostname.com diff --git a/e2e-env/README.md b/e2e-env/README.md index 3c68ea81..388282ac 100644 --- a/e2e-env/README.md +++ b/e2e-env/README.md @@ -60,7 +60,7 @@ curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller Capture orders: ```sh -curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiOrders&job_id=valid-job-1" | jq . +curl -s "http://localhost:8000/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=orders&job_id=valid-job-1" | jq . ``` ## Make changes to the mock diff --git a/e2e-env/cloudsync-mock/src/lib/collector-api.ts b/e2e-env/cloudsync-mock/src/lib/collector-api.ts index 37833eb5..842d8b7d 100644 --- a/e2e-env/cloudsync-mock/src/lib/collector-api.ts +++ b/e2e-env/cloudsync-mock/src/lib/collector-api.ts @@ -1,25 +1,26 @@ import { Server } from "./server"; -import {WsServer} from "./ws-server"; +import { WsServer } from "./ws-server"; // @ts-expect-error we don't care about packaging here import multer from "multer"; -const storage = multer.memoryStorage() -const upload = multer({ storage }) +const storage = multer.memoryStorage(); +const upload = multer({ storage }); export class CollectorApiServer extends Server { - public constructor( probe: WsServer) { - super( probe); + public constructor(probe: WsServer) { + super(probe); this.api.get("/", (_req, res) => { res.status(200).end(); }); - this.api.post("/upload/:jobid", upload.single('file'), (req, res) => { + this.api.post("/upload/:jobid", upload.single("file"), (req, res) => { const jobId = req.params.jobid; if (jobId.startsWith("valid-job-")) { - req.body.file = req.file.buffer.toString() - .split('\n') - .map(line => JSON.parse(line.trim())) + req.body.file = req.file.buffer + .toString() + .split("\n") + .map((line) => JSON.parse(line.trim())); res.status(201).end(); } else { res.status(500).end(); diff --git a/e2e-env/credentials.dist.json b/e2e-env/credentials.dist.json new file mode 100644 index 00000000..56bef42e --- /dev/null +++ b/e2e-env/credentials.dist.json @@ -0,0 +1,5 @@ +{ + "AccountTag": "00000000000000000000000000000000", + "TunnelSecret": "ZWggbm9uIHBhcyBkZSBzZWNyZXQgaWNpLCBiaWVuIGVzc2F5w6k=", + "TunnelID": "00000000-0000-0000-0000-000000000000" +} diff --git a/e2e-env/docker-compose.yml b/e2e-env/docker-compose.yml index 32721fdd..9b08d28e 100644 --- a/e2e-env/docker-compose.yml +++ b/e2e-env/docker-compose.yml @@ -1,5 +1,5 @@ -services: - prestashop: +x-service: + prestashop-base: &prestashop-base image: ${DOCKER_IMAGE_PRESTASHOP:?See e2e-env/.env.dist} depends_on: mysql: @@ -11,25 +11,48 @@ services: "curl", "-sI", "-H", - "Host: localhost:8000", + "Host: localhost:${HOST_PORT_BIND_PRESTASHOP:?See e2e-env/.env.dist}", "http://localhost:80/index.php?fc=module&module=ps_eventbus&controller=apiHealthCheck", ] interval: 30s + environment: + - ON_INIT_SCRIPT_FAILURE=fail + - DEBUG_MODE=true + - INIT_SCRIPTS_USER=root + - PS_DOMAIN=localhost:${HOST_PORT_BIND_PRESTASHOP} + ports: + - ${HOST_PORT_BIND_PRESTASHOP:?See e2e-env/.env.dist}:80 + +services: + # This service ir for local development and testing with ps-accounts mock + prestashop-local: + <<: *prestashop-base + environment: + - PS_DOMAIN=localhost:${HOST_PORT_BIND_PRESTASHOP} volumes: - ..:/var/www/html/modules/ps_eventbus:rw - - ./init-scripts:/tmp/init-scripts:ro + - ./init-scripts/install-ps-accounts-mock.sh:/tmp/init-scripts/install-ps-accounts-mock.sh:ro + - ./init-scripts/install-ps-eventbus.sh:/tmp/init-scripts/install-ps-eventbus.sh:ro # Notice: you might enable this if your uid is not 1000, or encounter permission issues # - /var/www/html/modules/ps_eventbus/vendor # - /var/www/html/modules/ps_eventbus/tools/vendor + profiles: [localhost, cicd] + + # This service is for testing with real ps-accounts, and exposed the service to the internet + prestashop-exposed: + <<: *prestashop-base environment: - - PS_DOMAIN=localhost:8000 - - ON_INIT_SCRIPT_FAILURE=fail - - DEBUG_MODE=true - - INIT_SCRIPTS_USER=root + - PS_DOMAIN=${TUNNEL_NAME} + - PS_PROTOCOL=https ports: - ${HOST_PORT_BIND_PRESTASHOP:?See e2e-env/.env.dist}:80 - networks: - - prestashop + volumes: + - ..:/var/www/html/modules/ps_eventbus:rw + - ./init-scripts/install-ps-eventbus.sh:/tmp/init-scripts/install-ps-eventbus.sh:ro + # Notice: you might enable this if your uid is not 1000, or encounter permission issues + # - /var/www/html/modules/ps_eventbus/vendor + # - /var/www/html/modules/ps_eventbus/tools/vendor + profiles: [cloudflared] mysql: image: mariadb:${DOCKER_VERSION_MARIADB:?See e2e-env/.env.dist} @@ -44,8 +67,6 @@ services: - MYSQL_DATABASE=prestashop ports: - ${HOST_PORT_BIND_MYSQL:?See e2e-env/.env.dist}:3306 - networks: - - prestashop phpmyadmin: image: phpmyadmin:latest @@ -60,8 +81,7 @@ services: - PMA_USER=prestashop - PMA_PASSWORD=prestashop - MYSQL_ROOT_PASSWORD=prestashop - networks: - - prestashop + profiles: [localhost, cloudflared] cloudsync-mock: build: @@ -78,8 +98,6 @@ services: - ${COLLECTOR_API_PORT:?See e2e-env/.env.dist}:3333 - ${LIVE_SYNC_API_PORT:?See e2e-env/.env.dist}:3434 - ${WS_PORT:?See e2e-env/.env.dist}:8080 - networks: - - prestashop reverse-proxy: image: nginx:stable-alpine @@ -88,11 +106,16 @@ services: volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro,cached command: [nginx-debug, "-g", "daemon off;"] - networks: - - prestashop ports: - ${HOST_PORT_BIND_CLOUDSYNC_REVERSE_PROXY:?See e2e-env/.env.dist}:80 -networks: - prestashop: - driver: bridge + cloudflared: + image: cloudflare/cloudflared:latest + command: tunnel run $${TUNNEL_NAME} + environment: + - TUNNEL_CRED_FILE=/credentials.json + - TUNNEL_URL=http://prestashop-exposed:80 + - TUNNEL_HTTP_HOST_HEADER=${TUNNEL_NAME} + volumes: + - ./credentials.json:/credentials.json + profiles: [cloudflared] diff --git a/e2e-env/init-scripts/install-module.sh b/e2e-env/init-scripts/install-ps-accounts-mock.sh similarity index 72% rename from e2e-env/init-scripts/install-module.sh rename to e2e-env/init-scripts/install-ps-accounts-mock.sh index 7d53fe32..217be2d6 100755 --- a/e2e-env/init-scripts/install-module.sh +++ b/e2e-env/init-scripts/install-ps-accounts-mock.sh @@ -24,14 +24,4 @@ ps_accounts_mock_install() { php -d memory_limit=-1 bin/console prestashop:module --no-interaction install "ps_accounts" } -ps_eventbus_install() { - # Notice: you might enable this if your uid is not 1000, or encounter permission issues - # composer install -n -d ./modules/ps_eventbus - echo "* [ps_eventbus] installing the module..." - cd "$PS_FOLDER" - php -d memory_limit=-1 bin/console prestashop:module --no-interaction install "ps_eventbus" -} - ps_accounts_mock_install -ps_eventbus_install - diff --git a/e2e-env/init-scripts/install-ps-eventbus.sh b/e2e-env/init-scripts/install-ps-eventbus.sh new file mode 100755 index 00000000..904eed40 --- /dev/null +++ b/e2e-env/init-scripts/install-ps-eventbus.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# This is an init-script for prestashop-flashlight. +# +# Storing a folder in /var/www/html/modules is not enough to register the module +# into PrestaShop, hence why we have to call the console install CLI. +# +set -eu + +error() { + printf "\e[1;31m%s\e[0m\n" "${1:-Unknown error}" + exit "${2:-1}" +} + +ps_eventbus_install() { + # Notice: you might enable this if your uid is not 1000, or encounter permission issues + # composer install -n -d ./modules/ps_eventbus + echo "* [ps_eventbus] installing the module..." + cd "$PS_FOLDER" + php -d memory_limit=-1 bin/console prestashop:module --no-interaction install "ps_eventbus" +} + +ps_eventbus_install diff --git a/e2e/README.md b/e2e/README.md index 7d90455f..e5dde583 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -17,13 +17,13 @@ import { MockProbe } from './helpers/mock-probe'; import testConfig from './helpers/test.config'; import request from 'supertest'; -const controller = 'apiCategories'; -const endpoint = `/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5`; +const controller = 'categories'; +const endpoint = `/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=${shopContent}&limit=5`; -describe('CategoriesController', () => { - it(`${controller} should upload to collector`, async () => { +describe('CategoriesShopContent', () => { + it(`${shopContent} should upload to collector`, async () => { // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5&full=1&job_id=${jobId}`; + const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`; // jobId starting with "valid-job-" will be considered valid by the mock sync-api and will always return 201; // other values will be rejected by the mock const jobId = 'valid-job-1' diff --git a/e2e/jest.config.json b/e2e/jest.config.json index 5699c0ce..0effbacc 100644 --- a/e2e/jest.config.json +++ b/e2e/jest.config.json @@ -10,5 +10,6 @@ "testEnvironment": "node", "moduleNameMapper": { "^@/(.*)$": "/$1" - } + }, + "verbose": true } diff --git a/e2e/package.json b/e2e/package.json index 04cfaec6..b9e278a1 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -27,6 +27,7 @@ "jest-expect-message": "^1.1.3", "jest-extended": "^4.0.2", "jest-mock-extended": "^3.0.7", + "object-hash": "3.0.0", "prettier": "^3.3.3", "ramda": "^0.30.1", "rxjs": "^7.8.1", diff --git a/e2e/pnpm-lock.yaml b/e2e/pnpm-lock.yaml index 0c5c8010..ae54ab75 100644 --- a/e2e/pnpm-lock.yaml +++ b/e2e/pnpm-lock.yaml @@ -1,1731 +1,108 @@ -lockfileVersion: '9.0' +lockfileVersion: '6.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -importers: - - .: - dependencies: - semver: - specifier: ^7.6.3 - version: 7.6.3 - devDependencies: - '@eslint/js': - specifier: ^9.10.0 - version: 9.10.0 - '@jest/globals': - specifier: ^29.7.0 - version: 29.7.0 - '@types/eslint__js': - specifier: ^8.42.3 - version: 8.42.3 - '@types/jest': - specifier: ^29.5.13 - version: 29.5.13 - '@types/node': - specifier: ^22.5.4 - version: 22.5.4 - '@types/ramda': - specifier: ^0.30.2 - version: 0.30.2 - '@types/semver': - specifier: ^7.5.8 - version: 7.5.8 - '@types/ws': - specifier: ^8.5.12 - version: 8.5.12 - axios: - specifier: ^1.7.7 - version: 1.7.7 - eslint: - specifier: ^9.10.0 - version: 9.10.0 - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@22.5.4) - jest-expect-message: - specifier: ^1.1.3 - version: 1.1.3 - jest-extended: - specifier: ^4.0.2 - version: 4.0.2(jest@29.7.0(@types/node@22.5.4)) - jest-mock-extended: - specifier: ^3.0.7 - version: 3.0.7(jest@29.7.0(@types/node@22.5.4))(typescript@5.6.2) - prettier: - specifier: ^3.3.3 - version: 3.3.3 - ramda: - specifier: ^0.30.1 - version: 0.30.1 - rxjs: - specifier: ^7.8.1 - version: 7.8.1 - ts-jest: - specifier: ^29.2.5 - version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@22.5.4))(typescript@5.6.2) - typescript: - specifier: ^5.6.2 - version: 5.6.2 - typescript-eslint: - specifier: ^8.5.0 - version: 8.5.0(eslint@9.10.0)(typescript@5.6.2) - ws: - specifier: ^8.18.0 - version: 8.18.0 - -packages: - - '@ampproject/remapping@2.3.0': - resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} - engines: {node: '>=6.0.0'} - - '@babel/code-frame@7.24.7': - resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} - engines: {node: '>=6.9.0'} - - '@babel/compat-data@7.25.4': - resolution: {integrity: sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==} - engines: {node: '>=6.9.0'} - - '@babel/core@7.25.2': - resolution: {integrity: sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==} - engines: {node: '>=6.9.0'} - - '@babel/generator@7.25.5': - resolution: {integrity: sha512-abd43wyLfbWoxC6ahM8xTkqLpGB2iWBVyuKC9/srhFunCd1SDNrV1s72bBpK4hLj8KLzHBBcOblvLQZBNw9r3w==} - engines: {node: '>=6.9.0'} - - '@babel/helper-compilation-targets@7.25.2': - resolution: {integrity: sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-imports@7.24.7': - resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==} - engines: {node: '>=6.9.0'} - - '@babel/helper-module-transforms@7.25.2': - resolution: {integrity: sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - - '@babel/helper-plugin-utils@7.24.8': - resolution: {integrity: sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-simple-access@7.24.7': - resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} - engines: {node: '>=6.9.0'} - - '@babel/helper-string-parser@7.24.8': - resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-identifier@7.24.7': - resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} - engines: {node: '>=6.9.0'} - - '@babel/helper-validator-option@7.24.8': - resolution: {integrity: sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==} - engines: {node: '>=6.9.0'} - - '@babel/helpers@7.25.0': - resolution: {integrity: sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw==} - engines: {node: '>=6.9.0'} - - '@babel/highlight@7.24.7': - resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} - engines: {node: '>=6.9.0'} - - '@babel/parser@7.25.4': - resolution: {integrity: sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA==} - engines: {node: '>=6.0.0'} - hasBin: true - - '@babel/plugin-syntax-async-generators@7.8.4': - resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-bigint@7.8.3': - resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-properties@7.12.13': - resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-class-static-block@7.14.5': - resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-attributes@7.24.7': - resolution: {integrity: sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-import-meta@7.10.4': - resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-json-strings@7.8.3': - resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-jsx@7.24.7': - resolution: {integrity: sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-logical-assignment-operators@7.10.4': - resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': - resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-numeric-separator@7.10.4': - resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-object-rest-spread@7.8.3': - resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-catch-binding@7.8.3': - resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-optional-chaining@7.8.3': - resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-private-property-in-object@7.14.5': - resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-top-level-await@7.14.5': - resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/plugin-syntax-typescript@7.25.4': - resolution: {integrity: sha512-uMOCoHVU52BsSWxPOMVv5qKRdeSlPuImUCB2dlPuBSU+W2/ROE7/Zg8F2Kepbk+8yBa68LlRKxO+xgEVWorsDg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0-0 - - '@babel/template@7.25.0': - resolution: {integrity: sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==} - engines: {node: '>=6.9.0'} - - '@babel/traverse@7.25.4': - resolution: {integrity: sha512-VJ4XsrD+nOvlXyLzmLzUs/0qjFS4sK30te5yEFlvbbUNEgKaVb2BHZUpAL+ttLPQAHNrsI3zZisbfha5Cvr8vg==} - engines: {node: '>=6.9.0'} - - '@babel/types@7.25.4': - resolution: {integrity: sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ==} - engines: {node: '>=6.9.0'} - - '@bcoe/v8-coverage@0.2.3': - resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} - - '@eslint-community/eslint-utils@4.4.0': - resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - - '@eslint-community/regexpp@4.11.0': - resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==} - engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - - '@eslint/config-array@0.18.0': - resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/eslintrc@3.1.0': - resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/js@9.10.0': - resolution: {integrity: sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/object-schema@2.1.4': - resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@eslint/plugin-kit@0.1.0': - resolution: {integrity: sha512-autAXT203ixhqei9xt+qkYOvY8l6LAFIdT2UXc/RPNeUVfqRF1BV94GTJyVPFKT8nFM6MyVJhjLj9E8JWvf5zQ==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@humanwhocodes/module-importer@1.0.1': - resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} - engines: {node: '>=12.22'} - - '@humanwhocodes/retry@0.3.0': - resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} - engines: {node: '>=18.18'} - - '@istanbuljs/load-nyc-config@1.1.0': - resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} - engines: {node: '>=8'} - - '@istanbuljs/schema@0.1.3': - resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} - engines: {node: '>=8'} - - '@jest/console@29.7.0': - resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/core@29.7.0': - resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - '@jest/environment@29.7.0': - resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/expect-utils@29.7.0': - resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/expect@29.7.0': - resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/fake-timers@29.7.0': - resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/globals@29.7.0': - resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/reporters@29.7.0': - resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - '@jest/schemas@29.6.3': - resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/source-map@29.6.3': - resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/test-result@29.7.0': - resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/test-sequencer@29.7.0': - resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/transform@29.7.0': - resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jest/types@29.6.3': - resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - '@jridgewell/gen-mapping@0.3.5': - resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} - engines: {node: '>=6.0.0'} - - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} - - '@jridgewell/set-array@1.2.1': - resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} - engines: {node: '>=6.0.0'} - - '@jridgewell/sourcemap-codec@1.5.0': - resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} - - '@jridgewell/trace-mapping@0.3.25': - resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - - '@sinclair/typebox@0.27.8': - resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} - - '@sinonjs/commons@3.0.1': - resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} - - '@sinonjs/fake-timers@10.3.0': - resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} - - '@types/babel__core@7.20.5': - resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} - - '@types/babel__generator@7.6.8': - resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==} - - '@types/babel__template@7.4.4': - resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} - - '@types/babel__traverse@7.20.6': - resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} - - '@types/eslint@9.6.1': - resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} - - '@types/eslint__js@8.42.3': - resolution: {integrity: sha512-alfG737uhmPdnvkrLdZLcEKJ/B8s9Y4hrZ+YAdzUeoArBlSUERA2E87ROfOaS4jd/C45fzOoZzidLc1IPwLqOw==} - - '@types/estree@1.0.5': - resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} - - '@types/graceful-fs@4.1.9': - resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} - - '@types/istanbul-lib-coverage@2.0.6': - resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} - - '@types/istanbul-lib-report@3.0.3': - resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} - - '@types/istanbul-reports@3.0.4': - resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} - - '@types/jest@29.5.13': - resolution: {integrity: sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==} - - '@types/json-schema@7.0.15': - resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - - '@types/node@22.5.4': - resolution: {integrity: sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==} - - '@types/ramda@0.30.2': - resolution: {integrity: sha512-PyzHvjCalm2BRYjAU6nIB3TprYwMNOUY/7P/N8bSzp9W/yM2YrtGtAnnVtaCNSeOZ8DzKyFDvaqQs7LnWwwmBA==} - - '@types/semver@7.5.8': - resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} - - '@types/stack-utils@2.0.3': - resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} - - '@types/ws@8.5.12': - resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} - - '@types/yargs-parser@21.0.3': - resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} - - '@types/yargs@17.0.33': - resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==} - - '@typescript-eslint/eslint-plugin@8.5.0': - resolution: {integrity: sha512-lHS5hvz33iUFQKuPFGheAB84LwcJ60G8vKnEhnfcK1l8kGVLro2SFYW6K0/tj8FUhRJ0VHyg1oAfg50QGbPPHw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 - eslint: ^8.57.0 || ^9.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - - '@typescript-eslint/parser@8.5.0': - resolution: {integrity: sha512-gF77eNv0Xz2UJg/NbpWJ0kqAm35UMsvZf1GHj8D9MRFTj/V3tAciIWXfmPLsAAF/vUlpWPvUDyH1jjsr0cMVWw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - - '@typescript-eslint/scope-manager@8.5.0': - resolution: {integrity: sha512-06JOQ9Qgj33yvBEx6tpC8ecP9o860rsR22hWMEd12WcTRrfaFgHr2RB/CA/B+7BMhHkXT4chg2MyboGdFGawYg==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/type-utils@8.5.0': - resolution: {integrity: sha512-N1K8Ix+lUM+cIDhL2uekVn/ZD7TZW+9/rwz8DclQpcQ9rk4sIL5CAlBC0CugWKREmDjBzI/kQqU4wkg46jWLYA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - - '@typescript-eslint/types@8.5.0': - resolution: {integrity: sha512-qjkormnQS5wF9pjSi6q60bKUHH44j2APxfh9TQRXK8wbYVeDYYdYJGIROL87LGZZ2gz3Rbmjc736qyL8deVtdw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - '@typescript-eslint/typescript-estree@8.5.0': - resolution: {integrity: sha512-vEG2Sf9P8BPQ+d0pxdfndw3xIXaoSjliG0/Ejk7UggByZPKXmJmw3GW5jV2gHNQNawBUyfahoSiCFVov0Ruf7Q==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - - '@typescript-eslint/utils@8.5.0': - resolution: {integrity: sha512-6yyGYVL0e+VzGYp60wvkBHiqDWOpT63pdMV2CVG4LVDd5uR6q1qQN/7LafBZtAtNIn/mqXjsSeS5ggv/P0iECw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - eslint: ^8.57.0 || ^9.0.0 - - '@typescript-eslint/visitor-keys@8.5.0': - resolution: {integrity: sha512-yTPqMnbAZJNy2Xq2XU8AdtOW9tJIr+UQb64aXB9f3B1498Zx9JorVgFJcZpEc9UBuCCrdzKID2RGAMkYcDtZOw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - acorn-jsx@5.3.2: - resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} - peerDependencies: - acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - - acorn@8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} - engines: {node: '>=0.4.0'} - hasBin: true - - ajv@6.12.6: - resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} - - ansi-escapes@4.3.2: - resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} - engines: {node: '>=8'} - - ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - - ansi-styles@3.2.1: - resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} - engines: {node: '>=4'} - - ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - - ansi-styles@5.2.0: - resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} - engines: {node: '>=10'} - - anymatch@3.1.3: - resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} - engines: {node: '>= 8'} - - argparse@1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - - argparse@2.0.1: - resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - - async@3.2.6: - resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} - - asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - - axios@1.7.7: - resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} - - babel-jest@29.7.0: - resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.8.0 - - babel-plugin-istanbul@6.1.1: - resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} - engines: {node: '>=8'} - - babel-plugin-jest-hoist@29.6.3: - resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - babel-preset-current-node-syntax@1.1.0: - resolution: {integrity: sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==} - peerDependencies: - '@babel/core': ^7.0.0 - - babel-preset-jest@29.6.3: - resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.0.0 - - balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - - brace-expansion@1.1.11: - resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} - - brace-expansion@2.0.1: - resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - - browserslist@4.23.3: - resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==} - engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} - hasBin: true - - bs-logger@0.2.6: - resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} - engines: {node: '>= 6'} - - bser@2.1.1: - resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} - - buffer-from@1.1.2: - resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - - callsites@3.1.0: - resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} - engines: {node: '>=6'} - - camelcase@5.3.1: - resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} - engines: {node: '>=6'} - - camelcase@6.3.0: - resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} - engines: {node: '>=10'} - - caniuse-lite@1.0.30001653: - resolution: {integrity: sha512-XGWQVB8wFQ2+9NZwZ10GxTYC5hk0Fa+q8cSkr0tgvMhYhMHP/QC+WTgrePMDBWiWc/pV+1ik82Al20XOK25Gcw==} - - chalk@2.4.2: - resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} - engines: {node: '>=4'} - - chalk@4.1.2: - resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} - engines: {node: '>=10'} - - char-regex@1.0.2: - resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} - engines: {node: '>=10'} - - ci-info@3.9.0: - resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} - engines: {node: '>=8'} - - cjs-module-lexer@1.4.0: - resolution: {integrity: sha512-N1NGmowPlGBLsOZLPvm48StN04V4YvQRL0i6b7ctrVY3epjP/ct7hFLOItz6pDIvRjwpfPxi52a2UWV2ziir8g==} - - cliui@8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - - co@4.6.0: - resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} - engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} - - collect-v8-coverage@1.0.2: - resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==} - - color-convert@1.9.3: - resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} - - color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - - color-name@1.1.3: - resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - - color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - - combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - - concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - - convert-source-map@2.0.0: - resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - - create-jest@29.7.0: - resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - - cross-spawn@7.0.3: - resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} - engines: {node: '>= 8'} - - debug@4.3.6: - resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - - dedent@1.5.3: - resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} - peerDependencies: - babel-plugin-macros: ^3.1.0 - peerDependenciesMeta: - babel-plugin-macros: - optional: true - - deep-is@0.1.4: - resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} - - deepmerge@4.3.1: - resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} - engines: {node: '>=0.10.0'} - - delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - - detect-newline@3.1.0: - resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} - engines: {node: '>=8'} - - diff-sequences@29.6.3: - resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - ejs@3.1.10: - resolution: {integrity: sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==} - engines: {node: '>=0.10.0'} - hasBin: true - - electron-to-chromium@1.5.13: - resolution: {integrity: sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==} - - emittery@0.13.1: - resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} - engines: {node: '>=12'} - - emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - - error-ex@1.3.2: - resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} - - escalade@3.1.2: - resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} - engines: {node: '>=6'} - - escape-string-regexp@1.0.5: - resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} - engines: {node: '>=0.8.0'} - - escape-string-regexp@2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - - escape-string-regexp@4.0.0: - resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} - engines: {node: '>=10'} - - eslint-scope@8.0.2: - resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - eslint-visitor-keys@3.4.3: - resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - - eslint-visitor-keys@4.0.0: - resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - eslint@9.10.0: - resolution: {integrity: sha512-Y4D0IgtBZfOcOUAIQTSXBKoNGfY0REGqHJG6+Q81vNippW5YlKjHFj4soMxamKK1NXHUWuBZTLdU3Km+L/pcHw==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - hasBin: true - peerDependencies: - jiti: '*' - peerDependenciesMeta: - jiti: - optional: true - - espree@10.1.0: - resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - - esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - - esquery@1.6.0: - resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} - engines: {node: '>=0.10'} - - esrecurse@4.3.0: - resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} - engines: {node: '>=4.0'} - - estraverse@5.3.0: - resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} - engines: {node: '>=4.0'} - - esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - - execa@5.1.1: - resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} - engines: {node: '>=10'} - - exit@0.1.2: - resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} - engines: {node: '>= 0.8.0'} - - expect@29.7.0: - resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - - fast-glob@3.3.2: - resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} - engines: {node: '>=8.6.0'} - - fast-json-stable-stringify@2.1.0: - resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} - - fast-levenshtein@2.0.6: - resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - - fastq@1.17.1: - resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} - - fb-watchman@2.0.2: - resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} - - file-entry-cache@8.0.0: - resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} - engines: {node: '>=16.0.0'} - - filelist@1.0.4: - resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} - - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - - find-up@4.1.0: - resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} - engines: {node: '>=8'} - - find-up@5.0.0: - resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} - engines: {node: '>=10'} - - flat-cache@4.0.1: - resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} - engines: {node: '>=16'} - - flatted@3.3.1: - resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} - - follow-redirects@1.15.6: - resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - - form-data@4.0.0: - resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} - engines: {node: '>= 6'} - - fs.realpath@1.0.0: - resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} - - fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - - function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - - gensync@1.0.0-beta.2: - resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} - engines: {node: '>=6.9.0'} - - get-caller-file@2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - - get-package-type@0.1.0: - resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} - engines: {node: '>=8.0.0'} - - get-stream@6.0.1: - resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} - engines: {node: '>=10'} - - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - - glob-parent@6.0.2: - resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} - engines: {node: '>=10.13.0'} - - glob@7.2.3: - resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Glob versions prior to v9 are no longer supported - - globals@11.12.0: - resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} - engines: {node: '>=4'} - - globals@14.0.0: - resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} - engines: {node: '>=18'} - - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - - graphemer@1.4.0: - resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - - has-flag@3.0.0: - resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} - engines: {node: '>=4'} - - has-flag@4.0.0: - resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} - engines: {node: '>=8'} - - hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} - engines: {node: '>= 0.4'} - - html-escaper@2.0.2: - resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} - - human-signals@2.1.0: - resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} - engines: {node: '>=10.17.0'} - - ignore@5.3.2: - resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} - engines: {node: '>= 4'} - - import-fresh@3.3.0: - resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} - engines: {node: '>=6'} - - import-local@3.2.0: - resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} - engines: {node: '>=8'} - hasBin: true - - imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - - inflight@1.0.6: - resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} - deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. - - inherits@2.0.4: - resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - - is-arrayish@0.2.1: - resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} - - is-core-module@2.15.1: - resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} - engines: {node: '>= 0.4'} - - is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - - is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - - is-generator-fn@2.1.0: - resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} - engines: {node: '>=6'} - - is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - - is-path-inside@3.0.3: - resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} - engines: {node: '>=8'} - - is-stream@2.0.1: - resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} - engines: {node: '>=8'} - - isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - - istanbul-lib-coverage@3.2.2: - resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} - engines: {node: '>=8'} - - istanbul-lib-instrument@5.2.1: - resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} - engines: {node: '>=8'} - - istanbul-lib-instrument@6.0.3: - resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==} - engines: {node: '>=10'} - - istanbul-lib-report@3.0.1: - resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} - engines: {node: '>=10'} - - istanbul-lib-source-maps@4.0.1: - resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} - engines: {node: '>=10'} - - istanbul-reports@3.1.7: - resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} - engines: {node: '>=8'} - - jake@10.9.2: - resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} - engines: {node: '>=10'} - hasBin: true - - jest-changed-files@29.7.0: - resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-circus@29.7.0: - resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-cli@29.7.0: - resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - jest-config@29.7.0: - resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@types/node': '*' - ts-node: '>=9.0.0' - peerDependenciesMeta: - '@types/node': - optional: true - ts-node: - optional: true - - jest-diff@29.7.0: - resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-docblock@29.7.0: - resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-each@29.7.0: - resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-environment-node@29.7.0: - resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-expect-message@1.1.3: - resolution: {integrity: sha512-bTK77T4P+zto+XepAX3low8XVQxDgaEqh3jSTQOG8qvPpD69LsIdyJTa+RmnJh3HNSzJng62/44RPPc7OIlFxg==} - - jest-extended@4.0.2: - resolution: {integrity: sha512-FH7aaPgtGYHc9mRjriS0ZEHYM5/W69tLrFTIdzm+yJgeoCmmrSB/luSfMSqWP9O29QWHPEmJ4qmU6EwsZideog==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - jest: '>=27.2.5' - peerDependenciesMeta: - jest: - optional: true - - jest-get-type@29.6.3: - resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-haste-map@29.7.0: - resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-leak-detector@29.7.0: - resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-matcher-utils@29.7.0: - resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-message-util@29.7.0: - resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-mock-extended@3.0.7: - resolution: {integrity: sha512-7lsKdLFcW9B9l5NzZ66S/yTQ9k8rFtnwYdCNuRU/81fqDWicNDVhitTSPnrGmNeNm0xyw0JHexEOShrIKRCIRQ==} - peerDependencies: - jest: ^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0 - typescript: ^3.0.0 || ^4.0.0 || ^5.0.0 - - jest-mock@29.7.0: - resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-pnp-resolver@1.2.3: - resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} - engines: {node: '>=6'} - peerDependencies: - jest-resolve: '*' - peerDependenciesMeta: - jest-resolve: - optional: true - - jest-regex-util@29.6.3: - resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-resolve-dependencies@29.7.0: - resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-resolve@29.7.0: - resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-runner@29.7.0: - resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-runtime@29.7.0: - resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-snapshot@29.7.0: - resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-util@29.7.0: - resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-validate@29.7.0: - resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-watcher@29.7.0: - resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest-worker@29.7.0: - resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - jest@29.7.0: - resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - - js-tokens@4.0.0: - resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - - js-yaml@3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - - js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} - hasBin: true - - jsesc@2.5.2: - resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} - engines: {node: '>=4'} - hasBin: true - - json-buffer@3.0.1: - resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} - - json-parse-even-better-errors@2.3.1: - resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} - - json-schema-traverse@0.4.1: - resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} - - json-stable-stringify-without-jsonify@1.0.1: - resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} - - json5@2.2.3: - resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} - engines: {node: '>=6'} - hasBin: true - - keyv@4.5.4: - resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - - kleur@3.0.3: - resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} - engines: {node: '>=6'} - - leven@3.1.0: - resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} - engines: {node: '>=6'} - - levn@0.4.1: - resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} - engines: {node: '>= 0.8.0'} - - lines-and-columns@1.2.4: - resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - - locate-path@5.0.0: - resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} - engines: {node: '>=8'} - - locate-path@6.0.0: - resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} - engines: {node: '>=10'} - - lodash.memoize@4.1.2: - resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} - - lodash.merge@4.6.2: - resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} - - lru-cache@5.1.1: - resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - - make-dir@4.0.0: - resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} - engines: {node: '>=10'} - - make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - - makeerror@1.0.12: - resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} - - merge-stream@2.0.0: - resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} - - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} - - mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - - mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - - mimic-fn@2.1.0: - resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} - engines: {node: '>=6'} - - minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - - minimatch@5.1.6: - resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} - engines: {node: '>=10'} - - minimatch@9.0.5: - resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} - engines: {node: '>=16 || 14 >=14.17'} - - ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - - natural-compare@1.4.0: - resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - - node-int64@0.4.0: - resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} - - node-releases@2.0.18: - resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} - - normalize-path@3.0.0: - resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} - engines: {node: '>=0.10.0'} - - npm-run-path@4.0.1: - resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} - engines: {node: '>=8'} - - once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - - onetime@5.1.2: - resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} - engines: {node: '>=6'} - - optionator@0.9.4: - resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} - engines: {node: '>= 0.8.0'} - - p-limit@2.3.0: - resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} - engines: {node: '>=6'} - - p-limit@3.1.0: - resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} - engines: {node: '>=10'} - - p-locate@4.1.0: - resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} - engines: {node: '>=8'} - - p-locate@5.0.0: - resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} - engines: {node: '>=10'} - - p-try@2.2.0: - resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} - engines: {node: '>=6'} - - parent-module@1.0.1: - resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} - engines: {node: '>=6'} - - parse-json@5.2.0: - resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} - engines: {node: '>=8'} - - path-exists@4.0.0: - resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} - engines: {node: '>=8'} - - path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - - path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - - path-parse@1.0.7: - resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - - picocolors@1.0.1: - resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} - - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - - pirates@4.0.6: - resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} - engines: {node: '>= 6'} - - pkg-dir@4.2.0: - resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} - engines: {node: '>=8'} - - prelude-ls@1.2.1: - resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} - engines: {node: '>= 0.8.0'} - - prettier@3.3.3: - resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} - engines: {node: '>=14'} - hasBin: true - - pretty-format@29.7.0: - resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - - prompts@2.4.2: - resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} - engines: {node: '>= 6'} - - proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - - punycode@2.3.1: - resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} - engines: {node: '>=6'} - - pure-rand@6.1.0: - resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} - - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - - ramda@0.30.1: - resolution: {integrity: sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw==} - - react-is@18.3.1: - resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} - - require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - - resolve-cwd@3.0.0: - resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} - engines: {node: '>=8'} - - resolve-from@4.0.0: - resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} - engines: {node: '>=4'} - - resolve-from@5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - - resolve.exports@2.0.2: - resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} - engines: {node: '>=10'} - - resolve@1.22.8: - resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} - hasBin: true - - reusify@1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - - rxjs@7.8.1: - resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} - - semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - - semver@7.6.3: - resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} - engines: {node: '>=10'} - hasBin: true - - shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - - shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - - signal-exit@3.0.7: - resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} - - sisteransi@1.0.5: - resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} - - slash@3.0.0: - resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} - engines: {node: '>=8'} - - source-map-support@0.5.13: - resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} - - source-map@0.6.1: - resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} - engines: {node: '>=0.10.0'} - - sprintf-js@1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - - stack-utils@2.0.6: - resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} - engines: {node: '>=10'} - - string-length@4.0.2: - resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} - engines: {node: '>=10'} - - string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - - strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} +dependencies: + semver: + specifier: ^7.6.3 + version: 7.6.3 + +devDependencies: + '@eslint/js': + specifier: ^9.10.0 + version: 9.10.0 + '@jest/globals': + specifier: ^29.7.0 + version: 29.7.0 + '@types/eslint__js': + specifier: ^8.42.3 + version: 8.42.3 + '@types/jest': + specifier: ^29.5.13 + version: 29.5.13 + '@types/node': + specifier: ^22.5.4 + version: 22.5.4 + '@types/ramda': + specifier: ^0.30.2 + version: 0.30.2 + '@types/semver': + specifier: ^7.5.8 + version: 7.5.8 + '@types/ws': + specifier: ^8.5.12 + version: 8.5.12 + axios: + specifier: ^1.7.7 + version: 1.7.7 + eslint: + specifier: ^9.10.0 + version: 9.10.0 + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@22.5.4) + jest-expect-message: + specifier: ^1.1.3 + version: 1.1.3 + jest-extended: + specifier: ^4.0.2 + version: 4.0.2(jest@29.7.0) + jest-mock-extended: + specifier: ^3.0.7 + version: 3.0.7(jest@29.7.0)(typescript@5.6.2) + object-hash: + specifier: 3.0.0 + version: 3.0.0 + prettier: + specifier: ^3.3.3 + version: 3.3.3 + ramda: + specifier: ^0.30.1 + version: 0.30.1 + rxjs: + specifier: ^7.8.1 + version: 7.8.1 + ts-jest: + specifier: ^29.2.5 + version: 29.2.5(@babel/core@7.25.2)(jest@29.7.0)(typescript@5.6.2) + typescript: + specifier: ^5.6.2 + version: 5.6.2 + typescript-eslint: + specifier: ^8.5.0 + version: 8.5.0(eslint@9.10.0)(typescript@5.6.2) + ws: + specifier: ^8.18.0 + version: 8.18.0 - strip-bom@4.0.0: - resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} - engines: {node: '>=8'} - - strip-final-newline@2.0.0: - resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} - engines: {node: '>=6'} - - strip-json-comments@3.1.1: - resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} - engines: {node: '>=8'} - - supports-color@5.5.0: - resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} - engines: {node: '>=4'} - - supports-color@7.2.0: - resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} - engines: {node: '>=8'} - - supports-color@8.1.1: - resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} - engines: {node: '>=10'} - - supports-preserve-symlinks-flag@1.0.0: - resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} - engines: {node: '>= 0.4'} - - test-exclude@6.0.0: - resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} - engines: {node: '>=8'} - - text-table@0.2.0: - resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - - tmpl@1.0.5: - resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} - - to-fast-properties@2.0.0: - resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} - engines: {node: '>=4'} - - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - - ts-api-utils@1.3.0: - resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} - engines: {node: '>=16'} - peerDependencies: - typescript: '>=4.2.0' - - ts-essentials@10.0.2: - resolution: {integrity: sha512-Xwag0TULqriaugXqVdDiGZ5wuZpqABZlpwQ2Ho4GDyiu/R2Xjkp/9+zcFxL7uzeLl/QCPrflnvpVYyS3ouT7Zw==} - peerDependencies: - typescript: '>=4.5.0' - peerDependenciesMeta: - typescript: - optional: true - - ts-jest@29.2.5: - resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==} - engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@jest/transform': ^29.0.0 - '@jest/types': ^29.0.0 - babel-jest: ^29.0.0 - esbuild: '*' - jest: ^29.0.0 - typescript: '>=4.3 <6' - peerDependenciesMeta: - '@babel/core': - optional: true - '@jest/transform': - optional: true - '@jest/types': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - - ts-toolbelt@9.6.0: - resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} - - tslib@2.7.0: - resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} - - type-check@0.4.0: - resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} - engines: {node: '>= 0.8.0'} - - type-detect@4.0.8: - resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} - engines: {node: '>=4'} - - type-fest@0.21.3: - resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} - engines: {node: '>=10'} - - types-ramda@0.30.1: - resolution: {integrity: sha512-1HTsf5/QVRmLzcGfldPFvkVsAdi1db1BBKzi7iW3KBUlOICg/nKnFS+jGqDJS3YD8VsWbAh7JiHeBvbsw8RPxA==} - - typescript-eslint@8.5.0: - resolution: {integrity: sha512-uD+XxEoSIvqtm4KE97etm32Tn5MfaZWgWfMMREStLxR6JzvHkc2Tkj7zhTEK5XmtpTmKHNnG8Sot6qDfhHtR1Q==} - engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - - typescript@5.6.2: - resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} - engines: {node: '>=14.17'} - hasBin: true - - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - - update-browserslist-db@1.1.0: - resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} - hasBin: true - peerDependencies: - browserslist: '>= 4.21.0' - - uri-js@4.4.1: - resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - - v8-to-istanbul@9.3.0: - resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} - engines: {node: '>=10.12.0'} - - walker@1.0.8: - resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} - - which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - - word-wrap@1.2.5: - resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} - engines: {node: '>=0.10.0'} - - wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - - wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - - write-file-atomic@4.0.2: - resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} - engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} - - ws@8.18.0: - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - y18n@5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - - yallist@3.1.1: - resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} - - yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - - yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - - yocto-queue@0.1.0: - resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} - engines: {node: '>=10'} - -snapshots: +packages: - '@ampproject/remapping@2.3.0': + /@ampproject/remapping@2.3.0: + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} dependencies: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 + dev: true - '@babel/code-frame@7.24.7': + /@babel/code-frame@7.24.7: + resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} + engines: {node: '>=6.9.0'} dependencies: '@babel/highlight': 7.24.7 picocolors: 1.0.1 + dev: true - '@babel/compat-data@7.25.4': {} + /@babel/compat-data@7.25.4: + resolution: {integrity: sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==} + engines: {node: '>=6.9.0'} + dev: true - '@babel/core@7.25.2': + /@babel/core@7.25.2: + resolution: {integrity: sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==} + engines: {node: '>=6.9.0'} dependencies: '@ampproject/remapping': 2.3.0 '@babel/code-frame': 7.24.7 @@ -1744,30 +121,44 @@ snapshots: semver: 6.3.1 transitivePeerDependencies: - supports-color + dev: true - '@babel/generator@7.25.5': + /@babel/generator@7.25.5: + resolution: {integrity: sha512-abd43wyLfbWoxC6ahM8xTkqLpGB2iWBVyuKC9/srhFunCd1SDNrV1s72bBpK4hLj8KLzHBBcOblvLQZBNw9r3w==} + engines: {node: '>=6.9.0'} dependencies: '@babel/types': 7.25.4 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 + dev: true - '@babel/helper-compilation-targets@7.25.2': + /@babel/helper-compilation-targets@7.25.2: + resolution: {integrity: sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==} + engines: {node: '>=6.9.0'} dependencies: '@babel/compat-data': 7.25.4 '@babel/helper-validator-option': 7.24.8 browserslist: 4.23.3 lru-cache: 5.1.1 semver: 6.3.1 + dev: true - '@babel/helper-module-imports@7.24.7': + /@babel/helper-module-imports@7.24.7: + resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==} + engines: {node: '>=6.9.0'} dependencies: '@babel/traverse': 7.25.4 '@babel/types': 7.25.4 transitivePeerDependencies: - supports-color + dev: true - '@babel/helper-module-transforms@7.25.2(@babel/core@7.25.2)': + /@babel/helper-module-transforms@7.25.2(@babel/core@7.25.2): + resolution: {integrity: sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.2 '@babel/helper-module-imports': 7.24.7 @@ -1776,130 +167,235 @@ snapshots: '@babel/traverse': 7.25.4 transitivePeerDependencies: - supports-color + dev: true - '@babel/helper-plugin-utils@7.24.8': {} + /@babel/helper-plugin-utils@7.24.8: + resolution: {integrity: sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==} + engines: {node: '>=6.9.0'} + dev: true - '@babel/helper-simple-access@7.24.7': + /@babel/helper-simple-access@7.24.7: + resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} + engines: {node: '>=6.9.0'} dependencies: '@babel/traverse': 7.25.4 '@babel/types': 7.25.4 transitivePeerDependencies: - supports-color + dev: true - '@babel/helper-string-parser@7.24.8': {} + /@babel/helper-string-parser@7.24.8: + resolution: {integrity: sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==} + engines: {node: '>=6.9.0'} + dev: true - '@babel/helper-validator-identifier@7.24.7': {} + /@babel/helper-validator-identifier@7.24.7: + resolution: {integrity: sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==} + engines: {node: '>=6.9.0'} + dev: true - '@babel/helper-validator-option@7.24.8': {} + /@babel/helper-validator-option@7.24.8: + resolution: {integrity: sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==} + engines: {node: '>=6.9.0'} + dev: true - '@babel/helpers@7.25.0': + /@babel/helpers@7.25.0: + resolution: {integrity: sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw==} + engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.25.0 '@babel/types': 7.25.4 + dev: true - '@babel/highlight@7.24.7': + /@babel/highlight@7.24.7: + resolution: {integrity: sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==} + engines: {node: '>=6.9.0'} dependencies: '@babel/helper-validator-identifier': 7.24.7 chalk: 2.4.2 js-tokens: 4.0.0 picocolors: 1.0.1 + dev: true - '@babel/parser@7.25.4': + /@babel/parser@7.25.4: + resolution: {integrity: sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA==} + engines: {node: '>=6.0.0'} + hasBin: true dependencies: '@babel/types': 7.25.4 + dev: true - '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.25.2)': + /@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.25.2): + resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.25.2)': + /@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.25.2): + resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.25.2)': + /@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.25.2): + resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.25.2)': + /@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.25.2): + resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-import-attributes@7.24.7(@babel/core@7.25.2)': + /@babel/plugin-syntax-import-attributes@7.24.7(@babel/core@7.25.2): + resolution: {integrity: sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.25.2)': + /@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.25.2): + resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.25.2)': + /@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.25.2): + resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.25.2)': + /@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.25.2): + resolution: {integrity: sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.25.2)': + /@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.25.2): + resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.25.2)': + /@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.25.2): + resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.25.2)': + /@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.25.2): + resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.25.2)': + /@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.25.2): + resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.25.2)': + /@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.25.2): + resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.25.2)': + /@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.25.2): + resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.25.2)': + /@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.25.2): + resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.25.2)': + /@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.25.2): + resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/plugin-syntax-typescript@7.25.4(@babel/core@7.25.2)': + /@babel/plugin-syntax-typescript@7.25.4(@babel/core@7.25.2): + resolution: {integrity: sha512-uMOCoHVU52BsSWxPOMVv5qKRdeSlPuImUCB2dlPuBSU+W2/ROE7/Zg8F2Kepbk+8yBa68LlRKxO+xgEVWorsDg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 + dev: true - '@babel/template@7.25.0': + /@babel/template@7.25.0: + resolution: {integrity: sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==} + engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.24.7 '@babel/parser': 7.25.4 '@babel/types': 7.25.4 + dev: true - '@babel/traverse@7.25.4': + /@babel/traverse@7.25.4: + resolution: {integrity: sha512-VJ4XsrD+nOvlXyLzmLzUs/0qjFS4sK30te5yEFlvbbUNEgKaVb2BHZUpAL+ttLPQAHNrsI3zZisbfha5Cvr8vg==} + engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.24.7 '@babel/generator': 7.25.5 @@ -1910,31 +406,50 @@ snapshots: globals: 11.12.0 transitivePeerDependencies: - supports-color + dev: true - '@babel/types@7.25.4': + /@babel/types@7.25.4: + resolution: {integrity: sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ==} + engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 to-fast-properties: 2.0.0 + dev: true - '@bcoe/v8-coverage@0.2.3': {} + /@bcoe/v8-coverage@0.2.3: + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + dev: true - '@eslint-community/eslint-utils@4.4.0(eslint@9.10.0)': + /@eslint-community/eslint-utils@4.4.0(eslint@9.10.0): + resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: eslint: 9.10.0 eslint-visitor-keys: 3.4.3 + dev: true - '@eslint-community/regexpp@4.11.0': {} + /@eslint-community/regexpp@4.11.1: + resolution: {integrity: sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + dev: true - '@eslint/config-array@0.18.0': + /@eslint/config-array@0.18.0: + resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: '@eslint/object-schema': 2.1.4 debug: 4.3.6 minimatch: 3.1.2 transitivePeerDependencies: - supports-color + dev: true - '@eslint/eslintrc@3.1.0': + /@eslint/eslintrc@3.1.0: + resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: ajv: 6.12.6 debug: 4.3.6 @@ -1947,30 +462,54 @@ snapshots: strip-json-comments: 3.1.1 transitivePeerDependencies: - supports-color + dev: true - '@eslint/js@9.10.0': {} + /@eslint/js@9.10.0: + resolution: {integrity: sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true - '@eslint/object-schema@2.1.4': {} + /@eslint/object-schema@2.1.4: + resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true - '@eslint/plugin-kit@0.1.0': + /@eslint/plugin-kit@0.1.0: + resolution: {integrity: sha512-autAXT203ixhqei9xt+qkYOvY8l6LAFIdT2UXc/RPNeUVfqRF1BV94GTJyVPFKT8nFM6MyVJhjLj9E8JWvf5zQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: levn: 0.4.1 + dev: true - '@humanwhocodes/module-importer@1.0.1': {} + /@humanwhocodes/module-importer@1.0.1: + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + dev: true - '@humanwhocodes/retry@0.3.0': {} + /@humanwhocodes/retry@0.3.0: + resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==} + engines: {node: '>=18.18'} + dev: true - '@istanbuljs/load-nyc-config@1.1.0': + /@istanbuljs/load-nyc-config@1.1.0: + resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} + engines: {node: '>=8'} dependencies: camelcase: 5.3.1 find-up: 4.1.0 get-package-type: 0.1.0 js-yaml: 3.14.1 resolve-from: 5.0.0 + dev: true - '@istanbuljs/schema@0.1.3': {} + /@istanbuljs/schema@0.1.3: + resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} + engines: {node: '>=8'} + dev: true - '@jest/console@29.7.0': + /@jest/console@29.7.0: + resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 '@types/node': 22.5.4 @@ -1978,8 +517,16 @@ snapshots: jest-message-util: 29.7.0 jest-util: 29.7.0 slash: 3.0.0 + dev: true - '@jest/core@29.7.0': + /@jest/core@29.7.0: + resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true dependencies: '@jest/console': 29.7.0 '@jest/reporters': 29.7.0 @@ -2013,26 +560,38 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + dev: true - '@jest/environment@29.7.0': + /@jest/environment@29.7.0: + resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 '@types/node': 22.5.4 jest-mock: 29.7.0 + dev: true - '@jest/expect-utils@29.7.0': + /@jest/expect-utils@29.7.0: + resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: jest-get-type: 29.6.3 + dev: true - '@jest/expect@29.7.0': + /@jest/expect@29.7.0: + resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: expect: 29.7.0 jest-snapshot: 29.7.0 transitivePeerDependencies: - supports-color + dev: true - '@jest/fake-timers@29.7.0': + /@jest/fake-timers@29.7.0: + resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 @@ -2040,8 +599,11 @@ snapshots: jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 + dev: true - '@jest/globals@29.7.0': + /@jest/globals@29.7.0: + resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/environment': 29.7.0 '@jest/expect': 29.7.0 @@ -2049,8 +611,16 @@ snapshots: jest-mock: 29.7.0 transitivePeerDependencies: - supports-color + dev: true - '@jest/reporters@29.7.0': + /@jest/reporters@29.7.0: + resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true dependencies: '@bcoe/v8-coverage': 0.2.3 '@jest/console': 29.7.0 @@ -2078,32 +648,47 @@ snapshots: v8-to-istanbul: 9.3.0 transitivePeerDependencies: - supports-color + dev: true - '@jest/schemas@29.6.3': + /@jest/schemas@29.6.3: + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@sinclair/typebox': 0.27.8 + dev: true - '@jest/source-map@29.6.3': + /@jest/source-map@29.6.3: + resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jridgewell/trace-mapping': 0.3.25 callsites: 3.1.0 graceful-fs: 4.2.11 + dev: true - '@jest/test-result@29.7.0': + /@jest/test-result@29.7.0: + resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/console': 29.7.0 '@jest/types': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 collect-v8-coverage: 1.0.2 + dev: true - '@jest/test-sequencer@29.7.0': + /@jest/test-sequencer@29.7.0: + resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/test-result': 29.7.0 graceful-fs: 4.2.11 jest-haste-map: 29.7.0 slash: 3.0.0 + dev: true - '@jest/transform@29.7.0': + /@jest/transform@29.7.0: + resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/core': 7.25.2 '@jest/types': 29.6.3 @@ -2122,8 +707,11 @@ snapshots: write-file-atomic: 4.0.2 transitivePeerDependencies: - supports-color + dev: true - '@jest/types@29.6.3': + /@jest/types@29.6.3: + resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 @@ -2131,124 +719,202 @@ snapshots: '@types/node': 22.5.4 '@types/yargs': 17.0.33 chalk: 4.1.2 + dev: true - '@jridgewell/gen-mapping@0.3.5': + /@jridgewell/gen-mapping@0.3.5: + resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + engines: {node: '>=6.0.0'} dependencies: '@jridgewell/set-array': 1.2.1 '@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/trace-mapping': 0.3.25 + dev: true - '@jridgewell/resolve-uri@3.1.2': {} + /@jridgewell/resolve-uri@3.1.2: + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + dev: true - '@jridgewell/set-array@1.2.1': {} + /@jridgewell/set-array@1.2.1: + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + dev: true - '@jridgewell/sourcemap-codec@1.5.0': {} + /@jridgewell/sourcemap-codec@1.5.0: + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + dev: true - '@jridgewell/trace-mapping@0.3.25': + /@jridgewell/trace-mapping@0.3.25: + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} dependencies: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + dev: true - '@nodelib/fs.scandir@2.1.5': + /@nodelib/fs.scandir@2.1.5: + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} dependencies: '@nodelib/fs.stat': 2.0.5 run-parallel: 1.2.0 + dev: true - '@nodelib/fs.stat@2.0.5': {} + /@nodelib/fs.stat@2.0.5: + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + dev: true - '@nodelib/fs.walk@1.2.8': + /@nodelib/fs.walk@1.2.8: + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} dependencies: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 + dev: true - '@sinclair/typebox@0.27.8': {} + /@sinclair/typebox@0.27.8: + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + dev: true - '@sinonjs/commons@3.0.1': + /@sinonjs/commons@3.0.1: + resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} dependencies: type-detect: 4.0.8 + dev: true - '@sinonjs/fake-timers@10.3.0': + /@sinonjs/fake-timers@10.3.0: + resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} dependencies: '@sinonjs/commons': 3.0.1 + dev: true - '@types/babel__core@7.20.5': + /@types/babel__core@7.20.5: + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} dependencies: '@babel/parser': 7.25.4 '@babel/types': 7.25.4 '@types/babel__generator': 7.6.8 '@types/babel__template': 7.4.4 '@types/babel__traverse': 7.20.6 + dev: true - '@types/babel__generator@7.6.8': + /@types/babel__generator@7.6.8: + resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==} dependencies: '@babel/types': 7.25.4 + dev: true - '@types/babel__template@7.4.4': + /@types/babel__template@7.4.4: + resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} dependencies: '@babel/parser': 7.25.4 '@babel/types': 7.25.4 + dev: true - '@types/babel__traverse@7.20.6': + /@types/babel__traverse@7.20.6: + resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} dependencies: '@babel/types': 7.25.4 + dev: true - '@types/eslint@9.6.1': + /@types/eslint@9.6.1: + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} dependencies: '@types/estree': 1.0.5 '@types/json-schema': 7.0.15 + dev: true - '@types/eslint__js@8.42.3': + /@types/eslint__js@8.42.3: + resolution: {integrity: sha512-alfG737uhmPdnvkrLdZLcEKJ/B8s9Y4hrZ+YAdzUeoArBlSUERA2E87ROfOaS4jd/C45fzOoZzidLc1IPwLqOw==} dependencies: '@types/eslint': 9.6.1 + dev: true - '@types/estree@1.0.5': {} + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + dev: true - '@types/graceful-fs@4.1.9': + /@types/graceful-fs@4.1.9: + resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} dependencies: '@types/node': 22.5.4 + dev: true - '@types/istanbul-lib-coverage@2.0.6': {} + /@types/istanbul-lib-coverage@2.0.6: + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} + dev: true - '@types/istanbul-lib-report@3.0.3': + /@types/istanbul-lib-report@3.0.3: + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} dependencies: '@types/istanbul-lib-coverage': 2.0.6 + dev: true - '@types/istanbul-reports@3.0.4': + /@types/istanbul-reports@3.0.4: + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} dependencies: '@types/istanbul-lib-report': 3.0.3 + dev: true - '@types/jest@29.5.13': + /@types/jest@29.5.13: + resolution: {integrity: sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==} dependencies: expect: 29.7.0 pretty-format: 29.7.0 + dev: true - '@types/json-schema@7.0.15': {} + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + dev: true - '@types/node@22.5.4': + /@types/node@22.5.4: + resolution: {integrity: sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==} dependencies: undici-types: 6.19.8 + dev: true - '@types/ramda@0.30.2': + /@types/ramda@0.30.2: + resolution: {integrity: sha512-PyzHvjCalm2BRYjAU6nIB3TprYwMNOUY/7P/N8bSzp9W/yM2YrtGtAnnVtaCNSeOZ8DzKyFDvaqQs7LnWwwmBA==} dependencies: types-ramda: 0.30.1 + dev: true - '@types/semver@7.5.8': {} + /@types/semver@7.5.8: + resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} + dev: true - '@types/stack-utils@2.0.3': {} + /@types/stack-utils@2.0.3: + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + dev: true - '@types/ws@8.5.12': + /@types/ws@8.5.12: + resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} dependencies: '@types/node': 22.5.4 + dev: true - '@types/yargs-parser@21.0.3': {} + /@types/yargs-parser@21.0.3: + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} + dev: true - '@types/yargs@17.0.33': + /@types/yargs@17.0.33: + resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==} dependencies: '@types/yargs-parser': 21.0.3 + dev: true - '@typescript-eslint/eslint-plugin@8.5.0(@typescript-eslint/parser@8.5.0(eslint@9.10.0)(typescript@5.6.2))(eslint@9.10.0)(typescript@5.6.2)': + /@typescript-eslint/eslint-plugin@8.5.0(@typescript-eslint/parser@8.5.0)(eslint@9.10.0)(typescript@5.6.2): + resolution: {integrity: sha512-lHS5hvz33iUFQKuPFGheAB84LwcJ60G8vKnEhnfcK1l8kGVLro2SFYW6K0/tj8FUhRJ0VHyg1oAfg50QGbPPHw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: - '@eslint-community/regexpp': 4.11.0 + '@eslint-community/regexpp': 4.11.1 '@typescript-eslint/parser': 8.5.0(eslint@9.10.0)(typescript@5.6.2) '@typescript-eslint/scope-manager': 8.5.0 '@typescript-eslint/type-utils': 8.5.0(eslint@9.10.0)(typescript@5.6.2) @@ -2259,12 +925,20 @@ snapshots: ignore: 5.3.2 natural-compare: 1.4.0 ts-api-utils: 1.3.0(typescript@5.6.2) - optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color + dev: true - '@typescript-eslint/parser@8.5.0(eslint@9.10.0)(typescript@5.6.2)': + /@typescript-eslint/parser@8.5.0(eslint@9.10.0)(typescript@5.6.2): + resolution: {integrity: sha512-gF77eNv0Xz2UJg/NbpWJ0kqAm35UMsvZf1GHj8D9MRFTj/V3tAciIWXfmPLsAAF/vUlpWPvUDyH1jjsr0cMVWw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: '@typescript-eslint/scope-manager': 8.5.0 '@typescript-eslint/types': 8.5.0 @@ -2272,31 +946,51 @@ snapshots: '@typescript-eslint/visitor-keys': 8.5.0 debug: 4.3.6 eslint: 9.10.0 - optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color + dev: true - '@typescript-eslint/scope-manager@8.5.0': + /@typescript-eslint/scope-manager@8.5.0: + resolution: {integrity: sha512-06JOQ9Qgj33yvBEx6tpC8ecP9o860rsR22hWMEd12WcTRrfaFgHr2RB/CA/B+7BMhHkXT4chg2MyboGdFGawYg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: '@typescript-eslint/types': 8.5.0 '@typescript-eslint/visitor-keys': 8.5.0 + dev: true - '@typescript-eslint/type-utils@8.5.0(eslint@9.10.0)(typescript@5.6.2)': + /@typescript-eslint/type-utils@8.5.0(eslint@9.10.0)(typescript@5.6.2): + resolution: {integrity: sha512-N1K8Ix+lUM+cIDhL2uekVn/ZD7TZW+9/rwz8DclQpcQ9rk4sIL5CAlBC0CugWKREmDjBzI/kQqU4wkg46jWLYA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: '@typescript-eslint/typescript-estree': 8.5.0(typescript@5.6.2) '@typescript-eslint/utils': 8.5.0(eslint@9.10.0)(typescript@5.6.2) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.6.2) - optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - eslint - supports-color + dev: true - '@typescript-eslint/types@8.5.0': {} + /@typescript-eslint/types@8.5.0: + resolution: {integrity: sha512-qjkormnQS5wF9pjSi6q60bKUHH44j2APxfh9TQRXK8wbYVeDYYdYJGIROL87LGZZ2gz3Rbmjc736qyL8deVtdw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true - '@typescript-eslint/typescript-estree@8.5.0(typescript@5.6.2)': + /@typescript-eslint/typescript-estree@8.5.0(typescript@5.6.2): + resolution: {integrity: sha512-vEG2Sf9P8BPQ+d0pxdfndw3xIXaoSjliG0/Ejk7UggByZPKXmJmw3GW5jV2gHNQNawBUyfahoSiCFVov0Ruf7Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: '@typescript-eslint/types': 8.5.0 '@typescript-eslint/visitor-keys': 8.5.0 @@ -2306,12 +1000,16 @@ snapshots: minimatch: 9.0.5 semver: 7.6.3 ts-api-utils: 1.3.0(typescript@5.6.2) - optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - supports-color + dev: true - '@typescript-eslint/utils@8.5.0(eslint@9.10.0)(typescript@5.6.2)': + /@typescript-eslint/utils@8.5.0(eslint@9.10.0)(typescript@5.6.2): + resolution: {integrity: sha512-6yyGYVL0e+VzGYp60wvkBHiqDWOpT63pdMV2CVG4LVDd5uR6q1qQN/7LafBZtAtNIn/mqXjsSeS5ggv/P0iECw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.10.0) '@typescript-eslint/scope-manager': 8.5.0 @@ -2321,65 +1019,111 @@ snapshots: transitivePeerDependencies: - supports-color - typescript + dev: true - '@typescript-eslint/visitor-keys@8.5.0': + /@typescript-eslint/visitor-keys@8.5.0: + resolution: {integrity: sha512-yTPqMnbAZJNy2Xq2XU8AdtOW9tJIr+UQb64aXB9f3B1498Zx9JorVgFJcZpEc9UBuCCrdzKID2RGAMkYcDtZOw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: '@typescript-eslint/types': 8.5.0 eslint-visitor-keys: 3.4.3 + dev: true - acorn-jsx@5.3.2(acorn@8.12.1): + /acorn-jsx@5.3.2(acorn@8.12.1): + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: acorn: 8.12.1 + dev: true - acorn@8.12.1: {} + /acorn@8.12.1: + resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true - ajv@6.12.6: + /ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: fast-deep-equal: 3.1.3 fast-json-stable-stringify: 2.1.0 json-schema-traverse: 0.4.1 uri-js: 4.4.1 + dev: true - ansi-escapes@4.3.2: + /ansi-escapes@4.3.2: + resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} + engines: {node: '>=8'} dependencies: type-fest: 0.21.3 + dev: true - ansi-regex@5.0.1: {} + /ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + dev: true - ansi-styles@3.2.1: + /ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} dependencies: color-convert: 1.9.3 + dev: true - ansi-styles@4.3.0: + /ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} dependencies: color-convert: 2.0.1 + dev: true - ansi-styles@5.2.0: {} + /ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + dev: true - anymatch@3.1.3: + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} dependencies: normalize-path: 3.0.0 picomatch: 2.3.1 + dev: true - argparse@1.0.10: + /argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: sprintf-js: 1.0.3 + dev: true - argparse@2.0.1: {} + /argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + dev: true - async@3.2.6: {} + /async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + dev: true - asynckit@0.4.0: {} + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: true - axios@1.7.7: + /axios@1.7.7: + resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} dependencies: follow-redirects: 1.15.6 form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: - debug + dev: true - babel-jest@29.7.0(@babel/core@7.25.2): + /babel-jest@29.7.0(@babel/core@7.25.2): + resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.8.0 dependencies: '@babel/core': 7.25.2 '@jest/transform': 29.7.0 @@ -2391,8 +1135,11 @@ snapshots: slash: 3.0.0 transitivePeerDependencies: - supports-color + dev: true - babel-plugin-istanbul@6.1.1: + /babel-plugin-istanbul@6.1.1: + resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} + engines: {node: '>=8'} dependencies: '@babel/helper-plugin-utils': 7.24.8 '@istanbuljs/load-nyc-config': 1.1.0 @@ -2401,15 +1148,22 @@ snapshots: test-exclude: 6.0.0 transitivePeerDependencies: - supports-color + dev: true - babel-plugin-jest-hoist@29.6.3: + /babel-plugin-jest-hoist@29.6.3: + resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/template': 7.25.0 '@babel/types': 7.25.4 '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.6 + dev: true - babel-preset-current-node-syntax@1.1.0(@babel/core@7.25.2): + /babel-preset-current-node-syntax@1.1.0(@babel/core@7.25.2): + resolution: {integrity: sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==} + peerDependencies: + '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.2 '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.25.2) @@ -2427,101 +1181,179 @@ snapshots: '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.25.2) '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.25.2) '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.25.2) + dev: true - babel-preset-jest@29.6.3(@babel/core@7.25.2): + /babel-preset-jest@29.6.3(@babel/core@7.25.2): + resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.2 babel-plugin-jest-hoist: 29.6.3 babel-preset-current-node-syntax: 1.1.0(@babel/core@7.25.2) + dev: true - balanced-match@1.0.2: {} + /balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + dev: true - brace-expansion@1.1.11: + /brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} dependencies: balanced-match: 1.0.2 concat-map: 0.0.1 + dev: true - brace-expansion@2.0.1: + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} dependencies: balanced-match: 1.0.2 + dev: true - braces@3.0.3: + /braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} dependencies: fill-range: 7.1.1 + dev: true - browserslist@4.23.3: + /browserslist@4.23.3: + resolution: {integrity: sha512-btwCFJVjI4YWDNfau8RhZ+B1Q/VLoUITrm3RlP6y1tYGWIOa+InuYiRGXUBXo8nA1qKmHMyLB/iVQg5TT4eFoA==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true dependencies: caniuse-lite: 1.0.30001653 electron-to-chromium: 1.5.13 node-releases: 2.0.18 update-browserslist-db: 1.1.0(browserslist@4.23.3) + dev: true - bs-logger@0.2.6: + /bs-logger@0.2.6: + resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} + engines: {node: '>= 6'} dependencies: fast-json-stable-stringify: 2.1.0 + dev: true - bser@2.1.1: + /bser@2.1.1: + resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} dependencies: node-int64: 0.4.0 + dev: true - buffer-from@1.1.2: {} + /buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + dev: true - callsites@3.1.0: {} + /callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + dev: true - camelcase@5.3.1: {} + /camelcase@5.3.1: + resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} + engines: {node: '>=6'} + dev: true - camelcase@6.3.0: {} + /camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + dev: true - caniuse-lite@1.0.30001653: {} + /caniuse-lite@1.0.30001653: + resolution: {integrity: sha512-XGWQVB8wFQ2+9NZwZ10GxTYC5hk0Fa+q8cSkr0tgvMhYhMHP/QC+WTgrePMDBWiWc/pV+1ik82Al20XOK25Gcw==} + dev: true - chalk@2.4.2: + /chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} dependencies: ansi-styles: 3.2.1 escape-string-regexp: 1.0.5 supports-color: 5.5.0 + dev: true - chalk@4.1.2: + /chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} dependencies: ansi-styles: 4.3.0 supports-color: 7.2.0 + dev: true - char-regex@1.0.2: {} + /char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + dev: true - ci-info@3.9.0: {} + /ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} + dev: true - cjs-module-lexer@1.4.0: {} + /cjs-module-lexer@1.4.0: + resolution: {integrity: sha512-N1NGmowPlGBLsOZLPvm48StN04V4YvQRL0i6b7ctrVY3epjP/ct7hFLOItz6pDIvRjwpfPxi52a2UWV2ziir8g==} + dev: true - cliui@8.0.1: + /cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} dependencies: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + dev: true - co@4.6.0: {} + /co@4.6.0: + resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} + engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} + dev: true - collect-v8-coverage@1.0.2: {} + /collect-v8-coverage@1.0.2: + resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==} + dev: true - color-convert@1.9.3: + /color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: color-name: 1.1.3 + dev: true - color-convert@2.0.1: + /color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} dependencies: color-name: 1.1.4 + dev: true - color-name@1.1.3: {} + /color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + dev: true - color-name@1.1.4: {} + /color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + dev: true - combined-stream@1.0.8: + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 + dev: true - concat-map@0.0.1: {} + /concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + dev: true - convert-source-map@2.0.0: {} + /convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + dev: true - create-jest@29.7.0(@types/node@22.5.4): + /create-jest@29.7.0(@types/node@22.5.4): + resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 @@ -2535,64 +1367,139 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + dev: true - cross-spawn@7.0.3: + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} dependencies: path-key: 3.1.1 shebang-command: 2.0.0 which: 2.0.2 + dev: true - debug@4.3.6: + /debug@4.3.6: + resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.1.2 + dev: true - dedent@1.5.3: {} + /dedent@1.5.3: + resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + dev: true - deep-is@0.1.4: {} + /deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + dev: true - deepmerge@4.3.1: {} + /deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + dev: true - delayed-stream@1.0.0: {} + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: true - detect-newline@3.1.0: {} + /detect-newline@3.1.0: + resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} + engines: {node: '>=8'} + dev: true - diff-sequences@29.6.3: {} + /diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true - ejs@3.1.10: + /ejs@3.1.10: + resolution: {integrity: sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==} + engines: {node: '>=0.10.0'} + hasBin: true dependencies: jake: 10.9.2 + dev: true - electron-to-chromium@1.5.13: {} + /electron-to-chromium@1.5.13: + resolution: {integrity: sha512-lbBcvtIJ4J6sS4tb5TLp1b4LyfCdMkwStzXPyAgVgTRAsep4bvrAGaBOP7ZJtQMNJpSQ9SqG4brWOroNaQtm7Q==} + dev: true - emittery@0.13.1: {} + /emittery@0.13.1: + resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} + engines: {node: '>=12'} + dev: true - emoji-regex@8.0.0: {} + /emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + dev: true - error-ex@1.3.2: + /error-ex@1.3.2: + resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} dependencies: is-arrayish: 0.2.1 + dev: true - escalade@3.1.2: {} + /escalade@3.1.2: + resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} + engines: {node: '>=6'} + dev: true - escape-string-regexp@1.0.5: {} + /escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + dev: true - escape-string-regexp@2.0.0: {} + /escape-string-regexp@2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + dev: true - escape-string-regexp@4.0.0: {} + /escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + dev: true - eslint-scope@8.0.2: + /eslint-scope@8.0.2: + resolution: {integrity: sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 + dev: true - eslint-visitor-keys@3.4.3: {} + /eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true - eslint-visitor-keys@4.0.0: {} + /eslint-visitor-keys@4.0.0: + resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dev: true - eslint@9.10.0: + /eslint@9.10.0: + resolution: {integrity: sha512-Y4D0IgtBZfOcOUAIQTSXBKoNGfY0REGqHJG6+Q81vNippW5YlKjHFj4soMxamKK1NXHUWuBZTLdU3Km+L/pcHw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@9.10.0) - '@eslint-community/regexpp': 4.11.0 + '@eslint-community/regexpp': 4.11.1 '@eslint/config-array': 0.18.0 '@eslint/eslintrc': 3.1.0 '@eslint/js': 9.10.0 @@ -2627,28 +1534,50 @@ snapshots: text-table: 0.2.0 transitivePeerDependencies: - supports-color + dev: true - espree@10.1.0: + /espree@10.1.0: + resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} dependencies: acorn: 8.12.1 acorn-jsx: 5.3.2(acorn@8.12.1) eslint-visitor-keys: 4.0.0 + dev: true - esprima@4.0.1: {} + /esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + dev: true - esquery@1.6.0: + /esquery@1.6.0: + resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} + engines: {node: '>=0.10'} dependencies: estraverse: 5.3.0 + dev: true - esrecurse@4.3.0: + /esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} dependencies: estraverse: 5.3.0 + dev: true - estraverse@5.3.0: {} + /estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + dev: true - esutils@2.0.3: {} + /esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + dev: true - execa@5.1.1: + /execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} dependencies: cross-spawn: 7.0.3 get-stream: 6.0.1 @@ -2659,100 +1588,179 @@ snapshots: onetime: 5.1.2 signal-exit: 3.0.7 strip-final-newline: 2.0.0 + dev: true - exit@0.1.2: {} + /exit@0.1.2: + resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} + engines: {node: '>= 0.8.0'} + dev: true - expect@29.7.0: + /expect@29.7.0: + resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/expect-utils': 29.7.0 jest-get-type: 29.6.3 jest-matcher-utils: 29.7.0 jest-message-util: 29.7.0 jest-util: 29.7.0 + dev: true - fast-deep-equal@3.1.3: {} + /fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + dev: true - fast-glob@3.3.2: + /fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 '@nodelib/fs.walk': 1.2.8 glob-parent: 5.1.2 merge2: 1.4.1 micromatch: 4.0.8 + dev: true - fast-json-stable-stringify@2.1.0: {} + /fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + dev: true - fast-levenshtein@2.0.6: {} + /fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + dev: true - fastq@1.17.1: + /fastq@1.17.1: + resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} dependencies: reusify: 1.0.4 + dev: true - fb-watchman@2.0.2: + /fb-watchman@2.0.2: + resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} dependencies: bser: 2.1.1 + dev: true - file-entry-cache@8.0.0: + /file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} dependencies: flat-cache: 4.0.1 + dev: true - filelist@1.0.4: + /filelist@1.0.4: + resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} dependencies: minimatch: 5.1.6 + dev: true - fill-range@7.1.1: + /fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} dependencies: to-regex-range: 5.0.1 + dev: true - find-up@4.1.0: + /find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} dependencies: locate-path: 5.0.0 path-exists: 4.0.0 + dev: true - find-up@5.0.0: + /find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} dependencies: locate-path: 6.0.0 path-exists: 4.0.0 + dev: true - flat-cache@4.0.1: + /flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} dependencies: flatted: 3.3.1 keyv: 4.5.4 + dev: true - flatted@3.3.1: {} + /flatted@3.3.1: + resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} + dev: true - follow-redirects@1.15.6: {} + /follow-redirects@1.15.6: + resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: true - form-data@4.0.0: + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} dependencies: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + dev: true - fs.realpath@1.0.0: {} + /fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + dev: true - fsevents@2.3.3: + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true optional: true - function-bind@1.1.2: {} + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true - gensync@1.0.0-beta.2: {} + /gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + dev: true - get-caller-file@2.0.5: {} + /get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + dev: true - get-package-type@0.1.0: {} + /get-package-type@0.1.0: + resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} + engines: {node: '>=8.0.0'} + dev: true - get-stream@6.0.1: {} + /get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + dev: true - glob-parent@5.1.2: + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} dependencies: is-glob: 4.0.3 + dev: true - glob-parent@6.0.2: + /glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} dependencies: is-glob: 4.0.3 + dev: true - glob@7.2.3: + /glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported dependencies: fs.realpath: 1.0.0 inflight: 1.0.6 @@ -2760,75 +1768,151 @@ snapshots: minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 + dev: true - globals@11.12.0: {} + /globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + dev: true - globals@14.0.0: {} + /globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + dev: true - graceful-fs@4.2.11: {} + /graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true - graphemer@1.4.0: {} + /graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + dev: true - has-flag@3.0.0: {} + /has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + dev: true - has-flag@4.0.0: {} + /has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + dev: true - hasown@2.0.2: + /hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} dependencies: function-bind: 1.1.2 + dev: true - html-escaper@2.0.2: {} + /html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + dev: true - human-signals@2.1.0: {} + /human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + dev: true - ignore@5.3.2: {} + /ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + dev: true - import-fresh@3.3.0: + /import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} dependencies: parent-module: 1.0.1 resolve-from: 4.0.0 + dev: true - import-local@3.2.0: + /import-local@3.2.0: + resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} + engines: {node: '>=8'} + hasBin: true dependencies: pkg-dir: 4.2.0 resolve-cwd: 3.0.0 + dev: true - imurmurhash@0.1.4: {} + /imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + dev: true - inflight@1.0.6: + /inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. dependencies: once: 1.4.0 wrappy: 1.0.2 + dev: true - inherits@2.0.4: {} + /inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + dev: true - is-arrayish@0.2.1: {} + /is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + dev: true - is-core-module@2.15.1: + /is-core-module@2.15.1: + resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} + engines: {node: '>= 0.4'} dependencies: hasown: 2.0.2 + dev: true - is-extglob@2.1.1: {} + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true - is-fullwidth-code-point@3.0.0: {} + /is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + dev: true - is-generator-fn@2.1.0: {} + /is-generator-fn@2.1.0: + resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} + engines: {node: '>=6'} + dev: true - is-glob@4.0.3: + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} dependencies: is-extglob: 2.1.1 + dev: true - is-number@7.0.0: {} + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true - is-path-inside@3.0.3: {} + /is-path-inside@3.0.3: + resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} + engines: {node: '>=8'} + dev: true - is-stream@2.0.1: {} + /is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + dev: true - isexe@2.0.0: {} + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true - istanbul-lib-coverage@3.2.2: {} + /istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} + engines: {node: '>=8'} + dev: true - istanbul-lib-instrument@5.2.1: + /istanbul-lib-instrument@5.2.1: + resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} + engines: {node: '>=8'} dependencies: '@babel/core': 7.25.2 '@babel/parser': 7.25.4 @@ -2837,8 +1921,11 @@ snapshots: semver: 6.3.1 transitivePeerDependencies: - supports-color + dev: true - istanbul-lib-instrument@6.0.3: + /istanbul-lib-instrument@6.0.3: + resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==} + engines: {node: '>=10'} dependencies: '@babel/core': 7.25.2 '@babel/parser': 7.25.4 @@ -2847,40 +1934,59 @@ snapshots: semver: 7.6.3 transitivePeerDependencies: - supports-color + dev: true - istanbul-lib-report@3.0.1: + /istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} dependencies: istanbul-lib-coverage: 3.2.2 make-dir: 4.0.0 supports-color: 7.2.0 + dev: true - istanbul-lib-source-maps@4.0.1: + /istanbul-lib-source-maps@4.0.1: + resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} + engines: {node: '>=10'} dependencies: debug: 4.3.6 istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: - supports-color + dev: true - istanbul-reports@3.1.7: + /istanbul-reports@3.1.7: + resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} + engines: {node: '>=8'} dependencies: html-escaper: 2.0.2 istanbul-lib-report: 3.0.1 + dev: true - jake@10.9.2: + /jake@10.9.2: + resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} + engines: {node: '>=10'} + hasBin: true dependencies: async: 3.2.6 chalk: 4.1.2 filelist: 1.0.4 minimatch: 3.1.2 + dev: true - jest-changed-files@29.7.0: + /jest-changed-files@29.7.0: + resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: execa: 5.1.1 jest-util: 29.7.0 p-limit: 3.1.0 + dev: true - jest-circus@29.7.0: + /jest-circus@29.7.0: + resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/environment': 29.7.0 '@jest/expect': 29.7.0 @@ -2905,8 +2011,17 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros - supports-color + dev: true - jest-cli@29.7.0(@types/node@22.5.4): + /jest-cli@29.7.0(@types/node@22.5.4): + resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 @@ -2924,12 +2039,24 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + dev: true - jest-config@29.7.0(@types/node@22.5.4): + /jest-config@29.7.0(@types/node@22.5.4): + resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@types/node': '*' + ts-node: '>=9.0.0' + peerDependenciesMeta: + '@types/node': + optional: true + ts-node: + optional: true dependencies: '@babel/core': 7.25.2 '@jest/test-sequencer': 29.7.0 '@jest/types': 29.6.3 + '@types/node': 22.5.4 babel-jest: 29.7.0(@babel/core@7.25.2) chalk: 4.1.2 ci-info: 3.9.0 @@ -2949,32 +2076,42 @@ snapshots: pretty-format: 29.7.0 slash: 3.0.0 strip-json-comments: 3.1.1 - optionalDependencies: - '@types/node': 22.5.4 transitivePeerDependencies: - babel-plugin-macros - supports-color + dev: true - jest-diff@29.7.0: + /jest-diff@29.7.0: + resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: chalk: 4.1.2 diff-sequences: 29.6.3 jest-get-type: 29.6.3 pretty-format: 29.7.0 + dev: true - jest-docblock@29.7.0: + /jest-docblock@29.7.0: + resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: detect-newline: 3.1.0 + dev: true - jest-each@29.7.0: + /jest-each@29.7.0: + resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 jest-get-type: 29.6.3 jest-util: 29.7.0 pretty-format: 29.7.0 + dev: true - jest-environment-node@29.7.0: + /jest-environment-node@29.7.0: + resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 @@ -2982,19 +2119,34 @@ snapshots: '@types/node': 22.5.4 jest-mock: 29.7.0 jest-util: 29.7.0 + dev: true - jest-expect-message@1.1.3: {} + /jest-expect-message@1.1.3: + resolution: {integrity: sha512-bTK77T4P+zto+XepAX3low8XVQxDgaEqh3jSTQOG8qvPpD69LsIdyJTa+RmnJh3HNSzJng62/44RPPc7OIlFxg==} + dev: true - jest-extended@4.0.2(jest@29.7.0(@types/node@22.5.4)): + /jest-extended@4.0.2(jest@29.7.0): + resolution: {integrity: sha512-FH7aaPgtGYHc9mRjriS0ZEHYM5/W69tLrFTIdzm+yJgeoCmmrSB/luSfMSqWP9O29QWHPEmJ4qmU6EwsZideog==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + jest: '>=27.2.5' + peerDependenciesMeta: + jest: + optional: true dependencies: + jest: 29.7.0(@types/node@22.5.4) jest-diff: 29.7.0 jest-get-type: 29.6.3 - optionalDependencies: - jest: 29.7.0(@types/node@22.5.4) + dev: true - jest-get-type@29.6.3: {} + /jest-get-type@29.6.3: + resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true - jest-haste-map@29.7.0: + /jest-haste-map@29.7.0: + resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 @@ -3009,20 +2161,29 @@ snapshots: walker: 1.0.8 optionalDependencies: fsevents: 2.3.3 + dev: true - jest-leak-detector@29.7.0: + /jest-leak-detector@29.7.0: + resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: jest-get-type: 29.6.3 pretty-format: 29.7.0 + dev: true - jest-matcher-utils@29.7.0: + /jest-matcher-utils@29.7.0: + resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: chalk: 4.1.2 jest-diff: 29.7.0 jest-get-type: 29.6.3 pretty-format: 29.7.0 + dev: true - jest-message-util@29.7.0: + /jest-message-util@29.7.0: + resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/code-frame': 7.24.7 '@jest/types': 29.6.3 @@ -3033,33 +2194,58 @@ snapshots: pretty-format: 29.7.0 slash: 3.0.0 stack-utils: 2.0.6 + dev: true - jest-mock-extended@3.0.7(jest@29.7.0(@types/node@22.5.4))(typescript@5.6.2): + /jest-mock-extended@3.0.7(jest@29.7.0)(typescript@5.6.2): + resolution: {integrity: sha512-7lsKdLFcW9B9l5NzZ66S/yTQ9k8rFtnwYdCNuRU/81fqDWicNDVhitTSPnrGmNeNm0xyw0JHexEOShrIKRCIRQ==} + peerDependencies: + jest: ^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0 + typescript: ^3.0.0 || ^4.0.0 || ^5.0.0 dependencies: jest: 29.7.0(@types/node@22.5.4) ts-essentials: 10.0.2(typescript@5.6.2) typescript: 5.6.2 + dev: true - jest-mock@29.7.0: + /jest-mock@29.7.0: + resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 '@types/node': 22.5.4 jest-util: 29.7.0 + dev: true - jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): - optionalDependencies: + /jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): + resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} + engines: {node: '>=6'} + peerDependencies: + jest-resolve: '*' + peerDependenciesMeta: + jest-resolve: + optional: true + dependencies: jest-resolve: 29.7.0 + dev: true - jest-regex-util@29.6.3: {} + /jest-regex-util@29.6.3: + resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true - jest-resolve-dependencies@29.7.0: + /jest-resolve-dependencies@29.7.0: + resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: jest-regex-util: 29.6.3 jest-snapshot: 29.7.0 transitivePeerDependencies: - supports-color + dev: true - jest-resolve@29.7.0: + /jest-resolve@29.7.0: + resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: chalk: 4.1.2 graceful-fs: 4.2.11 @@ -3070,8 +2256,11 @@ snapshots: resolve: 1.22.8 resolve.exports: 2.0.2 slash: 3.0.0 + dev: true - jest-runner@29.7.0: + /jest-runner@29.7.0: + resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/console': 29.7.0 '@jest/environment': 29.7.0 @@ -3096,8 +2285,11 @@ snapshots: source-map-support: 0.5.13 transitivePeerDependencies: - supports-color + dev: true - jest-runtime@29.7.0: + /jest-runtime@29.7.0: + resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 @@ -3123,8 +2315,11 @@ snapshots: strip-bom: 4.0.0 transitivePeerDependencies: - supports-color + dev: true - jest-snapshot@29.7.0: + /jest-snapshot@29.7.0: + resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@babel/core': 7.25.2 '@babel/generator': 7.25.5 @@ -3148,8 +2343,11 @@ snapshots: semver: 7.6.3 transitivePeerDependencies: - supports-color + dev: true - jest-util@29.7.0: + /jest-util@29.7.0: + resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 '@types/node': 22.5.4 @@ -3157,8 +2355,11 @@ snapshots: ci-info: 3.9.0 graceful-fs: 4.2.11 picomatch: 2.3.1 + dev: true - jest-validate@29.7.0: + /jest-validate@29.7.0: + resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 camelcase: 6.3.0 @@ -3166,8 +2367,11 @@ snapshots: jest-get-type: 29.6.3 leven: 3.1.0 pretty-format: 29.7.0 + dev: true - jest-watcher@29.7.0: + /jest-watcher@29.7.0: + resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 @@ -3177,15 +2381,27 @@ snapshots: emittery: 0.13.1 jest-util: 29.7.0 string-length: 4.0.2 + dev: true - jest-worker@29.7.0: + /jest-worker@29.7.0: + resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@types/node': 22.5.4 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 + dev: true - jest@29.7.0(@types/node@22.5.4): + /jest@29.7.0(@types/node@22.5.4): + resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 @@ -3196,123 +2412,231 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + dev: true - js-tokens@4.0.0: {} + /js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + dev: true - js-yaml@3.14.1: + /js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true dependencies: argparse: 1.0.10 esprima: 4.0.1 + dev: true - js-yaml@4.1.0: + /js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true dependencies: argparse: 2.0.1 + dev: true - jsesc@2.5.2: {} + /jsesc@2.5.2: + resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} + engines: {node: '>=4'} + hasBin: true + dev: true - json-buffer@3.0.1: {} + /json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + dev: true - json-parse-even-better-errors@2.3.1: {} + /json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + dev: true - json-schema-traverse@0.4.1: {} + /json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + dev: true - json-stable-stringify-without-jsonify@1.0.1: {} + /json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + dev: true - json5@2.2.3: {} + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: true - keyv@4.5.4: + /keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} dependencies: json-buffer: 3.0.1 + dev: true - kleur@3.0.3: {} + /kleur@3.0.3: + resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} + engines: {node: '>=6'} + dev: true - leven@3.1.0: {} + /leven@3.1.0: + resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} + engines: {node: '>=6'} + dev: true - levn@0.4.1: + /levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} dependencies: prelude-ls: 1.2.1 type-check: 0.4.0 + dev: true - lines-and-columns@1.2.4: {} + /lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + dev: true - locate-path@5.0.0: + /locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} dependencies: p-locate: 4.1.0 + dev: true - locate-path@6.0.0: + /locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} dependencies: p-locate: 5.0.0 + dev: true - lodash.memoize@4.1.2: {} + /lodash.memoize@4.1.2: + resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} + dev: true - lodash.merge@4.6.2: {} + /lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + dev: true - lru-cache@5.1.1: + /lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} dependencies: yallist: 3.1.1 + dev: true - make-dir@4.0.0: + /make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} dependencies: semver: 7.6.3 + dev: true - make-error@1.3.6: {} + /make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: true - makeerror@1.0.12: + /makeerror@1.0.12: + resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} dependencies: tmpl: 1.0.5 + dev: true - merge-stream@2.0.0: {} + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true - merge2@1.4.1: {} + /merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + dev: true - micromatch@4.0.8: + /micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} dependencies: braces: 3.0.3 picomatch: 2.3.1 + dev: true - mime-db@1.52.0: {} + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: true - mime-types@2.1.35: + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 + dev: true - mimic-fn@2.1.0: {} + /mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: true - minimatch@3.1.2: + /minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: brace-expansion: 1.1.11 + dev: true - minimatch@5.1.6: + /minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} dependencies: brace-expansion: 2.0.1 + dev: true - minimatch@9.0.5: + /minimatch@9.0.5: + resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} + engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 + dev: true - ms@2.1.2: {} + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true - natural-compare@1.4.0: {} + /natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + dev: true - node-int64@0.4.0: {} + /node-int64@0.4.0: + resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} + dev: true - node-releases@2.0.18: {} + /node-releases@2.0.18: + resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + dev: true - normalize-path@3.0.0: {} + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true - npm-run-path@4.0.1: + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} dependencies: path-key: 3.1.1 + dev: true - once@1.4.0: + /object-hash@3.0.0: + resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} + engines: {node: '>= 6'} + dev: true + + /once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 + dev: true - onetime@5.1.2: + /onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} dependencies: mimic-fn: 2.1.0 + dev: true - optionator@0.9.4: + /optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} dependencies: deep-is: 0.1.4 fast-levenshtein: 2.0.6 @@ -3320,199 +2644,401 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 word-wrap: 1.2.5 + dev: true - p-limit@2.3.0: + /p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} dependencies: p-try: 2.2.0 + dev: true - p-limit@3.1.0: + /p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} dependencies: yocto-queue: 0.1.0 + dev: true - p-locate@4.1.0: + /p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} dependencies: p-limit: 2.3.0 + dev: true - p-locate@5.0.0: + /p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} dependencies: p-limit: 3.1.0 + dev: true - p-try@2.2.0: {} + /p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + dev: true - parent-module@1.0.1: + /parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} dependencies: callsites: 3.1.0 + dev: true - parse-json@5.2.0: + /parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} dependencies: '@babel/code-frame': 7.24.7 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + dev: true - path-exists@4.0.0: {} + /path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + dev: true - path-is-absolute@1.0.1: {} + /path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + dev: true - path-key@3.1.1: {} + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true - path-parse@1.0.7: {} + /path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + dev: true - picocolors@1.0.1: {} + /picocolors@1.0.1: + resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + dev: true - picomatch@2.3.1: {} + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true - pirates@4.0.6: {} + /pirates@4.0.6: + resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} + engines: {node: '>= 6'} + dev: true - pkg-dir@4.2.0: + /pkg-dir@4.2.0: + resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} + engines: {node: '>=8'} dependencies: find-up: 4.1.0 + dev: true - prelude-ls@1.2.1: {} + /prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + dev: true - prettier@3.3.3: {} + /prettier@3.3.3: + resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + engines: {node: '>=14'} + hasBin: true + dev: true - pretty-format@29.7.0: + /pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 react-is: 18.3.1 + dev: true - prompts@2.4.2: + /prompts@2.4.2: + resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} + engines: {node: '>= 6'} dependencies: kleur: 3.0.3 sisteransi: 1.0.5 + dev: true - proxy-from-env@1.1.0: {} + /proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + dev: true - punycode@2.3.1: {} + /punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + dev: true - pure-rand@6.1.0: {} + /pure-rand@6.1.0: + resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} + dev: true - queue-microtask@1.2.3: {} + /queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + dev: true - ramda@0.30.1: {} + /ramda@0.30.1: + resolution: {integrity: sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw==} + dev: true - react-is@18.3.1: {} + /react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + dev: true - require-directory@2.1.1: {} + /require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + dev: true - resolve-cwd@3.0.0: + /resolve-cwd@3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} dependencies: resolve-from: 5.0.0 + dev: true - resolve-from@4.0.0: {} + /resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + dev: true - resolve-from@5.0.0: {} + /resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + dev: true - resolve.exports@2.0.2: {} + /resolve.exports@2.0.2: + resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} + engines: {node: '>=10'} + dev: true - resolve@1.22.8: + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true dependencies: is-core-module: 2.15.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 + dev: true - reusify@1.0.4: {} + /reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + dev: true - run-parallel@1.2.0: + /run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: queue-microtask: 1.2.3 + dev: true - rxjs@7.8.1: + /rxjs@7.8.1: + resolution: {integrity: sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==} dependencies: tslib: 2.7.0 + dev: true - semver@6.3.1: {} + /semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + dev: true - semver@7.6.3: {} + /semver@7.6.3: + resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} + engines: {node: '>=10'} + hasBin: true - shebang-command@2.0.0: + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} dependencies: shebang-regex: 3.0.0 + dev: true - shebang-regex@3.0.0: {} + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true - signal-exit@3.0.7: {} + /signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true - sisteransi@1.0.5: {} + /sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + dev: true - slash@3.0.0: {} + /slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + dev: true - source-map-support@0.5.13: + /source-map-support@0.5.13: + resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} dependencies: buffer-from: 1.1.2 source-map: 0.6.1 + dev: true - source-map@0.6.1: {} + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true - sprintf-js@1.0.3: {} + /sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + dev: true - stack-utils@2.0.6: + /stack-utils@2.0.6: + resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} + engines: {node: '>=10'} dependencies: escape-string-regexp: 2.0.0 + dev: true - string-length@4.0.2: + /string-length@4.0.2: + resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} + engines: {node: '>=10'} dependencies: char-regex: 1.0.2 strip-ansi: 6.0.1 + dev: true - string-width@4.2.3: + /string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} dependencies: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + dev: true - strip-ansi@6.0.1: + /strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} dependencies: ansi-regex: 5.0.1 + dev: true - strip-bom@4.0.0: {} + /strip-bom@4.0.0: + resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} + engines: {node: '>=8'} + dev: true - strip-final-newline@2.0.0: {} + /strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + dev: true - strip-json-comments@3.1.1: {} + /strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + dev: true - supports-color@5.5.0: + /supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} dependencies: has-flag: 3.0.0 + dev: true - supports-color@7.2.0: + /supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} dependencies: has-flag: 4.0.0 + dev: true - supports-color@8.1.1: + /supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} dependencies: has-flag: 4.0.0 + dev: true - supports-preserve-symlinks-flag@1.0.0: {} + /supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + dev: true - test-exclude@6.0.0: + /test-exclude@6.0.0: + resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} + engines: {node: '>=8'} dependencies: '@istanbuljs/schema': 0.1.3 glob: 7.2.3 minimatch: 3.1.2 + dev: true - text-table@0.2.0: {} + /text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + dev: true - tmpl@1.0.5: {} + /tmpl@1.0.5: + resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} + dev: true - to-fast-properties@2.0.0: {} + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + dev: true - to-regex-range@5.0.1: + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} dependencies: is-number: 7.0.0 + dev: true - ts-api-utils@1.3.0(typescript@5.6.2): + /ts-api-utils@1.3.0(typescript@5.6.2): + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' dependencies: typescript: 5.6.2 + dev: true - ts-essentials@10.0.2(typescript@5.6.2): - optionalDependencies: + /ts-essentials@10.0.2(typescript@5.6.2): + resolution: {integrity: sha512-Xwag0TULqriaugXqVdDiGZ5wuZpqABZlpwQ2Ho4GDyiu/R2Xjkp/9+zcFxL7uzeLl/QCPrflnvpVYyS3ouT7Zw==} + peerDependencies: + typescript: '>=4.5.0' + peerDependenciesMeta: + typescript: + optional: true + dependencies: typescript: 5.6.2 + dev: true - ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@22.5.4))(typescript@5.6.2): + /ts-jest@29.2.5(@babel/core@7.25.2)(jest@29.7.0)(typescript@5.6.2): + resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==} + engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@babel/core': '>=7.0.0-beta.0 <8' + '@jest/transform': ^29.0.0 + '@jest/types': ^29.0.0 + babel-jest: ^29.0.0 + esbuild: '*' + jest: ^29.0.0 + typescript: '>=4.3 <6' + peerDependenciesMeta: + '@babel/core': + optional: true + '@jest/transform': + optional: true + '@jest/types': + optional: true + babel-jest: + optional: true + esbuild: + optional: true dependencies: + '@babel/core': 7.25.2 bs-logger: 0.2.6 ejs: 3.1.10 fast-json-stable-stringify: 2.1.0 @@ -3524,91 +3050,163 @@ snapshots: semver: 7.6.3 typescript: 5.6.2 yargs-parser: 21.1.1 - optionalDependencies: - '@babel/core': 7.25.2 - '@jest/transform': 29.7.0 - '@jest/types': 29.6.3 - babel-jest: 29.7.0(@babel/core@7.25.2) + dev: true - ts-toolbelt@9.6.0: {} + /ts-toolbelt@9.6.0: + resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} + dev: true - tslib@2.7.0: {} + /tslib@2.7.0: + resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} + dev: true - type-check@0.4.0: + /type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} dependencies: prelude-ls: 1.2.1 + dev: true - type-detect@4.0.8: {} + /type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + dev: true - type-fest@0.21.3: {} + /type-fest@0.21.3: + resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} + engines: {node: '>=10'} + dev: true - types-ramda@0.30.1: + /types-ramda@0.30.1: + resolution: {integrity: sha512-1HTsf5/QVRmLzcGfldPFvkVsAdi1db1BBKzi7iW3KBUlOICg/nKnFS+jGqDJS3YD8VsWbAh7JiHeBvbsw8RPxA==} dependencies: ts-toolbelt: 9.6.0 + dev: true - typescript-eslint@8.5.0(eslint@9.10.0)(typescript@5.6.2): + /typescript-eslint@8.5.0(eslint@9.10.0)(typescript@5.6.2): + resolution: {integrity: sha512-uD+XxEoSIvqtm4KE97etm32Tn5MfaZWgWfMMREStLxR6JzvHkc2Tkj7zhTEK5XmtpTmKHNnG8Sot6qDfhHtR1Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: - '@typescript-eslint/eslint-plugin': 8.5.0(@typescript-eslint/parser@8.5.0(eslint@9.10.0)(typescript@5.6.2))(eslint@9.10.0)(typescript@5.6.2) + '@typescript-eslint/eslint-plugin': 8.5.0(@typescript-eslint/parser@8.5.0)(eslint@9.10.0)(typescript@5.6.2) '@typescript-eslint/parser': 8.5.0(eslint@9.10.0)(typescript@5.6.2) '@typescript-eslint/utils': 8.5.0(eslint@9.10.0)(typescript@5.6.2) - optionalDependencies: typescript: 5.6.2 transitivePeerDependencies: - eslint - supports-color + dev: true - typescript@5.6.2: {} + /typescript@5.6.2: + resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} + engines: {node: '>=14.17'} + hasBin: true + dev: true - undici-types@6.19.8: {} + /undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + dev: true - update-browserslist-db@1.1.0(browserslist@4.23.3): + /update-browserslist-db@1.1.0(browserslist@4.23.3): + resolution: {integrity: sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' dependencies: browserslist: 4.23.3 escalade: 3.1.2 picocolors: 1.0.1 + dev: true - uri-js@4.4.1: + /uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: punycode: 2.3.1 + dev: true - v8-to-istanbul@9.3.0: + /v8-to-istanbul@9.3.0: + resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} + engines: {node: '>=10.12.0'} dependencies: '@jridgewell/trace-mapping': 0.3.25 '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 + dev: true - walker@1.0.8: + /walker@1.0.8: + resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} dependencies: makeerror: 1.0.12 + dev: true - which@2.0.2: + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true dependencies: isexe: 2.0.0 + dev: true - word-wrap@1.2.5: {} + /word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + dev: true - wrap-ansi@7.0.0: + /wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} dependencies: ansi-styles: 4.3.0 string-width: 4.2.3 strip-ansi: 6.0.1 + dev: true - wrappy@1.0.2: {} + /wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + dev: true - write-file-atomic@4.0.2: + /write-file-atomic@4.0.2: + resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: imurmurhash: 0.1.4 signal-exit: 3.0.7 + dev: true - ws@8.18.0: {} + /ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: true - y18n@5.0.8: {} + /y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + dev: true - yallist@3.1.1: {} + /yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true - yargs-parser@21.1.1: {} + /yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: true - yargs@17.7.2: + /yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} dependencies: cliui: 8.0.1 escalade: 3.1.2 @@ -3617,5 +3215,9 @@ snapshots: string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 21.1.1 + dev: true - yocto-queue@0.1.0: {} + /yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + dev: true diff --git a/e2e/src/fixtures/1.6/apiOrders/orders.json b/e2e/src/fixtures/1.6/apiOrders/orders.json deleted file mode 100644 index 1cb964f1..00000000 --- a/e2e/src/fixtures/1.6/apiOrders/orders.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "id": 1, - "collection": "orders", - "properties": { - "id_order": 1, - "reference": "XKBKNABJK", - "id_customer": 1, - "id_cart": "1", - "current_state": 6, - "conversion_rate": 1, - "total_paid_tax_excl": 55, - "total_paid_tax_incl": 55, - "new_customer": true, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "cheque", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 2, - "created_at": "2024-07-16T15:33:56+0200", - "updated_at": "2024-07-16T15:33:56+0200", - "id_carrier": 2, - "payment_name": "cheque", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Canceled", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 2, - "collection": "orders", - "properties": { - "id_order": 2, - "reference": "OHSATSERP", - "id_customer": 1, - "id_cart": "2", - "current_state": 1, - "conversion_rate": 1, - "total_paid_tax_excl": 75.9, - "total_paid_tax_incl": 75.9, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "cheque", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 2, - "created_at": "2024-07-16T15:33:56+0200", - "updated_at": "2024-07-16T15:33:56+0200", - "id_carrier": 2, - "payment_name": "cheque", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Awaiting check payment", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 3, - "collection": "orders", - "properties": { - "id_order": 3, - "reference": "UOYEVOLI", - "id_customer": 1, - "id_cart": "3", - "current_state": 8, - "conversion_rate": 1, - "total_paid_tax_excl": 76.01, - "total_paid_tax_incl": 76.01, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "cheque", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 2, - "created_at": "2024-07-16T15:33:56+0200", - "updated_at": "2024-07-16T15:33:56+0200", - "id_carrier": 2, - "payment_name": "cheque", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Payment error", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 4, - "collection": "orders", - "properties": { - "id_order": 4, - "reference": "FFATNOMMJ", - "id_customer": 1, - "id_cart": "4", - "current_state": 1, - "conversion_rate": 1, - "total_paid_tax_excl": 89.89, - "total_paid_tax_incl": 89.89, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "cheque", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 2, - "created_at": "2024-07-16T15:33:56+0200", - "updated_at": "2024-07-16T15:33:56+0200", - "id_carrier": 2, - "payment_name": "cheque", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Awaiting check payment", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 5, - "collection": "orders", - "properties": { - "id_order": 5, - "reference": "KHWLILZLL", - "id_customer": 1, - "id_cart": "5", - "current_state": 10, - "conversion_rate": 1, - "total_paid_tax_excl": 71.51, - "total_paid_tax_incl": 71.51, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "bankwire", - "payment_mode": "Bank wire", - "total_paid_real": "0.000000", - "shipping_cost": 2, - "created_at": "2024-07-16T15:33:56+0200", - "updated_at": "2024-07-16T15:33:56+0200", - "id_carrier": 2, - "payment_name": "bankwire", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Awaiting bank wire payment", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - } -] diff --git a/e2e/src/fixtures/1.6/apiOrders/order_cart_rules.json b/e2e/src/fixtures/1.6/attributes.json similarity index 100% rename from e2e/src/fixtures/1.6/apiOrders/order_cart_rules.json rename to e2e/src/fixtures/1.6/attributes.json diff --git a/e2e/src/fixtures/1.6/apiProducts/bundles.json b/e2e/src/fixtures/1.6/bundles.json similarity index 100% rename from e2e/src/fixtures/1.6/apiProducts/bundles.json rename to e2e/src/fixtures/1.6/bundles.json diff --git a/e2e/src/fixtures/1.6/apiCarriers/carrier_details.json b/e2e/src/fixtures/1.6/carrier_details.json similarity index 78% rename from e2e/src/fixtures/1.6/apiCarriers/carrier_details.json rename to e2e/src/fixtures/1.6/carrier_details.json index f6fa1176..e0ec1665 100644 --- a/e2e/src/fixtures/1.6/apiCarriers/carrier_details.json +++ b/e2e/src/fixtures/1.6/carrier_details.json @@ -1,18 +1,18 @@ [ { + "action": "upsert", "collection": "carrier_details", - "id": "2-1-range_weight-1", "properties": { "id_reference": "2", "id_zone": "1", "id_range": "1", - "id_carrier_detail": "1", "shipping_method": "range_weight", "delimiter1": 0, "delimiter2": 10000, "country_ids": "GB", "state_ids": "", - "price": 5 + "price": 5, + "id_carrier_detail": "1" } } ] diff --git a/e2e/src/fixtures/1.6/apiStocks/stock_movements.json b/e2e/src/fixtures/1.6/carrier_taxes.json similarity index 100% rename from e2e/src/fixtures/1.6/apiStocks/stock_movements.json rename to e2e/src/fixtures/1.6/carrier_taxes.json diff --git a/e2e/src/fixtures/1.6/apiCarriers/carriers.json b/e2e/src/fixtures/1.6/carriers.json similarity index 95% rename from e2e/src/fixtures/1.6/apiCarriers/carriers.json rename to e2e/src/fixtures/1.6/carriers.json index f125a26c..588ab5e5 100644 --- a/e2e/src/fixtures/1.6/apiCarriers/carriers.json +++ b/e2e/src/fixtures/1.6/carriers.json @@ -1,18 +1,14 @@ [ { + "action": "upsert", "collection": "carriers", - "id": "1", "properties": { "id_carrier": "1", "id_reference": "1", - "name": "PrestaShop", - "carrier_taxes_rates_group_id": "1", + "name": "0", "url": "", "active": true, "deleted": false, - "shipping_handling": 0, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": true, @@ -25,24 +21,24 @@ "max_weight": 0, "grade": 0, "delay": "Pick up in-store", + "shipping_handling": 0, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "2", "properties": { "id_carrier": "2", "id_reference": "2", "name": "My carrier", - "carrier_taxes_rates_group_id": "1", "url": "", "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -55,6 +51,10 @@ "max_weight": 0, "grade": 0, "delay": "Delivery next day!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } diff --git a/e2e/src/fixtures/1.6/apiCarts/cart_products.json b/e2e/src/fixtures/1.6/cart_products.json similarity index 90% rename from e2e/src/fixtures/1.6/apiCarts/cart_products.json rename to e2e/src/fixtures/1.6/cart_products.json index 60efc442..d3505fa0 100644 --- a/e2e/src/fixtures/1.6/apiCarts/cart_products.json +++ b/e2e/src/fixtures/1.6/cart_products.json @@ -1,6 +1,6 @@ [ { - "id": "1-2-10", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -12,7 +12,7 @@ } }, { - "id": "1-3-13", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -24,7 +24,7 @@ } }, { - "id": "2-2-10", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -36,7 +36,7 @@ } }, { - "id": "2-6-32", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -48,7 +48,7 @@ } }, { - "id": "2-7-34", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -60,7 +60,7 @@ } }, { - "id": "3-1-1", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "3", @@ -72,7 +72,7 @@ } }, { - "id": "3-2-10", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "3", @@ -84,7 +84,7 @@ } }, { - "id": "3-6-32", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "3", @@ -96,7 +96,7 @@ } }, { - "id": "4-1-1", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -108,7 +108,7 @@ } }, { - "id": "4-3-13", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -120,7 +120,7 @@ } }, { - "id": "4-5-19", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -132,7 +132,7 @@ } }, { - "id": "4-7-34", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -144,7 +144,7 @@ } }, { - "id": "5-1-1", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "5", @@ -156,7 +156,7 @@ } }, { - "id": "5-2-7", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "5", @@ -168,7 +168,7 @@ } }, { - "id": "5-3-13", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/1.7/apiCarriers/carrier_details.json b/e2e/src/fixtures/1.6/cart_rules.json similarity index 100% rename from e2e/src/fixtures/1.7/apiCarriers/carrier_details.json rename to e2e/src/fixtures/1.6/cart_rules.json diff --git a/e2e/src/fixtures/1.6/apiCarts/carts.json b/e2e/src/fixtures/1.6/carts.json similarity index 88% rename from e2e/src/fixtures/1.6/apiCarts/carts.json rename to e2e/src/fixtures/1.6/carts.json index ee7855aa..a49c2f9b 100644 --- a/e2e/src/fixtures/1.6/apiCarts/carts.json +++ b/e2e/src/fixtures/1.6/carts.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "1", @@ -9,7 +9,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "2", @@ -18,7 +18,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "3", @@ -27,7 +27,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "4", @@ -36,7 +36,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/1.6/apiCategories/categories.json b/e2e/src/fixtures/1.6/categories.json similarity index 95% rename from e2e/src/fixtures/1.6/apiCategories/categories.json rename to e2e/src/fixtures/1.6/categories.json index 03b193f6..c3126624 100644 --- a/e2e/src/fixtures/1.6/apiCategories/categories.json +++ b/e2e/src/fixtures/1.6/categories.json @@ -1,6 +1,6 @@ [ { - "id": "1-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "1-en", @@ -18,7 +18,7 @@ } }, { - "id": "2-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "2-en", @@ -36,7 +36,7 @@ } }, { - "id": "3-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "3-en", @@ -54,7 +54,7 @@ } }, { - "id": "4-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "4-en", @@ -72,7 +72,7 @@ } }, { - "id": "5-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "5-en", @@ -90,7 +90,7 @@ } }, { - "id": "6-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "6-en", @@ -108,7 +108,7 @@ } }, { - "id": "7-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "7-en", @@ -126,7 +126,7 @@ } }, { - "id": "8-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "8-en", @@ -144,7 +144,7 @@ } }, { - "id": "9-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "9-en", @@ -162,7 +162,7 @@ } }, { - "id": "10-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "10-en", @@ -180,7 +180,7 @@ } }, { - "id": "11-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "11-en", diff --git a/e2e/src/fixtures/1.6/apiCurrencies/currencies.json b/e2e/src/fixtures/1.6/currencies.json similarity index 89% rename from e2e/src/fixtures/1.6/apiCurrencies/currencies.json rename to e2e/src/fixtures/1.6/currencies.json index c1a1734b..ace7f805 100644 --- a/e2e/src/fixtures/1.6/apiCurrencies/currencies.json +++ b/e2e/src/fixtures/1.6/currencies.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 1, @@ -12,7 +12,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 2, diff --git a/e2e/src/fixtures/1.7/apiOrders/order_cart_rules.json b/e2e/src/fixtures/1.6/custom_product_carriers.json similarity index 100% rename from e2e/src/fixtures/1.7/apiOrders/order_cart_rules.json rename to e2e/src/fixtures/1.6/custom_product_carriers.json diff --git a/e2e/src/fixtures/1.6/apiCustomers/customers.json b/e2e/src/fixtures/1.6/customers.json similarity index 95% rename from e2e/src/fixtures/1.6/apiCustomers/customers.json rename to e2e/src/fixtures/1.6/customers.json index 42524418..2a73e994 100644 --- a/e2e/src/fixtures/1.6/apiCustomers/customers.json +++ b/e2e/src/fixtures/1.6/customers.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 1, diff --git a/e2e/src/fixtures/1.6/apiEmployees/employees.json b/e2e/src/fixtures/1.6/employees.json similarity index 96% rename from e2e/src/fixtures/1.6/apiEmployees/employees.json rename to e2e/src/fixtures/1.6/employees.json index c7627627..0a7bafcd 100644 --- a/e2e/src/fixtures/1.6/apiEmployees/employees.json +++ b/e2e/src/fixtures/1.6/employees.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "employees", "properties": { "id_employee": 1, diff --git a/e2e/src/fixtures/1.6/apiImageTypes/image_types.json b/e2e/src/fixtures/1.6/image_types.json similarity index 92% rename from e2e/src/fixtures/1.6/apiImageTypes/image_types.json rename to e2e/src/fixtures/1.6/image_types.json index 13fbb204..d26aea1f 100644 --- a/e2e/src/fixtures/1.6/apiImageTypes/image_types.json +++ b/e2e/src/fixtures/1.6/image_types.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 1, @@ -15,7 +15,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 2, @@ -30,7 +30,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 3, @@ -45,7 +45,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 4, @@ -60,7 +60,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 5, @@ -75,7 +75,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 6, @@ -90,7 +90,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 7, @@ -105,7 +105,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 8, @@ -120,7 +120,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 9, diff --git a/e2e/src/fixtures/1.6/apiImages/images.json b/e2e/src/fixtures/1.6/images.json similarity index 89% rename from e2e/src/fixtures/1.6/apiImages/images.json rename to e2e/src/fixtures/1.6/images.json index baaab889..063a1ae7 100644 --- a/e2e/src/fixtures/1.6/apiImages/images.json +++ b/e2e/src/fixtures/1.6/images.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "images", "properties": { "id_image": 1, @@ -13,7 +13,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "images", "properties": { "id_image": 2, @@ -26,7 +26,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "images", "properties": { "id_image": 3, @@ -39,7 +39,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "images", "properties": { "id_image": 4, @@ -52,7 +52,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "images", "properties": { "id_image": 5, @@ -65,7 +65,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "images", "properties": { "id_image": 6, @@ -78,7 +78,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "images", "properties": { "id_image": 7, @@ -91,7 +91,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "images", "properties": { "id_image": 8, @@ -104,7 +104,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "images", "properties": { "id_image": 9, @@ -117,7 +117,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "images", "properties": { "id_image": 10, @@ -130,7 +130,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "images", "properties": { "id_image": 11, @@ -143,7 +143,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "images", "properties": { "id_image": 12, @@ -156,7 +156,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "images", "properties": { "id_image": 13, @@ -169,7 +169,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "images", "properties": { "id_image": 14, @@ -182,7 +182,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "images", "properties": { "id_image": 15, @@ -195,7 +195,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "images", "properties": { "id_image": 16, @@ -208,7 +208,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "images", "properties": { "id_image": 17, @@ -221,7 +221,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "images", "properties": { "id_image": 18, @@ -234,7 +234,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "images", "properties": { "id_image": 19, @@ -247,7 +247,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "images", "properties": { "id_image": 20, @@ -260,7 +260,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "images", "properties": { "id_image": 21, @@ -273,7 +273,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "images", "properties": { "id_image": 22, @@ -286,7 +286,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "images", "properties": { "id_image": 23, diff --git a/e2e/src/fixtures/1.6/apiLanguages/languages.json b/e2e/src/fixtures/1.6/languages.json similarity index 93% rename from e2e/src/fixtures/1.6/apiLanguages/languages.json rename to e2e/src/fixtures/1.6/languages.json index 983adf8c..e18b1806 100644 --- a/e2e/src/fixtures/1.6/apiLanguages/languages.json +++ b/e2e/src/fixtures/1.6/languages.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "languages", "properties": { "id_lang": 1, diff --git a/e2e/src/fixtures/1.6/apiManufacturers/manufacturers.json b/e2e/src/fixtures/1.6/manufacturers.json similarity index 94% rename from e2e/src/fixtures/1.6/apiManufacturers/manufacturers.json rename to e2e/src/fixtures/1.6/manufacturers.json index 68a27430..3572111d 100644 --- a/e2e/src/fixtures/1.6/apiManufacturers/manufacturers.json +++ b/e2e/src/fixtures/1.6/manufacturers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 1, diff --git a/e2e/src/fixtures/1.6/apiModules/modules.json b/e2e/src/fixtures/1.6/modules.json similarity index 91% rename from e2e/src/fixtures/1.6/apiModules/modules.json rename to e2e/src/fixtures/1.6/modules.json index 2c75976b..33c40bb5 100644 --- a/e2e/src/fixtures/1.6/apiModules/modules.json +++ b/e2e/src/fixtures/1.6/modules.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "modules", "properties": { "module_id": "1", @@ -12,7 +12,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "modules", "properties": { "module_id": "2", @@ -24,7 +24,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "modules", "properties": { "module_id": "3", @@ -36,7 +36,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "modules", "properties": { "module_id": "4", @@ -48,7 +48,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "modules", "properties": { "module_id": "5", @@ -60,7 +60,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "modules", "properties": { "module_id": "6", @@ -72,7 +72,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "modules", "properties": { "module_id": "7", @@ -84,7 +84,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "modules", "properties": { "module_id": "8", @@ -96,7 +96,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "modules", "properties": { "module_id": "9", @@ -108,7 +108,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "modules", "properties": { "module_id": "10", @@ -120,7 +120,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "modules", "properties": { "module_id": "11", @@ -132,7 +132,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "modules", "properties": { "module_id": "12", @@ -144,7 +144,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "modules", "properties": { "module_id": "13", @@ -156,7 +156,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "modules", "properties": { "module_id": "14", @@ -168,7 +168,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "modules", "properties": { "module_id": "15", @@ -180,7 +180,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "modules", "properties": { "module_id": "16", @@ -192,7 +192,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "modules", "properties": { "module_id": "17", @@ -204,7 +204,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "modules", "properties": { "module_id": "18", @@ -216,7 +216,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "modules", "properties": { "module_id": "19", @@ -228,7 +228,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "modules", "properties": { "module_id": "20", @@ -240,7 +240,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "modules", "properties": { "module_id": "21", @@ -252,7 +252,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "modules", "properties": { "module_id": "22", @@ -264,7 +264,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "modules", "properties": { "module_id": "23", @@ -276,7 +276,7 @@ } }, { - "id": "24", + "action": "upsert", "collection": "modules", "properties": { "module_id": "24", @@ -288,7 +288,7 @@ } }, { - "id": "25", + "action": "upsert", "collection": "modules", "properties": { "module_id": "25", @@ -300,7 +300,7 @@ } }, { - "id": "26", + "action": "upsert", "collection": "modules", "properties": { "module_id": "26", @@ -312,7 +312,7 @@ } }, { - "id": "27", + "action": "upsert", "collection": "modules", "properties": { "module_id": "27", @@ -324,7 +324,7 @@ } }, { - "id": "28", + "action": "upsert", "collection": "modules", "properties": { "module_id": "28", @@ -336,7 +336,7 @@ } }, { - "id": "29", + "action": "upsert", "collection": "modules", "properties": { "module_id": "29", @@ -348,7 +348,7 @@ } }, { - "id": "30", + "action": "upsert", "collection": "modules", "properties": { "module_id": "30", @@ -360,7 +360,7 @@ } }, { - "id": "31", + "action": "upsert", "collection": "modules", "properties": { "module_id": "31", @@ -372,7 +372,7 @@ } }, { - "id": "32", + "action": "upsert", "collection": "modules", "properties": { "module_id": "32", @@ -384,7 +384,7 @@ } }, { - "id": "33", + "action": "upsert", "collection": "modules", "properties": { "module_id": "33", @@ -396,7 +396,7 @@ } }, { - "id": "34", + "action": "upsert", "collection": "modules", "properties": { "module_id": "34", @@ -408,7 +408,7 @@ } }, { - "id": "35", + "action": "upsert", "collection": "modules", "properties": { "module_id": "35", @@ -420,7 +420,7 @@ } }, { - "id": "36", + "action": "upsert", "collection": "modules", "properties": { "module_id": "36", @@ -432,7 +432,7 @@ } }, { - "id": "37", + "action": "upsert", "collection": "modules", "properties": { "module_id": "37", @@ -444,7 +444,7 @@ } }, { - "id": "38", + "action": "upsert", "collection": "modules", "properties": { "module_id": "38", @@ -456,7 +456,7 @@ } }, { - "id": "39", + "action": "upsert", "collection": "modules", "properties": { "module_id": "39", @@ -468,7 +468,7 @@ } }, { - "id": "40", + "action": "upsert", "collection": "modules", "properties": { "module_id": "40", @@ -480,7 +480,7 @@ } }, { - "id": "41", + "action": "upsert", "collection": "modules", "properties": { "module_id": "41", @@ -492,7 +492,7 @@ } }, { - "id": "42", + "action": "upsert", "collection": "modules", "properties": { "module_id": "42", @@ -504,7 +504,7 @@ } }, { - "id": "43", + "action": "upsert", "collection": "modules", "properties": { "module_id": "43", @@ -516,7 +516,7 @@ } }, { - "id": "44", + "action": "upsert", "collection": "modules", "properties": { "module_id": "44", @@ -528,7 +528,7 @@ } }, { - "id": "45", + "action": "upsert", "collection": "modules", "properties": { "module_id": "45", @@ -540,7 +540,7 @@ } }, { - "id": "46", + "action": "upsert", "collection": "modules", "properties": { "module_id": "46", @@ -552,7 +552,7 @@ } }, { - "id": "47", + "action": "upsert", "collection": "modules", "properties": { "module_id": "47", @@ -564,7 +564,7 @@ } }, { - "id": "48", + "action": "upsert", "collection": "modules", "properties": { "module_id": "48", @@ -576,7 +576,7 @@ } }, { - "id": "49", + "action": "upsert", "collection": "modules", "properties": { "module_id": "49", @@ -588,7 +588,7 @@ } }, { - "id": "50", + "action": "upsert", "collection": "modules", "properties": { "module_id": "50", @@ -600,7 +600,7 @@ } }, { - "id": "51", + "action": "upsert", "collection": "modules", "properties": { "module_id": "51", @@ -612,7 +612,7 @@ } }, { - "id": "52", + "action": "upsert", "collection": "modules", "properties": { "module_id": "52", @@ -624,7 +624,7 @@ } }, { - "id": "53", + "action": "upsert", "collection": "modules", "properties": { "module_id": "53", @@ -636,7 +636,7 @@ } }, { - "id": "54", + "action": "upsert", "collection": "modules", "properties": { "module_id": "54", @@ -648,7 +648,7 @@ } }, { - "id": "55", + "action": "upsert", "collection": "modules", "properties": { "module_id": "55", @@ -660,7 +660,7 @@ } }, { - "id": "56", + "action": "upsert", "collection": "modules", "properties": { "module_id": "56", @@ -672,7 +672,7 @@ } }, { - "id": "57", + "action": "upsert", "collection": "modules", "properties": { "module_id": "57", @@ -684,7 +684,7 @@ } }, { - "id": "58", + "action": "upsert", "collection": "modules", "properties": { "module_id": "58", @@ -696,7 +696,7 @@ } }, { - "id": "59", + "action": "upsert", "collection": "modules", "properties": { "module_id": "59", @@ -708,7 +708,7 @@ } }, { - "id": "60", + "action": "upsert", "collection": "modules", "properties": { "module_id": "60", @@ -720,7 +720,7 @@ } }, { - "id": "61", + "action": "upsert", "collection": "modules", "properties": { "module_id": "61", @@ -732,7 +732,7 @@ } }, { - "id": "62", + "action": "upsert", "collection": "modules", "properties": { "module_id": "62", @@ -744,7 +744,7 @@ } }, { - "id": "63", + "action": "upsert", "collection": "modules", "properties": { "module_id": "63", @@ -756,7 +756,7 @@ } }, { - "id": "64", + "action": "upsert", "collection": "modules", "properties": { "module_id": "64", @@ -768,7 +768,7 @@ } }, { - "id": "65", + "action": "upsert", "collection": "modules", "properties": { "module_id": "65", @@ -780,7 +780,7 @@ } }, { - "id": "66", + "action": "upsert", "collection": "modules", "properties": { "module_id": "66", @@ -792,7 +792,7 @@ } }, { - "id": "67", + "action": "upsert", "collection": "modules", "properties": { "module_id": "67", @@ -804,7 +804,7 @@ } }, { - "id": "68", + "action": "upsert", "collection": "modules", "properties": { "module_id": "68", @@ -816,7 +816,7 @@ } }, { - "id": "69", + "action": "upsert", "collection": "modules", "properties": { "module_id": "69", diff --git a/e2e/src/fixtures/8/apiOrders/order_cart_rules.json b/e2e/src/fixtures/1.6/order_cart_rules.json similarity index 100% rename from e2e/src/fixtures/8/apiOrders/order_cart_rules.json rename to e2e/src/fixtures/1.6/order_cart_rules.json diff --git a/e2e/src/fixtures/1.6/apiOrders/order_details.json b/e2e/src/fixtures/1.6/order_details.json similarity index 95% rename from e2e/src/fixtures/1.6/apiOrders/order_details.json rename to e2e/src/fixtures/1.6/order_details.json index 43771458..619ec48b 100644 --- a/e2e/src/fixtures/1.6/apiOrders/order_details.json +++ b/e2e/src/fixtures/1.6/order_details.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 5, @@ -100,7 +100,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 6, @@ -120,7 +120,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 7, @@ -140,7 +140,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 8, @@ -160,7 +160,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 9, @@ -180,7 +180,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 10, @@ -200,7 +200,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 11, @@ -220,7 +220,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 12, @@ -240,7 +240,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 13, @@ -260,7 +260,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 14, @@ -280,7 +280,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 15, diff --git a/e2e/src/fixtures/1.6/apiOrders/order_status_history.json b/e2e/src/fixtures/1.6/order_status_history.json similarity index 95% rename from e2e/src/fixtures/1.6/apiOrders/order_status_history.json rename to e2e/src/fixtures/1.6/order_status_history.json index e39bdde7..5f92b609 100644 --- a/e2e/src/fixtures/1.6/apiOrders/order_status_history.json +++ b/e2e/src/fixtures/1.6/order_status_history.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -19,7 +19,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -38,7 +38,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -57,7 +57,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -76,7 +76,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 10, @@ -95,7 +95,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 6, @@ -114,7 +114,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 8, diff --git a/e2e/src/fixtures/1.6/orders.json b/e2e/src/fixtures/1.6/orders.json new file mode 100644 index 00000000..68d19afb --- /dev/null +++ b/e2e/src/fixtures/1.6/orders.json @@ -0,0 +1,287 @@ +[ + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 1, + "reference": "XKBKNABJK", + "id_customer": 1, + "id_cart": "1", + "current_state": 6, + "conversion_rate": 1, + "total_paid_tax_excl": 55, + "total_paid_tax_incl": 55, + "currency": "EUR", + "payment_module": "cheque", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 2, + "created_at": "2024-08-22T12:24:54+0200", + "updated_at": "2024-08-22T12:24:54+0200", + "id_carrier": 2, + "payment_name": "cheque", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Canceled", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 53, + "total_products_wt": 53, + "total_shipping_tax_incl": 2, + "total_shipping_tax_excl": 2, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": true, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 2, + "reference": "OHSATSERP", + "id_customer": 1, + "id_cart": "2", + "current_state": 1, + "conversion_rate": 1, + "total_paid_tax_excl": 75.9, + "total_paid_tax_incl": 75.9, + "currency": "EUR", + "payment_module": "cheque", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 2, + "created_at": "2024-08-22T12:24:54+0200", + "updated_at": "2024-08-22T12:24:54+0200", + "id_carrier": 2, + "payment_name": "cheque", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting check payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 73, + "total_products_wt": 73, + "total_shipping_tax_incl": 2, + "total_shipping_tax_excl": 2, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 3, + "reference": "UOYEVOLI", + "id_customer": 1, + "id_cart": "3", + "current_state": 8, + "conversion_rate": 1, + "total_paid_tax_excl": 76.01, + "total_paid_tax_incl": 76.01, + "currency": "EUR", + "payment_module": "cheque", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 2, + "created_at": "2024-08-22T12:24:54+0200", + "updated_at": "2024-08-22T12:24:54+0200", + "id_carrier": 2, + "payment_name": "cheque", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Payment error", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 74, + "total_products_wt": 74, + "total_shipping_tax_incl": 2, + "total_shipping_tax_excl": 2, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 4, + "reference": "FFATNOMMJ", + "id_customer": 1, + "id_cart": "4", + "current_state": 1, + "conversion_rate": 1, + "total_paid_tax_excl": 89.89, + "total_paid_tax_incl": 89.89, + "currency": "EUR", + "payment_module": "cheque", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 2, + "created_at": "2024-08-22T12:24:54+0200", + "updated_at": "2024-08-22T12:24:54+0200", + "id_carrier": 2, + "payment_name": "cheque", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting check payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 87, + "total_products_wt": 87, + "total_shipping_tax_incl": 2, + "total_shipping_tax_excl": 2, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 5, + "reference": "KHWLILZLL", + "id_customer": 1, + "id_cart": "5", + "current_state": 10, + "conversion_rate": 1, + "total_paid_tax_excl": 71.51, + "total_paid_tax_incl": 71.51, + "currency": "EUR", + "payment_module": "bankwire", + "payment_mode": "Bank wire", + "total_paid_real": "0.000000", + "shipping_cost": 2, + "created_at": "2024-08-22T12:24:54+0200", + "updated_at": "2024-08-22T12:24:54+0200", + "id_carrier": 2, + "payment_name": "bankwire", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting bank wire payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 69, + "total_products_wt": 69, + "total_shipping_tax_incl": 2, + "total_shipping_tax_excl": 2, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + } +] diff --git a/e2e/src/fixtures/1.6/apiProducts/product_suppliers.json b/e2e/src/fixtures/1.6/product_suppliers.json similarity index 92% rename from e2e/src/fixtures/1.6/apiProducts/product_suppliers.json rename to e2e/src/fixtures/1.6/product_suppliers.json index a26e26e2..a25e97e3 100644 --- a/e2e/src/fixtures/1.6/apiProducts/product_suppliers.json +++ b/e2e/src/fixtures/1.6/product_suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 2, @@ -26,7 +26,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 3, @@ -39,7 +39,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 4, @@ -52,7 +52,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 5, @@ -65,7 +65,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 6, @@ -78,7 +78,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 7, diff --git a/e2e/src/fixtures/1.6/apiProducts/products.json b/e2e/src/fixtures/1.6/products.json similarity index 97% rename from e2e/src/fixtures/1.6/apiProducts/products.json rename to e2e/src/fixtures/1.6/products.json index a75b1c85..1107067e 100644 --- a/e2e/src/fixtures/1.6/apiProducts/products.json +++ b/e2e/src/fixtures/1.6/products.json @@ -1,6 +1,6 @@ [ { - "id": "1-2-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -56,12 +56,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > T-shirts", "category_id_path": "1 > 2 > 3 > 4 > 5", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "1-3-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -117,12 +118,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > T-shirts", "category_id_path": "1 > 2 > 3 > 4 > 5", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "1-4-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -178,12 +180,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > T-shirts", "category_id_path": "1 > 2 > 3 > 4 > 5", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "1-5-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -239,12 +242,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > T-shirts", "category_id_path": "1 > 2 > 3 > 4 > 5", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "1-6-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -300,12 +304,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > T-shirts", "category_id_path": "1 > 2 > 3 > 4 > 5", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "1-1-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -361,12 +366,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > T-shirts", "category_id_path": "1 > 2 > 3 > 4 > 5", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "2-8-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -422,12 +428,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > Blouses", "category_id_path": "1 > 2 > 3 > 4 > 7", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "2-9-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -483,12 +490,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > Blouses", "category_id_path": "1 > 2 > 3 > 4 > 7", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "2-10-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -544,12 +552,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > Blouses", "category_id_path": "1 > 2 > 3 > 4 > 7", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "2-11-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -605,12 +614,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > Blouses", "category_id_path": "1 > 2 > 3 > 4 > 7", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "2-12-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -666,12 +676,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > Blouses", "category_id_path": "1 > 2 > 3 > 4 > 7", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "2-7-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -727,12 +738,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Tops > Blouses", "category_id_path": "1 > 2 > 3 > 4 > 7", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "3-14-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -788,12 +800,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Casual Dresses", "category_id_path": "1 > 2 > 3 > 8 > 9", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "3-15-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -849,12 +862,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Casual Dresses", "category_id_path": "1 > 2 > 3 > 8 > 9", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "3-13-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -910,12 +924,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Casual Dresses", "category_id_path": "1 > 2 > 3 > 8 > 9", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "4-17-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -971,12 +986,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Evening Dresses", "category_id_path": "1 > 2 > 3 > 8 > 10", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "4-18-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1032,12 +1048,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Evening Dresses", "category_id_path": "1 > 2 > 3 > 8 > 10", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "4-43-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1093,12 +1110,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Evening Dresses", "category_id_path": "1 > 2 > 3 > 8 > 10", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "4-44-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1154,12 +1172,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Evening Dresses", "category_id_path": "1 > 2 > 3 > 8 > 10", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "4-45-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1215,12 +1234,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Evening Dresses", "category_id_path": "1 > 2 > 3 > 8 > 10", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "4-16-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1276,12 +1296,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Evening Dresses", "category_id_path": "1 > 2 > 3 > 8 > 10", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-20-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1337,12 +1358,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-21-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1398,12 +1420,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-22-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1459,12 +1482,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-23-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1520,12 +1544,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-24-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1581,12 +1606,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-25-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1642,12 +1668,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-26-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1703,12 +1730,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-27-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1764,12 +1792,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-28-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1825,12 +1854,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-29-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1886,12 +1916,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-30-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1947,12 +1978,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "5-19-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -2008,12 +2040,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "6-32-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -2069,12 +2102,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "6-33-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -2130,12 +2164,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "6-40-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -2191,12 +2226,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "6-41-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -2252,12 +2288,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "6-42-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -2313,12 +2350,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "6-31-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -2374,12 +2412,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "7-35-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -2435,12 +2474,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "7-36-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -2496,12 +2536,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "7-37-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -2557,12 +2598,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "7-38-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -2618,12 +2660,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "7-39-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -2679,12 +2722,13 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } }, { - "id": "7-34-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -2740,6 +2784,7 @@ "sale_tax": 0, "category_path": "Root > Home > Women > Dresses > Summer Dresses", "category_id_path": "1 > 2 > 3 > 8 > 11", + "additional_delivery_times": "", "isbn": "", "mpn": "" } diff --git a/e2e/src/fixtures/1.6/apiInfo/shops.json b/e2e/src/fixtures/1.6/shops.json similarity index 97% rename from e2e/src/fixtures/1.6/apiInfo/shops.json rename to e2e/src/fixtures/1.6/shops.json index 5ccb60ce..430926cd 100644 --- a/e2e/src/fixtures/1.6/apiInfo/shops.json +++ b/e2e/src/fixtures/1.6/shops.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "shops", "properties": { "created_at": "2024-07-16 15:33:52", diff --git a/e2e/src/fixtures/1.6/apiSpecificPrices/specific_prices.json b/e2e/src/fixtures/1.6/specific_prices.json similarity index 97% rename from e2e/src/fixtures/1.6/apiSpecificPrices/specific_prices.json rename to e2e/src/fixtures/1.6/specific_prices.json index 66bd33b4..6a9a3b49 100644 --- a/e2e/src/fixtures/1.6/apiSpecificPrices/specific_prices.json +++ b/e2e/src/fixtures/1.6/specific_prices.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 1, @@ -31,7 +31,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 2, diff --git a/e2e/src/fixtures/1.7/apiStocks/stock_movements.json b/e2e/src/fixtures/1.6/stock_movements.json similarity index 100% rename from e2e/src/fixtures/1.7/apiStocks/stock_movements.json rename to e2e/src/fixtures/1.6/stock_movements.json diff --git a/e2e/src/fixtures/1.6/apiStocks/stocks.json b/e2e/src/fixtures/1.6/stocks.json similarity index 92% rename from e2e/src/fixtures/1.6/apiStocks/stocks.json rename to e2e/src/fixtures/1.6/stocks.json index d58cf9b3..2d08f970 100644 --- a/e2e/src/fixtures/1.6/apiStocks/stocks.json +++ b/e2e/src/fixtures/1.6/stocks.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 1, @@ -14,7 +14,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 2, @@ -28,7 +28,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 3, @@ -42,7 +42,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 4, @@ -56,7 +56,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 5, @@ -70,7 +70,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 6, @@ -84,7 +84,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 7, @@ -98,7 +98,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 8, @@ -112,7 +112,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 9, @@ -126,7 +126,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 10, @@ -140,7 +140,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 11, @@ -154,7 +154,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 12, @@ -168,7 +168,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 13, @@ -182,7 +182,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 14, @@ -196,7 +196,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 15, @@ -210,7 +210,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 16, @@ -224,7 +224,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 17, @@ -238,7 +238,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 18, @@ -252,7 +252,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 19, @@ -266,7 +266,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 20, @@ -280,7 +280,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 21, @@ -294,7 +294,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 22, @@ -308,7 +308,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 23, @@ -322,7 +322,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 24, @@ -336,7 +336,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 25, @@ -350,7 +350,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 26, @@ -364,7 +364,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 27, @@ -378,7 +378,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 28, @@ -392,7 +392,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 29, @@ -406,7 +406,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 30, @@ -420,7 +420,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 31, @@ -434,7 +434,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 32, @@ -448,7 +448,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 33, @@ -462,7 +462,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 34, @@ -476,7 +476,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 35, @@ -490,7 +490,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 36, @@ -504,7 +504,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 37, @@ -518,7 +518,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 38, @@ -532,7 +532,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 39, @@ -546,7 +546,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 40, @@ -560,7 +560,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 41, @@ -574,7 +574,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 42, @@ -588,7 +588,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 43, @@ -602,7 +602,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 44, @@ -616,7 +616,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 45, @@ -630,7 +630,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 46, @@ -644,7 +644,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 47, @@ -658,7 +658,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 48, @@ -672,7 +672,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 49, @@ -686,7 +686,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 50, @@ -700,7 +700,7 @@ } }, { - "id": 51, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 51, @@ -714,7 +714,7 @@ } }, { - "id": 52, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 52, diff --git a/e2e/src/fixtures/1.6/apiStores/stores.json b/e2e/src/fixtures/1.6/stores.json similarity index 96% rename from e2e/src/fixtures/1.6/apiStores/stores.json rename to e2e/src/fixtures/1.6/stores.json index 0bd37217..df1501ed 100644 --- a/e2e/src/fixtures/1.6/apiStores/stores.json +++ b/e2e/src/fixtures/1.6/stores.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stores", "properties": { "id_store": 1, @@ -18,7 +18,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stores", "properties": { "id_store": 2, @@ -36,7 +36,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stores", "properties": { "id_store": 3, @@ -54,7 +54,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stores", "properties": { "id_store": 4, @@ -72,7 +72,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stores", "properties": { "id_store": 5, diff --git a/e2e/src/fixtures/1.6/apiSuppliers/suppliers.json b/e2e/src/fixtures/1.6/suppliers.json similarity index 94% rename from e2e/src/fixtures/1.6/apiSuppliers/suppliers.json rename to e2e/src/fixtures/1.6/suppliers.json index 9a577579..d1dff472 100644 --- a/e2e/src/fixtures/1.6/apiSuppliers/suppliers.json +++ b/e2e/src/fixtures/1.6/suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 1, diff --git a/e2e/src/fixtures/8/apiStocks/stock_movements.json b/e2e/src/fixtures/1.6/taxonomies.json similarity index 100% rename from e2e/src/fixtures/8/apiStocks/stock_movements.json rename to e2e/src/fixtures/1.6/taxonomies.json diff --git a/e2e/src/fixtures/1.6/apiThemes/themes.json b/e2e/src/fixtures/1.6/themes.json similarity index 81% rename from e2e/src/fixtures/1.6/apiThemes/themes.json rename to e2e/src/fixtures/1.6/themes.json index 737943a7..b6d055ee 100644 --- a/e2e/src/fixtures/1.6/apiThemes/themes.json +++ b/e2e/src/fixtures/1.6/themes.json @@ -1,6 +1,6 @@ [ { - "id": "f3e39421159095f9fb628aea58bd1907", + "action": "upsert", "collection": "themes", "properties": { "theme_id": "f3e39421159095f9fb628aea58bd1907", diff --git a/e2e/src/fixtures/9/apiOrders/order_cart_rules.json b/e2e/src/fixtures/1.6/translations.json similarity index 100% rename from e2e/src/fixtures/9/apiOrders/order_cart_rules.json rename to e2e/src/fixtures/1.6/translations.json diff --git a/e2e/src/fixtures/9/apiStocks/stock_movements.json b/e2e/src/fixtures/1.6/wishlist_products.json similarity index 100% rename from e2e/src/fixtures/9/apiStocks/stock_movements.json rename to e2e/src/fixtures/1.6/wishlist_products.json diff --git a/e2e/src/fixtures/1.6/wishlists.json b/e2e/src/fixtures/1.6/wishlists.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.6/wishlists.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiOrders/orders.json b/e2e/src/fixtures/1.7/apiOrders/orders.json deleted file mode 100644 index aea28404..00000000 --- a/e2e/src/fixtures/1.7/apiOrders/orders.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "id": 1, - "collection": "orders", - "properties": { - "id_order": 1, - "reference": "XKBKNABJK", - "id_customer": 2, - "id_cart": "1", - "current_state": 6, - "conversion_rate": 1, - "total_paid_tax_excl": 66.8, - "total_paid_tax_incl": 68.2, - "new_customer": true, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2023-12-20T22:56:49+0100", - "updated_at": "2023-12-20T22:56:49+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Canceled", - "total_paid_tax": 1.4000000000000057, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 2, - "collection": "orders", - "properties": { - "id_order": 2, - "reference": "OHSATSERP", - "id_customer": 2, - "id_cart": "2", - "current_state": 1, - "conversion_rate": 1, - "total_paid_tax_excl": 169.9, - "total_paid_tax_incl": 169.9, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 0, - "created_at": "2023-12-20T22:56:49+0100", - "updated_at": "2023-12-20T22:56:49+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Awaiting check payment", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 3, - "collection": "orders", - "properties": { - "id_order": 3, - "reference": "UOYEVOLI", - "id_customer": 2, - "id_cart": "3", - "current_state": 8, - "conversion_rate": 1, - "total_paid_tax_excl": 19.9, - "total_paid_tax_incl": 21.3, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2023-12-20T22:56:49+0100", - "updated_at": "2023-12-20T22:56:49+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Payment error", - "total_paid_tax": 1.4000000000000021, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 4, - "collection": "orders", - "properties": { - "id_order": 4, - "reference": "FFATNOMMJ", - "id_customer": 2, - "id_cart": "4", - "current_state": 1, - "conversion_rate": 1, - "total_paid_tax_excl": 19.9, - "total_paid_tax_incl": 21.3, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2023-12-20T22:56:49+0100", - "updated_at": "2023-12-20T22:56:49+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Awaiting check payment", - "total_paid_tax": 1.4000000000000021, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 5, - "collection": "orders", - "properties": { - "id_order": 5, - "reference": "KHWLILZLL", - "id_customer": 2, - "id_cart": "5", - "current_state": 10, - "conversion_rate": 1, - "total_paid_tax_excl": 25.9, - "total_paid_tax_incl": 27.3, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_wirepayment", - "payment_mode": "Bank wire", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2023-12-20T22:56:49+0100", - "updated_at": "2023-12-20T22:56:49+0100", - "id_carrier": 2, - "payment_name": "ps_wirepayment", - "is_validated": "0", - "is_paid": false, - "is_shipped": "0", - "status_label": "Awaiting bank wire payment", - "total_paid_tax": 1.4000000000000021, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - } -] diff --git a/e2e/src/fixtures/1.7/attributes.json b/e2e/src/fixtures/1.7/attributes.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/attributes.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiProducts/bundles.json b/e2e/src/fixtures/1.7/bundles.json similarity index 89% rename from e2e/src/fixtures/1.7/apiProducts/bundles.json rename to e2e/src/fixtures/1.7/bundles.json index 7fced11c..fac3dce8 100644 --- a/e2e/src/fixtures/1.7/apiProducts/bundles.json +++ b/e2e/src/fixtures/1.7/bundles.json @@ -1,6 +1,6 @@ [ { - "id": "15", + "action": "upsert", "collection": "bundles", "properties": { "id_bundle": "15", @@ -11,7 +11,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "bundles", "properties": { "id_bundle": "15", diff --git a/e2e/src/fixtures/1.7/carrier_details.json b/e2e/src/fixtures/1.7/carrier_details.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/carrier_details.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/carrier_taxes.json b/e2e/src/fixtures/1.7/carrier_taxes.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/carrier_taxes.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiCarriers/carriers.json b/e2e/src/fixtures/1.7/carriers.json similarity index 96% rename from e2e/src/fixtures/1.7/apiCarriers/carriers.json rename to e2e/src/fixtures/1.7/carriers.json index 2d329af0..283bf500 100644 --- a/e2e/src/fixtures/1.7/apiCarriers/carriers.json +++ b/e2e/src/fixtures/1.7/carriers.json @@ -1,21 +1,17 @@ [ { + "action": "upsert", "collection": "carriers", - "id": "3", "properties": { - "id_carrier": "3", - "id_reference": "3", - "name": "My cheap carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "1", + "id_reference": "1", + "name": "0", "url": "", - "active": false, + "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, - "is_free": false, + "is_free": true, "shipping_external": false, "need_range": false, "external_module_name": "", @@ -24,25 +20,25 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Buy more to pay less!", + "delay": "Pick up in-store", + "shipping_handling": 0, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "4", "properties": { - "id_carrier": "4", - "id_reference": "4", - "name": "My light carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "2", + "id_reference": "2", + "name": "My carrier", "url": "", - "active": false, + "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -54,28 +50,28 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "The lighter the cheaper!", + "delay": "Delivery next day!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "1", "properties": { - "id_carrier": "1", - "id_reference": "1", - "name": "PrestaShop", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "3", + "id_reference": "3", + "name": "My cheap carrier", "url": "", - "active": true, + "active": false, "deleted": false, - "shipping_handling": 0, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, - "is_free": true, + "is_free": false, "shipping_external": false, "need_range": false, "external_module_name": "", @@ -84,25 +80,25 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Pick up in-store", + "delay": "Buy more to pay less!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "2", "properties": { - "id_carrier": "2", - "id_reference": "2", - "name": "My carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "4", + "id_reference": "4", + "name": "My light carrier", "url": "", - "active": true, + "active": false, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -114,7 +110,11 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Delivery next day!", + "delay": "The lighter the cheaper!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } diff --git a/e2e/src/fixtures/8/apiCarts/cart_products.json b/e2e/src/fixtures/1.7/cart_products.json similarity index 90% rename from e2e/src/fixtures/8/apiCarts/cart_products.json rename to e2e/src/fixtures/1.7/cart_products.json index c4af221f..2d245056 100644 --- a/e2e/src/fixtures/8/apiCarts/cart_products.json +++ b/e2e/src/fixtures/1.7/cart_products.json @@ -1,6 +1,6 @@ [ { - "id": "1-1-1", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -12,7 +12,7 @@ } }, { - "id": "1-2-9", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -24,7 +24,7 @@ } }, { - "id": "2-4-18", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -36,7 +36,7 @@ } }, { - "id": "2-8-0", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -48,7 +48,7 @@ } }, { - "id": "3-16-28", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "3", @@ -60,7 +60,7 @@ } }, { - "id": "4-16-29", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -72,7 +72,7 @@ } }, { - "id": "5-10-25", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/1.7/cart_rules.json b/e2e/src/fixtures/1.7/cart_rules.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/cart_rules.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiCarts/carts.json b/e2e/src/fixtures/1.7/carts.json similarity index 88% rename from e2e/src/fixtures/1.7/apiCarts/carts.json rename to e2e/src/fixtures/1.7/carts.json index f0d08485..64a6a70d 100644 --- a/e2e/src/fixtures/1.7/apiCarts/carts.json +++ b/e2e/src/fixtures/1.7/carts.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "1", @@ -9,7 +9,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "2", @@ -18,7 +18,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "3", @@ -27,7 +27,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "4", @@ -36,7 +36,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/1.7/apiCategories/categories.json b/e2e/src/fixtures/1.7/categories.json similarity index 95% rename from e2e/src/fixtures/1.7/apiCategories/categories.json rename to e2e/src/fixtures/1.7/categories.json index e1afb9d0..92cfea7b 100644 --- a/e2e/src/fixtures/1.7/apiCategories/categories.json +++ b/e2e/src/fixtures/1.7/categories.json @@ -1,6 +1,6 @@ [ { - "id": "1-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "1-en", @@ -18,7 +18,7 @@ } }, { - "id": "2-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "2-en", @@ -36,7 +36,7 @@ } }, { - "id": "3-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "3-en", @@ -54,7 +54,7 @@ } }, { - "id": "4-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "4-en", @@ -72,7 +72,7 @@ } }, { - "id": "5-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "5-en", @@ -90,7 +90,7 @@ } }, { - "id": "6-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "6-en", @@ -108,7 +108,7 @@ } }, { - "id": "7-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "7-en", @@ -126,7 +126,7 @@ } }, { - "id": "8-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "8-en", @@ -144,7 +144,7 @@ } }, { - "id": "9-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "9-en", diff --git a/e2e/src/fixtures/1.7/apiCurrencies/currencies.json b/e2e/src/fixtures/1.7/currencies.json similarity index 90% rename from e2e/src/fixtures/1.7/apiCurrencies/currencies.json rename to e2e/src/fixtures/1.7/currencies.json index 877caf69..780dc095 100644 --- a/e2e/src/fixtures/1.7/apiCurrencies/currencies.json +++ b/e2e/src/fixtures/1.7/currencies.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 2, diff --git a/e2e/src/fixtures/1.7/custom_product_carriers.json b/e2e/src/fixtures/1.7/custom_product_carriers.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/custom_product_carriers.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiCustomers/customers.json b/e2e/src/fixtures/1.7/customers.json similarity index 95% rename from e2e/src/fixtures/1.7/apiCustomers/customers.json rename to e2e/src/fixtures/1.7/customers.json index 2260f3a9..06a16dca 100644 --- a/e2e/src/fixtures/1.7/apiCustomers/customers.json +++ b/e2e/src/fixtures/1.7/customers.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 1, @@ -17,7 +17,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 2, diff --git a/e2e/src/fixtures/1.7/apiEmployees/employees.json b/e2e/src/fixtures/1.7/employees.json similarity index 96% rename from e2e/src/fixtures/1.7/apiEmployees/employees.json rename to e2e/src/fixtures/1.7/employees.json index 747c86b6..cb046d42 100644 --- a/e2e/src/fixtures/1.7/apiEmployees/employees.json +++ b/e2e/src/fixtures/1.7/employees.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "employees", "properties": { "id_employee": 1, diff --git a/e2e/src/fixtures/8/apiImageTypes/image_types.json b/e2e/src/fixtures/1.7/image_types.json similarity index 92% rename from e2e/src/fixtures/8/apiImageTypes/image_types.json rename to e2e/src/fixtures/1.7/image_types.json index b8cbf800..7d0cba7f 100644 --- a/e2e/src/fixtures/8/apiImageTypes/image_types.json +++ b/e2e/src/fixtures/1.7/image_types.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 1, @@ -15,7 +15,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 2, @@ -30,7 +30,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 3, @@ -45,7 +45,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 4, @@ -60,7 +60,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 5, @@ -75,7 +75,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 6, @@ -90,7 +90,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 7, diff --git a/e2e/src/fixtures/8/apiImages/images.json b/e2e/src/fixtures/1.7/images.json similarity index 90% rename from e2e/src/fixtures/8/apiImages/images.json rename to e2e/src/fixtures/1.7/images.json index 9927ccb0..8dea38a2 100644 --- a/e2e/src/fixtures/8/apiImages/images.json +++ b/e2e/src/fixtures/1.7/images.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "images", "properties": { "id_image": 1, @@ -13,7 +13,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "images", "properties": { "id_image": 2, @@ -26,7 +26,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "images", "properties": { "id_image": 3, @@ -39,7 +39,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "images", "properties": { "id_image": 4, @@ -52,7 +52,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "images", "properties": { "id_image": 5, @@ -65,7 +65,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "images", "properties": { "id_image": 6, @@ -78,7 +78,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "images", "properties": { "id_image": 7, @@ -91,7 +91,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "images", "properties": { "id_image": 8, @@ -104,7 +104,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "images", "properties": { "id_image": 9, @@ -117,7 +117,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "images", "properties": { "id_image": 10, @@ -130,7 +130,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "images", "properties": { "id_image": 11, @@ -143,7 +143,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "images", "properties": { "id_image": 12, @@ -156,7 +156,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "images", "properties": { "id_image": 13, @@ -169,7 +169,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "images", "properties": { "id_image": 14, @@ -182,7 +182,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "images", "properties": { "id_image": 15, @@ -195,7 +195,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "images", "properties": { "id_image": 16, @@ -208,7 +208,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "images", "properties": { "id_image": 17, @@ -221,7 +221,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "images", "properties": { "id_image": 18, @@ -234,7 +234,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "images", "properties": { "id_image": 19, @@ -247,7 +247,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "images", "properties": { "id_image": 20, @@ -260,7 +260,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "images", "properties": { "id_image": 21, @@ -273,7 +273,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "images", "properties": { "id_image": 22, @@ -286,7 +286,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "images", "properties": { "id_image": 23, diff --git a/e2e/src/fixtures/8/apiLanguages/languages.json b/e2e/src/fixtures/1.7/languages.json similarity index 93% rename from e2e/src/fixtures/8/apiLanguages/languages.json rename to e2e/src/fixtures/1.7/languages.json index 8c0b6eb5..7f08db6e 100644 --- a/e2e/src/fixtures/8/apiLanguages/languages.json +++ b/e2e/src/fixtures/1.7/languages.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "languages", "properties": { "id_lang": 1, diff --git a/e2e/src/fixtures/1.7/apiManufacturers/manufacturers.json b/e2e/src/fixtures/1.7/manufacturers.json similarity index 95% rename from e2e/src/fixtures/1.7/apiManufacturers/manufacturers.json rename to e2e/src/fixtures/1.7/manufacturers.json index fbb33521..aa9bdb73 100644 --- a/e2e/src/fixtures/1.7/apiManufacturers/manufacturers.json +++ b/e2e/src/fixtures/1.7/manufacturers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 1, @@ -18,7 +18,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 2, diff --git a/e2e/src/fixtures/1.7/apiModules/modules.json b/e2e/src/fixtures/1.7/modules.json similarity index 91% rename from e2e/src/fixtures/1.7/apiModules/modules.json rename to e2e/src/fixtures/1.7/modules.json index b2ca101a..fdbb20db 100644 --- a/e2e/src/fixtures/1.7/apiModules/modules.json +++ b/e2e/src/fixtures/1.7/modules.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "modules", "properties": { "module_id": "1", @@ -12,7 +12,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "modules", "properties": { "module_id": "2", @@ -24,7 +24,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "modules", "properties": { "module_id": "3", @@ -36,7 +36,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "modules", "properties": { "module_id": "4", @@ -48,7 +48,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "modules", "properties": { "module_id": "5", @@ -60,7 +60,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "modules", "properties": { "module_id": "6", @@ -72,7 +72,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "modules", "properties": { "module_id": "7", @@ -84,7 +84,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "modules", "properties": { "module_id": "8", @@ -96,7 +96,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "modules", "properties": { "module_id": "9", @@ -108,7 +108,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "modules", "properties": { "module_id": "10", @@ -120,7 +120,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "modules", "properties": { "module_id": "11", @@ -132,7 +132,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "modules", "properties": { "module_id": "12", @@ -144,7 +144,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "modules", "properties": { "module_id": "13", @@ -156,7 +156,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "modules", "properties": { "module_id": "14", @@ -168,7 +168,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "modules", "properties": { "module_id": "15", @@ -180,7 +180,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "modules", "properties": { "module_id": "16", @@ -192,7 +192,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "modules", "properties": { "module_id": "17", @@ -204,7 +204,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "modules", "properties": { "module_id": "18", @@ -216,7 +216,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "modules", "properties": { "module_id": "19", @@ -228,7 +228,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "modules", "properties": { "module_id": "20", @@ -240,7 +240,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "modules", "properties": { "module_id": "21", @@ -252,7 +252,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "modules", "properties": { "module_id": "22", @@ -264,7 +264,7 @@ } }, { - "id": "24", + "action": "upsert", "collection": "modules", "properties": { "module_id": "24", @@ -276,7 +276,7 @@ } }, { - "id": "25", + "action": "upsert", "collection": "modules", "properties": { "module_id": "25", @@ -288,7 +288,7 @@ } }, { - "id": "26", + "action": "upsert", "collection": "modules", "properties": { "module_id": "26", @@ -300,7 +300,7 @@ } }, { - "id": "27", + "action": "upsert", "collection": "modules", "properties": { "module_id": "27", @@ -312,7 +312,7 @@ } }, { - "id": "28", + "action": "upsert", "collection": "modules", "properties": { "module_id": "28", @@ -324,7 +324,7 @@ } }, { - "id": "29", + "action": "upsert", "collection": "modules", "properties": { "module_id": "29", @@ -336,7 +336,7 @@ } }, { - "id": "30", + "action": "upsert", "collection": "modules", "properties": { "module_id": "30", @@ -348,7 +348,7 @@ } }, { - "id": "31", + "action": "upsert", "collection": "modules", "properties": { "module_id": "31", @@ -360,7 +360,7 @@ } }, { - "id": "32", + "action": "upsert", "collection": "modules", "properties": { "module_id": "32", @@ -372,7 +372,7 @@ } }, { - "id": "33", + "action": "upsert", "collection": "modules", "properties": { "module_id": "33", @@ -384,7 +384,7 @@ } }, { - "id": "34", + "action": "upsert", "collection": "modules", "properties": { "module_id": "34", @@ -396,7 +396,7 @@ } }, { - "id": "35", + "action": "upsert", "collection": "modules", "properties": { "module_id": "35", @@ -408,7 +408,7 @@ } }, { - "id": "36", + "action": "upsert", "collection": "modules", "properties": { "module_id": "36", @@ -420,7 +420,7 @@ } }, { - "id": "37", + "action": "upsert", "collection": "modules", "properties": { "module_id": "37", @@ -432,7 +432,7 @@ } }, { - "id": "38", + "action": "upsert", "collection": "modules", "properties": { "module_id": "38", @@ -444,7 +444,7 @@ } }, { - "id": "39", + "action": "upsert", "collection": "modules", "properties": { "module_id": "39", @@ -456,7 +456,7 @@ } }, { - "id": "40", + "action": "upsert", "collection": "modules", "properties": { "module_id": "40", @@ -468,7 +468,7 @@ } }, { - "id": "41", + "action": "upsert", "collection": "modules", "properties": { "module_id": "41", @@ -480,7 +480,7 @@ } }, { - "id": "42", + "action": "upsert", "collection": "modules", "properties": { "module_id": "42", @@ -492,7 +492,7 @@ } }, { - "id": "43", + "action": "upsert", "collection": "modules", "properties": { "module_id": "43", @@ -504,7 +504,7 @@ } }, { - "id": "44", + "action": "upsert", "collection": "modules", "properties": { "module_id": "44", @@ -516,7 +516,7 @@ } }, { - "id": "45", + "action": "upsert", "collection": "modules", "properties": { "module_id": "45", @@ -528,7 +528,7 @@ } }, { - "id": "46", + "action": "upsert", "collection": "modules", "properties": { "module_id": "46", @@ -540,7 +540,7 @@ } }, { - "id": "47", + "action": "upsert", "collection": "modules", "properties": { "module_id": "47", @@ -552,7 +552,7 @@ } }, { - "id": "48", + "action": "upsert", "collection": "modules", "properties": { "module_id": "48", @@ -564,7 +564,7 @@ } }, { - "id": "49", + "action": "upsert", "collection": "modules", "properties": { "module_id": "49", @@ -576,7 +576,7 @@ } }, { - "id": "50", + "action": "upsert", "collection": "modules", "properties": { "module_id": "50", @@ -588,7 +588,7 @@ } }, { - "id": "51", + "action": "upsert", "collection": "modules", "properties": { "module_id": "51", @@ -600,7 +600,7 @@ } }, { - "id": "52", + "action": "upsert", "collection": "modules", "properties": { "module_id": "52", @@ -612,7 +612,7 @@ } }, { - "id": "53", + "action": "upsert", "collection": "modules", "properties": { "module_id": "53", @@ -624,7 +624,7 @@ } }, { - "id": "54", + "action": "upsert", "collection": "modules", "properties": { "module_id": "54", @@ -636,7 +636,7 @@ } }, { - "id": "55", + "action": "upsert", "collection": "modules", "properties": { "module_id": "55", @@ -648,7 +648,7 @@ } }, { - "id": "56", + "action": "upsert", "collection": "modules", "properties": { "module_id": "56", @@ -660,7 +660,7 @@ } }, { - "id": "57", + "action": "upsert", "collection": "modules", "properties": { "module_id": "57", @@ -672,7 +672,7 @@ } }, { - "id": "58", + "action": "upsert", "collection": "modules", "properties": { "module_id": "58", @@ -684,7 +684,7 @@ } }, { - "id": "59", + "action": "upsert", "collection": "modules", "properties": { "module_id": "59", @@ -696,7 +696,7 @@ } }, { - "id": "60", + "action": "upsert", "collection": "modules", "properties": { "module_id": "60", @@ -708,7 +708,7 @@ } }, { - "id": "61", + "action": "upsert", "collection": "modules", "properties": { "module_id": "61", @@ -720,7 +720,7 @@ } }, { - "id": "62", + "action": "upsert", "collection": "modules", "properties": { "module_id": "62", @@ -732,7 +732,7 @@ } }, { - "id": "63", + "action": "upsert", "collection": "modules", "properties": { "module_id": "63", @@ -744,7 +744,7 @@ } }, { - "id": "64", + "action": "upsert", "collection": "modules", "properties": { "module_id": "64", diff --git a/e2e/src/fixtures/1.7/order_cart_rules.json b/e2e/src/fixtures/1.7/order_cart_rules.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/order_cart_rules.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiOrders/order_details.json b/e2e/src/fixtures/1.7/order_details.json similarity index 95% rename from e2e/src/fixtures/9/apiOrders/order_details.json rename to e2e/src/fixtures/1.7/order_details.json index 9f313260..36a44a9b 100644 --- a/e2e/src/fixtures/9/apiOrders/order_details.json +++ b/e2e/src/fixtures/1.7/order_details.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 5, @@ -100,7 +100,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 6, @@ -120,7 +120,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 7, diff --git a/e2e/src/fixtures/1.7/apiOrders/order_status_history.json b/e2e/src/fixtures/1.7/order_status_history.json similarity index 95% rename from e2e/src/fixtures/1.7/apiOrders/order_status_history.json rename to e2e/src/fixtures/1.7/order_status_history.json index 80aa3b22..3039affb 100644 --- a/e2e/src/fixtures/1.7/apiOrders/order_status_history.json +++ b/e2e/src/fixtures/1.7/order_status_history.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -19,7 +19,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -38,7 +38,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -57,7 +57,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -76,7 +76,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 10, @@ -95,7 +95,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 6, @@ -114,7 +114,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 8, diff --git a/e2e/src/fixtures/1.7/orders.json b/e2e/src/fixtures/1.7/orders.json new file mode 100644 index 00000000..dfcba136 --- /dev/null +++ b/e2e/src/fixtures/1.7/orders.json @@ -0,0 +1,287 @@ +[ + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 1, + "reference": "XKBKNABJK", + "id_customer": 2, + "id_cart": "1", + "current_state": 6, + "conversion_rate": 1, + "total_paid_tax_excl": 66.8, + "total_paid_tax_incl": 68.2, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-10-26T00:32:43+0200", + "updated_at": "2024-10-26T00:32:43+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Canceled", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 59, + "total_products_wt": 59, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": true, + "total_paid_tax": 1.4000000000000057, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 2, + "reference": "OHSATSERP", + "id_customer": 2, + "id_cart": "2", + "current_state": 1, + "conversion_rate": 1, + "total_paid_tax_excl": 169.9, + "total_paid_tax_incl": 169.9, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 0, + "created_at": "2024-10-26T00:32:43+0200", + "updated_at": "2024-10-26T00:32:43+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting check payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 169, + "total_products_wt": 169, + "total_shipping_tax_incl": 0, + "total_shipping_tax_excl": 0, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 3, + "reference": "UOYEVOLI", + "id_customer": 2, + "id_cart": "3", + "current_state": 8, + "conversion_rate": 1, + "total_paid_tax_excl": 19.9, + "total_paid_tax_incl": 21.3, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-10-26T00:32:43+0200", + "updated_at": "2024-10-26T00:32:43+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Payment error", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 12, + "total_products_wt": 12, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 1.4000000000000021, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 4, + "reference": "FFATNOMMJ", + "id_customer": 2, + "id_cart": "4", + "current_state": 1, + "conversion_rate": 1, + "total_paid_tax_excl": 19.9, + "total_paid_tax_incl": 21.3, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-10-26T00:32:43+0200", + "updated_at": "2024-10-26T00:32:43+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting check payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 12, + "total_products_wt": 12, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 1.4000000000000021, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 5, + "reference": "KHWLILZLL", + "id_customer": 2, + "id_cart": "5", + "current_state": 10, + "conversion_rate": 1, + "total_paid_tax_excl": 25.9, + "total_paid_tax_incl": 27.3, + "currency": "EUR", + "payment_module": "ps_wirepayment", + "payment_mode": "Bank wire", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-10-26T00:32:43+0200", + "updated_at": "2024-10-26T00:32:43+0200", + "id_carrier": 2, + "payment_name": "ps_wirepayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting bank wire payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 18, + "total_products_wt": 18, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 1.4000000000000021, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + } +] diff --git a/e2e/src/fixtures/1.7/apiProducts/product_suppliers.json b/e2e/src/fixtures/1.7/product_suppliers.json similarity index 66% rename from e2e/src/fixtures/1.7/apiProducts/product_suppliers.json rename to e2e/src/fixtures/1.7/product_suppliers.json index 8a7ec862..f180aff8 100644 --- a/e2e/src/fixtures/1.7/apiProducts/product_suppliers.json +++ b/e2e/src/fixtures/1.7/product_suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 2, @@ -26,7 +26,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 3, @@ -39,7 +39,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 4, @@ -52,7 +52,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 5, @@ -65,7 +65,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 6, @@ -78,7 +78,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 7, @@ -91,7 +91,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 8, @@ -104,7 +104,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 9, @@ -117,7 +117,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 10, @@ -130,7 +130,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 11, @@ -143,7 +143,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 12, @@ -156,7 +156,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 13, @@ -169,7 +169,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 14, @@ -182,7 +182,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 15, @@ -195,7 +195,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 16, @@ -208,7 +208,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 17, @@ -221,7 +221,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 18, @@ -234,7 +234,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 19, @@ -247,7 +247,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 20, @@ -260,7 +260,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 21, @@ -273,7 +273,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 22, @@ -286,7 +286,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 23, @@ -299,7 +299,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 24, @@ -312,7 +312,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 25, @@ -325,7 +325,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 26, @@ -338,7 +338,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 27, @@ -351,7 +351,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 28, @@ -364,7 +364,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 29, @@ -377,7 +377,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 30, @@ -390,7 +390,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 31, @@ -403,7 +403,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 32, @@ -416,7 +416,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 33, @@ -429,7 +429,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 34, @@ -442,7 +442,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 35, @@ -455,7 +455,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 36, @@ -468,7 +468,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 37, @@ -481,7 +481,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 38, @@ -494,7 +494,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 39, @@ -507,7 +507,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 40, @@ -520,7 +520,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 41, @@ -533,7 +533,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 42, @@ -546,7 +546,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 43, @@ -559,7 +559,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 44, @@ -572,7 +572,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 45, @@ -585,7 +585,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 46, @@ -598,7 +598,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 47, @@ -611,7 +611,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 48, @@ -624,7 +624,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 49, @@ -637,7 +637,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 50, @@ -648,5 +648,265 @@ "product_supplier_price_te": 5.49, "id_currency": 0 } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 51, + "id_product": 10, + "id_product_attribute": 25, + "id_supplier": 2, + "product_supplier_reference": "demo_16_82", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 52, + "id_product": 11, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_17_83", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 53, + "id_product": 11, + "id_product_attribute": 26, + "id_supplier": 2, + "product_supplier_reference": "demo_17_83", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 54, + "id_product": 11, + "id_product_attribute": 27, + "id_supplier": 2, + "product_supplier_reference": "demo_17_84", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 55, + "id_product": 16, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_8_85", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 56, + "id_product": 16, + "id_product_attribute": 28, + "id_supplier": 2, + "product_supplier_reference": "demo_8_85", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 57, + "id_product": 16, + "id_product_attribute": 29, + "id_supplier": 2, + "product_supplier_reference": "demo_8_86", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 58, + "id_product": 16, + "id_product_attribute": 30, + "id_supplier": 2, + "product_supplier_reference": "demo_8_87", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 59, + "id_product": 16, + "id_product_attribute": 31, + "id_supplier": 2, + "product_supplier_reference": "demo_8_88", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 60, + "id_product": 17, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_9_89", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 61, + "id_product": 17, + "id_product_attribute": 32, + "id_supplier": 2, + "product_supplier_reference": "demo_9_89", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 62, + "id_product": 17, + "id_product_attribute": 33, + "id_supplier": 2, + "product_supplier_reference": "demo_9_90", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 63, + "id_product": 17, + "id_product_attribute": 34, + "id_supplier": 2, + "product_supplier_reference": "demo_9_91", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 64, + "id_product": 17, + "id_product_attribute": 35, + "id_supplier": 2, + "product_supplier_reference": "demo_9_92", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 65, + "id_product": 18, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_10_93", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 66, + "id_product": 18, + "id_product_attribute": 36, + "id_supplier": 2, + "product_supplier_reference": "demo_10_93", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 67, + "id_product": 18, + "id_product_attribute": 37, + "id_supplier": 2, + "product_supplier_reference": "demo_10_94", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 68, + "id_product": 18, + "id_product_attribute": 38, + "id_supplier": 2, + "product_supplier_reference": "demo_10_95", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 69, + "id_product": 18, + "id_product_attribute": 39, + "id_supplier": 2, + "product_supplier_reference": "demo_10_96", + "product_supplier_price_te": 5.49, + "id_currency": 0 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 70, + "id_product": 15, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "", + "product_supplier_price_te": 0, + "id_currency": 0 + } } ] diff --git a/e2e/src/fixtures/1.7/apiProducts/products.json b/e2e/src/fixtures/1.7/products.json similarity index 98% rename from e2e/src/fixtures/1.7/apiProducts/products.json rename to e2e/src/fixtures/1.7/products.json index b6ae4bc3..ba544a20 100644 --- a/e2e/src/fixtures/1.7/apiProducts/products.json +++ b/e2e/src/fixtures/1.7/products.json @@ -1,6 +1,6 @@ [ { - "id": "1-2-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -63,7 +63,7 @@ } }, { - "id": "1-3-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -126,7 +126,7 @@ } }, { - "id": "1-4-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -189,7 +189,7 @@ } }, { - "id": "1-5-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -252,7 +252,7 @@ } }, { - "id": "1-6-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -315,7 +315,7 @@ } }, { - "id": "1-7-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -378,7 +378,7 @@ } }, { - "id": "1-8-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -441,7 +441,7 @@ } }, { - "id": "1-1-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -504,7 +504,7 @@ } }, { - "id": "2-10-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -566,7 +566,7 @@ } }, { - "id": "2-11-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -628,7 +628,7 @@ } }, { - "id": "2-12-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -690,7 +690,7 @@ } }, { - "id": "2-9-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -752,7 +752,7 @@ } }, { - "id": "3-14-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -813,7 +813,7 @@ } }, { - "id": "3-15-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -874,7 +874,7 @@ } }, { - "id": "3-13-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -935,7 +935,7 @@ } }, { - "id": "4-17-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -996,7 +996,7 @@ } }, { - "id": "4-18-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1057,7 +1057,7 @@ } }, { - "id": "4-16-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1118,7 +1118,7 @@ } }, { - "id": "5-20-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1179,7 +1179,7 @@ } }, { - "id": "5-21-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1240,7 +1240,7 @@ } }, { - "id": "5-19-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1301,7 +1301,7 @@ } }, { - "id": "6-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -1360,7 +1360,7 @@ } }, { - "id": "7-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -1419,7 +1419,7 @@ } }, { - "id": "8-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 8, @@ -1478,7 +1478,7 @@ } }, { - "id": "9-23-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 9, @@ -1540,7 +1540,7 @@ } }, { - "id": "9-22-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 9, @@ -1602,7 +1602,7 @@ } }, { - "id": "10-25-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 10, @@ -1664,7 +1664,7 @@ } }, { - "id": "10-24-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 10, @@ -1726,7 +1726,7 @@ } }, { - "id": "11-27-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 11, @@ -1788,7 +1788,7 @@ } }, { - "id": "11-26-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 11, @@ -1850,7 +1850,7 @@ } }, { - "id": "12-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 12, @@ -1907,7 +1907,7 @@ } }, { - "id": "13-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 13, @@ -1964,7 +1964,7 @@ } }, { - "id": "14-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 14, @@ -2021,7 +2021,7 @@ } }, { - "id": "15-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 15, @@ -2078,7 +2078,7 @@ } }, { - "id": "16-29-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2140,7 +2140,7 @@ } }, { - "id": "16-30-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2202,7 +2202,7 @@ } }, { - "id": "16-31-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2264,7 +2264,7 @@ } }, { - "id": "16-28-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2326,7 +2326,7 @@ } }, { - "id": "17-33-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2388,7 +2388,7 @@ } }, { - "id": "17-34-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2450,7 +2450,7 @@ } }, { - "id": "17-35-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2512,7 +2512,7 @@ } }, { - "id": "17-32-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2574,7 +2574,7 @@ } }, { - "id": "18-37-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2636,7 +2636,7 @@ } }, { - "id": "18-38-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2698,7 +2698,7 @@ } }, { - "id": "18-39-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2760,7 +2760,7 @@ } }, { - "id": "18-36-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2822,7 +2822,7 @@ } }, { - "id": "19-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 19, diff --git a/e2e/src/fixtures/1.7/apiInfo/shops.json b/e2e/src/fixtures/1.7/shops.json similarity index 97% rename from e2e/src/fixtures/1.7/apiInfo/shops.json rename to e2e/src/fixtures/1.7/shops.json index b29741e3..854c0275 100644 --- a/e2e/src/fixtures/1.7/apiInfo/shops.json +++ b/e2e/src/fixtures/1.7/shops.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "shops", "properties": { "created_at": "2023-12-20 22:56:03", diff --git a/e2e/src/fixtures/1.7/apiSpecificPrices/specific_prices.json b/e2e/src/fixtures/1.7/specific_prices.json similarity index 96% rename from e2e/src/fixtures/1.7/apiSpecificPrices/specific_prices.json rename to e2e/src/fixtures/1.7/specific_prices.json index f179c309..222d03f4 100644 --- a/e2e/src/fixtures/1.7/apiSpecificPrices/specific_prices.json +++ b/e2e/src/fixtures/1.7/specific_prices.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 1, @@ -31,7 +31,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 2, diff --git a/e2e/src/fixtures/1.7/stock_movements.json b/e2e/src/fixtures/1.7/stock_movements.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/stock_movements.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiStocks/stocks.json b/e2e/src/fixtures/1.7/stocks.json similarity index 93% rename from e2e/src/fixtures/1.7/apiStocks/stocks.json rename to e2e/src/fixtures/1.7/stocks.json index b95df9a4..12efb5ae 100644 --- a/e2e/src/fixtures/1.7/apiStocks/stocks.json +++ b/e2e/src/fixtures/1.7/stocks.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 1, @@ -17,7 +17,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 2, @@ -34,7 +34,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 3, @@ -51,7 +51,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 4, @@ -68,7 +68,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 5, @@ -85,7 +85,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 6, @@ -102,7 +102,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 7, @@ -119,7 +119,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 8, @@ -136,7 +136,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 9, @@ -153,7 +153,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 10, @@ -170,7 +170,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 11, @@ -187,7 +187,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 12, @@ -204,7 +204,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 13, @@ -221,7 +221,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 14, @@ -238,7 +238,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 15, @@ -255,7 +255,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 16, @@ -272,7 +272,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 17, @@ -289,7 +289,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 18, @@ -306,7 +306,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 19, @@ -323,7 +323,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 20, @@ -340,7 +340,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 21, @@ -357,7 +357,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 22, @@ -374,7 +374,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 23, @@ -391,7 +391,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 24, @@ -408,7 +408,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 25, @@ -425,7 +425,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 26, @@ -442,7 +442,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 27, @@ -459,7 +459,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 28, @@ -476,7 +476,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 29, @@ -493,7 +493,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 30, @@ -510,7 +510,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 31, @@ -527,7 +527,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 32, @@ -544,7 +544,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 33, @@ -561,7 +561,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 34, @@ -578,7 +578,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 35, @@ -595,7 +595,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 36, @@ -612,7 +612,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 37, @@ -629,7 +629,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 38, @@ -646,7 +646,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 39, @@ -663,7 +663,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 40, @@ -680,7 +680,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 41, @@ -697,7 +697,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 42, @@ -714,7 +714,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 43, @@ -731,7 +731,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 44, @@ -748,7 +748,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 45, @@ -765,7 +765,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 46, @@ -782,7 +782,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 47, @@ -799,7 +799,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 48, @@ -816,7 +816,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 49, @@ -833,7 +833,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 50, @@ -850,7 +850,7 @@ } }, { - "id": 51, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 51, @@ -867,7 +867,7 @@ } }, { - "id": 52, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 52, @@ -884,7 +884,7 @@ } }, { - "id": 53, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 53, @@ -901,7 +901,7 @@ } }, { - "id": 54, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 54, @@ -918,7 +918,7 @@ } }, { - "id": 55, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 55, @@ -935,7 +935,7 @@ } }, { - "id": 56, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 56, @@ -952,7 +952,7 @@ } }, { - "id": 57, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 57, @@ -969,7 +969,7 @@ } }, { - "id": 58, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 58, diff --git a/e2e/src/fixtures/1.7/apiStores/stores.json b/e2e/src/fixtures/1.7/stores.json similarity index 96% rename from e2e/src/fixtures/1.7/apiStores/stores.json rename to e2e/src/fixtures/1.7/stores.json index 893436bb..d4f07ffc 100644 --- a/e2e/src/fixtures/1.7/apiStores/stores.json +++ b/e2e/src/fixtures/1.7/stores.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stores", "properties": { "id_store": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stores", "properties": { "id_store": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stores", "properties": { "id_store": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stores", "properties": { "id_store": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stores", "properties": { "id_store": 5, diff --git a/e2e/src/fixtures/1.7/apiSuppliers/suppliers.json b/e2e/src/fixtures/1.7/suppliers.json similarity index 94% rename from e2e/src/fixtures/1.7/apiSuppliers/suppliers.json rename to e2e/src/fixtures/1.7/suppliers.json index 33b27dad..0d869afe 100644 --- a/e2e/src/fixtures/1.7/apiSuppliers/suppliers.json +++ b/e2e/src/fixtures/1.7/suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 1, @@ -17,7 +17,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 2, diff --git a/e2e/src/fixtures/1.7/taxonomies.json b/e2e/src/fixtures/1.7/taxonomies.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/taxonomies.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiThemes/themes.json b/e2e/src/fixtures/1.7/themes.json similarity index 81% rename from e2e/src/fixtures/1.7/apiThemes/themes.json rename to e2e/src/fixtures/1.7/themes.json index d50b15de..15884f3e 100644 --- a/e2e/src/fixtures/1.7/apiThemes/themes.json +++ b/e2e/src/fixtures/1.7/themes.json @@ -1,6 +1,6 @@ [ { - "id": "f3d64714d1f6e7f71558d4252e84ab58", + "action": "upsert", "collection": "themes", "properties": { "theme_id": "f3d64714d1f6e7f71558d4252e84ab58", diff --git a/e2e/src/fixtures/1.7/translations.json b/e2e/src/fixtures/1.7/translations.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/translations.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/wishlist_products.json b/e2e/src/fixtures/1.7/wishlist_products.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/wishlist_products.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/wishlists.json b/e2e/src/fixtures/1.7/wishlists.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/1.7/wishlists.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiOrders/orders.json b/e2e/src/fixtures/8/apiOrders/orders.json deleted file mode 100644 index cbad1720..00000000 --- a/e2e/src/fixtures/8/apiOrders/orders.json +++ /dev/null @@ -1,167 +0,0 @@ -[ - { - "id": 1, - "collection": "orders", - "properties": { - "id_order": 1, - "reference": "XKBKNABJK", - "id_customer": 2, - "id_cart": 1, - "current_state": 6, - "conversion_rate": 1, - "total_paid_tax_excl": 66.8, - "total_paid_tax_incl": 68.2, - "new_customer": true, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2024-02-06T20:24:53+0100", - "updated_at": "2024-02-06T20:24:53+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": 0, - "is_paid": false, - "is_shipped": 0, - "status_label": "Canceled", - "total_paid_tax": 1.4000000000000057, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 2, - "collection": "orders", - "properties": { - "id_order": 2, - "reference": "OHSATSERP", - "id_customer": 2, - "id_cart": 2, - "current_state": 1, - "conversion_rate": 1, - "total_paid_tax_excl": 169.9, - "total_paid_tax_incl": 169.9, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 0, - "created_at": "2024-02-06T20:24:53+0100", - "updated_at": "2024-02-06T20:24:53+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": 0, - "is_paid": false, - "is_shipped": 0, - "status_label": "Awaiting check payment", - "total_paid_tax": 0, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 3, - "collection": "orders", - "properties": { - "id_order": 3, - "reference": "UOYEVOLI", - "id_customer": 2, - "id_cart": 3, - "current_state": 8, - "conversion_rate": 1, - "total_paid_tax_excl": 19.9, - "total_paid_tax_incl": 21.3, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2024-02-06T20:24:53+0100", - "updated_at": "2024-02-06T20:24:53+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": 0, - "is_paid": false, - "is_shipped": 0, - "status_label": "Payment error", - "total_paid_tax": 1.4000000000000021, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 4, - "collection": "orders", - "properties": { - "id_order": 4, - "reference": "FFATNOMMJ", - "id_customer": 2, - "id_cart": 4, - "current_state": 1, - "conversion_rate": 1, - "total_paid_tax_excl": 19.9, - "total_paid_tax_incl": 21.3, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_checkpayment", - "payment_mode": "Payment by check", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2024-02-06T20:24:53+0100", - "updated_at": "2024-02-06T20:24:53+0100", - "id_carrier": 2, - "payment_name": "ps_checkpayment", - "is_validated": 0, - "is_paid": false, - "is_shipped": 0, - "status_label": "Awaiting check payment", - "total_paid_tax": 1.4000000000000021, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - }, - { - "id": 5, - "collection": "orders", - "properties": { - "id_order": 5, - "reference": "KHWLILZLL", - "id_customer": 2, - "id_cart": 5, - "current_state": 10, - "conversion_rate": 1, - "total_paid_tax_excl": 25.9, - "total_paid_tax_incl": 27.3, - "new_customer": false, - "currency": "EUR", - "refund": 0, - "refund_tax_excl": 0, - "payment_module": "ps_wirepayment", - "payment_mode": "Bank wire", - "total_paid_real": "0.000000", - "shipping_cost": 7, - "created_at": "2024-02-06T20:24:53+0100", - "updated_at": "2024-02-06T20:24:53+0100", - "id_carrier": 2, - "payment_name": "ps_wirepayment", - "is_validated": 0, - "is_paid": false, - "is_shipped": 0, - "status_label": "Awaiting bank wire payment", - "total_paid_tax": 1.4000000000000021, - "delivery_country_code": "US", - "invoice_country_code": "US" - } - } -] diff --git a/e2e/src/fixtures/8/attributes.json b/e2e/src/fixtures/8/attributes.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/attributes.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/bundles.json b/e2e/src/fixtures/8/bundles.json new file mode 100644 index 00000000..fac3dce8 --- /dev/null +++ b/e2e/src/fixtures/8/bundles.json @@ -0,0 +1,24 @@ +[ + { + "action": "upsert", + "collection": "bundles", + "properties": { + "id_bundle": "15", + "id_product": "5", + "id_product_attribute": "19", + "unique_product_id": "15-0-en", + "quantity": "5" + } + }, + { + "action": "upsert", + "collection": "bundles", + "properties": { + "id_bundle": "15", + "id_product": "7", + "id_product_attribute": "0", + "unique_product_id": "15-0-en", + "quantity": "5" + } + } +] diff --git a/e2e/src/fixtures/8/apiCarriers/carrier_details.json b/e2e/src/fixtures/8/carrier_details.json similarity index 60% rename from e2e/src/fixtures/8/apiCarriers/carrier_details.json rename to e2e/src/fixtures/8/carrier_details.json index fe34c614..89f4a992 100644 --- a/e2e/src/fixtures/8/apiCarriers/carrier_details.json +++ b/e2e/src/fixtures/8/carrier_details.json @@ -1,226 +1,226 @@ [ { + "action": "upsert", "collection": "carrier_details", - "id": "3-1-range_price-2", "properties": { - "id_reference": "3", + "id_reference": "2", "id_zone": "1", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_price", + "id_range": "1", + "shipping_method": "range_weight", "delimiter1": 0, - "delimiter2": 50, + "delimiter2": 10000, "country_ids": "FR", "state_ids": "", - "price": 3 + "price": 5, + "id_carrier_detail": "1" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "3-2-range_price-2", "properties": { - "id_reference": "3", + "id_reference": "2", "id_zone": "2", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_price", + "id_range": "1", + "shipping_method": "range_weight", "delimiter1": 0, - "delimiter2": 50, + "delimiter2": 10000, "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 4 + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 5, + "id_carrier_detail": "1" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "3-2-range_price-3", "properties": { "id_reference": "3", - "id_zone": "2", - "id_range": "3", - "id_carrier_detail": "3", + "id_zone": "1", + "id_range": "2", "shipping_method": "range_price", - "delimiter1": 50, - "delimiter2": 100, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 2 + "delimiter1": 0, + "delimiter2": 50, + "country_ids": "FR", + "state_ids": "", + "price": 0, + "id_carrier_detail": "2" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "3-1-range_price-3", "properties": { "id_reference": "3", "id_zone": "1", "id_range": "3", - "id_carrier_detail": "3", "shipping_method": "range_price", "delimiter1": 50, "delimiter2": 100, "country_ids": "FR", "state_ids": "", - "price": 1 + "price": 0, + "id_carrier_detail": "3" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "3-1-range_price-4", "properties": { "id_reference": "3", "id_zone": "1", "id_range": "4", - "id_carrier_detail": "4", "shipping_method": "range_price", "delimiter1": 100, "delimiter2": 200, "country_ids": "FR", "state_ids": "", - "price": 0 + "price": 0, + "id_carrier_detail": "4" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "3-2-range_price-4", "properties": { "id_reference": "3", "id_zone": "2", - "id_range": "4", - "id_carrier_detail": "4", + "id_range": "2", "shipping_method": "range_price", - "delimiter1": 100, - "delimiter2": 200, + "delimiter1": 0, + "delimiter2": 50, "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 0 + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 0, + "id_carrier_detail": "2" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "4-1-range_weight-2", "properties": { - "id_reference": "4", - "id_zone": "1", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 1, - "country_ids": "FR", - "state_ids": "", - "price": 0 + "id_reference": "3", + "id_zone": "2", + "id_range": "3", + "shipping_method": "range_price", + "delimiter1": 50, + "delimiter2": 100, + "country_ids": "US", + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 0, + "id_carrier_detail": "3" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "4-2-range_weight-2", "properties": { - "id_reference": "4", + "id_reference": "3", "id_zone": "2", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 1, + "id_range": "4", + "shipping_method": "range_price", + "delimiter1": 100, + "delimiter2": 200, "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 0 + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 0, + "id_carrier_detail": "4" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "4-2-range_weight-3", "properties": { "id_reference": "4", - "id_zone": "2", - "id_range": "3", - "id_carrier_detail": "3", + "id_zone": "1", + "id_range": "2", "shipping_method": "range_weight", - "delimiter1": 1, - "delimiter2": 3, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 3 + "delimiter1": 0, + "delimiter2": 1, + "country_ids": "FR", + "state_ids": "", + "price": 6, + "id_carrier_detail": "2" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "4-1-range_weight-3", "properties": { "id_reference": "4", "id_zone": "1", "id_range": "3", - "id_carrier_detail": "3", "shipping_method": "range_weight", "delimiter1": 1, "delimiter2": 3, "country_ids": "FR", "state_ids": "", - "price": 2 + "price": 6, + "id_carrier_detail": "3" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "4-1-range_weight-4", "properties": { "id_reference": "4", "id_zone": "1", "id_range": "4", - "id_carrier_detail": "4", "shipping_method": "range_weight", "delimiter1": 3, "delimiter2": 10000, "country_ids": "FR", "state_ids": "", - "price": 5 + "price": 6, + "id_carrier_detail": "4" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "4-2-range_weight-4", "properties": { "id_reference": "4", "id_zone": "2", - "id_range": "4", - "id_carrier_detail": "4", + "id_range": "2", "shipping_method": "range_weight", - "delimiter1": 3, - "delimiter2": 10000, + "delimiter1": 0, + "delimiter2": 1, "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 6 + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 6, + "id_carrier_detail": "2" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "2-1-range_weight-1", "properties": { - "id_reference": "2", - "id_zone": "1", - "id_range": "1", - "id_carrier_detail": "1", + "id_reference": "4", + "id_zone": "2", + "id_range": "3", "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 10000, - "country_ids": "FR", - "state_ids": "", - "price": 5 + "delimiter1": 1, + "delimiter2": 3, + "country_ids": "US", + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 6, + "id_carrier_detail": "3" } }, { + "action": "upsert", "collection": "carrier_details", - "id": "2-2-range_weight-1", "properties": { - "id_reference": "2", + "id_reference": "4", "id_zone": "2", - "id_range": "1", - "id_carrier_detail": "1", + "id_range": "4", "shipping_method": "range_weight", - "delimiter1": 0, + "delimiter1": 3, "delimiter2": 10000, "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 5 + "state_ids": "AA,AE,AK,AL,AP,AR,AZ,CA,CO,CT,DC,DE,FL,GA,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MI,MN,MO,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY", + "price": 6, + "id_carrier_detail": "4" } } ] diff --git a/e2e/src/fixtures/8/carrier_taxes.json b/e2e/src/fixtures/8/carrier_taxes.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/carrier_taxes.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiCarriers/carriers.json b/e2e/src/fixtures/8/carriers.json similarity index 96% rename from e2e/src/fixtures/9/apiCarriers/carriers.json rename to e2e/src/fixtures/8/carriers.json index 0caae8c7..5205b166 100644 --- a/e2e/src/fixtures/9/apiCarriers/carriers.json +++ b/e2e/src/fixtures/8/carriers.json @@ -1,21 +1,17 @@ [ { + "action": "upsert", "collection": "carriers", - "id": "3", "properties": { - "id_carrier": "3", - "id_reference": "3", - "name": "My cheap carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "1", + "id_reference": "1", + "name": "Click and collect", "url": "", - "active": false, + "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, - "is_free": false, + "is_free": true, "shipping_external": false, "need_range": false, "external_module_name": "", @@ -24,25 +20,25 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Buy more to pay less!", + "delay": "Pick up in-store", + "shipping_handling": 0, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "4", "properties": { - "id_carrier": "4", - "id_reference": "4", - "name": "My light carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "2", + "id_reference": "2", + "name": "My carrier", "url": "", - "active": false, + "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -54,28 +50,28 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "The lighter the cheaper!", + "delay": "Delivery next day!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "1", "properties": { - "id_carrier": "1", - "id_reference": "1", - "name": "Click and collect", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "3", + "id_reference": "3", + "name": "My cheap carrier", "url": "", - "active": true, + "active": false, "deleted": false, - "shipping_handling": 0, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, - "is_free": true, + "is_free": false, "shipping_external": false, "need_range": false, "external_module_name": "", @@ -84,25 +80,25 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Pick up in-store", + "delay": "Buy more to pay less!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "2", "properties": { - "id_carrier": "2", - "id_reference": "2", - "name": "My carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "4", + "id_reference": "4", + "name": "My light carrier", "url": "", - "active": true, + "active": false, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -114,7 +110,11 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Delivery next day!", + "delay": "The lighter the cheaper!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } diff --git a/e2e/src/fixtures/9/apiCarts/cart_products.json b/e2e/src/fixtures/8/cart_products.json similarity index 90% rename from e2e/src/fixtures/9/apiCarts/cart_products.json rename to e2e/src/fixtures/8/cart_products.json index c4af221f..2d245056 100644 --- a/e2e/src/fixtures/9/apiCarts/cart_products.json +++ b/e2e/src/fixtures/8/cart_products.json @@ -1,6 +1,6 @@ [ { - "id": "1-1-1", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -12,7 +12,7 @@ } }, { - "id": "1-2-9", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -24,7 +24,7 @@ } }, { - "id": "2-4-18", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -36,7 +36,7 @@ } }, { - "id": "2-8-0", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -48,7 +48,7 @@ } }, { - "id": "3-16-28", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "3", @@ -60,7 +60,7 @@ } }, { - "id": "4-16-29", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -72,7 +72,7 @@ } }, { - "id": "5-10-25", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/8/cart_rules.json b/e2e/src/fixtures/8/cart_rules.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/cart_rules.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiCarts/carts.json b/e2e/src/fixtures/8/carts.json similarity index 88% rename from e2e/src/fixtures/8/apiCarts/carts.json rename to e2e/src/fixtures/8/carts.json index 1e1bce2b..97934640 100644 --- a/e2e/src/fixtures/8/apiCarts/carts.json +++ b/e2e/src/fixtures/8/carts.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "1", @@ -9,7 +9,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "2", @@ -18,7 +18,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "3", @@ -27,7 +27,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "4", @@ -36,7 +36,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/8/apiCategories/categories.json b/e2e/src/fixtures/8/categories.json similarity index 95% rename from e2e/src/fixtures/8/apiCategories/categories.json rename to e2e/src/fixtures/8/categories.json index c1f796f6..014a4830 100644 --- a/e2e/src/fixtures/8/apiCategories/categories.json +++ b/e2e/src/fixtures/8/categories.json @@ -1,6 +1,6 @@ [ { - "id": "1-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "1-en", @@ -18,7 +18,7 @@ } }, { - "id": "2-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "2-en", @@ -36,7 +36,7 @@ } }, { - "id": "3-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "3-en", @@ -54,7 +54,7 @@ } }, { - "id": "4-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "4-en", @@ -72,7 +72,7 @@ } }, { - "id": "5-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "5-en", @@ -90,7 +90,7 @@ } }, { - "id": "6-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "6-en", @@ -108,7 +108,7 @@ } }, { - "id": "7-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "7-en", @@ -126,7 +126,7 @@ } }, { - "id": "8-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "8-en", @@ -144,7 +144,7 @@ } }, { - "id": "9-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "9-en", diff --git a/e2e/src/fixtures/8/apiCurrencies/currencies.json b/e2e/src/fixtures/8/currencies.json similarity index 90% rename from e2e/src/fixtures/8/apiCurrencies/currencies.json rename to e2e/src/fixtures/8/currencies.json index 1955a57d..c936a1f2 100644 --- a/e2e/src/fixtures/8/apiCurrencies/currencies.json +++ b/e2e/src/fixtures/8/currencies.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 2, diff --git a/e2e/src/fixtures/8/custom_product_carriers.json b/e2e/src/fixtures/8/custom_product_carriers.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/custom_product_carriers.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiCustomers/customers.json b/e2e/src/fixtures/8/customers.json similarity index 95% rename from e2e/src/fixtures/8/apiCustomers/customers.json rename to e2e/src/fixtures/8/customers.json index 9ab76e48..fdaac1b6 100644 --- a/e2e/src/fixtures/8/apiCustomers/customers.json +++ b/e2e/src/fixtures/8/customers.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 1, @@ -17,7 +17,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 2, diff --git a/e2e/src/fixtures/8/apiEmployees/employees.json b/e2e/src/fixtures/8/employees.json similarity index 96% rename from e2e/src/fixtures/8/apiEmployees/employees.json rename to e2e/src/fixtures/8/employees.json index 747c86b6..cb046d42 100644 --- a/e2e/src/fixtures/8/apiEmployees/employees.json +++ b/e2e/src/fixtures/8/employees.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "employees", "properties": { "id_employee": 1, diff --git a/e2e/src/fixtures/1.7/apiImageTypes/image_types.json b/e2e/src/fixtures/8/image_types.json similarity index 92% rename from e2e/src/fixtures/1.7/apiImageTypes/image_types.json rename to e2e/src/fixtures/8/image_types.json index b8cbf800..7d0cba7f 100644 --- a/e2e/src/fixtures/1.7/apiImageTypes/image_types.json +++ b/e2e/src/fixtures/8/image_types.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 1, @@ -15,7 +15,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 2, @@ -30,7 +30,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 3, @@ -45,7 +45,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 4, @@ -60,7 +60,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 5, @@ -75,7 +75,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 6, @@ -90,7 +90,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 7, diff --git a/e2e/src/fixtures/9/apiImages/images.json b/e2e/src/fixtures/8/images.json similarity index 90% rename from e2e/src/fixtures/9/apiImages/images.json rename to e2e/src/fixtures/8/images.json index 9927ccb0..8dea38a2 100644 --- a/e2e/src/fixtures/9/apiImages/images.json +++ b/e2e/src/fixtures/8/images.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "images", "properties": { "id_image": 1, @@ -13,7 +13,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "images", "properties": { "id_image": 2, @@ -26,7 +26,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "images", "properties": { "id_image": 3, @@ -39,7 +39,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "images", "properties": { "id_image": 4, @@ -52,7 +52,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "images", "properties": { "id_image": 5, @@ -65,7 +65,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "images", "properties": { "id_image": 6, @@ -78,7 +78,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "images", "properties": { "id_image": 7, @@ -91,7 +91,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "images", "properties": { "id_image": 8, @@ -104,7 +104,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "images", "properties": { "id_image": 9, @@ -117,7 +117,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "images", "properties": { "id_image": 10, @@ -130,7 +130,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "images", "properties": { "id_image": 11, @@ -143,7 +143,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "images", "properties": { "id_image": 12, @@ -156,7 +156,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "images", "properties": { "id_image": 13, @@ -169,7 +169,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "images", "properties": { "id_image": 14, @@ -182,7 +182,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "images", "properties": { "id_image": 15, @@ -195,7 +195,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "images", "properties": { "id_image": 16, @@ -208,7 +208,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "images", "properties": { "id_image": 17, @@ -221,7 +221,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "images", "properties": { "id_image": 18, @@ -234,7 +234,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "images", "properties": { "id_image": 19, @@ -247,7 +247,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "images", "properties": { "id_image": 20, @@ -260,7 +260,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "images", "properties": { "id_image": 21, @@ -273,7 +273,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "images", "properties": { "id_image": 22, @@ -286,7 +286,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "images", "properties": { "id_image": 23, diff --git a/e2e/src/fixtures/9/apiLanguages/languages.json b/e2e/src/fixtures/8/languages.json similarity index 93% rename from e2e/src/fixtures/9/apiLanguages/languages.json rename to e2e/src/fixtures/8/languages.json index 8c0b6eb5..7f08db6e 100644 --- a/e2e/src/fixtures/9/apiLanguages/languages.json +++ b/e2e/src/fixtures/8/languages.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "languages", "properties": { "id_lang": 1, diff --git a/e2e/src/fixtures/8/apiManufacturers/manufacturers.json b/e2e/src/fixtures/8/manufacturers.json similarity index 95% rename from e2e/src/fixtures/8/apiManufacturers/manufacturers.json rename to e2e/src/fixtures/8/manufacturers.json index 3940f5b3..7a5409ec 100644 --- a/e2e/src/fixtures/8/apiManufacturers/manufacturers.json +++ b/e2e/src/fixtures/8/manufacturers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 1, @@ -18,7 +18,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 2, diff --git a/e2e/src/fixtures/8/apiModules/modules.json b/e2e/src/fixtures/8/modules.json similarity index 91% rename from e2e/src/fixtures/8/apiModules/modules.json rename to e2e/src/fixtures/8/modules.json index 621bf62c..8b07c229 100644 --- a/e2e/src/fixtures/8/apiModules/modules.json +++ b/e2e/src/fixtures/8/modules.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "modules", "properties": { "module_id": "1", @@ -12,7 +12,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "modules", "properties": { "module_id": "2", @@ -24,7 +24,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "modules", "properties": { "module_id": "3", @@ -36,7 +36,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "modules", "properties": { "module_id": "4", @@ -48,7 +48,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "modules", "properties": { "module_id": "5", @@ -60,7 +60,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "modules", "properties": { "module_id": "6", @@ -72,7 +72,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "modules", "properties": { "module_id": "7", @@ -84,7 +84,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "modules", "properties": { "module_id": "8", @@ -96,7 +96,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "modules", "properties": { "module_id": "9", @@ -108,7 +108,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "modules", "properties": { "module_id": "10", @@ -120,7 +120,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "modules", "properties": { "module_id": "11", @@ -132,7 +132,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "modules", "properties": { "module_id": "12", @@ -144,7 +144,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "modules", "properties": { "module_id": "13", @@ -156,7 +156,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "modules", "properties": { "module_id": "14", @@ -168,7 +168,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "modules", "properties": { "module_id": "15", @@ -180,7 +180,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "modules", "properties": { "module_id": "16", @@ -192,7 +192,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "modules", "properties": { "module_id": "17", @@ -204,7 +204,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "modules", "properties": { "module_id": "18", @@ -216,7 +216,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "modules", "properties": { "module_id": "19", @@ -228,7 +228,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "modules", "properties": { "module_id": "20", @@ -240,7 +240,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "modules", "properties": { "module_id": "21", @@ -252,7 +252,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "modules", "properties": { "module_id": "22", @@ -264,7 +264,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "modules", "properties": { "module_id": "23", @@ -276,7 +276,7 @@ } }, { - "id": "25", + "action": "upsert", "collection": "modules", "properties": { "module_id": "25", @@ -288,7 +288,7 @@ } }, { - "id": "26", + "action": "upsert", "collection": "modules", "properties": { "module_id": "26", @@ -300,7 +300,7 @@ } }, { - "id": "27", + "action": "upsert", "collection": "modules", "properties": { "module_id": "27", @@ -312,7 +312,7 @@ } }, { - "id": "28", + "action": "upsert", "collection": "modules", "properties": { "module_id": "28", @@ -324,7 +324,7 @@ } }, { - "id": "29", + "action": "upsert", "collection": "modules", "properties": { "module_id": "29", @@ -336,7 +336,7 @@ } }, { - "id": "30", + "action": "upsert", "collection": "modules", "properties": { "module_id": "30", @@ -348,7 +348,7 @@ } }, { - "id": "31", + "action": "upsert", "collection": "modules", "properties": { "module_id": "31", @@ -360,7 +360,7 @@ } }, { - "id": "32", + "action": "upsert", "collection": "modules", "properties": { "module_id": "32", @@ -372,7 +372,7 @@ } }, { - "id": "33", + "action": "upsert", "collection": "modules", "properties": { "module_id": "33", @@ -384,7 +384,7 @@ } }, { - "id": "34", + "action": "upsert", "collection": "modules", "properties": { "module_id": "34", @@ -396,7 +396,7 @@ } }, { - "id": "35", + "action": "upsert", "collection": "modules", "properties": { "module_id": "35", @@ -408,7 +408,7 @@ } }, { - "id": "36", + "action": "upsert", "collection": "modules", "properties": { "module_id": "36", @@ -420,7 +420,7 @@ } }, { - "id": "37", + "action": "upsert", "collection": "modules", "properties": { "module_id": "37", @@ -432,7 +432,7 @@ } }, { - "id": "38", + "action": "upsert", "collection": "modules", "properties": { "module_id": "38", @@ -444,7 +444,7 @@ } }, { - "id": "39", + "action": "upsert", "collection": "modules", "properties": { "module_id": "39", @@ -456,7 +456,7 @@ } }, { - "id": "40", + "action": "upsert", "collection": "modules", "properties": { "module_id": "40", @@ -468,7 +468,7 @@ } }, { - "id": "41", + "action": "upsert", "collection": "modules", "properties": { "module_id": "41", @@ -480,7 +480,7 @@ } }, { - "id": "42", + "action": "upsert", "collection": "modules", "properties": { "module_id": "42", @@ -492,7 +492,7 @@ } }, { - "id": "43", + "action": "upsert", "collection": "modules", "properties": { "module_id": "43", @@ -504,7 +504,7 @@ } }, { - "id": "44", + "action": "upsert", "collection": "modules", "properties": { "module_id": "44", @@ -516,7 +516,7 @@ } }, { - "id": "45", + "action": "upsert", "collection": "modules", "properties": { "module_id": "45", @@ -528,7 +528,7 @@ } }, { - "id": "46", + "action": "upsert", "collection": "modules", "properties": { "module_id": "46", @@ -540,7 +540,7 @@ } }, { - "id": "47", + "action": "upsert", "collection": "modules", "properties": { "module_id": "47", @@ -552,7 +552,7 @@ } }, { - "id": "48", + "action": "upsert", "collection": "modules", "properties": { "module_id": "48", @@ -564,7 +564,7 @@ } }, { - "id": "49", + "action": "upsert", "collection": "modules", "properties": { "module_id": "49", @@ -576,7 +576,7 @@ } }, { - "id": "50", + "action": "upsert", "collection": "modules", "properties": { "module_id": "50", @@ -588,7 +588,7 @@ } }, { - "id": "51", + "action": "upsert", "collection": "modules", "properties": { "module_id": "51", @@ -600,7 +600,7 @@ } }, { - "id": "52", + "action": "upsert", "collection": "modules", "properties": { "module_id": "52", @@ -612,7 +612,7 @@ } }, { - "id": "53", + "action": "upsert", "collection": "modules", "properties": { "module_id": "53", @@ -624,7 +624,7 @@ } }, { - "id": "54", + "action": "upsert", "collection": "modules", "properties": { "module_id": "54", @@ -636,7 +636,7 @@ } }, { - "id": "55", + "action": "upsert", "collection": "modules", "properties": { "module_id": "55", @@ -648,7 +648,7 @@ } }, { - "id": "56", + "action": "upsert", "collection": "modules", "properties": { "module_id": "56", @@ -660,7 +660,7 @@ } }, { - "id": "57", + "action": "upsert", "collection": "modules", "properties": { "module_id": "57", @@ -672,7 +672,7 @@ } }, { - "id": "58", + "action": "upsert", "collection": "modules", "properties": { "module_id": "58", @@ -684,7 +684,7 @@ } }, { - "id": "59", + "action": "upsert", "collection": "modules", "properties": { "module_id": "59", @@ -696,7 +696,7 @@ } }, { - "id": "60", + "action": "upsert", "collection": "modules", "properties": { "module_id": "60", @@ -708,7 +708,7 @@ } }, { - "id": "61", + "action": "upsert", "collection": "modules", "properties": { "module_id": "61", @@ -720,7 +720,7 @@ } }, { - "id": "62", + "action": "upsert", "collection": "modules", "properties": { "module_id": "62", @@ -732,7 +732,7 @@ } }, { - "id": "63", + "action": "upsert", "collection": "modules", "properties": { "module_id": "63", @@ -744,7 +744,7 @@ } }, { - "id": "64", + "action": "upsert", "collection": "modules", "properties": { "module_id": "64", @@ -756,7 +756,7 @@ } }, { - "id": "65", + "action": "upsert", "collection": "modules", "properties": { "module_id": "65", @@ -768,7 +768,7 @@ } }, { - "id": "66", + "action": "upsert", "collection": "modules", "properties": { "module_id": "66", @@ -780,7 +780,7 @@ } }, { - "id": "67", + "action": "upsert", "collection": "modules", "properties": { "module_id": "67", @@ -792,7 +792,7 @@ } }, { - "id": "68", + "action": "upsert", "collection": "modules", "properties": { "module_id": "68", @@ -804,7 +804,7 @@ } }, { - "id": "69", + "action": "upsert", "collection": "modules", "properties": { "module_id": "69", diff --git a/e2e/src/fixtures/8/order_cart_rules.json b/e2e/src/fixtures/8/order_cart_rules.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/order_cart_rules.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/1.7/apiOrders/order_details.json b/e2e/src/fixtures/8/order_details.json similarity index 95% rename from e2e/src/fixtures/1.7/apiOrders/order_details.json rename to e2e/src/fixtures/8/order_details.json index 9f313260..36a44a9b 100644 --- a/e2e/src/fixtures/1.7/apiOrders/order_details.json +++ b/e2e/src/fixtures/8/order_details.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 5, @@ -100,7 +100,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 6, @@ -120,7 +120,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 7, diff --git a/e2e/src/fixtures/8/apiOrders/order_status_history.json b/e2e/src/fixtures/8/order_status_history.json similarity index 95% rename from e2e/src/fixtures/8/apiOrders/order_status_history.json rename to e2e/src/fixtures/8/order_status_history.json index f5d6eac5..60575de7 100644 --- a/e2e/src/fixtures/8/apiOrders/order_status_history.json +++ b/e2e/src/fixtures/8/order_status_history.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -19,7 +19,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -38,7 +38,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -57,7 +57,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -76,7 +76,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 10, @@ -95,7 +95,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 6, @@ -114,7 +114,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 8, diff --git a/e2e/src/fixtures/8/orders.json b/e2e/src/fixtures/8/orders.json new file mode 100644 index 00000000..09866d89 --- /dev/null +++ b/e2e/src/fixtures/8/orders.json @@ -0,0 +1,287 @@ +[ + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 1, + "reference": "XKBKNABJK", + "id_customer": 2, + "id_cart": "1", + "current_state": 6, + "conversion_rate": 1, + "total_paid_tax_excl": 66.8, + "total_paid_tax_incl": 68.2, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-09-26T22:51:17+0200", + "updated_at": "2024-09-26T22:51:17+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Canceled", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 59, + "total_products_wt": 59, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": true, + "total_paid_tax": 1.4000000000000057, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 2, + "reference": "OHSATSERP", + "id_customer": 2, + "id_cart": "2", + "current_state": 1, + "conversion_rate": 1, + "total_paid_tax_excl": 169.9, + "total_paid_tax_incl": 169.9, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 0, + "created_at": "2024-09-26T22:51:17+0200", + "updated_at": "2024-09-26T22:51:17+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting check payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 169, + "total_products_wt": 169, + "total_shipping_tax_incl": 0, + "total_shipping_tax_excl": 0, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 0, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 3, + "reference": "UOYEVOLI", + "id_customer": 2, + "id_cart": "3", + "current_state": 8, + "conversion_rate": 1, + "total_paid_tax_excl": 19.9, + "total_paid_tax_incl": 21.3, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-09-26T22:51:17+0200", + "updated_at": "2024-09-26T22:51:17+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Payment error", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 12, + "total_products_wt": 12, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 1.4000000000000021, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 4, + "reference": "FFATNOMMJ", + "id_customer": 2, + "id_cart": "4", + "current_state": 1, + "conversion_rate": 1, + "total_paid_tax_excl": 19.9, + "total_paid_tax_incl": 21.3, + "currency": "EUR", + "payment_module": "ps_checkpayment", + "payment_mode": "Payment by check", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-09-26T22:51:17+0200", + "updated_at": "2024-09-26T22:51:17+0200", + "id_carrier": 2, + "payment_name": "ps_checkpayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting check payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 12, + "total_products_wt": 12, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 1.4000000000000021, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + }, + { + "action": "upsert", + "collection": "orders", + "properties": { + "id_order": 5, + "reference": "KHWLILZLL", + "id_customer": 2, + "id_cart": "5", + "current_state": 10, + "conversion_rate": 1, + "total_paid_tax_excl": 25.9, + "total_paid_tax_incl": 27.3, + "currency": "EUR", + "payment_module": "ps_wirepayment", + "payment_mode": "Bank wire", + "total_paid_real": "0.000000", + "shipping_cost": 7, + "created_at": "2024-09-26T22:51:17+0200", + "updated_at": "2024-09-26T22:51:17+0200", + "id_carrier": 2, + "payment_name": "ps_wirepayment", + "is_validated": "0", + "is_paid": false, + "is_shipped": "0", + "status_label": "Awaiting bank wire payment", + "id_shop_group": 1, + "id_shop": 1, + "id_lang": 1, + "id_currency": 1, + "recyclable": false, + "gift": false, + "total_discounts": 0, + "total_discounts_tax_incl": 0, + "total_discounts_tax_excl": 0, + "total_products": 18, + "total_products_wt": 18, + "total_shipping_tax_incl": 8, + "total_shipping_tax_excl": 7, + "carrier_tax_rate": 0, + "total_wrapping": 0, + "total_wrapping_tax_incl": 0, + "total_wrapping_tax_excl": 0, + "round_mode": 0, + "round_type": 0, + "invoice_number": 0, + "delivery_number": 0, + "invoice_date": "0000-00-00 00:00:00", + "delivery_date": "0000-00-00 00:00:00", + "valid": false, + "refund": 0, + "refund_tax_excl": 0, + "new_customer": false, + "total_paid_tax": 1.4000000000000021, + "delivery_country_code": "US", + "invoice_country_code": "US" + } + } +] diff --git a/e2e/src/fixtures/8/apiProducts/product_suppliers.json b/e2e/src/fixtures/8/product_suppliers.json similarity index 63% rename from e2e/src/fixtures/8/apiProducts/product_suppliers.json rename to e2e/src/fixtures/8/product_suppliers.json index 4ac63997..72ee278d 100644 --- a/e2e/src/fixtures/8/apiProducts/product_suppliers.json +++ b/e2e/src/fixtures/8/product_suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 2, @@ -26,7 +26,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 3, @@ -39,7 +39,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 4, @@ -52,7 +52,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 5, @@ -65,7 +65,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 6, @@ -78,7 +78,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 7, @@ -91,7 +91,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 8, @@ -104,7 +104,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 9, @@ -117,7 +117,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 10, @@ -130,7 +130,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 11, @@ -143,7 +143,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 12, @@ -156,7 +156,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 13, @@ -169,7 +169,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 14, @@ -182,7 +182,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 15, @@ -195,7 +195,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 16, @@ -208,7 +208,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 17, @@ -221,7 +221,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 18, @@ -234,7 +234,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 19, @@ -247,7 +247,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 20, @@ -260,7 +260,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 21, @@ -273,7 +273,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 22, @@ -286,7 +286,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 23, @@ -299,7 +299,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 24, @@ -312,7 +312,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 25, @@ -325,7 +325,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 26, @@ -338,7 +338,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 27, @@ -351,7 +351,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 28, @@ -364,7 +364,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 29, @@ -377,7 +377,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 30, @@ -390,7 +390,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 31, @@ -403,7 +403,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 32, @@ -416,7 +416,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 33, @@ -429,7 +429,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 34, @@ -442,7 +442,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 35, @@ -455,7 +455,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 36, @@ -468,7 +468,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 37, @@ -481,7 +481,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 38, @@ -494,7 +494,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 39, @@ -507,7 +507,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 40, @@ -520,7 +520,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 41, @@ -533,7 +533,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 42, @@ -546,7 +546,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 43, @@ -559,7 +559,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 44, @@ -572,7 +572,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 45, @@ -585,7 +585,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 46, @@ -598,7 +598,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 47, @@ -611,7 +611,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 48, @@ -624,7 +624,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 49, @@ -637,7 +637,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 50, @@ -648,5 +648,304 @@ "product_supplier_price_te": 5.49, "id_currency": 1 } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 51, + "id_product": 9, + "id_product_attribute": 23, + "id_supplier": 2, + "product_supplier_reference": "demo_15_80", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 52, + "id_product": 10, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_16_81", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 53, + "id_product": 10, + "id_product_attribute": 24, + "id_supplier": 2, + "product_supplier_reference": "demo_16_81", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 54, + "id_product": 10, + "id_product_attribute": 25, + "id_supplier": 2, + "product_supplier_reference": "demo_16_82", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 55, + "id_product": 11, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_17_83", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 56, + "id_product": 11, + "id_product_attribute": 26, + "id_supplier": 2, + "product_supplier_reference": "demo_17_83", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 57, + "id_product": 11, + "id_product_attribute": 27, + "id_supplier": 2, + "product_supplier_reference": "demo_17_84", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 58, + "id_product": 16, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_8_85", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 59, + "id_product": 16, + "id_product_attribute": 28, + "id_supplier": 2, + "product_supplier_reference": "demo_8_85", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 60, + "id_product": 16, + "id_product_attribute": 29, + "id_supplier": 2, + "product_supplier_reference": "demo_8_86", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 61, + "id_product": 16, + "id_product_attribute": 30, + "id_supplier": 2, + "product_supplier_reference": "demo_8_87", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 62, + "id_product": 16, + "id_product_attribute": 31, + "id_supplier": 2, + "product_supplier_reference": "demo_8_88", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 63, + "id_product": 17, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_9_89", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 64, + "id_product": 17, + "id_product_attribute": 32, + "id_supplier": 2, + "product_supplier_reference": "demo_9_89", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 65, + "id_product": 17, + "id_product_attribute": 33, + "id_supplier": 2, + "product_supplier_reference": "demo_9_90", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 66, + "id_product": 17, + "id_product_attribute": 34, + "id_supplier": 2, + "product_supplier_reference": "demo_9_91", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 67, + "id_product": 17, + "id_product_attribute": 35, + "id_supplier": 2, + "product_supplier_reference": "demo_9_92", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 68, + "id_product": 18, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_10_93", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 69, + "id_product": 18, + "id_product_attribute": 36, + "id_supplier": 2, + "product_supplier_reference": "demo_10_93", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 70, + "id_product": 18, + "id_product_attribute": 37, + "id_supplier": 2, + "product_supplier_reference": "demo_10_94", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 71, + "id_product": 18, + "id_product_attribute": 38, + "id_supplier": 2, + "product_supplier_reference": "demo_10_95", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 72, + "id_product": 18, + "id_product_attribute": 39, + "id_supplier": 2, + "product_supplier_reference": "demo_10_96", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 73, + "id_product": 15, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "", + "product_supplier_price_te": 0, + "id_currency": 1 + } } ] diff --git a/e2e/src/fixtures/8/apiProducts/products.json b/e2e/src/fixtures/8/products.json similarity index 97% rename from e2e/src/fixtures/8/apiProducts/products.json rename to e2e/src/fixtures/8/products.json index 41a26983..d6ee1349 100644 --- a/e2e/src/fixtures/8/apiProducts/products.json +++ b/e2e/src/fixtures/8/products.json @@ -1,6 +1,6 @@ [ { - "id": "1-2-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -34,7 +34,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -63,7 +63,7 @@ } }, { - "id": "1-3-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -97,7 +97,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -126,7 +126,7 @@ } }, { - "id": "1-4-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -160,7 +160,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -189,7 +189,7 @@ } }, { - "id": "1-5-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -223,7 +223,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -252,7 +252,7 @@ } }, { - "id": "1-6-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -286,7 +286,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -315,7 +315,7 @@ } }, { - "id": "1-7-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -349,7 +349,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -378,7 +378,7 @@ } }, { - "id": "1-8-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -412,7 +412,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -441,7 +441,7 @@ } }, { - "id": "1-1-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -475,7 +475,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -504,7 +504,7 @@ } }, { - "id": "2-10-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -538,7 +538,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -566,7 +566,7 @@ } }, { - "id": "2-11-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -600,7 +600,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -628,7 +628,7 @@ } }, { - "id": "2-12-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -662,7 +662,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -690,7 +690,7 @@ } }, { - "id": "2-9-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -724,7 +724,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -752,7 +752,7 @@ } }, { - "id": "3-14-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -786,7 +786,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -813,7 +813,7 @@ } }, { - "id": "3-15-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -847,7 +847,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -874,7 +874,7 @@ } }, { - "id": "3-13-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -908,7 +908,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -935,7 +935,7 @@ } }, { - "id": "4-17-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -969,7 +969,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -996,7 +996,7 @@ } }, { - "id": "4-18-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1030,7 +1030,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1057,7 +1057,7 @@ } }, { - "id": "4-16-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1091,7 +1091,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1118,7 +1118,7 @@ } }, { - "id": "5-20-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1152,7 +1152,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1179,7 +1179,7 @@ } }, { - "id": "5-21-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1213,7 +1213,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1240,7 +1240,7 @@ } }, { - "id": "5-19-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1274,7 +1274,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1301,7 +1301,7 @@ } }, { - "id": "6-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -1335,7 +1335,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1360,7 +1360,7 @@ } }, { - "id": "7-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -1394,7 +1394,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1419,7 +1419,7 @@ } }, { - "id": "8-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 8, @@ -1453,7 +1453,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1478,7 +1478,7 @@ } }, { - "id": "9-23-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 9, @@ -1512,7 +1512,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1540,7 +1540,7 @@ } }, { - "id": "9-22-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 9, @@ -1574,7 +1574,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1602,7 +1602,7 @@ } }, { - "id": "10-25-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 10, @@ -1636,7 +1636,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1664,7 +1664,7 @@ } }, { - "id": "10-24-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 10, @@ -1698,7 +1698,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1726,7 +1726,7 @@ } }, { - "id": "11-27-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 11, @@ -1760,7 +1760,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1788,7 +1788,7 @@ } }, { - "id": "11-26-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 11, @@ -1822,7 +1822,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1850,7 +1850,7 @@ } }, { - "id": "12-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 12, @@ -1884,7 +1884,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1907,7 +1907,7 @@ } }, { - "id": "13-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 13, @@ -1941,7 +1941,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -1964,7 +1964,7 @@ } }, { - "id": "14-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 14, @@ -1998,7 +1998,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2021,7 +2021,7 @@ } }, { - "id": "15-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 15, @@ -2055,7 +2055,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2078,7 +2078,7 @@ } }, { - "id": "16-29-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2112,7 +2112,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2140,7 +2140,7 @@ } }, { - "id": "16-30-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2174,7 +2174,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2202,7 +2202,7 @@ } }, { - "id": "16-31-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2236,7 +2236,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2264,7 +2264,7 @@ } }, { - "id": "16-28-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2298,7 +2298,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2326,7 +2326,7 @@ } }, { - "id": "17-33-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2360,7 +2360,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2388,7 +2388,7 @@ } }, { - "id": "17-34-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2422,7 +2422,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2450,7 +2450,7 @@ } }, { - "id": "17-35-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2484,7 +2484,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2512,7 +2512,7 @@ } }, { - "id": "17-32-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2546,7 +2546,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2574,7 +2574,7 @@ } }, { - "id": "18-37-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2608,7 +2608,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2636,7 +2636,7 @@ } }, { - "id": "18-38-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2670,7 +2670,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2698,7 +2698,7 @@ } }, { - "id": "18-39-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2732,7 +2732,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2760,7 +2760,7 @@ } }, { - "id": "18-36-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2794,7 +2794,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", @@ -2822,7 +2822,7 @@ } }, { - "id": "19-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 19, @@ -2856,7 +2856,7 @@ "width": "0.000000", "height": "0.000000", "depth": "0.000000", - "additional_delivery_times": 1, + "additional_delivery_times": "1", "additional_shipping_cost": "0.000000", "delivery_in_stock": "", "delivery_out_stock": "", diff --git a/e2e/src/fixtures/8/apiInfo/shops.json b/e2e/src/fixtures/8/shops.json similarity index 72% rename from e2e/src/fixtures/8/apiInfo/shops.json rename to e2e/src/fixtures/8/shops.json index d6980752..8ee1c151 100644 --- a/e2e/src/fixtures/8/apiInfo/shops.json +++ b/e2e/src/fixtures/8/shops.json @@ -1,11 +1,11 @@ [ { - "id": "1", + "action": "upsert", "collection": "shops", "properties": { - "created_at": "2024-02-06 20:24:44", - "folder_created_at": "2024-02-09 16:24:55", - "cms_version": "8.1.3", + "created_at": "2024-08-22T12:27:09+0200", + "folder_created_at": "2024-08-27T10:07:19+0200", + "cms_version": "8.1.7", "url_is_simplified": true, "cart_is_persistent": false, "default_language": "en", @@ -19,8 +19,8 @@ "timezone": "Europe/Paris", "is_order_return_enabled": false, "order_return_nb_days": 14, - "php_version": "8.1.27", - "http_server": "nginx/1.24.0", + "php_version": "8.1.29", + "http_server": "nginx/1.26.2", "url": "http://localhost:8000/", "ssl": false, "multi_shop_count": 1, diff --git a/e2e/src/fixtures/8/apiSpecificPrices/specific_prices.json b/e2e/src/fixtures/8/specific_prices.json similarity index 96% rename from e2e/src/fixtures/8/apiSpecificPrices/specific_prices.json rename to e2e/src/fixtures/8/specific_prices.json index f179c309..222d03f4 100644 --- a/e2e/src/fixtures/8/apiSpecificPrices/specific_prices.json +++ b/e2e/src/fixtures/8/specific_prices.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 1, @@ -31,7 +31,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 2, diff --git a/e2e/src/fixtures/8/stock_movements.json b/e2e/src/fixtures/8/stock_movements.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/stock_movements.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiStocks/stocks.json b/e2e/src/fixtures/8/stocks.json similarity index 93% rename from e2e/src/fixtures/8/apiStocks/stocks.json rename to e2e/src/fixtures/8/stocks.json index b95df9a4..12efb5ae 100644 --- a/e2e/src/fixtures/8/apiStocks/stocks.json +++ b/e2e/src/fixtures/8/stocks.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 1, @@ -17,7 +17,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 2, @@ -34,7 +34,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 3, @@ -51,7 +51,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 4, @@ -68,7 +68,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 5, @@ -85,7 +85,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 6, @@ -102,7 +102,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 7, @@ -119,7 +119,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 8, @@ -136,7 +136,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 9, @@ -153,7 +153,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 10, @@ -170,7 +170,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 11, @@ -187,7 +187,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 12, @@ -204,7 +204,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 13, @@ -221,7 +221,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 14, @@ -238,7 +238,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 15, @@ -255,7 +255,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 16, @@ -272,7 +272,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 17, @@ -289,7 +289,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 18, @@ -306,7 +306,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 19, @@ -323,7 +323,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 20, @@ -340,7 +340,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 21, @@ -357,7 +357,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 22, @@ -374,7 +374,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 23, @@ -391,7 +391,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 24, @@ -408,7 +408,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 25, @@ -425,7 +425,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 26, @@ -442,7 +442,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 27, @@ -459,7 +459,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 28, @@ -476,7 +476,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 29, @@ -493,7 +493,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 30, @@ -510,7 +510,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 31, @@ -527,7 +527,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 32, @@ -544,7 +544,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 33, @@ -561,7 +561,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 34, @@ -578,7 +578,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 35, @@ -595,7 +595,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 36, @@ -612,7 +612,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 37, @@ -629,7 +629,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 38, @@ -646,7 +646,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 39, @@ -663,7 +663,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 40, @@ -680,7 +680,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 41, @@ -697,7 +697,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 42, @@ -714,7 +714,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 43, @@ -731,7 +731,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 44, @@ -748,7 +748,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 45, @@ -765,7 +765,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 46, @@ -782,7 +782,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 47, @@ -799,7 +799,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 48, @@ -816,7 +816,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 49, @@ -833,7 +833,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 50, @@ -850,7 +850,7 @@ } }, { - "id": 51, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 51, @@ -867,7 +867,7 @@ } }, { - "id": 52, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 52, @@ -884,7 +884,7 @@ } }, { - "id": 53, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 53, @@ -901,7 +901,7 @@ } }, { - "id": 54, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 54, @@ -918,7 +918,7 @@ } }, { - "id": 55, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 55, @@ -935,7 +935,7 @@ } }, { - "id": 56, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 56, @@ -952,7 +952,7 @@ } }, { - "id": 57, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 57, @@ -969,7 +969,7 @@ } }, { - "id": 58, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 58, diff --git a/e2e/src/fixtures/8/apiStores/stores.json b/e2e/src/fixtures/8/stores.json similarity index 96% rename from e2e/src/fixtures/8/apiStores/stores.json rename to e2e/src/fixtures/8/stores.json index 002bd9e8..15159b88 100644 --- a/e2e/src/fixtures/8/apiStores/stores.json +++ b/e2e/src/fixtures/8/stores.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stores", "properties": { "id_store": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stores", "properties": { "id_store": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stores", "properties": { "id_store": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stores", "properties": { "id_store": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stores", "properties": { "id_store": 5, diff --git a/e2e/src/fixtures/8/apiSuppliers/suppliers.json b/e2e/src/fixtures/8/suppliers.json similarity index 94% rename from e2e/src/fixtures/8/apiSuppliers/suppliers.json rename to e2e/src/fixtures/8/suppliers.json index 8475a828..8edfef88 100644 --- a/e2e/src/fixtures/8/apiSuppliers/suppliers.json +++ b/e2e/src/fixtures/8/suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 1, @@ -17,7 +17,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 2, diff --git a/e2e/src/fixtures/8/taxonomies.json b/e2e/src/fixtures/8/taxonomies.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/taxonomies.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiThemes/themes.json b/e2e/src/fixtures/8/themes.json similarity index 81% rename from e2e/src/fixtures/8/apiThemes/themes.json rename to e2e/src/fixtures/8/themes.json index be7189af..dd4040cb 100644 --- a/e2e/src/fixtures/8/apiThemes/themes.json +++ b/e2e/src/fixtures/8/themes.json @@ -1,6 +1,6 @@ [ { - "id": "f3d64714d1f6e7f71558d4252e84ab58", + "action": "upsert", "collection": "themes", "properties": { "theme_id": "f3d64714d1f6e7f71558d4252e84ab58", diff --git a/e2e/src/fixtures/8/translations.json b/e2e/src/fixtures/8/translations.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/translations.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/wishlist_products.json b/e2e/src/fixtures/8/wishlist_products.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/wishlist_products.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/wishlists.json b/e2e/src/fixtures/8/wishlists.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/8/wishlists.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiCarriers/carrier_details.json b/e2e/src/fixtures/9/apiCarriers/carrier_details.json deleted file mode 100644 index 531f022a..00000000 --- a/e2e/src/fixtures/9/apiCarriers/carrier_details.json +++ /dev/null @@ -1,226 +0,0 @@ -[ - { - "collection": "carrier_details", - "id": "3-2-range_price-2", - "properties": { - "id_reference": "3", - "id_zone": "2", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_price", - "delimiter1": 0, - "delimiter2": 50, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 4 - } - }, - { - "collection": "carrier_details", - "id": "3-1-range_price-2", - "properties": { - "id_reference": "3", - "id_zone": "1", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_price", - "delimiter1": 0, - "delimiter2": 50, - "country_ids": "FR", - "state_ids": "", - "price": 3 - } - }, - { - "collection": "carrier_details", - "id": "3-2-range_price-3", - "properties": { - "id_reference": "3", - "id_zone": "2", - "id_range": "3", - "id_carrier_detail": "3", - "shipping_method": "range_price", - "delimiter1": 50, - "delimiter2": 100, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 2 - } - }, - { - "collection": "carrier_details", - "id": "3-1-range_price-3", - "properties": { - "id_reference": "3", - "id_zone": "1", - "id_range": "3", - "id_carrier_detail": "3", - "shipping_method": "range_price", - "delimiter1": 50, - "delimiter2": 100, - "country_ids": "FR", - "state_ids": "", - "price": 1 - } - }, - { - "collection": "carrier_details", - "id": "3-1-range_price-4", - "properties": { - "id_reference": "3", - "id_zone": "1", - "id_range": "4", - "id_carrier_detail": "4", - "shipping_method": "range_price", - "delimiter1": 100, - "delimiter2": 200, - "country_ids": "FR", - "state_ids": "", - "price": 0 - } - }, - { - "collection": "carrier_details", - "id": "3-2-range_price-4", - "properties": { - "id_reference": "3", - "id_zone": "2", - "id_range": "4", - "id_carrier_detail": "4", - "shipping_method": "range_price", - "delimiter1": 100, - "delimiter2": 200, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 0 - } - }, - { - "collection": "carrier_details", - "id": "4-2-range_weight-2", - "properties": { - "id_reference": "4", - "id_zone": "2", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 1, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 0 - } - }, - { - "collection": "carrier_details", - "id": "4-1-range_weight-2", - "properties": { - "id_reference": "4", - "id_zone": "1", - "id_range": "2", - "id_carrier_detail": "2", - "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 1, - "country_ids": "FR", - "state_ids": "", - "price": 0 - } - }, - { - "collection": "carrier_details", - "id": "4-2-range_weight-3", - "properties": { - "id_reference": "4", - "id_zone": "2", - "id_range": "3", - "id_carrier_detail": "3", - "shipping_method": "range_weight", - "delimiter1": 1, - "delimiter2": 3, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 3 - } - }, - { - "collection": "carrier_details", - "id": "4-1-range_weight-3", - "properties": { - "id_reference": "4", - "id_zone": "1", - "id_range": "3", - "id_carrier_detail": "3", - "shipping_method": "range_weight", - "delimiter1": 1, - "delimiter2": 3, - "country_ids": "FR", - "state_ids": "", - "price": 2 - } - }, - { - "collection": "carrier_details", - "id": "4-1-range_weight-4", - "properties": { - "id_reference": "4", - "id_zone": "1", - "id_range": "4", - "id_carrier_detail": "4", - "shipping_method": "range_weight", - "delimiter1": 3, - "delimiter2": 10000, - "country_ids": "FR", - "state_ids": "", - "price": 5 - } - }, - { - "collection": "carrier_details", - "id": "4-2-range_weight-4", - "properties": { - "id_reference": "4", - "id_zone": "2", - "id_range": "4", - "id_carrier_detail": "4", - "shipping_method": "range_weight", - "delimiter1": 3, - "delimiter2": 10000, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 6 - } - }, - { - "collection": "carrier_details", - "id": "2-1-range_weight-1", - "properties": { - "id_reference": "2", - "id_zone": "1", - "id_range": "1", - "id_carrier_detail": "1", - "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 10000, - "country_ids": "FR", - "state_ids": "", - "price": 5 - } - }, - { - "collection": "carrier_details", - "id": "2-2-range_weight-1", - "properties": { - "id_reference": "2", - "id_zone": "2", - "id_range": "1", - "id_carrier_detail": "1", - "shipping_method": "range_weight", - "delimiter1": 0, - "delimiter2": 10000, - "country_ids": "US", - "state_ids": "AA,AE,AP,AL,AK,AZ,AR,CA,CO,CT,DE,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,PR,VI,DC", - "price": 5 - } - } -] diff --git a/e2e/src/fixtures/9/apiProducts/bundles.json b/e2e/src/fixtures/9/apiProducts/bundles.json deleted file mode 100644 index 7438d673..00000000 --- a/e2e/src/fixtures/9/apiProducts/bundles.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "id": 15, - "collection": "bundles", - "properties": { - "id_bundle": 15, - "id_product": 5, - "id_product_attribute": 19, - "unique_product_id": "15-0-en", - "quantity": 5 - } - }, - { - "id": 15, - "collection": "bundles", - "properties": { - "id_bundle": 15, - "id_product": 7, - "id_product_attribute": 0, - "unique_product_id": "15-0-en", - "quantity": 5 - } - } -] diff --git a/e2e/src/fixtures/9/attributes.json b/e2e/src/fixtures/9/attributes.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/attributes.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiProducts/bundles.json b/e2e/src/fixtures/9/bundles.json similarity index 89% rename from e2e/src/fixtures/8/apiProducts/bundles.json rename to e2e/src/fixtures/9/bundles.json index 7438d673..4ac3d9ad 100644 --- a/e2e/src/fixtures/8/apiProducts/bundles.json +++ b/e2e/src/fixtures/9/bundles.json @@ -1,6 +1,6 @@ [ { - "id": 15, + "action": "upsert", "collection": "bundles", "properties": { "id_bundle": 15, @@ -11,7 +11,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "bundles", "properties": { "id_bundle": 15, diff --git a/e2e/src/fixtures/9/carrier_details.json b/e2e/src/fixtures/9/carrier_details.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/carrier_details.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/carrier_taxes.json b/e2e/src/fixtures/9/carrier_taxes.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/carrier_taxes.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiCarriers/carriers.json b/e2e/src/fixtures/9/carriers.json similarity index 96% rename from e2e/src/fixtures/8/apiCarriers/carriers.json rename to e2e/src/fixtures/9/carriers.json index 0caae8c7..5205b166 100644 --- a/e2e/src/fixtures/8/apiCarriers/carriers.json +++ b/e2e/src/fixtures/9/carriers.json @@ -1,21 +1,17 @@ [ { + "action": "upsert", "collection": "carriers", - "id": "3", "properties": { - "id_carrier": "3", - "id_reference": "3", - "name": "My cheap carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "1", + "id_reference": "1", + "name": "Click and collect", "url": "", - "active": false, + "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, - "is_free": false, + "is_free": true, "shipping_external": false, "need_range": false, "external_module_name": "", @@ -24,25 +20,25 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Buy more to pay less!", + "delay": "Pick up in-store", + "shipping_handling": 0, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "4", "properties": { - "id_carrier": "4", - "id_reference": "4", - "name": "My light carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "2", + "id_reference": "2", + "name": "My carrier", "url": "", - "active": false, + "active": true, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -54,28 +50,28 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "The lighter the cheaper!", + "delay": "Delivery next day!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "1", "properties": { - "id_carrier": "1", - "id_reference": "1", - "name": "Click and collect", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "3", + "id_reference": "3", + "name": "My cheap carrier", "url": "", - "active": true, + "active": false, "deleted": false, - "shipping_handling": 0, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, - "is_free": true, + "is_free": false, "shipping_external": false, "need_range": false, "external_module_name": "", @@ -84,25 +80,25 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Pick up in-store", + "delay": "Buy more to pay less!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } }, { + "action": "upsert", "collection": "carriers", - "id": "2", "properties": { - "id_carrier": "2", - "id_reference": "2", - "name": "My carrier", - "carrier_taxes_rates_group_id": "1", + "id_carrier": "4", + "id_reference": "4", + "name": "My light carrier", "url": "", - "active": true, + "active": false, "deleted": false, - "shipping_handling": 2, - "free_shipping_starts_at_price": 0, - "free_shipping_starts_at_weight": 0, "disable_carrier_when_out_of_range": false, "is_module": false, "is_free": false, @@ -114,7 +110,11 @@ "max_depth": 0, "max_weight": 0, "grade": 0, - "delay": "Delivery next day!", + "delay": "The lighter the cheaper!", + "shipping_handling": 2, + "carrier_taxes_rates_group_id": "1", + "free_shipping_starts_at_price": 0, + "free_shipping_starts_at_weight": 0, "currency": "EUR", "weight_unit": "kg" } diff --git a/e2e/src/fixtures/1.7/apiCarts/cart_products.json b/e2e/src/fixtures/9/cart_products.json similarity index 90% rename from e2e/src/fixtures/1.7/apiCarts/cart_products.json rename to e2e/src/fixtures/9/cart_products.json index c4af221f..2d245056 100644 --- a/e2e/src/fixtures/1.7/apiCarts/cart_products.json +++ b/e2e/src/fixtures/9/cart_products.json @@ -1,6 +1,6 @@ [ { - "id": "1-1-1", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -12,7 +12,7 @@ } }, { - "id": "1-2-9", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "1", @@ -24,7 +24,7 @@ } }, { - "id": "2-4-18", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -36,7 +36,7 @@ } }, { - "id": "2-8-0", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "2", @@ -48,7 +48,7 @@ } }, { - "id": "3-16-28", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "3", @@ -60,7 +60,7 @@ } }, { - "id": "4-16-29", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "4", @@ -72,7 +72,7 @@ } }, { - "id": "5-10-25", + "action": "upsert", "collection": "cart_products", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/9/cart_rules.json b/e2e/src/fixtures/9/cart_rules.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/cart_rules.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiCarts/carts.json b/e2e/src/fixtures/9/carts.json similarity index 88% rename from e2e/src/fixtures/9/apiCarts/carts.json rename to e2e/src/fixtures/9/carts.json index 8f45075d..6e68aab8 100644 --- a/e2e/src/fixtures/9/apiCarts/carts.json +++ b/e2e/src/fixtures/9/carts.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "1", @@ -9,7 +9,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "2", @@ -18,7 +18,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "3", @@ -27,7 +27,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "4", @@ -36,7 +36,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "carts", "properties": { "id_cart": "5", diff --git a/e2e/src/fixtures/9/apiCategories/categories.json b/e2e/src/fixtures/9/categories.json similarity index 92% rename from e2e/src/fixtures/9/apiCategories/categories.json rename to e2e/src/fixtures/9/categories.json index 00ad9528..91c81ce5 100644 --- a/e2e/src/fixtures/9/apiCategories/categories.json +++ b/e2e/src/fixtures/9/categories.json @@ -1,6 +1,6 @@ [ { - "id": "1-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "1-en", @@ -10,7 +10,6 @@ "description": "", "link_rewrite": "root", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:21+0200", @@ -18,7 +17,7 @@ } }, { - "id": "2-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "2-en", @@ -28,7 +27,6 @@ "description": "", "link_rewrite": "home", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:21+0200", @@ -36,7 +34,7 @@ } }, { - "id": "3-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "3-en", @@ -46,7 +44,6 @@ "description": "PHA+RGlzY292ZXIgb3VyIGZhdm9yaXRlcyBmYXNoaW9uYWJsZSBkaXNjb3ZlcmllcywgYSBzZWxlY3Rpb24gb2YgY29vbCBpdGVtcyB0byBpbnRlZ3JhdGUgaW4geW91ciB3YXJkcm9iZS4gQ29tcG9zZSBhIHVuaXF1ZSBzdHlsZSB3aXRoIHBlcnNvbmFsaXR5IHdoaWNoIG1hdGNoZXMgeW91ciBvd24uPC9wPg==", "link_rewrite": "clothes", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", @@ -54,7 +51,7 @@ } }, { - "id": "4-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "4-en", @@ -64,7 +61,6 @@ "description": "PHA+VC1zaGlydHMsIHN3ZWF0ZXJzLCBob29kaWVzIGFuZCBtZW4ncyBhY2Nlc3Nvcmllcy4gRnJvbSBiYXNpY3MgdG8gb3JpZ2luYWwgY3JlYXRpb25zLCBmb3IgZXZlcnkgc3R5bGUuIDwvcD4=", "link_rewrite": "men", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", @@ -72,7 +68,7 @@ } }, { - "id": "5-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "5-en", @@ -82,7 +78,6 @@ "description": "PHA+VC1zaGlydHMsIHN3ZWF0ZXJzLCBob29kaWVzIGFuZCB3b21lbidzIGFjY2Vzc29yaWVzLiBGcm9tIGJhc2ljcyB0byBvcmlnaW5hbCBjcmVhdGlvbnMsIGZvciBldmVyeSBzdHlsZS4gPC9wPg==", "link_rewrite": "women", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", @@ -90,7 +85,7 @@ } }, { - "id": "6-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "6-en", @@ -100,7 +95,6 @@ "description": "PHA+SXRlbXMgYW5kIGFjY2Vzc29yaWVzIGZvciB5b3VyIGRlc2ssIGtpdGNoZW4gb3IgbGl2aW5nIHJvb20uIE1ha2UgeW91ciBob3VzZSBhIGhvbWUgd2l0aCBvdXIgZXllLWNhdGNoaW5nIGRlc2lnbnMuIDwvcD4=", "link_rewrite": "accessories", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", @@ -108,7 +102,7 @@ } }, { - "id": "7-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "7-en", @@ -118,7 +112,6 @@ "description": "PHA+Tm90ZWJvb2tzLCBhZ2VuZGFzLCBvZmZpY2UgYWNjZXNzb3JpZXMgYW5kIG1vcmUuIEV2ZXJ5dGhpbmcgeW91IG5lZWQgdG8gY29tYmluZSB0aGUgcGxlYXNhbnQgYW5kIHRoZSB1c2VmdWwsIGVpdGhlciBhdCB3b3JrIG9yIGF0IGhvbWUuIDwvcD4=", "link_rewrite": "stationery", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", @@ -126,7 +119,7 @@ } }, { - "id": "8-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "8-en", @@ -136,7 +129,6 @@ "description": "PHA+RGV0YWlscyBtYXR0ZXIhIExpdmVuIHVwIHlvdXIgaW50ZXJpb3Igd2l0aCBvdXIgc2VsZWN0aW9uIG9mIGhvbWUgYWNjZXNzb3JpZXMuIDwvcD4=", "link_rewrite": "home-accessories", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", @@ -144,7 +136,7 @@ } }, { - "id": "9-en", + "action": "upsert", "collection": "categories", "properties": { "unique_category_id": "9-en", @@ -154,7 +146,6 @@ "description": "PHA+RnJhbWVkIHBvc3RlciBhbmQgdmVjdG9yIGltYWdlcywgYWxsIHlvdSBuZWVkIHRvIGdpdmUgcGVyc29uYWxpdHkgdG8geW91ciB3YWxscyBvciBicmluZyB5b3VyIGNyZWF0aXZlIHByb2plY3RzIHRvIGxpZmUuPC9wPg==", "link_rewrite": "art", "meta_title": "", - "meta_keywords": "", "meta_description": "", "iso_code": "en", "created_at": "2024-06-10T02:27:30+0200", diff --git a/e2e/src/fixtures/9/apiCurrencies/currencies.json b/e2e/src/fixtures/9/currencies.json similarity index 90% rename from e2e/src/fixtures/9/apiCurrencies/currencies.json rename to e2e/src/fixtures/9/currencies.json index 3e192200..7c488699 100644 --- a/e2e/src/fixtures/9/apiCurrencies/currencies.json +++ b/e2e/src/fixtures/9/currencies.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "currencies", "properties": { "id_currency": 2, diff --git a/e2e/src/fixtures/9/custom_product_carriers.json b/e2e/src/fixtures/9/custom_product_carriers.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/custom_product_carriers.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiCustomers/customers.json b/e2e/src/fixtures/9/customers.json similarity index 95% rename from e2e/src/fixtures/9/apiCustomers/customers.json rename to e2e/src/fixtures/9/customers.json index 35648e61..a137a525 100644 --- a/e2e/src/fixtures/9/apiCustomers/customers.json +++ b/e2e/src/fixtures/9/customers.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 1, @@ -17,7 +17,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "customers", "properties": { "id_customer": 2, diff --git a/e2e/src/fixtures/9/apiEmployees/employees.json b/e2e/src/fixtures/9/employees.json similarity index 96% rename from e2e/src/fixtures/9/apiEmployees/employees.json rename to e2e/src/fixtures/9/employees.json index b31c2177..07be19f2 100644 --- a/e2e/src/fixtures/9/apiEmployees/employees.json +++ b/e2e/src/fixtures/9/employees.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "employees", "properties": { "id_employee": 1, diff --git a/e2e/src/fixtures/9/apiImageTypes/image_types.json b/e2e/src/fixtures/9/image_types.json similarity index 92% rename from e2e/src/fixtures/9/apiImageTypes/image_types.json rename to e2e/src/fixtures/9/image_types.json index b8cbf800..7d0cba7f 100644 --- a/e2e/src/fixtures/9/apiImageTypes/image_types.json +++ b/e2e/src/fixtures/9/image_types.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 1, @@ -15,7 +15,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 2, @@ -30,7 +30,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 3, @@ -45,7 +45,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 4, @@ -60,7 +60,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 5, @@ -75,7 +75,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 6, @@ -90,7 +90,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "image_types", "properties": { "id_image_type": 7, diff --git a/e2e/src/fixtures/1.7/apiImages/images.json b/e2e/src/fixtures/9/images.json similarity index 90% rename from e2e/src/fixtures/1.7/apiImages/images.json rename to e2e/src/fixtures/9/images.json index 9927ccb0..8dea38a2 100644 --- a/e2e/src/fixtures/1.7/apiImages/images.json +++ b/e2e/src/fixtures/9/images.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "images", "properties": { "id_image": 1, @@ -13,7 +13,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "images", "properties": { "id_image": 2, @@ -26,7 +26,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "images", "properties": { "id_image": 3, @@ -39,7 +39,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "images", "properties": { "id_image": 4, @@ -52,7 +52,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "images", "properties": { "id_image": 5, @@ -65,7 +65,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "images", "properties": { "id_image": 6, @@ -78,7 +78,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "images", "properties": { "id_image": 7, @@ -91,7 +91,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "images", "properties": { "id_image": 8, @@ -104,7 +104,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "images", "properties": { "id_image": 9, @@ -117,7 +117,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "images", "properties": { "id_image": 10, @@ -130,7 +130,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "images", "properties": { "id_image": 11, @@ -143,7 +143,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "images", "properties": { "id_image": 12, @@ -156,7 +156,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "images", "properties": { "id_image": 13, @@ -169,7 +169,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "images", "properties": { "id_image": 14, @@ -182,7 +182,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "images", "properties": { "id_image": 15, @@ -195,7 +195,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "images", "properties": { "id_image": 16, @@ -208,7 +208,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "images", "properties": { "id_image": 17, @@ -221,7 +221,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "images", "properties": { "id_image": 18, @@ -234,7 +234,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "images", "properties": { "id_image": 19, @@ -247,7 +247,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "images", "properties": { "id_image": 20, @@ -260,7 +260,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "images", "properties": { "id_image": 21, @@ -273,7 +273,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "images", "properties": { "id_image": 22, @@ -286,7 +286,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "images", "properties": { "id_image": 23, diff --git a/e2e/src/fixtures/1.7/apiLanguages/languages.json b/e2e/src/fixtures/9/languages.json similarity index 93% rename from e2e/src/fixtures/1.7/apiLanguages/languages.json rename to e2e/src/fixtures/9/languages.json index 8c0b6eb5..7f08db6e 100644 --- a/e2e/src/fixtures/1.7/apiLanguages/languages.json +++ b/e2e/src/fixtures/9/languages.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "languages", "properties": { "id_lang": 1, diff --git a/e2e/src/fixtures/9/apiManufacturers/manufacturers.json b/e2e/src/fixtures/9/manufacturers.json similarity index 93% rename from e2e/src/fixtures/9/apiManufacturers/manufacturers.json rename to e2e/src/fixtures/9/manufacturers.json index 226c8d67..53f052c3 100644 --- a/e2e/src/fixtures/9/apiManufacturers/manufacturers.json +++ b/e2e/src/fixtures/9/manufacturers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 1, @@ -12,13 +12,12 @@ "description": "

Studio Design offers a range of items from ready-to-wear collections to contemporary objects. The brand has been presenting new ideas and trends since its creation in 2012.

", "short_description": "", "meta_title": "", - "meta_keywords": "", "meta_description": "", "id_shop": 1 } }, { - "id": 2, + "action": "upsert", "collection": "manufacturers", "properties": { "id_manufacturer": 2, @@ -30,7 +29,6 @@ "description": "

Since 2010, Graphic Corner offers a large choice of quality posters, available on paper and many other formats.

", "short_description": "", "meta_title": "", - "meta_keywords": "", "meta_description": "", "id_shop": 1 } diff --git a/e2e/src/fixtures/9/apiModules/modules.json b/e2e/src/fixtures/9/modules.json similarity index 91% rename from e2e/src/fixtures/9/apiModules/modules.json rename to e2e/src/fixtures/9/modules.json index 4175cc83..e7b724d4 100644 --- a/e2e/src/fixtures/9/apiModules/modules.json +++ b/e2e/src/fixtures/9/modules.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "modules", "properties": { "module_id": "1", @@ -12,7 +12,7 @@ } }, { - "id": "2", + "action": "upsert", "collection": "modules", "properties": { "module_id": "2", @@ -24,7 +24,7 @@ } }, { - "id": "3", + "action": "upsert", "collection": "modules", "properties": { "module_id": "3", @@ -36,7 +36,7 @@ } }, { - "id": "4", + "action": "upsert", "collection": "modules", "properties": { "module_id": "4", @@ -48,7 +48,7 @@ } }, { - "id": "5", + "action": "upsert", "collection": "modules", "properties": { "module_id": "5", @@ -60,7 +60,7 @@ } }, { - "id": "6", + "action": "upsert", "collection": "modules", "properties": { "module_id": "6", @@ -72,7 +72,7 @@ } }, { - "id": "7", + "action": "upsert", "collection": "modules", "properties": { "module_id": "7", @@ -84,7 +84,7 @@ } }, { - "id": "8", + "action": "upsert", "collection": "modules", "properties": { "module_id": "8", @@ -96,7 +96,7 @@ } }, { - "id": "9", + "action": "upsert", "collection": "modules", "properties": { "module_id": "9", @@ -108,7 +108,7 @@ } }, { - "id": "10", + "action": "upsert", "collection": "modules", "properties": { "module_id": "10", @@ -120,7 +120,7 @@ } }, { - "id": "11", + "action": "upsert", "collection": "modules", "properties": { "module_id": "11", @@ -132,7 +132,7 @@ } }, { - "id": "12", + "action": "upsert", "collection": "modules", "properties": { "module_id": "12", @@ -144,7 +144,7 @@ } }, { - "id": "13", + "action": "upsert", "collection": "modules", "properties": { "module_id": "13", @@ -156,7 +156,7 @@ } }, { - "id": "14", + "action": "upsert", "collection": "modules", "properties": { "module_id": "14", @@ -168,7 +168,7 @@ } }, { - "id": "15", + "action": "upsert", "collection": "modules", "properties": { "module_id": "15", @@ -180,7 +180,7 @@ } }, { - "id": "16", + "action": "upsert", "collection": "modules", "properties": { "module_id": "16", @@ -192,7 +192,7 @@ } }, { - "id": "17", + "action": "upsert", "collection": "modules", "properties": { "module_id": "17", @@ -204,7 +204,7 @@ } }, { - "id": "18", + "action": "upsert", "collection": "modules", "properties": { "module_id": "18", @@ -216,7 +216,7 @@ } }, { - "id": "19", + "action": "upsert", "collection": "modules", "properties": { "module_id": "19", @@ -228,7 +228,7 @@ } }, { - "id": "20", + "action": "upsert", "collection": "modules", "properties": { "module_id": "20", @@ -240,7 +240,7 @@ } }, { - "id": "21", + "action": "upsert", "collection": "modules", "properties": { "module_id": "21", @@ -252,7 +252,7 @@ } }, { - "id": "22", + "action": "upsert", "collection": "modules", "properties": { "module_id": "22", @@ -264,7 +264,7 @@ } }, { - "id": "23", + "action": "upsert", "collection": "modules", "properties": { "module_id": "23", @@ -276,7 +276,7 @@ } }, { - "id": "25", + "action": "upsert", "collection": "modules", "properties": { "module_id": "25", @@ -288,7 +288,7 @@ } }, { - "id": "26", + "action": "upsert", "collection": "modules", "properties": { "module_id": "26", @@ -300,7 +300,7 @@ } }, { - "id": "27", + "action": "upsert", "collection": "modules", "properties": { "module_id": "27", @@ -312,7 +312,7 @@ } }, { - "id": "28", + "action": "upsert", "collection": "modules", "properties": { "module_id": "28", @@ -324,7 +324,7 @@ } }, { - "id": "29", + "action": "upsert", "collection": "modules", "properties": { "module_id": "29", @@ -336,7 +336,7 @@ } }, { - "id": "30", + "action": "upsert", "collection": "modules", "properties": { "module_id": "30", @@ -348,7 +348,7 @@ } }, { - "id": "31", + "action": "upsert", "collection": "modules", "properties": { "module_id": "31", @@ -360,7 +360,7 @@ } }, { - "id": "32", + "action": "upsert", "collection": "modules", "properties": { "module_id": "32", @@ -372,7 +372,7 @@ } }, { - "id": "33", + "action": "upsert", "collection": "modules", "properties": { "module_id": "33", @@ -384,7 +384,7 @@ } }, { - "id": "34", + "action": "upsert", "collection": "modules", "properties": { "module_id": "34", @@ -396,7 +396,7 @@ } }, { - "id": "35", + "action": "upsert", "collection": "modules", "properties": { "module_id": "35", @@ -408,7 +408,7 @@ } }, { - "id": "36", + "action": "upsert", "collection": "modules", "properties": { "module_id": "36", @@ -420,7 +420,7 @@ } }, { - "id": "37", + "action": "upsert", "collection": "modules", "properties": { "module_id": "37", @@ -432,7 +432,7 @@ } }, { - "id": "38", + "action": "upsert", "collection": "modules", "properties": { "module_id": "38", @@ -444,7 +444,7 @@ } }, { - "id": "39", + "action": "upsert", "collection": "modules", "properties": { "module_id": "39", @@ -456,7 +456,7 @@ } }, { - "id": "40", + "action": "upsert", "collection": "modules", "properties": { "module_id": "40", @@ -468,7 +468,7 @@ } }, { - "id": "41", + "action": "upsert", "collection": "modules", "properties": { "module_id": "41", @@ -480,7 +480,7 @@ } }, { - "id": "42", + "action": "upsert", "collection": "modules", "properties": { "module_id": "42", @@ -492,7 +492,7 @@ } }, { - "id": "43", + "action": "upsert", "collection": "modules", "properties": { "module_id": "43", @@ -504,7 +504,7 @@ } }, { - "id": "44", + "action": "upsert", "collection": "modules", "properties": { "module_id": "44", @@ -516,7 +516,7 @@ } }, { - "id": "45", + "action": "upsert", "collection": "modules", "properties": { "module_id": "45", @@ -528,7 +528,7 @@ } }, { - "id": "46", + "action": "upsert", "collection": "modules", "properties": { "module_id": "46", @@ -540,7 +540,7 @@ } }, { - "id": "47", + "action": "upsert", "collection": "modules", "properties": { "module_id": "47", @@ -552,7 +552,7 @@ } }, { - "id": "48", + "action": "upsert", "collection": "modules", "properties": { "module_id": "48", @@ -564,7 +564,7 @@ } }, { - "id": "49", + "action": "upsert", "collection": "modules", "properties": { "module_id": "49", @@ -576,7 +576,7 @@ } }, { - "id": "50", + "action": "upsert", "collection": "modules", "properties": { "module_id": "50", @@ -588,7 +588,7 @@ } }, { - "id": "51", + "action": "upsert", "collection": "modules", "properties": { "module_id": "51", @@ -600,7 +600,7 @@ } }, { - "id": "52", + "action": "upsert", "collection": "modules", "properties": { "module_id": "52", @@ -612,7 +612,7 @@ } }, { - "id": "53", + "action": "upsert", "collection": "modules", "properties": { "module_id": "53", @@ -624,7 +624,7 @@ } }, { - "id": "54", + "action": "upsert", "collection": "modules", "properties": { "module_id": "54", @@ -636,7 +636,7 @@ } }, { - "id": "55", + "action": "upsert", "collection": "modules", "properties": { "module_id": "55", @@ -648,7 +648,7 @@ } }, { - "id": "56", + "action": "upsert", "collection": "modules", "properties": { "module_id": "56", @@ -660,7 +660,7 @@ } }, { - "id": "57", + "action": "upsert", "collection": "modules", "properties": { "module_id": "57", @@ -672,7 +672,7 @@ } }, { - "id": "58", + "action": "upsert", "collection": "modules", "properties": { "module_id": "58", @@ -684,7 +684,7 @@ } }, { - "id": "59", + "action": "upsert", "collection": "modules", "properties": { "module_id": "59", @@ -696,7 +696,7 @@ } }, { - "id": "60", + "action": "upsert", "collection": "modules", "properties": { "module_id": "60", @@ -708,7 +708,7 @@ } }, { - "id": "61", + "action": "upsert", "collection": "modules", "properties": { "module_id": "61", @@ -720,7 +720,7 @@ } }, { - "id": "62", + "action": "upsert", "collection": "modules", "properties": { "module_id": "62", @@ -732,7 +732,7 @@ } }, { - "id": "63", + "action": "upsert", "collection": "modules", "properties": { "module_id": "63", @@ -744,7 +744,7 @@ } }, { - "id": "64", + "action": "upsert", "collection": "modules", "properties": { "module_id": "64", @@ -756,7 +756,7 @@ } }, { - "id": "65", + "action": "upsert", "collection": "modules", "properties": { "module_id": "65", @@ -768,7 +768,7 @@ } }, { - "id": "66", + "action": "upsert", "collection": "modules", "properties": { "module_id": "66", @@ -780,7 +780,7 @@ } }, { - "id": "67", + "action": "upsert", "collection": "modules", "properties": { "module_id": "67", @@ -792,7 +792,7 @@ } }, { - "id": "68", + "action": "upsert", "collection": "modules", "properties": { "module_id": "68", @@ -804,7 +804,7 @@ } }, { - "id": "69", + "action": "upsert", "collection": "modules", "properties": { "module_id": "69", @@ -816,7 +816,7 @@ } }, { - "id": "70", + "action": "upsert", "collection": "modules", "properties": { "module_id": "70", diff --git a/e2e/src/fixtures/9/order_cart_rules.json b/e2e/src/fixtures/9/order_cart_rules.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/order_cart_rules.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/8/apiOrders/order_details.json b/e2e/src/fixtures/9/order_details.json similarity index 95% rename from e2e/src/fixtures/8/apiOrders/order_details.json rename to e2e/src/fixtures/9/order_details.json index 9f313260..36a44a9b 100644 --- a/e2e/src/fixtures/8/apiOrders/order_details.json +++ b/e2e/src/fixtures/9/order_details.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 5, @@ -100,7 +100,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 6, @@ -120,7 +120,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_details", "properties": { "id_order_detail": 7, diff --git a/e2e/src/fixtures/9/apiOrders/order_status_history.json b/e2e/src/fixtures/9/order_status_history.json similarity index 95% rename from e2e/src/fixtures/9/apiOrders/order_status_history.json rename to e2e/src/fixtures/9/order_status_history.json index 05868d4b..c0257455 100644 --- a/e2e/src/fixtures/9/apiOrders/order_status_history.json +++ b/e2e/src/fixtures/9/order_status_history.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -19,7 +19,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -38,7 +38,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -57,7 +57,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 1, @@ -76,7 +76,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 10, @@ -95,7 +95,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 6, @@ -114,7 +114,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "order_status_history", "properties": { "id_order_state": 8, diff --git a/e2e/src/fixtures/9/apiOrders/orders.json b/e2e/src/fixtures/9/orders.json similarity index 95% rename from e2e/src/fixtures/9/apiOrders/orders.json rename to e2e/src/fixtures/9/orders.json index c8400ea5..155414fb 100644 --- a/e2e/src/fixtures/9/apiOrders/orders.json +++ b/e2e/src/fixtures/9/orders.json @@ -1,12 +1,12 @@ [ { - "id": 1, + "action": "upsert", "collection": "orders", "properties": { "id_order": 1, "reference": "XKBKNABJK", "id_customer": 2, - "id_cart": 1, + "id_cart": "1", "current_state": 6, "conversion_rate": 1, "total_paid_tax_excl": 66.8, @@ -33,13 +33,13 @@ } }, { - "id": 2, + "action": "upsert", "collection": "orders", "properties": { "id_order": 2, "reference": "OHSATSERP", "id_customer": 2, - "id_cart": 2, + "id_cart": "2", "current_state": 1, "conversion_rate": 1, "total_paid_tax_excl": 169.9, @@ -66,13 +66,13 @@ } }, { - "id": 3, + "action": "upsert", "collection": "orders", "properties": { "id_order": 3, "reference": "UOYEVOLI", "id_customer": 2, - "id_cart": 3, + "id_cart": "3", "current_state": 8, "conversion_rate": 1, "total_paid_tax_excl": 19.9, @@ -99,13 +99,13 @@ } }, { - "id": 4, + "action": "upsert", "collection": "orders", "properties": { "id_order": 4, "reference": "FFATNOMMJ", "id_customer": 2, - "id_cart": 4, + "id_cart": "4", "current_state": 1, "conversion_rate": 1, "total_paid_tax_excl": 19.9, @@ -132,13 +132,13 @@ } }, { - "id": 5, + "action": "upsert", "collection": "orders", "properties": { "id_order": 5, "reference": "KHWLILZLL", "id_customer": 2, - "id_cart": 5, + "id_cart": "5", "current_state": 10, "conversion_rate": 1, "total_paid_tax_excl": 25.9, diff --git a/e2e/src/fixtures/9/apiProducts/product_suppliers.json b/e2e/src/fixtures/9/product_suppliers.json similarity index 63% rename from e2e/src/fixtures/9/apiProducts/product_suppliers.json rename to e2e/src/fixtures/9/product_suppliers.json index 4ac63997..72ee278d 100644 --- a/e2e/src/fixtures/9/apiProducts/product_suppliers.json +++ b/e2e/src/fixtures/9/product_suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 1, @@ -13,7 +13,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 2, @@ -26,7 +26,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 3, @@ -39,7 +39,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 4, @@ -52,7 +52,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 5, @@ -65,7 +65,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 6, @@ -78,7 +78,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 7, @@ -91,7 +91,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 8, @@ -104,7 +104,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 9, @@ -117,7 +117,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 10, @@ -130,7 +130,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 11, @@ -143,7 +143,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 12, @@ -156,7 +156,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 13, @@ -169,7 +169,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 14, @@ -182,7 +182,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 15, @@ -195,7 +195,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 16, @@ -208,7 +208,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 17, @@ -221,7 +221,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 18, @@ -234,7 +234,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 19, @@ -247,7 +247,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 20, @@ -260,7 +260,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 21, @@ -273,7 +273,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 22, @@ -286,7 +286,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 23, @@ -299,7 +299,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 24, @@ -312,7 +312,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 25, @@ -325,7 +325,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 26, @@ -338,7 +338,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 27, @@ -351,7 +351,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 28, @@ -364,7 +364,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 29, @@ -377,7 +377,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 30, @@ -390,7 +390,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 31, @@ -403,7 +403,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 32, @@ -416,7 +416,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 33, @@ -429,7 +429,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 34, @@ -442,7 +442,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 35, @@ -455,7 +455,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 36, @@ -468,7 +468,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 37, @@ -481,7 +481,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 38, @@ -494,7 +494,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 39, @@ -507,7 +507,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 40, @@ -520,7 +520,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 41, @@ -533,7 +533,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 42, @@ -546,7 +546,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 43, @@ -559,7 +559,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 44, @@ -572,7 +572,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 45, @@ -585,7 +585,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 46, @@ -598,7 +598,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 47, @@ -611,7 +611,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 48, @@ -624,7 +624,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 49, @@ -637,7 +637,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "product_suppliers", "properties": { "id_product_supplier": 50, @@ -648,5 +648,304 @@ "product_supplier_price_te": 5.49, "id_currency": 1 } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 51, + "id_product": 9, + "id_product_attribute": 23, + "id_supplier": 2, + "product_supplier_reference": "demo_15_80", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 52, + "id_product": 10, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_16_81", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 53, + "id_product": 10, + "id_product_attribute": 24, + "id_supplier": 2, + "product_supplier_reference": "demo_16_81", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 54, + "id_product": 10, + "id_product_attribute": 25, + "id_supplier": 2, + "product_supplier_reference": "demo_16_82", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 55, + "id_product": 11, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_17_83", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 56, + "id_product": 11, + "id_product_attribute": 26, + "id_supplier": 2, + "product_supplier_reference": "demo_17_83", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 57, + "id_product": 11, + "id_product_attribute": 27, + "id_supplier": 2, + "product_supplier_reference": "demo_17_84", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 58, + "id_product": 16, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_8_85", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 59, + "id_product": 16, + "id_product_attribute": 28, + "id_supplier": 2, + "product_supplier_reference": "demo_8_85", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 60, + "id_product": 16, + "id_product_attribute": 29, + "id_supplier": 2, + "product_supplier_reference": "demo_8_86", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 61, + "id_product": 16, + "id_product_attribute": 30, + "id_supplier": 2, + "product_supplier_reference": "demo_8_87", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 62, + "id_product": 16, + "id_product_attribute": 31, + "id_supplier": 2, + "product_supplier_reference": "demo_8_88", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 63, + "id_product": 17, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_9_89", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 64, + "id_product": 17, + "id_product_attribute": 32, + "id_supplier": 2, + "product_supplier_reference": "demo_9_89", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 65, + "id_product": 17, + "id_product_attribute": 33, + "id_supplier": 2, + "product_supplier_reference": "demo_9_90", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 66, + "id_product": 17, + "id_product_attribute": 34, + "id_supplier": 2, + "product_supplier_reference": "demo_9_91", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 67, + "id_product": 17, + "id_product_attribute": 35, + "id_supplier": 2, + "product_supplier_reference": "demo_9_92", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 68, + "id_product": 18, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "demo_10_93", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 69, + "id_product": 18, + "id_product_attribute": 36, + "id_supplier": 2, + "product_supplier_reference": "demo_10_93", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 70, + "id_product": 18, + "id_product_attribute": 37, + "id_supplier": 2, + "product_supplier_reference": "demo_10_94", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 71, + "id_product": 18, + "id_product_attribute": 38, + "id_supplier": 2, + "product_supplier_reference": "demo_10_95", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 72, + "id_product": 18, + "id_product_attribute": 39, + "id_supplier": 2, + "product_supplier_reference": "demo_10_96", + "product_supplier_price_te": 5.49, + "id_currency": 1 + } + }, + { + "action": "upsert", + "collection": "product_suppliers", + "properties": { + "id_product_supplier": 73, + "id_product": 15, + "id_product_attribute": 0, + "id_supplier": 2, + "product_supplier_reference": "", + "product_supplier_price_te": 0, + "id_currency": 1 + } } ] diff --git a/e2e/src/fixtures/9/apiProducts/products.json b/e2e/src/fixtures/9/products.json similarity index 98% rename from e2e/src/fixtures/9/apiProducts/products.json rename to e2e/src/fixtures/9/products.json index 45936ceb..e9dca1b5 100644 --- a/e2e/src/fixtures/9/apiProducts/products.json +++ b/e2e/src/fixtures/9/products.json @@ -1,6 +1,6 @@ [ { - "id": "1-2-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -63,7 +63,7 @@ } }, { - "id": "1-3-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -126,7 +126,7 @@ } }, { - "id": "1-4-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -189,7 +189,7 @@ } }, { - "id": "1-5-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -252,7 +252,7 @@ } }, { - "id": "1-6-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -315,7 +315,7 @@ } }, { - "id": "1-7-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -378,7 +378,7 @@ } }, { - "id": "1-8-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -441,7 +441,7 @@ } }, { - "id": "1-1-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 1, @@ -504,7 +504,7 @@ } }, { - "id": "2-10-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -566,7 +566,7 @@ } }, { - "id": "2-11-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -628,7 +628,7 @@ } }, { - "id": "2-12-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -690,7 +690,7 @@ } }, { - "id": "2-9-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 2, @@ -752,7 +752,7 @@ } }, { - "id": "3-14-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -813,7 +813,7 @@ } }, { - "id": "3-15-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -874,7 +874,7 @@ } }, { - "id": "3-13-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 3, @@ -935,7 +935,7 @@ } }, { - "id": "4-17-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -996,7 +996,7 @@ } }, { - "id": "4-18-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1057,7 +1057,7 @@ } }, { - "id": "4-16-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 4, @@ -1118,7 +1118,7 @@ } }, { - "id": "5-20-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1179,7 +1179,7 @@ } }, { - "id": "5-21-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1240,7 +1240,7 @@ } }, { - "id": "5-19-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 5, @@ -1301,7 +1301,7 @@ } }, { - "id": "6-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 6, @@ -1360,7 +1360,7 @@ } }, { - "id": "7-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 7, @@ -1419,7 +1419,7 @@ } }, { - "id": "8-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 8, @@ -1478,7 +1478,7 @@ } }, { - "id": "9-23-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 9, @@ -1540,7 +1540,7 @@ } }, { - "id": "9-22-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 9, @@ -1602,7 +1602,7 @@ } }, { - "id": "10-25-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 10, @@ -1664,7 +1664,7 @@ } }, { - "id": "10-24-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 10, @@ -1726,7 +1726,7 @@ } }, { - "id": "11-27-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 11, @@ -1788,7 +1788,7 @@ } }, { - "id": "11-26-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 11, @@ -1850,7 +1850,7 @@ } }, { - "id": "12-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 12, @@ -1907,7 +1907,7 @@ } }, { - "id": "13-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 13, @@ -1964,7 +1964,7 @@ } }, { - "id": "14-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 14, @@ -2021,7 +2021,7 @@ } }, { - "id": "15-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 15, @@ -2078,7 +2078,7 @@ } }, { - "id": "16-29-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2140,7 +2140,7 @@ } }, { - "id": "16-30-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2202,7 +2202,7 @@ } }, { - "id": "16-31-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2264,7 +2264,7 @@ } }, { - "id": "16-28-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 16, @@ -2326,7 +2326,7 @@ } }, { - "id": "17-33-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2388,7 +2388,7 @@ } }, { - "id": "17-34-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2450,7 +2450,7 @@ } }, { - "id": "17-35-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2512,7 +2512,7 @@ } }, { - "id": "17-32-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 17, @@ -2574,7 +2574,7 @@ } }, { - "id": "18-37-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2636,7 +2636,7 @@ } }, { - "id": "18-38-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2698,7 +2698,7 @@ } }, { - "id": "18-39-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2760,7 +2760,7 @@ } }, { - "id": "18-36-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 18, @@ -2822,7 +2822,7 @@ } }, { - "id": "19-0-en", + "action": "upsert", "collection": "products", "properties": { "id_product": 19, diff --git a/e2e/src/fixtures/9/apiInfo/shops.json b/e2e/src/fixtures/9/shops.json similarity index 97% rename from e2e/src/fixtures/9/apiInfo/shops.json rename to e2e/src/fixtures/9/shops.json index 49605475..08fd4f5d 100644 --- a/e2e/src/fixtures/9/apiInfo/shops.json +++ b/e2e/src/fixtures/9/shops.json @@ -1,6 +1,6 @@ [ { - "id": "1", + "action": "upsert", "collection": "shops", "properties": { "created_at": "2024-06-10 02:27:21", diff --git a/e2e/src/fixtures/9/apiSpecificPrices/specific_prices.json b/e2e/src/fixtures/9/specific_prices.json similarity index 96% rename from e2e/src/fixtures/9/apiSpecificPrices/specific_prices.json rename to e2e/src/fixtures/9/specific_prices.json index f179c309..222d03f4 100644 --- a/e2e/src/fixtures/9/apiSpecificPrices/specific_prices.json +++ b/e2e/src/fixtures/9/specific_prices.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 1, @@ -31,7 +31,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "specific_prices", "properties": { "id_specific_price": 2, diff --git a/e2e/src/fixtures/9/stock_movements.json b/e2e/src/fixtures/9/stock_movements.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/stock_movements.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiStocks/stocks.json b/e2e/src/fixtures/9/stocks.json similarity index 93% rename from e2e/src/fixtures/9/apiStocks/stocks.json rename to e2e/src/fixtures/9/stocks.json index b95df9a4..12efb5ae 100644 --- a/e2e/src/fixtures/9/apiStocks/stocks.json +++ b/e2e/src/fixtures/9/stocks.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 1, @@ -17,7 +17,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 2, @@ -34,7 +34,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 3, @@ -51,7 +51,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 4, @@ -68,7 +68,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 5, @@ -85,7 +85,7 @@ } }, { - "id": 6, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 6, @@ -102,7 +102,7 @@ } }, { - "id": 7, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 7, @@ -119,7 +119,7 @@ } }, { - "id": 8, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 8, @@ -136,7 +136,7 @@ } }, { - "id": 9, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 9, @@ -153,7 +153,7 @@ } }, { - "id": 10, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 10, @@ -170,7 +170,7 @@ } }, { - "id": 11, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 11, @@ -187,7 +187,7 @@ } }, { - "id": 12, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 12, @@ -204,7 +204,7 @@ } }, { - "id": 13, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 13, @@ -221,7 +221,7 @@ } }, { - "id": 14, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 14, @@ -238,7 +238,7 @@ } }, { - "id": 15, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 15, @@ -255,7 +255,7 @@ } }, { - "id": 16, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 16, @@ -272,7 +272,7 @@ } }, { - "id": 17, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 17, @@ -289,7 +289,7 @@ } }, { - "id": 18, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 18, @@ -306,7 +306,7 @@ } }, { - "id": 19, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 19, @@ -323,7 +323,7 @@ } }, { - "id": 20, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 20, @@ -340,7 +340,7 @@ } }, { - "id": 21, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 21, @@ -357,7 +357,7 @@ } }, { - "id": 22, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 22, @@ -374,7 +374,7 @@ } }, { - "id": 23, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 23, @@ -391,7 +391,7 @@ } }, { - "id": 24, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 24, @@ -408,7 +408,7 @@ } }, { - "id": 25, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 25, @@ -425,7 +425,7 @@ } }, { - "id": 26, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 26, @@ -442,7 +442,7 @@ } }, { - "id": 27, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 27, @@ -459,7 +459,7 @@ } }, { - "id": 28, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 28, @@ -476,7 +476,7 @@ } }, { - "id": 29, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 29, @@ -493,7 +493,7 @@ } }, { - "id": 30, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 30, @@ -510,7 +510,7 @@ } }, { - "id": 31, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 31, @@ -527,7 +527,7 @@ } }, { - "id": 32, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 32, @@ -544,7 +544,7 @@ } }, { - "id": 33, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 33, @@ -561,7 +561,7 @@ } }, { - "id": 34, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 34, @@ -578,7 +578,7 @@ } }, { - "id": 35, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 35, @@ -595,7 +595,7 @@ } }, { - "id": 36, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 36, @@ -612,7 +612,7 @@ } }, { - "id": 37, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 37, @@ -629,7 +629,7 @@ } }, { - "id": 38, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 38, @@ -646,7 +646,7 @@ } }, { - "id": 39, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 39, @@ -663,7 +663,7 @@ } }, { - "id": 40, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 40, @@ -680,7 +680,7 @@ } }, { - "id": 41, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 41, @@ -697,7 +697,7 @@ } }, { - "id": 42, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 42, @@ -714,7 +714,7 @@ } }, { - "id": 43, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 43, @@ -731,7 +731,7 @@ } }, { - "id": 44, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 44, @@ -748,7 +748,7 @@ } }, { - "id": 45, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 45, @@ -765,7 +765,7 @@ } }, { - "id": 46, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 46, @@ -782,7 +782,7 @@ } }, { - "id": 47, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 47, @@ -799,7 +799,7 @@ } }, { - "id": 48, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 48, @@ -816,7 +816,7 @@ } }, { - "id": 49, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 49, @@ -833,7 +833,7 @@ } }, { - "id": 50, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 50, @@ -850,7 +850,7 @@ } }, { - "id": 51, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 51, @@ -867,7 +867,7 @@ } }, { - "id": 52, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 52, @@ -884,7 +884,7 @@ } }, { - "id": 53, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 53, @@ -901,7 +901,7 @@ } }, { - "id": 54, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 54, @@ -918,7 +918,7 @@ } }, { - "id": 55, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 55, @@ -935,7 +935,7 @@ } }, { - "id": 56, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 56, @@ -952,7 +952,7 @@ } }, { - "id": 57, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 57, @@ -969,7 +969,7 @@ } }, { - "id": 58, + "action": "upsert", "collection": "stocks", "properties": { "id_stock_available": 58, diff --git a/e2e/src/fixtures/9/apiStores/stores.json b/e2e/src/fixtures/9/stores.json similarity index 96% rename from e2e/src/fixtures/9/apiStores/stores.json rename to e2e/src/fixtures/9/stores.json index 29191752..65c3760d 100644 --- a/e2e/src/fixtures/9/apiStores/stores.json +++ b/e2e/src/fixtures/9/stores.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "stores", "properties": { "id_store": 1, @@ -20,7 +20,7 @@ } }, { - "id": 2, + "action": "upsert", "collection": "stores", "properties": { "id_store": 2, @@ -40,7 +40,7 @@ } }, { - "id": 3, + "action": "upsert", "collection": "stores", "properties": { "id_store": 3, @@ -60,7 +60,7 @@ } }, { - "id": 4, + "action": "upsert", "collection": "stores", "properties": { "id_store": 4, @@ -80,7 +80,7 @@ } }, { - "id": 5, + "action": "upsert", "collection": "stores", "properties": { "id_store": 5, diff --git a/e2e/src/fixtures/9/apiSuppliers/suppliers.json b/e2e/src/fixtures/9/suppliers.json similarity index 90% rename from e2e/src/fixtures/9/apiSuppliers/suppliers.json rename to e2e/src/fixtures/9/suppliers.json index 2cd693a8..af6ce5b7 100644 --- a/e2e/src/fixtures/9/apiSuppliers/suppliers.json +++ b/e2e/src/fixtures/9/suppliers.json @@ -1,6 +1,6 @@ [ { - "id": 1, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 1, @@ -11,13 +11,12 @@ "id_lang": 1, "description": "", "meta_title": "", - "meta_keywords": "", "meta_description": "", "id_shop": 1 } }, { - "id": 2, + "action": "upsert", "collection": "suppliers", "properties": { "id_supplier": 2, @@ -28,7 +27,6 @@ "id_lang": 1, "description": "", "meta_title": "", - "meta_keywords": "", "meta_description": "", "id_shop": 1 } diff --git a/e2e/src/fixtures/9/taxonomies.json b/e2e/src/fixtures/9/taxonomies.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/taxonomies.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/apiThemes/themes.json b/e2e/src/fixtures/9/themes.json similarity index 81% rename from e2e/src/fixtures/9/apiThemes/themes.json rename to e2e/src/fixtures/9/themes.json index d6821c78..411fcd30 100644 --- a/e2e/src/fixtures/9/apiThemes/themes.json +++ b/e2e/src/fixtures/9/themes.json @@ -1,6 +1,6 @@ [ { - "id": "28d58425ad1994a889cc596050bc52db", + "action": "upsert", "collection": "themes", "properties": { "theme_id": "28d58425ad1994a889cc596050bc52db", @@ -10,7 +10,7 @@ } }, { - "id": "f3d64714d1f6e7f71558d4252e84ab58", + "action": "upsert", "collection": "themes", "properties": { "theme_id": "f3d64714d1f6e7f71558d4252e84ab58", diff --git a/e2e/src/fixtures/9/translations.json b/e2e/src/fixtures/9/translations.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/translations.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/wishlist_products.json b/e2e/src/fixtures/9/wishlist_products.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/wishlist_products.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/fixtures/9/wishlists.json b/e2e/src/fixtures/9/wishlists.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/e2e/src/fixtures/9/wishlists.json @@ -0,0 +1 @@ +[] diff --git a/e2e/src/full-sync.spec.ts b/e2e/src/full-sync.spec.ts index c1ea7910..9c58790f 100644 --- a/e2e/src/full-sync.spec.ts +++ b/e2e/src/full-sync.spec.ts @@ -1,30 +1,18 @@ import testConfig from "./helpers/test.config"; import * as matchers from "jest-extended"; import { dumpUploadData, logAxiosError } from "./helpers/log-helper"; -import axios, { AxiosError } from "axios"; +import axios from "axios"; import { doFullSync, probe, PsEventbusSyncUpload } from "./helpers/mock-probe"; -import { from, lastValueFrom, toArray, withLatestFrom } from "rxjs"; +import { lastValueFrom, toArray, withLatestFrom } from "rxjs"; import { - generatePredictableModuleId, loadFixture, omitProperties, sortUploadData, } from "./helpers/data-helper"; -import { Controller, controllerList } from "./helpers/controllers"; +import { shopContentList } from "./helpers/shop-contents"; expect.extend(matchers); -// these controllers will be excluded from the following test suite -const EXCLUDED_API: Controller[] = ["apiGoogleTaxonomies"]; - -// FIXME : these api can't send anything to the mock api because the database is empty from the factory -const MISSING_TEST_DATA: Controller[] = [ - "apiCartRules", - "apiCustomProductCarriers", - "apiTranslations", - "apiWishlists", -]; - // these fields change from test run to test run, so we replace them with a matcher to only ensure the type and format are correct const isDateString = (val) => val ? expect(val).toBeDateString() : expect(val).toBeNull(); @@ -32,9 +20,13 @@ const isString = (val) => val ? expect(val).toBeString() : expect(val).toBeNull(); const isNumber = (val) => val ? expect(val).toBeNumber() : expect(val).toBeNull(); +const isBoolean = (val) => + val ? expect(val).toBeBoolean() : expect(val).toBeNull(); const specialFieldAssert: { [index: string]: (val) => void } = { created_at: isDateString, updated_at: isDateString, + delivery_date: isDateString, + invoice_date: isDateString, last_connection_date: isDateString, folder_created_at: isDateString, date_add: isDateString, @@ -47,61 +39,27 @@ const specialFieldAssert: { [index: string]: (val) => void } = { theme_version: isString, php_version: isString, http_server: isString, + cover: isString, + link: isString, + url: isString, + images: isString, + ssl: isBoolean, }; describe("Full Sync", () => { - let testIndex = 0; - - // gérer les cas ou un shopContent n'existe pas (pas de fixture du coup) - const controllers: Controller[] = controllerList.filter( - (it) => !EXCLUDED_API.includes(it), - ); + let generatedNumber = 0; let jobId: string; beforeEach(() => { - jobId = `valid-job-full-${testIndex++}`; + generatedNumber = Date.now() + Math.trunc(Math.random() * 100000000000000); + jobId = `valid-job-full-${generatedNumber}`; }); - // TODO : some versions of prestashop include ps_facebook out of the box, this test can't reliably be run for all versions - describe.skip("apiGoogleTaxonomies", () => { - const controller = "apiGoogleTaxonomies"; - - // TODO : apiGoogleTaxonomies requires an additional module to be present : devise a specific test setup for this endpoint - it.skip(`${controller} should accept full sync`, async () => {}); - - it.skip(`${controller} should upload to collector`, async () => {}); - - it(`${controller} should reject full sync when ps_facebook is not installed`, async () => { + describe.each(shopContentList)("%s", (shopContent) => { + it(`${shopContent} should accept full sync`, async () => { // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5&full=1&job_id=${jobId}`; - - const callId = { call_id: Math.random().toString(36).substring(2, 11) }; - - // act - const response = await axios - .post(url, callId, { - headers: { - Host: testConfig.prestaShopHostHeader, - "Content-Type": "application/x-www-form-urlencoded", // for compat PHP 5.6 - }, - }) - .catch((err) => { - expect(err).toBeInstanceOf(AxiosError); - return err.response; - }); - - // assert - expect(response.status).toEqual(456); - // expect some explanation to be given to the user - expect(response.statusText).toMatch(/[Ff]acebook/); - }); - }); - - describe.each(controllers)("%s", (controller) => { - it(`${controller} should accept full sync`, async () => { - // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5&full=1&job_id=${jobId}`; + const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=${shopContent}&limit=5&full=1&job_id=${jobId}`; const callId = { call_id: Math.random().toString(36).substring(2, 11) }; @@ -128,98 +86,51 @@ describe("Full Sync", () => { }); }); - if (MISSING_TEST_DATA.includes(controller)) { - it.skip(`${controller} should upload to collector`, () => {}); - } else { - it(`${controller} should upload to collector`, async () => { - // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5&full=1&job_id=${jobId}`; - const message$ = probe({ url: `/upload/${jobId}` }); - - const callId = { call_id: Math.random().toString(36).substring(2, 11) }; - - // act - const request$ = from( - axios.post(url, callId, { - headers: { - Host: testConfig.prestaShopHostHeader, - "Content-Type": "application/x-www-form-urlencoded", // for compat PHP 5.6 - }, - }), - ); - - const probeMessage = await lastValueFrom( - request$.pipe(withLatestFrom(message$, (_, message) => message)), - ); - - // assert - expect(probeMessage).toBeTruthy(); - expect(probeMessage.method).toBe("POST"); - expect(probeMessage.headers).toMatchObject({ - "full-sync-requested": "1", - }); - }); - } - - if (MISSING_TEST_DATA.includes(controller)) { - it.skip(`${controller} should upload complete dataset to collector`, () => {}); - } else { - it(`${controller} should upload complete dataset collector`, async () => { - // arrange - const response$ = doFullSync(jobId, controller, { timeout: 4000 }); - const message$ = probe({ url: `/upload/${jobId}` }, { timeout: 4000 }); - - // this combines each response from ps_eventbus to the last request captured by the probe. - // it works because ps_eventbus sends a response after calling our mock collector server - // if ps_eventbus doesn't need to call the collector, the probe completes without value after its timeout - const messages = await lastValueFrom( - response$.pipe( - withLatestFrom(message$, (_, message) => message.body.file), - toArray(), - ), - ); - - const syncedData: PsEventbusSyncUpload[] = messages.flat(); - - // dump data for easier debugging or updating fixtures - let processedData = syncedData as PsEventbusSyncUpload[]; - if (testConfig.dumpFullSyncData) { - await dumpUploadData(processedData, controller); - } + it(`${shopContent} should upload complete dataset collector`, async () => { + // arrange + const response$ = doFullSync(jobId, shopContent, { timeout: 5000 }); + const message$ = probe({ url: `/upload/${jobId}` }, { timeout: 4000 }); - const fixture = await loadFixture(controller); + // this combines each response from ps_eventbus to the last request captured by the probe. + // it works because ps_eventbus sends a response after calling our mock collector server + // if ps_eventbus doesn't need to call the collector, the probe completes without value after its timeout + const messages = await lastValueFrom( + response$.pipe( + withLatestFrom(message$, (_, message) => message.body.file), + toArray(), + ), + ); - // we need to process fixtures and data returned from ps_eventbus to make them easier to compare - let processedFixture = fixture; - if (controller === "apiModules") { - processedData = generatePredictableModuleId(processedData); - processedFixture = generatePredictableModuleId(processedFixture); - } - processedData = omitProperties( - processedData, - Object.keys(specialFieldAssert), - ); - processedData = sortUploadData(processedData); - processedFixture = omitProperties( - processedFixture, - Object.keys(specialFieldAssert), - ); - processedFixture = sortUploadData(processedFixture); - - // assert - expect(processedData).toMatchObject(processedFixture); - - // assert special field using custom matcher - for (const data of processedData) { - for (const specialFieldName of Object.keys(specialFieldAssert)) { - if (data.properties[specialFieldName] !== undefined) { - specialFieldAssert[specialFieldName]( - data.properties[specialFieldName], - ); - } + let dataFromModule: PsEventbusSyncUpload[] = messages.flat(); + let fixtures = await loadFixture(shopContent); + + if (testConfig.dumpFullSyncData) { + await dumpUploadData(dataFromModule); + } + + dataFromModule = omitProperties( + dataFromModule, + Object.keys(specialFieldAssert), + ); + + fixtures = omitProperties(fixtures, Object.keys(specialFieldAssert)); + + dataFromModule = sortUploadData(dataFromModule); + fixtures = sortUploadData(fixtures); + + // assert + expect(dataFromModule).toEqual(fixtures); + + // assert special field using custom matcher + for (const data of dataFromModule) { + for (const specialFieldName of Object.keys(specialFieldAssert)) { + if (data.properties[specialFieldName] !== undefined) { + specialFieldAssert[specialFieldName]( + data.properties[specialFieldName], + ); } } - }); - } + } + }); // Timeout set to 30s because full sync can take a long time }); }); diff --git a/e2e/src/helpers/controllers.ts b/e2e/src/helpers/controllers.ts deleted file mode 100644 index 919183aa..00000000 --- a/e2e/src/helpers/controllers.ts +++ /dev/null @@ -1,47 +0,0 @@ -import R from "ramda"; - -export const contentControllerMapping = { - carriers: "apiCarriers", - carrier_details: "apiCarriers", - carts: "apiCarts", - cart_products: "apiCarts", - cart_rules: "apiCartRules", - categories: "apiCategories", - currencies: "apiCurrencies", - specific_prices: "apiSpecificPrices", - custom_product_carriers: "apiCustomProductCarriers", - customers: "apiCustomers", - taxonomies: "apiGoogleTaxonomies", - modules: "apiModules", - orders: "apiOrders", - order_details: "apiOrders", - order_status_history: "apiOrders", - order_cart_rules: "apiOrders", - products: "apiProducts", - shops: "apiInfo", - stores: "apiStores", - themes: "apiThemes", - bundles: "apiProducts", - wishlists: "apiWishlists", - wishlist_products: "apiWishlists", - stocks: "apiStocks", - stock_movements: "apiStocks", - manufacturers: "apiManufacturers", - suppliers: "apiSuppliers", - product_suppliers: "apiProducts", - languages: "apiLanguages", - employees: "apiEmployees", - translations: "apiTranslations", - images: "apiImages", - image_types: "apiImageTypes", -} as const; - -type ContentControllerMapping = typeof contentControllerMapping; - -export type Content = keyof ContentControllerMapping; -export const contentList = Object.keys(contentControllerMapping) as Content[]; - -export type Controller = ContentControllerMapping[Content]; -export const controllerList = R.uniq( - Object.values(contentControllerMapping), -) as Controller[]; diff --git a/e2e/src/helpers/data-helper.ts b/e2e/src/helpers/data-helper.ts index f62e1bad..48341b9b 100644 --- a/e2e/src/helpers/data-helper.ts +++ b/e2e/src/helpers/data-helper.ts @@ -1,35 +1,26 @@ import R from "ramda"; import { PsEventbusSyncUpload } from "./mock-probe"; import fs from "fs"; -import { Content, contentControllerMapping, Controller } from "./controllers"; +import { Content, shopContentMapping, ShopContent } from "./shop-contents"; import axios from "axios"; import testConfig from "./test.config"; import { HealthCheck } from "../type/health-check"; import semver from "semver"; - +import hash from "object-hash"; /** - * sort upload data by collection and id to allow easier comparison + * sort upload data by collection and hash to allow easier comparison + * The hash is calculated from the data object + * * @param data ps_eventbus upload data */ -export const sortUploadData: ( - data: PsEventbusSyncUpload[], -) => PsEventbusSyncUpload[] = R.pipe( - R.sortBy(R.prop("collection")), - R.sortBy(R.prop("id")), -); - -/** - * modules returned by ps_eventbus use their database it as their collection id, which makes it random. - * this function provides a way to generate a predictable replacement id. - * @param data - */ -export function generatePredictableModuleId( +export function sortUploadData( data: PsEventbusSyncUpload[], ): PsEventbusSyncUpload[] { - return data.map((it) => ({ - ...it, - id: `${(it.properties as { name: string }).name}`, - })); + data.forEach((item) => { + item["hash"] = hash(item); + }); + + return R.pipe(R.sortBy(R.prop("collection")), R.sortBy(R.prop("hash")))(data); } export function omitProperties( @@ -42,9 +33,9 @@ export function omitProperties( })); } -export function getControllerContent(controller: Controller): Content[] { - return Object.entries(contentControllerMapping) - .filter((it) => it[1] === controller) +export function getControllerContent(shopContent: ShopContent): Content[] { + return Object.entries(shopContentMapping) + .filter((it) => it[1] === shopContent) .map((it) => it[0]) as Content[]; } @@ -70,9 +61,9 @@ export async function getShopHealthCheck(options?: { const FIXTURE_DIR = "./src/fixtures"; export async function loadFixture( - controller: Controller, + shopContent: ShopContent, ): Promise { - const contents = getControllerContent(controller); + const contents = getControllerContent(shopContent); const shopVersion = (await getShopHealthCheck()).prestashop_version; const shopSemver = semver.coerce(shopVersion); const fixture = []; @@ -100,7 +91,7 @@ export async function loadFixture( const files = contents.map((content) => fs.promises.readFile( - `${FIXTURE_DIR}/${useFixture}/${controller}/${content}.json`, + `${FIXTURE_DIR}/${useFixture}/${content}.json`, "utf-8", ), ); diff --git a/e2e/src/helpers/log-helper.ts b/e2e/src/helpers/log-helper.ts index 8baf908b..d211b04c 100644 --- a/e2e/src/helpers/log-helper.ts +++ b/e2e/src/helpers/log-helper.ts @@ -7,16 +7,19 @@ import { getShopHealthCheck } from "./data-helper"; export function logAxiosError(err: Error) { if (err instanceof AxiosError) { - console.log(R.pick(["status", "statusText", "data"], err.response)); + const data = { + ...R.pick(["url"], err.response.config), + ...R.pick(["status", "statusText", "data"], err.response), + }; + + console.log(data); } } -export async function dumpUploadData( - data: PsEventbusSyncUpload[], - filename: string, -) { +export async function dumpUploadData(data: PsEventbusSyncUpload[]) { const shopVersion = (await getShopHealthCheck()).prestashop_version; - const dir = `./dumps/${testConfig.testRunTime}/${shopVersion}/${filename}`; + const dir = `./dumps/${testConfig.testRunTime}/${shopVersion}`; + await fs.promises.mkdir(dir, { recursive: true }); const groupedData = R.groupBy((el) => el.collection, data); const files = Object.keys(groupedData).map((collection) => { diff --git a/e2e/src/helpers/mock-probe.ts b/e2e/src/helpers/mock-probe.ts index 36a828cf..69e9b4ed 100644 --- a/e2e/src/helpers/mock-probe.ts +++ b/e2e/src/helpers/mock-probe.ts @@ -1,10 +1,20 @@ import WebSocket from "ws"; import { WebSocketSubject } from "rxjs/webSocket"; -import { EMPTY, expand, filter, from, map, Observable, timeout } from "rxjs"; +import { + EMPTY, + expand, + filter, + from, + map, + Observable, + takeUntil, + timeout, + timer, +} from "rxjs"; import R from "ramda"; import testConfig from "./test.config"; import axios from "axios"; -import { Controller } from "./controllers"; +import { ShopContent } from "./shop-contents"; const DEFAULT_OPTIONS = { timeout: 500, @@ -71,22 +81,22 @@ export function probe( return socket.pipe( filter((message) => (match ? R.whereEq(match, message) : true)), - timeout(options.timeout), + takeUntil(timer(options.timeout)), ); } export function doFullSync( jobId: string, - controller: Controller, + shopContent: ShopContent, options?: MockClientOptions, ): Observable { options = R.mergeLeft(options, DEFAULT_OPTIONS); const callId = { call_id: Math.random().toString(36).substring(2, 11) }; - const requestNext = (full: number) => - axios.post( - `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5&full=${full}&job_id=${jobId}`, + const requestNext = (full: number) => { + return axios.post( + `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=${shopContent}&limit=5&full=${full}&job_id=${jobId}`, callId, { headers: { @@ -95,6 +105,7 @@ export function doFullSync( }, }, ); + }; return from(requestNext(1)).pipe( expand((response) => { diff --git a/e2e/src/helpers/shop-contents.ts b/e2e/src/helpers/shop-contents.ts new file mode 100644 index 00000000..ed67ac07 --- /dev/null +++ b/e2e/src/helpers/shop-contents.ts @@ -0,0 +1,49 @@ +import R from "ramda"; + +export const shopContentMapping = { + attributes: "attributes", + bundles: "bundles", + carriers: "carriers", + carrier_details: "carrier-details", + carrier_taxes: "carrier-taxes", + carts: "carts", + cart_products: "cart-products", + cart_rules: "cart-rules", + categories: "categories", + currencies: "currencies", + customers: "customers", + custom_product_carriers: "custom-product-carriers", + employees: "employees", + images: "images", + image_types: "image-types", + languages: "languages", + manufacturers: "manufacturers", + modules: "modules", + orders: "orders", + order_cart_rules: "order-cart-rules", + order_details: "order-details", + order_status_history: "order-status-history", + products: "products", + product_suppliers: "product-suppliers", + shops: "shops", + specific_prices: "specific-prices", + stocks: "stocks", + stock_movements: "stock-movements", + stores: "stores", + suppliers: "suppliers", + taxonomies: "taxonomies", + themes: "themes", + translations: "translations", + wishlists: "wishlists", + wishlist_products: "wishlist-products", +} as const; + +type ShopContentMapping = typeof shopContentMapping; + +export type Content = keyof ShopContentMapping; +export const contentList = Object.keys(shopContentMapping) as Content[]; + +export type ShopContent = ShopContentMapping[Content]; +export const shopContentList = R.uniq( + Object.values(shopContentMapping), +) as ShopContent[]; diff --git a/e2e/src/job-id-validation.spec.ts b/e2e/src/job-id-validation.spec.ts index 3097d302..3a6f6339 100644 --- a/e2e/src/job-id-validation.spec.ts +++ b/e2e/src/job-id-validation.spec.ts @@ -3,126 +3,64 @@ import { beforeEach, describe, expect } from "@jest/globals"; import axios from "axios"; import { from, lastValueFrom, map, toArray, zip } from "rxjs"; import { probe } from "./helpers/mock-probe"; -import { Controller, controllerList } from "./helpers/controllers"; +import { ShopContent, shopContentList } from "./helpers/shop-contents"; describe("Reject invalid job-id", () => { - let testIndex = 0; + let generatedNumber = 0; - const controllers: Controller[] = controllerList; + const shopContents: ShopContent[] = shopContentList; let jobId: string; - describe("healthcheck endpoint", () => { - it(`should return an authentified payload with an valid job-id`, async () => { - // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiHealthCheck&job_id=valid-job-1`; - - //act - const res = await axios.get(url, { - headers: { Host: testConfig.prestaShopHostHeader }, - }); - - // assert - expect(res.status).toEqual(200); - expect(res.headers).toMatchObject({ - "content-type": /json/, - }); - expect(res.data).toMatchObject({ - httpCode: 200, - shop_id: "f07181f7-2399-406d-9226-4b6c14cf6068", - is_valid_jwt: true, - ps_account: true, - ps_eventbus: true, - php_version: expect.any(String), - prestashop_version: expect.any(String), - ps_accounts_version: expect.any(String), - ps_eventbus_version: expect.any(String), - env: { - EVENT_BUS_LIVE_SYNC_API_URL: "http://reverse-proxy/live-sync-api/v1", - EVENT_BUS_PROXY_API_URL: "http://reverse-proxy/collector", - EVENT_BUS_SYNC_API_URL: "http://reverse-proxy/sync-api", - }, - }); - }); + beforeEach(() => { + generatedNumber = Date.now() + Math.trunc(Math.random() * 100000000000000); + jobId = `invalid-job-id-${generatedNumber}`; + }); - it(`should return a minimal dataset with an invalid job`, async () => { + it.each(shopContents)( + `%s should return 454 with an invalid job id (sync-api status 454)`, + async (shopContent) => { + expect.assertions(6); // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiHealthCheck&job_id=invalid-job`; + const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=apiShopContent&shop_content=${shopContent}&limit=5&job_id=${jobId}`; + const message$ = probe({ params: { id: jobId } }); //act - const res = await axios.get(url, { - headers: { Host: testConfig.prestaShopHostHeader }, - }); + const request$ = from( + axios + .get(url, { + headers: { Host: testConfig.prestaShopHostHeader }, + }) + .then((res) => { + expect(res).toBeNull(); // fail test + }) + .catch((err) => { + return err.response; + }), + ); + + const results = await lastValueFrom( + zip(message$, request$).pipe( + map((result) => ({ + probeMessage: result[0], + psEventbusReq: result[1], + })), + toArray(), + ), + ); // assert - expect(res.status).toEqual(200); - expect(res.headers).toMatchObject({ + expect(results.length).toEqual(1); + expect(results[0].probeMessage.method).toBe("GET"); + expect(results[0].probeMessage.url.split("/")).toContain(jobId); + expect(results[0].psEventbusReq.status).toEqual(454); + expect(results[0].psEventbusReq.headers).toMatchObject({ "content-type": /json/, }); - expect(res.data).toMatchObject({ - httpCode: 200, - is_valid_jwt: true, - ps_account: true, - ps_eventbus: true, - env: { - EVENT_BUS_LIVE_SYNC_API_URL: "http://reverse-proxy/live-sync-api/v1", - EVENT_BUS_PROXY_API_URL: "http://reverse-proxy/collector", - EVENT_BUS_SYNC_API_URL: "http://reverse-proxy/sync-api", - }, + expect(results[0].psEventbusReq.data).toMatchObject({ + status: false, + httpCode: 454, }); - }); - }); - - describe("data endpoints", () => { - beforeEach(() => { - jobId = `invalid-job-id-${testIndex++}`; - }); - - it.each(controllers)( - `%s should return 454 with an invalid job id (sync-api status 454)`, - async (controller) => { - expect.assertions(6); - // arrange - const url = `${testConfig.prestashopUrl}/index.php?fc=module&module=ps_eventbus&controller=${controller}&limit=5&job_id=${jobId}`; - const message$ = probe({ params: { id: jobId } }); - - //act - const request$ = from( - axios - .get(url, { - headers: { Host: testConfig.prestaShopHostHeader }, - }) - .then((res) => { - expect(res).toBeNull(); // fail test - }) - .catch((err) => { - return err.response; - }), - ); - - const results = await lastValueFrom( - zip(message$, request$).pipe( - map((result) => ({ - probeMessage: result[0], - psEventbusReq: result[1], - })), - toArray(), - ), - ); - - // assert - expect(results.length).toEqual(1); - expect(results[0].probeMessage.method).toBe("GET"); - expect(results[0].probeMessage.url.split("/")).toContain(jobId); - expect(results[0].psEventbusReq.status).toEqual(454); - expect(results[0].psEventbusReq.headers).toMatchObject({ - "content-type": /json/, - }); - expect(results[0].psEventbusReq.data).toMatchObject({ - status: false, - httpCode: 454, - }); - }, - ); - }); + }, + ); }); diff --git a/e2e/src/type/bundles.ts b/e2e/src/type/bundles.ts index 33cb39e6..eb4f660c 100644 --- a/e2e/src/type/bundles.ts +++ b/e2e/src/type/bundles.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiProducts/bundles.json"; +import fixture from "../fixtures/latest/bundles.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/carrier-details.ts b/e2e/src/type/carrier-details.ts index 36e5361c..8675759a 100644 --- a/e2e/src/type/carrier-details.ts +++ b/e2e/src/type/carrier-details.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCarriers/carrier_details.json"; +import fixture from "../fixtures/latest/carrier_details.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/carriers.ts b/e2e/src/type/carriers.ts index 13923fde..64487862 100644 --- a/e2e/src/type/carriers.ts +++ b/e2e/src/type/carriers.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCarriers/carriers.json"; +import fixture from "../fixtures/latest/carriers.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/cart-products.ts b/e2e/src/type/cart-products.ts index afc0f7fd..9a00afcc 100644 --- a/e2e/src/type/cart-products.ts +++ b/e2e/src/type/cart-products.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCarts/cart_products.json"; +import fixture from "../fixtures/latest/cart_products.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/carts.ts b/e2e/src/type/carts.ts index 4f47ef31..aba88a3b 100644 --- a/e2e/src/type/carts.ts +++ b/e2e/src/type/carts.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCarts/carts.json"; +import fixture from "../fixtures/latest/carts.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/categories.ts b/e2e/src/type/categories.ts index 49dbca50..ae160136 100644 --- a/e2e/src/type/categories.ts +++ b/e2e/src/type/categories.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCategories/categories.json"; +import fixture from "../fixtures/latest/categories.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/currency.ts b/e2e/src/type/currency.ts index 22e4092e..1b814f95 100644 --- a/e2e/src/type/currency.ts +++ b/e2e/src/type/currency.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCurrencies/currencies.json"; +import fixture from "../fixtures/latest/currencies.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/customers.ts b/e2e/src/type/customers.ts index 5a18e57c..d405ae3a 100644 --- a/e2e/src/type/customers.ts +++ b/e2e/src/type/customers.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiCustomers/customers.json"; +import fixture from "../fixtures/latest/customers.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/employees.ts b/e2e/src/type/employees.ts index f347f00b..088472f6 100644 --- a/e2e/src/type/employees.ts +++ b/e2e/src/type/employees.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiEmployees/employees.json"; +import fixture from "../fixtures/latest/employees.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/image-type.ts b/e2e/src/type/image-type.ts index 19640032..d5f49677 100644 --- a/e2e/src/type/image-type.ts +++ b/e2e/src/type/image-type.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiImageTypes/image_types.json"; +import fixture from "../fixtures/latest/image_types.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/images.ts b/e2e/src/type/images.ts index b6b5cfe1..90142a97 100644 --- a/e2e/src/type/images.ts +++ b/e2e/src/type/images.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiImages/images.json"; +import fixture from "../fixtures/latest/images.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/languages.ts b/e2e/src/type/languages.ts index be4c493d..4dbbde11 100644 --- a/e2e/src/type/languages.ts +++ b/e2e/src/type/languages.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiLanguages/languages.json"; +import fixture from "../fixtures/latest/languages.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/manufacturers.ts b/e2e/src/type/manufacturers.ts index 3b32664f..bc8e30a1 100644 --- a/e2e/src/type/manufacturers.ts +++ b/e2e/src/type/manufacturers.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiManufacturers/manufacturers.json"; +import fixture from "../fixtures/latest/manufacturers.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/modules.ts b/e2e/src/type/modules.ts index 3dc6002b..ccffeb95 100644 --- a/e2e/src/type/modules.ts +++ b/e2e/src/type/modules.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiModules/modules.json"; +import fixture from "../fixtures/latest/modules.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/order-details.ts b/e2e/src/type/order-details.ts index a934f6f3..67fac876 100644 --- a/e2e/src/type/order-details.ts +++ b/e2e/src/type/order-details.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiOrders/order_details.json"; +import fixture from "../fixtures/latest/order_details.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/order-status-history.ts b/e2e/src/type/order-status-history.ts index 83b9cf16..c1b8b112 100644 --- a/e2e/src/type/order-status-history.ts +++ b/e2e/src/type/order-status-history.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiOrders/order_status_history.json"; +import fixture from "../fixtures/latest/order_status_histories.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/orders.ts b/e2e/src/type/orders.ts index 61bb9fce..3a265cd7 100644 --- a/e2e/src/type/orders.ts +++ b/e2e/src/type/orders.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiOrders/orders.json"; +import fixture from "../fixtures/latest/orders.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/product-supplier.ts b/e2e/src/type/product-supplier.ts index f7d1a2c7..76fc7077 100644 --- a/e2e/src/type/product-supplier.ts +++ b/e2e/src/type/product-supplier.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiProducts/product_suppliers.json"; +import fixture from "../fixtures/latest/product_suppliers.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/products.ts b/e2e/src/type/products.ts index 89f6018e..662ad657 100644 --- a/e2e/src/type/products.ts +++ b/e2e/src/type/products.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiProducts/products.json"; +import fixture from "../fixtures/latest/products.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/shops.ts b/e2e/src/type/shops.ts index 1a41b9f7..3e6d3b85 100644 --- a/e2e/src/type/shops.ts +++ b/e2e/src/type/shops.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiInfo/shops.json"; +import fixture from "../fixtures/latest/shops.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/specific-prices.ts b/e2e/src/type/specific-prices.ts index 9c1cdcbf..d863d4ce 100644 --- a/e2e/src/type/specific-prices.ts +++ b/e2e/src/type/specific-prices.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiSpecificPrices/specific_prices.json"; +import fixture from "../fixtures/latest/specific_prices.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/stocks.ts b/e2e/src/type/stocks.ts index fc73418a..f97665b4 100644 --- a/e2e/src/type/stocks.ts +++ b/e2e/src/type/stocks.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiStocks/stocks.json"; +import fixture from "../fixtures/latest/stocks.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/stores.ts b/e2e/src/type/stores.ts index 96ef4084..5dc6e77c 100644 --- a/e2e/src/type/stores.ts +++ b/e2e/src/type/stores.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiStores/stores.json"; +import fixture from "../fixtures/latest/stores.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/e2e/src/type/suppliers.ts b/e2e/src/type/suppliers.ts index ecf8cfc5..57989f6a 100644 --- a/e2e/src/type/suppliers.ts +++ b/e2e/src/type/suppliers.ts @@ -1,4 +1,4 @@ -import fixture from "../fixtures/latest/apiSuppliers/suppliers.json"; +import fixture from "../fixtures/latest/suppliers.json"; // test type // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/ps_eventbus.php b/ps_eventbus.php index 4f896071..1474d662 100644 --- a/ps_eventbus.php +++ b/ps_eventbus.php @@ -1,33 +1,35 @@ - * @copyright 2007-2023 PrestaShop SA and Contributors - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - * International Registered Trademark & Property of PrestaShop SA + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ -use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\DependencyInjection\ServiceContainer; use PrestaShop\Module\PsEventbus\Module\Install; use PrestaShop\Module\PsEventbus\Module\Uninstall; -use PrestaShop\Module\PsEventbus\Service\SynchronizationService; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; + +require_once __DIR__ . '/vendor/autoload.php'; if (!defined('_PS_VERSION_')) { exit; @@ -35,6 +37,9 @@ class Ps_eventbus extends Module { + // All hooks is here + use PrestaShop\Module\PsEventbus\Traits\UseHooks; + /** * @var array */ @@ -47,119 +52,13 @@ class Ps_eventbus extends Module const DEFAULT_ENV = ''; - /** - * @var array - */ - const REQUIRED_TABLES = [ - 'eventbus_type_sync', - 'eventbus_job', - 'eventbus_deleted_objects', - 'eventbus_incremental_sync', - ]; - /** * @var string */ public $version; /** - * List of hook to install at the installation of the module - * - * @var array - */ - private $hookToInstall = [ - 'actionObjectCarrierAddAfter', - 'actionObjectCarrierDeleteAfter', - 'actionObjectCarrierUpdateAfter', - - 'actionObjectCartAddAfter', - 'actionObjectCartUpdateAfter', - - 'actionObjectCartRuleAddAfter', - 'actionObjectCartRuleDeleteAfter', - 'actionObjectCartRuleUpdateAfter', - - 'actionObjectCategoryAddAfter', - 'actionObjectCategoryDeleteAfter', - 'actionObjectCategoryUpdateAfter', - - 'actionObjectCombinationDeleteAfter', - - 'actionObjectCountryAddAfter', - 'actionObjectCountryDeleteAfter', - 'actionObjectCountryUpdateAfter', - - 'actionObjectCurrencyAddAfter', - 'actionObjectCurrencyUpdateAfter', - - 'actionObjectCustomerAddAfter', - 'actionObjectCustomerDeleteAfter', - 'actionObjectCustomerUpdateAfter', - - 'actionObjectImageAddAfter', - 'actionObjectImageDeleteAfter', - 'actionObjectImageUpdateAfter', - - 'actionObjectLanguageAddAfter', - 'actionObjectLanguageDeleteAfter', - 'actionObjectLanguageUpdateAfter', - - 'actionObjectManufacturerAddAfter', - 'actionObjectManufacturerDeleteAfter', - 'actionObjectManufacturerUpdateAfter', - - 'actionObjectOrderAddAfter', - 'actionObjectOrderUpdateAfter', - - 'actionObjectProductAddAfter', - 'actionObjectProductDeleteAfter', - 'actionObjectProductUpdateAfter', - - 'actionObjectSpecificPriceAddAfter', - 'actionObjectSpecificPriceDeleteAfter', - 'actionObjectSpecificPriceUpdateAfter', - - 'actionObjectStateAddAfter', - 'actionObjectStateDeleteAfter', - 'actionObjectStateUpdateAfter', - - 'actionObjectStockAddAfter', - 'actionObjectStockUpdateAfter', - - 'actionObjectStoreAddAfter', - 'actionObjectStoreDeleteAfter', - 'actionObjectStoreUpdateAfter', - - 'actionObjectSupplierAddAfter', - 'actionObjectSupplierDeleteAfter', - 'actionObjectSupplierUpdateAfter', - - 'actionObjectTaxAddAfter', - 'actionObjectTaxDeleteAfter', - 'actionObjectTaxRulesGroupAddAfter', - 'actionObjectTaxRulesGroupDeleteAfter', - 'actionObjectTaxRulesGroupUpdateAfter', - 'actionObjectTaxUpdateAfter', - - 'actionObjectWishlistAddAfter', - 'actionObjectWishlistDeleteAfter', - 'actionObjectWishlistUpdateAfter', - - 'actionObjectZoneAddAfter', - 'actionObjectZoneDeleteAfter', - 'actionObjectZoneUpdateAfter', - - 'actionShippingPreferencesPageSave', - - 'actionObjectEmployeeAddAfter', - 'actionObjectEmployeeDeleteAfter', - 'actionObjectEmployeeUpdateAfter', - - 'actionDispatcherBefore', - ]; - - /** - * @var PrestaShop\Module\PsEventbus\DependencyInjection\ServiceContainer + * @var ServiceContainer */ private $serviceContainer; @@ -216,8 +115,6 @@ public function __construct() return; } - require_once __DIR__ . '/vendor/autoload.php'; - if ($this->context->shop === null) { throw new PrestaShopException('No shop context'); } @@ -258,7 +155,7 @@ public function install() return $installer->installDatabaseTables() && parent::install() - && $this->registerHook($this->hookToInstall); + && $this->registerHook($this->getHooks()); } /** @@ -292,7 +189,7 @@ public function getModuleEnv($default = null) } /** - * @return PrestaShop\Module\PsEventbus\DependencyInjection\ServiceContainer + * @return ServiceContainer * * @throws Exception */ @@ -300,7 +197,7 @@ public function getServiceContainer() { if (null === $this->serviceContainer) { // append version number to force cache generation (1.6 Core won't clear it) - $this->serviceContainer = new PrestaShop\Module\PsEventbus\DependencyInjection\ServiceContainer( + $this->serviceContainer = new ServiceContainer( $this->name . str_replace(['.', '-', '+'], '', $this->version), $this->getLocalPath(), $this->getModuleEnv() @@ -320,1436 +217,25 @@ public function getServiceContainer() */ public function getService($serviceName) { - return $this->getServiceContainer()->getService($serviceName); - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectImageDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $image = $parameters['object']; - - if (isset($image->id_product)) { - $synchronizationService->sendLiveSync('products', $image->id_product, 'delete'); - $synchronizationService->insertIncrementalSyncObject( - $image->id_product, - Config::COLLECTION_PRODUCTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectImageAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $image = $parameters['object']; - if (isset($image->id_product)) { - $synchronizationService->sendLiveSync('products', $image->id_product, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $image->id_product, - Config::COLLECTION_PRODUCTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectImageUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $image = $parameters['object']; - if (isset($image->id_product)) { - $synchronizationService->sendLiveSync('products', $image->id_product, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $image->id_product, - Config::COLLECTION_PRODUCTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectLanguageDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $language = $parameters['object']; - if (isset($language->id)) { - $synchronizationService->sendLiveSync('languages', $language->id, 'delete'); - $synchronizationService->insertDeletedObject( - $language->id, - Config::COLLECTION_LANGUAGES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectLanguageAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $language = $parameters['object']; - if (isset($language->id) && isset($language->id_product)) { - $synchronizationService->sendLiveSync('languages', $language->id_product, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $language->id, - Config::COLLECTION_LANGUAGES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectLanguageUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $language = $parameters['object']; - if (isset($language->id) && isset($language->id_product)) { - $synchronizationService->sendLiveSync('languages', $language->id_product, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $language->id, - Config::COLLECTION_LANGUAGES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectManufacturerDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $manufacturer = $parameters['object']; - if (isset($manufacturer->id)) { - $synchronizationService->sendLiveSync('manufacturers', $manufacturer->id, 'delete'); - $synchronizationService->insertDeletedObject( - $manufacturer->id, - Config::COLLECTION_MANUFACTURERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectManufacturerAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $manufacturer = $parameters['object']; - if (isset($manufacturer->id)) { - $synchronizationService->sendLiveSync('manufacturers', $manufacturer->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $manufacturer->id, - Config::COLLECTION_MANUFACTURERS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectManufacturerUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $manufacturer = $parameters['object']; - if (isset($manufacturer->id)) { - $synchronizationService->sendLiveSync('manufacturers', $manufacturer->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $manufacturer->id, - Config::COLLECTION_MANUFACTURERS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectSupplierDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $supplier = $parameters['object']; - if (isset($supplier->id)) { - $synchronizationService->sendLiveSync('suppliers', $supplier->id, 'delete'); - $synchronizationService->insertDeletedObject( - $supplier->id, - Config::COLLECTION_SUPPLIERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectSupplierAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $supplier = $parameters['object']; - if (isset($supplier->id)) { - $synchronizationService->sendLiveSync('suppliers', $supplier->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $supplier->id, - Config::COLLECTION_SUPPLIERS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectSupplierUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $supplier = $parameters['object']; - if (isset($supplier->id)) { - $synchronizationService->sendLiveSync('suppliers', $supplier->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $supplier->id, - Config::COLLECTION_SUPPLIERS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectProductDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $product = $parameters['object']; - - if (isset($product->id)) { - $synchronizationService->sendLiveSync('products', $product->id, 'delete'); - $synchronizationService->insertDeletedObject( - $product->id, - Config::COLLECTION_PRODUCTS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectProductAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $product = $parameters['object']; - if (isset($product->id)) { - $synchronizationService->sendLiveSync('products', $product->id, 'upsert'); - $synchronizationService->sendLiveSync('custom_product_carriers', $product->id, 'upsert'); - $synchronizationService->sendLiveSync('stocks', $product->id, 'upsert'); - - $synchronizationService->insertIncrementalSyncObject( - $product->id, - Config::COLLECTION_PRODUCTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectProductUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var Product $product */ - $product = $parameters['object']; - - if (isset($product->id)) { - $synchronizationService->sendLiveSync('products', $product->id, 'upsert'); - $synchronizationService->sendLiveSync('custom_product_carriers', $product->id, 'upsert'); - $synchronizationService->sendLiveSync('stocks', $product->id, 'upsert'); - - $synchronizationService->insertIncrementalSyncObject( - $product->id, - Config::COLLECTION_PRODUCTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectWishlistDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $wishlist = $parameters['object']; - if (isset($wishlist->id)) { - $synchronizationService->sendLiveSync('wishlists', $wishlist->id, 'delete'); - $synchronizationService->insertDeletedObject( - $wishlist->id, - Config::COLLECTION_WISHLISTS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectWishlistAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $wishlist = $parameters['object']; - if (isset($wishlist->id)) { - $synchronizationService->sendLiveSync('wishlists', $wishlist->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $wishlist->id, - Config::COLLECTION_WISHLISTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectWishlistUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $wishlist = $parameters['object']; - if (isset($wishlist->id)) { - $synchronizationService->sendLiveSync('wishlists', $wishlist->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $wishlist->id, - Config::COLLECTION_WISHLISTS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectStockAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $stock = $parameters['object']; - if (isset($stock->id)) { - $synchronizationService->sendLiveSync('stocks', $stock->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $stock->id, - Config::COLLECTION_STOCKS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectStockUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $stock = $parameters['object']; - if (isset($stock->id)) { - $synchronizationService->sendLiveSync('stocks', $stock->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $stock->id, - Config::COLLECTION_STOCKS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectStoreDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $product = $parameters['object']; - if (isset($product->id)) { - $synchronizationService->sendLiveSync('stores', $product->id, 'delete'); - $synchronizationService->insertDeletedObject( - $product->id, - Config::COLLECTION_STORES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectStoreAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $product = $parameters['object']; - if (isset($product->id)) { - $synchronizationService->sendLiveSync('stores', $product->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $product->id, - Config::COLLECTION_STORES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectStoreUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); + try { + return $this->getServiceContainer()->getService($serviceName); + } catch (ServiceNotFoundException $exception) { + if (method_exists($this, 'get')) { + return $this->get($serviceName); + } - $store = $parameters['object']; - if (isset($store->id)) { - $synchronizationService->sendLiveSync('stores', $store->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $store->id, - Config::COLLECTION_STORES, - date(DATE_ATOM), - $this->shopId, - true - ); + throw new ServiceNotFoundException($serviceName); } } /** - * @param array $parameters + * @param string $serviceName * - * @return void + * @return mixed */ - public function hookActionObjectCombinationDeleteAfter($parameters) + public function hasService($serviceName) { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var Combination $combination */ - $combination = $parameters['object']; - - if (isset($combination->id)) { - $synchronizationService->sendLiveSync('products', $combination->id, 'delete'); - $synchronizationService->insertDeletedObject( - $combination->id, - Config::COLLECTION_PRODUCT_ATTRIBUTES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCategoryAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $category = $parameters['object']; - - if (isset($category->id)) { - $synchronizationService->sendLiveSync('categories', $category->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $category->id, - Config::COLLECTION_CATEGORIES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCategoryUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $category = $parameters['object']; - - if (isset($category->id)) { - $synchronizationService->sendLiveSync('categories', $category->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $category->id, - Config::COLLECTION_CATEGORIES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCategoryDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $category = $parameters['object']; - - if (isset($category->id)) { - $synchronizationService->sendLiveSync('categories', $category->id, 'delete'); - $synchronizationService->insertDeletedObject( - $category->id, - Config::COLLECTION_CATEGORIES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCustomerAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $customer = $parameters['object']; - - if (isset($customer->id)) { - $synchronizationService->sendLiveSync('customers', $customer->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $customer->id, - Config::COLLECTION_CUSTOMERS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCustomerUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $customer = $parameters['object']; - - if (isset($customer->id)) { - $synchronizationService->sendLiveSync('customers', $customer->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $customer->id, - Config::COLLECTION_CUSTOMERS, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCustomerDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $customer = $parameters['object']; - - if (isset($customer->id)) { - $synchronizationService->sendLiveSync('customers', $customer->id, 'delete'); - $synchronizationService->insertDeletedObject( - $customer->id, - Config::COLLECTION_CUSTOMERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCurrencyAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $currency = $parameters['object']; - - if (isset($currency->id)) { - $synchronizationService->sendLiveSync('currencies', $currency->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $currency->id, - Config::COLLECTION_CURRENCIES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCurrencyUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $currency = $parameters['object']; - - if (isset($currency->id)) { - $synchronizationService->sendLiveSync('currencies', $currency->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $currency->id, - Config::COLLECTION_CURRENCIES, - date(DATE_ATOM), - $this->shopId, - true - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCurrencyDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $currency = $parameters['object']; - - if (isset($currency->id)) { - $synchronizationService->sendLiveSync('currencies', $currency->id, 'delete'); - $synchronizationService->insertDeletedObject( - $currency->id, - Config::COLLECTION_CURRENCIES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCartAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $cart = $parameters['object']; - - if (isset($cart->id)) { - $synchronizationService->sendLiveSync('carts', $cart->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $cart->id, - Config::COLLECTION_CARTS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCartUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $cart = $parameters['object']; - - if (isset($cart->id)) { - $synchronizationService->sendLiveSync('carts', $cart->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $cart->id, - Config::COLLECTION_CARTS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCartRuleAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $cartRule = $parameters['object']; - - if (isset($cartRule->id)) { - $synchronizationService->sendLiveSync('cart_rules', $cartRule->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $cartRule->id, - Config::COLLECTION_CART_RULES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCartRuleDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $cartRule = $parameters['object']; - - if (isset($cartRule->id)) { - $synchronizationService->sendLiveSync('cart_rules', $cartRule->id, 'delete'); - $synchronizationService->insertDeletedObject( - $cartRule->id, - Config::COLLECTION_CART_RULES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCartRuleUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $cartRule = $parameters['object']; - - if (isset($cartRule->id)) { - $synchronizationService->sendLiveSync('cart_rules', $cartRule->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $cartRule->id, - Config::COLLECTION_CART_RULES, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectOrderAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $order = $parameters['object']; - - if (isset($order->id)) { - $synchronizationService->sendLiveSync('orders', $order->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $order->id, - Config::COLLECTION_ORDERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectOrderUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $order = $parameters['object']; - - if (isset($order->id)) { - $synchronizationService->sendLiveSync('orders', $order->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $order->id, - Config::COLLECTION_ORDERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCarrierAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var Carrier $carrier */ - $carrier = $parameters['object']; - - if (isset($carrier->id)) { - $synchronizationService->sendLiveSync('carriers', $carrier->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $carrier->id, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCarrierUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var Carrier $carrier */ - $carrier = $parameters['object']; - - if (isset($carrier->id)) { - $synchronizationService->sendLiveSync('carriers', $carrier->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $carrier->id, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectCarrierDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var Carrier $carrier */ - $carrier = $parameters['object']; - - if (isset($carrier->id)) { - $synchronizationService->sendLiveSync('carriers', $carrier->id, 'delete'); - $synchronizationService->insertIncrementalSyncObject( - $carrier->id, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - } - - /** - * @return void - */ - public function hookActionObjectCountryAddAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectCountryUpdateAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectCountryDeleteAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectStateAddAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectStateUpdateAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectStateDeleteAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectZoneAddAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectZoneUpdateAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectZoneDeleteAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectTaxAddAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectTaxUpdateAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectTaxDeleteAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectTaxRulesGroupAddAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectTaxRulesGroupUpdateAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectTaxRulesGroupDeleteAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionShippingPreferencesPageSave() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_CARRIERS, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectEmployeeAddAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_EMPLOYEES, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectEmployeeDeleteAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - $synchronizationService->insertDeletedObject( - 0, - Config::COLLECTION_EMPLOYEES, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * @return void - */ - public function hookActionObjectEmployeeUpdateAfter() - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_EMPLOYEES, - date(DATE_ATOM), - $this->shopId - ); - } - - /** - * This is global hook. This hook is called at the beginning of the dispatch method of the Dispatcher - * It's possible to use this hook all time when we don't have specific hook. - * Available since: 1.7.1 - * - * Unable to use hookActionDispatcherAfter. Seem to be have a strange effect. When i use - * this hook and try to dump() the content, no dump appears in the symfony debugger, and no more hooks appear. - * For security reasons, I like to use the before hook, and put it in a try/catch - * - * @param array $parameters - * - * @return void - */ - public function hookActionDispatcherBefore($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - try { - /* - * Class "ActionDispatcherLegacyHooksSubscriber" as implement in 1.7.3.0: - * https://github.com/PrestaShop/PrestaShop/commit/a4ae4544cc62c818aba8b3d9254308f538b7acdc - */ - if ($parameters['controller_type'] != 2) { - return; - } - - if (array_key_exists('route', $parameters)) { - $route = $parameters['route']; - - // when translation is edited or reset, add to incremental sync - if ($route == 'api_translation_value_edit' || $route == 'api_translation_value_reset') { - $synchronizationService->insertIncrementalSyncObject( - 0, - Config::COLLECTION_TRANSLATIONS, - date(DATE_ATOM), - $this->shopId - ); - } - } - } catch (Exception $e) { - return; - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectSpecificPriceAddAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var SpecificPrice $specificPrice */ - $specificPrice = $parameters['object']; - - if ($specificPrice instanceof SpecificPrice) { - if (isset($specificPrice->id)) { - $synchronizationService->sendLiveSync('specific_prices', $specificPrice->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $specificPrice->id, - Config::COLLECTION_SPECIFIC_PRICES, - date(DATE_ATOM), - $this->shopId - ); - } - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectSpecificPriceUpdateAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var SpecificPrice $specificPrice */ - $specificPrice = $parameters['object']; - - if ($specificPrice instanceof SpecificPrice) { - if (isset($specificPrice->id)) { - $synchronizationService->sendLiveSync('specific_prices', $specificPrice->id, 'upsert'); - $synchronizationService->insertIncrementalSyncObject( - $specificPrice->id, - Config::COLLECTION_SPECIFIC_PRICES, - date(DATE_ATOM), - $this->shopId - ); - } - } - } - - /** - * @param array $parameters - * - * @return void - */ - public function hookActionObjectSpecificPriceDeleteAfter($parameters) - { - /** @var SynchronizationService $synchronizationService * */ - $synchronizationService = $this->getService('PrestaShop\Module\PsEventbus\Service\SynchronizationService'); - - /** @var SpecificPrice $specificPrice */ - $specificPrice = $parameters['object']; - - if ($specificPrice instanceof SpecificPrice) { - if (isset($specificPrice->id)) { - $synchronizationService->sendLiveSync('specific_prices', $specificPrice->id, 'delete'); - $synchronizationService->insertDeletedObject( - $specificPrice->id, - Config::COLLECTION_SPECIFIC_PRICES, - date(DATE_ATOM), - $this->shopId - ); - } - } + return $this->getServiceContainer()->hasService($serviceName); } /** diff --git a/sql/install.sql b/sql/install.sql index 45b38aab..ed2f9b5c 100644 --- a/sql/install.sql +++ b/sql/install.sql @@ -5,7 +5,8 @@ CREATE TABLE IF NOT EXISTS `PREFIX_eventbus_type_sync` `id_shop` INT(10) UNSIGNED NOT NULL, `lang_iso` VARCHAR(3), `full_sync_finished` TINYINT(1) NOT NULL DEFAULT 0, - `last_sync_date` DATETIME NOT NULL + `last_sync_date` DATETIME NOT NULL, + PRIMARY KEY (`type`, `id_shop`, `lang_iso`) ) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8; @@ -16,19 +17,10 @@ CREATE TABLE IF NOT EXISTS `PREFIX_eventbus_job` ) ENGINE = ENGINE_TYPE DEFAULT CHARSET = utf8; -CREATE TABLE IF NOT EXISTS `PREFIX_eventbus_deleted_objects` -( - `type` VARCHAR(50) NOT NULL, - `id_object` INT(10) UNSIGNED NOT NULL, - `id_shop` INT(10) UNSIGNED NOT NULL, - `created_at` DATETIME NOT NULL, - PRIMARY KEY (`type`, `id_object`, `id_shop`) -) ENGINE = ENGINE_TYPE - DEFAULT CHARSET = utf8; - CREATE TABLE IF NOT EXISTS `PREFIX_eventbus_incremental_sync` ( `type` VARCHAR(50) NOT NULL, + `action` VARCHAR(50) NOT NULL, `id_object` INT(10) UNSIGNED NOT NULL, `id_shop` INT(10) UNSIGNED NOT NULL, `lang_iso` VARCHAR(3), diff --git a/sql/migrate.sql b/sql/migrate.sql deleted file mode 100644 index 419720b8..00000000 --- a/sql/migrate.sql +++ /dev/null @@ -1,13 +0,0 @@ -INSERT INTO `PREFIX_eventbus_type_sync` -SELECT * FROM `PREFIX_accounts_type_sync`; - -INSERT INTO `PREFIX_eventbus_deleted_objects` -SELECT * FROM `PREFIX_accounts_deleted_objects`; - -INSERT INTO `PREFIX_eventbus_incremental_sync` -SELECT * FROM `PREFIX_accounts_incremental_sync`; - -DROP TABLE IF EXISTS `PREFIX_accounts_type_sync`; -DROP TABLE IF EXISTS `PREFIX_accounts_deleted_objects`; -DROP TABLE IF EXISTS `PREFIX_accounts_incremental_sync`; -DROP TABLE IF EXISTS `PREFIX_accounts_sync`; \ No newline at end of file diff --git a/sql/uninstall.sql b/sql/uninstall.sql index 436d0d28..38e84e7e 100644 --- a/sql/uninstall.sql +++ b/sql/uninstall.sql @@ -1,5 +1,4 @@ DROP TABLE IF EXISTS `PREFIX_eventbus_type_sync`; DROP TABLE IF EXISTS `PREFIX_eventbus_job`; -DROP TABLE IF EXISTS `PREFIX_eventbus_deleted_objects`; DROP TABLE IF EXISTS `PREFIX_eventbus_incremental_sync`; DROP TABLE IF EXISTS `PREFIX_eventbus_live_sync`; diff --git a/src/Api/CollectorApiClient.php b/src/Api/CollectorApiClient.php index 7d818e7e..7a30065e 100644 --- a/src/Api/CollectorApiClient.php +++ b/src/Api/CollectorApiClient.php @@ -1,4 +1,28 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api; @@ -10,6 +34,10 @@ use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; use Prestashop\ModuleLibGuzzleAdapter\Interfaces\HttpClientInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class CollectorApiClient { /** diff --git a/src/Api/LiveSyncApiClient.php b/src/Api/LiveSyncApiClient.php index 0d31c391..6e026698 100644 --- a/src/Api/LiveSyncApiClient.php +++ b/src/Api/LiveSyncApiClient.php @@ -1,4 +1,28 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api; @@ -8,6 +32,10 @@ use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; use Prestashop\ModuleLibGuzzleAdapter\Interfaces\HttpClientInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class LiveSyncApiClient { /** @@ -66,12 +94,11 @@ private function getClient($timeout = Config::SYNC_API_MAX_TIMEOUT) /** * @param string $shopContent - * @param int $shopContentId * @param string $action * * @return array */ - public function liveSync($shopContent, $shopContentId, $action) + public function liveSync($shopContent, $action) { // shop content send to the API must be in kebab-case $kebabCasedShopContent = str_replace('_', '-', $shopContent); @@ -86,7 +113,7 @@ public function liveSync($shopContent, $shopContentId, $action) 'User-Agent' => 'ps-eventbus/' . $this->module->version, 'Content-Type' => 'application/json', ], - '{"shopContents": ["' . $kebabCasedShopContent . '"], "shopContentId": ' . $shopContentId . ', "action": "' . $action . '"}' + '{"shopContents": ["' . $kebabCasedShopContent . '"], "action": "' . $action . '"}' ) ); diff --git a/src/Api/Post/MultipartBody.php b/src/Api/Post/MultipartBody.php index 898dd0e0..f37cd657 100755 --- a/src/Api/Post/MultipartBody.php +++ b/src/Api/Post/MultipartBody.php @@ -1,4 +1,28 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api\Post; @@ -6,6 +30,10 @@ use GuzzleHttp\Psr7\StreamDecoratorTrait; use Psr\Http\Message\StreamInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Stream that when read returns bytes for a streaming multipart/form-data body */ diff --git a/src/Api/Post/PostFileApi.php b/src/Api/Post/PostFileApi.php index bb9f4a84..ee001f5a 100644 --- a/src/Api/Post/PostFileApi.php +++ b/src/Api/Post/PostFileApi.php @@ -1,9 +1,37 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api\Post; use Psr\Http\Message\StreamInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Post file upload */ diff --git a/src/Api/Post/PostFileInterface.php b/src/Api/Post/PostFileInterface.php index 8d90bb5c..d603dbeb 100755 --- a/src/Api/Post/PostFileInterface.php +++ b/src/Api/Post/PostFileInterface.php @@ -1,9 +1,37 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api\Post; use Psr\Http\Message\StreamInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Post file upload interface */ diff --git a/src/Api/Post/Stream.php b/src/Api/Post/Stream.php index aae58bfd..7fb60cda 100644 --- a/src/Api/Post/Stream.php +++ b/src/Api/Post/Stream.php @@ -1,10 +1,38 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api\Post; use GuzzleHttp\Psr7\PumpStream; use Psr\Http\Message\StreamInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * PHP stream implementation */ diff --git a/src/Api/SyncApiClient.php b/src/Api/SyncApiClient.php index e0b89faa..4b64bfe1 100644 --- a/src/Api/SyncApiClient.php +++ b/src/Api/SyncApiClient.php @@ -1,4 +1,28 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Api; @@ -8,6 +32,10 @@ use Prestashop\ModuleLibGuzzleAdapter\ClientFactory; use Prestashop\ModuleLibGuzzleAdapter\Interfaces\HttpClientInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class SyncApiClient { /** @@ -59,7 +87,7 @@ private function getClient($timeout = Config::SYNC_API_MAX_TIMEOUT) /** * @param string $jobId * - * @return array|bool + * @return array */ public function validateJobId($jobId) { diff --git a/src/Builder/CarrierBuilder.php b/src/Builder/CarrierBuilder.php deleted file mode 100644 index 9139eca2..00000000 --- a/src/Builder/CarrierBuilder.php +++ /dev/null @@ -1,248 +0,0 @@ -carrierRepository = $carrierRepository; - $this->countryRepository = $countryRepository; - $this->stateRepository = $stateRepository; - $this->taxRepository = $taxRepository; - $this->configurationRepository = $configurationRepository; - } - - /** - * @param array $carriers - * @param int $langId - * @param \Currency $currency - * @param string $weightUnit - * - * @return array - * - * @@throws \PrestaShopDatabaseException - * @@throws \PrestaShopException - */ - public function buildCarriers($carriers, $langId, \Currency $currency, $weightUnit) - { - $eventBusCarriers = []; - foreach ($carriers as $carrier) { - $eventBusCarriers[] = $this->buildCarrier( - new \Carrier($carrier['id_carrier'], $langId), - $currency->iso_code, - $weightUnit - ); - } - - $formattedCarriers = []; - /** @var EventBusCarrier $eventBusCarrier */ - foreach ($eventBusCarriers as $eventBusCarrier) { - /** @var array $eventBusCarrierSerialized */ - $eventBusCarrierSerialized = $eventBusCarrier->jsonSerialize(); - $formattedCarriers = array_merge($formattedCarriers, $eventBusCarrierSerialized); - } - - return $formattedCarriers; - } - - /** - * @param \Carrier $carrier - * @param string $currencyIsoCode - * @param string $weightUnit - * - * @return EventBusCarrier - * - * @@throws \PrestaShopDatabaseException - * @@throws \PrestaShopException - */ - public function buildCarrier(\Carrier $carrier, $currencyIsoCode, $weightUnit) - { - $eventBusCarrier = new EventBusCarrier(); - $freeShippingStartsAtPrice = (float) $this->configurationRepository->get('PS_SHIPPING_FREE_PRICE'); - $freeShippingStartsAtWeight = (float) $this->configurationRepository->get('PS_SHIPPING_FREE_WEIGHT'); - $eventBusCarrier->setFreeShippingStartsAtPrice($freeShippingStartsAtPrice); - $eventBusCarrier->setFreeShippingStartsAtWeight($freeShippingStartsAtWeight); - - $eventBusCarrier->setShippingHandling($this->getShippingHandlePrice((bool) $carrier->shipping_handling)); - - $eventBusCarrier - ->setIdCarrier((int) $carrier->id) - ->setIdReference((int) $carrier->id_reference) - ->setName($carrier->name) - ->setTaxesRatesGroupId((int) $carrier->getIdTaxRulesGroup()) - ->setUrl($carrier->url) - ->setActive($carrier->active) - ->setDeleted($carrier->deleted) - ->setDisableCarrierWhenOutOfRange((bool) $carrier->range_behavior) - ->setIsModule($carrier->is_module) - ->setIsFree($carrier->is_free) - ->setShippingExternal($carrier->shipping_external) - ->setNeedRange($carrier->need_range) - ->setExternalModuleName($carrier->external_module_name) - ->setMaxWidth($carrier->max_width) - ->setMaxHeight($carrier->max_height) - ->setMaxDepth($carrier->max_depth) - ->setMaxWeight($carrier->max_weight) - ->setGrade($carrier->grade) - ->setDelay($carrier->delay) - ->setCurrency($currencyIsoCode) - ->setWeightUnit($weightUnit); - - $deliveryPriceByRanges = $this->carrierRepository->getDeliveryPriceByRange($carrier); - - if (!$deliveryPriceByRanges) { - return $eventBusCarrier; - } - - $carrierDetails = []; - $carrierTaxes = []; - foreach ($deliveryPriceByRanges as $deliveryPriceByRange) { - $range = $this->carrierRepository->getCarrierRange($deliveryPriceByRange); - if (!$range) { - continue; - } - foreach ($deliveryPriceByRange['zones'] as $zone) { - $carrierDetail = $this->buildCarrierDetails($carrier, $range, $zone); - if ($carrierDetail) { - $carrierDetails[] = $carrierDetail; - } - - /** @var int $rangeId */ - $rangeId = $range->id; - $carrierTax = $this->buildCarrierTaxes($carrier, $zone['id_zone'], $rangeId); - if ($carrierTax) { - $carrierTaxes[] = $carrierTax; - } - } - } - - $eventBusCarrier->setCarrierDetails($carrierDetails); - $eventBusCarrier->setCarrierTaxes($carrierTaxes); - - return $eventBusCarrier; - } - - /** - * @param \Carrier $carrier - * @param \RangeWeight|\RangePrice $range - * @param array $zone - * - * @return false|CarrierDetail - * - * @@throws \PrestaShopDatabaseException - */ - private function buildCarrierDetails(\Carrier $carrier, $range, $zone) - { - /** @var int $rangeId */ - $rangeId = $range->id; - $carrierDetail = new CarrierDetail(); - $carrierDetail->setShippingMethod($carrier->getRangeTable()); - $carrierDetail->setCarrierDetailId($rangeId); - $carrierDetail->setDelimiter1($range->delimiter1); - $carrierDetail->setDelimiter2($range->delimiter2); - $carrierDetail->setPrice($zone['price']); - $carrierDetail->setCarrierReference($carrier->id_reference); - $carrierDetail->setZoneId($zone['id_zone']); - $carrierDetail->setRangeId($rangeId); - - /** @var array $countryIsoCodes */ - $countryIsoCodes = $this->countryRepository->getCountyIsoCodesByZoneId($zone['id_zone']); - if (!$countryIsoCodes) { - return false; - } - $carrierDetail->setCountryIsoCodes($countryIsoCodes); - - /** @var array $stateIsoCodes */ - $stateIsoCodes = $this->stateRepository->getStateIsoCodesByZoneId($zone['id_zone']); - $carrierDetail->setStateIsoCodes($stateIsoCodes); - - return $carrierDetail; - } - - /** - * @param \Carrier $carrier - * @param int $zoneId - * @param int $rangeId - * - * @return CarrierTax|null - * - * @@throws \PrestaShopDatabaseException - */ - private function buildCarrierTaxes(\Carrier $carrier, $zoneId, $rangeId) - { - $taxRulesGroupId = (int) $carrier->getIdTaxRulesGroup(); - /** @var array $carrierTaxesByZone */ - $carrierTaxesByZone = $this->taxRepository->getCarrierTaxesByZone($zoneId, $taxRulesGroupId); - - if (!$carrierTaxesByZone[0]['country_iso_code']) { - return null; - } - - $carrierTaxesByZone = $carrierTaxesByZone[0]; - - $carrierTax = new CarrierTax(); - $carrierTax->setCarrierReference($carrier->id_reference); - $carrierTax->setRangeId($rangeId); - $carrierTax->setTaxRulesGroupId($taxRulesGroupId); - $carrierTax->setZoneId($zoneId); - $carrierTax->setCountryIsoCode($carrierTaxesByZone['country_iso_code']); - $carrierTax->setStateIsoCodes($carrierTaxesByZone['state_iso_code']); - $carrierTax->setTaxRate($carrierTaxesByZone['rate']); - - return $carrierTax; - } - - /** - * @param bool $shippingHandling - * - * @return float - */ - private function getShippingHandlePrice($shippingHandling) - { - if ($shippingHandling) { - return (float) $this->configurationRepository->get('PS_SHIPPING_HANDLING'); - } - - return 0.0; - } -} diff --git a/src/Config/Config.php b/src/Config/Config.php index bcf698ef..3fc7593d 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -1,12 +1,49 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Config; +if (!defined('_PS_VERSION_')) { + exit; +} + class Config { + const MYSQL_DATE_FORMAT = 'Y-m-d H:i:s'; + + const INCREMENTAL_SYNC_TABLE_SIZE_CHECK_MOD = 20; + const INCREMENTAL_SYNC_MAX_TABLE_SIZE = 100000; + const INCREMENTAL_TYPE_UPSERT = 'upsert'; + const INCREMENTAL_TYPE_DELETE = 'delete'; + const SYNC_API_MAX_TIMEOUT = 5; - const COLLECTOR_MAX_TIMEOUT = 30; + const SYNC_SERVICE_NAME = 'PrestaShop\Module\PsEventbus\Service\SynchronizationService'; + const COLLECTOR_MULTIPART_BOUNDARY = 'ps_eventbus_boundary'; + const REFRESH_TOKEN_ERROR_CODE = 452; const ENV_MISCONFIGURED_ERROR_CODE = 453; const DATABASE_QUERY_ERROR_CODE = 454; @@ -27,48 +64,77 @@ class Config self::PS_ACCOUNTS_NOT_INSTALLED => 'PsAccounts not installed', ]; + const COLLECTION_ATTRIBUTES = 'attributes'; const COLLECTION_BUNDLES = 'bundles'; const COLLECTION_CARRIERS = 'carriers'; + const COLLECTION_CARRIER_DETAILS = 'carrier_details'; + const COLLECTION_CARRIER_TAXES = 'carrier_taxes'; const COLLECTION_CARTS = 'carts'; const COLLECTION_CART_PRODUCTS = 'cart_products'; const COLLECTION_CART_RULES = 'cart_rules'; const COLLECTION_CATEGORIES = 'categories'; const COLLECTION_CURRENCIES = 'currencies'; - const COLLECTION_CUSTOM_PRODUCT_CARRIERS = 'custom_product_carriers'; const COLLECTION_CUSTOMERS = 'customers'; - const COLLECTION_DELETED = 'deleted'; + const COLLECTION_CUSTOM_PRODUCT_CARRIERS = 'custom_product_carriers'; const COLLECTION_EMPLOYEES = 'employees'; const COLLECTION_IMAGES = 'images'; - const COLLECTION_IMAGE_TYPES = 'image_types'; + const COLLECTION_IMAGE_TYPES = 'image_types'; // NO INCREMENTAL const COLLECTION_LANGUAGES = 'languages'; const COLLECTION_MANUFACTURERS = 'manufacturers'; - const COLLECTION_MODULES = 'modules'; + const COLLECTION_MODULES = 'modules'; // NO INCREMENTAL const COLLECTION_ORDERS = 'orders'; const COLLECTION_ORDER_CART_RULES = 'order_cart_rules'; const COLLECTION_ORDER_DETAILS = 'order_details'; const COLLECTION_ORDER_STATUS_HISTORY = 'order_status_history'; const COLLECTION_PRODUCTS = 'products'; - const COLLECTION_PRODUCT_ATTRIBUTES = 'attributes'; const COLLECTION_PRODUCT_SUPPLIERS = 'product_suppliers'; - const COLLECTION_SHOPS = 'shops'; + const COLLECTION_SHOPS = 'shops'; // NO INCREMENTAL const COLLECTION_SPECIFIC_PRICES = 'specific_prices'; const COLLECTION_STOCKS = 'stocks'; - const COLLECTION_STOCK_MVTS = 'stock_movements'; + const COLLECTION_STOCK_MOVEMENTS = 'stock_movements'; const COLLECTION_STORES = 'stores'; const COLLECTION_SUPPLIERS = 'suppliers'; - const COLLECTION_TAXONOMIES = 'taxonomies'; - const COLLECTION_THEMES = 'themes'; + const COLLECTION_TAXONOMIES = 'taxonomies'; // NO INCREMENTAL + const COLLECTION_THEMES = 'themes'; // NO INCREMENTAL const COLLECTION_TRANSLATIONS = 'translations'; const COLLECTION_WISHLISTS = 'wishlists'; const COLLECTION_WISHLIST_PRODUCTS = 'wishlist_products'; - /** - * @param mixed $message - * - * @return void - */ - public static function dev_log($message) - { - file_put_contents('/var/www/html/php.log', $message . PHP_EOL, FILE_APPEND); - } + const SHOP_CONTENTS = [ + self::COLLECTION_ATTRIBUTES, + self::COLLECTION_BUNDLES, + self::COLLECTION_CARRIERS, + self::COLLECTION_CARRIER_DETAILS, + self::COLLECTION_CARRIER_TAXES, + self::COLLECTION_CARTS, + self::COLLECTION_CART_PRODUCTS, + self::COLLECTION_CART_RULES, + self::COLLECTION_CATEGORIES, + self::COLLECTION_CURRENCIES, + self::COLLECTION_CUSTOMERS, + self::COLLECTION_EMPLOYEES, + self::COLLECTION_IMAGES, + self::COLLECTION_IMAGE_TYPES, + self::COLLECTION_LANGUAGES, + self::COLLECTION_MANUFACTURERS, + self::COLLECTION_MODULES, + self::COLLECTION_ORDERS, + self::COLLECTION_ORDER_CART_RULES, + self::COLLECTION_ORDER_DETAILS, + self::COLLECTION_ORDER_STATUS_HISTORY, + self::COLLECTION_PRODUCTS, + self::COLLECTION_CUSTOM_PRODUCT_CARRIERS, + self::COLLECTION_PRODUCT_SUPPLIERS, + self::COLLECTION_SHOPS, + self::COLLECTION_SPECIFIC_PRICES, + self::COLLECTION_STOCKS, + self::COLLECTION_STOCK_MOVEMENTS, + self::COLLECTION_STORES, + self::COLLECTION_SUPPLIERS, + self::COLLECTION_TAXONOMIES, + self::COLLECTION_THEMES, + self::COLLECTION_TRANSLATIONS, + self::COLLECTION_WISHLISTS, + self::COLLECTION_WISHLIST_PRODUCTS, + ]; } diff --git a/src/Controller/AbstractApiController.php b/src/Controller/AbstractApiController.php deleted file mode 100644 index e5b34bf8..00000000 --- a/src/Controller/AbstractApiController.php +++ /dev/null @@ -1,360 +0,0 @@ -ajax = true; - $this->content_only = true; - $this->controller_type = 'module'; - - $this->errorHandler = $this->module->getService(ErrorHandler::class); - try { - $this->psAccountsAdapterService = $this->module->getService(PsAccountsAdapterService::class); - $this->proxyService = $this->module->getService(ProxyService::class); - $this->authorizationService = $this->module->getService(ApiAuthorizationService::class); - $this->synchronizationService = $this->module->getService(SynchronizationService::class); - } catch (\Exception $exception) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } - - $this->eventbusSyncRepository = $this->module->getService(EventbusSyncRepository::class); - $this->languageRepository = $this->module->getService(LanguageRepository::class); - $this->incrementalSyncRepository = $this->module->getService(IncrementalSyncRepository::class); - } - - /** - * @return bool|void - * - * @throws UnauthorizedException - */ - public function init() - { - $this->startTime = time(); - - try { - $this->authorize(); - } catch (\Exception $exception) { - // For ApiHealthCheck, handle the error, and throw UnauthorizedException directly, to catch-up at top level. - if (strpos($this->page_name, 'apiHealthCheck') !== false) { - $this->errorHandler->handle($exception); - throw new UnauthorizedException('You are not allowed to access to this resource'); - } - - if ($exception instanceof \PrestaShopDatabaseException) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } elseif ($exception instanceof EnvVarException) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } elseif ($exception instanceof FirebaseException) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } - } - } - - /** - * @return void - * - * @throws \PrestaShopDatabaseException|EnvVarException|FirebaseException - */ - private function authorize() - { - /** @var string $jobId */ - $jobId = \Tools::getValue('job_id', 'empty_job_id'); - - $authorizationResponse = $this->authorizationService->authorizeCall($jobId); - - if (is_array($authorizationResponse)) { - $this->exitWithResponse($authorizationResponse); - } elseif (!$authorizationResponse) { - throw new \PrestaShopDatabaseException('Failed saving job id to database'); - } - - try { - $token = $this->psAccountsAdapterService->getOrRefreshToken(); - } catch (\Exception $exception) { - throw new FirebaseException($exception->getMessage()); - } - - if (!$token) { - throw new FirebaseException('Invalid token'); - } - } - - /** - * @param PaginatedApiDataProviderInterface $dataProvider - * - * @return array - */ - protected function handleDataSync(PaginatedApiDataProviderInterface $dataProvider) - { - /** @var bool $debug */ - $debug = \Tools::getValue('debug') == 1; - - /** @var string $jobId */ - $jobId = \Tools::getValue('job_id'); - /** @var string $langIso */ - $langIso = \Tools::getValue('lang_iso', $this->languageRepository->getDefaultLanguageIsoCode()); - /** @var int $limit */ - $limit = \Tools::getValue('limit', 50); - - if ($limit < 0) { - $this->exitWithExceptionMessage(new QueryParamsException('Invalid URL Parameters', Config::INVALID_URL_QUERY)); - } - - /** @var bool $initFullSync */ - $initFullSync = \Tools::getValue('full', 0) == 1; - - /** @var \PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository $configurationRepository */ - $configurationRepository = $this->module->getService(\PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository::class); - $timezone = (string) $configurationRepository->get('PS_TIMEZONE'); - - $dateNow = (new \DateTime('now', new \DateTimeZone($timezone)))->format(MYSQL_DATE_FORMAT); - $offset = 0; - $incrementalSync = false; - $response = []; - - try { - $typeSync = $this->eventbusSyncRepository->findTypeSync($this->type, $langIso); - - if ($debug) { - $response = $dataProvider->getQueryForDebug($offset, $limit, $langIso); - - return array_merge( - [ - 'object_type' => $this->type, - ], - $response - ); - } - - if ($typeSync !== false && is_array($typeSync)) { - $offset = (int) $typeSync['offset']; - - if ((int) $typeSync['full_sync_finished'] === 1 && !$initFullSync) { - $incrementalSync = true; - } elseif ($initFullSync) { - $offset = 0; - $this->eventbusSyncRepository->updateTypeSync( - $this->type, - $offset, - $dateNow, - false, - $langIso - ); - - $this->incrementalSyncRepository->removeIncrementaSyncObjectByType($this->type); - } - } else { - $this->eventbusSyncRepository->insertTypeSync($this->type, $offset, $dateNow, $langIso); - } - - if ($incrementalSync) { - $response = $this->synchronizationService->handleIncrementalSync( - $dataProvider, - $this->type, - $jobId, - $limit, - $langIso, - $this->startTime, - $initFullSync - ); - } else { - $response = $this->synchronizationService->handleFullSync( - $dataProvider, - $this->type, - $jobId, - $langIso, - $offset, - $limit, - $dateNow, - $this->startTime, - $initFullSync - ); - } - - return array_merge( - [ - 'job_id' => $jobId, - 'object_type' => $this->type, - 'syncType' => $incrementalSync ? 'incremental' : 'full', - ], - $response - ); - } catch (\PrestaShopDatabaseException $exception) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } catch (EnvVarException $exception) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } catch (FirebaseException $exception) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } catch (\Exception $exception) { - $this->errorHandler->handle($exception); - $this->exitWithExceptionMessage($exception); - } - - return $response; - } - - /** - * @param array|null $value - * @param string|null $controller - * @param string|null $method - * - * @return void - * - * @throws \PrestaShopException - */ - public function ajaxDie($value = null, $controller = null, $method = null) - { - parent::ajaxDie(json_encode($value) ?: null, $controller, $method); - } - - /** - * @param array $response - * - * @return void - */ - protected function exitWithResponse($response) - { - $httpCode = isset($response['httpCode']) ? (int) $response['httpCode'] : 200; - - $this->dieWithResponse($response, $httpCode); - } - - /** - * @param \Exception $exception - * - * @return void - */ - protected function exitWithExceptionMessage(\Exception $exception) - { - $code = $exception->getCode() == 0 ? 500 : $exception->getCode(); - - if ($exception instanceof \PrestaShopDatabaseException) { - $code = Config::DATABASE_QUERY_ERROR_CODE; - } elseif ($exception instanceof EnvVarException) { - $code = Config::ENV_MISCONFIGURED_ERROR_CODE; - } elseif ($exception instanceof FirebaseException) { - $code = Config::REFRESH_TOKEN_ERROR_CODE; - } elseif ($exception instanceof QueryParamsException) { - $code = Config::INVALID_URL_QUERY; - } - - $response = [ - 'object_type' => $this->type, - 'status' => false, - 'httpCode' => $code, - 'message' => $exception->getMessage(), - ]; - - $this->dieWithResponse($response, (int) $code); - } - - /** - * @param array $response - * @param int $code - * - * @return void - */ - private function dieWithResponse($response, $code) - { - $httpStatusText = "HTTP/1.1 $code"; - - if (array_key_exists((int) $code, Config::HTTP_STATUS_MESSAGES)) { - $httpStatusText .= ' ' . Config::HTTP_STATUS_MESSAGES[(int) $code]; - } elseif (isset($response['body']['statusText'])) { - $httpStatusText .= ' ' . $response['body']['statusText']; - } - - $response['httpCode'] = (int) $code; - - header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); - header('Content-Type: application/json;charset=utf-8'); - header($httpStatusText); - - echo json_encode($response, JSON_UNESCAPED_SLASHES); - - exit; - } -} diff --git a/src/DTO/Carrier.php b/src/DTO/Carrier.php deleted file mode 100644 index 7f8e5976..00000000 --- a/src/DTO/Carrier.php +++ /dev/null @@ -1,731 +0,0 @@ -collection; - } - - /** - * @return int - */ - public function getIdCarrier() - { - return $this->idCarrier; - } - - /** - * @param int $idCarrier - * - * @return Carrier - */ - public function setIdCarrier($idCarrier) - { - $this->idCarrier = $idCarrier; - - return $this; - } - - /** - * @return int - */ - public function getIdReference() - { - return $this->idReference; - } - - /** - * @param int $idReference - * - * @return Carrier - */ - public function setIdReference($idReference) - { - $this->idReference = $idReference; - - return $this; - } - - /** - * @return int - */ - public function getTaxesRatesGroupId() - { - return $this->taxesRatesGroupId; - } - - /** - * @param int $taxesRatesGroupId - * - * @return Carrier - */ - public function setTaxesRatesGroupId($taxesRatesGroupId) - { - $this->taxesRatesGroupId = $taxesRatesGroupId; - - return $this; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - * - * @return Carrier - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - /** - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * @param string $url - * - * @return Carrier - */ - public function setUrl($url) - { - $this->url = $url; - - return $this; - } - - /** - * @return bool - */ - public function isActive() - { - return $this->active; - } - - /** - * @param bool $active - * - * @return Carrier - */ - public function setActive($active) - { - $this->active = $active; - - return $this; - } - - /** - * @return bool - */ - public function isDeleted() - { - return $this->deleted; - } - - /** - * @param bool $deleted - * - * @return Carrier - */ - public function setDeleted($deleted) - { - $this->deleted = $deleted; - - return $this; - } - - /** - * @return float - */ - public function getShippingHandling() - { - return $this->shippingHandling; - } - - /** - * @param float $shippingHandling - * - * @return Carrier - */ - public function setShippingHandling($shippingHandling) - { - $this->shippingHandling = $shippingHandling; - - return $this; - } - - /** - * @return float - */ - public function getFreeShippingStartsAtPrice() - { - return $this->freeShippingStartsAtPrice; - } - - /** - * @param float $freeShippingStartsAtPrice - * - * @return Carrier - */ - public function setFreeShippingStartsAtPrice($freeShippingStartsAtPrice) - { - $this->freeShippingStartsAtPrice = $freeShippingStartsAtPrice; - - return $this; - } - - /** - * @return float - */ - public function getFreeShippingStartsAtWeight() - { - return $this->freeShippingStartsAtWeight; - } - - /** - * @param float $freeShippingStartsAtWeight - * - * @return Carrier - */ - public function setFreeShippingStartsAtWeight($freeShippingStartsAtWeight) - { - $this->freeShippingStartsAtWeight = $freeShippingStartsAtWeight; - - return $this; - } - - /** - * @return bool - */ - public function isDisableCarrierWhenOutOfRange() - { - return $this->disableCarrierWhenOutOfRange; - } - - /** - * @param bool $disableCarrierWhenOutOfRange - * - * @return Carrier - */ - public function setDisableCarrierWhenOutOfRange($disableCarrierWhenOutOfRange) - { - $this->disableCarrierWhenOutOfRange = $disableCarrierWhenOutOfRange; - - return $this; - } - - /** - * @return bool - */ - public function isModule() - { - return $this->isModule; - } - - /** - * @param bool $isModule - * - * @return Carrier - */ - public function setIsModule($isModule) - { - $this->isModule = $isModule; - - return $this; - } - - /** - * @return bool - */ - public function isFree() - { - return $this->isFree; - } - - /** - * @param bool $isFree - * - * @return Carrier - */ - public function setIsFree($isFree) - { - $this->isFree = $isFree; - - return $this; - } - - /** - * @return bool - */ - public function isShippingExternal() - { - return $this->shippingExternal; - } - - /** - * @param bool $shippingExternal - * - * @return Carrier - */ - public function setShippingExternal($shippingExternal) - { - $this->shippingExternal = $shippingExternal; - - return $this; - } - - /** - * @return bool - */ - public function isNeedRange() - { - return $this->needRange; - } - - /** - * @param bool $needRange - * - * @return Carrier - */ - public function setNeedRange($needRange) - { - $this->needRange = $needRange; - - return $this; - } - - /** - * @return string - */ - public function getExternalModuleName() - { - return $this->externalModuleName; - } - - /** - * @param string $externalModuleName - * - * @return Carrier - */ - public function setExternalModuleName($externalModuleName) - { - $this->externalModuleName = $externalModuleName; - - return $this; - } - - /** - * @return float - */ - public function getMaxWidth() - { - return $this->maxWidth; - } - - /** - * @param float $maxWidth - * - * @return Carrier - */ - public function setMaxWidth($maxWidth) - { - $this->maxWidth = $maxWidth; - - return $this; - } - - /** - * @return float - */ - public function getMaxHeight() - { - return $this->maxHeight; - } - - /** - * @param float $maxHeight - * - * @return Carrier - */ - public function setMaxHeight($maxHeight) - { - $this->maxHeight = $maxHeight; - - return $this; - } - - /** - * @return float - */ - public function getMaxDepth() - { - return $this->maxDepth; - } - - /** - * @param float $maxDepth - * - * @return Carrier - */ - public function setMaxDepth($maxDepth) - { - $this->maxDepth = $maxDepth; - - return $this; - } - - /** - * @return float - */ - public function getMaxWeight() - { - return $this->maxWeight; - } - - /** - * @param float $maxWeight - * - * @return Carrier - */ - public function setMaxWeight($maxWeight) - { - $this->maxWeight = $maxWeight; - - return $this; - } - - /** - * @return int - */ - public function getGrade() - { - return $this->grade; - } - - /** - * @param int $grade - * - * @return Carrier - */ - public function setGrade($grade) - { - $this->grade = $grade; - - return $this; - } - - /** - * @return string - */ - public function getDelay() - { - return $this->delay; - } - - /** - * @param string $delay - * - * @return Carrier - */ - public function setDelay($delay) - { - $this->delay = $delay; - - return $this; - } - - /** - * @return string - */ - public function getCurrency() - { - return $this->currency; - } - - /** - * @param string $currency - * - * @return Carrier - */ - public function setCurrency($currency) - { - $this->currency = $currency; - - return $this; - } - - /** - * @return string - */ - public function getWeightUnit() - { - return $this->weightUnit; - } - - /** - * @param string $weightUnit - * - * @return Carrier - */ - public function setWeightUnit($weightUnit) - { - $this->weightUnit = $weightUnit; - - return $this; - } - - /** - * @return CarrierDetail[] - */ - public function getCarrierDetails() - { - return $this->carrierDetails; - } - - /** - * @param CarrierDetail[] $carrierDetails - * - * @return Carrier - */ - public function setCarrierDetails($carrierDetails) - { - $this->carrierDetails = $carrierDetails; - - return $this; - } - - /** - * @return CarrierTax[] - */ - public function getCarrierTaxes() - { - return $this->carrierTaxes; - } - - /** - * @param CarrierTax[] $carrierTaxes - * - * @return Carrier - */ - public function setCarrierTaxes($carrierTaxes) - { - $this->carrierTaxes = $carrierTaxes; - - return $this; - } - - public function jsonSerialize() - { - /* - * Hide this, the time to fix it - * otherwise the HTML in the JSON will cause the request to be discarded cloud-side: - * - *
- * Warning: Array to string conversion in /var/www/html/modules/ps_eventbus/src/DTO/Carrier.php on line 724
- * - * Which at the time of this writing correspond to this line: - * 'delay' => (string) $this->getDelay(), - * - * @TODO clean this up please. - */ - error_reporting(E_ALL ^ E_WARNING); - - $return = []; - - $return[] = [ - 'collection' => $this->getCollection(), - 'id' => (string) $this->getIdReference(), - 'properties' => [ - 'id_carrier' => (string) $this->getIdCarrier(), - 'id_reference' => (string) $this->getIdReference(), - 'name' => (string) $this->getName(), - 'carrier_taxes_rates_group_id' => (string) $this->getTaxesRatesGroupId(), - 'url' => (string) $this->getUrl(), - 'active' => (bool) $this->isActive(), - 'deleted' => (bool) $this->isDeleted(), - 'shipping_handling' => (float) $this->getShippingHandling(), - 'free_shipping_starts_at_price' => (float) $this->getFreeShippingStartsAtPrice(), - 'free_shipping_starts_at_weight' => (float) $this->getFreeShippingStartsAtWeight(), - 'disable_carrier_when_out_of_range' => (bool) $this->isDisableCarrierWhenOutOfRange(), - 'is_module' => (bool) $this->isModule(), - 'is_free' => (bool) $this->isFree(), - 'shipping_external' => (bool) $this->isShippingExternal(), - 'need_range' => (bool) $this->isNeedRange(), - 'external_module_name' => (string) $this->getExternalModuleName(), - 'max_width' => (float) $this->getMaxWidth(), - 'max_height' => (float) $this->getMaxHeight(), - 'max_depth' => (float) $this->getMaxDepth(), - 'max_weight' => (float) $this->getMaxWeight(), - 'grade' => (int) $this->getGrade(), - 'delay' => (string) $this->getDelay(), - 'currency' => (string) $this->getCurrency(), - 'weight_unit' => (string) $this->getWeightUnit(), - ], - ]; - - $carrierDetails = []; - foreach ($this->getCarrierDetails() as $carrierDetail) { - $carrierDetails[] = $carrierDetail->jsonSerialize(); - } - - $carrierTaxRates = []; - foreach ($this->getCarrierTaxes() as $carrierTax) { - $carrierTaxRates[] = $carrierTax->jsonSerialize(); - } - - return array_merge($return, $carrierDetails, $carrierTaxRates); - } -} diff --git a/src/DTO/CarrierDetail.php b/src/DTO/CarrierDetail.php deleted file mode 100644 index 4fc71145..00000000 --- a/src/DTO/CarrierDetail.php +++ /dev/null @@ -1,292 +0,0 @@ - - */ - private $countryIsoCodes; - - /** - * @var array - */ - private $stateIsoCodes; - - /** - * @var float - */ - private $price; - - /** - * @return string - */ - public function getCollection() - { - return $this->collection; - } - - /** - * @return string|bool - */ - public function getShippingMethod() - { - return $this->shippingMethod; - } - - /** - * @param bool|string $shippingMethod - * - * @return CarrierDetail - */ - public function setShippingMethod($shippingMethod) - { - $this->shippingMethod = $shippingMethod; - - return $this; - } - - /** - * @return int - */ - public function getCarrierReference() - { - return $this->carrierReference; - } - - /** - * @param int $carrierReference - * - * @return CarrierDetail - */ - public function setCarrierReference($carrierReference) - { - $this->carrierReference = $carrierReference; - - return $this; - } - - /** - * @return int - */ - public function getCarrierDetailId() - { - return $this->CarrierDetailId; - } - - /** - * @param int $CarrierDetailId - * - * @return CarrierDetail - */ - public function setCarrierDetailId($CarrierDetailId) - { - $this->CarrierDetailId = $CarrierDetailId; - - return $this; - } - - /** - * @return int - */ - public function getZoneId() - { - return $this->zoneId; - } - - /** - * @param int $zoneId - * - * @return CarrierDetail - */ - public function setZoneId($zoneId) - { - $this->zoneId = $zoneId; - - return $this; - } - - /** - * @return int - */ - public function getRangeId() - { - return $this->rangeId; - } - - /** - * @param int $rangeId - * - * @return CarrierDetail - */ - public function setRangeId($rangeId) - { - $this->rangeId = $rangeId; - - return $this; - } - - /** - * @return float - */ - public function getDelimiter1() - { - return $this->delimiter1; - } - - /** - * @param float $delimiter1 - * - * @return CarrierDetail - */ - public function setDelimiter1($delimiter1) - { - $this->delimiter1 = $delimiter1; - - return $this; - } - - /** - * @return float - */ - public function getDelimiter2() - { - return $this->delimiter2; - } - - /** - * @param float $delimiter2 - * - * @return CarrierDetail - */ - public function setDelimiter2($delimiter2) - { - $this->delimiter2 = $delimiter2; - - return $this; - } - - /** - * @return array - */ - public function getCountryIsoCodes() - { - return $this->countryIsoCodes; - } - - /** - * @param array $countryIsoCodes - * - * @return CarrierDetail - */ - public function setCountryIsoCodes($countryIsoCodes) - { - $this->countryIsoCodes = $countryIsoCodes; - - return $this; - } - - /** - * @return array - */ - public function getStateIsoCodes() - { - return $this->stateIsoCodes; - } - - /** - * @param array $stateIsoCodes - * - * @return CarrierDetail - */ - public function setStateIsoCodes($stateIsoCodes) - { - $this->stateIsoCodes = $stateIsoCodes; - - return $this; - } - - /** - * @return float - */ - public function getPrice() - { - return $this->price; - } - - /** - * @param float $price - * - * @return CarrierDetail - */ - public function setPrice($price) - { - $this->price = $price; - - return $this; - } - - public function jsonSerialize() - { - $countryIds = implode(',', $this->getCountryIsoCodes()); - $stateIds = implode(',', $this->getStateIsoCodes()); - - return [ - 'collection' => $this->getCollection(), - 'id' => $this->getCarrierReference() . '-' . $this->getZoneId() . '-' . $this->getShippingMethod() . '-' . $this->getRangeId(), - 'properties' => [ - 'id_reference' => (string) $this->getCarrierReference(), - 'id_zone' => (string) $this->getZoneId(), - 'id_range' => (string) $this->getRangeId(), - 'id_carrier_detail' => (string) $this->getCarrierDetailId(), - 'shipping_method' => (string) $this->getShippingMethod(), - 'delimiter1' => (float) $this->getDelimiter1(), - 'delimiter2' => (float) $this->getDelimiter2(), - 'country_ids' => (string) $countryIds, - 'state_ids' => (string) $stateIds, - 'price' => (float) $this->getPrice(), - ], - ]; - } -} diff --git a/src/DTO/CarrierTax.php b/src/DTO/CarrierTax.php deleted file mode 100644 index 648f062e..00000000 --- a/src/DTO/CarrierTax.php +++ /dev/null @@ -1,211 +0,0 @@ -collection; - } - - /** - * @return int - */ - public function getCarrierReference() - { - return $this->carrierReference; - } - - /** - * @param int $carrierReference - * - * @return CarrierTax - */ - public function setCarrierReference($carrierReference) - { - $this->carrierReference = $carrierReference; - - return $this; - } - - /** - * @return int - */ - public function getRangeId() - { - return $this->rangeId; - } - - /** - * @param int $rangeId - * - * @return CarrierTax - */ - public function setRangeId($rangeId) - { - $this->rangeId = $rangeId; - - return $this; - } - - /** - * @return int - */ - public function getTaxRulesGroupId() - { - return $this->taxRulesGroupId; - } - - /** - * @param int $taxRulesGroupId - * - * @return CarrierTax - */ - public function setTaxRulesGroupId($taxRulesGroupId) - { - $this->taxRulesGroupId = $taxRulesGroupId; - - return $this; - } - - /** - * @return int - */ - public function getZoneId() - { - return $this->zoneId; - } - - /** - * @param int $zoneId - * - * @return CarrierTax - */ - public function setZoneId($zoneId) - { - $this->zoneId = $zoneId; - - return $this; - } - - /** - * @return string - */ - public function getCountryIsoCode() - { - return $this->countryIsoCode; - } - - /** - * @param string $countryIsoCode - * - * @return CarrierTax - */ - public function setCountryIsoCode($countryIsoCode) - { - $this->countryIsoCode = $countryIsoCode; - - return $this; - } - - /** - * @return string - */ - public function getStateIsoCodes() - { - return $this->stateIsoCodes; - } - - /** - * @param string $stateIsoCodes - * - * @return CarrierTax - */ - public function setStateIsoCodes($stateIsoCodes) - { - $this->stateIsoCodes = $stateIsoCodes; - - return $this; - } - - /** - * @return float - */ - public function getTaxRate() - { - return $this->taxRate; - } - - /** - * @param float $taxRate - * - * @return CarrierTax - */ - public function setTaxRate($taxRate) - { - $this->taxRate = $taxRate; - - return $this; - } - - public function jsonSerialize() - { - return [ - 'collection' => $this->getCollection(), - 'id' => $this->getCarrierReference() . '-' . $this->getZoneId() . '-' . $this->getRangeId(), - 'properties' => [ - 'id_reference' => (string) $this->getCarrierReference(), - 'id_zone' => (string) $this->getZoneId(), - 'id_range' => (string) $this->getRangeId(), - 'id_carrier_tax' => (string) $this->getTaxRulesGroupId(), - 'country_id' => (string) $this->getCountryIsoCode(), - 'state_ids' => (string) $this->getStateIsoCodes(), - 'tax_rate' => (float) $this->getTaxRate(), - ], - ]; - } -} diff --git a/src/Decorator/CategoryDecorator.php b/src/Decorator/CategoryDecorator.php deleted file mode 100644 index 3842692d..00000000 --- a/src/Decorator/CategoryDecorator.php +++ /dev/null @@ -1,40 +0,0 @@ - $categories - * - * @return void - */ - public function decorateCategories(&$categories) - { - foreach ($categories as &$category) { - $this->castPropertyValues($category); - $this->formatDescription($category); - } - } - - /** - * @param array $category - * - * @return void - */ - private function castPropertyValues(&$category) - { - $category['id_category'] = (int) $category['id_category']; - $category['id_parent'] = (int) $category['id_parent']; - } - - /** - * @param array $category - * - * @return void - */ - private function formatDescription(&$category) - { - $category['description'] = base64_encode($category['description']); - } -} diff --git a/src/Decorator/CurrencyDecorator.php b/src/Decorator/CurrencyDecorator.php deleted file mode 100644 index 64060be8..00000000 --- a/src/Decorator/CurrencyDecorator.php +++ /dev/null @@ -1,36 +0,0 @@ - $currencies - * - * @return void - */ - public function decorateCurrencies(&$currencies) - { - foreach ($currencies as &$currency) { - $this->castPropertyValues($currency); - } - } - - /** - * @param array $currency - * - * @return void - */ - private function castPropertyValues(&$currency) - { - $currency['id_currency'] = (int) $currency['id_currency']; - $currency['conversion_rate'] = (float) $currency['conversion_rate']; - $currency['deleted'] = (bool) $currency['deleted']; - $currency['active'] = (bool) $currency['active']; - - // https://github.com/PrestaShop/PrestaShop/commit/37807f66b40b0cebb365ef952e919be15e9d6b2f#diff-3f41d3529ffdbfd1b994927eb91826a32a0560697025a734cf128a2c8e092a45R124 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.6.0', '>=')) { - $currency['precision'] = (int) $currency['precision']; - } - } -} diff --git a/src/Decorator/CustomPriceDecorator.php b/src/Decorator/CustomPriceDecorator.php deleted file mode 100644 index 0f91454a..00000000 --- a/src/Decorator/CustomPriceDecorator.php +++ /dev/null @@ -1,138 +0,0 @@ -context = $context; - $this->priceService = $priceService; - } - - /** - * @param array $specificPrices - * - * @return void - */ - public function decorateSpecificPrices(&$specificPrices) - { - foreach ($specificPrices as &$specificPrice) { - $this->addTotalPrice($specificPrice); - $this->setShopId($specificPrice); - $this->castPropertyValues($specificPrice); - } - } - - /** - * @param array $specificPrice - * - * @return void - */ - private function addTotalPrice(&$specificPrice) - { - $this->context->country = new \Country($specificPrice['id_country']); - $this->context->currency = new \Currency($specificPrice['id_currency']); - - $specificPrice['price_tax_included'] = $this->priceService->getSpecificProductPrice( - $specificPrice['id_product'], - $specificPrice['id_product_attribute'], - $specificPrice['id_specific_price'], - true, - false, - $this->context - ); - - $specificPrice['price_tax_excluded'] = $this->priceService->getSpecificProductPrice( - $specificPrice['id_product'], - $specificPrice['id_product_attribute'], - $specificPrice['id_specific_price'], - false, - false, - $this->context - ); - $specificPrice['sale_price_tax_incl'] = $this->priceService->getSpecificProductPrice( - $specificPrice['id_product'], - $specificPrice['id_product_attribute'], - $specificPrice['id_specific_price'], - true, - true, - $this->context - ); - $specificPrice['sale_price_tax_excl'] = $this->priceService->getSpecificProductPrice( - $specificPrice['id_product'], - $specificPrice['id_product_attribute'], - $specificPrice['id_specific_price'], - false, - true, - $this->context - ); - } - - /** - * @param array $specificPrice - * - * @return void - */ - private function castPropertyValues(&$specificPrice) - { - $specificPrice['id_specific_price'] = (int) $specificPrice['id_specific_price']; - $specificPrice['id_product'] = (int) $specificPrice['id_product']; - $specificPrice['id_shop'] = (int) $specificPrice['id_shop']; - $specificPrice['id_group'] = (int) $specificPrice['id_group']; - $specificPrice['id_shop_group'] = (int) $specificPrice['id_shop_group']; - $specificPrice['id_product_attribute'] = (int) $specificPrice['id_product_attribute']; - $specificPrice['price'] = (float) $specificPrice['price']; - $specificPrice['from_quantity'] = (int) $specificPrice['from_quantity']; - $specificPrice['reduction'] = (float) $specificPrice['reduction']; - $specificPrice['reduction_tax'] = (int) $specificPrice['reduction_tax']; - $specificPrice['id_currency'] = (int) $specificPrice['id_currency']; - $specificPrice['id_country'] = (int) $specificPrice['id_country']; - $specificPrice['id_customer'] = (int) $specificPrice['id_customer']; - $specificPrice['currency'] = $specificPrice['currency'] ?: 'ALL'; - $specificPrice['country'] = $specificPrice['country'] ?: 'ALL'; - $specificPrice['price_tax_included'] = (float) $specificPrice['price_tax_included']; - $specificPrice['price_tax_excluded'] = (float) $specificPrice['price_tax_excluded']; - $specificPrice['sale_price_tax_incl'] = (float) $specificPrice['sale_price_tax_incl']; - $specificPrice['sale_price_tax_excl'] = (float) $specificPrice['sale_price_tax_excl']; - - if ($specificPrice['reduction_type'] === 'percentage') { - $specificPrice['discount_percentage'] = $specificPrice['reduction'] * 100; - $specificPrice['discount_value_tax_incl'] = 0.0; - $specificPrice['discount_value_tax_excl'] = 0.0; - } else { - $specificPrice['discount_percentage'] = 0; - $specificPrice['discount_value_tax_incl'] = $specificPrice['price_tax_included'] - $specificPrice['sale_price_tax_incl']; - $specificPrice['discount_value_tax_excl'] = $specificPrice['price_tax_excluded'] - $specificPrice['sale_price_tax_excl']; - } - } - - /** - * @param array $specificPrice - * - * @return void - */ - private function setShopId(&$specificPrice) - { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - if ($specificPrice['id_shop']) { - $specificPrice['id_shop'] = $this->context->shop->id; - } - } -} diff --git a/src/Decorator/CustomerDecorator.php b/src/Decorator/CustomerDecorator.php deleted file mode 100644 index 97cc6eea..00000000 --- a/src/Decorator/CustomerDecorator.php +++ /dev/null @@ -1,47 +0,0 @@ - $customers - * - * @return void - */ - public function decorateCustomers(&$customers) - { - foreach ($customers as &$customer) { - $this->castPropertyValues($customer); - $this->hashEmail($customer); - } - } - - /** - * @param array $customer - * - * @return void - */ - private function castPropertyValues(&$customer) - { - $customer['id_customer'] = (int) $customer['id_customer']; - $customer['id_lang'] = (int) $customer['id_lang']; - $customer['newsletter'] = (bool) $customer['newsletter']; - $customer['newsletter_date_add'] = (string) $customer['newsletter_date_add']; - $customer['optin'] = (bool) $customer['optin']; - $customer['active'] = (bool) $customer['active']; - $customer['is_guest'] = (bool) $customer['is_guest']; - $customer['deleted'] = (bool) $customer['deleted']; - } - - /** - * @param array $customer - * - * @return void - */ - private function hashEmail(&$customer) - { - $customer['email_hash'] = hash('sha256', $customer['email'] . 'dUj4GMBD6689pL9pyr'); - unset($customer['email']); - } -} diff --git a/src/Decorator/EmployeeDecorator.php b/src/Decorator/EmployeeDecorator.php deleted file mode 100644 index 46d89006..00000000 --- a/src/Decorator/EmployeeDecorator.php +++ /dev/null @@ -1,67 +0,0 @@ - $employees - * - * @return void - */ - public function decorateEmployees(&$employees) - { - foreach ($employees as &$employee) { - $this->castPropertyValues($employee); - $this->hashEmail($employee); - } - } - - /** - * @param array $employee - * - * @return void - */ - private function castPropertyValues(&$employee) - { - $employee['id_employee'] = (int) $employee['id_employee']; - $employee['id_profile'] = (int) $employee['id_profile']; - $employee['id_lang'] = (int) $employee['id_lang']; - - $employee['default_tab'] = (int) $employee['default_tab']; - $employee['bo_width'] = (int) $employee['bo_width']; - $employee['bo_menu'] = (bool) $employee['bo_menu']; - - $employee['optin'] = (bool) $employee['optin']; - $employee['active'] = (bool) $employee['active']; - - $employee['id_last_order'] = (int) $employee['id_last_order']; - $employee['id_last_customer_message'] = (int) $employee['id_last_customer_message']; - $employee['id_last_customer'] = (int) $employee['id_last_customer']; - - if ($employee['last_connection_date'] == '0000-00-00') { - $employee['last_connection_date'] = null; - } else { - $employee['last_connection_date'] = (string) $employee['last_connection_date']; - } - - $employee['id_shop'] = (int) $employee['id_shop']; - - // https://github.com/PrestaShop/PrestaShop/commit/20f1d9fe8a03559dfa9d1f7109de1f70c99f1874#diff-cde6a9d4a58afb13ff068801ee09c0e712c5e90b0cbf5632a0cc965f15cb6802R107 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.8.0', '>=')) { - $employee['has_enabled_gravatar'] = (bool) $employee['has_enabled_gravatar']; - } - } - - /** - * @param array $employee - * - * @return void - */ - private function hashEmail(&$employee) - { - // FIXME : use a random salt generated during module install - $employee['email_hash'] = hash('sha256', $employee['email'] . 'dUj4GMBD6689pL9pyr'); - unset($employee['email']); - } -} diff --git a/src/Decorator/ImageDecorator.php b/src/Decorator/ImageDecorator.php deleted file mode 100644 index 5e3a4fda..00000000 --- a/src/Decorator/ImageDecorator.php +++ /dev/null @@ -1,34 +0,0 @@ - $images - * - * @return void - */ - public function decorateImages(&$images) - { - foreach ($images as &$image) { - $this->castPropertyValues($image); - } - } - - /** - * @param array $image - * - * @return void - */ - private function castPropertyValues(&$image) - { - $image['id_image'] = (int) $image['id_image']; - $image['id_product'] = (int) $image['id_product']; - $image['id_lang'] = (int) $image['id_lang']; - $image['id_shop'] = (int) $image['id_shop']; - $image['position'] = (int) $image['position']; - $image['cover'] = (bool) $image['cover']; - $image['legend'] = (string) $image['legend']; - } -} diff --git a/src/Decorator/ImageTypeDecorator.php b/src/Decorator/ImageTypeDecorator.php deleted file mode 100644 index 82b42cbd..00000000 --- a/src/Decorator/ImageTypeDecorator.php +++ /dev/null @@ -1,36 +0,0 @@ - $imageTypes - * - * @return void - */ - public function decorateImageTypes(&$imageTypes) - { - foreach ($imageTypes as &$imageType) { - $this->castPropertyValues($imageType); - } - } - - /** - * @param array $imageType - * - * @return void - */ - private function castPropertyValues(&$imageType) - { - $imageType['id_image_type'] = (int) $imageType['id_image_type']; - $imageType['name'] = (string) $imageType['name']; - $imageType['width'] = (int) $imageType['width']; - $imageType['height'] = (int) $imageType['height']; - $imageType['products'] = (bool) $imageType['products']; - $imageType['categories'] = (bool) $imageType['categories']; - $imageType['manufacturers'] = (bool) $imageType['manufacturers']; - $imageType['suppliers'] = (bool) $imageType['suppliers']; - $imageType['stores'] = (bool) $imageType['stores']; - } -} diff --git a/src/Decorator/LanguageDecorator.php b/src/Decorator/LanguageDecorator.php deleted file mode 100644 index cef89282..00000000 --- a/src/Decorator/LanguageDecorator.php +++ /dev/null @@ -1,31 +0,0 @@ - $languages - * - * @return void - */ - public function decorateLanguages(&$languages) - { - foreach ($languages as &$language) { - $this->castPropertyValues($language); - } - } - - /** - * @param array $language - * - * @return void - */ - private function castPropertyValues(&$language) - { - $language['id_lang'] = (int) $language['id_lang']; - $language['active'] = (bool) $language['active']; - $language['is_rtl'] = (bool) $language['is_rtl']; - $language['id_shop'] = (int) $language['id_shop']; - } -} diff --git a/src/Decorator/ManufacturerDecorator.php b/src/Decorator/ManufacturerDecorator.php deleted file mode 100644 index 878dee70..00000000 --- a/src/Decorator/ManufacturerDecorator.php +++ /dev/null @@ -1,33 +0,0 @@ - $manufacturers - * - * @return void - */ - public function decorateManufacturers(&$manufacturers) - { - foreach ($manufacturers as &$manufacturer) { - $this->castPropertyValues($manufacturer); - } - } - - /** - * @param array $manufacturer - * - * @return void - */ - private function castPropertyValues(&$manufacturer) - { - $manufacturer['id_manufacturer'] = (int) $manufacturer['id_manufacturer']; - $manufacturer['active'] = (bool) $manufacturer['active']; - $manufacturer['id_lang'] = (int) $manufacturer['id_lang']; - $manufacturer['id_shop'] = (int) $manufacturer['id_shop']; - $manufacturer['created_at'] = (string) $manufacturer['created_at']; - $manufacturer['updated_at'] = (string) $manufacturer['updated_at']; - } -} diff --git a/src/Decorator/PayloadDecorator.php b/src/Decorator/PayloadDecorator.php deleted file mode 100644 index c67f5135..00000000 --- a/src/Decorator/PayloadDecorator.php +++ /dev/null @@ -1,60 +0,0 @@ -configurationRepository = $configurationRepository; - $this->timezone = (string) $this->configurationRepository->get('PS_TIMEZONE'); - } - - /** - * @param array $payload - * - * @return void - * - * @throws \Exception - */ - public function convertDateFormat(&$payload) - { - foreach ($payload as &$payloadItem) { - foreach (DATE_FIELDS as $dateField) { - if (isset($payloadItem['properties'][$dateField])) { - $date = &$payloadItem['properties'][$dateField]; - if (!empty($date) && $date !== '0000-00-00 00:00:00') { - $dateTime = new \DateTime($date, new \DateTimeZone($this->timezone)); - $date = $dateTime->format(ISO8601); - } else { - $date = null; - } - } - } - } - } -} diff --git a/src/Decorator/ProductSupplierDecorator.php b/src/Decorator/ProductSupplierDecorator.php deleted file mode 100644 index 9c6fa9ef..00000000 --- a/src/Decorator/ProductSupplierDecorator.php +++ /dev/null @@ -1,33 +0,0 @@ - $productSuppliers - * - * @return void - */ - public function decorateProductSuppliers(&$productSuppliers) - { - foreach ($productSuppliers as &$productSupplier) { - $this->castProductSupplierPropertyValues($productSupplier); - } - } - - /** - * @param array $productSupplier - * - * @return void - */ - private function castProductSupplierPropertyValues(&$productSupplier) - { - $productSupplier['id_product_supplier'] = (int) $productSupplier['id_product_supplier']; - $productSupplier['id_product'] = (int) $productSupplier['id_product']; - $productSupplier['id_product_attribute'] = (int) $productSupplier['id_product_attribute']; - $productSupplier['id_supplier'] = (int) $productSupplier['id_supplier']; - $productSupplier['product_supplier_price_te'] = (float) $productSupplier['product_supplier_price_te']; - $productSupplier['id_currency'] = (int) $productSupplier['id_currency']; - } -} diff --git a/src/Decorator/StockDecorator.php b/src/Decorator/StockDecorator.php deleted file mode 100644 index 4666cfa5..00000000 --- a/src/Decorator/StockDecorator.php +++ /dev/null @@ -1,81 +0,0 @@ - $stocks - * - * @return void - */ - public function decorateStocks(&$stocks) - { - foreach ($stocks as &$stock) { - $this->castStockPropertyValues($stock); - } - } - - /** - * @param array $stock - * - * @return void - */ - private function castStockPropertyValues(&$stock) - { - $stock['id_stock_available'] = (int) $stock['id_stock_available']; - $stock['id_product'] = (int) $stock['id_product']; - $stock['id_product_attribute'] = (int) $stock['id_product_attribute']; - $stock['id_shop'] = (int) $stock['id_shop']; - $stock['id_shop_group'] = (int) $stock['id_shop_group']; - $stock['quantity'] = (int) $stock['quantity']; - - $stock['depends_on_stock'] = (bool) $stock['depends_on_stock']; - $stock['out_of_stock'] = (bool) $stock['out_of_stock']; - - // https://github.com/PrestaShop/PrestaShop/commit/2a3269ad93b1985f2615d6604458061d4989f0ea#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2186 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.2.0', '>=')) { - $stock['physical_quantity'] = (int) $stock['physical_quantity']; - $stock['reserved_quantity'] = (int) $stock['reserved_quantity']; - } - } - - /** - * @param array $stockMvts - * - * @return void - */ - public function decorateStockMvts(&$stockMvts) - { - foreach ($stockMvts as &$stockMvt) { - $this->castStockMvtPropertyValues($stockMvt); - } - } - - /** - * @param array $stockMvt - * - * @return void - */ - private function castStockMvtPropertyValues(&$stockMvt) - { - $date = $stockMvt['date_add']; - - $stockMvt['id_stock_mvt'] = (int) $stockMvt['id_stock_mvt']; - $stockMvt['id_stock'] = (int) $stockMvt['id_stock']; - $stockMvt['id_order'] = (int) $stockMvt['id_order']; - $stockMvt['id_supply_order'] = (int) $stockMvt['id_supply_order']; - $stockMvt['id_stock_mvt_reason'] = (int) $stockMvt['id_stock_mvt_reason']; - $stockMvt['id_lang'] = (int) $stockMvt['id_lang']; - $stockMvt['id_employee'] = (int) $stockMvt['id_employee']; - $stockMvt['physical_quantity'] = (int) $stockMvt['physical_quantity']; - $stockMvt['date_add'] = $date; - $stockMvt['sign'] = (int) $stockMvt['sign']; - $stockMvt['price_te'] = (float) $stockMvt['price_te']; - $stockMvt['last_wa'] = (float) $stockMvt['last_wa']; - $stockMvt['current_wa'] = (float) $stockMvt['current_wa']; - $stockMvt['referer'] = (int) $stockMvt['referer']; - $stockMvt['deleted'] = (bool) $stockMvt['deleted']; - $stockMvt['created_at'] = $date; - } -} diff --git a/src/Decorator/StoreDecorator.php b/src/Decorator/StoreDecorator.php deleted file mode 100644 index 7a41da0a..00000000 --- a/src/Decorator/StoreDecorator.php +++ /dev/null @@ -1,40 +0,0 @@ - $stores - * - * @return void - */ - public function decorateStores(&$stores) - { - foreach ($stores as &$store) { - $this->castPropertyValues($store); - } - } - - /** - * @param array $store - * - * @return void - */ - private function castPropertyValues(&$store) - { - $store['id_store'] = (int) $store['id_store']; - $store['id_country'] = (int) $store['id_country']; - $store['id_state'] = (int) $store['id_state']; - $store['active'] = (bool) $store['active']; - - // https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { - $store['id_lang'] = (int) $store['id_lang']; - $store['id_shop'] = (int) $store['id_shop']; - } - - $store['created_at'] = (string) $store['created_at']; - $store['updated_at'] = (string) $store['updated_at']; - } -} diff --git a/src/Decorator/SupplierDecorator.php b/src/Decorator/SupplierDecorator.php deleted file mode 100644 index fc0e87c7..00000000 --- a/src/Decorator/SupplierDecorator.php +++ /dev/null @@ -1,33 +0,0 @@ - $suppliers - * - * @return void - */ - public function decorateSuppliers(&$suppliers) - { - foreach ($suppliers as &$supplier) { - $this->castPropertyValues($supplier); - } - } - - /** - * @param array $supplier - * - * @return void - */ - private function castPropertyValues(&$supplier) - { - $supplier['id_supplier'] = (int) $supplier['id_supplier']; - $supplier['active'] = (bool) $supplier['active']; - $supplier['id_lang'] = (int) $supplier['id_lang']; - $supplier['id_shop'] = (int) $supplier['id_shop']; - $supplier['created_at'] = (string) $supplier['created_at']; - $supplier['updated_at'] = (string) $supplier['updated_at']; - } -} diff --git a/src/Decorator/TranslationDecorator.php b/src/Decorator/TranslationDecorator.php deleted file mode 100644 index 7fbbd5e5..00000000 --- a/src/Decorator/TranslationDecorator.php +++ /dev/null @@ -1,33 +0,0 @@ - $translations - * - * @return void - */ - public function decorateTranslations(&$translations) - { - foreach ($translations as &$translation) { - $this->castPropertyValues($translation); - } - } - - /** - * @param array $translation - * - * @return void - */ - private function castPropertyValues(&$translation) - { - $translation['id_translation'] = (int) $translation['id_translation']; - $translation['id_lang'] = (int) $translation['id_lang']; - $translation['key'] = (string) $translation['key']; - $translation['translation'] = (string) $translation['translation']; - $translation['domain'] = (string) $translation['domain']; - $translation['theme'] = (string) $translation['theme']; - } -} diff --git a/src/Decorator/WishlistDecorator.php b/src/Decorator/WishlistDecorator.php deleted file mode 100644 index cf49f9ad..00000000 --- a/src/Decorator/WishlistDecorator.php +++ /dev/null @@ -1,60 +0,0 @@ - $wishlists - * - * @return void - */ - public function decorateWishlists(&$wishlists) - { - foreach ($wishlists as &$wishlist) { - $this->castWishlistPropertyValues($wishlist); - } - } - - /** - * @param array $wishlistProducts - * - * @return void - */ - public function decorateWishlistProducts(&$wishlistProducts) - { - foreach ($wishlistProducts as &$wishlistProduct) { - $this->castWishlistProductPropertyValues($wishlistProduct); - } - } - - /** - * @param array $wishlist - * - * @return void - */ - private function castWishlistPropertyValues(&$wishlist) - { - $wishlist['id_wishlist'] = (int) $wishlist['id_wishlist']; - $wishlist['id_customer'] = (int) $wishlist['id_customer']; - $wishlist['id_shop'] = (int) $wishlist['id_shop']; - $wishlist['id_shop_group'] = (int) $wishlist['id_shop_group']; - $wishlist['counter'] = (int) $wishlist['counter']; - $wishlist['default'] = (bool) $wishlist['default']; - } - - /** - * @param array $wishlistProduct - * - * @return void - */ - private function castWishlistProductPropertyValues(&$wishlistProduct) - { - $wishlistProduct['id_wishlist_product'] = (int) $wishlistProduct['id_wishlist_product']; - $wishlistProduct['id_wishlist'] = (int) $wishlistProduct['id_wishlist']; - $wishlistProduct['id_product'] = (int) $wishlistProduct['id_product']; - $wishlistProduct['id_product_attribute'] = (int) $wishlistProduct['id_product_attribute']; - $wishlistProduct['quantity'] = (int) $wishlistProduct['quantity']; - $wishlistProduct['priority'] = (int) $wishlistProduct['priority']; - } -} diff --git a/src/DependencyInjection/ContainerProvider.php b/src/DependencyInjection/ContainerProvider.php index 7f24fb78..ebad03ef 100644 --- a/src/DependencyInjection/ContainerProvider.php +++ b/src/DependencyInjection/ContainerProvider.php @@ -5,17 +5,23 @@ * * NOTICE OF LICENSE * - * This source file is subject to the Academic Free License version 3.0 + * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: - * https://opensource.org/licenses/AFL-3.0 + * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * * @author PrestaShop SA and Contributors * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\DependencyInjection; @@ -28,6 +34,10 @@ use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +if (!defined('_PS_VERSION_')) { + exit; +} + class ContainerProvider { /** diff --git a/src/DependencyInjection/ServiceContainer.php b/src/DependencyInjection/ServiceContainer.php index 231e917d..63d063d1 100644 --- a/src/DependencyInjection/ServiceContainer.php +++ b/src/DependencyInjection/ServiceContainer.php @@ -5,17 +5,23 @@ * * NOTICE OF LICENSE * - * This source file is subject to the Academic Free License version 3.0 + * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.md. * It is also available through the world-wide-web at this URL: - * https://opensource.org/licenses/AFL-3.0 + * https://opensource.org/licenses/OSL-3.0 * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * * @author PrestaShop SA and Contributors * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\DependencyInjection; @@ -23,6 +29,10 @@ use PrestaShop\ModuleLibCacheDirectoryProvider\Cache\CacheDirectoryProvider; use Symfony\Component\DependencyInjection\ContainerInterface; +if (!defined('_PS_VERSION_')) { + exit; +} + class ServiceContainer { /** @@ -73,6 +83,18 @@ public function getService($serviceName) return $this->getContainer()->get($serviceName); } + /** + * @param string $serviceName + * + * @return bool + * + * @throws \Exception + */ + public function hasService($serviceName) + { + return $this->getContainer()->has($serviceName); + } + /** * @return ContainerInterface * diff --git a/src/Exception/ApiException.php b/src/Exception/ApiException.php index 1ce8b3cd..db1fef15 100644 --- a/src/Exception/ApiException.php +++ b/src/Exception/ApiException.php @@ -1,25 +1,35 @@ - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class ApiException extends \Exception { } diff --git a/src/Exception/EnvVarException.php b/src/Exception/EnvVarException.php index dcc5300d..6843f0b6 100644 --- a/src/Exception/EnvVarException.php +++ b/src/Exception/EnvVarException.php @@ -1,25 +1,35 @@ - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class EnvVarException extends \Exception { } diff --git a/src/Exception/FirebaseException.php b/src/Exception/FirebaseException.php index 689a296e..fdddd958 100644 --- a/src/Exception/FirebaseException.php +++ b/src/Exception/FirebaseException.php @@ -1,25 +1,35 @@ - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class FirebaseException extends \Exception { } diff --git a/src/Exception/HmacException.php b/src/Exception/HmacException.php deleted file mode 100644 index 3792a400..00000000 --- a/src/Exception/HmacException.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA - */ - -namespace PrestaShop\Module\PsEventbus\Exception; - -class HmacException extends \Exception -{ -} diff --git a/src/Exception/PsAccountsRsaSignDataEmptyException.php b/src/Exception/PsAccountsRsaSignDataEmptyException.php deleted file mode 100644 index d7df4349..00000000 --- a/src/Exception/PsAccountsRsaSignDataEmptyException.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA - */ - -namespace PrestaShop\Module\PsEventbus\Exception; - -class PsAccountsRsaSignDataEmptyException extends \Exception -{ -} diff --git a/src/Exception/QueryParamsException.php b/src/Exception/QueryParamsException.php index 6602b9a1..5864438b 100644 --- a/src/Exception/QueryParamsException.php +++ b/src/Exception/QueryParamsException.php @@ -1,25 +1,35 @@ - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Exception; +if (!defined('_PS_VERSION_')) { + exit; +} + class QueryParamsException extends \Exception { } diff --git a/src/Exception/UnauthorizedException.php b/src/Exception/UnauthorizedException.php deleted file mode 100644 index 151954d1..00000000 --- a/src/Exception/UnauthorizedException.php +++ /dev/null @@ -1,7 +0,0 @@ - - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA - */ - -namespace PrestaShop\Module\PsEventbus\Exception; - -class WebhookException extends \Exception -{ -} diff --git a/src/Factory/ContextFactory.php b/src/Factory/ContextFactory.php index 013ace1a..8cad3d81 100644 --- a/src/Factory/ContextFactory.php +++ b/src/Factory/ContextFactory.php @@ -1,7 +1,35 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Factory; +if (!defined('_PS_VERSION_')) { + exit; +} + class ContextFactory { /** diff --git a/src/Formatter/ArrayFormatter.php b/src/Formatter/ArrayFormatter.php index 248958de..67f249c7 100644 --- a/src/Formatter/ArrayFormatter.php +++ b/src/Formatter/ArrayFormatter.php @@ -1,7 +1,35 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Formatter; +if (!defined('_PS_VERSION_')) { + exit; +} + class ArrayFormatter { /** diff --git a/src/Formatter/JsonFormatter.php b/src/Formatter/JsonFormatter.php index 39fe4c85..f95be74b 100644 --- a/src/Formatter/JsonFormatter.php +++ b/src/Formatter/JsonFormatter.php @@ -1,7 +1,35 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Formatter; +if (!defined('_PS_VERSION_')) { + exit; +} + class JsonFormatter { /** diff --git a/src/Handler/ErrorHandler/ErrorHandler.php b/src/Handler/ErrorHandler/ErrorHandler.php index 506af5a6..41bf2988 100644 --- a/src/Handler/ErrorHandler/ErrorHandler.php +++ b/src/Handler/ErrorHandler/ErrorHandler.php @@ -1,32 +1,43 @@ * @copyright Since 2007 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Handler\ErrorHandler; +use Exception; +use PrestaShop\Module\PsEventbus\Service\CommonService; use PrestaShop\Module\PsEventbus\Service\PsAccountsAdapterService; +if (!defined('_PS_VERSION_')) { + exit; +} + /** * Handle Error. */ -class ErrorHandler implements ErrorHandlerInterface +class ErrorHandler { /** * @var ?\Raven_Client @@ -68,28 +79,46 @@ public function __construct(\Ps_eventbus $module, PsAccountsAdapterService $psAc } /** - * @param \Exception $error - * @param mixed $code - * @param bool|null $throw - * @param array|null $data + * @param mixed $exception * * @return void * * @@throws Exception */ - public function handle($error, $code = null, $throw = null, $data = null) + public function handle($exception) { - if ($throw == null) { - $throw = true; - } + $logsEnabled = false; + $verboseEnabled = false; if (!$this->client) { return; } - $this->client->captureException($error, $data); - if (is_int($code) && true === $throw) { - http_response_code($code); - throw $error; + + if (defined('PS_EVENTBUS_VERBOSE_ENABLED')) { + $logsEnabled = PS_EVENTBUS_VERBOSE_ENABLED; + } + + if (defined('PS_EVENTBUS_VERBOSE_ENABLED')) { + $verboseEnabled = PS_EVENTBUS_VERBOSE_ENABLED; + } + + if ($logsEnabled) { + \PrestaShopLogger::addLog( + $exception->getMessage() . ' : ' . $exception->getFile() . ':' . $exception->getLine() . ' | ' . $exception->getTraceAsString(), + 3, + $exception->getCode() > 0 ? $exception->getCode() : 500, + 'Module', + \Module::getModuleIdByName('ps_eventbus'), + true + ); + } + + // if debug mode enabled and verbose set to true, print error in front office + if (_PS_MODE_DEV_ && $verboseEnabled) { + throw $exception; + } else { + $this->client->captureException($exception); + CommonService::exitWithExceptionMessage($exception); } } diff --git a/src/Handler/ErrorHandler/ErrorHandlerInterface.php b/src/Handler/ErrorHandler/ErrorHandlerInterface.php deleted file mode 100644 index 1ce0b05f..00000000 --- a/src/Handler/ErrorHandler/ErrorHandlerInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -|null $data - * - * @return void - */ - public function handle($error, $code = null, $throw = null, $data = null); -} diff --git a/src/Helper/ModuleHelper.php b/src/Helper/ModuleHelper.php index 800e20a4..f9309587 100644 --- a/src/Helper/ModuleHelper.php +++ b/src/Helper/ModuleHelper.php @@ -1,9 +1,37 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Helper; use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder; +if (!defined('_PS_VERSION_')) { + exit; +} + class ModuleHelper { /** diff --git a/src/Module/Install.php b/src/Module/Install.php index c5fdb128..01e90761 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -1,25 +1,35 @@ - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Module; +if (!defined('_PS_VERSION_')) { + exit; +} + class Install { const PARENT_TAB_NAME = -1; @@ -70,38 +80,6 @@ public function installDatabaseTables() } } - $this->copyDataFromPsAccounts(); - return true; } - - /** - * @return void - */ - private function copyDataFromPsAccounts() - { - $dbInstallFile = "{$this->module->getLocalPath()}/sql/migrate.sql"; - - if (!file_exists($dbInstallFile)) { - return; - } - - $sql = \Tools::file_get_contents($dbInstallFile); - - if (empty($sql) || !is_string($sql)) { - return; - } - - $sql = str_replace(['PREFIX_', 'ENGINE_TYPE'], [_DB_PREFIX_, _MYSQL_ENGINE_], $sql); - $sql = preg_split("/;\s*[\r\n]+/", trim($sql)); - - if (!empty($sql)) { - foreach ($sql as $query) { - try { - $this->db->execute($query); - } catch (\Exception $exception) { - } - } - } - } } diff --git a/src/Module/Uninstall.php b/src/Module/Uninstall.php index 023ff290..b15e4a19 100644 --- a/src/Module/Uninstall.php +++ b/src/Module/Uninstall.php @@ -1,25 +1,35 @@ - * @copyright 2007-2020 PrestaShop SA and Contributors - * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) - * International Registered Trademark & Property of PrestaShop SA + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade PrestaShop to newer + * versions in the future. If you wish to customize PrestaShop for your + * needs please refer to https://devdocs.prestashop.com/ for more information. + * + * @author PrestaShop SA and Contributors + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\Module\PsEventbus\Module; +if (!defined('_PS_VERSION_')) { + exit; +} + class Uninstall { /** diff --git a/src/Provider/CarrierDataProvider.php b/src/Provider/CarrierDataProvider.php deleted file mode 100644 index 1a4a709f..00000000 --- a/src/Provider/CarrierDataProvider.php +++ /dev/null @@ -1,137 +0,0 @@ -configurationRepository = $configurationRepository; - $this->carrierBuilder = $carrierBuilder; - $this->carrierRepository = $carrierRepository; - $this->languageRepository = $languageRepository; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $currency = new \Currency((int) $this->configurationRepository->get('PS_CURRENCY_DEFAULT')); - - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - /** @var array $carriers */ - $carriers = $this->carrierRepository->getAllCarrierProperties($offset, $limit, $langId); - - /** @var string $configurationPsWeightUnit */ - $configurationPsWeightUnit = $this->configurationRepository->get('PS_WEIGHT_UNIT'); - /** @var EventBusCarrier[] $eventBusCarriers */ - $eventBusCarriers = $this->carrierBuilder->buildCarriers( - $carriers, - $langId, - $currency, - $configurationPsWeightUnit - ); - - return $eventBusCarriers; - } - - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - /** @var array $shippingIncremental */ - $shippingIncremental = $this->carrierRepository->getShippingIncremental(Config::COLLECTION_CARRIERS, $langIso); - - if (!$shippingIncremental) { - return []; - } - - $currency = new \Currency((int) $this->configurationRepository->get('PS_CURRENCY_DEFAULT')); - - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - $carrierIds = array_column($shippingIncremental, 'id_object'); - /** @var array $carriers */ - $carriers = $this->carrierRepository->getCarrierProperties($carrierIds, $langId); - - /** @var string $configurationPsWeightUnit */ - $configurationPsWeightUnit = $this->configurationRepository->get('PS_WEIGHT_UNIT'); - /** @var EventBusCarrier[] $eventBusCarriers */ - $eventBusCarriers = $this->carrierBuilder->buildCarriers( - $carriers, - $langId, - $currency, - $configurationPsWeightUnit - ); - - return $eventBusCarriers; - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - * - * @@throws \PrestaShopDatabaseException - */ - public function getRemainingObjectsCount($offset, $langIso) - { - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - return (int) $this->carrierRepository->getRemainingCarriersCount($offset, $langId); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - return $this->carrierRepository->getQueryForDebug($offset, $limit, $langId); - } -} diff --git a/src/Provider/CartDataProvider.php b/src/Provider/CartDataProvider.php deleted file mode 100644 index d31ab62e..00000000 --- a/src/Provider/CartDataProvider.php +++ /dev/null @@ -1,173 +0,0 @@ -cartRepository = $cartRepository; - $this->cartProductRepository = $cartProductRepository; - } - - public function getFormattedData($offset, $limit, $langIso) - { - $carts = $this->cartRepository->getCarts($offset, $limit); - - if (!is_array($carts)) { - return []; - } - - $cartProducts = $this->getCartProducts($carts); - - $this->castCartValues($carts); - - $carts = array_map(function ($cart) { - return [ - 'id' => $cart['id_cart'], - 'collection' => Config::COLLECTION_CARTS, - 'properties' => $cart, - ]; - }, $carts); - - return array_merge($carts, $cartProducts); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->cartRepository->getRemainingCartsCount($offset); - } - - /** - * @param array $carts - * - * @return void - */ - private function castCartValues(&$carts) - { - foreach ($carts as &$cart) { - $cart['id_cart'] = (string) $cart['id_cart']; - } - } - - /** - * @param array $cartProducts - * - * @return void - */ - private function castCartProductValues(&$cartProducts) - { - foreach ($cartProducts as &$cartProduct) { - $cartProduct['id_cart_product'] = (string) "{$cartProduct['id_cart']}-{$cartProduct['id_product']}-{$cartProduct['id_product_attribute']}"; - $cartProduct['id_cart'] = (string) $cartProduct['id_cart']; - $cartProduct['id_product'] = (string) $cartProduct['id_product']; - $cartProduct['id_product_attribute'] = (string) $cartProduct['id_product_attribute']; - $cartProduct['quantity'] = (int) $cartProduct['quantity']; - } - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $carts = $this->cartRepository->getCartsIncremental($limit, $objectIds); - - if (!is_array($carts) || empty($carts)) { - return []; - } - - $cartProducts = $this->getCartProducts($carts); - - $this->castCartValues($carts); - - $carts = array_map(function ($cart) { - return [ - 'id' => $cart['id_cart'], - 'collection' => Config::COLLECTION_CARTS, - 'properties' => $cart, - ]; - }, $carts); - - return array_merge($carts, $cartProducts); - } - - /** - * @param array $carts - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - private function getCartProducts($carts) - { - $cartIds = array_map(function ($cart) { - return (string) $cart['id_cart']; - }, $carts); - - $cartProducts = $this->cartProductRepository->getCartProducts($cartIds); - - if (!is_array($cartProducts) || empty($cartProducts)) { - return []; - } - - $this->castCartProductValues($cartProducts); - - if (is_array($cartProducts)) { - return array_map(function ($cartProduct) { - return [ - 'id' => "{$cartProduct['id_cart']}-{$cartProduct['id_product']}-{$cartProduct['id_product_attribute']}", - 'collection' => Config::COLLECTION_CART_PRODUCTS, - 'properties' => $cartProduct, - ]; - }, $cartProducts); - } - - return []; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->cartRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/CategoryDataProvider.php b/src/Provider/CategoryDataProvider.php deleted file mode 100644 index 80cf9876..00000000 --- a/src/Provider/CategoryDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -categoryRepository = $categoryRepository; - $this->categoryDecorator = $categoryDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $categories = $this->categoryRepository->getCategories($offset, $limit, $langIso); - - if (!is_array($categories)) { - return []; - } - - $this->categoryDecorator->decorateCategories($categories); - - return array_map(function ($category) { - return [ - 'id' => "{$category['id_category']}-{$category['iso_code']}", - 'collection' => Config::COLLECTION_CATEGORIES, - 'properties' => $category, - ]; - }, $categories); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->categoryRepository->getRemainingCategoriesCount($offset, $langIso); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $categories = $this->categoryRepository->getCategoriesIncremental($limit, $langIso, $objectIds); - - if (!is_array($categories)) { - return []; - } - - $this->categoryDecorator->decorateCategories($categories); - - return array_map(function ($category) { - return [ - 'id' => "{$category['id_category']}-{$category['iso_code']}", - 'collection' => Config::COLLECTION_CATEGORIES, - 'properties' => $category, - ]; - }, $categories); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->categoryRepository->getQueryForDebug($offset, $limit, $langIso); - } -} diff --git a/src/Provider/CurrencyDataProvider.php b/src/Provider/CurrencyDataProvider.php deleted file mode 100644 index 9ee19053..00000000 --- a/src/Provider/CurrencyDataProvider.php +++ /dev/null @@ -1,105 +0,0 @@ -currencyRepository = $currencyRepository; - $this->currencyDecorator = $currencyDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $currencies = $this->currencyRepository->getCurrencies($offset, $limit); - - if (!is_array($currencies)) { - return []; - } - $this->currencyDecorator->decorateCurrencies($currencies); - - return array_map(function ($currency) { - return [ - 'id' => $currency['id_currency'], - 'collection' => Config::COLLECTION_CURRENCIES, - 'properties' => $currency, - ]; - }, $currencies); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->currencyRepository->getRemainingCurrenciesCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $currencies = $this->currencyRepository->getCurrenciesIncremental($limit, $objectIds); - - if (!is_array($currencies)) { - return []; - } - $this->currencyDecorator->decorateCurrencies($currencies); - - return array_map(function ($currency) { - return [ - 'id' => $currency['id_currency'], - 'collection' => Config::COLLECTION_CURRENCIES, - 'properties' => $currency, - ]; - }, $currencies); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->currencyRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/CustomPriceDataProvider.php b/src/Provider/CustomPriceDataProvider.php deleted file mode 100644 index e7f330ab..00000000 --- a/src/Provider/CustomPriceDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -customPriceRepository = $customPriceRepository; - $this->customPriceDecorator = $customPriceDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $specificPrices = $this->customPriceRepository->getSpecificPrices($offset, $limit); - - $this->customPriceDecorator->decorateSpecificPrices($specificPrices); - - return array_map(function ($specificPrice) { - return [ - 'id' => $specificPrice['id_specific_price'], - 'collection' => Config::COLLECTION_SPECIFIC_PRICES, - 'properties' => $specificPrice, - ]; - }, $specificPrices); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - * - * @@throws \PrestaShopDatabaseException - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->customPriceRepository->getRemainingSpecificPricesCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $specificPrices = $this->customPriceRepository->getSpecificPricesIncremental($limit, $objectIds); - - if (!empty($specificPrices)) { - $this->customPriceDecorator->decorateSpecificPrices($specificPrices); - } else { - return []; - } - - return array_map(function ($specificPrice) { - return [ - 'id' => $specificPrice['id_specific_price'], - 'collection' => Config::COLLECTION_SPECIFIC_PRICES, - 'properties' => $specificPrice, - ]; - }, $specificPrices); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->customPriceRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/CustomProductCarrierDataProvider.php b/src/Provider/CustomProductCarrierDataProvider.php deleted file mode 100644 index c0ef680b..00000000 --- a/src/Provider/CustomProductCarrierDataProvider.php +++ /dev/null @@ -1,85 +0,0 @@ -productCarrierRepository = $productCarrierRepository; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $productCarriers = $this->productCarrierRepository->getProductCarriers($offset, $limit); - $productCarriers = array_map(function ($productCarrier) { - return [ - 'id' => $productCarrier['id_product'] . '-' . $productCarrier['id_carrier_reference'], - 'collection' => Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, - 'properties' => $productCarrier, - ]; - }, $productCarriers); - - return $productCarriers; - } - - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - /** @var array $productCarrierIncremental */ - $productCarrierIncremental = $this->productCarrierRepository->getProductCarrierIncremental(Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, $langIso); - - if (!$productCarrierIncremental) { - return []; - } - - $productIds = array_column($productCarrierIncremental, 'id_object'); - - /** @var array $productCarriers */ - $productCarriers = $this->productCarrierRepository->getProductCarriersProperties($productIds); - - return array_map(function ($productCarrier) { - return [ - 'id' => "{$productCarrier['id_product']}-{$productCarrier['id_carrier_reference']}", - 'collection' => Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, - 'properties' => $productCarrier, - ]; - }, $productCarriers); - } - - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->productCarrierRepository->getRemainingProductCarriersCount($offset); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->productCarrierRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/CustomerDataProvider.php b/src/Provider/CustomerDataProvider.php deleted file mode 100644 index 75a682c1..00000000 --- a/src/Provider/CustomerDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -customerRepository = $customerRepository; - $this->customerDecorator = $customerDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $customers = $this->customerRepository->getCustomers($offset, $limit); - - if (!is_array($customers)) { - return []; - } - - $this->customerDecorator->decorateCustomers($customers); - - return array_map(function ($customer) { - return [ - 'id' => "{$customer['id_customer']}", - 'collection' => Config::COLLECTION_CUSTOMERS, - 'properties' => $customer, - ]; - }, $customers); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->customerRepository->getRemainingCustomersCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $customers = $this->customerRepository->getCustomersIncremental($limit, $objectIds); - - if (!is_array($customers)) { - return []; - } - - $this->customerDecorator->decorateCustomers($customers); - - return array_map(function ($customer) { - return [ - 'id' => "{$customer['id_customer']}", - 'collection' => Config::COLLECTION_CUSTOMERS, - 'properties' => $customer, - ]; - }, $customers); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->customerRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/EmployeeDataProvider.php b/src/Provider/EmployeeDataProvider.php deleted file mode 100644 index df991457..00000000 --- a/src/Provider/EmployeeDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -employeeRepository = $employeeRepository; - $this->employeeDecorator = $employeeDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $employees = $this->employeeRepository->getEmployees($offset, $limit); - - if (!is_array($employees)) { - return []; - } - - $this->employeeDecorator->decorateEmployees($employees); - - return array_map(function ($employee) { - return [ - 'id' => "{$employee['id_employee']}", - 'collection' => Config::COLLECTION_EMPLOYEES, - 'properties' => $employee, - ]; - }, $employees); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->employeeRepository->getRemainingEmployeesCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $employees = $this->employeeRepository->getEmployeesIncremental($limit, $objectIds); - - if (!is_array($employees)) { - return []; - } - - $this->employeeDecorator->decorateEmployees($employees); - - return array_map(function ($employee) { - return [ - 'id' => "{$employee['id_customer']}", - 'collection' => Config::COLLECTION_EMPLOYEES, - 'properties' => $employee, - ]; - }, $employees); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->employeeRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/GoogleTaxonomyDataProvider.php b/src/Provider/GoogleTaxonomyDataProvider.php deleted file mode 100644 index 0cc59dcd..00000000 --- a/src/Provider/GoogleTaxonomyDataProvider.php +++ /dev/null @@ -1,79 +0,0 @@ -googleTaxonomyRepository = $googleTaxonomyRepository; - $this->context = $context; - - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $this->shopId = (int) $this->context->shop->id; - } - - public function getFormattedData($offset, $limit, $langIso) - { - $data = $this->googleTaxonomyRepository->getTaxonomyCategories($offset, $limit, $this->shopId); - - if (!is_array($data)) { - return []; - } - - return array_map(function ($googleTaxonomy) { - $uniqueId = "{$googleTaxonomy['id_category']}-{$googleTaxonomy['id_category']}"; - $googleTaxonomy['taxonomy_id'] = $uniqueId; - - return [ - 'id' => $uniqueId, - 'collection' => Config::COLLECTION_TAXONOMIES, - 'properties' => $googleTaxonomy, - ]; - }, $data); - } - - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->googleTaxonomyRepository->getRemainingTaxonomyRepositories($offset, $this->shopId); - } - - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - return []; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->googleTaxonomyRepository->getQueryForDebug($offset, $limit, $this->shopId); - } -} diff --git a/src/Provider/ImageDataProvider.php b/src/Provider/ImageDataProvider.php deleted file mode 100644 index 89201986..00000000 --- a/src/Provider/ImageDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -imageRepository = $imageRepository; - $this->imageDecorator = $imageDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $images = $this->imageRepository->getImages($offset, $limit); - - if (!is_array($images)) { - return []; - } - - $this->imageDecorator->decorateImages($images); - - return array_map(function ($image) { - return [ - 'id' => "{$image['id_image']}", - 'collection' => Config::COLLECTION_IMAGES, - 'properties' => $image, - ]; - }, $images); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->imageRepository->getRemainingImagesCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $images = $this->imageRepository->getImagesIncremental($limit, $objectIds); - - if (!is_array($images)) { - return []; - } - - $this->imageDecorator->decorateImages($images); - - return array_map(function ($image) { - return [ - 'id' => "{$image['id_image']}", - 'collection' => Config::COLLECTION_IMAGES, - 'properties' => $image, - ]; - }, $images); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->imageRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/ImageTypeDataProvider.php b/src/Provider/ImageTypeDataProvider.php deleted file mode 100644 index a15e8bac..00000000 --- a/src/Provider/ImageTypeDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -imageTypeRepository = $imageTypeRepository; - $this->imageTypeDecorator = $imageTypeDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $imageTypes = $this->imageTypeRepository->getImageTypes($offset, $limit); - - if (!is_array($imageTypes)) { - return []; - } - - $this->imageTypeDecorator->decorateImageTypes($imageTypes); - - return array_map(function ($imageType) { - return [ - 'id' => "{$imageType['id_image_type']}", - 'collection' => Config::COLLECTION_IMAGE_TYPES, - 'properties' => $imageType, - ]; - }, $imageTypes); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->imageTypeRepository->getRemainingImageTypesCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $imageTypes = $this->imageTypeRepository->getImageTypesIncremental($limit, $objectIds); - - if (!is_array($imageTypes)) { - return []; - } - - $this->imageTypeDecorator->decorateImageTypes($imageTypes); - - return array_map(function ($imageType) { - return [ - 'id' => "{$imageType['id_image_type']}", - 'collection' => Config::COLLECTION_IMAGE_TYPES, - 'properties' => $imageType, - ]; - }, $imageTypes); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->imageTypeRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/LanguageDataProvider.php b/src/Provider/LanguageDataProvider.php deleted file mode 100644 index 79a9b575..00000000 --- a/src/Provider/LanguageDataProvider.php +++ /dev/null @@ -1,105 +0,0 @@ -languageRepository = $languageRepository; - $this->languageDecorator = $languageDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $languages = $this->languageRepository->getLanguagesSync($offset, $limit); - - if (!is_array($languages)) { - return []; - } - $this->languageDecorator->decorateLanguages($languages); - - return array_map(function ($language) { - return [ - 'id' => $language['id_lang'], - 'collection' => Config::COLLECTION_LANGUAGES, - 'properties' => $language, - ]; - }, $languages); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->languageRepository->getRemainingLanguagesCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $languages = $this->languageRepository->getLanguagesIncremental($limit, $objectIds); - - if (!is_array($languages)) { - return []; - } - $this->languageDecorator->decorateLanguages($languages); - - return array_map(function ($language) { - return [ - 'id' => $language['id_lang'], - 'collection' => Config::COLLECTION_LANGUAGES, - 'properties' => $language, - ]; - }, $languages); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->languageRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/ManufacturerDataProvider.php b/src/Provider/ManufacturerDataProvider.php deleted file mode 100644 index f6add459..00000000 --- a/src/Provider/ManufacturerDataProvider.php +++ /dev/null @@ -1,105 +0,0 @@ -manufacturerRepository = $manufacturerRepository; - $this->manufacturerDecorator = $manufacturerDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $manufacturers = $this->manufacturerRepository->getManufacturers($offset, $limit, $langIso); - - if (!is_array($manufacturers)) { - return []; - } - $this->manufacturerDecorator->decorateManufacturers($manufacturers); - - return array_map(function ($manufacturer) { - return [ - 'id' => $manufacturer['id_manufacturer'], - 'collection' => Config::COLLECTION_MANUFACTURERS, - 'properties' => $manufacturer, - ]; - }, $manufacturers); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->manufacturerRepository->getRemainingManufacturersCount($offset, $langIso); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $manufacturers = $this->manufacturerRepository->getManufacturersIncremental($limit, $langIso, $objectIds); - - if (!is_array($manufacturers)) { - return []; - } - $this->manufacturerDecorator->decorateManufacturers($manufacturers); - - return array_map(function ($manufacturer) { - return [ - 'id' => $manufacturer['id_manufacturer'], - 'collection' => Config::COLLECTION_MANUFACTURERS, - 'properties' => $manufacturer, - ]; - }, $manufacturers); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->manufacturerRepository->getQueryForDebug($offset, $limit, $langIso); - } -} diff --git a/src/Provider/ModuleDataProvider.php b/src/Provider/ModuleDataProvider.php deleted file mode 100644 index df9fa2bc..00000000 --- a/src/Provider/ModuleDataProvider.php +++ /dev/null @@ -1,90 +0,0 @@ -moduleRepository = $moduleRepository; - $this->createdAt = $shopRepository->getCreatedAt(); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - */ - public function getFormattedData($offset, $limit, $langIso) - { - $modules = $this->moduleRepository->getModules($offset, $limit); - - if (!is_array($modules)) { - return []; - } - - return array_map(function ($module) { - $module['module_id'] = (string) $module['module_id']; - $module['active'] = $module['active'] == '1'; - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $module['created_at'] = $module['created_at'] ?: $this->createdAt; - $module['updated_at'] = $module['updated_at'] ?: $this->createdAt; - } else { - $module['created_at'] = $this->createdAt; - $module['updated_at'] = $this->createdAt; - } - - return [ - 'id' => $module['module_id'], - 'collection' => Config::COLLECTION_MODULES, - 'properties' => $module, - ]; - }, $modules); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->moduleRepository->getRemainingModules($offset); - } - - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - return []; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->moduleRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/OrderDataProvider.php b/src/Provider/OrderDataProvider.php deleted file mode 100644 index 1cdef93b..00000000 --- a/src/Provider/OrderDataProvider.php +++ /dev/null @@ -1,429 +0,0 @@ -orderRepository = $orderRepository; - $this->context = $context; - $this->arrayFormatter = $arrayFormatter; - $this->orderDetailsRepository = $orderDetailsRepository; - $this->orderHistoryRepository = $orderHistoryRepository; - $this->orderCartRuleRepository = $orderCartRuleRepository; - - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $this->shopId = (int) $this->context->shop->id; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $orders = $this->orderRepository->getOrders($offset, $limit, $this->shopId); - - if (empty($orders)) { - return []; - } - - $langId = (int) \Language::getIdByIso($langIso); - $this->castOrderValues($orders, $langId); - - $orderDetails = $this->getOrderDetails($orders); - $orderStatuses = $this->getOrderStatuses($orders, $langId); - $orderCartRules = $this->getOrderCartRules($orders); - - $orders = array_map(function ($order) { - return [ - 'id' => $order['id_order'], - 'collection' => Config::COLLECTION_ORDERS, - 'properties' => $order, - ]; - }, $orders); - - return array_merge($orders, $orderDetails, $orderStatuses, $orderCartRules); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->orderRepository->getRemainingOrderCount($offset, $this->shopId); - } - - /** - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $langId = (int) \Language::getIdByIso($langIso); - $orders = $this->orderRepository->getOrdersIncremental($limit, $this->shopId, $objectIds); - - if (!is_array($orders) || empty($orders)) { - return []; - } - - $orderDetails = $this->getOrderDetails($orders); - $orderStatuses = $this->getOrderStatuses($orders, $langId); - $orderCartRules = $this->getOrderCartRules($orders); - - $this->castOrderValues($orders, (int) \Language::getIdByIso($langIso)); - - $orders = array_map(function ($order) { - return [ - 'id' => $order['id_order'], - 'collection' => Config::COLLECTION_ORDERS, - 'properties' => $order, - ]; - }, $orders); - - return array_merge($orders, $orderDetails, $orderStatuses, $orderCartRules); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->orderRepository->getQueryForDebug($offset, $limit, $this->shopId); - } - - /** - * @param array $orders - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - private function getOrderDetails($orders) - { - if (empty($orders)) { - return []; - } - - $orderIds = $this->arrayFormatter->formatValueArray($orders, 'id_order'); - - $orderDetails = $this->orderDetailsRepository->getOrderDetails($orderIds, $this->shopId); - - if (!is_array($orderDetails) || empty($orderDetails)) { - return []; - } - - $this->castOrderDetailValues($orderDetails); - - $orderDetails = array_map(function ($orderDetail) { - return [ - 'id' => $orderDetail['id_order_detail'], - 'collection' => Config::COLLECTION_ORDER_DETAILS, - 'properties' => $orderDetail, - ]; - }, $orderDetails); - - return $orderDetails; - } - - /** - * @param array $orders - * @param int $langId - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - private function getOrderStatuses($orders, $langId) - { - if (empty($orders)) { - return []; - } - $orderIds = $this->arrayFormatter->formatValueArray($orders, 'id_order'); - $orderHistoryStatuses = $this->orderHistoryRepository->getOrderHistoryStatuses($orderIds, $langId); - $orderHistoryStatuses = $this->castOrderStatuses($orderHistoryStatuses); - - return array_map(function ($orderHistoryStatus) { - return [ - 'id' => $orderHistoryStatus['id_order_history'], - 'collection' => Config::COLLECTION_ORDER_STATUS_HISTORY, - 'properties' => $orderHistoryStatus, - ]; - }, $orderHistoryStatuses); - } - - /** - * @param array $orders - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - private function getOrderCartRules($orders) - { - if (empty($orders)) { - return []; - } - $orderIds = $this->arrayFormatter->formatValueArray($orders, 'id_order'); - $orderCartRules = $this->orderCartRuleRepository->getOrderCartRules($orderIds); - $this->castOrderCartRulesValues($orderCartRules); - - return array_map(function ($orderCartRule) { - return [ - 'id' => $orderCartRule['id_order_cart_rule'], - 'collection' => Config::COLLECTION_ORDER_CART_RULES, - 'properties' => $orderCartRule, - ]; - }, $orderCartRules); - } - - /** - * @param array $orders - * @param int $langId - * - * @return void - * - * @@throws \PrestaShopDatabaseException - */ - private function castOrderValues(&$orders, $langId) - { - foreach ($orders as &$order) { - $order['id_order'] = (int) $order['id_order']; - $order['id_customer'] = (int) $order['id_customer']; - $order['current_state'] = (int) $order['current_state']; - $order['conversion_rate'] = (float) $order['conversion_rate']; - $order['total_paid_tax_incl'] = (float) $order['total_paid_tax_incl']; - $order['total_paid_tax_excl'] = (float) $order['total_paid_tax_excl']; - $order['refund'] = (float) $order['refund']; - $order['refund_tax_excl'] = (float) $order['refund_tax_excl']; - $order['new_customer'] = $order['new_customer'] == 1; - $order['is_paid'] = $this->castIsPaidValue($orders, $order, $langId); - $order['shipping_cost'] = (float) $order['shipping_cost']; - $order['total_paid_tax'] = $order['total_paid_tax_incl'] - $order['total_paid_tax_excl']; - $order['id_carrier'] = (int) $order['id_carrier']; - - $order['id_shop_group'] = (int) $order['id_shop_group']; - $order['id_shop'] = (int) $order['id_shop']; - $order['id_lang'] = (int) $order['id_lang']; - $order['id_currency'] = (int) $order['id_currency']; - $order['recyclable'] = (bool) $order['recyclable']; - $order['gift'] = (bool) $order['gift']; - - $order['total_discounts'] = (int) $order['total_discounts']; - $order['total_discounts_tax_incl'] = (int) $order['total_discounts_tax_incl']; - $order['total_discounts_tax_excl'] = (int) $order['total_discounts_tax_excl']; - $order['total_products'] = (int) $order['total_products']; - $order['total_products_wt'] = (int) $order['total_products_wt']; - $order['total_shipping_tax_incl'] = (int) $order['total_shipping_tax_incl']; - $order['total_shipping_tax_excl'] = (int) $order['total_shipping_tax_excl']; - - $order['carrier_tax_rate'] = (int) $order['carrier_tax_rate']; - $order['total_wrapping'] = (int) $order['total_wrapping']; - $order['total_wrapping_tax_incl'] = (int) $order['total_wrapping_tax_incl']; - $order['total_wrapping_tax_excl'] = (int) $order['total_wrapping_tax_excl']; - $order['round_mode'] = (int) $order['round_mode']; - $order['round_type'] = (int) $order['round_type']; - $order['invoice_number'] = (int) $order['invoice_number']; - $order['delivery_number'] = (int) $order['delivery_number']; - $order['valid'] = (bool) $order['valid']; - - $this->castAddressIsoCodes($order); - unset($order['address_iso']); - } - } - - /** - * @param array $orders - * @param array $order - * @param int $langId - * - * @return bool - * - * @@throws \PrestaShopDatabaseException - */ - private function castIsPaidValue($orders, $order, $langId) - { - $isPaid = $dateAdd = 0; - $orderIds = $this->arrayFormatter->formatValueArray($orders, 'id_order'); - /** @var array $orderHistoryStatuses */ - $orderHistoryStatuses = $this->orderHistoryRepository->getOrderHistoryStatuses($orderIds, $langId); - - foreach ($orderHistoryStatuses as &$orderHistoryStatus) { - if ($order['id_order'] == $orderHistoryStatus['id_order'] && $dateAdd < $orderHistoryStatus['date_add']) { - $isPaid = (bool) $orderHistoryStatus['paid']; - $dateAdd = $orderHistoryStatus['date_add']; - } - } - - return (bool) $isPaid; - } - - /** - * @param array $orderDetails - * - * @return void - */ - private function castOrderDetailValues(&$orderDetails) - { - foreach ($orderDetails as &$orderDetail) { - $orderDetail['id_order_detail'] = (int) $orderDetail['id_order_detail']; - $orderDetail['id_order'] = (int) $orderDetail['id_order']; - $orderDetail['product_id'] = (int) $orderDetail['product_id']; - $orderDetail['product_attribute_id'] = (int) $orderDetail['product_attribute_id']; - $orderDetail['product_quantity'] = (int) $orderDetail['product_quantity']; - $orderDetail['unit_price_tax_incl'] = (float) $orderDetail['unit_price_tax_incl']; - $orderDetail['unit_price_tax_excl'] = (float) $orderDetail['unit_price_tax_excl']; - $orderDetail['refund'] = (float) $orderDetail['refund'] > 0 ? -1 * (float) $orderDetail['refund'] : 0; - $orderDetail['refund_tax_excl'] = (float) $orderDetail['refund_tax_excl'] > 0 ? -1 * (float) $orderDetail['refund_tax_excl'] : 0; - $orderDetail['category'] = (int) $orderDetail['category']; - $orderDetail['unique_product_id'] = "{$orderDetail['product_id']}-{$orderDetail['product_attribute_id']}-{$orderDetail['iso_code']}"; - $orderDetail['conversion_rate'] = (float) $orderDetail['conversion_rate']; - } - } - - /** - * @param array $orderStatuses - * - * @return array - */ - private function castOrderStatuses(&$orderStatuses) - { - $castedOrderStatuses = []; - foreach ($orderStatuses as $orderStatus) { - $castedOrderStatus = []; - $castedOrderStatus['id_order_state'] = (int) $orderStatus['id_order_state']; - $castedOrderStatus['id_order'] = (int) $orderStatus['id_order']; - $castedOrderStatus['id_order_history'] = (int) $orderStatus['id_order_history']; - $castedOrderStatus['name'] = (string) $orderStatus['name']; - $castedOrderStatus['template'] = (string) $orderStatus['template']; - $castedOrderStatus['date_add'] = $orderStatus['date_add']; - $castedOrderStatus['is_validated'] = (bool) $orderStatus['logable']; - $castedOrderStatus['is_delivered'] = (bool) $orderStatus['delivery']; - $castedOrderStatus['is_shipped'] = (bool) $orderStatus['shipped']; - $castedOrderStatus['is_paid'] = (bool) $orderStatus['paid']; - $castedOrderStatus['is_deleted'] = (bool) $orderStatus['deleted']; - $castedOrderStatus['created_at'] = $castedOrderStatus['date_add']; - $castedOrderStatus['updated_at'] = $castedOrderStatus['date_add']; - $castedOrderStatuses[] = $castedOrderStatus; - } - - return $castedOrderStatuses; - } - - /** - * @param array $orderDetail - * - * @return void - */ - private function castAddressIsoCodes(&$orderDetail) - { - if (!$orderDetail['address_iso']) { - $orderDetail['invoice_country_code'] = null; - $orderDetail['delivery_country_code'] = null; - - return; - } - - $addressAndIsoCodes = explode(',', $orderDetail['address_iso']); - if (count($addressAndIsoCodes) === 1) { - $addressAndIsoCode = explode(':', $addressAndIsoCodes[0]); - $orderDetail['invoice_country_code'] = $addressAndIsoCode[1]; - $orderDetail['delivery_country_code'] = $addressAndIsoCode[1]; - - return; - } - - foreach ($addressAndIsoCodes as $addressAndIsoCodeString) { - $addressAndIsoCode = explode(':', $addressAndIsoCodeString); - if ($addressAndIsoCode[0] === 'delivery') { - $orderDetail['delivery_country_code'] = $addressAndIsoCode[1]; - } elseif ($addressAndIsoCode[0] === 'invoice') { - $orderDetail['invoice_country_code'] = $addressAndIsoCode[1]; - } - } - } - - /** - * @param array $orderCartRules - * - * @return void - */ - private function castOrderCartRulesValues(&$orderCartRules) - { - foreach ($orderCartRules as &$orderCartRule) { - $orderCartRule['id_order_cart_rule'] = (int) $orderCartRule['id_order_cart_rule']; - $orderCartRule['id_order'] = (int) $orderCartRule['id_order']; - $orderCartRule['id_cart_rule'] = (int) $orderCartRule['id_cart_rule']; - $orderCartRule['id_order_invoice'] = (int) $orderCartRule['id_order_invoice']; - $orderCartRule['value'] = (float) $orderCartRule['value']; - $orderCartRule['value_tax_excl'] = (float) $orderCartRule['value_tax_excl']; - $orderCartRule['free_shipping'] = (bool) $orderCartRule['free_shipping']; - $orderCartRule['deleted'] = isset($orderCartRule['deleted']) ? (bool) $orderCartRule['deleted'] : false; - } - } -} diff --git a/src/Provider/PaginatedApiDataProviderInterface.php b/src/Provider/PaginatedApiDataProviderInterface.php deleted file mode 100644 index 646ea950..00000000 --- a/src/Provider/PaginatedApiDataProviderInterface.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso); - - /** - * @param int $offset - * @param string $langIso - * - * @return int - * - * @@throws \PrestaShopDatabaseException - */ - public function getRemainingObjectsCount($offset, $langIso); - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds); - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso); -} diff --git a/src/Provider/ProductDataProvider.php b/src/Provider/ProductDataProvider.php deleted file mode 100644 index 8480bd81..00000000 --- a/src/Provider/ProductDataProvider.php +++ /dev/null @@ -1,143 +0,0 @@ -productRepository = $productRepository; - $this->productDecorator = $productDecorator; - $this->productSupplierDataProvider = $productSupplierDataProvider; - $this->languageRepository = $languageRepository; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - $products = $this->productRepository->getProducts($offset, $limit, $langId); - - if (!$products) { - return []; - } - - $this->productDecorator->decorateProducts($products, $langIso, $langId); - - $bundles = $this->productDecorator->getBundles($products); - - $productSuppliers = $this->productSupplierDataProvider->getFormattedData($offset, $limit, $langIso); - - $products = array_map(function ($product) { - return [ - 'id' => $product['unique_product_id'], - 'collection' => Config::COLLECTION_PRODUCTS, - 'properties' => $product, - ]; - }, $products); - - return array_merge($products, $bundles, $productSuppliers); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - * - * @@throws \PrestaShopDatabaseException - */ - public function getRemainingObjectsCount($offset, $langIso) - { - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - return (int) $this->productRepository->getRemainingProductsCount($offset, $langId); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - $products = $this->productRepository->getProductsIncremental($limit, $langId, $objectIds); - - if (!empty($products)) { - $this->productDecorator->decorateProducts($products, $langIso, $langId); - } else { - return []; - } - - $bundles = $this->productDecorator->getBundles($products); - - $productSuppliers = $this->productSupplierDataProvider->getFormattedDataIncremental($limit, $langIso, $objectIds); - - $products = array_map(function ($product) { - return [ - 'id' => $product['unique_product_id'], - 'collection' => Config::COLLECTION_PRODUCTS, - 'properties' => $product, - ]; - }, $products); - - return array_merge($products, $bundles, $productSuppliers); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - $langId = $this->languageRepository->getLanguageIdByIsoCode($langIso); - - return $this->productRepository->getQueryForDebug($offset, $limit, $langId); - } -} diff --git a/src/Provider/ProductSupplierDataProvider.php b/src/Provider/ProductSupplierDataProvider.php deleted file mode 100644 index f1fa6455..00000000 --- a/src/Provider/ProductSupplierDataProvider.php +++ /dev/null @@ -1,107 +0,0 @@ -productSupplierRepository = $productSupplierRepository; - $this->productSupplierDecorator = $productSupplierDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $productSuppliers = $this->productSupplierRepository->getProductSuppliers($offset, $limit); - - if (empty($productSuppliers)) { - return []; - } - $this->productSupplierDecorator->decorateProductSuppliers($productSuppliers); - - return array_map(function ($productSupplier) { - return [ - 'id' => $productSupplier['id_product_supplier'], - 'collection' => Config::COLLECTION_PRODUCT_SUPPLIERS, - 'properties' => $productSupplier, - ]; - }, $productSuppliers); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->productSupplierRepository->getRemainingProductSuppliersCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $productSuppliers = $this->productSupplierRepository->getProductSuppliersIncremental($limit, $objectIds); - - if (!is_array($productSuppliers) || empty($productSuppliers)) { - return []; - } - - $this->productSupplierDecorator->decorateProductSuppliers($productSuppliers); - - return array_map(function ($productSupplier) { - return [ - 'id' => $productSupplier['id_product_supplier'], - 'collection' => Config::COLLECTION_PRODUCT_SUPPLIERS, - 'properties' => $productSupplier, - ]; - }, $productSuppliers); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->productSupplierRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/StockDataProvider.php b/src/Provider/StockDataProvider.php deleted file mode 100644 index 1f17b456..00000000 --- a/src/Provider/StockDataProvider.php +++ /dev/null @@ -1,164 +0,0 @@ -stockRepository = $stockRepository; - $this->stockMvtRepository = $stockMvtRepository; - $this->stockDecorator = $stockDecorator; - $this->arrayFormatter = $arrayFormatter; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $stocks = $this->stockRepository->getStocks($offset, $limit); - - if (empty($stocks)) { - return []; - } - $this->stockDecorator->decorateStocks($stocks); - - $stockMvts = $this->getStockMvts($langIso, $stocks); - - $stocks = array_map(function ($stock) { - return [ - 'id' => $stock['id_stock_available'], - 'collection' => Config::COLLECTION_STOCKS, - 'properties' => $stock, - ]; - }, $stocks); - - return array_merge($stocks, $stockMvts); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->stockRepository->getRemainingStocksCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $stocks = $this->stockRepository->getStocksIncremental($limit, $objectIds); - - if (!is_array($stocks) || empty($stocks)) { - return []; - } - - $this->stockDecorator->decorateStocks($stocks); - - $stockMvts = $this->getStockMvts($langIso, $stocks); - - $stocks = array_map(function ($stock) { - return [ - 'id' => $stock['id_stock_available'], - 'collection' => Config::COLLECTION_STOCKS, - 'properties' => $stock, - ]; - }, $stocks); - - return array_merge($stocks, $stockMvts); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->stockRepository->getQueryForDebug($offset, $limit); - } - - /** - * @param string $langIso - * @param array $stocks - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - private function getStockMvts($langIso, $stocks) - { - if (empty($stocks)) { - return []; - } - - $stockIds = $this->arrayFormatter->formatValueArray($stocks, 'id_stock_available'); - - $stockMvts = $this->stockMvtRepository->getStockMvts($langIso, $stockIds); - - if (!is_array($stockMvts) || empty($stockMvts)) { - return []; - } - - $this->stockDecorator->decorateStockMvts($stockMvts); - - $stockMvts = array_map(function ($stockMvt) { - return [ - 'id' => $stockMvt['id_stock_mvt'], - 'collection' => Config::COLLECTION_STOCK_MVTS, - 'properties' => $stockMvt, - ]; - }, $stockMvts); - - return $stockMvts; - } -} diff --git a/src/Provider/StoreDataProvider.php b/src/Provider/StoreDataProvider.php deleted file mode 100644 index 7b4226fa..00000000 --- a/src/Provider/StoreDataProvider.php +++ /dev/null @@ -1,106 +0,0 @@ -storeRepository = $storeRepository; - $this->storeDecorator = $storeDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $stores = $this->storeRepository->getStores($offset, $limit, $langIso); - - if (!is_array($stores)) { - return []; - } - - $this->storeDecorator->decorateStores($stores); - - return array_map(function ($store) { - return [ - 'id' => $store['id_store'], - 'collection' => Config::COLLECTION_STORES, - 'properties' => $store, - ]; - }, $stores); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->storeRepository->getRemainingStoreCount($offset, $langIso); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $stores = $this->storeRepository->getStoresIncremental($limit, $langIso, $objectIds); - - if (!is_array($stores)) { - return []; - } - - $this->storeDecorator->decorateStores($stores); - - return array_map(function ($store) { - return [ - 'id' => $store['id_store'], - 'collection' => Config::COLLECTION_STORES, - 'properties' => $store, - ]; - }, $stores); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->storeRepository->getQueryForDebug($offset, $limit, $langIso); - } -} diff --git a/src/Provider/SupplierDataProvider.php b/src/Provider/SupplierDataProvider.php deleted file mode 100644 index 2b044996..00000000 --- a/src/Provider/SupplierDataProvider.php +++ /dev/null @@ -1,105 +0,0 @@ -supplierRepository = $supplierRepository; - $this->supplierDecorator = $supplierDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $suppliers = $this->supplierRepository->getSuppliers($offset, $limit, $langIso); - - if (!is_array($suppliers)) { - return []; - } - $this->supplierDecorator->decorateSuppliers($suppliers); - - return array_map(function ($supplier) { - return [ - 'id' => $supplier['id_supplier'], - 'collection' => Config::COLLECTION_SUPPLIERS, - 'properties' => $supplier, - ]; - }, $suppliers); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->supplierRepository->getRemainingSuppliersCount($offset, $langIso); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $suppliers = $this->supplierRepository->getSuppliersIncremental($limit, $langIso, $objectIds); - - if (!is_array($suppliers)) { - return []; - } - $this->supplierDecorator->decorateSuppliers($suppliers); - - return array_map(function ($supplier) { - return [ - 'id' => $supplier['id_supplier'], - 'collection' => Config::COLLECTION_SUPPLIERS, - 'properties' => $supplier, - ]; - }, $suppliers); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->supplierRepository->getQueryForDebug($offset, $limit, $langIso); - } -} diff --git a/src/Provider/TranslationDataProvider.php b/src/Provider/TranslationDataProvider.php deleted file mode 100644 index 2494e557..00000000 --- a/src/Provider/TranslationDataProvider.php +++ /dev/null @@ -1,120 +0,0 @@ -translationRepository = $translationRepository; - $this->translationDecorator = $translationDecorator; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - // translations are stored as xml files before version 1.7 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '<')) { - return []; - } - - $translations = $this->translationRepository->getTranslations($offset, $limit); - - if (!is_array($translations)) { - return []; - } - $this->translationDecorator->decorateTranslations($translations); - - return array_map(function ($translation) { - return [ - 'id' => $translation['id_lang'], - 'collection' => Config::COLLECTION_TRANSLATIONS, - 'properties' => $translation, - ]; - }, $translations); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - // translations are stored as xml files before version 1.7 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '<')) { - return 0; - } - - return (int) $this->translationRepository->getRemainingTranslationsCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * @param array $objectIds - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - // translations are stored as xml files before version 1.7 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '<')) { - return []; - } - - $translations = $this->translationRepository->getTranslationsIncremental($limit, $objectIds); - - if (!is_array($translations)) { - return []; - } - $this->translationDecorator->decorateTranslations($translations); - - return array_map(function ($translation) { - return [ - 'id' => $translation['id_lang'], - 'collection' => Config::COLLECTION_TRANSLATIONS, - 'properties' => $translation, - ]; - }, $translations); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->translationRepository->getQueryForDebug($offset, $limit); - } -} diff --git a/src/Provider/WishlistDataProvider.php b/src/Provider/WishlistDataProvider.php deleted file mode 100644 index 8eef8710..00000000 --- a/src/Provider/WishlistDataProvider.php +++ /dev/null @@ -1,163 +0,0 @@ -wishlistRepository = $wishlistRepository; - $this->wishlistProductRepository = $wishlistProductRepository; - $this->wishlistDecorator = $wishlistDecorator; - $this->arrayFormatter = $arrayFormatter; - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedData($offset, $limit, $langIso) - { - $wishlists = $this->wishlistRepository->getWishlists($offset, $limit); - - if (empty($wishlists)) { - return []; - } - - $wishlistProducts = $this->getWishlistProducts($wishlists); - - $this->wishlistDecorator->decorateWishlists($wishlists); - - $wishlists = array_map(function ($wishlist) { - return [ - 'id' => $wishlist['id_wishlist'], - 'collection' => Config::COLLECTION_WISHLISTS, - 'properties' => $wishlist, - ]; - }, $wishlists); - - return array_merge($wishlists, $wishlistProducts); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingObjectsCount($offset, $langIso) - { - return (int) $this->wishlistRepository->getRemainingWishlistsCount($offset); - } - - /** - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) - { - $wishlists = $this->wishlistRepository->getWishlistsIncremental($limit, $objectIds); - - if (!is_array($wishlists) || empty($wishlists)) { - return []; - } - - $wishlistProducts = $this->getWishlistProducts($wishlists); - - $this->wishlistDecorator->decorateWishlists($wishlists); - - $wishlists = array_map(function ($wishlist) { - return [ - 'id' => $wishlist['id_wishlist'], - 'collection' => Config::COLLECTION_WISHLISTS, - 'properties' => $wishlist, - ]; - }, $wishlists); - - return array_merge($wishlists, $wishlistProducts); - } - - /** - * @param int $offset - * @param int $limit - * @param string $langIso - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $langIso) - { - return $this->wishlistRepository->getQueryForDebug($offset, $limit); - } - - /** - * @param array $wishlists - * - * @return array - * - * @@throws \PrestaShopDatabaseException - */ - private function getWishlistProducts(&$wishlists) - { - if (empty($wishlists)) { - return []; - } - - $wishlistIds = $this->arrayFormatter->formatValueArray($wishlists, 'id_wishlist'); - - $wishlistProducts = $this->wishlistProductRepository->getWishlistProducts($wishlistIds); - - if (!is_array($wishlistProducts) || empty($wishlistProducts)) { - return []; - } - - $this->wishlistDecorator->decorateWishlistProducts($wishlistProducts); - - $wishlistProducts = array_map(function ($wishlistProduct) { - return [ - 'id' => $wishlistProduct['id_wishlist_product'], - 'collection' => Config::COLLECTION_WISHLIST_PRODUCTS, - 'properties' => $wishlistProduct, - ]; - }, $wishlistProducts); - - return $wishlistProducts; - } -} diff --git a/src/Repository/AbstractRepository.php b/src/Repository/AbstractRepository.php new file mode 100644 index 00000000..ad95ec90 --- /dev/null +++ b/src/Repository/AbstractRepository.php @@ -0,0 +1,167 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +use PrestaShop\Module\PsEventbus\Service\CommonService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +abstract class AbstractRepository +{ + /** + * @var \Context + */ + private $context; + + /** + * @var \Db + */ + protected $db; + + /** + * @var \DbQuery + */ + protected $query; + + public function __construct() + { + $context = \Context::getContext(); + + if ($context == null) { + throw new \PrestaShopException('Context not found'); + } + + $this->context = $context; + $this->db = \Db::getInstance(); + } + + /** + * @param string $tableName + * @param string|null $alias + * + * @return void + */ + protected function generateMinimalQuery($tableName, $alias = null) + { + $this->query = new \DbQuery(); + + $this->query->from($tableName, $alias); + } + + /** + * @return \Context + */ + protected function getContext() + { + return $this->context; + } + + /** + * @return \Language|\PrestaShopBundle\Install\Language + * + * @throws \PrestaShopException + */ + protected function getLanguageContext() + { + if ($this->context->language === null) { + throw new \PrestaShopException('No language context'); + } + + return $this->context->language; + } + + /** + * @return \Shop + * + * @throws \PrestaShopException + */ + protected function getShopContext() + { + if ($this->context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + return $this->context->shop; + } + + /** + * @param string $tableName + * + * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + protected function checkIfTableExist($tableName) + { + $request = 'SELECT * FROM information_schema.tables WHERE table_name LIKE \'' . $tableName . '\' LIMIT 1;'; + + return $this->db->executeS($request); + } + + /** + * @param bool $disableCurrentExplain + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + protected function runQuery($disableCurrentExplain = null) + { + $explainSql = false; + + if (defined('PS_EVENTBUS_EXPLAIN_SQL_ENABLED')) { + $explainSql = PS_EVENTBUS_EXPLAIN_SQL_ENABLED; + } + + if ($explainSql && !$disableCurrentExplain) { + $this->debugQuery(); + } + + return (array) $this->db->executeS($this->query); + } + + /** + * @return void + * + * @throws \PrestaShopException + */ + private function debugQuery() + { + $queryStringified = preg_replace('/\s+/', ' ', $this->query->build()); + + $response = array_merge( + (array) $this->query, + ['queryStringified' => $queryStringified] + ); + + CommonService::exitWithResponse($response); + } +} diff --git a/src/Repository/BundleRepository.php b/src/Repository/BundleRepository.php index 97b8d310..d7c804ad 100644 --- a/src/Repository/BundleRepository.php +++ b/src/Repository/BundleRepository.php @@ -1,62 +1,135 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class BundleRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class BundleRepository extends AbstractRepository implements RepositoryInterface { + const TABLE_NAME = 'pack'; + /** - * @var \Db + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private $db; - - public function __construct() + public function generateFullQuery($langIso, $withSelecParameters) { - $this->db = \Db::getInstance(); + $this->generateMinimalQuery(self::TABLE_NAME, 'pac'); + + $this->query + ->innerJoin('product', 'p', 'p.id_product = pac.id_product_pack') + ->innerJoin('product_shop', 'ps', 'ps.id_product = p.id_product AND ps.id_shop = ' . parent::getShopContext()->id) + ->leftJoin('product_attribute_shop', 'pas', 'pas.id_product = p.id_product AND pas.id_shop = ps.id_shop') + ->leftJoin('product_attribute', 'pa', 'pas.id_product_attribute = pa.id_product_attribute') + ->where('p.cache_is_pack=1') + ; + + if ($withSelecParameters) { + $this->query + ->select('p.id_product') + ->select('pac.id_product_item') + ->select('IFNULL(pas.id_product_attribute, 0) as product_id_attribute') + ->select('pac.id_product_pack as id_bundle') + ->select('pac.id_product_attribute_item as id_product_attribute') + ->select('p.id_product') + ->select('pac.quantity') + ; + } } /** - * @param int $productPackId + * @param int $offset + * @param int $limit + * @param string $langIso * - * @return \DbQuery + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - private function getBaseQuery($productPackId) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = new \DbQuery(); + $this->generateFullQuery($langIso, true); - $query->from('pack', 'pac') - ->innerJoin('product', 'p', 'p.id_product = pac.id_product_item'); + $this->query->limit((int) $limit, (int) $offset); - $query->where('pac.id_product_pack = ' . (int) $productPackId); - - return $query; + return $this->runQuery(); } /** - * @param int $productPackId + * @param int $limit + * @param array $contentIds + * @param string $langIso * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getBundleProducts($productPackId) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery($productPackId); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $result = $this->db->executeS($query); + $this->query + ->where('pac.id_product IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return is_array($result) ? $result : []; + return $this->runQuery(); } /** - * @param \DbQuery $query + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int * - * @return void + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - private function addSelectParameters(\DbQuery $query) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query->select('pac.id_product_pack as id_bundle, pac.id_product_attribute_item as id_product_attribute'); - $query->select('p.id_product, pac.quantity'); + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; } } diff --git a/src/Repository/CarrierDetailRepository.php b/src/Repository/CarrierDetailRepository.php new file mode 100644 index 00000000..ce51b3bf --- /dev/null +++ b/src/Repository/CarrierDetailRepository.php @@ -0,0 +1,184 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CarrierDetailRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'carrier'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'ca'); + + $this->query + ->innerJoin('delivery', 'd', 'ca.id_carrier = d.id_carrier AND d.id_zone IS NOT NULL') + ->innerJoin('country', 'co', 'd.id_zone = co.id_zone AND co.iso_code IS NOT NULL AND co.active = 1') + ->leftJoin('range_weight', 'rw', 'ca.id_carrier = rw.id_carrier AND d.id_range_weight = rw.id_range_weight') + ->leftJoin('range_price', 'rp', 'ca.id_carrier = rp.id_carrier AND d.id_range_price = rp.id_range_price') + ->leftJoin('state', 's', 'co.id_zone = s.id_zone AND co.id_country = s.id_country AND s.active = 1') + ->leftJoin('configuration', 'conf', 'conf.name = "PS_SHIPPING_METHOD"') + ; + + if ($withSelecParameters) { + $this->query + ->select('ca.id_reference') + ->select('d.id_zone') + ->select(' + CASE + WHEN d.id_range_weight IS NOT NULL AND d.id_range_weight != 0 THEN d.id_range_weight + WHEN d.id_range_price IS NOT NULL AND d.id_range_price != 0 THEN d.id_range_price + END AS id_range + ') + ->select(' + CASE + WHEN ca.is_free = 1 THEN "free_shipping" + WHEN ca.shipping_method = 0 AND conf.value IS NULL THEN "range_price" + WHEN ca.shipping_method = 0 AND conf.value IS NOT NULL THEN "range_weight" + WHEN ca.shipping_method = 1 THEN "range_weight" + WHEN ca.shipping_method = 2 THEN "range_price" + END AS shipping_method + ') + ->select(' + CASE + WHEN rw.delimiter1 IS NOT NULL THEN rw.delimiter1 + WHEN rp.delimiter1 IS NOT NULL THEN rp.delimiter1 + END AS delimiter1 + ') + ->select(' + CASE + WHEN rw.delimiter2 IS NOT NULL THEN rw.delimiter2 + WHEN rp.delimiter2 IS NOT NULL THEN rp.delimiter2 + END AS delimiter2 + ') + ->select(' + GROUP_CONCAT( + DISTINCT co.iso_code + ORDER BY co.iso_code ASC + SEPARATOR \',\' + ) AS country_ids + ') + ->select(' + GROUP_CONCAT( + DISTINCT + s.iso_code + ORDER BY s.iso_code ASC + SEPARATOR \',\' + ) AS state_ids + ') + ->select(' + ( + SELECT d2.price + FROM ps_delivery d2 + WHERE d2.id_carrier = d.id_carrier + ORDER BY d2.id_delivery DESC + LIMIT 1 + ) AS price + ') + ; + + $this->query->groupBy('ca.id_reference, co.id_zone, id_range'); + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('ca.id_carrier IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit); + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $result = $this->db->executeS(' + SELECT (COUNT(*) - ' . (int) $offset . ') AS count + FROM (' . $this->query->build() . ') as subquery; + '); + + return is_array($result) ? $result[0]['count'] : []; + } +} diff --git a/src/Repository/CarrierRepository.php b/src/Repository/CarrierRepository.php index f36d8c89..b6c5b3e4 100644 --- a/src/Repository/CarrierRepository.php +++ b/src/Repository/CarrierRepository.php @@ -1,235 +1,150 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CarrierRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; - - /** - * @var int - */ - private $shopId; - - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $this->shopId = (int) $this->context->shop->id; - } +if (!defined('_PS_VERSION_')) { + exit; +} - /** - * @param \Carrier $carrierObj - * - * @return array|false - */ - public function getDeliveryPriceByRange(\Carrier $carrierObj) - { - $rangeTable = $carrierObj->getRangeTable(); - switch ($rangeTable) { - case 'range_weight': - return $this->getCarrierByWeightRange($carrierObj, 'range_weight'); - case 'range_price': - return $this->getCarrierByPriceRange($carrierObj, 'range_price'); - default: - return false; - } - } +class CarrierRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'carrier'; /** - * @param \Carrier $carrierObj - * @param string $rangeTable + * @param string $langIso + * @param bool $withSelecParameters * - * @return array - */ - private function getCarrierByPriceRange( - \Carrier $carrierObj, - $rangeTable - ) { - $deliveryPriceByRange = \Carrier::getDeliveryPriceByRanges($rangeTable, (int) $carrierObj->id); - - $filteredRanges = []; - foreach ($deliveryPriceByRange as $range) { - $filteredRanges[$range['id_range_price']]['id_range_price'] = $range['id_range_price']; - $filteredRanges[$range['id_range_price']]['id_carrier'] = $range['id_carrier']; - $filteredRanges[$range['id_range_price']]['zones'][$range['id_zone']]['id_zone'] = $range['id_zone']; - $filteredRanges[$range['id_range_price']]['zones'][$range['id_zone']]['price'] = $range['price']; - } - - return $filteredRanges; - } - - /** - * @param \Carrier $carrierObj - * @param string $rangeTable + * @return mixed * - * @return array + * @throws \PrestaShopException */ - private function getCarrierByWeightRange( - \Carrier $carrierObj, - $rangeTable - ) { - $deliveryPriceByRange = \Carrier::getDeliveryPriceByRanges($rangeTable, (int) $carrierObj->id); - - $filteredRanges = []; - foreach ($deliveryPriceByRange as $range) { - $filteredRanges[$range['id_range_weight']]['id_range_weight'] = $range['id_range_weight']; - $filteredRanges[$range['id_range_weight']]['id_carrier'] = $range['id_carrier']; - $filteredRanges[$range['id_range_weight']]['zones'][$range['id_zone']]['id_zone'] = $range['id_zone']; - $filteredRanges[$range['id_range_weight']]['zones'][$range['id_zone']]['price'] = $range['price']; + public function generateFullQuery($langIso, $withSelecParameters) + { + $langId = (int) \Language::getIdByIso($langIso); + + $this->generateMinimalQuery(self::TABLE_NAME, 'c'); + + $this->query + ->leftJoin('carrier_lang', 'cl', 'cl.id_carrier = c.id_carrier AND cl.id_lang = ' . $langId) + ->leftJoin('carrier_shop', 'cs', 'cs.id_carrier = c.id_carrier') + ; + + $this->query + ->where('cs.id_shop = ' . (int) parent::getShopContext()->id) + ->where('deleted=0') + ; + + if ($withSelecParameters) { + $this->query + ->select('c.id_carrier') + ->select('c.id_reference') + ->select('c.name') + ->select('c.url') + ->select('c.active') + ->select('c.deleted') + ->select('c.range_behavior AS disable_carrier_when_out_of_range') + ->select('c.is_module') + ->select('c.is_free') + ->select('c.shipping_external') + ->select('c.need_range') + ->select('c.external_module_name') + ->select('c.max_width') + ->select('c.max_height') + ->select('c.max_depth') + ->select('c.max_weight') + ->select('c.grade') + ->select('cl.delay AS delay') + ->select('c.shipping_handling') + ; } - - return $filteredRanges; } /** * @param int $offset * @param int $limit - * @param int $langId - * - * @return \DbQuery - */ - private function getAllCarriersQuery($offset, $limit, $langId) - { - $query = new \DbQuery(); - $query->from('carrier', 'c'); - $query->select('c.id_carrier'); - $query->leftJoin('carrier_lang', 'cl', 'cl.id_carrier = c.id_carrier AND cl.id_lang = ' . (int) $langId); - $query->leftJoin('carrier_shop', 'cs', 'cs.id_carrier = c.id_carrier'); - $query->where('cs.id_shop = ' . $this->shopId); - $query->where('deleted=0'); - $query->limit($limit, $offset); - - return $query; - } - - /** - * @param string $type * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getShippingIncremental($type, $langIso) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = new \DbQuery(); - $query->from(IncrementalSyncRepository::INCREMENTAL_SYNC_TABLE, 'aic'); - $query->leftJoin(EventbusSyncRepository::TYPE_SYNC_TABLE_NAME, 'ts', 'ts.type = aic.type'); - $query->where('aic.type = "' . pSQL($type) . '"'); - $query->where('ts.id_shop = ' . $this->shopId); - $query->where('ts.lang_iso = "' . pSQL($langIso) . '"'); - - return $this->db->executeS($query); - } + $this->generateFullQuery($langIso, true); - /** - * @param array $deliveryPriceByRange - * - * @return false|\RangeWeight|\RangePrice - * - * @throws \PrestaShopDatabaseException - * @throws \PrestaShopException - */ - public function getCarrierRange($deliveryPriceByRange) - { - if (isset($deliveryPriceByRange['id_range_weight'])) { - return new \RangeWeight($deliveryPriceByRange['id_range_weight']); - } - if (isset($deliveryPriceByRange['id_range_price'])) { - return new \RangePrice($deliveryPriceByRange['id_range_price']); - } + $this->query->limit((int) $limit, (int) $offset); - return false; + return $this->runQuery(); } /** - * @param int[] $carrierIds - * @param int $langId + * @param int $limit + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCarrierProperties($carrierIds, $langId) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - if (!$carrierIds) { + if ($contentIds == []) { return []; } - $query = new \DbQuery(); - $query->from('carrier', 'c'); - $query->select('c.*, cl.delay'); - $query->leftJoin('carrier_lang', 'cl', 'cl.id_carrier = c.id_carrier AND cl.id_lang = ' . (int) $langId); - $query->leftJoin('carrier_shop', 'cs', 'cs.id_carrier = c.id_carrier'); - $query->where('c.id_carrier IN (' . implode(',', array_map('intval', $carrierIds)) . ')'); - $query->where('cs.id_shop = ' . $this->shopId); - - return $this->db->executeS($query); - } - /** - * @param int $offset - * @param int $limit - * @param int $langId - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getAllCarrierProperties($offset, $limit, $langId) - { - return $this->db->executeS($this->getAllCarriersQuery($offset, $limit, $langId)); - } - - /** - * @param int $offset - * @param int $langId - * - * @return int - * - * @throws \PrestaShopDatabaseException - */ - public function getRemainingCarriersCount($offset, $langId) - { - $carriers = $this->getAllCarrierProperties($offset, 1, $langId); + $this->generateFullQuery($langIso, true); - if (!is_array($carriers) || empty($carriers)) { - return 0; - } + $this->query + ->where('c.id_carrier IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit); - return count($carriers); + return $this->runQuery(); } /** * @param int $offset * @param int $limit - * @param int $langId + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $langId) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getAllCarriersQuery($offset, $limit, $langId); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); + return $result[0]['count']; } } diff --git a/src/Repository/CarrierTaxeRepository.php b/src/Repository/CarrierTaxeRepository.php new file mode 100644 index 00000000..593fe981 --- /dev/null +++ b/src/Repository/CarrierTaxeRepository.php @@ -0,0 +1,154 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CarrierTaxeRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'carrier'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'ca'); + + $this->query + ->innerJoin('carrier_tax_rules_group_shop', 'ctrgs', 'ca.id_carrier = ctrgs.id_carrier') + ->innerJoin('tax_rule', 'tr', 'ctrgs.id_tax_rules_group = tr.id_tax_rules_group') + ->innerJoin('country', 'co', 'tr.id_country = co.id_country AND co.iso_code IS NOT NULL AND co.active = 1') + ->innerJoin('delivery', 'd', 'ca.id_carrier = d.id_carrier AND d.id_zone IS NOT NULL') + ->innerJoin('tax', 't', 'tr.id_tax = t.id_tax AND t.active = 1') + ->leftJoin('state', 's', 'tr.id_state = s.id_state AND s.active = 1') + ; + + $this->query + ->where('(co.id_zone = d.id_zone OR s.id_zone = d.id_zone)') + ; + + if ($withSelecParameters) { + $this->query + ->select('ca.id_reference') + ->select('co.id_zone') + ->select(' + CASE + WHEN d.id_range_weight IS NOT NULL AND d.id_range_weight != 0 THEN d.id_range_weight + WHEN d.id_range_price IS NOT NULL AND d.id_range_price != 0 THEN d.id_range_price + END AS id_range + ') + ->select('ctrgs.id_tax_rules_group AS id_carrier_tax') + ->select('co.iso_code as country_id') + ->select(' + GROUP_CONCAT( + DISTINCT + s.iso_code + ORDER BY s.iso_code ASC + SEPARATOR \',\' + ) AS state_ids + ') + ->select('t.rate AS tax_rate') + ; + + $this->query->groupBy('ca.id_reference, co.id_zone, id_range, country_id'); + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('ca.id_carrier IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit); + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $result = $this->db->executeS(' + SELECT (COUNT(*) - ' . (int) $offset . ') AS count + FROM (' . $this->query->build() . ') as subquery; + '); + + return is_array($result) ? $result[0]['count'] : []; + } +} diff --git a/src/Repository/CartProductRepository.php b/src/Repository/CartProductRepository.php index fa33e5e6..924871df 100644 --- a/src/Repository/CartProductRepository.php +++ b/src/Repository/CartProductRepository.php @@ -1,60 +1,127 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CartProductRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class CartProductRepository extends AbstractRepository implements RepositoryInterface { + const TABLE_NAME = 'cart_product'; + /** - * @var \Db + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private $db; + public function generateFullQuery($langIso, $withSelecParameters) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'cp'); + + $this->query->where('cp.id_shop = ' . (int) parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('cp.id_cart') + ->select('cp.id_product') + ->select('cp.id_product_attribute') + ->select('cp.quantity') + ->select('cp.date_add as created_at') + ; + } + } + /** - * @var \Context + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - private $context; - - public function __construct(\Context $context) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $this->db = \Db::getInstance(); - $this->context = $context; + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); } /** - * @return \DbQuery + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getBaseQuery() + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + if ($contentIds == []) { + return []; } - $shopId = (int) $this->context->shop->id; + $this->generateFullQuery($langIso, true); - $query = new \DbQuery(); + $this->query + ->where('cp.id_cart IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - $query->from('cart_product', 'cp') - ->where('cp.id_shop = ' . $shopId); - - return $query; + return $this->runQuery(); } /** - * @param array $cartIds + * @param int $offset + * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCartProducts($cartIds) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, false); - $query->select('cp.id_cart, cp.id_product, cp.id_product_attribute, cp.quantity, cp.date_add as created_at'); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - if (!empty($cartIds)) { - $query->where('cp.id_cart IN (' . implode(',', array_map('intval', $cartIds)) . ')'); - } + $result = $this->runQuery(true); - return $this->db->executeS($query); + return $result[0]['count']; } } diff --git a/src/Repository/CartRepository.php b/src/Repository/CartRepository.php index 77df6184..111db8a7 100644 --- a/src/Repository/CartRepository.php +++ b/src/Repository/CartRepository.php @@ -1,129 +1,125 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CartRepository -{ - /** - * @var \Db - */ - private $db; - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class CartRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'cart'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $this->context->shop->id; + $this->generateMinimalQuery(self::TABLE_NAME, 'c'); - $query = new \DbQuery(); + $this->query->where('c.id_shop = ' . (int) parent::getShopContext()->id); - $query->from('cart', 'c') - ->where('c.id_shop = ' . $shopId); - - return $query; + if ($withSelecParameters) { + $this->query + ->select('c.id_cart') + ->select('date_add as created_at') + ->select('date_upd as updated_at') + ; + } } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCarts($offset, $limit) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingCartsCount($offset) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, true); - $query->select('(COUNT(c.id_cart) - ' . (int) $offset . ') as count'); + $this->query->limit((int) $limit, (int) $offset); - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $cartIds + * @param array $contentIds + * @param string $langIso * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCartsIncremental($limit, $cartIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + if ($contentIds == []) { + return []; + } - $query->where('c.id_cart IN(' . implode(',', array_map('intval', $cartIds)) . ')') - ->limit($limit); + $this->generateFullQuery($langIso, true); - $result = $this->db->executeS($query); + $this->query + ->where('c.id_cart IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return is_array($result) ? $result : []; + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('c.id_cart, date_add as created_at, date_upd as updated_at'); + return $result[0]['count']; } } diff --git a/src/Repository/CartRuleRepository.php b/src/Repository/CartRuleRepository.php index adb821fb..545a6e08 100644 --- a/src/Repository/CartRuleRepository.php +++ b/src/Repository/CartRuleRepository.php @@ -1,132 +1,156 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CartRuleRepository -{ - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class CartRuleRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'cart_rule'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - public function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - $query = new \DbQuery(); - - $query->from('cart_rule', 'cr'); - - return $query; + $this->generateMinimalQuery(self::TABLE_NAME, 'cr'); + + if ($withSelecParameters) { + $this->query + ->select('cr.id_cart_rule') + ->select('cr.id_customer') + ->select('cr.code') + ->select('cr.date_from AS "from"') + ->select('cr.date_to AS "to"') + ->select('cr.description') + ->select('cr.quantity') + ->select('cr.quantity_per_user') + ->select('cr.priority') + ->select('cr.partial_use') + ->select('cr.minimum_amount') + ->select('cr.minimum_amount_tax') + ->select('cr.minimum_amount_currency') + ->select('cr.minimum_amount_shipping') + ->select('cr.country_restriction') + ->select('cr.carrier_restriction') + ->select('cr.group_restriction') + ->select('cr.cart_rule_restriction') + ->select('cr.product_restriction') + ->select('cr.shop_restriction') + ->select('cr.free_shipping') + ->select('cr.reduction_percent') + ->select('cr.reduction_amount') + ->select('cr.reduction_tax') + ->select('cr.reduction_currency') + ->select('cr.reduction_product') + ->select('cr.gift_product') + ->select('cr.gift_product_attribute') + ->select('cr.highlight') + ->select('cr.active') + ->select('cr.date_add AS created_at') + ->select('cr.date_upd AS updated_at') + ; + + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { + $this->query->select('cr.reduction_exclude_special'); + } + } } /** - * @param int $limit * @param int $offset + * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCartRules($limit, $offset) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, true); - $query->select('cr.id_cart_rule,cr.id_customer, cr.code, cr.date_from AS "from",cr.date_to AS "to",cr.description,cr.quantity'); - $query->select('cr.quantity_per_user,cr.priority,cr.partial_use,cr.minimum_amount,cr.minimum_amount_tax,cr.minimum_amount_currency'); - $query->select('cr.minimum_amount_shipping,cr.country_restriction,cr.carrier_restriction,cr.group_restriction,cr.cart_rule_restriction'); - $query->select('cr.product_restriction,cr.shop_restriction,cr.free_shipping,cr.reduction_percent,cr.reduction_amount,cr.reduction_tax'); - $query->select('cr.reduction_currency,cr.reduction_product,cr.gift_product,cr.gift_product_attribute'); - $query->select('cr.highlight,cr.active,cr.date_add AS created_at,cr.date_upd AS updated_at'); + $this->query->limit((int) $limit, (int) $offset); - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query->select('cr.reduction_exclude_special'); - } - - $query->limit($limit, $offset); - - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $cartRuleIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCartRulesIncremental($limit, $cartRuleIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); - - $query->select('cr.id_cart_rule,cr.id_customer, cr.code, cr.date_from AS "from",cr.date_to AS "to",cr.description,cr.quantity'); - $query->select('cr.quantity_per_user,cr.priority,cr.partial_use,cr.minimum_amount,cr.minimum_amount_tax,cr.minimum_amount_currency'); - $query->select('cr.minimum_amount_shipping,cr.country_restriction,cr.carrier_restriction,cr.group_restriction,cr.cart_rule_restriction'); - $query->select('cr.product_restriction,cr.shop_restriction,cr.free_shipping,cr.reduction_percent,cr.reduction_amount,cr.reduction_tax'); - $query->select('cr.reduction_currency,cr.reduction_product,cr.gift_product,cr.gift_product_attribute'); - $query->select('cr.highlight,cr.active,cr.date_add AS created_at,cr.date_upd AS updated_at'); - - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query->select('cr.reduction_exclude_special'); + if ($contentIds == []) { + return []; } - $query->where('cr.id_cart_rule IN(' . implode(',', array_map('intval', $cartRuleIds)) . ')') - ->limit($limit); - - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingCartRulesCount($offset) - { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, true); - $query->select('(COUNT(cr.id_cart_rule) - ' . (int) $offset . ') as count'); + $this->query + ->where('cr.id_cart_rule IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** - * @param int $limit * @param int $offset + * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($limit, $offset) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $query->select('cr.id_cart_rule,cr.id_customer, cr.code, cr.date_from AS "from",cr.date_to AS "to",cr.description,cr.quantity'); - $query->select('cr.quantity_per_user,cr.priority,cr.partial_use,cr.minimum_amount,cr.minimum_amount_tax,cr.minimum_amount_currency'); - $query->select('cr.minimum_amount_shipping,cr.country_restriction,cr.carrier_restriction,cr.group_restriction,cr.cart_rule_restriction'); - $query->select('cr.product_restriction,cr.shop_restriction,cr.free_shipping,cr.reduction_percent,cr.reduction_amount,cr.reduction_tax'); - $query->select('cr.reduction_currency,cr.reduction_product,cr.gift_product,cr.gift_product_attribute'); - $query->select('cr.highlight,cr.active,cr.date_add AS created_at,cr.date_upd AS updated_at'); - - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query->select('cr.reduction_exclude_special'); - } + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); + return $result[0]['count']; } } diff --git a/src/Repository/CategoryRepository.php b/src/Repository/CategoryRepository.php index b96cdc54..d2b2c2a0 100644 --- a/src/Repository/CategoryRepository.php +++ b/src/Repository/CategoryRepository.php @@ -1,237 +1,172 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CategoryRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var array - */ - private $categoryLangCache; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class CategoryRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'category_shop'; /** * @param string $langIso + * @param bool $withSelecParameters * - * @return \DbQuery + * @return mixed + * + * @throws \PrestaShopException */ - private function getBaseQuery($langIso) + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } + $this->generateMinimalQuery(self::TABLE_NAME, 'cs'); - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - $query->from('category_shop', 'cs') + $this->query ->innerJoin('category', 'c', 'cs.id_category = c.id_category') ->leftJoin('category_lang', 'cl', 'cl.id_category = cs.id_category') ->leftJoin('lang', 'l', 'l.id_lang = cl.id_lang') - ->where('cs.id_shop = ' . $shopId) + ->where('cs.id_shop = ' . parent::getShopContext()->id) ->where('cl.id_shop = cs.id_shop') - ->where('l.iso_code = "' . pSQL($langIso) . '"'); - - return $query; - } - - /** - * @param int $topCategoryId - * @param int $langId - * @param int $shopId - * - * @return array - */ - public function getCategoryPaths($topCategoryId, $langId, $shopId) - { - if ((int) $topCategoryId === 0) { - return [ - 'category_path' => '', - 'category_id_path' => '', - ]; - } - - $categories = []; - - try { - $categoriesWithParentsInfo = $this->getCategoriesWithParentInfo($langId, $shopId); - } catch (\PrestaShopDatabaseException $e) { - return [ - 'category_path' => '', - 'category_id_path' => '', - ]; - } - - $this->buildCategoryPaths($categoriesWithParentsInfo, $topCategoryId, $categories); - - $categories = array_reverse($categories); - - return [ - 'category_path' => implode(' > ', array_map(function ($category) { - return $category['name']; - }, $categories)), - 'category_id_path' => implode(' > ', array_map(function ($category) { - return $category['id_category']; - }, $categories)), - ]; - } - - /** - * @param array $categoriesWithParentsInfo - * @param int $currentCategoryId - * @param array $categories - * - * @return void - */ - private function buildCategoryPaths($categoriesWithParentsInfo, $currentCategoryId, &$categories) - { - foreach ($categoriesWithParentsInfo as $category) { - if ($category['id_category'] == $currentCategoryId) { - $categories[] = $category; - $this->buildCategoryPaths($categoriesWithParentsInfo, $category['id_parent'], $categories); + ->where('l.iso_code = "' . pSQL($langIso) . '"') + ; + + if ($withSelecParameters) { + $this->query + ->select('CONCAT(cs.id_category, "-", l.iso_code) as unique_category_id') + ->select('cs.id_category') + ->select('c.id_parent') + ->select('cl.name') + ->select('cl.description') + ->select('cl.link_rewrite') + ->select('cl.meta_title') + ->select('cl.meta_description') + ->select('l.iso_code') + ->select('c.date_add as created_at') + ->select('c.date_upd as updated_at') + ; + + // REMOVED HERE: https://github.com/PrestaShop/PrestaShop/commit/f37a8f61017654bae160b528a1a2eaf49edbdac0 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9.0', '<')) { + $this->query->select('cl.meta_keywords'); } } } /** - * @param int $langId - * @param int $shopId + * @param int $offset + * @param int $limit + * @param string $langIso * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCategoriesWithParentInfo($langId, $shopId) + public function retrieveContentsForFull($offset, $limit, $langIso) { - if (!isset($this->categoryLangCache[$langId])) { - $query = new \DbQuery(); - - $query->select('c.id_category, cl.name, c.id_parent') - ->from('category', 'c') - ->leftJoin( - 'category_lang', - 'cl', - 'cl.id_category = c.id_category AND cl.id_shop = ' . (int) $shopId - ) - ->where('cl.id_lang = ' . (int) $langId) - ->orderBy('cl.id_category'); - - $result = $this->db->executeS($query); - - if (is_array($result)) { - $this->categoryLangCache[$langId] = $result; - } else { - throw new \PrestaShopDatabaseException('No categories found'); - } - } + $this->generateFullQuery($langIso, true); - return $this->categoryLangCache[$langId]; + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); } /** - * @param int $offset * @param int $limit + * @param array $contentIds * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCategories($offset, $limit, $langIso) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery($langIso); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->limit($limit, $offset); + $this->query + ->where('cs.id_category IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingCategoriesCount($offset, $langIso) - { - $query = $this->getBaseQuery($langIso) - ->select('(COUNT(cs.id_category) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); - } - - /** * @param int $limit * @param string $langIso - * @param array $categoryIds * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCategoriesIncremental($limit, $langIso, $categoryIds) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery($langIso); + $this->generateFullQuery($langIso, false); - $this->addSelectParameters($query); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $query->where('c.id_category IN(' . implode(',', array_map('intval', $categoryIds)) . ')') - ->limit($limit); + $result = $this->runQuery(true); - return $this->db->executeS($query); + return $result[0]['count']; } /** - * @param int $offset - * @param int $limit - * @param string $langIso + * @param int $langId + * @param int $shopId * * @return array * * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $langIso) + public function getCategoriesWithParentInfo($langId, $shopId) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); + $this->generateMinimalQuery('category', 'c'); - $query->limit($limit, $offset); + $this->query + ->leftJoin('category_lang', 'cl', 'cl.id_category = c.id_category AND cl.id_shop = ' . (int) $shopId) + ->where('cl.id_lang = ' . (int) $langId) + ->orderBy('cl.id_category') + ; - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $this->query + ->select('c.id_category') + ->select('cl.name') + ->select('c.id_parent') + ; - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('CONCAT(cs.id_category, "-", l.iso_code) as unique_category_id, cs.id_category'); - $query->select('c.id_parent, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description'); - $query->select('l.iso_code, c.date_add as created_at, c.date_upd as updated_at'); + return $this->runQuery(true); } } diff --git a/src/Repository/ConfigurationRepository.php b/src/Repository/ConfigurationRepository.php deleted file mode 100644 index a2086802..00000000 --- a/src/Repository/ConfigurationRepository.php +++ /dev/null @@ -1,20 +0,0 @@ - - */ - private $countryIsoCodeCache = []; - - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } - - /** - * @return \DbQuery - */ - private function getBaseQuery() - { - if ($this->context->shop == null) { - throw new \PrestaShopException('No shop context'); - } - - if ($this->context->language == null) { - throw new \PrestaShopException('No language context'); - } - - $query = new \DbQuery(); - - $query->from('country', 'c') - ->innerJoin('country_shop', 'cs', 'cs.id_country = c.id_country') - ->innerJoin('country_lang', 'cl', 'cl.id_country = c.id_country') - ->where('cs.id_shop = ' . (int) $this->context->shop->id) - ->where('cl.id_lang = ' . (int) $this->context->language->id); - - return $query; - } - - /** - * @param int $zoneId - * @param bool $active - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getCountyIsoCodesByZoneId($zoneId, $active = null) - { - if ($active == null) { - $active = true; - } - - $cacheKey = $zoneId . '-' . (int) $active; - - if (!isset($this->countryIsoCodeCache[$cacheKey])) { - $query = $this->getBaseQuery(); - - $query->select('iso_code'); - $query->where('id_zone = ' . (int) $zoneId); - $query->where('active = ' . (bool) $active); - - $isoCodes = []; - $result = $this->db->executeS($query); - if (is_array($result)) { - foreach ($result as $country) { - $isoCodes[] = $country['iso_code']; - } - } - $this->countryIsoCodeCache[$cacheKey] = $isoCodes; - } - - return $this->countryIsoCodeCache[$cacheKey]; - } -} diff --git a/src/Repository/CurrencyRepository.php b/src/Repository/CurrencyRepository.php index 9116055c..31e2e5a0 100644 --- a/src/Repository/CurrencyRepository.php +++ b/src/Repository/CurrencyRepository.php @@ -1,155 +1,148 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CurrencyRepository -{ - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class CurrencyRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'currency'; /** + * @param string $langIso + * @param bool $withSelecParameters + * * @return mixed + * + * @throws \PrestaShopException */ - private function isLangAvailable() - { - return defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.6', '>='); - } - - /** - * @return array - */ - public function getCurrenciesIsoCodes() + public function generateFullQuery($langIso, $withSelecParameters) { - $currencies = \Currency::getCurrencies(); + $this->generateMinimalQuery(self::TABLE_NAME, 'c'); - return array_map(function ($currency) { - return $currency['iso_code']; - }, $currencies); - } - - /** - * @return string - */ - public function getDefaultCurrencyIsoCode() - { - $currency = \Currency::getDefaultCurrency(); + if ($this->isCurrencyLangAvailable()) { + $this->query->innerJoin('currency_lang', 'cl', 'cl.id_currency = c.id_currency'); + } - return $currency instanceof \Currency ? $currency->iso_code : ''; + if ($withSelecParameters) { + $this->query + ->select('c.id_currency') + ->select('c.iso_code') + ->select('c.conversion_rate') + ->select('c.deleted') + ->select('c.active') + ; + + if ($this->isCurrencyLangAvailable()) { + $this->query->select('cl.name'); + } else { + $this->query->select('\'\' as name'); + } + + // https://github.com/PrestaShop/PrestaShop/commit/37807f66b40b0cebb365ef952e919be15e9d6b2f#diff-3f41d3529ffdbfd1b994927eb91826a32a0560697025a734cf128a2c8e092a45R124 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.6.0', '>=')) { + $this->query->select('c.precision'); + } + } } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCurrencies($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); + $this->generateFullQuery($langIso, true); - return $this->db->executeS($query); - } + $this->query->limit((int) $limit, (int) $offset); - /** - * @param int $offset - * - * @return int - */ - public function getRemainingCurrenciesCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(c.id_currency) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $currencyIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCurrenciesIncremental($limit, $currencyIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->where('c.id_currency IN(' . implode(',', array_map('intval', $currencyIds)) . ')') - ->limit($limit); + if ($contentIds == []) { + return []; + } - return $this->db->executeS($query); - } + $this->generateFullQuery($langIso, true); - /** - * @return \DbQuery - */ - public function getBaseQuery() - { - $query = new \DbQuery(); - $query->from('currency', 'c'); - if ($this->isLangAvailable()) { - $query->innerJoin('currency_lang', 'cl', 'cl.id_currency = c.id_currency'); - } + $this->query + ->where('c.id_currency IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $query; + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); + return $result[0]['count']; } /** - * @param \DbQuery $query - * - * @return void + * @return mixed */ - private function addSelectParameters(\DbQuery $query) + private function isCurrencyLangAvailable() { - if ($this->isLangAvailable()) { - $query->select('c.id_currency, cl.name, c.iso_code, c.conversion_rate, c.deleted, c.active'); - } else { - $query->select('c.id_currency, \'\' as name, c.iso_code, c.conversion_rate, c.deleted, c.active'); - } - - // https://github.com/PrestaShop/PrestaShop/commit/37807f66b40b0cebb365ef952e919be15e9d6b2f#diff-3f41d3529ffdbfd1b994927eb91826a32a0560697025a734cf128a2c8e092a45R124 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.6.0', '>=')) { - $query->select('c.precision'); - } + return defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.6', '>='); } } diff --git a/src/Repository/CustomPriceRepository.php b/src/Repository/CustomPriceRepository.php deleted file mode 100644 index fc2eec9b..00000000 --- a/src/Repository/CustomPriceRepository.php +++ /dev/null @@ -1,146 +0,0 @@ -db = \Db::getInstance(); - $this->context = $context; - - if (!$this->context->employee instanceof \Employee) { - if (($employees = \Employee::getEmployees()) !== false) { - $this->context->employee = new \Employee($employees[0]['id_employee']); - } - } - } - - /** - * @return \DbQuery - */ - private function getBaseQuery() - { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - - $query->from('specific_price', 'sp') - ->leftJoin('country', 'c', 'c.id_country = sp.id_country') - ->leftJoin('currency', 'cur', 'cur.id_currency = sp.id_currency'); - - $query->where('sp.id_shop = 0 OR sp.id_shop = ' . $shopId); - - return $query; - } - - /** - * @param int $offset - * @param int $limit - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getSpecificPrices($offset, $limit) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } - - /** - * @param int $offset - * - * @return int - * - * @throws \PrestaShopDatabaseException - */ - public function getRemainingSpecificPricesCount($offset) - { - $query = $this->getBaseQuery(); - - $query->select('(COUNT(sp.id_specific_price) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('sp.id_specific_price, sp.id_product, sp.id_shop, sp.id_shop_group, sp.id_currency'); - $query->select('sp.id_country, sp.id_group, sp.id_customer, sp.id_product_attribute, sp.price, sp.from_quantity'); - $query->select('sp.reduction, sp.reduction_tax, sp.from, sp.to, sp.reduction_type'); - $query->select('c.iso_code as country'); - $query->select('cur.iso_code as currency'); - } - - /** - * @param int $limit - * @param array $specificPriceIds - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getSpecificPricesIncremental($limit, $specificPriceIds) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->where('sp.id_specific_price IN(' . implode(',', array_map('intval', $specificPriceIds)) . ')') - ->limit($limit); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } - - /** - * @param int $offset - * @param int $limit - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } -} diff --git a/src/Repository/CustomProductCarrierRepository.php b/src/Repository/CustomProductCarrierRepository.php new file mode 100644 index 00000000..5532b728 --- /dev/null +++ b/src/Repository/CustomProductCarrierRepository.php @@ -0,0 +1,141 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CustomProductCarrierRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'product_carrier'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'pc'); + + $this->query->where('pc.id_shop = ' . parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query->select('pc.*'); + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('pc.id_carrier_reference IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; + } + + /** + * @param int $idProduct + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function getCustomProductCarrierIdsByCarrierId($idProduct) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'pc'); + + $this->query + ->where('pc.id_product = ' . (int) $idProduct) + ->where('pc.id_shop = ' . parent::getShopContext()->id) + ; + + return $this->runQuery(true); + } +} diff --git a/src/Repository/CustomerRepository.php b/src/Repository/CustomerRepository.php index 27d0d0de..94e6eb83 100644 --- a/src/Repository/CustomerRepository.php +++ b/src/Repository/CustomerRepository.php @@ -1,127 +1,133 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class CustomerRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class CustomerRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'customer'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - public function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + $this->generateMinimalQuery(self::TABLE_NAME, 'c'); + + $this->query->where('c.id_shop = ' . parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('c.id_customer') + ->select('c.id_lang') + ->select('c.email') + ->select('c.newsletter') + ->select('c.newsletter_date_add') + ->select('c.optin') + ->select('c.active') + ->select('c.is_guest') + ->select('c.deleted') + ->select('c.date_add as created_at') + ->select('c.date_upd as updated_at') + ; } - - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - $query->from('customer', 'c') - ->where('c.id_shop = ' . $shopId); - - return $query; } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCustomers($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->limit($limit, $offset); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingCustomersCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(c.id_customer) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $customerIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getCustomersIncremental($limit, $customerIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('c.id_customer IN(' . implode(',', array_map('intval', $customerIds)) . ')') - ->limit($limit); + $this->query + ->where('c.id_customer IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('c.id_customer, c.id_lang, c.email, c.newsletter, c.newsletter_date_add'); - $query->select('c.optin, c.active, c.is_guest, c.deleted, c.date_add as created_at, c.date_upd as updated_at'); + return $result[0]['count']; } } diff --git a/src/Repository/DeletedObjectsRepository.php b/src/Repository/DeletedObjectsRepository.php deleted file mode 100644 index 67634c89..00000000 --- a/src/Repository/DeletedObjectsRepository.php +++ /dev/null @@ -1,94 +0,0 @@ -db = \Db::getInstance(); - $this->errorHandler = $errorHandler; - } - - /** - * @param int $shopId - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getDeletedObjectsGrouped($shopId) - { - $query = new \DbQuery(); - - $query->select('type, GROUP_CONCAT(id_object SEPARATOR ";") as ids') - ->from(self::DELETED_OBJECTS_TABLE) - ->where('id_shop = ' . (int) $shopId) - ->groupBy('type'); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } - - /** - * @param int $objectId - * @param string $objectType - * @param string $date - * @param int $shopId - * - * @return bool - */ - public function insertDeletedObject($objectId, $objectType, $date, $shopId) - { - try { - return $this->db->insert( - self::DELETED_OBJECTS_TABLE, - [ - 'id_shop' => $shopId, - 'id_object' => $objectId, - 'type' => $objectType, - 'created_at' => $date, - ], - false, - true, - \Db::ON_DUPLICATE_KEY - ); - } catch (\PrestaShopDatabaseException $e) { - $this->errorHandler->handle($e); - - return false; - } - } - - /** - * @param string $type - * @param array $objectIds - * @param int $shopId - * - * @return bool - */ - public function removeDeletedObjects($type, $objectIds, $shopId) - { - return $this->db->delete( - self::DELETED_OBJECTS_TABLE, - 'type = "' . pSQL($type) . '" - AND id_shop = ' . (int) $shopId . ' - AND id_object IN(' . implode(',', array_map('intval', $objectIds)) . ')' - ); - } -} diff --git a/src/Repository/EmployeeRepository.php b/src/Repository/EmployeeRepository.php index 82aefa5d..15b1a373 100644 --- a/src/Repository/EmployeeRepository.php +++ b/src/Repository/EmployeeRepository.php @@ -1,149 +1,147 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class EmployeeRepository -{ - /** - * @var \Context - */ - private $context; - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class EmployeeRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'employee'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + $this->generateMinimalQuery(self::TABLE_NAME, 'e'); + + $this->query + ->leftJoin('employee_shop', 'es', 'es.id_employee = e.id_employee') + ->where('es.id_shop = ' . parent::getShopContext()->id) + ; + + if ($withSelecParameters) { + $this->query + ->select('e.id_employee') + ->select('e.id_profile') + ->select('e.id_lang') + ->select('e.email') + ->select('e.bo_color') + ->select('e.bo_theme') + ->select('e.bo_css') + ->select('e.default_tab') + ->select('e.bo_width') + ->select('e.bo_menu') + ->select('e.active') + ->select('e.optin') + ->select('e.id_last_order') + ->select('e.id_last_customer_message') + ->select('e.id_last_customer') + ->select('e.last_connection_date') + ->select('es.id_shop as id_shop') + ; + + // https://github.com/PrestaShop/PrestaShop/commit/20f1d9fe8a03559dfa9d1f7109de1f70c99f1874#diff-cde6a9d4a58afb13ff068801ee09c0e712c5e90b0cbf5632a0cc965f15cb6802R107 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.8.0', '>=')) { + $this->query->select('e.has_enabled_gravatar'); + } } - - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - - $query->from('employee', 'e') - ->leftJoin('employee_shop', 'es', 'es.id_employee = e.id_employee'); - - $query->where('es.id_shop = ' . $shopId); - - return $query; } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getEmployees($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->limit($limit, $offset); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingEmployeesCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(e.id_employee) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $employeeIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getEmployeesIncremental($limit, $employeeIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('e.id_employee IN(' . implode(',', array_map('intval', $employeeIds)) . ')') - ->limit($limit); + $this->query + ->where('e.id_employee IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('e.id_employee'); - $query->select('e.id_profile'); - $query->select('e.id_lang'); - $query->select('e.email'); - $query->select('e.bo_color'); - $query->select('e.bo_theme'); - $query->select('e.bo_css'); - $query->select('e.default_tab'); - $query->select('e.bo_width'); - $query->select('e.bo_menu'); - $query->select('e.active'); - $query->select('e.optin'); - $query->select('e.id_last_order'); - $query->select('e.id_last_customer_message'); - $query->select('e.id_last_customer'); - $query->select('e.last_connection_date'); - $query->select('es.id_shop as id_shop'); - - // https://github.com/PrestaShop/PrestaShop/commit/20f1d9fe8a03559dfa9d1f7109de1f70c99f1874#diff-cde6a9d4a58afb13ff068801ee09c0e712c5e90b0cbf5632a0cc965f15cb6802R107 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.8.0', '>=')) { - $query->select('e.has_enabled_gravatar'); - } + return $result[0]['count']; } } diff --git a/src/Repository/EventbusSyncRepository.php b/src/Repository/EventbusSyncRepository.php deleted file mode 100644 index a9d33384..00000000 --- a/src/Repository/EventbusSyncRepository.php +++ /dev/null @@ -1,162 +0,0 @@ -db = \Db::getInstance(); - $this->context = $context; - - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $this->shopId = (int) $this->context->shop->id; - } - - /** - * @param string $type - * @param int $offset - * @param string $lastSyncDate - * @param string $langIso - * - * @return bool - * - * @throws \PrestaShopDatabaseException - */ - public function insertTypeSync($type, $offset, $lastSyncDate, $langIso = null) - { - $result = $this->db->insert( - self::TYPE_SYNC_TABLE_NAME, - [ - 'id_shop' => $this->shopId, - 'type' => pSQL((string) $type), - 'offset' => (int) $offset, - 'last_sync_date' => pSQL((string) $lastSyncDate), - 'lang_iso' => pSQL((string) $langIso), - ] - ); - - if (!$result) { - throw new \PrestaShopDatabaseException('Failed to insert type sync', Config::DATABASE_INSERT_ERROR_CODE); - } - - return $result; - } - - /** - * @param string $jobId - * @param string $date - * - * @return bool - * - * @throws \PrestaShopDatabaseException - */ - public function insertJob($jobId, $date) - { - return $this->db->insert( - self::JOB_TABLE_NAME, - [ - 'job_id' => pSQL($jobId), - 'created_at' => pSQL($date), - ] - ); - } - - /** - * @param string $jobId - * - * @return array|bool|false|object|null - */ - public function findJobById($jobId) - { - $query = new \DbQuery(); - $query->select('*') - ->from(self::JOB_TABLE_NAME) - ->where('job_id = "' . pSQL($jobId) . '"'); - - return $this->db->getRow($query); - } - - /** - * @param string $type - * @param string $langIso - * - * @return array|bool|object|null - */ - public function findTypeSync($type, $langIso = null) - { - $query = new \DbQuery(); - $query->select('*') - ->from(self::TYPE_SYNC_TABLE_NAME) - ->where('type = "' . pSQL($type) . '"') - ->where('lang_iso = "' . pSQL((string) $langIso) . '"') - ->where('id_shop = ' . $this->shopId); - - return $this->db->getRow($query); - } - - /** - * @param string $type - * @param int $offset - * @param string $date - * @param bool $fullSyncFinished - * @param string $langIso - * - * @return bool - */ - public function updateTypeSync($type, $offset, $date, $fullSyncFinished, $langIso = null) - { - return $this->db->update( - self::TYPE_SYNC_TABLE_NAME, - [ - 'offset' => (int) $offset, - 'full_sync_finished' => (int) $fullSyncFinished, - 'last_sync_date' => pSQL($date), - ], - 'type = "' . pSQL($type) . '" - AND lang_iso = "' . pSQL((string) $langIso) . '" - AND id_shop = ' . $this->shopId - ); - } - - /** - * @param string $type - * @param string $langIso - * - * @return bool - */ - public function isFullSyncDoneForThisTypeSync($type, $langIso = null) - { - $query = new \DbQuery(); - - $query->select('full_sync_finished') - ->from(self::TYPE_SYNC_TABLE_NAME) - ->where('type = "' . pSQL($type) . '"') - ->where('lang_iso = "' . pSQL((string) $langIso) . '"') - ->where('id_shop = ' . $this->shopId); - - return (bool) $this->db->getValue($query); - } -} diff --git a/src/Repository/GoogleTaxonomyRepository.php b/src/Repository/GoogleTaxonomyRepository.php deleted file mode 100644 index 8f32ad48..00000000 --- a/src/Repository/GoogleTaxonomyRepository.php +++ /dev/null @@ -1,89 +0,0 @@ -db = \Db::getInstance(); - } - - /** - * @param int $shopId - * - * @return \DbQuery - */ - public function getBaseQuery($shopId) - { - $query = new \DbQuery(); - - $query->from('fb_category_match', 'cm') - ->where('cm.id_shop = ' . (int) $shopId); - - return $query; - } - - /** - * @param int $offset - * @param int $limit - * @param int $shopId - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getTaxonomyCategories($offset, $limit, $shopId) - { - $query = $this->getBaseQuery($shopId); - - $query->select('cm.id_category, cm.google_category_id') - ->limit($limit, $offset); - - return $this->db->executeS($query); - } - - /** - * @param int $offset - * @param int $shopId - * - * @return int - */ - public function getRemainingTaxonomyRepositories($offset, $shopId) - { - $query = $this->getBaseQuery($shopId); - - $query->select('(COUNT(cm.id_category) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); - } - - /** - * @param int $offset - * @param int $limit - * @param int $shopId - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit, $shopId) - { - $query = $this->getBaseQuery($shopId); - - $query->select('cm.id_category, cm.google_category_id') - ->limit($limit, $offset); - - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } -} diff --git a/src/Repository/ImageRepository.php b/src/Repository/ImageRepository.php index f93f8a3a..4ebe7d65 100644 --- a/src/Repository/ImageRepository.php +++ b/src/Repository/ImageRepository.php @@ -1,177 +1,131 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ImageRepository -{ - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class ImageRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'image'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - $query = new \DbQuery(); + $this->generateMinimalQuery(self::TABLE_NAME, 'i'); - $query->from('image', 'i') + $this->query ->leftJoin('image_lang', 'il', 'il.id_image = i.id_image') ->leftJoin('image_shop', 'is', 'is.id_image = i.id_image'); - return $query; + if ($withSelecParameters) { + $this->query + ->select('i.id_image') + ->select('i.id_product') + ->select('i.position') + ->select('i.cover') + ->select('il.id_lang') + ->select('il.legend') + ->select('is.id_shop') + ; + } } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getImages($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); + $this->generateFullQuery($langIso, true); - return $this->db->executeS($query); - } + $this->query->limit((int) $limit, (int) $offset); - /** - * @param int $offset - * - * @return int - */ - public function getRemainingImagesCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(i.id_image) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $imageIds - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getImagesIncremental($limit, $imageIds) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->where('i.id_image IN(' . implode(',', array_map('intval', $imageIds)) . ')') - ->limit($limit); - - return $this->db->executeS($query); - } - - /** - * @param int $productId - * @param int $shopId - * - * @return false|string|null - */ - public function getProductCoverImage($productId, $shopId) - { - $query = new \DbQuery(); - - $query->select('imgs.id_image') - ->from('image_shop', 'imgs') - ->where('imgs.cover = 1') - ->where('imgs.id_shop = ' . (int) $shopId) - ->where('imgs.id_product = ' . (int) $productId); - - return $this->db->getValue($query); - } - - /** - * @param int $productId - * @param int $attributeId - * @param int $shopId - * @param bool $includeCover + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getProductImages($productId, $attributeId, $shopId, $includeCover = null) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = new \DbQuery(); - - $query->select('imgs.id_image') - ->from('image_shop', 'imgs') - ->leftJoin('image', 'img', 'imgs.id_image = img.id_image') - ->where('imgs.id_shop = ' . (int) $shopId) - ->where('imgs.id_product = ' . (int) $productId) - ->orderBy('img.position ASC'); - - if ((int) $attributeId !== 0) { - $query->innerJoin( - 'product_attribute_image', - 'pai', - 'imgs.id_image = pai.id_image AND pai.id_product_attribute = ' . (int) $attributeId - ); + if ($contentIds == []) { + return []; } - if (!$includeCover) { - $query->where('(imgs.cover IS NULL OR imgs.cover = 0)'); - } + $this->generateFullQuery($langIso, true); + + $this->query + ->where('i.id_image IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('i.id_image'); - $query->select('i.id_product'); - $query->select('i.position'); - $query->select('i.cover'); - $query->select('il.id_lang'); - $query->select('il.legend'); - $query->select('is.id_shop'); + return $result[0]['count']; } } diff --git a/src/Repository/ImageTypeRepository.php b/src/Repository/ImageTypeRepository.php index 745a6314..fbc872b4 100644 --- a/src/Repository/ImageTypeRepository.php +++ b/src/Repository/ImageTypeRepository.php @@ -1,122 +1,129 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ImageTypeRepository -{ - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class ImageTypeRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'image_type'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - $query = new \DbQuery(); - - $query->from('image_type', 'it'); - - return $query; + $this->generateMinimalQuery(self::TABLE_NAME, 'it'); + + if ($withSelecParameters) { + $this->query + ->select('it.id_image_type') + ->select('it.name') + ->select('it.width') + ->select('it.height') + ->select('it.products') + ->select('it.categories') + ->select('it.manufacturers') + ->select('it.suppliers') + ->select('it.stores') + ; + } } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getImageTypes($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - return $this->db->executeS($query); - } + $this->generateFullQuery($langIso, true); - /** - * @param int $offset - * - * @return int - */ - public function getRemainingImageTypesCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(it.id_image_type) - ' . (int) $offset . ') as count'); + $this->query->limit((int) $limit, (int) $offset); - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $imageTypeIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getImageTypesIncremental($limit, $imageTypeIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('it.id_image_type IN(' . implode(',', array_map('intval', $imageTypeIds)) . ')') - ->limit($limit); + $this->query + ->where('it.id_image_type IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('it.id_image_type'); - $query->select('it.name'); - $query->select('it.width'); - $query->select('it.height'); - $query->select('it.products'); - $query->select('it.categories'); - $query->select('it.manufacturers'); - $query->select('it.suppliers'); - $query->select('it.stores'); + return $result[0]['count']; } } diff --git a/src/Repository/IncrementalSyncRepository.php b/src/Repository/IncrementalSyncRepository.php index 93bc5f2d..cd629348 100644 --- a/src/Repository/IncrementalSyncRepository.php +++ b/src/Repository/IncrementalSyncRepository.php @@ -1,42 +1,51 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface; +use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler; -class IncrementalSyncRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class IncrementalSyncRepository extends AbstractRepository { - const INCREMENTAL_SYNC_TABLE = 'eventbus_incremental_sync'; + const TABLE_NAME = 'eventbus_incremental_sync'; /** - * @var \Db - */ - private $db; - /** - * @var \Context - */ - private $context; - /** - * @var ErrorHandlerInterface + * @var ErrorHandler */ private $errorHandler; - /** - * @var int - */ - private $shopId; - - public function __construct(\Context $context, ErrorHandlerInterface $errorHandler) + public function __construct(ErrorHandler $errorHandler) { - $this->db = \Db::getInstance(); - $this->context = $context; $this->errorHandler = $errorHandler; - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $this->shopId = (int) $this->context->shop->id; + parent::__construct(); } /** @@ -56,7 +65,7 @@ public function insertIncrementalObject($data) $elementsCount = count($arrayOfData); $index = 0; - $query = 'INSERT INTO `' . _DB_PREFIX_ . $this::INCREMENTAL_SYNC_TABLE . '` (type, id_object, id_shop, lang_iso, created_at) VALUES '; + $query = 'INSERT INTO `' . _DB_PREFIX_ . self::TABLE_NAME . '` (type, id_object, id_shop, lang_iso, action, created_at) VALUES '; foreach ($arrayOfData as $currenData) { $dateTime = new \DateTime($currenData['created_at']); @@ -67,6 +76,7 @@ public function insertIncrementalObject($data) {$this->db->escape($currenData['id_object'])}, {$this->db->escape($currenData['id_shop'])}, '{$this->db->escape($currenData['lang_iso'])}', + '{$this->db->escape($currenData['action'])}', '{$this->db->escape($date)}' )"; @@ -81,13 +91,14 @@ public function insertIncrementalObject($data) id_object = VALUES(id_object), id_shop = VALUES(id_shop), lang_iso = VALUES(lang_iso), + action = VALUES(action), created_at = VALUES(created_at) '; return (bool) $this->db->query($query); - } catch (\PrestaShopDatabaseException $e) { + } catch (\PrestaShopDatabaseException $exception) { $this->errorHandler->handle( - new \PrestaShopDatabaseException('Failed to insert incremental object', $e->getCode(), $e) + new \PrestaShopDatabaseException('Failed to insert incremental object', $exception->getCode(), $exception) ); return false; @@ -104,16 +115,16 @@ public function insertIncrementalObject($data) public function removeIncrementalSyncObjects($type, $objectIds, $langIso) { return $this->db->delete( - self::INCREMENTAL_SYNC_TABLE, + self::TABLE_NAME, 'type = "' . pSQL($type) . '" - AND id_shop = ' . $this->shopId . ' + AND id_shop = ' . parent::getShopContext()->id . ' AND id_object IN(' . implode(',', array_map('intval', $objectIds)) . ') AND lang_iso = "' . pSQL($langIso) . '"' ); } /** - * @param string $type + * @param string $shopContent * @param string $langIso * @param int $limit * @@ -121,26 +132,24 @@ public function removeIncrementalSyncObjects($type, $objectIds, $langIso) * * @throws \PrestaShopDatabaseException */ - public function getIncrementalSyncObjectIds($type, $langIso, $limit) + public function getIncrementalSyncObjects($shopContent, $langIso, $limit) { - $query = new \DbQuery(); - - $query->select('id_object') - ->from(self::INCREMENTAL_SYNC_TABLE) - ->where('lang_iso = "' . pSQL($langIso) . '"') - ->where('id_shop = "' . $this->shopId . '"') - ->where('type = "' . pSQL($type) . '"') - ->limit($limit); - - $result = $this->db->executeS($query); - - if (is_array($result) && !empty($result)) { - return array_map(function ($object) { - return $object['id_object']; - }, $result); - } - - return []; + $this->generateMinimalQuery(self::TABLE_NAME, 'eis'); + + $this->query + ->where('eis.lang_iso = "' . pSQL($langIso) . '"') + ->where('eis.id_shop = "' . parent::getShopContext()->id . '"') + ->where('eis.type = "' . pSQL($shopContent) . '"') + ->limit($limit) + ; + + $this->query + ->select('eis.type') + ->select('eis.id_object as id') + ->select('eis.action') + ; + + return $this->runQuery(true); } /** @@ -151,15 +160,17 @@ public function getIncrementalSyncObjectIds($type, $langIso, $limit) */ public function getRemainingIncrementalObjects($type, $langIso) { - $query = new \DbQuery(); + $this->generateMinimalQuery(self::TABLE_NAME, 'eis'); + + $this->query + ->where('eis.lang_iso = "' . pSQL($langIso) . '"') + ->where('eis.id_shop = "' . parent::getShopContext()->id . '"') + ->where('eis.type = "' . pSQL($type) . '"') + ; - $query->select('COUNT(id_object) as count') - ->from(self::INCREMENTAL_SYNC_TABLE) - ->where('lang_iso = "' . pSQL($langIso) . '"') - ->where('id_shop = "' . $this->shopId . '"') - ->where('type = "' . pSQL($type) . '"'); + $this->query->select('COUNT(eis.id_object) as count'); - return (int) $this->db->getValue($query); + return (int) $this->db->getValue($this->query); } /** @@ -171,9 +182,9 @@ public function getRemainingIncrementalObjects($type, $langIso) public function removeIncrementalSyncObject($type, $objectId) { return $this->db->delete( - self::INCREMENTAL_SYNC_TABLE, + self::TABLE_NAME, 'type = "' . pSQL($type) . '" - AND id_shop = ' . $this->shopId . ' + AND id_shop = ' . parent::getShopContext()->id . ' AND id_object = ' . (int) $objectId ); } @@ -185,13 +196,12 @@ public function removeIncrementalSyncObject($type, $objectId) */ public function getIncrementalSyncObjectCountByType($type) { - $query = new \DbQuery(); + $this->generateMinimalQuery(self::TABLE_NAME, 'eis'); - $query->select('COUNT(type) as count') - ->from(self::INCREMENTAL_SYNC_TABLE) - ->where('type = "' . psql($type) . '"'); + $this->query->where('eis.type = "' . psql($type) . '"'); + $this->query->select('COUNT(eis.type) as count'); - return (int) $this->db->getValue($query); + return (int) $this->db->getValue($this->query); } /** @@ -202,7 +212,7 @@ public function getIncrementalSyncObjectCountByType($type) public function removeIncrementaSyncObjectByType($type) { return $this->db->delete( - self::INCREMENTAL_SYNC_TABLE, + self::TABLE_NAME, 'type = "' . pSQL($type) . '"' ); } diff --git a/src/Repository/LanguageRepository.php b/src/Repository/LanguageRepository.php index 4a4c84d0..ea0c8533 100644 --- a/src/Repository/LanguageRepository.php +++ b/src/Repository/LanguageRepository.php @@ -1,176 +1,136 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class LanguageRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class LanguageRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'lang'; /** - * @param int $offset - * @param int $limit + * @param string $langIso + * @param bool $withSelecParameters * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return mixed * - * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException */ - public function getLanguagesSync($offset, $limit) + public function generateFullQuery($langIso, $withSelecParameters) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - return $this->db->executeS($query); + $this->generateMinimalQuery(self::TABLE_NAME, 'la'); + + $this->query->innerJoin('lang_shop', 'las', 'la.id_lang = las.id_lang AND las.id_shop = ' . parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('la.id_lang') + ->select('la.name') + ->select('la.active') + ->select('la.iso_code') + ->select('la.language_code') + ->select('la.date_format_lite') + ->select('la.date_format_full') + ->select('la.is_rtl') + ->select('las.id_shop') + ; + + // https://github.com/PrestaShop/PrestaShop/commit/481111b8274ed005e1c4a8ce2cf2b3ebbeb9a270#diff-c123d3d30d9c9e012a826a21887fccce6600a2f2a848a58d5910e55f0f8f5093R41 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { + $this->query->select('la.locale'); + } + } } /** * @param int $offset - * - * @return int - */ - public function getRemainingLanguagesCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(la.id_lang) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); - } - - /** * @param int $limit - * @param array $languageIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getLanguagesIncremental($limit, $languageIds) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->where('la.id_lang IN(' . implode(',', array_map('intval', $languageIds)) . ')') - ->limit($limit); - - return $this->db->executeS($query); - } - - /** - * @return \DbQuery - */ - public function getBaseQuery() + public function retrieveContentsForFull($offset, $limit, $langIso) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } + $this->generateFullQuery($langIso, true); - $shopId = (int) $this->context->shop->id; - $query = new \DbQuery(); - $query->from('lang', 'la') - ->innerJoin('lang_shop', 'las', 'la.id_lang = las.id_lang AND las.id_shop = ' . $shopId); + $this->query->limit((int) $limit, (int) $offset); - return $query; + return $this->runQuery(); } /** - * @param \DbQuery $query + * @param int $limit + * @param array $contentIds + * @param string $langIso * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - // https://github.com/PrestaShop/PrestaShop/commit/481111b8274ed005e1c4a8ce2cf2b3ebbeb9a270#diff-c123d3d30d9c9e012a826a21887fccce6600a2f2a848a58d5910e55f0f8f5093R41 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { - $query->select('la.locale'); - } - - $query->select('la.id_lang, la.name, la.active, la.iso_code, la.language_code, la.date_format_lite'); - $query->select('la.date_format_full, la.is_rtl, las.id_shop'); - } - - /** * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getLanguagesIsoCodes() - { - /** @var array $languages */ - $languages = \Language::getLanguages(); - - return array_map(function ($language) { - return $language['iso_code']; - }, $languages); - } - - /** - * @return string - */ - public function getDefaultLanguageIsoCode() + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $language = \Language::getLanguage((int) \Configuration::get('PS_LANG_DEFAULT')); - - if (is_array($language)) { - return $language['iso_code']; + if ($contentIds == []) { + return []; } - return ''; - } + $this->generateFullQuery($langIso, true); - /** - * @param string $isoCode - * - * @return int - */ - public function getLanguageIdByIsoCode($isoCode) - { - return (int) \Language::getIdByIso($isoCode); - } + $this->query + ->where('la.id_lang IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - /** - * @return array - */ - public function getLanguages() - { - return \Language::getLanguages(); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); + return $result[0]['count']; } } diff --git a/src/Repository/LiveSyncRepository.php b/src/Repository/LiveSyncRepository.php index 808cfd9d..5ee0637e 100644 --- a/src/Repository/LiveSyncRepository.php +++ b/src/Repository/LiveSyncRepository.php @@ -1,9 +1,39 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; +if (!defined('_PS_VERSION_')) { + exit; +} + class LiveSyncRepository { + const TABLE_NAME = 'eventbus_live_sync'; + /** * @var \Db */ diff --git a/src/Repository/ManufacturerRepository.php b/src/Repository/ManufacturerRepository.php index 9a9ed0e2..b2bbc81a 100644 --- a/src/Repository/ManufacturerRepository.php +++ b/src/Repository/ManufacturerRepository.php @@ -1,101 +1,120 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ManufacturerRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class ManufacturerRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'manufacturer'; /** - * @param int $offset - * @param int $limit * @param string $langIso + * @param bool $withSelecParameters * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return mixed * - * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException */ - public function getManufacturers($offset, $limit, $langIso) + public function generateFullQuery($langIso, $withSelecParameters) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - return $this->db->executeS($query); + $this->generateMinimalQuery(self::TABLE_NAME, 'ma'); + + $this->query + ->innerJoin('manufacturer_lang', 'mal', 'ma.id_manufacturer = mal.id_manufacturer AND mal.id_lang = ' . (int) parent::getShopContext()->id) + ->innerJoin('manufacturer_shop', 'mas', 'ma.id_manufacturer = mas.id_manufacturer AND mas.id_shop = ' . (int) parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('ma.id_manufacturer') + ->select('ma.name') + ->select('ma.date_add as created_at') + ->select('ma.date_upd as updated_at') + ->select('ma.active') + ->select('mal.id_lang') + ->select('mal.description') + ->select('mal.short_description') + ->select('mal.meta_title') + ->select('mal.meta_description') + ->select('mas.id_shop') + ; + + // REMOVED HERE: https://github.com/PrestaShop/PrestaShop/commit/f37a8f61017654bae160b528a1a2eaf49edbdac0 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9.0', '<')) { + $this->query->select('mal.meta_keywords'); + } + } } /** * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingManufacturersCount($offset, $langIso) - { - $query = $this->getBaseQuery($langIso) - ->select('(COUNT(ma.id_manufacturer) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); - } - - /** * @param int $limit * @param string $langIso - * @param array $manufacturerIds * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getManufacturersIncremental($limit, $langIso, $manufacturerIds) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('ma.id_manufacturer IN(' . implode(',', array_map('intval', $manufacturerIds)) . ')') - ->limit($limit); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); + return $this->runQuery(); } /** + * @param int $limit + * @param array $contentIds * @param string $langIso * - * @return \DbQuery + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getBaseQuery($langIso) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + if ($contentIds == []) { + return []; } - $shopId = (int) $this->context->shop->id; + $this->generateFullQuery($langIso, true); - /** @var int $langId */ - $langId = (int) \Language::getIdByIso($langIso); - $query = new \DbQuery(); - $query->from('manufacturer', 'ma') - ->innerJoin('manufacturer_lang', 'mal', 'ma.id_manufacturer = mal.id_manufacturer AND mal.id_lang = ' . (int) $langId) - ->innerJoin('manufacturer_shop', 'mas', 'ma.id_manufacturer = mas.id_manufacturer AND mas.id_shop = ' . $shopId); + $this->query + ->where('ma.id_manufacturer IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $query; + return $this->runQuery(); } /** @@ -103,34 +122,19 @@ public function getBaseQuery($langIso) * @param int $limit * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $langIso) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); + $this->generateFullQuery($langIso, false); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('ma.id_manufacturer, ma.name, ma.date_add as created_at, ma.date_upd as updated_at, ma.active, mal.id_lang'); - $query->select('mal.description, mal.short_description, mal.meta_title, mal.meta_keywords, mal.meta_description, mas.id_shop'); + return $result[0]['count']; } } diff --git a/src/Repository/ModuleRepository.php b/src/Repository/ModuleRepository.php index 5fdd606c..41e4a41e 100644 --- a/src/Repository/ModuleRepository.php +++ b/src/Repository/ModuleRepository.php @@ -1,109 +1,142 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ModuleRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class ModuleRepository extends AbstractRepository implements RepositoryInterface { - const MODULE_TABLE = 'module'; - const MODULE_TABLE_HISTORY = 'module_history'; - const MODULE_SHOP = 'module_shop'; + const TABLE_NAME = 'module'; /** - * @var \Db + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private $db; - - public function __construct() + public function generateFullQuery($langIso, $withSelecParameters) { - $this->db = \Db::getInstance(); - } + $this->generateMinimalQuery(self::TABLE_NAME, 'm'); - /** - * @return \DbQuery - */ - public function getBaseQuery() - { - $query = (new \DbQuery()) - ->from(self::MODULE_TABLE, 'm') - ->leftJoin(self::MODULE_SHOP, 'm_shop', 'm.id_module = m_shop.id_module'); + $this->query->leftJoin('module_shop', 'm_shop', 'm.id_module = m_shop.id_module'); if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query = $query->leftJoin(self::MODULE_TABLE_HISTORY, 'h', 'm.id_module = h.id_module'); + $this->query->leftJoin('module_history', 'h', 'm.id_module = h.id_module'); } - return $query; + if ($withSelecParameters) { + /* + * The `active` field of the "ps_module" table has been deprecated, + * this is why we use the "ps_module_shop" table to check if a module is active or not + */ + + $this->query + ->select('m.id_module as module_id') + ->select('name') + ->select('version as module_version') + ->select('IF(m_shop.enable_device, 1, 0) as active') + ; + + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { + $this->query + ->select('date_add as created_at') + ->select('date_upd as updated_at') + ; + } + } } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|false|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getModules($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, true); - /* - * The `active` field of the "ps_module" table has been deprecated, this is why we use the "ps_module_shop" table - * to check if a module is active or not - */ - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query->select('m.id_module as module_id, name, version as module_version, IF(m_shop.enable_device, 1, 0) as active, date_add as created_at, date_upd as updated_at') - ->limit($limit, $offset); - } else { - $query->select('m.id_module as module_id, name, version as module_version, IF(m_shop.enable_device, 1, 0) as active') - ->limit($limit, $offset); - } + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); + return $this->runQuery(); } /** - * @param int $offset + * @param int $limit + * @param array $contentIds + * @param string $langIso * - * @return int + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getRemainingModules($offset) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); - $query->select('(COUNT(m.id_module) - ' . (int) $offset . ') as count'); + $this->query + ->where('m.id_module IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, false); - /* - * The `active` field of the "ps_module" table has been deprecated, this is why we use the "ps_module_shop" table - * to check if a module is active or not - */ - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query->select('m.id_module as module_id, name, version as module_version, IF(m_shop.enable_device, 1, 0) as active, date_add as created_at, date_upd as updated_at') - ->limit($limit, $offset); - } else { - $query->select('m.id_module as module_id, name, version as module_version, IF(m_shop.enable_device, 1, 0) as active') - ->limit($limit, $offset); - } + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); + return $result[0]['count']; } } diff --git a/src/Repository/OrderCartRuleRepository.php b/src/Repository/OrderCartRuleRepository.php index a2adab90..c855e9bc 100644 --- a/src/Repository/OrderCartRuleRepository.php +++ b/src/Repository/OrderCartRuleRepository.php @@ -1,78 +1,130 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class OrderCartRuleRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrderCartRuleRepository extends AbstractRepository implements RepositoryInterface { const TABLE_NAME = 'order_cart_rule'; /** - * @var \Db + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private $db; - - public function __construct() + public function generateFullQuery($langIso, $withSelecParameters) { - $this->db = \Db::getInstance(); + $this->generateMinimalQuery(self::TABLE_NAME, 'ocr'); + + if ($withSelecParameters) { + $this->query + ->select('ocr.id_order_cart_rule') + ->select('ocr.id_order') + ->select('ocr.id_cart_rule') + ->select('ocr.id_order_invoice') + ->select('ocr.name') + ->select('ocr.value') + ->select('ocr.value_tax_excl') + ->select('ocr.free_shipping'); + + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.7.0', '>=')) { + $this->query->select('ocr.deleted'); + } + } } /** - * @return \DbQuery + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getBaseQuery() + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = new \DbQuery(); + $this->generateFullQuery($langIso, true); - $query->from(self::TABLE_NAME, 'ocr'); + $this->query->limit((int) $limit, (int) $offset); - return $query; + return $this->runQuery(); } /** - * @param array $orderIds + * @param int $limit + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getOrderCartRules($orderIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - if (!$orderIds) { + if ($contentIds == []) { return []; } - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, true); - $query->select('ocr.id_order_cart_rule,ocr.id_order,ocr.id_cart_rule,ocr.id_order_invoice,ocr.name,ocr.value,ocr.value_tax_excl, ocr.free_shipping'); - - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.7.0', '>=')) { - $query->select('ocr.deleted'); - } - $query->where('ocr.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')'); + $this->query + ->where('ocr.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit); - return $this->db->executeS($query); + return $this->runQuery(); } /** - * @param array $orderIds + * @param int $offset + * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getOrderCartRuleIdsByOrderIds($orderIds) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - if (!$orderIds) { - return []; - } - - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, false); - $query->select('ocr.id_order_cart_rule as id'); - $query->where('ocr.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')'); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $result = $this->db->executeS($query); + $result = $this->runQuery(true); - return is_array($result) ? $result : []; + return $result[0]['count']; } } diff --git a/src/Repository/OrderDetailRepository.php b/src/Repository/OrderDetailRepository.php new file mode 100644 index 00000000..447897eb --- /dev/null +++ b/src/Repository/OrderDetailRepository.php @@ -0,0 +1,154 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrderDetailRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'order_detail'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $context = \Context::getContext(); + + if ($context == null) { + throw new \PrestaShopException('Context is null'); + } + + if ($context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + $this->generateMinimalQuery(self::TABLE_NAME, 'od'); + + $this->query + ->where('od.id_shop = ' . $context->shop->id) + ->innerJoin('orders', 'o', 'od.id_order = o.id_order') + ->leftJoin('order_slip_detail', 'osd', 'od.id_order_detail = osd.id_order_detail') + ->leftJoin('product_shop', 'ps', 'od.product_id = ps.id_product AND ps.id_shop = ' . (int) $context->shop->id) + ->leftJoin('currency', 'c', 'c.id_currency = o.id_currency') + ->leftJoin('lang', 'l', 'o.id_lang = l.id_lang') + ; + + if ($withSelecParameters) { + $this->query + ->select('od.id_order_detail') + ->select('od.id_order') + ->select('od.product_id') + ->select('od.product_attribute_id') + ->select('od.product_quantity') + ->select('od.unit_price_tax_incl') + ->select('od.unit_price_tax_excl') + ->select('SUM(osd.total_price_tax_incl) as refund') + ->select('SUM(osd.total_price_tax_excl) as refund_tax_excl') + ->select('c.iso_code as currency') + ->select('ps.id_category_default as category') + ->select('l.iso_code') + ->select('o.conversion_rate as conversion_rate') + ; + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $this->query->groupBy('od.id_order_detail'); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('od.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; + } +} diff --git a/src/Repository/OrderDetailsRepository.php b/src/Repository/OrderDetailsRepository.php deleted file mode 100644 index b019ae87..00000000 --- a/src/Repository/OrderDetailsRepository.php +++ /dev/null @@ -1,97 +0,0 @@ -context = $context; - $this->db = \Db::getInstance(); - } - - /** - * @return \DbQuery - */ - public function getBaseQuery() - { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - - $query->from(self::TABLE_NAME, 'od') - ->where('od.id_shop = ' . $shopId); - - return $query; - } - - /** - * @param array $orderIds - * @param int $shopId - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getOrderDetails($orderIds, $shopId) - { - if (!$orderIds) { - return []; - } - - $query = $this->getBaseQuery(); - - $query->select('od.id_order_detail, od.id_order, od.product_id, od.product_attribute_id'); - $query->select('od.product_quantity, od.unit_price_tax_incl, od.unit_price_tax_excl, SUM(osd.total_price_tax_incl) as refund'); - $query->select('SUM(osd.total_price_tax_excl) as refund_tax_excl, c.iso_code as currency, ps.id_category_default as category'); - $query->select('l.iso_code, o.conversion_rate as conversion_rate') - ->leftJoin('order_slip_detail', 'osd', 'od.id_order_detail = osd.id_order_detail') - ->leftJoin('product_shop', 'ps', 'od.product_id = ps.id_product AND ps.id_shop = ' . (int) $shopId) - ->innerJoin('orders', 'o', 'od.id_order = o.id_order') - ->leftJoin('currency', 'c', 'c.id_currency = o.id_currency') - ->leftJoin('lang', 'l', 'o.id_lang = l.id_lang') - ->where('od.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')') - ->groupBy('od.id_order_detail'); - - return $this->db->executeS($query); - } - - /** - * @param array $orderIds - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getOrderDetailIdsByOrderIds($orderIds) - { - if (!$orderIds) { - return []; - } - - $query = $this->getBaseQuery(); - - $query->select('od.id_order_detail as id') - ->where('od.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')') - ->groupBy('od.id_order_detail'); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } -} diff --git a/src/Repository/OrderHistoryRepository.php b/src/Repository/OrderHistoryRepository.php deleted file mode 100644 index 9cf0d31d..00000000 --- a/src/Repository/OrderHistoryRepository.php +++ /dev/null @@ -1,80 +0,0 @@ -db = \Db::getInstance(); - } - - /** - * @return \DbQuery - */ - public function getBaseQuery() - { - $query = new \DbQuery(); - - $query->from(self::TABLE_NAME, 'oh'); - - return $query; - } - - /** - * @param array $orderIds - * @param int $langId - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getOrderHistoryStatuses($orderIds, $langId) - { - if (!$orderIds) { - return []; - } - - $query = $this->getBaseQuery(); - - $query->select('oh.id_order_state, osl.name, osl.template, oh.date_add, oh.id_order, oh.id_order_history') - ->select('os.logable, os.delivery, os.shipped, os.paid, os.deleted') - ->innerJoin('order_state', 'os', 'os.id_order_state = oh.id_order_State') - ->innerJoin('order_state_lang', 'osl', 'osl.id_order_state = os.id_order_State AND osl.id_lang = ' . (int) $langId) - ->where('oh.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')') - ; - - return $this->db->executeS($query); - } - - /** - * @param array $orderIds - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getOrderHistoryStatuseIdsByOrderIds($orderIds) - { - if (!$orderIds) { - return []; - } - - $query = $this->getBaseQuery(); - - $query->select('oh.id_order_state as id') - ->where('oh.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')') - ; - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } -} diff --git a/src/Repository/OrderRepository.php b/src/Repository/OrderRepository.php index a9d6a22b..71352a86 100644 --- a/src/Repository/OrderRepository.php +++ b/src/Repository/OrderRepository.php @@ -1,30 +1,52 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class OrderRepository -{ - const ORDERS_TABLE = 'orders'; - - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class OrderRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'orders'; /** - * @param int $shopId + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed * - * @return \DbQuery + * @throws \PrestaShopException */ - public function getBaseQuery($shopId) + public function generateFullQuery($langIso, $withSelecParameters) { - $query = new \DbQuery(); - $query->from(self::ORDERS_TABLE, 'o') + $this->generateMinimalQuery(self::TABLE_NAME, 'o'); + + $this->query ->leftJoin('currency', 'c', 'o.id_currency = c.id_currency') ->leftJoin('order_slip', 'os', 'o.id_order = os.id_order') ->leftJoin('address', 'ad', 'ad.id_address = o.id_address_delivery') @@ -33,123 +55,130 @@ public function getBaseQuery($shopId) ->leftJoin('country', 'cnti', 'cnti.id_country = ai.id_country') ->leftJoin('order_state_lang', 'osl', 'o.current_state = osl.id_order_state') ->leftJoin('order_state', 'ost', 'o.current_state = ost.id_order_state') - ->where('o.id_shop = ' . (int) $shopId) - ->groupBy('o.id_order'); - - return $query; + ->where('o.id_shop = ' . (int) parent::getShopContext()->id) + ; + + if ($withSelecParameters) { + $this->query + ->select('o.id_order') + ->select('o.reference') + ->select('o.id_customer') + ->select('o.id_cart') + ->select('o.current_state') + ->select('o.conversion_rate') + ->select('o.total_paid_tax_excl') + ->select('o.total_paid_tax_incl') + ->select('c.iso_code as currency') + ->select('o.module as payment_module') + ->select('o.payment as payment_mode') + ->select('o.total_paid_real') + ->select('o.total_shipping as shipping_cost') + ->select('o.date_add as created_at') + ->select('o.date_upd as updated_at') + ->select('o.id_carrier') + ->select('o.payment as payment_name') + ->select('o.valid as is_validated') + ->select('ost.paid as is_paid') + ->select('ost.shipped as is_shipped') + ->select('osl.name as status_label') + ->select('o.module as payment_name') + ->select('o.id_shop_group') + ->select('o.id_shop') + ->select('o.id_lang') + ->select('o.id_currency') + ->select('o.recyclable') + ->select('o.gift') + ->select('o.total_discounts') + ->select('o.total_discounts_tax_incl') + ->select('o.total_discounts_tax_excl') + ->select('o.total_products') + ->select('o.total_products_wt') + ->select('o.total_shipping_tax_incl') + ->select('o.total_shipping_tax_excl') + ->select('o.carrier_tax_rate') + ->select('o.total_wrapping') + ->select('o.total_wrapping_tax_incl') + ->select('o.total_wrapping_tax_excl') + ->select('o.round_mode') + ->select('o.round_type') + ->select('o.invoice_number') + ->select('o.delivery_number') + ->select('o.invoice_date') + ->select('o.delivery_date') + ->select('o.valid') + ->select('SUM(os.total_products_tax_incl + os.total_shipping_tax_incl) as refund') + ->select('SUM(os.total_products_tax_excl + os.total_shipping_tax_excl) as refund_tax_excl') + ->select('CONCAT(CONCAT("delivery", ":", cntd.iso_code), ",", CONCAT("invoice", ":", cnti.iso_code)) as address_iso') + ->select('IF((SELECT so.id_order FROM `' . _DB_PREFIX_ . 'orders` so WHERE so.id_customer = o.id_customer AND so.id_order < o.id_order LIMIT 1) > 0, 0, 1) as new_customer') + ; + } } /** * @param int $offset * @param int $limit - * @param int $shopId + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getOrders($offset, $limit, $shopId) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery($shopId); + $this->generateFullQuery($langIso, true); - $this->addSelectParameters($query); + $this->query->groupBy('o.id_order'); - $query->limit((int) $limit, (int) $offset); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); - } - - /** - * @param int $offset - * @param int $shopId - * - * @return int - */ - public function getRemainingOrderCount($offset, $shopId) - { - $orders = $this->getOrders($offset, 1, $shopId); - - if (!is_array($orders) || empty($orders)) { - return 0; - } - - return count($orders); + return $this->runQuery(); } /** * @param int $limit - * @param int $shopId - * @param array $orderIds + * @param array $contentIds + * @param string $langIso * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getOrdersIncremental($limit, $shopId, $orderIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery($shopId); - - $this->addSelectParameters($query); + if ($contentIds == []) { + return []; + } - $query->where('o.id_order IN(' . implode(',', array_map('intval', $orderIds)) . ')') - ->limit($limit); + $this->generateFullQuery($langIso, true); - $result = $this->db->executeS($query); + $this->query + ->where('o.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return is_array($result) ? $result : []; + return $this->runQuery(); } /** * @param int $offset * @param int $limit - * @param int $shopId + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $shopId) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery($shopId); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit((int) $limit, (int) $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('o.id_order, o.reference, o.id_customer, o.id_cart, o.current_state'); - $query->select('o.conversion_rate, o.total_paid_tax_excl, o.total_paid_tax_incl'); - $query->select('IF((SELECT so.id_order FROM `' . _DB_PREFIX_ . 'orders` so WHERE so.id_customer = o.id_customer AND so.id_order < o.id_order LIMIT 1) > 0, 0, 1) as new_customer'); - $query->select('c.iso_code as currency, SUM(os.total_products_tax_incl + os.total_shipping_tax_incl) as refund'); - $query->select('SUM(os.total_products_tax_excl + os.total_shipping_tax_excl) as refund_tax_excl, o.module as payment_module'); - $query->select('o.payment as payment_mode, o.total_paid_real, o.total_shipping as shipping_cost, o.date_add as created_at'); - $query->select('o.date_upd as updated_at, o.id_carrier'); - $query->select('o.payment as payment_name'); - $query->select('CONCAT(CONCAT("delivery", ":", cntd.iso_code), ",", CONCAT("invoice", ":", cnti.iso_code)) as address_iso'); - $query->select('o.valid as is_validated'); - $query->select('ost.paid as is_paid'); - $query->select('ost.shipped as is_shipped'); - $query->select('osl.name as status_label'); - $query->select('o.module as payment_name'); - - $query->select('o.id_shop_group, o.id_shop, o.id_lang, o.id_currency, o.recyclable, o.gift'); - $query->select('o.total_discounts, o.total_discounts_tax_incl, o.total_discounts_tax_excl'); - $query->select('o.total_products, o.total_products_wt, o.total_shipping_tax_incl, o.total_shipping_tax_excl'); - $query->select('o.carrier_tax_rate, o.total_wrapping, o.total_wrapping_tax_incl, o.total_wrapping_tax_excl'); - $query->select('o.round_mode, o.round_type, o.invoice_number, o.delivery_number, o.invoice_date, o.delivery_date, o.valid'); + return $result[0]['count']; } } diff --git a/src/Repository/OrderStatusHistoryRepository.php b/src/Repository/OrderStatusHistoryRepository.php new file mode 100644 index 00000000..5ad0e6b3 --- /dev/null +++ b/src/Repository/OrderStatusHistoryRepository.php @@ -0,0 +1,159 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrderStatusHistoryRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'order_history'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $langId = (int) \Language::getIdByIso($langIso); + + $this->generateMinimalQuery(self::TABLE_NAME, 'oh'); + + $this->query + ->innerJoin('order_state', 'os', 'os.id_order_state = oh.id_order_State') + ->innerJoin('order_state_lang', 'osl', 'osl.id_order_state = os.id_order_State AND osl.id_lang = ' . (int) $langId) + ; + + if ($withSelecParameters) { + $this->query + ->select('oh.id_order_state') + ->select('osl.name') + ->select('osl.template') + ->select('oh.date_add') + ->select('oh.id_order') + ->select('oh.id_order_history') + ->select('os.logable AS is_validated') + ->select('os.delivery AS is_delivered') + ->select('os.shipped AS is_shipped') + ->select('os.paid AS is_paid') + ->select('os.deleted AS is_deleted') + ; + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('oh.id_order IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; + } + + /** + * @param array $orderIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopDatabaseException + */ + public function getOrderStatusHistoriesByOrderIds($orderIds, $langIso) + { + if (!$orderIds) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query->where('oh.id_order IN (' . implode(',', array_map('intval', $orderIds)) . ')'); + + return $this->runQuery(); + } +} diff --git a/src/Repository/ProductCarrierRepository.php b/src/Repository/ProductCarrierRepository.php deleted file mode 100644 index 861104fa..00000000 --- a/src/Repository/ProductCarrierRepository.php +++ /dev/null @@ -1,182 +0,0 @@ -db = \Db::getInstance(); - $this->context = $context; - - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $this->shopId = (int) $this->context->shop->id; - } - - /** - * @return \DbQuery - */ - private function getBaseQuery() - { - $query = new \DbQuery(); - - $query->from('product_carrier', 'pc'); - $query->where('pc.id_shop = ' . $this->shopId); - - return $query; - } - - /** - * @param int $offset - * @param int $limit - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getProductCarriers($offset, $limit) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } - - /** - * @param int $offset - * - * @return int - * - * @throws \PrestaShopDatabaseException - */ - public function getRemainingProductCarriersCount($offset) - { - $productCarriers = $this->getProductCarriers($offset, 1); - - if (!is_array($productCarriers) || empty($productCarriers)) { - return 0; - } - - return count($productCarriers); - } - - /** - * @param string $type - * @param string $langIso - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getProductCarrierIncremental($type, $langIso) - { - $query = new \DbQuery(); - $query->from(IncrementalSyncRepository::INCREMENTAL_SYNC_TABLE, 'aic'); - $query->leftJoin(EventbusSyncRepository::TYPE_SYNC_TABLE_NAME, 'ts', 'ts.type = aic.type'); - $query->where('aic.type = "' . (string) $type . '"'); - $query->where('ts.id_shop = ' . $this->shopId); - $query->where('ts.lang_iso = "' . (string) $langIso . '"'); - - return $this->db->executeS($query); - } - - /** - * @param array $productIds - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getProductCarriersProperties($productIds) - { - if (!$productIds) { - return []; - } - $query = new \DbQuery(); - - $query->select('pc.*') - ->from('product_carrier', 'pc') - ->where('pc.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')'); - - return $this->db->executeS($query); - } - - /** - * @param int $offset - * @param int $limit - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getQueryForDebug($offset, $limit) - { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } - - /** - * @param array $productIds - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getProductCarrierIdsByProductIds($productIds) - { - if (!$productIds) { - return []; - } - - $query = $this->getBaseQuery(); - - $query->select('pc.id_carrier_reference as id'); - $query->where('pc.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')'); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('pc.id_carrier_reference, pc.id_product'); - } -} diff --git a/src/Repository/ProductRepository.php b/src/Repository/ProductRepository.php index 1da42b6d..29a9d628 100644 --- a/src/Repository/ProductRepository.php +++ b/src/Repository/ProductRepository.php @@ -1,189 +1,282 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ProductRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class ProductRepository extends AbstractRepository implements RepositoryInterface { - /** - * @var \Context - */ - private $context; - /** - * @var \Db - */ - private $db; + const TABLE_NAME = 'product'; /** - * @var int + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private $shopId; - - public function __construct(\Context $context) + public function generateFullQuery($langIso, $withSelecParameters) { - $this->db = \Db::getInstance(); - $this->context = $context; + $shopIdGroup = (int) parent::getShopContext()->id_shop_group; + $langId = (int) \Language::getIdByIso($langIso); - if (!$this->context->employee instanceof \Employee) { - if (($employees = \Employee::getEmployees()) !== false) { - $this->context->employee = new \Employee($employees[0]['id_employee']); + // WTF IS THAT ? + if (!parent::getContext()->employee instanceof \Employee) { + $employees = \Employee::getEmployees(); + + if ($employees) { + parent::getContext()->employee = new \Employee($employees[0]['id_employee']); } } - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + $this->generateMinimalQuery(self::TABLE_NAME, 'p'); + + $this->query + ->innerJoin('product_shop', 'ps', 'ps.id_product = p.id_product AND ps.id_shop = ' . parent::getShopContext()->id) + ->innerJoin('product_lang', 'pl', 'pl.id_product = ps.id_product AND pl.id_shop = ps.id_shop AND pl.id_lang = ' . $langId) + ->leftJoin('product_attribute_shop', 'pas', 'pas.id_product = p.id_product AND pas.id_shop = ps.id_shop') + ->leftJoin('product_attribute', 'pa', 'pas.id_product_attribute = pa.id_product_attribute') + ->leftJoin('category_lang', 'cl', 'ps.id_category_default = cl.id_category AND ps.id_shop = cl.id_shop AND cl.id_lang = ' . $langId) + ->leftJoin('manufacturer', 'm', 'p.id_manufacturer = m.id_manufacturer') + ; + + if (parent::getShopContext()->getGroup()->share_stock) { + $this->query->leftJoin( + 'stock_available', + 'sa', + 'sa.id_product = p.id_product AND sa.id_product_attribute = IFNULL(pas.id_product_attribute, 0) AND sa.id_shop_group = ' . $shopIdGroup) + ; + } else { + $this->query->leftJoin( + 'stock_available', + 'sa', + 'sa.id_product = p.id_product AND sa.id_product_attribute = IFNULL(pas.id_product_attribute, 0) AND sa.id_shop = ps.id_shop') + ; } - $this->shopId = (int) $this->context->shop->id; + if ($withSelecParameters) { + $this->query + ->select('p.id_product') + ->select('p.id_manufacturer') + ->select('p.id_supplier') + ->select('IFNULL(pas.id_product_attribute, 0) as id_attribute') + ->select('pas.default_on as is_default_attribute') + ->select('pl.name') + ->select('pl.description') + ->select('pl.description_short') + ->select('pl.link_rewrite') + ->select('cl.name as default_category') + ->select('ps.id_category_default') + ->select('IFNULL(NULLIF(pa.reference, ""), p.reference) as reference') + ->select('IFNULL(NULLIF(pa.upc, ""), p.upc) as upc') + ->select('IFNULL(NULLIF(pa.ean13, ""), p.ean13) as ean') + ->select('ps.condition') + ->select('ps.visibility') + ->select('ps.active') + ->select('sa.quantity') + ->select('m.name as manufacturer') + ->select('(p.weight + IFNULL(pas.weight, 0)) as weight') + ->select('(ps.price + IFNULL(pas.price, 0)) as price_tax_excl') + ->select('p.date_add as created_at') + ->select('p.date_upd as updated_at') + ->select('p.available_for_order') + ->select('p.available_date') + ->select('p.cache_is_pack as is_bundle') + ->select('p.is_virtual') + ->select('p.unity') + ->select('p.unit_price_ratio') + ->select('p.width') + ->select('p.height') + ->select('p.depth') + ->select('p.additional_shipping_cost'); + + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { + $this->query->select('IFNULL(NULLIF(pa.isbn, ""), p.isbn) as isbn'); + } + + // https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { + $this->query + ->select('p.additional_delivery_times') + ->select('pl.delivery_in_stock') + ->select('pl.delivery_out_stock') + ; + } + + // https://github.com/PrestaShop/PrestaShop/commit/75fcc335a85c4e3acb2444ef9584590a59fc2d62#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R1615 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.7.0', '>=')) { + $this->query->select('p.mpn'); + } + } } /** - * @param int $langId + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array * - * @return \DbQuery + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - private function getBaseQuery($langId) + public function retrieveContentsForFull($offset, $limit, $langIso) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $shopIdGroup = (int) $this->context->shop->id_shop_group; + $this->generateFullQuery($langIso, true); - $query = new \DbQuery(); + $this->query->limit((int) $limit, (int) $offset); - $query->from('product', 'p') - ->innerJoin('product_shop', 'ps', 'ps.id_product = p.id_product AND ps.id_shop = ' . $this->shopId) - ->innerJoin('product_lang', 'pl', 'pl.id_product = ps.id_product AND pl.id_shop = ps.id_shop AND pl.id_lang = ' . (int) $langId) - ->leftJoin('product_attribute_shop', 'pas', 'pas.id_product = p.id_product AND pas.id_shop = ps.id_shop') - ->leftJoin('product_attribute', 'pa', 'pas.id_product_attribute = pa.id_product_attribute') - ->leftJoin('category_lang', 'cl', 'ps.id_category_default = cl.id_category AND ps.id_shop = cl.id_shop AND cl.id_lang = ' . (int) $langId) - ->leftJoin('manufacturer', 'm', 'p.id_manufacturer = m.id_manufacturer'); - - if ($this->context->shop->getGroup()->share_stock) { - $query->leftJoin('stock_available', 'sa', 'sa.id_product = p.id_product AND - sa.id_product_attribute = IFNULL(pas.id_product_attribute, 0) AND sa.id_shop_group = ' . $shopIdGroup); - } else { - $query->leftJoin('stock_available', 'sa', 'sa.id_product = p.id_product AND - sa.id_product_attribute = IFNULL(pas.id_product_attribute, 0) AND sa.id_shop = ps.id_shop'); - } - - return $query; + return $this->runQuery(); } /** - * @param int $offset * @param int $limit - * @param int $langId + * @param array $contentIds + * @param string $langIso * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getProducts($offset, $limit, $langId) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery($langId); - - $this->addSelectParameters($query); + if ($contentIds == []) { + return []; + } - $query->limit($limit, $offset); + $this->generateFullQuery($langIso, true); - $result = $this->db->executeS($query); + $this->query + ->where('p.id_product IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return is_array($result) ? $result : []; + return $this->runQuery(); } /** * @param int $offset - * @param int $langId + * @param int $limit + * @param string $langIso * * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getRemainingProductsCount($offset, $langId) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $products = $this->getProducts($offset, 1, $langId); + $this->generateFullQuery($langIso, false); - if (!is_array($products) || empty($products)) { - return 0; - } + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); - return count($products); + return $result[0]['count']; } /** * @param array $attributeIds - * @param int $langId + * @param string $langIso * * @return array * * @throws \PrestaShopDatabaseException */ - public function getProductAttributeValues($attributeIds, $langId) + public function getProductAttributeValues($attributeIds, $langIso) { - if (!$attributeIds) { - return []; - } - $query = new \DbQuery(); + $langId = (int) \Language::getIdByIso($langIso); - $query->select('pas.id_product_attribute, agl.name as name, al.name as value') - ->from('product_attribute_shop', 'pas') + $this->generateMinimalQuery('product_attribute_shop', 'pas'); + + $this->query ->leftJoin('product_attribute_combination', 'pac', 'pac.id_product_attribute = pas.id_product_attribute') ->leftJoin('attribute', 'a', 'a.id_attribute = pac.id_attribute') - ->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = a.id_attribute_group AND agl.id_lang = ' . (int) $langId) + ->leftJoin('attribute_group_lang', 'agl', 'agl.id_attribute_group = a.id_attribute_group AND agl.id_lang = ' . $langId) ->leftJoin('attribute_lang', 'al', 'al.id_attribute = pac.id_attribute AND al.id_lang = agl.id_lang') - ->where('pas.id_product_attribute IN (' . implode(',', array_map('intval', $attributeIds)) . ') AND pas.id_shop = ' . $this->shopId); + ->where('pas.id_product_attribute IN (' . implode(',', array_map('intval', $attributeIds)) . ') AND pas.id_shop = ' . parent::getShopContext()->id) + ; - $attributes = $this->db->executeS($query); + $this->query + ->select('pas.id_product_attribute, agl.name as name, al.name as value') + ->select('agl.name as name') + ->select('al.name as value') + ; - if (is_array($attributes)) { - $resultArray = []; + $attributes = $this->runQuery(true); - foreach ($attributes as $attribute) { - $resultArray[$attribute['id_product_attribute']][$attribute['name']] = $attribute['value']; - } + $resultArray = []; - return $resultArray; + foreach ($attributes as $attribute) { + $resultArray[$attribute['id_product_attribute']][$attribute['name']] = $attribute['value']; } - return []; + return $resultArray; } /** * @param array $productIds - * @param int $langId + * @param string $langIso * * @return array * * @throws \PrestaShopDatabaseException */ - public function getProductFeatures($productIds, $langId) + public function getProductFeatures($productIds, $langIso) { - if (!$productIds) { - return []; - } + $langId = (int) \Language::getIdByIso($langIso); - $query = new \DbQuery(); + $this->generateMinimalQuery('feature_product', 'fp'); - $query->select('fp.id_product, fl.name, fvl.value') - ->from('feature_product', 'fp') - ->leftJoin('feature_lang', 'fl', 'fl.id_feature = fp.id_feature AND fl.id_lang = ' . (int) $langId) + $this->query + ->leftJoin('feature_lang', 'fl', 'fl.id_feature = fp.id_feature AND fl.id_lang = ' . $langId) ->leftJoin('feature_value_lang', 'fvl', 'fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = fl.id_lang') - ->where('fp.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')'); + ->where('fp.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')') + ; - $features = $this->db->executeS($query); + $this->query + ->select('fp.id_product') + ->select('fl.name') + ->select('fvl.value') + ; - if (is_array($features)) { - $resultArray = []; + $features = $this->runQuery(true); - foreach ($features as $feature) { - $resultArray[$feature['id_product']][$feature['name']] = $feature['value']; - } + $resultArray = []; - return $resultArray; + foreach ($features as $feature) { + $resultArray[$feature['id_product']][$feature['name']] = $feature['value']; } - return []; + return $resultArray; } /** @@ -195,19 +288,18 @@ public function getProductFeatures($productIds, $langId) */ public function getProductImages($productIds) { - if (!$productIds) { - return []; - } - - $query = new \DbQuery(); + $this->generateMinimalQuery('image_shop', 'imgs'); - $query->select('imgs.id_product, imgs.id_image, IFNULL(imgs.cover, 0) as cover') - ->from('image_shop', 'imgs') - ->where('imgs.id_shop = ' . $this->shopId . ' AND imgs.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')'); + $this->query + ->where('imgs.id_shop = ' . parent::getShopContext()->id . ' AND imgs.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')'); - $result = $this->db->executeS($query); + $this->query + ->select('imgs.id_product, imgs.id_image, IFNULL(imgs.cover, 0) as cover') + ->select('imgs.id_image') + ->select('IFNULL(imgs.cover, 0) as cover') + ; - return is_array($result) ? $result : []; + return $this->runQuery(true); } /** @@ -219,142 +311,55 @@ public function getProductImages($productIds) */ public function getAttributeImages($attributeIds) { - if (!$attributeIds) { - return []; - } - $query = new \DbQuery(); - - $query->select('id_product_attribute, id_image') - ->from('product_attribute_image', 'pai') - ->where('pai.id_product_attribute IN (' . implode(',', array_map('intval', $attributeIds)) . ')'); + $this->generateMinimalQuery('product_attribute_image', 'pai'); - $result = $this->db->executeS($query); + $this->query + ->where('pai.id_product_attribute IN (' . implode(',', array_map('intval', $attributeIds)) . ')') + ; - return is_array($result) ? $result : []; - } - - /** - * @param int $productId - * @param int $attributeId - * - * @return float|null - */ - public function getPriceTaxExcluded($productId, $attributeId) - { - return \Product::getPriceStatic($productId, false, $attributeId, 6, null, false, false); - } + $this->query + ->select('id_product_attribute, id_image') + ->select('id_image') + ; - /** - * @param int $productId - * @param int $attributeId - * - * @return float|null - */ - public function getPriceTaxIncluded($productId, $attributeId) - { - return \Product::getPriceStatic($productId, true, $attributeId, 6, null, false, false); + return $this->runQuery(true); } /** * @param int $productId - * @param int $attributeId - * - * @return float|null - */ - public function getSalePriceTaxExcluded($productId, $attributeId) - { - return \Product::getPriceStatic($productId, false, $attributeId, 6); - } - - /** - * @param int $productId - * @param int $attributeId - * - * @return float|null - */ - public function getSalePriceTaxIncluded($productId, $attributeId) - { - return \Product::getPriceStatic($productId, true, $attributeId, 6); - } - - /** - * @param int $limit - * @param int $langId - * @param array $productIds - * - * @return array - * - * @throws \PrestaShopDatabaseException - */ - public function getProductsIncremental($limit, $langId, $productIds) - { - $query = $this->getBaseQuery($langId); - - $this->addSelectParameters($query); - - $query->where('p.id_product IN(' . implode(',', array_map('intval', $productIds)) . ')') - ->limit($limit); - - $result = $this->db->executeS($query); - - return is_array($result) ? $result : []; - } - - /** - * @param int $offset - * @param int $limit - * @param int $langId * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $langId) + public function getProductPriceAndDeclinations($productId) { - $query = $this->getBaseQuery($langId); + $this->generateMinimalQuery('product', 'p'); - $this->addSelectParameters($query); + $this->query->where('p.`id_product` = ' . (int) $productId); - $query->limit($limit, $offset); + $this->query->innerJoin( + 'product_shop', 'ps', '(ps.id_product=p.id_product AND ps.id_shop = ' . (int) parent::getShopContext()->id . ')'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $this->query + ->select('ps.price') + ->select('ps.ecotax') + ; - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + if (\Combination::isFeatureActive()) { + $this->query->leftJoin( + 'product_attribute_shop', 'pas', '(pas.id_product = p.id_product AND pas.id_shop = ' . (int) parent::getShopContext()->id . ')'); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('p.id_product, p.id_manufacturer, p.id_supplier, IFNULL(pas.id_product_attribute, 0) as id_attribute, pas.default_on as is_default_attribute'); - $query->select('pl.name, pl.description, pl.description_short, pl.link_rewrite, cl.name as default_category'); - $query->select('ps.id_category_default, IFNULL(NULLIF(pa.reference, ""), p.reference) as reference, IFNULL(NULLIF(pa.upc, ""), p.upc) as upc'); - $query->select('IFNULL(NULLIF(pa.ean13, ""), p.ean13) as ean, ps.condition, ps.visibility, ps.active, sa.quantity, m.name as manufacturer'); - $query->select('(p.weight + IFNULL(pas.weight, 0)) as weight, (ps.price + IFNULL(pas.price, 0)) as price_tax_excl'); - $query->select('p.date_add as created_at, p.date_upd as updated_at'); - $query->select('p.available_for_order, p.available_date, p.cache_is_pack as is_bundle, p.is_virtual'); - $query->select('p.unity, p.unit_price_ratio'); - - if (property_exists(new \Product(), 'mpn')) { - $query->select('p.mpn'); - } - - // https://github.com/PrestaShop/PrestaShop/commit/10268af8db4163dc2a02edb8da93d02f37f814d8#diff-e94a594ba740485c7a4882b333984d3932a2f99c0d6d0005620745087cce7a10R260 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { - $query->select('p.additional_delivery_times'); - $query->select('pl.delivery_in_stock, pl.delivery_out_stock'); + $this->query + ->select('IFNULL(pas.id_product_attribute,0) id_product_attribute') + ->select('pas.`price` AS attribute_price') + ->select('pas.default_on') + ; + } else { + $this->query->select('0 as id_product_attribute'); } - $query->select('p.width, p.height, p.depth, p.additional_shipping_cost'); - - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>=')) { - $query->select('IFNULL(NULLIF(pa.isbn, ""), p.isbn) as isbn'); - } + return $this->runQuery(true); } } diff --git a/src/Repository/ProductSupplierRepository.php b/src/Repository/ProductSupplierRepository.php index b6bf7c24..683d67d3 100644 --- a/src/Repository/ProductSupplierRepository.php +++ b/src/Repository/ProductSupplierRepository.php @@ -1,114 +1,127 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ProductSupplierRepository -{ - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class ProductSupplierRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'product_supplier'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - public function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - $query = new \DbQuery(); - $query->from('product_supplier', 'ps'); - - return $query; + $this->generateMinimalQuery(self::TABLE_NAME, 'ps'); + + if ($withSelecParameters) { + $this->query + ->select('ps.id_product_supplier') + ->select('ps.id_product') + ->select('ps.id_product_attribute') + ->select('ps.id_supplier') + ->select('ps.product_supplier_reference') + ->select('ps.product_supplier_price_te') + ->select('ps.id_currency') + ; + } } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getProductSuppliers($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->limit($limit, $offset); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingProductSuppliersCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(ps.id_product_supplier) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $productIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getProductSuppliersIncremental($limit, $productIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('ps.id_product IN(' . implode(',', array_map('intval', $productIds)) . ')') - ->limit($limit); + $this->query + ->where('ps.id_product IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); + $this->generateFullQuery($langIso, false); - $this->addSelectParameters($query); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $query->limit($limit, $offset); + $result = $this->runQuery(true); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('ps.id_product_supplier, ps.id_product, ps.id_product_attribute, ps.id_supplier, ps.product_supplier_reference'); - $query->select('ps.product_supplier_price_te, ps.id_currency'); + return $result[0]['count']; } } diff --git a/src/Repository/RepositoryInterface.php b/src/Repository/RepositoryInterface.php new file mode 100644 index 00000000..9904a316 --- /dev/null +++ b/src/Repository/RepositoryInterface.php @@ -0,0 +1,75 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @property \DbQuery $query + */ +interface RepositoryInterface +{ + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + */ + public function generateFullQuery($langIso, $withSelecParameters); + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function retrieveContentsForFull($offset, $limit, $langIso); + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso); + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso); +} diff --git a/src/Repository/ServerInformationRepository.php b/src/Repository/ServerInformationRepository.php deleted file mode 100644 index 02bd7e17..00000000 --- a/src/Repository/ServerInformationRepository.php +++ /dev/null @@ -1,230 +0,0 @@ - - */ - private $configuration; - /** - * @var ErrorHandlerInterface - */ - private $errorHandler; - - /** - * @param \Context $context - * @param PsAccountsAdapterService $psAccountsAdapterService - * @param CurrencyRepository $currencyRepository - * @param LanguageRepository $languageRepository - * @param ConfigurationRepository $configurationRepository - * @param ShopRepository $shopRepository - * @param ErrorHandlerInterface $errorHandler - * @param string $eventbusSyncApiUrl - * @param string $eventbusLiveSyncApiUrl - * @param string $eventbusProxyApiUrl - * - * @return void - */ - public function __construct( - \Context $context, - PsAccountsAdapterService $psAccountsAdapterService, - CurrencyRepository $currencyRepository, - LanguageRepository $languageRepository, - ConfigurationRepository $configurationRepository, - ShopRepository $shopRepository, - ErrorHandlerInterface $errorHandler, - $eventbusSyncApiUrl, - $eventbusLiveSyncApiUrl, - $eventbusProxyApiUrl - ) { - $this->currencyRepository = $currencyRepository; - $this->languageRepository = $languageRepository; - $this->configurationRepository = $configurationRepository; - $this->shopRepository = $shopRepository; - $this->context = $context; - $this->db = \Db::getInstance(); - $this->psAccountsAdapterService = $psAccountsAdapterService; - $this->configuration = [ - 'EVENT_BUS_SYNC_API_URL' => $eventbusSyncApiUrl, - 'EVENT_BUS_LIVE_SYNC_API_URL' => $eventbusLiveSyncApiUrl, - 'EVENT_BUS_PROXY_API_URL' => $eventbusProxyApiUrl, - ]; - $this->errorHandler = $errorHandler; - } - - /** - * @param string $langIso - * - * @return array[] - * - * @throws \PrestaShopException - */ - public function getServerInformation($langIso = '') - { - $langId = !empty($langIso) ? (int) \Language::getIdByIso($langIso) : null; - - /* This file is created on installation and never modified. - As php doesn't allow to retrieve the creation date of a file or folder, - we use the modification date of this file to get the installation date of the shop */ - $filename = './img/admin/enabled.gif'; - $folderCreatedAt = null; - if (file_exists($filename)) { - $folderCreatedAt = date('Y-m-d H:i:s', (int) filectime($filename)); - } - - if ($this->context->link === null) { - throw new \PrestaShopException('No link context'); - } - - return [ - [ - 'id' => '1', - 'collection' => Config::COLLECTION_SHOPS, - 'properties' => [ - 'created_at' => $this->shopRepository->getCreatedAt(), - 'folder_created_at' => $folderCreatedAt, - 'cms_version' => _PS_VERSION_, - 'url_is_simplified' => $this->configurationRepository->get('PS_REWRITING_SETTINGS') == '1', - 'cart_is_persistent' => $this->configurationRepository->get('PS_CART_FOLLOWING') == '1', - 'default_language' => $this->languageRepository->getDefaultLanguageIsoCode(), - 'languages' => implode(';', $this->languageRepository->getLanguagesIsoCodes()), - 'default_currency' => $this->currencyRepository->getDefaultCurrencyIsoCode(), - 'currencies' => implode(';', $this->currencyRepository->getCurrenciesIsoCodes()), - 'weight_unit' => $this->configurationRepository->get('PS_WEIGHT_UNIT'), - 'distance_unit' => $this->configurationRepository->get('PS_BASE_DISTANCE_UNIT'), - 'volume_unit' => $this->configurationRepository->get('PS_VOLUME_UNIT'), - 'dimension_unit' => $this->configurationRepository->get('PS_DIMENSION_UNIT'), - 'timezone' => $this->configurationRepository->get('PS_TIMEZONE'), - 'is_order_return_enabled' => $this->configurationRepository->get('PS_ORDER_RETURN') == '1', - 'order_return_nb_days' => (int) $this->configurationRepository->get('PS_ORDER_RETURN_NB_DAYS'), - 'php_version' => phpversion(), - 'http_server' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '', - 'url' => $this->context->link->getPageLink('index', null, $langId), - 'ssl' => $this->configurationRepository->get('PS_SSL_ENABLED') == '1', - 'multi_shop_count' => $this->shopRepository->getMultiShopCount(), - 'country_code' => $this->shopRepository->getShopCountryCode(), - ], - ], - ]; - } - - /** - * @param bool $isAuthentifiedCall - * - * @return array - */ - public function getHealthCheckData($isAuthentifiedCall) - { - $tokenValid = false; - $tokenIsSet = false; - $allTablesInstalled = true; - - try { - $token = $this->psAccountsAdapterService->getOrRefreshToken(); - if ($token) { - $tokenIsSet = true; - $accountsClient = $this->getAccountsClient(); - /** @phpstan-ignore-next-line */ - $response = $accountsClient->verifyToken($token); - if ($response && true === $response['status']) { - $tokenValid = true; - } - } - } catch (\Exception $e) { - $this->errorHandler->handle($e); - $tokenIsSet = false; - } - - foreach (\Ps_eventbus::REQUIRED_TABLES as $requiredTable) { - $query = new \DbQuery(); - - $query->select('*') - ->from($requiredTable) - ->limit(1); - - try { - $this->db->executeS($query); - } catch (\PrestaShopDatabaseException $e) { - $allTablesInstalled = false; - break; - } - } - - if (defined('PHP_VERSION') && defined('PHP_EXTRA_VERSION')) { - $phpVersion = str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION); - } else { - $phpVersion = (string) explode('-', (string) phpversion())[0]; - } - - $sensibleInformation = [ - 'prestashop_version' => _PS_VERSION_, - 'ps_eventbus_version' => \Ps_eventbus::VERSION, - 'ps_accounts_version' => defined('Ps_accounts::VERSION') ? \Ps_accounts::VERSION : false, /* @phpstan-ignore-line */ - 'php_version' => $phpVersion, - 'shop_id' => $this->psAccountsAdapterService->getShopUuid(), - ]; - - $serverInformation = [ - 'ps_account' => $tokenIsSet, - 'is_valid_jwt' => $tokenValid, - 'ps_eventbus' => $allTablesInstalled, - 'env' => [ - 'EVENT_BUS_PROXY_API_URL' => isset($this->configuration['EVENT_BUS_PROXY_API_URL']) ? $this->configuration['EVENT_BUS_PROXY_API_URL'] : null, - 'EVENT_BUS_SYNC_API_URL' => isset($this->configuration['EVENT_BUS_SYNC_API_URL']) ? $this->configuration['EVENT_BUS_SYNC_API_URL'] : null, - 'EVENT_BUS_LIVE_SYNC_API_URL' => isset($this->configuration['EVENT_BUS_LIVE_SYNC_API_URL']) ? $this->configuration['EVENT_BUS_LIVE_SYNC_API_URL'] : null, - ], - ]; - - if ($isAuthentifiedCall) { - $serverInformation = array_merge($sensibleInformation, $serverInformation); - } - - return $serverInformation; - } - - /** - * @return mixed - */ - private function getAccountsClient() - { - $module = \Module::getInstanceByName('ps_accounts'); - - /* @phpstan-ignore-next-line */ - return $module->getService(AccountsClient::class); - } -} diff --git a/src/Repository/ShopRepository.php b/src/Repository/ShopRepository.php index 1e523f5c..c9bae43d 100644 --- a/src/Repository/ShopRepository.php +++ b/src/Repository/ShopRepository.php @@ -1,31 +1,48 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class ShopRepository -{ - /** - * @var \Db - */ - private $db; - - public function __construct() - { - $this->db = \Db::getInstance(); - } +if (!defined('_PS_VERSION_')) { + exit; +} +class ShopRepository extends AbstractRepository +{ /** * @return int */ public function getMultiShopCount() { - $query = new \DbQuery(); + $this->generateMinimalQuery('shop', 's'); - $query->select('COUNT(id_shop)') - ->from('shop') - ->where('active = 1 and deleted = 0'); + $this->query->where('s.active = 1 and s.deleted = 0'); + $this->query->select('COUNT(s.id_shop)'); - return (int) $this->db->getValue($query); + return (int) $this->db->getValue($this->query); } /** @@ -33,13 +50,12 @@ public function getMultiShopCount() */ public function getCreatedAt() { - $query = new \DbQuery(); + $this->generateMinimalQuery('configuration', 'c'); - $query->select('date_add as created_at') - ->from('configuration') - ->where('name = "PS_INSTALL_VERSION"'); + $this->query->where('c.name = "PS_INSTALL_VERSION"'); + $this->query->select('c.date_add as created_at'); - return (string) $this->db->getValue($query); + return (string) $this->db->getValue($this->query); } /** @@ -49,12 +65,11 @@ public function getCreatedAt() */ public function getShopCountryCode() { - $query = new \DbQuery(); + $this->generateMinimalQuery('country', 'c'); - $query->select('iso_code') - ->from('country') - ->where('active = 1'); + $this->query->where('c.active = 1'); + $this->query->select('c.iso_code'); - return (string) $this->db->getValue($query); + return (string) $this->db->getValue($this->query); } } diff --git a/src/Repository/SpecificPriceRepository.php b/src/Repository/SpecificPriceRepository.php index 27e16717..ea95c292 100644 --- a/src/Repository/SpecificPriceRepository.php +++ b/src/Repository/SpecificPriceRepository.php @@ -1,60 +1,185 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class SpecificPriceRepository +if (!defined('_PS_VERSION_')) { + exit; +} + +class SpecificPriceRepository extends AbstractRepository implements RepositoryInterface { const TABLE_NAME = 'specific_price'; /** - * @var \Db + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - private $db; - - public function __construct() + public function generateFullQuery($langIso, $withSelecParameters) { - $this->db = \Db::getInstance(); + $this->generateMinimalQuery(self::TABLE_NAME, 'sp'); + + $this->query + ->leftJoin('country', 'c', 'c.id_country = sp.id_country') + ->leftJoin('currency', 'cur', 'cur.id_currency = sp.id_currency') + ; + + $this->query->where('sp.id_shop = 0 OR sp.id_shop = ' . (int) parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('sp.id_specific_price') + ->select('sp.id_product') + ->select('sp.id_shop') + ->select('sp.id_shop_group') + ->select('sp.id_currency') + ->select('sp.id_country') + ->select('sp.id_group') // different + ->select('sp.id_customer') + ->select('sp.id_product_attribute') + ->select('sp.price') + ->select('sp.from_quantity') + ->select('sp.reduction') + ->select('sp.reduction_tax') + ->select('sp.from') + ->select('sp.to') + ->select('sp.reduction_type') + ->select('c.iso_code as country') // different + ->select('cur.iso_code as currency') // different + ; + } } /** - * @return \DbQuery + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getBaseQuery() + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = new \DbQuery(); - $query->from(self::TABLE_NAME, 'sp'); + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); - return $query; + return $this->runQuery(); } /** - * @param int $specificPriceId + * @param int $limit + * @param array $contentIds + * @param string $langIso * - * @return array|bool|false|object|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getSpecificPrice($specificPriceId) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - if (!$specificPriceId) { + if ($contentIds == []) { return []; } - $query = $this->getBaseQuery(); - $this->addSelectParameters($query); - $query->where('sp.id_specific_price= ' . (int) $specificPriceId); + $this->generateFullQuery($langIso, true); - return $this->db->getRow($query); + $this->query + ->where('sp.id_specific_price IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; + + return $this->runQuery(); } /** - * @param \DbQuery $query + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int * - * @return void + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - private function addSelectParameters(\DbQuery $query) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query->select('sp.id_specific_price, sp.id_specific_price_rule, sp.id_cart, sp.id_product, sp.id_shop, sp.id_shop_group, sp.id_currency, sp.id_country'); - $query->select('sp.id_country, sp.id_customer, sp.id_product_attribute, sp.price, sp.from_quantity, sp.reduction, sp.reduction_tax, sp.reduction_type, sp.from, sp.to'); + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; + } + + /** + * @param int $specificPriceId + * + * @return array + * + * @throws \PrestaShopDatabaseException + */ + public function getSpecificPriceById($specificPriceId) + { + if (!$specificPriceId) { + return []; + } + + $this->generateMinimalQuery(self::TABLE_NAME, 'sp'); + + $this->query->where('sp.id_specific_price= ' . (int) $specificPriceId); + + $this->query + ->select('sp.id_specific_price') + ->select('sp.id_product') + ->select('sp.id_shop') + ->select('sp.id_shop_group') + ->select('sp.id_currency') + ->select('sp.id_country') + ->select('sp.id_customer') + ->select('sp.id_product_attribute') + ->select('sp.price') + ->select('sp.from_quantity') + ->select('sp.reduction') + ->select('sp.reduction_tax') + ->select('sp.from') + ->select('sp.to') + ->select('sp.reduction_type') + ->select('sp.id_specific_price_rule') // different + ->select('sp.id_cart') // different + ; + + return $this->runQuery(true); } } diff --git a/src/Repository/StateRepository.php b/src/Repository/StateRepository.php deleted file mode 100644 index c7e92b73..00000000 --- a/src/Repository/StateRepository.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ - private $stateIsoCodeCache = []; - - public function __construct() - { - $this->db = \Db::getInstance(); - } - - /** - * @return \DbQuery - */ - private function getBaseQuery() - { - $query = new \DbQuery(); - - $query->from('state', 's'); - - return $query; - } - - /** - * @param int $zoneId - * @param bool $active - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getStateIsoCodesByZoneId($zoneId, $active = null) - { - if ($active == null) { - $active = true; - } - - $cacheKey = $zoneId . '-' . (int) $active; - - if (!isset($this->stateIsoCodeCache[$cacheKey])) { - $query = $this->getBaseQuery(); - - $query->select('s.iso_code'); - $query->innerJoin('country', 'c', 'c.id_country = s.id_country'); - $query->where('s.id_zone = ' . (int) $zoneId); - $query->where('s.active = ' . (bool) $active); - $query->where('c.active = ' . (bool) $active); - - $isoCodes = []; - - $result = $this->db->executeS($query); - if (is_array($result)) { - foreach ($result as $state) { - $isoCodes[] = $state['iso_code']; - } - } - $this->stateIsoCodeCache[$cacheKey] = $isoCodes; - } - - return $this->stateIsoCodeCache[$cacheKey]; - } -} diff --git a/src/Repository/StockMovementRepository.php b/src/Repository/StockMovementRepository.php new file mode 100644 index 00000000..f897a2ab --- /dev/null +++ b/src/Repository/StockMovementRepository.php @@ -0,0 +1,142 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class StockMovementRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'stock_mvt'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'sm'); + + $this->query + ->innerJoin('stock_mvt_reason', 'smr', 'sm.id_stock_mvt_reason = smr.id_stock_mvt_reason') + ->innerJoin('stock_mvt_reason_lang', 'smrl', 'sm.id_stock_mvt_reason = smrl.id_stock_mvt_reason AND smrl.id_lang = ' . (int) parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('sm.id_stock_mvt') + ->select('sm.id_stock') + ->select('sm.id_order') + ->select('sm.id_supply_order') + ->select('sm.id_stock_mvt_reason') + ->select('smrl.name') + ->select('smrl.id_lang') + ->select('sm.id_employee') + ->select('sm.employee_lastname') + ->select('sm.employee_firstname') + ->select('sm.physical_quantity') + ->select('sm.date_add') + ->select('sm.sign') + ->select('sm.price_te') + ->select('sm.last_wa') + ->select('sm.current_wa') + ->select('sm.referer') + ->select('smr.deleted') + ; + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('sm.id_stock IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; + } +} diff --git a/src/Repository/StockMvtRepository.php b/src/Repository/StockMvtRepository.php deleted file mode 100644 index 6c3141f5..00000000 --- a/src/Repository/StockMvtRepository.php +++ /dev/null @@ -1,64 +0,0 @@ -db = \Db::getInstance(); - } - - /** - * @param string $langIso - * - * @return \DbQuery - */ - public function getBaseQuery($langIso) - { - /** @var int $langId */ - $langId = (int) \Language::getIdByIso($langIso); - $query = new \DbQuery(); - $query->from('stock_mvt', 'sm') - ->innerJoin('stock_mvt_reason', 'smr', 'sm.id_stock_mvt_reason = smr.id_stock_mvt_reason') - ->innerJoin('stock_mvt_reason_lang', 'smrl', 'sm.id_stock_mvt_reason = smrl.id_stock_mvt_reason AND smrl.id_lang = ' . (int) $langId); - - return $query; - } - - /** - * @param string $langIso - * @param array $stockIds - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getStockMvts($langIso, $stockIds) - { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); - - $query->where('sm.id_stock IN(' . implode(',', array_map('intval', $stockIds)) . ')'); - - return $this->db->executeS($query); - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('sm.id_stock_mvt, sm.id_stock, sm.id_order, sm.id_supply_order, sm.id_stock_mvt_reason, smrl.name, smrl.id_lang'); - $query->select('sm.id_employee, sm.employee_lastname, sm.employee_firstname, sm.physical_quantity, sm.date_add, sm.sign, sm.price_te'); - $query->select('sm.last_wa, sm.current_wa, sm.referer, smr.deleted'); - } -} diff --git a/src/Repository/StockRepository.php b/src/Repository/StockRepository.php index 93b1e534..6ecbf753 100644 --- a/src/Repository/StockRepository.php +++ b/src/Repository/StockRepository.php @@ -1,159 +1,166 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class StockRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class StockRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'stock_available'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - public function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + $this->generateMinimalQuery(self::TABLE_NAME, 'sa'); + + $this->query->where('sa.id_shop = ' . (int) parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('sa.id_stock_available') + ->select('sa.id_product') + ->select('sa.id_product_attribute') + ->select('sa.id_shop') + ->select('sa.id_shop_group') + ->select('sa.quantity') + ->select('sa.depends_on_stock') + ->select('sa.out_of_stock') + ; + + // https://github.com/PrestaShop/PrestaShop/commit/2a3269ad93b1985f2615d6604458061d4989f0ea#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2186 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.2.0', '>=')) { + $this->query + ->select('sa.physical_quantity') + ->select('sa.reserved_quantity') + ; + } + + // https://github.com/PrestaShop/PrestaShop/commit/4c7d58a905dfb61c7fb2ef4a1f9b4fab2a8d8ecb#diff-e57fb1deeaab9e9079505333394d58f0bf7bb40280b4382aad1278c08c73e2e8R58 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.5.0', '>=')) { + $this->query->select('sa.location'); + } } - - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - $query->from('stock_available', 'sa') - ->where('sa.id_shop = ' . (int) $shopId); - - return $query; } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getStocks($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->limit($limit, $offset); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingStocksCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(sa.id_stock_available) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $productIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getStocksIncremental($limit, $productIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('sa.id_product IN(' . implode(',', array_map('intval', $productIds)) . ')') - ->limit($limit); + $this->query + ->where('s.id_stock_available IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, false); - $query->limit($limit, $offset); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $result = $this->runQuery(true); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); + return $result[0]['count']; } /** - * @param array $productIds + * @param int $productId * - * @return array + * @return mixed * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getStocksIdsByProductIds($productIds) + public function getStockIdByProductId($productId) { - if (!$productIds) { - return []; - } - - $query = $this->getBaseQuery(); - - $query->select('sa.id_stock_available as id'); - $query->where('sa.id_product IN (' . implode(',', array_map('intval', $productIds)) . ')'); + $this->generateMinimalQuery(self::TABLE_NAME, 'sa'); - $result = $this->db->executeS($query); + $this->query + ->select('sa.id_stock_available') + ->where('sa.id_product = ' . (int) $productId) + ->where('sa.id_shop = ' . (int) parent::getShopContext()->id) + ; - return is_array($result) ? $result : []; - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('sa.id_stock_available, sa.id_product, sa.id_product_attribute, sa.id_shop, sa.id_shop_group'); - $query->select('sa.quantity, sa.depends_on_stock, sa.out_of_stock'); - - // https://github.com/PrestaShop/PrestaShop/commit/2a3269ad93b1985f2615d6604458061d4989f0ea#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2186 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.2.0', '>=')) { - $query->select('sa.physical_quantity, sa.reserved_quantity'); - } - // https://github.com/PrestaShop/PrestaShop/commit/4c7d58a905dfb61c7fb2ef4a1f9b4fab2a8d8ecb#diff-e57fb1deeaab9e9079505333394d58f0bf7bb40280b4382aad1278c08c73e2e8R58 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.5.0', '>=')) { - $query->select('sa.location'); - } + return $result[0]['id_stock_available']; } } diff --git a/src/Repository/StoreRepository.php b/src/Repository/StoreRepository.php index d6b6807f..6be5d5b9 100644 --- a/src/Repository/StoreRepository.php +++ b/src/Repository/StoreRepository.php @@ -1,54 +1,93 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class StoreRepository -{ - const STORES_TABLE = 'store'; - - /** - * @var \Db - */ - private $db; - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class StoreRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'store'; /** * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed * - * @return \DbQuery + * @throws \PrestaShopException */ - public function getBaseQuery($langIso) + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $this->context->shop->id; + $this->generateMinimalQuery(self::TABLE_NAME, 's'); $langId = (int) \Language::getIdByIso($langIso); - $query = new \DbQuery(); - // https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004 if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { - $query->from(self::STORES_TABLE, 's') + $this->query ->leftJoin('store_lang', 'sl', 's.id_store = sl.id_store') ->leftJoin('store_shop', 'ss', 's.id_store = ss.id_store') - ->where('ss.id_shop = ' . (int) $shopId) - ->where('sl.id_lang = ' . (int) $langId); - } else { - $query->from(self::STORES_TABLE, 's'); + ->where('ss.id_shop = ' . (int) parent::getShopContext()->id) + ->where('sl.id_lang = ' . (int) $langId) + ; } - return $query; + if ($withSelecParameters) { + $this->query + ->select('s.id_store') + ->select('s.id_country') + ->select('s.id_state') + ->select('s.city') + ->select('s.postcode') + ->select('s.active') + ->select('s.date_add as created_at') + ->select('s.date_upd as updated_at') + ; + + // https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { + $this->query + ->select('sl.id_lang') + ->select('sl.name') + ->select('sl.address1') + ->select('sl.address2') + ->select('sl.hours') + ->select('ss.id_shop') + ; + } else { + $this->query + ->select('s.name') + ->select('s.address1') + ->select('s.address2') + ->select('s.hours') + ; + } + } } /** @@ -56,59 +95,44 @@ public function getBaseQuery($langIso) * @param int $limit * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getStores($offset, $limit, $langIso) - { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); - - $query->limit((int) $limit, (int) $offset); - - return $this->db->executeS($query); - } - - /** - * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingStoreCount($offset, $langIso) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $stores = $this->getStores($offset, 1, $langIso); + $this->generateFullQuery($langIso, true); - if (!is_array($stores) || empty($stores)) { - return 0; - } + $this->query->limit((int) $limit, (int) $offset); - return count($stores); + return $this->runQuery(); } /** * @param int $limit + * @param array $contentIds * @param string $langIso - * @param array $storeIds * * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getStoresIncremental($limit, $langIso, $storeIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); + if ($contentIds == []) { + return []; + } - $query->where('s.id_store IN(' . implode(',', array_map('intval', $storeIds)) . ')') - ->limit($limit); + $this->generateFullQuery($langIso, true); - $result = $this->db->executeS($query); + $this->query + ->where('s.id_store IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return is_array($result) ? $result : []; + return $this->runQuery(); } /** @@ -116,55 +140,19 @@ public function getStoresIncremental($limit, $langIso, $storeIds) * @param int $limit * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $langIso) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery($langIso); + $this->generateFullQuery($langIso, false); - $this->addSelectParameters($query); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - $query->limit($limit, $offset); + $result = $this->runQuery(true); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); - - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } - - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('s.id_store'); - $query->select('s.id_country'); - $query->select('s.id_state'); - $query->select('s.city'); - $query->select('s.postcode'); - $query->select('s.active'); - $query->select('s.date_add as created_at'); - $query->select('s.date_upd as updated_at'); - - // https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004 - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { - $query->select('sl.id_lang'); - $query->select('sl.name'); - $query->select('sl.address1'); - $query->select('sl.address2'); - $query->select('sl.hours'); - $query->select('ss.id_shop'); - } else { - $query->select('s.name'); - $query->select('s.address1'); - $query->select('s.address2'); - $query->select('s.hours'); - } + return $result[0]['count']; } } diff --git a/src/Repository/SupplierRepository.php b/src/Repository/SupplierRepository.php index 269f6279..9a2a81c4 100644 --- a/src/Repository/SupplierRepository.php +++ b/src/Repository/SupplierRepository.php @@ -1,101 +1,122 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class SupplierRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class SupplierRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'supplier'; /** - * @param int $offset - * @param int $limit * @param string $langIso + * @param bool $withSelecParameters * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return mixed * - * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException */ - public function getSuppliers($offset, $limit, $langIso) + public function generateFullQuery($langIso, $withSelecParameters) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); + $this->generateMinimalQuery(self::TABLE_NAME, 'su'); - $query->limit($limit, $offset); + $langId = (int) \Language::getIdByIso($langIso); - return $this->db->executeS($query); + $this->query + ->innerJoin('supplier_lang', 'sul', 'su.id_supplier = sul.id_supplier AND sul.id_lang = ' . (int) $langId) + ->innerJoin('supplier_shop', 'sus', 'su.id_supplier = sus.id_supplier AND sus.id_shop = ' . parent::getShopContext()->id) + ; + + if ($withSelecParameters) { + $this->query + ->select('su.id_supplier') + ->select('su.name') + ->select('su.date_add as created_at') + ->select('su.date_upd as updated_at') + ->select('su.active') + ->select('sul.id_lang') + ->select('sul.description') + ->select('sul.meta_title') + ->select('sul.meta_description') + ->select('sus.id_shop') + ; + + // REMOVED HERE: https://github.com/PrestaShop/PrestaShop/commit/f37a8f61017654bae160b528a1a2eaf49edbdac0 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '9.0', '<')) { + $this->query->select('sul.meta_keywords'); + } + } } /** * @param int $offset - * @param string $langIso - * - * @return int - */ - public function getRemainingSuppliersCount($offset, $langIso) - { - $query = $this->getBaseQuery($langIso) - ->select('(COUNT(su.id_supplier) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); - } - - /** * @param int $limit * @param string $langIso - * @param array $supplierIds * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getSuppliersIncremental($limit, $langIso, $supplierIds) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('su.id_supplier IN(' . implode(',', array_map('intval', $supplierIds)) . ')') - ->limit($limit); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); + return $this->runQuery(); } /** + * @param int $limit + * @param array $contentIds * @param string $langIso * - * @return \DbQuery + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - public function getBaseQuery($langIso) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + if ($contentIds == []) { + return []; } - $shopId = (int) $this->context->shop->id; + $this->generateFullQuery($langIso, true); - /** @var int $langId */ - $langId = (int) \Language::getIdByIso($langIso); - $query = new \DbQuery(); - $query->from('supplier', 'su') - ->innerJoin('supplier_lang', 'sul', 'su.id_supplier = sul.id_supplier AND sul.id_lang = ' . (int) $langId) - ->innerJoin('supplier_shop', 'sus', 'su.id_supplier = sus.id_supplier AND sus.id_shop = ' . $shopId); + $this->query + ->where('su.id_supplier IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $query; + return $this->runQuery(); } /** @@ -103,34 +124,19 @@ public function getBaseQuery($langIso) * @param int $limit * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit, $langIso) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery($langIso); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); + $this->generateFullQuery($langIso, false); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('su.id_supplier, su.name, su.date_add as created_at, su.date_upd as updated_at, su.active, sul.id_lang'); - $query->select('sul.description, sul.meta_title, sul.meta_keywords, sul.meta_description, sus.id_shop'); + return $result[0]['count']; } } diff --git a/src/Repository/SyncRepository.php b/src/Repository/SyncRepository.php new file mode 100644 index 00000000..d92491ee --- /dev/null +++ b/src/Repository/SyncRepository.php @@ -0,0 +1,140 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class SyncRepository extends AbstractRepository +{ + const TYPE_SYNC_TABLE_NAME = 'eventbus_type_sync'; + const JOB_TABLE_NAME = 'eventbus_job'; + + /** + * @param string $type + * @param int $offset + * @param string $date + * @param bool $fullSyncFinished + * @param string $langIso + * + * @return bool + */ + public function upsertTypeSync($type, $offset, $date, $fullSyncFinished, $langIso = null) + { + return $this->db->insert( + self::TYPE_SYNC_TABLE_NAME, + [ + 'type' => pSQL((string) $type), + 'offset' => (int) $offset, + 'id_shop' => parent::getShopContext()->id, + 'lang_iso' => pSQL((string) $langIso), + 'full_sync_finished' => (int) $fullSyncFinished, + 'last_sync_date' => pSQL($date), + ], + false, + true, + \Db::ON_DUPLICATE_KEY + ); + } + + /** + * @param string $jobId + * @param string $date + * + * @return bool + * + * @throws \PrestaShopDatabaseException + */ + public function insertJob($jobId, $date) + { + return $this->db->insert( + self::JOB_TABLE_NAME, + [ + 'job_id' => pSQL($jobId), + 'created_at' => pSQL($date), + ] + ); + } + + /** + * @param string $jobId + * + * @return array|bool|false|object|null + */ + public function findJobById($jobId) + { + $this->generateMinimalQuery(self::JOB_TABLE_NAME, 'ej'); + + $this->query->where('ej.job_id = "' . pSQL($jobId) . '"'); + $this->query->select('ej.*'); + + return $this->db->getRow($this->query); + } + + /** + * @param string $type + * @param string $langIso + * + * @return array|bool|object|null + */ + public function findTypeSync($type, $langIso = null) + { + $this->generateMinimalQuery(self::TYPE_SYNC_TABLE_NAME, 'ets'); + + $this->query + ->where('ets.type = "' . pSQL($type) . '"') + ->where('ets.lang_iso = "' . pSQL((string) $langIso) . '"') + ->where('ets.id_shop = ' . parent::getShopContext()->id) + ; + + $this->query->select('ets.*'); + + return $this->db->getRow($this->query); + } + + /** + * @param string $type + * @param string $langIso + * + * @return bool + */ + public function isFullSyncDoneForThisTypeSync($type, $langIso = null) + { + $this->generateMinimalQuery(self::TYPE_SYNC_TABLE_NAME, 'ets'); + + $this->query + ->where('ets.type = "' . pSQL($type) . '"') + ->where('ets.lang_iso = "' . pSQL((string) $langIso) . '"') + ->where('ets.id_shop = ' . parent::getShopContext()->id) + ; + + $this->query->select('ets.full_sync_finished'); + + return (bool) $this->db->getValue($this->query); + } +} diff --git a/src/Repository/TaxRepository.php b/src/Repository/TaxRepository.php deleted file mode 100644 index 0ccb78c3..00000000 --- a/src/Repository/TaxRepository.php +++ /dev/null @@ -1,93 +0,0 @@ - - */ - private $countryIsoCodeCache = []; - - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } - - /** - * @return \DbQuery - */ - private function getBaseQuery() - { - if ($this->context->shop == null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $this->context->shop->id; - - if ($this->context->language == null) { - throw new \PrestaShopException('No language context'); - } - - $language = (int) $this->context->language->id; - - $query = new \DbQuery(); - - $query->from('tax', 't') - ->innerJoin('tax_rule', 'tr', 'tr.id_tax = t.id_tax') - ->innerJoin('tax_rules_group', 'trg', 'trg.id_tax_rules_group = tr.id_tax_rules_group') - ->innerJoin('tax_rules_group_shop', 'trgs', 'trgs.id_tax_rules_group = tr.id_tax_rules_group') - ->innerJoin('tax_lang', 'tl', 'tl.id_tax = t.id_tax') - ->where('trgs.id_shop = ' . $shopId) - ->where('tl.id_lang = ' . $language); - - return $query; - } - - /** - * @param int $zoneId - * @param int $taxRulesGroupId - * @param bool $active - * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopDatabaseException - */ - public function getCarrierTaxesByZone($zoneId, $taxRulesGroupId, $active = null) - { - if ($active == null) { - $active = true; - } - - $cacheKey = $zoneId . '-' . (int) $active; - - if (!isset($this->countryIsoCodeCache[$cacheKey])) { - $query = $this->getBaseQuery(); - - $query->select('rate, c.iso_code as country_iso_code, GROUP_CONCAT(s.iso_code SEPARATOR ",") as state_iso_code'); - $query->leftJoin('country', 'c', 'c.id_country = tr.id_country'); - $query->leftJoin('state', 's', 's.id_state = tr.id_state'); - $query->where('tr.id_tax_rules_group = ' . (int) $taxRulesGroupId); - $query->where('c.active = ' . (bool) $active); - $query->where('s.active = ' . (bool) $active . ' OR s.active IS NULL'); - $query->where('t.active = ' . (bool) $active); - $query->where('c.id_zone = ' . (int) $zoneId . ' OR s.id_zone = ' . (int) $zoneId); - $query->where('c.iso_code IS NOT NULL'); - - $this->countryIsoCodeCache[$cacheKey] = $this->db->executeS($query); - } - - return $this->countryIsoCodeCache[$cacheKey]; - } -} diff --git a/src/Repository/TaxonomyRepository.php b/src/Repository/TaxonomyRepository.php new file mode 100644 index 00000000..edefb17e --- /dev/null +++ b/src/Repository/TaxonomyRepository.php @@ -0,0 +1,147 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Repository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class TaxonomyRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'fb_category_match'; + + /** + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException + */ + public function generateFullQuery($langIso, $withSelecParameters) + { + $this->generateMinimalQuery(self::TABLE_NAME, 'fbcm'); + + $this->query->where('fbcm.id_shop = ' . (int) parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('fbcm.id_category') + ->select('fbcm.google_category_id') + ; + } + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForFull($offset, $limit, $langIso) + { + // need this module for this table : https://addons.prestashop.com/en/products-on-facebook-social-networks/50291-prestashop-social-with-facebook-instagram.html + if (empty($this->checkIfPsFacebookIsInstalled())) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query->limit((int) $limit, (int) $offset); + + return $this->runQuery(); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) + { + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('fbcm.id_category IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; + + return $this->runQuery(); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + public function countFullSyncContentLeft($offset, $limit, $langIso) + { + // need this module for this table : https://addons.prestashop.com/en/products-on-facebook-social-networks/50291-prestashop-social-with-facebook-instagram.html + if (empty($this->checkIfPsFacebookIsInstalled())) { + return 0; + } + + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; + } + + /** + * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException + */ + private function checkIfPsFacebookIsInstalled() + { + $moduleisInstalledQuery = 'SELECT * FROM information_schema.tables WHERE table_name LIKE \'%fb_category_match\' LIMIT 1;'; + + return $this->db->executeS($moduleisInstalledQuery); + } +} diff --git a/src/Repository/ThemeRepository.php b/src/Repository/ThemeRepository.php deleted file mode 100644 index d773ee3e..00000000 --- a/src/Repository/ThemeRepository.php +++ /dev/null @@ -1,91 +0,0 @@ -context = $context; - $this->db = \Db::getInstance(); - } - - /** - * @return array|mixed|null - */ - public function getThemes() - { - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $themeRepository = (new ThemeManagerBuilder($this->context, $this->db)) - ->buildRepository($this->context->shop); - - $currentTheme = $this->context->shop->theme; - $themes = $themeRepository->getList(); - - return array_map(function ($key, $theme) use ($currentTheme) { - return [ - 'id' => md5((string) $key), - 'collection' => Config::COLLECTION_THEMES, - 'properties' => [ - 'theme_id' => md5((string) $key), - 'name' => (string) $theme->getName(), - 'theme_version' => (string) $theme->get('version'), - 'active' => $theme->getName() == $currentTheme->getName(), - ], - ]; - }, array_keys($themes), $themes); - } else { - /* @phpstan-ignore-next-line */ - $themes = \Theme::getAvailable(false); - - return array_map(function ($theme) { - /* @phpstan-ignore-next-line */ - $themeObj = \Theme::getByDirectory($theme); - - $themeData = [ - 'id' => md5($theme), - 'collection' => Config::COLLECTION_THEMES, - 'properties' => [], - ]; - - /* @phpstan-ignore-next-line */ - if ($themeObj instanceof \Theme) { - /* @phpstan-ignore-next-line */ - $themeInfo = \Theme::getThemeInfo($themeObj->id); - - $themeData['properties'] = [ - 'theme_id' => md5($theme), - 'name' => isset($themeInfo['theme_name']) ? $themeInfo['theme_name'] : '', - 'theme_version' => isset($themeInfo['theme_version']) ? $themeInfo['theme_version'] : '', - 'active' => isset($themeInfo['theme_version']) ? false : (string) $this->context->theme->id == (string) $themeInfo['theme_id'], - ]; - } else { - $themeData['properties'] = [ - 'theme_id' => md5($theme), - 'name' => $theme, - 'theme_version' => '', - 'active' => false, - ]; - } - - return $themeData; - }, $themes); - } - } -} diff --git a/src/Repository/TranslationRepository.php b/src/Repository/TranslationRepository.php index 2043247b..62cb6d2a 100644 --- a/src/Repository/TranslationRepository.php +++ b/src/Repository/TranslationRepository.php @@ -1,123 +1,136 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class TranslationRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class TranslationRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'translation'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - public function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + $this->generateMinimalQuery(self::TABLE_NAME, 't'); + + if ($withSelecParameters) { + $this->query + ->select('t.id_translation') + ->select('t.id_lang') + ->select('t.key') + ->select('t.translation') + ->select('t.domain') + ->select('t.theme') + ; } - - $query = new \DbQuery(); - $query->from('translation', 't'); - - return $query; } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getTranslations($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); + // this table doesn't exist in the database before 1.7 + if (empty(parent::checkIfTableExist('%translation'))) { + return []; + } - return $this->db->executeS($query); - } + $this->generateFullQuery($langIso, true); - /** - * @param int $offset - * - * @return int - */ - public function getRemainingTranslationsCount($offset) - { - $query = $this->getBaseQuery() - ->select('(COUNT(t.id_translation) - ' . (int) $offset . ') as count'); + $this->query->limit((int) $limit, (int) $offset); - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $translationIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getTranslationsIncremental($limit, $translationIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('t.id_translation IN(' . implode(',', array_map('intval', $translationIds)) . ')') - ->limit($limit); + $this->query + ->where('t.id_translation IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + // this table doesn't exist in the database before 1.7 + if (empty(parent::checkIfTableExist('%translation'))) { + return 0; + } - $query->limit($limit, $offset); + $this->generateFullQuery($langIso, false); - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $result = $this->runQuery(true); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('t.id_translation, t.id_lang, t.key, t.translation, t.domain, t.theme'); + return $result[0]['count']; } } diff --git a/src/Repository/WishlistProductRepository.php b/src/Repository/WishlistProductRepository.php index f206bb1e..f4a012aa 100644 --- a/src/Repository/WishlistProductRepository.php +++ b/src/Repository/WishlistProductRepository.php @@ -1,75 +1,136 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class WishlistProductRepository -{ - /** - * @var \Db - */ - private $db; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct() - { - $this->db = \Db::getInstance(); - } +class WishlistProductRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'wishlist_product'; /** - * @param array $wishlistIds + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed * - * @return \DbQuery + * @throws \PrestaShopException */ - public function getBaseQuery(&$wishlistIds) + public function generateFullQuery($langIso, $withSelecParameters) { - $query = new \DbQuery(); - - $query->from('wishlist_product', 'wp'); - $query->where('wp.id_wishlist IN(' . implode(',', array_map('intval', $wishlistIds)) . ')'); + $this->generateMinimalQuery(self::TABLE_NAME, 'wp'); - return $query; + if ($withSelecParameters) { + $this->query + ->select('wp.id_wishlist_product') + ->select('wp.id_wishlist') + ->select('wp.id_product') + ->select('wp.id_product_attribute') + ->select('wp.quantity') + ->select('wp.priority') + ; + } } /** - * @param array $wishlistIds + * @param int $offset + * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getWishlistProducts(&$wishlistIds) + public function retrieveContentsForFull($offset, $limit, $langIso) { // need this module for this table : https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html - if (empty($this->checkIfPsWishlistIsInstalled())) { + if (empty(parent::checkIfTableExist('%wishlist'))) { return []; } - $query = $this->getBaseQuery($wishlistIds); + $this->generateFullQuery($langIso, true); - $this->addSelectParameters($query); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); + return $this->runQuery(); } /** - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @param int $limit + * @param array $contentIds + * @param string $langIso + * + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - private function checkIfPsWishlistIsInstalled() + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $moduleisInstalledQuery = 'SELECT * FROM information_schema.tables WHERE table_name LIKE \'%wishlist\' LIMIT 1;'; + if ($contentIds == []) { + return []; + } + + $this->generateFullQuery($langIso, true); + + $this->query + ->where('wp.id_wishlist IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($moduleisInstalledQuery); + return $this->runQuery(); } /** - * @param \DbQuery $query + * @param int $offset + * @param int $limit + * @param string $langIso * - * @return void + * @return int + * + * @throws \PrestaShopException + * @throws \PrestaShopDatabaseException */ - private function addSelectParameters(\DbQuery $query) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query->select('wp.id_wishlist_product, wp.id_wishlist, wp.id_product, wp.id_product_attribute'); - $query->select('wp.quantity, wp.priority'); + // need this module for this table : https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html + if (empty(parent::checkIfTableExist('%wishlist'))) { + return 0; + } + + $this->generateFullQuery($langIso, false); + + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); + + $result = $this->runQuery(true); + + return $result[0]['count']; } } diff --git a/src/Repository/WishlistRepository.php b/src/Repository/WishlistRepository.php index eeb8c1fd..f56fc089 100644 --- a/src/Repository/WishlistRepository.php +++ b/src/Repository/WishlistRepository.php @@ -1,150 +1,142 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Repository; -class WishlistRepository -{ - /** - * @var \Db - */ - private $db; - - /** - * @var \Context - */ - private $context; +if (!defined('_PS_VERSION_')) { + exit; +} - public function __construct(\Context $context) - { - $this->db = \Db::getInstance(); - $this->context = $context; - } +class WishlistRepository extends AbstractRepository implements RepositoryInterface +{ + const TABLE_NAME = 'wishlist'; /** - * @return \DbQuery + * @param string $langIso + * @param bool $withSelecParameters + * + * @return mixed + * + * @throws \PrestaShopException */ - public function getBaseQuery() + public function generateFullQuery($langIso, $withSelecParameters) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); + $this->generateMinimalQuery(self::TABLE_NAME, 'w'); + + $this->query->where('w.id_shop = ' . parent::getShopContext()->id); + + if ($withSelecParameters) { + $this->query + ->select('w.id_wishlist') + ->select('w.id_customer') + ->select('w.id_shop') + ->select('w.id_shop_group') + ->select('w.token') + ->select('w.name') + ->select('w.counter') + ->select('w.date_add AS created_at') + ->select('w.date_upd as updated_at') + ->select('w.default') + ; } - - $shopId = (int) $this->context->shop->id; - - $query = new \DbQuery(); - $query->from('wishlist', 'w') - ->where('w.id_shop = ' . $shopId); - - return $query; } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getWishlists($offset, $limit) + public function retrieveContentsForFull($offset, $limit, $langIso) { // need this module for this table : https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html - if (empty($this->checkIfPsWishlistIsInstalled())) { + if (empty(parent::checkIfTableExist('%wishlist'))) { return []; } - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->limit($limit, $offset); + $this->query->limit((int) $limit, (int) $offset); - return $this->db->executeS($query); - } - - /** - * @param int $offset - * - * @return int - */ - public function getRemainingWishlistsCount($offset) - { - // need this module for this table : https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html - if (empty($this->checkIfPsWishlistIsInstalled())) { - return 0; - } - - $query = $this->getBaseQuery() - ->select('(COUNT(w.id_wishlist) - ' . (int) $offset . ') as count'); - - return (int) $this->db->getValue($query); + return $this->runQuery(); } /** * @param int $limit - * @param array $wishlistIds + * @param array $contentIds + * @param string $langIso * - * @return array|bool|\mysqli_result|\PDOStatement|resource|null + * @return array * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getWishlistsIncremental($limit, $wishlistIds) + public function retrieveContentsForIncremental($limit, $contentIds, $langIso) { - $query = $this->getBaseQuery(); + if ($contentIds == []) { + return []; + } - $this->addSelectParameters($query); + $this->generateFullQuery($langIso, true); - $query->where('w.id_wishlist IN(' . implode(',', array_map('intval', $wishlistIds)) . ')') - ->limit($limit); + $this->query + ->where('w.id_wishlist IN(' . implode(',', array_map('intval', $contentIds)) . ')') + ->limit($limit) + ; - return $this->db->executeS($query); + return $this->runQuery(); } /** * @param int $offset * @param int $limit + * @param string $langIso * - * @return array + * @return int * + * @throws \PrestaShopException * @throws \PrestaShopDatabaseException */ - public function getQueryForDebug($offset, $limit) + public function countFullSyncContentLeft($offset, $limit, $langIso) { - $query = $this->getBaseQuery(); - - $this->addSelectParameters($query); - - $query->limit($limit, $offset); - - $queryStringified = preg_replace('/\s+/', ' ', $query->build()); + // need this module for this table : https://addons.prestashop.com/en/undownloadable/9131-wishlist-block.html + if (empty(parent::checkIfTableExist('%wishlist'))) { + return 0; + } - return array_merge( - (array) $query, - ['queryStringified' => $queryStringified] - ); - } + $this->generateFullQuery($langIso, false); - /** - * @param \DbQuery $query - * - * @return void - */ - private function addSelectParameters(\DbQuery $query) - { - $query->select('w.id_wishlist, w.id_customer, w.id_shop, w.id_shop_group, w.token, w.name, w.counter'); - $query->select('w.date_add AS created_at, w.date_upd as updated_at, w.default'); - } + $this->query->select('(COUNT(*) - ' . (int) $offset . ') as count'); - /** - * @return array|bool|\mysqli_result|\PDOStatement|resource|null - * - * @throws \PrestaShopException - * @throws \PrestaShopDatabaseException - */ - private function checkIfPsWishlistIsInstalled() - { - $moduleisInstalledQuery = 'SELECT * FROM information_schema.tables WHERE table_name LIKE \'%wishlist\' LIMIT 1;'; + $result = $this->runQuery(true); - return $this->db->executeS($moduleisInstalledQuery); + return $result[0]['count']; } } diff --git a/src/Service/ApiAuthorizationService.php b/src/Service/ApiAuthorizationService.php index a94fb012..ff1e7ac8 100644 --- a/src/Service/ApiAuthorizationService.php +++ b/src/Service/ApiAuthorizationService.php @@ -1,28 +1,113 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Service; use PrestaShop\Module\PsEventbus\Api\SyncApiClient; -use PrestaShop\Module\PsEventbus\Repository\EventbusSyncRepository; +use PrestaShop\Module\PsEventbus\Exception\EnvVarException; +use PrestaShop\Module\PsEventbus\Exception\FirebaseException; +use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler; +use PrestaShop\Module\PsEventbus\Repository\SyncRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} class ApiAuthorizationService { - /** - * @var EventbusSyncRepository - */ - private $eventbusSyncRepository; + /** @var SyncRepository */ + private $syncRepository; - /** - * @var SyncApiClient - */ + /** @var SyncApiClient */ private $syncApiClient; + /** @var PsAccountsAdapterService */ + private $psAccountsAdapterService; + + /** @var ErrorHandler */ + private $errorHandler; + public function __construct( - EventbusSyncRepository $eventbusSyncRepository, - SyncApiClient $syncApiClient + SyncRepository $syncRepository, + SyncApiClient $syncApiClient, + PsAccountsAdapterService $psAccountsAdapterService, + ErrorHandler $errorHandler ) { - $this->eventbusSyncRepository = $eventbusSyncRepository; + $this->syncRepository = $syncRepository; $this->syncApiClient = $syncApiClient; + $this->psAccountsAdapterService = $psAccountsAdapterService; + $this->errorHandler = $errorHandler; + } + + /** + * @param string $jobId + * @param bool $isHealthCheck + * + * @return bool + * + * @throws \PrestaShopDatabaseException|EnvVarException|FirebaseException + */ + public function authorize($jobId, $isHealthCheck) + { + try { + $authorizationResponse = $this->authorizeCall($jobId); + + if (!$authorizationResponse) { + throw new \PrestaShopDatabaseException('Failed saving job id to database'); + } + + try { + $token = $this->psAccountsAdapterService->getOrRefreshToken(); + } catch (\Exception $exception) { + throw new FirebaseException($exception->getMessage()); + } + + if (!$token) { + throw new FirebaseException('Invalid token'); + } + + return true; + } catch (\Exception $exception) { + // For ApiHealthCheck, handle the error, and return false + if ($isHealthCheck) { + return false; + } + + switch ($exception) { + case $exception instanceof \PrestaShopDatabaseException: + case $exception instanceof EnvVarException: + case $exception instanceof FirebaseException: + $this->errorHandler->handle($exception); + break; + default: + break; + } + + return false; + } } /** @@ -30,12 +115,12 @@ public function __construct( * * @param string $jobId * - * @return array|bool + * @return bool */ - public function authorizeCall($jobId) + private function authorizeCall($jobId) { // Check if the job already exists - $job = $this->eventbusSyncRepository->findJobById($jobId); + $job = $this->syncRepository->findJobById($jobId); if ($job) { return true; @@ -44,11 +129,11 @@ public function authorizeCall($jobId) // Check the jobId validity to avoid Denial Of Service $jobValidationResponse = $this->syncApiClient->validateJobId($jobId); - if (!is_array($jobValidationResponse) || (int) $jobValidationResponse['httpCode'] !== 201) { + if ((int) $jobValidationResponse['httpCode'] !== 201) { return false; } // Cache the valid jobId - return $this->eventbusSyncRepository->insertJob($jobId, date(DATE_ATOM)); + return $this->syncRepository->insertJob($jobId, date(DATE_ATOM)); } } diff --git a/src/Service/ApiHealthCheckService.php b/src/Service/ApiHealthCheckService.php new file mode 100644 index 00000000..ebea7a73 --- /dev/null +++ b/src/Service/ApiHealthCheckService.php @@ -0,0 +1,185 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service; + +use PrestaShop\Module\PsAccounts\Api\Client\AccountsClient; +use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ApiHealthCheckService +{ + /** @var \Db */ + private $db; + + /** @var PsAccountsAdapterService */ + private $psAccountsAdapterService; + + /** @var ApiAuthorizationService */ + private $apiAuthorizationService; + + /** @var array */ + private $configuration; + + /** @var ErrorHandler */ + private $errorHandler; + + /** + * @var array + */ + const REQUIRED_TABLES = [ + 'eventbus_type_sync', + 'eventbus_job', + 'eventbus_incremental_sync', + ]; + + /** + * @param PsAccountsAdapterService $psAccountsAdapterService + * @param ErrorHandler $errorHandler + * @param string $eventbusSyncApiUrl + * @param string $eventbusLiveSyncApiUrl + * @param string $eventbusProxyApiUrl + * + * @return void + */ + public function __construct( + PsAccountsAdapterService $psAccountsAdapterService, + ApiAuthorizationService $apiAuthorizationService, + ErrorHandler $errorHandler, + $eventbusSyncApiUrl, + $eventbusLiveSyncApiUrl, + $eventbusProxyApiUrl + ) { + $this->db = \Db::getInstance(); + $this->apiAuthorizationService = $apiAuthorizationService; + $this->psAccountsAdapterService = $psAccountsAdapterService; + $this->configuration = [ + 'EVENT_BUS_SYNC_API_URL' => $eventbusSyncApiUrl, + 'EVENT_BUS_LIVE_SYNC_API_URL' => $eventbusLiveSyncApiUrl, + 'EVENT_BUS_PROXY_API_URL' => $eventbusProxyApiUrl, + ]; + $this->errorHandler = $errorHandler; + } + + /** + * @param string $jobId + * + * @return array + * + * @throws \PrestaShopException + */ + public function getHealthCheck($jobId) + { + $tokenValid = false; + $tokenIsSet = false; + $allTablesInstalled = false; + + $isAuthentified = $this->apiAuthorizationService->authorize($jobId, true); + + try { + $token = $this->psAccountsAdapterService->getOrRefreshToken(); + if ($token) { + $psAccount = \Module::getInstanceByName('ps_accounts'); + + /* @phpstan-ignore-next-line */ + $accountsClient = $psAccount->getService(AccountsClient::class); + + $tokenIsSet = true; + + /** @phpstan-ignore-next-line */ + $response = $accountsClient->verifyToken($token); + if ($response && true === $response['status']) { + $tokenValid = true; + } + } + } catch (\Exception $exception) { + $this->errorHandler->handle($exception); + $tokenIsSet = false; + } + + $missingTables = $this->getMissingRequiredTables(); + + if (count($missingTables) == 0) { + $allTablesInstalled = true; + } + + if (defined('PHP_VERSION') && defined('PHP_EXTRA_VERSION')) { + $phpVersion = str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION); + } else { + $phpVersion = (string) explode('-', (string) phpversion())[0]; + } + + $sensibleInformation = [ + 'prestashop_version' => _PS_VERSION_, + 'ps_eventbus_version' => \Ps_eventbus::VERSION, + 'ps_accounts_version' => defined('Ps_accounts::VERSION') ? \Ps_accounts::VERSION : false, /* @phpstan-ignore-line */ + 'php_version' => $phpVersion, + 'shop_id' => $this->psAccountsAdapterService->getShopUuid(), + ]; + + $serverInformation = [ + 'ps_account' => $tokenIsSet, + 'is_valid_jwt' => $tokenValid, + 'ps_eventbus' => $allTablesInstalled, + 'env' => [ + 'EVENT_BUS_PROXY_API_URL' => isset($this->configuration['EVENT_BUS_PROXY_API_URL']) ? $this->configuration['EVENT_BUS_PROXY_API_URL'] : null, + 'EVENT_BUS_SYNC_API_URL' => isset($this->configuration['EVENT_BUS_SYNC_API_URL']) ? $this->configuration['EVENT_BUS_SYNC_API_URL'] : null, + 'EVENT_BUS_LIVE_SYNC_API_URL' => isset($this->configuration['EVENT_BUS_LIVE_SYNC_API_URL']) ? $this->configuration['EVENT_BUS_LIVE_SYNC_API_URL'] : null, + ], + ]; + + if ($isAuthentified) { + $serverInformation = array_merge($sensibleInformation, $serverInformation); + } + + return $serverInformation; + } + + /** + * @return array + * + * @throws \PrestaShopDatabaseException + */ + private function getMissingRequiredTables() + { + $requiredTablesQuery = 'SELECT TABLE_NAME FROM information_schema.tables WHERE table_name LIKE \'%eventbus%\';'; + $requiredTablesResponse = (array) $this->db->executeS($requiredTablesQuery); + + // Transform 2D array into array + $requiredTables = array_column($requiredTablesResponse, 'TABLE_NAME'); + + // Remove the prefix of the tables (ex: ps_) + $filteredRequiredTables = array_map(function ($item) { + return substr($item, strpos($item, '_') + 1); + }, $requiredTables); + + // return array, with list of missing required table + return array_diff(self::REQUIRED_TABLES, $filteredRequiredTables); + } +} diff --git a/src/Service/ApiShopContentService.php b/src/Service/ApiShopContentService.php new file mode 100644 index 00000000..a1a1a28f --- /dev/null +++ b/src/Service/ApiShopContentService.php @@ -0,0 +1,174 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Exception\QueryParamsException; +use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler; +use PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository; +use PrestaShop\Module\PsEventbus\Repository\SyncRepository; +use PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ApiShopContentService +{ + /** @var int */ + public $startTime; + + /** @var ApiAuthorizationService */ + private $apiAuthorizationService; + + /** @var SyncRepository */ + private $syncRepository; + + /** @var SynchronizationService */ + private $synchronizationService; + + /** @var \Ps_eventbus */ + private $module; + + /** @var ErrorHandler */ + private $errorHandler; + + public function __construct( + \Ps_eventbus $module, + ErrorHandler $errorHandler, + ApiAuthorizationService $apiAuthorizationService, + SynchronizationService $synchronizationService, + SyncRepository $syncRepository + ) { + $this->startTime = time(); + + $this->module = $module; + $this->errorHandler = $errorHandler; + $this->apiAuthorizationService = $apiAuthorizationService; + $this->synchronizationService = $synchronizationService; + $this->syncRepository = $syncRepository; + } + + /** + * @param string $shopContent + * @param string $jobId + * @param string $langIso + * @param int $limit + * @param bool $fullSyncRequested + * + * @return void + */ + public function handleDataSync($shopContent, $jobId, $langIso, $limit, $fullSyncRequested) + { + try { + if (!in_array($shopContent, Config::SHOP_CONTENTS, true)) { + CommonService::exitWithExceptionMessage(new QueryParamsException('404 - ShopContent not found', Config::INVALID_URL_QUERY)); + } + + if ($limit < 0) { + CommonService::exitWithExceptionMessage(new QueryParamsException('Invalid URL Parameters', Config::INVALID_URL_QUERY)); + } + + $this->apiAuthorizationService->authorize($jobId, false); + + $response = []; + + /** @var LanguagesService $languagesService */ + $languagesService = $this->module->getService('PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService'); + + $timezone = (string) \Configuration::get('PS_TIMEZONE'); + $dateNow = (new \DateTime('now', new \DateTimeZone($timezone)))->format(Config::MYSQL_DATE_FORMAT); + $langIso = $langIso ? $langIso : $languagesService->getDefaultLanguageIsoCode(); + + $typeSync = $this->syncRepository->findTypeSync($shopContent, $langIso); + + // If no typesync exist, or if fullsync is requested by user + if (!is_array($typeSync) || $fullSyncRequested) { + $isFullSync = true; + $fullSyncIsFinished = false; + $offset = 0; + + if ($typeSync) { + /** @var IncrementalSyncRepository $incrementalSyncRepository */ + $incrementalSyncRepository = $this->module->getService('PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository'); + $incrementalSyncRepository->removeIncrementaSyncObjectByType($shopContent); + } + + $this->syncRepository->upsertTypeSync( + $shopContent, + $offset, + $dateNow, + $fullSyncIsFinished, + $langIso + ); + // Else if fullsync is not finished + } elseif (!boolval($typeSync['full_sync_finished'])) { + $isFullSync = true; + $fullSyncIsFinished = false; + $offset = (int) $typeSync['offset']; + // Else, we are in incremental sync + } else { + $isFullSync = false; + $fullSyncIsFinished = $typeSync['full_sync_finished']; + $offset = (int) $typeSync['offset']; + } + + if ($isFullSync) { + $response = $this->synchronizationService->sendFullSync( + $shopContent, + $jobId, + $langIso, + $offset, + $limit, + $this->startTime, + $dateNow + ); + } else { + $response = $this->synchronizationService->sendIncrementalSync( + $shopContent, + $jobId, + $langIso, + $limit, + $this->startTime + ); + } + + CommonService::exitWithResponse( + array_merge( + [ + 'job_id' => $jobId, + 'object_type' => $shopContent, + 'syncType' => $isFullSync ? 'full' : 'incremental', + ], + $response + ) + ); + } catch (\Exception $exception) { + $this->errorHandler->handle($exception); + } + } +} diff --git a/src/Service/CacheService.php b/src/Service/CacheService.php deleted file mode 100644 index 858354a3..00000000 --- a/src/Service/CacheService.php +++ /dev/null @@ -1,35 +0,0 @@ -getItem($key); - $cacheItem->set($value); - $cache->save($cacheItem); - } - - /** - * @param string $key - * - * @return mixed - */ - public function getCacheProperty($key) - { - $cache = new FilesystemAdapter(); - $cacheItem = $cache->getItem($key); - - return $cacheItem->get(); - } -} diff --git a/src/Service/CommonService.php b/src/Service/CommonService.php new file mode 100644 index 00000000..9c83df03 --- /dev/null +++ b/src/Service/CommonService.php @@ -0,0 +1,155 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Exception\EnvVarException; +use PrestaShop\Module\PsEventbus\Exception\FirebaseException; +use PrestaShop\Module\PsEventbus\Exception\QueryParamsException; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CommonService +{ + /** + * @param mixed $response + * + * @return void + */ + public static function exitWithResponse($response) + { + if (!is_array($response)) { + $response = [$response]; + } + + $httpCode = isset($response['httpCode']) ? (int) $response['httpCode'] : 200; + + self::dieWithResponse($response, $httpCode); + } + + /** + * @param \Exception $exception + * + * @return void + */ + public static function exitWithExceptionMessage(\Exception $exception) + { + switch ($exception) { + case $exception instanceof \PrestaShopDatabaseException: + $code = Config::DATABASE_QUERY_ERROR_CODE; + break; + case $exception instanceof EnvVarException: + $code = Config::ENV_MISCONFIGURED_ERROR_CODE; + break; + case $exception instanceof FirebaseException: + $code = Config::REFRESH_TOKEN_ERROR_CODE; + break; + case $exception instanceof QueryParamsException: + $code = Config::INVALID_URL_QUERY; + break; + default: + $code = 500; + } + + $response = [ + 'object_type' => \Tools::getValue('shopContent'), + 'status' => false, + 'httpCode' => $code, + 'message' => $code == 500 ? 'Server error' : $exception->getMessage(), + ]; + + self::dieWithResponse($response, (int) $code); + } + + /** + * @param array $response + * @param int $code + * + * @return void + */ + public static function dieWithResponse($response, $code) + { + $httpStatusText = "HTTP/1.1 $code"; + + if (array_key_exists((int) $code, Config::HTTP_STATUS_MESSAGES)) { + $httpStatusText .= ' ' . Config::HTTP_STATUS_MESSAGES[(int) $code]; + } elseif (isset($response['body']['statusText'])) { + $httpStatusText .= ' ' . $response['body']['statusText']; + } + + $response['httpCode'] = (int) $code; + + header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); + header('Content-Type: application/json;charset=utf-8'); + header($httpStatusText); + + echo json_encode($response, JSON_UNESCAPED_SLASHES); + + exit; + } + + /** + * @param array $payload + * + * @return void + * + * @throws \Exception + */ + public static function convertDateFormat(&$payload) + { + // use hardcoded format to avoid problems with interface change in PHP 7.2 + $ISO8601 = 'Y-m-d\TH:i:sO'; + $dateFields = [ + 'created_at', + 'updated_at', + 'last_connection_date', + 'folder_created_at', + 'date_add', + 'newsletter_date_add', + 'from', + 'to', + ]; + + $timezone = (string) \Configuration::get('PS_TIMEZONE'); + + foreach ($payload as &$payloadItem) { + foreach ($dateFields as $dateField) { + if (isset($payloadItem['properties'][$dateField])) { + $date = &$payloadItem['properties'][$dateField]; + if (!empty($date) && $date !== '0000-00-00 00:00:00') { + $dateTime = new \DateTime($date, new \DateTimeZone($timezone)); + $date = $dateTime->format($ISO8601); + } else { + $date = null; + } + } + } + } + } +} diff --git a/src/Service/CompressionService.php b/src/Service/CompressionService.php deleted file mode 100644 index c4763a13..00000000 --- a/src/Service/CompressionService.php +++ /dev/null @@ -1,42 +0,0 @@ -jsonFormatter = $jsonFormatter; - } - - /** - * Compresses data with gzip - * - * @param array $data - * - * @return string - * - * @@throws \Exception - */ - public function gzipCompressData($data) - { - if (!extension_loaded('zlib')) { - throw new \Exception('Zlib extension for PHP is not enabled'); - } - - $dataJson = $this->jsonFormatter->formatNewlineJsonString($data); - - if (!$encodedData = gzencode($dataJson)) { - throw new \Exception('Failed encoding data to GZIP'); - } - - return $encodedData; - } -} diff --git a/src/Service/DeletedObjectsService.php b/src/Service/DeletedObjectsService.php deleted file mode 100644 index ad772ed2..00000000 --- a/src/Service/DeletedObjectsService.php +++ /dev/null @@ -1,93 +0,0 @@ -context = $context; - $this->deletedObjectsRepository = $deletedObjectsRepository; - $this->proxyService = $proxyService; - } - - /** - * @param string $jobId - * @param int $scriptStartTime - * - * @return array - * - * @@throws \PrestaShopDatabaseException|EnvVarException - */ - public function handleDeletedObjectsSync($jobId, $scriptStartTime) - { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $this->context->shop->id; - - $deletedObjects = $this->deletedObjectsRepository->getDeletedObjectsGrouped($shopId); - - if (empty($deletedObjects)) { - return [ - 'job_id' => $jobId, - 'total_objects' => 0, - 'syncType' => 'full', - ]; - } - - $data = $this->formatData($deletedObjects); - - $response = $this->proxyService->delete($jobId, $data, $scriptStartTime); - - if ($response['httpCode'] == 200) { - foreach ($data as $dataItem) { - $this->deletedObjectsRepository->removeDeletedObjects( - $dataItem['collection'], - $dataItem['deleteIds'], - $shopId - ); - } - } - - return array_merge( - [ - 'job_id' => $jobId, - 'total_objects' => count($data), - 'syncType' => 'full', - ], - $response - ); - } - - /** - * @param array $data - * - * @return array - */ - private function formatData($data) - { - return array_map(function ($dataItem) { - return [ - 'collection' => $dataItem['type'], - 'deleteIds' => explode(';', $dataItem['ids']), - ]; - }, $data); - } -} diff --git a/src/Service/PresenterService.php b/src/Service/PresenterService.php index 3c8f5bcb..832d8c51 100644 --- a/src/Service/PresenterService.php +++ b/src/Service/PresenterService.php @@ -1,7 +1,35 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Service; +if (!defined('_PS_VERSION_')) { + exit; +} + class PresenterService { /** @@ -65,7 +93,7 @@ public function expose(\ModuleCore $module, $requiredConsents = [], $optionalCon */ private function convertObjectToArray($object) { - if ($object == false) { + if (!$object) { return []; } $array = []; diff --git a/src/Service/ProxyService.php b/src/Service/ProxyService.php index adf65316..29fdf4a2 100644 --- a/src/Service/ProxyService.php +++ b/src/Service/ProxyService.php @@ -1,4 +1,28 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Service; @@ -7,7 +31,11 @@ use PrestaShop\Module\PsEventbus\Api\CollectorApiClient; use PrestaShop\Module\PsEventbus\Exception\EnvVarException; use PrestaShop\Module\PsEventbus\Formatter\JsonFormatter; -use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandlerInterface; +use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler; + +if (!defined('_PS_VERSION_')) { + exit; +} class ProxyService implements ProxyServiceInterface { @@ -20,11 +48,11 @@ class ProxyService implements ProxyServiceInterface */ private $jsonFormatter; /** - * @var ErrorHandlerInterface + * @var ErrorHandler */ private $errorHandler; - public function __construct(CollectorApiClient $eventBusProxyClient, JsonFormatter $jsonFormatter, ErrorHandlerInterface $errorHandler) + public function __construct(CollectorApiClient $eventBusProxyClient, JsonFormatter $jsonFormatter, ErrorHandler $errorHandler) { $this->eventBusProxyClient = $eventBusProxyClient; $this->jsonFormatter = $jsonFormatter; @@ -41,7 +69,7 @@ public function __construct(CollectorApiClient $eventBusProxyClient, JsonFormatt * * @throws EnvVarException */ - public function upload($jobId, $data, $scriptStartTime, $isFull = null) + public function upload($jobId, $data, $scriptStartTime, $isFull) { $dataJson = $this->jsonFormatter->formatNewlineJsonString($data); @@ -52,7 +80,7 @@ public function upload($jobId, $data, $scriptStartTime, $isFull = null) return ['error' => $exception->getMessage()]; } catch (ConnectException $exception) { - $this->errorHandler->handle(new \Exception($exception)); + $this->errorHandler->handle($exception); return ['error' => $exception->getMessage()]; } diff --git a/src/Service/ProxyServiceInterface.php b/src/Service/ProxyServiceInterface.php index 4ea84e07..3ec8f616 100644 --- a/src/Service/ProxyServiceInterface.php +++ b/src/Service/ProxyServiceInterface.php @@ -1,7 +1,35 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Service; +if (!defined('_PS_VERSION_')) { + exit; +} + interface ProxyServiceInterface { /** @@ -12,7 +40,7 @@ interface ProxyServiceInterface * * @return array */ - public function upload($jobId, $data, $scriptStartTime, $isFull = null); + public function upload($jobId, $data, $scriptStartTime, $isFull); /** * @param string $jobId diff --git a/src/Service/PsAccountsAdapterService.php b/src/Service/PsAccountsAdapterService.php index d928c747..d877993d 100644 --- a/src/Service/PsAccountsAdapterService.php +++ b/src/Service/PsAccountsAdapterService.php @@ -1,9 +1,37 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Service; use PrestaShop\Module\PsEventbus\Helper\ModuleHelper; +if (!defined('_PS_VERSION_')) { + exit; +} + class PsAccountsAdapterService { /** @@ -31,7 +59,7 @@ public function __construct(ModuleHelper $moduleHelper) */ public function getModule() { - if ($this->moduleHelper->isInstalledAndActive('ps_accounts') == false) { + if (!$this->moduleHelper->isInstalledAndActive('ps_accounts')) { return false; } @@ -47,7 +75,7 @@ public function getModule() */ public function getService() { - if ($this->moduleHelper->isInstalledAndActive('ps_accounts') == false) { + if (!$this->moduleHelper->isInstalledAndActive('ps_accounts')) { return false; } @@ -63,7 +91,7 @@ public function getService() */ public function getPresenter() { - if ($this->moduleHelper->isInstalledAndActive('ps_accounts') == false) { + if (!$this->moduleHelper->isInstalledAndActive('ps_accounts')) { return false; } @@ -79,7 +107,7 @@ public function getPresenter() */ public function getShopUuid() { - if ($this->moduleHelper->isInstalledAndActive('ps_accounts') == false) { + if (!$this->moduleHelper->isInstalledAndActive('ps_accounts')) { return ''; } @@ -95,7 +123,7 @@ public function getShopUuid() */ public function getOrRefreshToken() { - if ($this->moduleHelper->isInstalledAndActive('ps_accounts') == false) { + if (!$this->moduleHelper->isInstalledAndActive('ps_accounts')) { return ''; } diff --git a/src/Service/ShopContent/AttributesService.php b/src/Service/ShopContent/AttributesService.php new file mode 100644 index 00000000..9055003c --- /dev/null +++ b/src/Service/ShopContent/AttributesService.php @@ -0,0 +1,75 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; + +if (!defined('_PS_VERSION_')) { + exit; +} + +// The service exists solely because it is necessary to notify CloudSync about the deleted content, +// and there is nothing specific to synchronize in full sync, or that has been upserted. +class AttributesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + return []; + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + return parent::formatIncrementalSyncResponse(Config::COLLECTION_BUNDLES, [], $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return 0; + } +} diff --git a/src/Service/ShopContent/BundlesService.php b/src/Service/ShopContent/BundlesService.php new file mode 100644 index 00000000..7645e524 --- /dev/null +++ b/src/Service/ShopContent/BundlesService.php @@ -0,0 +1,123 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\BundleRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class BundlesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var BundleRepository */ + private $bundleRepository; + + public function __construct(BundleRepository $bundleRepository) + { + $this->bundleRepository = $bundleRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->bundleRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castBundles($result, $langIso); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_BUNDLES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->bundleRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castBundles($result, $langIso); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_BUNDLES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->bundleRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $bundles + * @param string $langIso + * + * @return void + */ + private function castBundles(&$bundles, $langIso) + { + foreach ($bundles as &$bundle) { + $bundle['id_product'] = (string) $bundle['id_product_item']; + $bundle['unique_product_id'] = "{$bundle['id_bundle']}-{$bundle['product_id_attribute']}-{$langIso}"; + $bundle['id_bundle'] = (string) $bundle['id_bundle']; + $bundle['id_product_attribute'] = (string) $bundle['id_product_attribute']; + $bundle['quantity'] = (string) $bundle['quantity']; + + unset($bundle['product_id_attribute']); + unset($bundle['id_product_item']); + unset($bundle['id_product_attribute_item']); + } + } +} diff --git a/src/Service/ShopContent/CarrierDetailsService.php b/src/Service/ShopContent/CarrierDetailsService.php new file mode 100644 index 00000000..b5b477f6 --- /dev/null +++ b/src/Service/ShopContent/CarrierDetailsService.php @@ -0,0 +1,123 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CarrierDetailRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CarrierDetailsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CarrierDetailRepository */ + private $carrierDetailRepository; + + public function __construct(CarrierDetailRepository $carrierDetailRepository) + { + $this->carrierDetailRepository = $carrierDetailRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->carrierDetailRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCarrierDetails($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CARRIER_DETAILS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->carrierDetailRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCarrierDetails($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CARRIER_DETAILS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->carrierDetailRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $carrierDetails + * + * @return void + */ + private function castCarrierDetails(&$carrierDetails) + { + foreach ($carrierDetails as &$carrierDetail) { + $carrierDetail['id_reference'] = (string) $carrierDetail['id_reference']; + $carrierDetail['id_zone'] = (string) $carrierDetail['id_zone']; + $carrierDetail['id_range'] = (string) $carrierDetail['id_range']; + $carrierDetail['id_carrier_detail'] = (string) $carrierDetail['id_range']; // same value as id_range + $carrierDetail['shipping_method'] = (string) $carrierDetail['shipping_method']; + $carrierDetail['delimiter1'] = (float) $carrierDetail['delimiter1']; + $carrierDetail['delimiter2'] = (float) $carrierDetail['delimiter2']; + $carrierDetail['country_ids'] = (string) $carrierDetail['country_ids']; + $carrierDetail['state_ids'] = (string) $carrierDetail['state_ids']; + $carrierDetail['price'] = (float) $carrierDetail['price']; + } + } +} diff --git a/src/Service/ShopContent/CarrierTaxesService.php b/src/Service/ShopContent/CarrierTaxesService.php new file mode 100644 index 00000000..97eecc20 --- /dev/null +++ b/src/Service/ShopContent/CarrierTaxesService.php @@ -0,0 +1,120 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CarrierTaxeRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CarrierTaxesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CarrierTaxeRepository */ + private $carrierTaxeRepository; + + public function __construct(CarrierTaxeRepository $carrierTaxeRepository) + { + $this->carrierTaxeRepository = $carrierTaxeRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->carrierTaxeRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCarrierTaxes($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CARRIER_TAXES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->carrierTaxeRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCarrierTaxes($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CARRIER_TAXES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->carrierTaxeRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $carrierTaxes + * + * @return void + */ + private function castCarrierTaxes(&$carrierTaxes) + { + foreach ($carrierTaxes as &$carrierTaxe) { + $carrierTaxe['id_reference'] = (string) $carrierTaxe['id_reference']; + $carrierTaxe['id_zone'] = (string) $carrierTaxe['id_zone']; + $carrierTaxe['id_range'] = (string) $carrierTaxe['id_range']; + $carrierTaxe['id_carrier_tax'] = (string) $carrierTaxe['id_carrier_tax']; + $carrierTaxe['country_id'] = (string) $carrierTaxe['country_id']; + $carrierTaxe['state_ids'] = (string) $carrierTaxe['state_ids']; + $carrierTaxe['tax_rate'] = (float) $carrierTaxe['tax_rate']; + } + } +} diff --git a/src/Service/ShopContent/CarriersService.php b/src/Service/ShopContent/CarriersService.php new file mode 100644 index 00000000..701a4d2b --- /dev/null +++ b/src/Service/ShopContent/CarriersService.php @@ -0,0 +1,182 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CarrierRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CarriersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CarrierRepository */ + private $carrierRepository; + + public function __construct(CarrierRepository $carrierRepository) + { + $this->carrierRepository = $carrierRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->carrierRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCarriers($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CARRIERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->carrierRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCarriers($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CARRIERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->carrierRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param \Carrier $carrier + * @param array $delivery + * + * @return false|\RangeWeight|\RangePrice + * + * @throws \PrestaShopDatabaseException + * @throws \PrestaShopException + */ + public static function generateRange($carrier, $delivery) + { + $rangeTable = $carrier->getRangeTable(); + + if ($rangeTable === 'range_weight') { + return new \RangeWeight($delivery['id_range_weight']); + } + + if ($rangeTable === 'range_price') { + return new \RangePrice($delivery['id_range_price']); + } + + return false; + } + + /** + * @param array $carriers + * + * @return void + */ + private function castCarriers(&$carriers) + { + $context = \Context::getContext(); + + if ($context == null) { + throw new \PrestaShopException('Context is null'); + } + + $currency = new \Currency((int) \Configuration::get('PS_CURRENCY_DEFAULT')); + $freeShippingStartsAtPrice = (float) \Configuration::get('PS_SHIPPING_FREE_PRICE'); + $freeShippingStartsAtWeight = (float) \Configuration::get('PS_SHIPPING_FREE_WEIGHT'); + + /** @var string $psWeightUnit */ + $psWeightUnit = \Configuration::get('PS_WEIGHT_UNIT'); + + foreach ($carriers as &$carrier) { + $carrierTaxesRatesGroupId = \Carrier::getIdTaxRulesGroupByIdCarrier((int) $carrier['id_carrier'], \Context::getContext()); + + $shippingHandling = 0.0; + + if ($carrier['shipping_handling']) { + $shippingHandling = (float) \Configuration::get('PS_SHIPPING_HANDLING'); + } + + $carrier['id_carrier'] = (string) $carrier['id_carrier']; + $carrier['id_reference'] = (string) $carrier['id_reference']; + $carrier['name'] = (string) $carrier['name']; + $carrier['carrier_taxes_rates_group_id'] = (string) $carrierTaxesRatesGroupId; + $carrier['url'] = (string) $carrier['url']; + $carrier['active'] = (bool) $carrier['active']; + $carrier['deleted'] = (bool) $carrier['deleted']; + $carrier['shipping_handling'] = (float) $shippingHandling; + $carrier['free_shipping_starts_at_price'] = (float) $freeShippingStartsAtPrice; + $carrier['free_shipping_starts_at_weight'] = (float) $freeShippingStartsAtWeight; + $carrier['disable_carrier_when_out_of_range'] = (bool) $carrier['disable_carrier_when_out_of_range']; + $carrier['is_module'] = (bool) $carrier['is_module']; + $carrier['is_free'] = (bool) $carrier['is_free']; + $carrier['shipping_external'] = (bool) $carrier['shipping_external']; + $carrier['need_range'] = (bool) $carrier['need_range']; + $carrier['external_module_name'] = (string) $carrier['external_module_name']; + $carrier['max_width'] = (float) $carrier['max_width']; + $carrier['max_height'] = (float) $carrier['max_height']; + $carrier['max_depth'] = (float) $carrier['max_depth']; + $carrier['max_weight'] = (float) $carrier['max_weight']; + $carrier['grade'] = (int) $carrier['grade']; + $carrier['delay'] = (string) $carrier['delay']; + $carrier['currency'] = (string) $currency->iso_code; + $carrier['weight_unit'] = (string) $psWeightUnit; + } + } +} diff --git a/src/Service/ShopContent/CartProductsService.php b/src/Service/ShopContent/CartProductsService.php new file mode 100644 index 00000000..7201debb --- /dev/null +++ b/src/Service/ShopContent/CartProductsService.php @@ -0,0 +1,118 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CartProductRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CartProductsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CartProductRepository */ + private $cartProductRepository; + + public function __construct(CartProductRepository $cartProductRepository) + { + $this->cartProductRepository = $cartProductRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->cartProductRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCartProducts($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CART_PRODUCTS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->cartProductRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCartProducts($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CART_PRODUCTS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->cartProductRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $cartProducts + * + * @return void + */ + private function castCartProducts(&$cartProducts) + { + foreach ($cartProducts as &$cartProduct) { + $cartProduct['id_cart_product'] = (string) "{$cartProduct['id_cart']}-{$cartProduct['id_product']}-{$cartProduct['id_product_attribute']}"; + $cartProduct['id_cart'] = (string) $cartProduct['id_cart']; + $cartProduct['id_product'] = (string) $cartProduct['id_product']; + $cartProduct['id_product_attribute'] = (string) $cartProduct['id_product_attribute']; + $cartProduct['quantity'] = (int) $cartProduct['quantity']; + } + } +} diff --git a/src/Provider/CartRuleDataProvider.php b/src/Service/ShopContent/CartRulesService.php similarity index 55% rename from src/Provider/CartRuleDataProvider.php rename to src/Service/ShopContent/CartRulesService.php index fc1d9e85..500f70b7 100644 --- a/src/Provider/CartRuleDataProvider.php +++ b/src/Service/ShopContent/CartRulesService.php @@ -1,86 +1,91 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; use PrestaShop\Module\PsEventbus\Config\Config; use PrestaShop\Module\PsEventbus\Repository\CartRuleRepository; -class CartRuleDataProvider implements PaginatedApiDataProviderInterface +if (!defined('_PS_VERSION_')) { + exit; +} + +class CartRulesService extends ShopContentAbstractService implements ShopContentServiceInterface { - /** - * @var CartRuleRepository - */ + /** @var CartRuleRepository */ private $cartRuleRepository; - /** - * @param CartRuleRepository $cartRuleRepository - */ - public function __construct( - CartRuleRepository $cartRuleRepository - ) { - $this->cartRuleRepository = $cartRuleRepository; - } - - public function getFormattedData($offset, $limit, $langIso) + public function __construct(CartRuleRepository $cartRuleRepository) { - $cartRules = $this->cartRuleRepository->getCartRules($limit, $offset); - - if (!is_array($cartRules) || empty($cartRules)) { - return []; - } - - $this->castCartRuleValues($cartRules); - - if (is_array($cartRules)) { - return array_map(function ($cartRule) { - return [ - 'id' => $cartRule['id_cart_rule'], - 'collection' => Config::COLLECTION_CART_RULES, - 'properties' => $cartRule, - ]; - }, $cartRules); - } - - return []; + $this->cartRuleRepository = $cartRuleRepository; } /** * @param int $offset + * @param int $limit * @param string $langIso * - * @return int + * @return array */ - public function getRemainingObjectsCount($offset, $langIso) + public function getContentsForFull($offset, $limit, $langIso) { - return (int) $this->cartRuleRepository->getRemainingCartRulesCount($offset); + $result = $this->cartRuleRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCartRules($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CART_RULES, + 'properties' => $item, + ]; + }, $result); } /** * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents * @param string $langIso - * @param array $objectIds * * @return array - * - * @@throws \PrestaShopDatabaseException */ - public function getFormattedDataIncremental($limit, $langIso, $objectIds) + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) { - $cartRules = $this->cartRuleRepository->getCartRulesIncremental($limit, $objectIds); + $result = $this->cartRuleRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); - if (!is_array($cartRules)) { - return []; + if (!empty($result)) { + $this->castCartRules($result); } - $this->castCartRuleValues($cartRules); - - return array_map(function ($cartRule) { - return [ - 'id' => $cartRule['id_cart_rule'], - 'collection' => Config::COLLECTION_CART_RULES, - 'properties' => $cartRule, - ]; - }, $cartRules); + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CART_RULES, $result, $deletedContents); } /** @@ -88,13 +93,11 @@ public function getFormattedDataIncremental($limit, $langIso, $objectIds) * @param int $limit * @param string $langIso * - * @return array - * - * @@throws \PrestaShopDatabaseException + * @return int */ - public function getQueryForDebug($offset, $limit, $langIso) + public function getFullSyncContentLeft($offset, $limit, $langIso) { - return $this->cartRuleRepository->getQueryForDebug($limit, $offset); + return $this->cartRuleRepository->countFullSyncContentLeft($offset, $limit, $langIso); } /** @@ -102,7 +105,7 @@ public function getQueryForDebug($offset, $limit, $langIso) * * @return void */ - private function castCartRuleValues(&$cartRules) + private function castCartRules(&$cartRules) { foreach ($cartRules as &$cartRule) { $cartRule['id_cart_rule'] = (int) $cartRule['id_cart_rule']; diff --git a/src/Service/ShopContent/CartsService.php b/src/Service/ShopContent/CartsService.php new file mode 100644 index 00000000..ec44a0d1 --- /dev/null +++ b/src/Service/ShopContent/CartsService.php @@ -0,0 +1,116 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CartRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CartsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CartRepository */ + private $cartRepository; + + public function __construct(CartRepository $cartRepository) + { + $this->cartRepository = $cartRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->cartRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCarts($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CARTS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->cartRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCarts($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CARTS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->cartRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $carts + * + * @return void + */ + private function castCarts(&$carts) + { + foreach ($carts as &$cart) { + $cart['id_cart'] = (string) $cart['id_cart']; + $cart['created_at'] = (string) $cart['created_at']; + $cart['updated_at'] = (string) $cart['updated_at']; + } + } +} diff --git a/src/Service/ShopContent/CategoriesService.php b/src/Service/ShopContent/CategoriesService.php new file mode 100644 index 00000000..206534dd --- /dev/null +++ b/src/Service/ShopContent/CategoriesService.php @@ -0,0 +1,174 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CategoryRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CategoriesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CategoryRepository */ + private $categoryRepository; + + public function __construct(CategoryRepository $categoryRepository) + { + $this->categoryRepository = $categoryRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->categoryRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCategories($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CATEGORIES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->categoryRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCategories($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CATEGORIES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->categoryRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param int $topCategoryId + * @param int $langId + * @param int $shopId + * + * @return array + */ + public function getCategoryPaths($topCategoryId, $langId, $shopId) + { + if ((int) $topCategoryId === 0) { + return [ + 'category_path' => '', + 'category_id_path' => '', + ]; + } + + $categories = []; + + try { + $categoriesWithParentsInfo = $this->categoryRepository->getCategoriesWithParentInfo($langId, $shopId); + } catch (\PrestaShopDatabaseException $e) { + return [ + 'category_path' => '', + 'category_id_path' => '', + ]; + } + + $this->buildCategoryPaths($categoriesWithParentsInfo, $topCategoryId, $categories); + + $categories = array_reverse($categories); + + return [ + 'category_path' => implode(' > ', array_map(function ($category) { + return $category['name']; + }, $categories)), + 'category_id_path' => implode(' > ', array_map(function ($category) { + return $category['id_category']; + }, $categories)), + ]; + } + + /** + * @param array $categoriesWithParentsInfo + * @param int $currentCategoryId + * @param array $categories + * + * @return void + */ + private function buildCategoryPaths($categoriesWithParentsInfo, $currentCategoryId, &$categories) + { + foreach ($categoriesWithParentsInfo as $category) { + if ($category['id_category'] == $currentCategoryId) { + $categories[] = $category; + $this->buildCategoryPaths($categoriesWithParentsInfo, $category['id_parent'], $categories); + } + } + } + + /** + * @param array $categories + * + * @return void + */ + private function castCategories(&$categories) + { + foreach ($categories as &$category) { + $category['id_category'] = (int) $category['id_category']; + $category['id_parent'] = (int) $category['id_parent']; + $category['description'] = base64_encode($category['description']); + } + } +} diff --git a/src/Service/ShopContent/CurrenciesService.php b/src/Service/ShopContent/CurrenciesService.php new file mode 100644 index 00000000..8cdc4723 --- /dev/null +++ b/src/Service/ShopContent/CurrenciesService.php @@ -0,0 +1,144 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CurrencyRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CurrenciesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CurrencyRepository */ + private $currencyRepository; + + public function __construct(CurrencyRepository $currencyRepository) + { + $this->currencyRepository = $currencyRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->currencyRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCurrencies($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CURRENCIES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->currencyRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCurrencies($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CURRENCIES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->currencyRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @return array + */ + public function getCurrenciesIsoCodes() + { + $currencies = \Currency::getCurrencies(); + + return array_map(function ($currency) { + return $currency['iso_code']; + }, $currencies); + } + + /** + * @return string + */ + public function getDefaultCurrencyIsoCode() + { + $currency = \Currency::getDefaultCurrency(); + + return $currency instanceof \Currency ? $currency->iso_code : ''; + } + + /** + * @param array $currencies + * + * @return void + */ + private function castCurrencies(&$currencies) + { + foreach ($currencies as &$currency) { + $currency['id_currency'] = (int) $currency['id_currency']; + $currency['conversion_rate'] = (float) $currency['conversion_rate']; + $currency['deleted'] = (bool) $currency['deleted']; + $currency['active'] = (bool) $currency['active']; + + // https://github.com/PrestaShop/PrestaShop/commit/37807f66b40b0cebb365ef952e919be15e9d6b2f#diff-3f41d3529ffdbfd1b994927eb91826a32a0560697025a734cf128a2c8e092a45R124 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.6.0', '>=')) { + $currency['precision'] = (int) $currency['precision']; + } + } + } +} diff --git a/src/Service/ShopContent/CustomProductCarriersService.php b/src/Service/ShopContent/CustomProductCarriersService.php new file mode 100644 index 00000000..4b4cb83d --- /dev/null +++ b/src/Service/ShopContent/CustomProductCarriersService.php @@ -0,0 +1,96 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CustomProductCarriersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CustomProductCarrierRepository */ + private $customProductCarrierRepository; + + public function __construct(CustomProductCarrierRepository $customProductCarrierRepository) + { + $this->customProductCarrierRepository = $customProductCarrierRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->customProductCarrierRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->customProductCarrierRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->customProductCarrierRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } +} diff --git a/src/Service/ShopContent/CustomersService.php b/src/Service/ShopContent/CustomersService.php new file mode 100644 index 00000000..101d2b0f --- /dev/null +++ b/src/Service/ShopContent/CustomersService.php @@ -0,0 +1,124 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CustomerRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class CustomersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CustomerRepository */ + private $customerRepository; + + public function __construct(CustomerRepository $customerRepository) + { + $this->customerRepository = $customerRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->customerRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCustomers($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_CUSTOMERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->customerRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCustomers($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_CUSTOMERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->customerRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $customers + * + * @return void + */ + private function castCustomers(&$customers) + { + foreach ($customers as &$customer) { + $customer['id_customer'] = (int) $customer['id_customer']; + $customer['id_lang'] = (int) $customer['id_lang']; + $customer['newsletter'] = (bool) $customer['newsletter']; + $customer['newsletter_date_add'] = (string) $customer['newsletter_date_add']; + $customer['optin'] = (bool) $customer['optin']; + $customer['active'] = (bool) $customer['active']; + $customer['is_guest'] = (bool) $customer['is_guest']; + $customer['deleted'] = (bool) $customer['deleted']; + + $customer['email_hash'] = hash('sha256', $customer['email'] . 'dUj4GMBD6689pL9pyr'); + unset($customer['email']); + } + } +} diff --git a/src/Service/ShopContent/EmployeesService.php b/src/Service/ShopContent/EmployeesService.php new file mode 100644 index 00000000..1ccf7b3e --- /dev/null +++ b/src/Service/ShopContent/EmployeesService.php @@ -0,0 +1,143 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\EmployeeRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class EmployeesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var EmployeeRepository */ + private $employeeRepository; + + public function __construct(EmployeeRepository $employeeRepository) + { + $this->employeeRepository = $employeeRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->employeeRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castEmployees($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_EMPLOYEES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->employeeRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castEmployees($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_EMPLOYEES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->employeeRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $currencies + * + * @return void + */ + private function castEmployees(&$currencies) + { + foreach ($currencies as &$employee) { + $employee['id_employee'] = (int) $employee['id_employee']; + $employee['id_profile'] = (int) $employee['id_profile']; + $employee['id_lang'] = (int) $employee['id_lang']; + + $employee['default_tab'] = (int) $employee['default_tab']; + $employee['bo_width'] = (int) $employee['bo_width']; + $employee['bo_menu'] = (bool) $employee['bo_menu']; + + $employee['optin'] = (bool) $employee['optin']; + $employee['active'] = (bool) $employee['active']; + + $employee['id_last_order'] = (int) $employee['id_last_order']; + $employee['id_last_customer_message'] = (int) $employee['id_last_customer_message']; + $employee['id_last_customer'] = (int) $employee['id_last_customer']; + + if ($employee['last_connection_date'] == '0000-00-00') { + $employee['last_connection_date'] = null; + } else { + $employee['last_connection_date'] = (string) $employee['last_connection_date']; + } + + $employee['id_shop'] = (int) $employee['id_shop']; + + // https://github.com/PrestaShop/PrestaShop/commit/20f1d9fe8a03559dfa9d1f7109de1f70c99f1874#diff-cde6a9d4a58afb13ff068801ee09c0e712c5e90b0cbf5632a0cc965f15cb6802R107 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.8.0', '>=')) { + $employee['has_enabled_gravatar'] = (bool) $employee['has_enabled_gravatar']; + } + + $employee['email_hash'] = hash('sha256', $employee['email'] . 'dUj4GMBD6689pL9pyr'); + unset($employee['email']); + } + } +} diff --git a/src/Service/ShopContent/ImageTypesService.php b/src/Service/ShopContent/ImageTypesService.php new file mode 100644 index 00000000..36df3956 --- /dev/null +++ b/src/Service/ShopContent/ImageTypesService.php @@ -0,0 +1,122 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ImageTypeRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ImageTypesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var ImageTypeRepository */ + private $imageTypeRepository; + + public function __construct(ImageTypeRepository $imageTypeRepository) + { + $this->imageTypeRepository = $imageTypeRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->imageTypeRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castImageTypes($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_IMAGE_TYPES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->imageTypeRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castImageTypes($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_IMAGE_TYPES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->imageTypeRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $imageTypes + * + * @return void + */ + private function castImageTypes(&$imageTypes) + { + foreach ($imageTypes as &$imageType) { + $imageType['id_image_type'] = (int) $imageType['id_image_type']; + $imageType['name'] = (string) $imageType['name']; + $imageType['width'] = (int) $imageType['width']; + $imageType['height'] = (int) $imageType['height']; + $imageType['products'] = (bool) $imageType['products']; + $imageType['categories'] = (bool) $imageType['categories']; + $imageType['manufacturers'] = (bool) $imageType['manufacturers']; + $imageType['suppliers'] = (bool) $imageType['suppliers']; + $imageType['stores'] = (bool) $imageType['stores']; + } + } +} diff --git a/src/Service/ShopContent/ImagesService.php b/src/Service/ShopContent/ImagesService.php new file mode 100644 index 00000000..47a7fb42 --- /dev/null +++ b/src/Service/ShopContent/ImagesService.php @@ -0,0 +1,120 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ImageRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ImagesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var ImageRepository */ + private $imageRepository; + + public function __construct(ImageRepository $imageRepository) + { + $this->imageRepository = $imageRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->imageRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castImages($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_IMAGES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->imageRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castImages($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_IMAGES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->imageRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $images + * + * @return void + */ + private function castImages(&$images) + { + foreach ($images as &$image) { + $image['id_image'] = (int) $image['id_image']; + $image['id_product'] = (int) $image['id_product']; + $image['id_lang'] = (int) $image['id_lang']; + $image['id_shop'] = (int) $image['id_shop']; + $image['position'] = (int) $image['position']; + $image['cover'] = (bool) $image['cover']; + $image['legend'] = (string) $image['legend']; + } + } +} diff --git a/src/Service/ShopContent/LanguagesService.php b/src/Service/ShopContent/LanguagesService.php new file mode 100644 index 00000000..596a676e --- /dev/null +++ b/src/Service/ShopContent/LanguagesService.php @@ -0,0 +1,162 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\LanguageRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class LanguagesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var LanguageRepository */ + private $languageRepository; + + public function __construct(LanguageRepository $languageRepository) + { + $this->languageRepository = $languageRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->languageRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castLanguages($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_LANGUAGES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->languageRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castLanguages($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_LANGUAGES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->languageRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @return array + */ + public function getLanguagesIsoCodes() + { + /** @var array $languages */ + $languages = \Language::getLanguages(); + + return array_map(function ($language) { + return $language['iso_code']; + }, $languages); + } + + /** + * @return string + */ + public function getDefaultLanguageIsoCode() + { + $language = \Language::getLanguage((int) \Configuration::get('PS_LANG_DEFAULT')); + + if (is_array($language)) { + return $language['iso_code']; + } + + return ''; + } + + /** + * @param string $isoCode + * + * @return int + */ + public function getLanguageIdByIsoCode($isoCode) + { + return (int) \Language::getIdByIso($isoCode); + } + + /** + * @return array + */ + public function getLanguages() + { + return \Language::getLanguages(); + } + + /** + * @param array $languages + * + * @return void + */ + private function castLanguages(&$languages) + { + foreach ($languages as &$language) { + $language['id_lang'] = (int) $language['id_lang']; + $language['active'] = (bool) $language['active']; + $language['is_rtl'] = (bool) $language['is_rtl']; + $language['id_shop'] = (int) $language['id_shop']; + } + } +} diff --git a/src/Service/ShopContent/ManufacturersService.php b/src/Service/ShopContent/ManufacturersService.php new file mode 100644 index 00000000..34666c09 --- /dev/null +++ b/src/Service/ShopContent/ManufacturersService.php @@ -0,0 +1,119 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ManufacturerRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ManufacturersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var ManufacturerRepository */ + private $manufacturerRepository; + + public function __construct(ManufacturerRepository $manufacturerRepository) + { + $this->manufacturerRepository = $manufacturerRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->manufacturerRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castManufacturers($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_MANUFACTURERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->manufacturerRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castManufacturers($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_MANUFACTURERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->manufacturerRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $manufacturers + * + * @return void + */ + private function castManufacturers(&$manufacturers) + { + foreach ($manufacturers as &$manufacturer) { + $manufacturer['id_manufacturer'] = (int) $manufacturer['id_manufacturer']; + $manufacturer['active'] = (bool) $manufacturer['active']; + $manufacturer['id_lang'] = (int) $manufacturer['id_lang']; + $manufacturer['id_shop'] = (int) $manufacturer['id_shop']; + $manufacturer['created_at'] = (string) $manufacturer['created_at']; + $manufacturer['updated_at'] = (string) $manufacturer['updated_at']; + } + } +} diff --git a/src/Service/ShopContent/ModulesService.php b/src/Service/ShopContent/ModulesService.php new file mode 100644 index 00000000..d07425fa --- /dev/null +++ b/src/Service/ShopContent/ModulesService.php @@ -0,0 +1,126 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ModuleRepository; +use PrestaShop\Module\PsEventbus\Repository\ShopRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ModulesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var ModuleRepository */ + private $moduleRepository; + + /** @var ShopRepository */ + private $shopRepository; + + public function __construct( + ModuleRepository $moduleRepository, + ShopRepository $shopRepository + ) { + $this->moduleRepository = $moduleRepository; + $this->shopRepository = $shopRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->moduleRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castModules($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_MODULES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->moduleRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castModules($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_MODULES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->moduleRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $modules + * + * @return void + */ + private function castModules(&$modules) + { + $shopCreatedAt = $this->shopRepository->getCreatedAt(); + + foreach ($modules as &$module) { + $module['module_id'] = (string) $module['module_id']; + $module['active'] = $module['active'] == '1'; + $module['created_at'] = isset($module['created_at']) ? $module['created_at'] : $shopCreatedAt; + $module['updated_at'] = isset($module['updated_at']) ? $module['updated_at'] : $shopCreatedAt; + } + } +} diff --git a/src/Service/ShopContent/OrderCartRulesService.php b/src/Service/ShopContent/OrderCartRulesService.php new file mode 100644 index 00000000..044bca19 --- /dev/null +++ b/src/Service/ShopContent/OrderCartRulesService.php @@ -0,0 +1,140 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\OrderCartRuleRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrderCartRulesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var OrderCartRuleRepository */ + private $orderCartRuleRepository; + + public function __construct(OrderCartRuleRepository $orderCartRuleRepository) + { + $this->orderCartRuleRepository = $orderCartRuleRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->orderCartRuleRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castOrderCartRules($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_ORDER_CART_RULES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->orderCartRuleRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castOrderCartRules($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_ORDER_CART_RULES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->orderCartRuleRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $orderCartRules + * + * @return void + */ + private function castOrderCartRules(&$orderCartRules) + { + foreach ($orderCartRules as &$orderCartRule) { + $orderCartRule['id_cart_rule'] = (int) $orderCartRule['id_cart_rule']; + $orderCartRule['id_customer'] = (int) $orderCartRule['id_customer']; + $orderCartRule['quantity'] = (int) $orderCartRule['quantity']; + $orderCartRule['quantity_per_user'] = (int) $orderCartRule['quantity_per_user']; + $orderCartRule['priority'] = (int) $orderCartRule['priority']; + $orderCartRule['partial_use'] = (bool) $orderCartRule['partial_use']; + $orderCartRule['minimum_amount'] = (float) $orderCartRule['minimum_amount']; + $orderCartRule['minimum_amount_tax'] = (bool) $orderCartRule['minimum_amount_tax']; + $orderCartRule['minimum_amount_currency'] = (int) $orderCartRule['minimum_amount_currency']; + $orderCartRule['minimum_amount_shipping'] = (bool) $orderCartRule['minimum_amount_shipping']; + $orderCartRule['country_restriction'] = (bool) $orderCartRule['country_restriction']; + $orderCartRule['carrier_restriction'] = (bool) $orderCartRule['carrier_restriction']; + $orderCartRule['group_restriction'] = (bool) $orderCartRule['group_restriction']; + $orderCartRule['cart_rule_restriction'] = (bool) $orderCartRule['cart_rule_restriction']; + $orderCartRule['product_restriction'] = (bool) $orderCartRule['product_restriction']; + $orderCartRule['shop_restriction'] = (bool) $orderCartRule['shop_restriction']; + $orderCartRule['free_shipping'] = (bool) $orderCartRule['free_shipping']; + $orderCartRule['reduction_percent'] = (float) $orderCartRule['reduction_percent']; + $orderCartRule['reduction_amount'] = (float) $orderCartRule['reduction_amount']; + $orderCartRule['reduction_tax'] = (bool) $orderCartRule['reduction_tax']; + $orderCartRule['reduction_currency'] = (int) $orderCartRule['reduction_currency']; + $orderCartRule['reduction_product'] = (int) $orderCartRule['reduction_product']; + $orderCartRule['reduction_exclude_special'] = (bool) $orderCartRule['reduction_exclude_special']; + $orderCartRule['gift_product'] = (int) $orderCartRule['gift_product']; + $orderCartRule['gift_product_attribute'] = (int) $orderCartRule['gift_product_attribute']; + $orderCartRule['highlight'] = (bool) $orderCartRule['highlight']; + $orderCartRule['active'] = (bool) $orderCartRule['active']; + } + } +} diff --git a/src/Service/ShopContent/OrderDetailsService.php b/src/Service/ShopContent/OrderDetailsService.php new file mode 100644 index 00000000..f1bab8ff --- /dev/null +++ b/src/Service/ShopContent/OrderDetailsService.php @@ -0,0 +1,125 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\OrderDetailRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrderDetailsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var OrderDetailRepository */ + private $orderDetailRepository; + + public function __construct(OrderDetailRepository $orderDetailRepository) + { + $this->orderDetailRepository = $orderDetailRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->orderDetailRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castOrderDetails($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_ORDER_DETAILS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->orderDetailRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castOrderDetails($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_ORDER_DETAILS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->orderDetailRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $orderDetails + * + * @return void + */ + private function castOrderDetails(&$orderDetails) + { + foreach ($orderDetails as &$orderDetail) { + $orderDetail['id_order_detail'] = (int) $orderDetail['id_order_detail']; + $orderDetail['id_order'] = (int) $orderDetail['id_order']; + $orderDetail['product_id'] = (int) $orderDetail['product_id']; + $orderDetail['product_attribute_id'] = (int) $orderDetail['product_attribute_id']; + $orderDetail['product_quantity'] = (int) $orderDetail['product_quantity']; + $orderDetail['unit_price_tax_incl'] = (float) $orderDetail['unit_price_tax_incl']; + $orderDetail['unit_price_tax_excl'] = (float) $orderDetail['unit_price_tax_excl']; + $orderDetail['refund'] = (float) $orderDetail['refund'] > 0 ? -1 * (float) $orderDetail['refund'] : 0; + $orderDetail['refund_tax_excl'] = (float) $orderDetail['refund_tax_excl'] > 0 ? -1 * (float) $orderDetail['refund_tax_excl'] : 0; + $orderDetail['category'] = (int) $orderDetail['category']; + $orderDetail['unique_product_id'] = "{$orderDetail['product_id']}-{$orderDetail['product_attribute_id']}-{$orderDetail['iso_code']}"; + $orderDetail['conversion_rate'] = (float) $orderDetail['conversion_rate']; + } + } +} diff --git a/src/Service/ShopContent/OrderStatusHistoryService.php b/src/Service/ShopContent/OrderStatusHistoryService.php new file mode 100644 index 00000000..32435365 --- /dev/null +++ b/src/Service/ShopContent/OrderStatusHistoryService.php @@ -0,0 +1,125 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\OrderStatusHistoryRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrderStatusHistoryService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var OrderStatusHistoryRepository */ + private $orderStatusHistoryRepository; + + public function __construct(OrderStatusHistoryRepository $orderStatusHistoryRepository) + { + $this->orderStatusHistoryRepository = $orderStatusHistoryRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->orderStatusHistoryRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castOrderStatusHistories($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_ORDER_STATUS_HISTORY, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->orderStatusHistoryRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castOrderStatusHistories($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_ORDER_STATUS_HISTORY, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->orderStatusHistoryRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $orderStatusHistories + * + * @return void + */ + private function castOrderStatusHistories(&$orderStatusHistories) + { + foreach ($orderStatusHistories as &$orderStatusHistory) { + $orderStatusHistory['id_order_state'] = (int) $orderStatusHistory['id_order_state']; + $orderStatusHistory['id_order'] = (int) $orderStatusHistory['id_order']; + $orderStatusHistory['id_order_history'] = (int) $orderStatusHistory['id_order_history']; + $orderStatusHistory['name'] = (string) $orderStatusHistory['name']; + $orderStatusHistory['template'] = (string) $orderStatusHistory['template']; + $orderStatusHistory['is_validated'] = (bool) $orderStatusHistory['is_validated']; + $orderStatusHistory['is_delivered'] = (bool) $orderStatusHistory['is_delivered']; + $orderStatusHistory['is_shipped'] = (bool) $orderStatusHistory['is_shipped']; + $orderStatusHistory['is_paid'] = (bool) $orderStatusHistory['is_paid']; + $orderStatusHistory['is_deleted'] = (bool) $orderStatusHistory['is_deleted']; + $orderStatusHistory['created_at'] = $orderStatusHistory['date_add']; + $orderStatusHistory['updated_at'] = $orderStatusHistory['date_add']; + } + } +} diff --git a/src/Service/ShopContent/OrdersService.php b/src/Service/ShopContent/OrdersService.php new file mode 100644 index 00000000..d4594e92 --- /dev/null +++ b/src/Service/ShopContent/OrdersService.php @@ -0,0 +1,233 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter; +use PrestaShop\Module\PsEventbus\Repository\OrderRepository; +use PrestaShop\Module\PsEventbus\Repository\OrderStatusHistoryRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class OrdersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var OrderRepository */ + private $orderRepository; + + /** @var OrderStatusHistoryRepository */ + private $orderStatusHistoryRepository; + + /** @var ArrayFormatter */ + private $arrayFormatter; + + public function __construct( + OrderRepository $orderRepository, + OrderStatusHistoryRepository $orderStatusHistoryRepository, + ArrayFormatter $arrayFormatter + ) { + $this->orderRepository = $orderRepository; + $this->orderStatusHistoryRepository = $orderStatusHistoryRepository; + $this->arrayFormatter = $arrayFormatter; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->orderRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castOrders($result, $langIso); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_ORDERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->orderRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castOrders($result, $langIso); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_ORDERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->orderRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $orders + * @param string $langIso + * + * @return void + */ + private function castOrders(&$orders, $langIso) + { + foreach ($orders as &$order) { + $order['id_order'] = (int) $order['id_order']; + $order['id_cart'] = (string) $order['id_cart']; + $order['id_customer'] = (int) $order['id_customer']; + $order['current_state'] = (int) $order['current_state']; + $order['conversion_rate'] = (float) $order['conversion_rate']; + $order['total_paid_tax_incl'] = (float) $order['total_paid_tax_incl']; + $order['total_paid_tax_excl'] = (float) $order['total_paid_tax_excl']; + $order['refund'] = (float) $order['refund']; + $order['refund_tax_excl'] = (float) $order['refund_tax_excl']; + $order['new_customer'] = $order['new_customer'] == 1; + $order['is_paid'] = $this->castIsPaidValue($orders, $order, $langIso); + $order['shipping_cost'] = (float) $order['shipping_cost']; + $order['total_paid_tax'] = $order['total_paid_tax_incl'] - $order['total_paid_tax_excl']; + $order['id_carrier'] = (int) $order['id_carrier']; + + $order['id_shop_group'] = (int) $order['id_shop_group']; + $order['id_shop'] = (int) $order['id_shop']; + $order['id_lang'] = (int) $order['id_lang']; + $order['id_currency'] = (int) $order['id_currency']; + $order['recyclable'] = (bool) $order['recyclable']; + $order['gift'] = (bool) $order['gift']; + + $order['total_discounts'] = (int) $order['total_discounts']; + $order['total_discounts_tax_incl'] = (int) $order['total_discounts_tax_incl']; + $order['total_discounts_tax_excl'] = (int) $order['total_discounts_tax_excl']; + $order['total_products'] = (int) $order['total_products']; + $order['total_products_wt'] = (int) $order['total_products_wt']; + $order['total_shipping_tax_incl'] = (int) $order['total_shipping_tax_incl']; + $order['total_shipping_tax_excl'] = (int) $order['total_shipping_tax_excl']; + + $order['carrier_tax_rate'] = (int) $order['carrier_tax_rate']; + $order['total_wrapping'] = (int) $order['total_wrapping']; + $order['total_wrapping_tax_incl'] = (int) $order['total_wrapping_tax_incl']; + $order['total_wrapping_tax_excl'] = (int) $order['total_wrapping_tax_excl']; + $order['round_mode'] = (int) $order['round_mode']; + $order['round_type'] = (int) $order['round_type']; + $order['invoice_number'] = (int) $order['invoice_number']; + $order['delivery_number'] = (int) $order['delivery_number']; + $order['valid'] = (bool) $order['valid']; + + $order['is_shipped'] = (string) $order['is_shipped']; + $order['is_validated'] = (string) $order['is_validated']; + + $this->castAddressIsoCodes($order); + + // remove extra properties + unset($order['address_iso']); + } + } + + /** + * @param array $orders + * @param array $order + * @param string $langIso + * + * @return bool + * + * @@throws \PrestaShopDatabaseException + */ + private function castIsPaidValue($orders, $order, $langIso) + { + $isPaid = $dateAdd = 0; + $orderIds = $this->arrayFormatter->formatValueArray($orders, 'id_order'); + /** @var array $orderStatusHistories */ + $orderStatusHistories = $this->orderStatusHistoryRepository->getOrderStatusHistoriesByOrderIds($orderIds, $langIso); + + foreach ($orderStatusHistories as &$orderStatusHistory) { + if ($order['id_order'] == $orderStatusHistory['id_order'] && $dateAdd < $orderStatusHistory['date_add']) { + $isPaid = (bool) $orderStatusHistory['is_paid']; + $dateAdd = $orderStatusHistory['date_add']; + } + } + + return (bool) $isPaid; + } + + /** + * @param array $orderDetail + * + * @return void + */ + private function castAddressIsoCodes(&$orderDetail) + { + if (!$orderDetail['address_iso']) { + $orderDetail['invoice_country_code'] = null; + $orderDetail['delivery_country_code'] = null; + + return; + } + + $addressAndIsoCodes = explode(',', $orderDetail['address_iso']); + if (count($addressAndIsoCodes) === 1) { + $addressAndIsoCode = explode(':', $addressAndIsoCodes[0]); + $orderDetail['invoice_country_code'] = $addressAndIsoCode[1]; + $orderDetail['delivery_country_code'] = $addressAndIsoCode[1]; + + return; + } + + foreach ($addressAndIsoCodes as $addressAndIsoCodeString) { + $addressAndIsoCode = explode(':', $addressAndIsoCodeString); + if ($addressAndIsoCode[0] === 'delivery') { + $orderDetail['delivery_country_code'] = $addressAndIsoCode[1]; + } elseif ($addressAndIsoCode[0] === 'invoice') { + $orderDetail['invoice_country_code'] = $addressAndIsoCode[1]; + } + } + } +} diff --git a/src/Service/ShopContent/ProductSuppliersService.php b/src/Service/ShopContent/ProductSuppliersService.php new file mode 100644 index 00000000..25931ab1 --- /dev/null +++ b/src/Service/ShopContent/ProductSuppliersService.php @@ -0,0 +1,119 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ProductSupplierRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ProductSuppliersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var ProductSupplierRepository */ + private $productSupplierRepository; + + public function __construct(ProductSupplierRepository $productSupplierRepository) + { + $this->productSupplierRepository = $productSupplierRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->productSupplierRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castProductsSuppliers($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_PRODUCT_SUPPLIERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->productSupplierRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castProductsSuppliers($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_PRODUCT_SUPPLIERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->productSupplierRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $productSuppliers + * + * @return void + */ + private function castProductsSuppliers(&$productSuppliers) + { + foreach ($productSuppliers as &$productSupplier) { + $productSupplier['id_product_supplier'] = (int) $productSupplier['id_product_supplier']; + $productSupplier['id_product'] = (int) $productSupplier['id_product']; + $productSupplier['id_product_attribute'] = (int) $productSupplier['id_product_attribute']; + $productSupplier['id_supplier'] = (int) $productSupplier['id_supplier']; + $productSupplier['product_supplier_price_te'] = (float) $productSupplier['product_supplier_price_te']; + $productSupplier['id_currency'] = (int) $productSupplier['id_currency']; + } + } +} diff --git a/src/Decorator/ProductDecorator.php b/src/Service/ShopContent/ProductsService.php similarity index 52% rename from src/Decorator/ProductDecorator.php rename to src/Service/ShopContent/ProductsService.php index af6f438b..1314fd70 100644 --- a/src/Decorator/ProductDecorator.php +++ b/src/Service/ShopContent/ProductsService.php @@ -1,60 +1,77 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; use PrestaShop\Module\PsEventbus\Config\Config; use PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter; -use PrestaShop\Module\PsEventbus\Repository\BundleRepository; -use PrestaShop\Module\PsEventbus\Repository\CategoryRepository; -use PrestaShop\Module\PsEventbus\Repository\LanguageRepository; use PrestaShop\Module\PsEventbus\Repository\ProductRepository; -class ProductDecorator +if (!defined('_PS_VERSION_')) { + exit; +} + +class ProductsService extends ShopContentAbstractService implements ShopContentServiceInterface { - /** - * @var \Context - */ - private $context; - /** - * @var LanguageRepository - */ - private $languageRepository; - /** - * @var ProductRepository - */ + /** @var ProductRepository */ private $productRepository; - /** - * @var CategoryRepository - */ - private $categoryRepository; - /** - * @var ArrayFormatter - */ + + /** @var LanguagesService */ + private $languagesService; + + /** @var CategoriesService */ + private $categoriesService; + + /** @var ArrayFormatter */ private $arrayFormatter; - /** - * @var BundleRepository - */ - private $bundleRepository; - /** - * @var int - */ + /** @var \Context */ + private $context; + + /** @var int */ private $shopId; public function __construct( - \Context $context, - LanguageRepository $languageRepository, ProductRepository $productRepository, - CategoryRepository $categoryRepository, - ArrayFormatter $arrayFormatter, - BundleRepository $bundleRepository + LanguagesService $languagesService, + CategoriesService $categoriesService, + ArrayFormatter $arrayFormatter ) { - $this->context = $context; - $this->languageRepository = $languageRepository; $this->productRepository = $productRepository; - $this->categoryRepository = $categoryRepository; + $this->languagesService = $languagesService; + $this->categoriesService = $categoriesService; $this->arrayFormatter = $arrayFormatter; - $this->bundleRepository = $bundleRepository; + + $context = \Context::getContext(); + + if ($context == null) { + throw new \PrestaShopException('Context not found'); + } + + $this->context = $context; if ($this->context->shop === null) { throw new \PrestaShopException('No shop context'); @@ -63,19 +80,77 @@ public function __construct( $this->shopId = (int) $this->context->shop->id; } + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->productRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->decorateProducts($result, $langIso); + $this->castProducts($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_PRODUCTS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->productRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->decorateProducts($result, $langIso); + $this->castProducts($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_PRODUCTS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->productRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + /** * @param array $products * @param string $langIso - * @param int $langId * * @return void * * @@throws \PrestaShopDatabaseException */ - public function decorateProducts(&$products, $langIso, $langId) + private function decorateProducts(&$products, $langIso) { - $this->addFeatureValues($products, $langId); - $this->addAttributeValues($products, $langId); + $this->addFeatureValues($products, $langIso); + $this->addAttributeValues($products, $langIso); $this->addImages($products); foreach ($products as &$product) { @@ -86,25 +161,47 @@ public function decorateProducts(&$products, $langIso, $langId) $this->addProductPrices($product); $this->formatDescriptions($product); $this->addCategoryTree($product); - $this->castPropertyValues($product); } } /** * @param array $products * - * @return array + * @return void */ - public function getBundles($products) + private function castProducts(&$products) { - $bundles = []; - foreach ($products as $product) { - if ($product['is_bundle']) { - $bundles = array_merge($bundles, $this->getBundleCollection($product)); + foreach ($products as &$product) { + $product['id_product'] = (int) $product['id_product']; + $product['id_manufacturer'] = (int) $product['id_manufacturer']; + $product['id_supplier'] = (int) $product['id_supplier']; + $product['id_attribute'] = (int) $product['id_attribute']; + $product['id_category_default'] = (int) $product['id_category_default']; + $product['quantity'] = (int) $product['quantity']; + $product['additional_delivery_times'] = (string) $product['additional_delivery_times']; + $product['weight'] = (float) $product['weight']; + $product['active'] = $product['active'] == '1'; + $product['manufacturer'] = (string) $product['manufacturer']; + $product['default_category'] = (string) $product['default_category']; + $product['isbn'] = (string) $product['isbn']; + $product['mpn'] = (string) $product['mpn']; + $product['ean'] = (string) $product['ean']; + $product['upc'] = (string) $product['upc']; + $product['is_default_attribute'] = $product['id_attribute'] === 0 ? true : $product['is_default_attribute'] == 1; + $product['available_for_order'] = $product['available_for_order'] == '1'; + $product['available_date'] = (string) $product['available_date']; + $product['is_bundle'] = $product['is_bundle'] == '1'; + $product['is_virtual'] = $product['is_virtual'] == '1'; + + if ($product['unit_price_ratio'] == 0) { + unset($product['unit_price_ratio']); + unset($product['unity']); + } else { + $product['unit_price_ratio'] = (float) $product['unit_price_ratio']; + $product['unity'] = (string) $product['unity']; + $product['price_per_unit'] = (float) ($product['price_tax_excl'] / $product['unit_price_ratio']); } } - - return $bundles; } /** @@ -114,17 +211,17 @@ public function getBundles($products) */ private function addLink(&$product) { - try { - if ($this->context->link === null) { - throw new \PrestaShopException('No link context'); - } + if ($this->context->link === null) { + throw new \PrestaShopException('No link context'); + } + try { $product['link'] = $this->context->link->getProductLink( $product, null, null, null, - $this->languageRepository->getLanguageIdByIsoCode($product['iso_code']), + $this->languagesService->getLanguageIdByIsoCode($product['iso_code']), $this->shopId, $product['id_attribute'] ); @@ -142,41 +239,16 @@ private function addProductPrices(&$product) { $product['price_tax_excl'] = (float) $product['price_tax_excl']; $product['price_tax_incl'] = - (float) $this->productRepository->getPriceTaxIncluded($product['id_product'], $product['id_attribute']); + (float) \Product::getPriceStatic($product['id_product'], true, $product['id_attribute'], 6, null, false, false); $product['sale_price_tax_excl'] = - (float) $this->productRepository->getSalePriceTaxExcluded($product['id_product'], $product['id_attribute']); + (float) \Product::getPriceStatic($product['id_product'], false, $product['id_attribute'], 6); $product['sale_price_tax_incl'] = - (float) $this->productRepository->getSalePriceTaxIncluded($product['id_product'], $product['id_attribute']); + (float) \Product::getPriceStatic($product['id_product'], true, $product['id_attribute'], 6); $product['tax'] = $product['price_tax_incl'] - $product['price_tax_excl']; $product['sale_tax'] = $product['sale_price_tax_incl'] - $product['sale_price_tax_excl']; } - /** - * @param array $product - * - * @return array - */ - private function getBundleCollection($product) - { - $bundleProducts = $this->bundleRepository->getBundleProducts($product['id_product']); - $uniqueProductId = $product['unique_product_id']; - - return array_map(function ($bundleProduct) use ($uniqueProductId) { - return [ - 'id' => $bundleProduct['id_bundle'], - 'collection' => Config::COLLECTION_BUNDLES, - 'properties' => [ - 'id_bundle' => $bundleProduct['id_bundle'], - 'id_product' => $bundleProduct['id_product'], - 'id_product_attribute' => $bundleProduct['id_product_attribute'], - 'unique_product_id' => $uniqueProductId, - 'quantity' => $bundleProduct['quantity'], - ], - ]; - }, $bundleProducts); - } - /** * @param array $product * @@ -195,9 +267,9 @@ private function formatDescriptions(&$product) */ private function addCategoryTree(&$product) { - $categoryPaths = $this->categoryRepository->getCategoryPaths( + $categoryPaths = $this->categoriesService->getCategoryPaths( $product['id_category_default'], - $this->languageRepository->getLanguageIdByIsoCode($product['iso_code']), + $this->languagesService->getLanguageIdByIsoCode($product['iso_code']), $this->shopId ); @@ -205,39 +277,6 @@ private function addCategoryTree(&$product) $product['category_id_path'] = $categoryPaths['category_id_path']; } - /** - * @param array $product - * - * @return void - */ - private function castPropertyValues(&$product) - { - $product['id_product'] = (int) $product['id_product']; - $product['id_manufacturer'] = (int) $product['id_manufacturer']; - $product['id_supplier'] = (int) $product['id_supplier']; - $product['id_attribute'] = (int) $product['id_attribute']; - $product['id_category_default'] = (int) $product['id_category_default']; - $product['quantity'] = (int) $product['quantity']; - $product['weight'] = (float) $product['weight']; - $product['active'] = $product['active'] == '1'; - $product['manufacturer'] = (string) $product['manufacturer']; - $product['default_category'] = (string) $product['default_category']; - $product['isbn'] = isset($product['isbn']) ? (string) $product['isbn'] : ''; - $product['mpn'] = isset($product['mpn']) ? (string) $product['mpn'] : ''; - $product['ean'] = (string) $product['ean']; - $product['upc'] = (string) $product['upc']; - $product['is_default_attribute'] = $product['id_attribute'] === 0 ? true : $product['is_default_attribute'] == 1; - $product['available_for_order'] = $product['available_for_order'] == '1'; - $product['available_date'] = (string) $product['available_date']; - $product['is_bundle'] = $product['is_bundle'] == '1'; - $product['is_virtual'] = $product['is_virtual'] == '1'; - $product['unit_price_ratio'] = (float) $product['unit_price_ratio']; - $product['unity'] = (string) $product['unity']; - if ($product['unit_price_ratio'] != 0) { - $product['price_per_unit'] = (float) $product['price_tax_excl'] / (float) $product['unit_price_ratio']; - } - } - /** * @param array $product * @@ -271,16 +310,16 @@ private function addLanguageIsoCode(&$product, $langiso) /** * @param array $products - * @param int $langId + * @param string $langIso * * @return void * * @@throws \PrestaShopDatabaseException */ - private function addFeatureValues(&$products, $langId) + private function addFeatureValues(&$products, $langIso) { $productIds = $this->arrayFormatter->formatValueArray($products, 'id_product', true); - $features = $this->productRepository->getProductFeatures($productIds, $langId); + $features = $this->productRepository->getProductFeatures($productIds, $langIso); foreach ($products as &$product) { $product['features'] = isset($features[$product['id_product']]) ? $features[$product['id_product']] : ''; @@ -289,16 +328,16 @@ private function addFeatureValues(&$products, $langId) /** * @param array $products - * @param int $langId + * @param string $langIso * * @return void * * @@throws \PrestaShopDatabaseException */ - private function addAttributeValues(&$products, $langId) + private function addAttributeValues(&$products, $langIso) { $attributeIds = $this->arrayFormatter->formatValueArray($products, 'id_attribute', true); - $attributes = $this->productRepository->getProductAttributeValues($attributeIds, $langId); + $attributes = $this->productRepository->getProductAttributeValues($attributeIds, $langIso); foreach ($products as &$product) { $product['attributes'] = isset($attributes[$product['id_attribute']]) ? $attributes[$product['id_attribute']] : ''; @@ -361,18 +400,17 @@ private function addImages(&$products) $link = $this->context->link; - // For some stores, we might implement a behavior that dynamically adapts, - // retrieving the appropriate label from an image table to accurately reflect - // the merchant's available items. + /* + * Ici pour certaines boutique on aurait un comportement qui pourrait être adapté. + * et aller chercher dans la table des images le bon libellé pour appeler ce que le marchand possède. + */ $product['images'] = $this->arrayFormatter->arrayToString( array_map(function ($imageId) use ($product, $link) { return $link->getImageLink($product['link_rewrite'], (string) $imageId); }, $productImageIds) ); - $product['cover'] = $coverImageId == '0' ? - '' : - $link->getImageLink($product['link_rewrite'], (string) $coverImageId); + $product['cover'] = $coverImageId == '0' ? '' : $link->getImageLink($product['link_rewrite'], (string) $coverImageId); } } } diff --git a/src/Service/ShopContent/ShopContentAbstractService.php b/src/Service/ShopContent/ShopContentAbstractService.php new file mode 100644 index 00000000..7e427975 --- /dev/null +++ b/src/Service/ShopContent/ShopContentAbstractService.php @@ -0,0 +1,68 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; + +if (!defined('_PS_VERSION_')) { + exit; +} + +abstract class ShopContentAbstractService +{ + /** + * @param string $collection + * @param array $upsertedContents + * @param array $deletedList + * + * @return array + */ + protected function formatIncrementalSyncResponse($collection, $upsertedContents, $deletedList) + { + $data = []; + + foreach ($upsertedContents as $upsertedContent) { + $data[] = [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => $collection, + 'properties' => $upsertedContent, + ]; + } + + foreach ($deletedList as $item) { + $data[] = [ + 'action' => Config::INCREMENTAL_TYPE_DELETE, + 'collection' => $collection, + 'properties' => [ + 'id' => $item['id'], + ], + ]; + } + + return $data; + } +} diff --git a/src/Service/ShopContent/ShopContentServiceInterface.php b/src/Service/ShopContent/ShopContentServiceInterface.php new file mode 100644 index 00000000..41bbc3fb --- /dev/null +++ b/src/Service/ShopContent/ShopContentServiceInterface.php @@ -0,0 +1,62 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +if (!defined('_PS_VERSION_')) { + exit; +} + +interface ShopContentServiceInterface +{ + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso); + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso); + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso); +} diff --git a/src/Service/ShopContent/ShopsService.php b/src/Service/ShopContent/ShopsService.php new file mode 100644 index 00000000..8a574151 --- /dev/null +++ b/src/Service/ShopContent/ShopsService.php @@ -0,0 +1,150 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ShopRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ShopsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var CurrenciesService */ + private $currenciesService; + + /** @var LanguagesService */ + private $languagesService; + + /** @var \Context */ + private $context; + + /** @var ShopRepository */ + private $shopRepository; + + /** + * @param \Context $context + * @param ShopRepository $shopRepository + * @param LanguagesService $languagesService + * @param CurrenciesService $currenciesService + * + * @return void + */ + public function __construct( + \Context $context, + ShopRepository $shopRepository, + LanguagesService $languagesService, + CurrenciesService $currenciesService + ) { + $this->currenciesService = $currenciesService; + $this->languagesService = $languagesService; + $this->shopRepository = $shopRepository; + $this->context = $context; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $langId = !empty($langIso) ? (int) \Language::getIdByIso($langIso) : null; + + /* This file is created on installation and never modified. + As php doesn't allow to retrieve the creation date of a file or folder, + we use the modification date of this file to get the installation date of the shop */ + $filename = './img/admin/enabled.gif'; + $folderCreatedAt = null; + if (file_exists($filename)) { + $folderCreatedAt = date('Y-m-d H:i:s', (int) filectime($filename)); + } + + if ($this->context->link === null) { + throw new \PrestaShopException('No link context'); + } + + return [ + [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_SHOPS, + 'properties' => [ + 'created_at' => $this->shopRepository->getCreatedAt(), + 'folder_created_at' => $folderCreatedAt, + 'cms_version' => _PS_VERSION_, + 'url_is_simplified' => \Configuration::get('PS_REWRITING_SETTINGS') == '1', + 'cart_is_persistent' => \Configuration::get('PS_CART_FOLLOWING') == '1', + 'default_language' => $this->languagesService->getDefaultLanguageIsoCode(), + 'languages' => implode(';', $this->languagesService->getLanguagesIsoCodes()), + 'default_currency' => $this->currenciesService->getDefaultCurrencyIsoCode(), + 'currencies' => implode(';', $this->currenciesService->getCurrenciesIsoCodes()), + 'weight_unit' => \Configuration::get('PS_WEIGHT_UNIT'), + 'distance_unit' => \Configuration::get('PS_BASE_DISTANCE_UNIT'), + 'volume_unit' => \Configuration::get('PS_VOLUME_UNIT'), + 'dimension_unit' => \Configuration::get('PS_DIMENSION_UNIT'), + 'timezone' => \Configuration::get('PS_TIMEZONE'), + 'is_order_return_enabled' => \Configuration::get('PS_ORDER_RETURN') == '1', + 'order_return_nb_days' => (int) \Configuration::get('PS_ORDER_RETURN_NB_DAYS'), + 'php_version' => phpversion(), + 'http_server' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '', + 'url' => $this->context->link->getPageLink('index', null, $langId), + 'ssl' => \Configuration::get('PS_SSL_ENABLED') == '1', + 'multi_shop_count' => $this->shopRepository->getMultiShopCount(), + 'country_code' => $this->shopRepository->getShopCountryCode(), + ], + ], + ]; + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + return []; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return 0; + } +} diff --git a/src/Service/ShopContent/SpecificPricesService.php b/src/Service/ShopContent/SpecificPricesService.php new file mode 100644 index 00000000..eb080900 --- /dev/null +++ b/src/Service/ShopContent/SpecificPricesService.php @@ -0,0 +1,525 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\ProductRepository; +use PrestaShop\Module\PsEventbus\Repository\SpecificPriceRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class SpecificPricesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var SpecificPriceRepository */ + private $specificPriceRepository; + + /** @var ProductRepository */ + private $productRepository; + + public function __construct( + SpecificPriceRepository $specificPriceRepository, + ProductRepository $productRepository + ) { + $this->specificPriceRepository = $specificPriceRepository; + $this->productRepository = $productRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->specificPriceRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castCustomPrices($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_SPECIFIC_PRICES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->specificPriceRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castCustomPrices($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_SPECIFIC_PRICES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->specificPriceRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $customPrices + * + * @return void + */ + private function castCustomPrices(&$customPrices) + { + foreach ($customPrices as &$customPrice) { + $context = \Context::getContext(); + + if ($context == null) { + throw new \PrestaShopException('Context not found'); + } + + if ($context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + $context->country = new \Country($customPrice['id_country']); + $context->currency = new \Currency($customPrice['id_currency']); + + $customPrice['price_tax_included'] = $this->getPriceStatic( + $customPrice['id_product'], + $customPrice['id_product_attribute'], + $customPrice['id_specific_price'], + true, + false, + $context + ); + + $customPrice['price_tax_excluded'] = $this->getPriceStatic( + $customPrice['id_product'], + $customPrice['id_product_attribute'], + $customPrice['id_specific_price'], + false, + false, + $context + ); + $customPrice['sale_price_tax_incl'] = $this->getPriceStatic( + $customPrice['id_product'], + $customPrice['id_product_attribute'], + $customPrice['id_specific_price'], + true, + true, + $context + ); + $customPrice['sale_price_tax_excl'] = $this->getPriceStatic( + $customPrice['id_product'], + $customPrice['id_product_attribute'], + $customPrice['id_specific_price'], + false, + true, + $context + ); + + if ($customPrice['id_shop']) { + $customPrice['id_shop'] = $context->shop->id; + } + + $customPrice['id_specific_price'] = (int) $customPrice['id_specific_price']; + $customPrice['id_product'] = (int) $customPrice['id_product']; + $customPrice['id_shop'] = (int) $customPrice['id_shop']; + $customPrice['id_group'] = (int) $customPrice['id_group']; + $customPrice['id_shop_group'] = (int) $customPrice['id_shop_group']; + $customPrice['id_product_attribute'] = (int) $customPrice['id_product_attribute']; + $customPrice['price'] = (float) $customPrice['price']; + $customPrice['from_quantity'] = (int) $customPrice['from_quantity']; + $customPrice['reduction'] = (float) $customPrice['reduction']; + $customPrice['reduction_tax'] = (int) $customPrice['reduction_tax']; + $customPrice['id_currency'] = (int) $customPrice['id_currency']; + $customPrice['id_country'] = (int) $customPrice['id_country']; + $customPrice['id_customer'] = (int) $customPrice['id_customer']; + $customPrice['currency'] = isset($customPrice['currency']) ? $customPrice['currency'] : 'ALL'; + $customPrice['country'] = isset($customPrice['country']) ? $customPrice['country'] : 'ALL'; + $customPrice['price_tax_included'] = (float) $customPrice['price_tax_included']; + $customPrice['price_tax_excluded'] = (float) $customPrice['price_tax_excluded']; + $customPrice['sale_price_tax_incl'] = (float) $customPrice['sale_price_tax_incl']; + $customPrice['sale_price_tax_excl'] = (float) $customPrice['sale_price_tax_excl']; + + if ($customPrice['reduction_type'] === 'percentage') { + $customPrice['discount_percentage'] = $customPrice['reduction'] * 100; + $customPrice['discount_value_tax_incl'] = 0.0; + $customPrice['discount_value_tax_excl'] = 0.0; + } else { + $customPrice['discount_percentage'] = 0; + $customPrice['discount_value_tax_incl'] = $customPrice['price_tax_included'] - $customPrice['sale_price_tax_incl']; + $customPrice['discount_value_tax_excl'] = $customPrice['price_tax_excluded'] - $customPrice['sale_price_tax_excl']; + } + } + } + + /** + * @param int $idProduct + * @param int $idProductAttribute + * @param int $specificPriceId + * @param bool $usetax + * @param bool $usereduc + * @param \Context|null $context + * + * @return float|int|void + * + * @@throws \PrestaShopException + */ + private function getPriceStatic( + $idProduct, + $idProductAttribute, + $specificPriceId, + $usetax = true, + $usereduc = true, + $context = null + ) { + if (!$context) { + /** @var \Context $context */ + $context = \Context::getContext(); + } + + \Tools::displayParameterAsDeprecated('divisor'); + + if (!\Validate::isBool($usetax) || !\Validate::isUnsignedId($idProduct)) { + exit(\Tools::displayError()); + } + + // Initializations + $idGroup = (int) \Group::getCurrent()->id; + + /** @var \Currency $currency */ + $currency = $context->currency; + $idCurrency = \Validate::isLoadedObject($currency) ? (int) $currency->id : (int) \Configuration::get('PS_CURRENCY_DEFAULT'); + + $currentCart = $context->cart; + $idAddress = null; + + if ($currentCart != null && \Validate::isLoadedObject($currentCart)) { + $idAddress = $currentCart->{\Configuration::get('PS_TAX_ADDRESS_TYPE')}; + } + + // retrieve address informations + $address = \Address::initialize($idAddress, true); + $idCountry = (int) $address->id_country; + $idState = (int) $address->id_state; + $zipcode = $address->postcode; + + if (\Tax::excludeTaxeOption()) { + $usetax = false; + } + + if ( + $usetax + && !empty($address->vat_number) + && $address->id_country != \Configuration::get('VATNUMBER_COUNTRY') + && \Configuration::get('VATNUMBER_MANAGEMENT') + ) { + $usetax = false; + } + + if ($context->shop == null) { + throw new \PrestaShopException('No shop context'); + } + + $shopId = (int) $context->shop->id; + + return $this->priceCalculation( + $shopId, + $idProduct, + $idProductAttribute, + $specificPriceId, + $idCountry, + $idState, + $zipcode, + $idCurrency, + $idGroup, + $usetax, + 6, + false, + $usereduc, + $specificPriceOutput, + true + ); + } + + /** + * @param int $idShop + * @param int $idProduct + * @param int $idProductAttribute + * @param int $specificPriceId + * @param int $idCountry + * @param int $idState + * @param string $zipcode + * @param int $idCurrency + * @param int $idGroup + * @param bool $useTax + * @param int $decimals + * @param bool $onlyReduc + * @param bool $useReduc + * @param array $specificPrice + * @param bool $useGroupReduction + * @param int $idCustomization + * + * @return float|int|void + * + * @@throws \PrestaShopDatabaseException + */ + private function priceCalculation( + $idShop, + $idProduct, + $idProductAttribute, + $specificPriceId, + $idCountry, + $idState, + $zipcode, + $idCurrency, + $idGroup, + $useTax, + $decimals, + $onlyReduc, + $useReduc, + &$specificPrice, + $useGroupReduction, + $idCustomization = 0 + ) { + static $address = null; + static $context = null; + + /** @var array */ + static $pricesLevel2; + + if ($context == null) { + /** @var \Context $context */ + $context = \Context::getContext(); + $context = $context->cloneContext(); + } + + if ($address === null) { + if (is_object($context->cart) && $context->cart->{\Configuration::get('PS_TAX_ADDRESS_TYPE')} != null) { + $idAddress = $context->cart->{\Configuration::get('PS_TAX_ADDRESS_TYPE')}; + $address = new \Address($idAddress); + } else { + $address = new \Address(); + } + } + + if ($idShop && $context->shop->id != (int) $idShop) { + $context->shop = new \Shop((int) $idShop); + } + + if ($idProductAttribute == null) { + $idProductAttribute = \Product::getDefaultAttribute($idProduct); + } + + $specificPrice = $this->getSpecificPrice($specificPriceId); + + // fetch price & attribute price + $cacheId2 = $idProduct . '-' . $idShop . '-' . $specificPriceId; + if (!isset($pricesLevel2[$cacheId2])) { + $result = $this->productRepository->getProductPriceAndDeclinations($idProduct); + + if ($result) { + foreach ($result as $row) { + $array_tmp = [ + 'price' => $row['price'], + 'ecotax' => $row['ecotax'], + 'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null), + ]; + $pricesLevel2[$cacheId2][(int) $row['id_product_attribute']] = $array_tmp; + + if (isset($row['default_on']) && $row['default_on'] == 1) { + $pricesLevel2[$cacheId2][0] = $array_tmp; + } + } + } + } + + if (!isset($pricesLevel2[$cacheId2][(int) $idProductAttribute])) { + return; + } + + $result = $pricesLevel2[$cacheId2][(int) $idProductAttribute]; + + if (!$specificPrice || $specificPrice['price'] < 0) { + $price = (float) $result['price']; + } else { + $price = (float) $specificPrice['price']; + } + // convert only if the specific price is in the default currency (id_currency = 0) + if (!$specificPrice || !($specificPrice['price'] >= 0 && $specificPrice['id_currency'])) { + $price = \Tools::convertPrice($price, $idCurrency); + + if (isset($specificPrice['price']) && $specificPrice['price'] >= 0) { + $specificPrice['price'] = $price; + } + } + + // Attribute price + if (is_array($result) && (!$specificPrice || !$specificPrice['id_product_attribute'] || $specificPrice['price'] < 0)) { + $attributePrice = \Tools::convertPrice($result['attribute_price'] !== null ? (float) $result['attribute_price'] : 0, $idCurrency); + // If you want the default combination, please use NULL value instead + if ($idProductAttribute) { + $price += $attributePrice; + } + } + + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.0.0', '>=') && (int) $idCustomization) { + /* @phpstan-ignore-next-line */ + $price += \Tools::convertPrice(\Customization::getCustomizationPrice($idCustomization), $idCurrency); + } + + // Tax + $address->id_country = $idCountry; + $address->id_state = $idState; + $address->postcode = $zipcode; + + $tax_manager = \TaxManagerFactory::getManager($address, \Product::getIdTaxRulesGroupByIdProduct((int) $idProduct, $context)); + $productTaxCalculator = $tax_manager->getTaxCalculator(); + + // Add Tax + if ($useTax) { + $price = $productTaxCalculator->addTaxes((float) $price); + } + + // Eco Tax + if ($result['ecotax'] || isset($result['attribute_ecotax'])) { + $ecotax = $result['ecotax']; + if (isset($result['attribute_ecotax']) && $result['attribute_ecotax'] > 0) { + $ecotax = $result['attribute_ecotax']; + } + + if ($idCurrency) { + $ecotax = \Tools::convertPrice($ecotax, $idCurrency); + } + if ($useTax) { + static $psEcotaxTaxRulesGroupId = null; + if ($psEcotaxTaxRulesGroupId === null) { + $psEcotaxTaxRulesGroupId = (int) \Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID'); + } + // reinit the tax manager for ecotax handling + $tax_manager = \TaxManagerFactory::getManager( + $address, + $psEcotaxTaxRulesGroupId + ); + $ecotaxTaxCalculator = $tax_manager->getTaxCalculator(); + $price += $ecotaxTaxCalculator->addTaxes($ecotax); + } else { + $price += $ecotax; + } + } + + // Reduction + $specificPriceReduction = 0; + if (($onlyReduc || $useReduc) && $specificPrice) { + if ($specificPrice['reduction_type'] == 'amount') { + $reductionAmount = $specificPrice['reduction']; + + if (!$specificPrice['id_currency']) { + $reductionAmount = \Tools::convertPrice($reductionAmount, $idCurrency); + } + + $specificPriceReduction = $reductionAmount; + + // Adjust taxes if required + + if (!$useTax && $specificPrice['reduction_tax']) { + $specificPriceReduction = $productTaxCalculator->removeTaxes($specificPriceReduction); + } + if ($useTax && !$specificPrice['reduction_tax']) { + $specificPriceReduction = $productTaxCalculator->addTaxes($specificPriceReduction); + } + } else { + $specificPriceReduction = $price * $specificPrice['reduction']; + } + } + + if ($useReduc) { + $price -= $specificPriceReduction; + } + + // Group reduction + if ($useGroupReduction) { + $reductionFromCategory = \GroupReduction::getValueForProduct($idProduct, $idGroup); + if ($reductionFromCategory) { + $groupReduction = $price * (float) $reductionFromCategory; + } else { // apply group reduction if there is no group reduction for this category + $groupReduction = (($reduc = \Group::getReductionByIdGroup($idGroup)) != 0) ? ($price * $reduc / 100) : 0; + } + + $price -= $groupReduction; + } + + if ($onlyReduc) { + return \Tools::ps_round($specificPriceReduction, $decimals); + } + + $price = \Tools::ps_round((float) $price, $decimals); + + if ($price < 0) { + $price = 0; + } + + return $price; + } + + /** + * Returns the specificPrice information related to a given productId and context. + * + * @param int $specificPriceId + * + * @return array + */ + private function getSpecificPrice($specificPriceId) + { + if (!\SpecificPrice::isFeatureActive()) { + return []; + } + + return $this->specificPriceRepository->getSpecificPriceById($specificPriceId)[0]; + } +} diff --git a/src/Service/ShopContent/StockMovementsService.php b/src/Service/ShopContent/StockMovementsService.php new file mode 100644 index 00000000..7d748e4d --- /dev/null +++ b/src/Service/ShopContent/StockMovementsService.php @@ -0,0 +1,131 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\StockMovementRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class StockMovementsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var StockMovementRepository */ + private $stockMovementRepository; + + public function __construct(StockMovementRepository $stockMovementRepository) + { + $this->stockMovementRepository = $stockMovementRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->stockMovementRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castStockMovements($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_STOCK_MOVEMENTS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->stockMovementRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castStockMovements($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_STOCK_MOVEMENTS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->stockMovementRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $stockMovements + * + * @return void + */ + private function castStockMovements(&$stockMovements) + { + foreach ($stockMovements as &$stockMovement) { + $date = $stockMovement['date_add']; + + $stockMovement['id_stock_mvt'] = (int) $stockMovement['id_stock_mvt']; + $stockMovement['id_stock'] = (int) $stockMovement['id_stock']; + $stockMovement['id_order'] = (int) $stockMovement['id_order']; + $stockMovement['id_supply_order'] = (int) $stockMovement['id_supply_order']; + $stockMovement['id_stock_mvt_reason'] = (int) $stockMovement['id_stock_mvt_reason']; + $stockMovement['id_lang'] = (int) $stockMovement['id_lang']; + $stockMovement['id_employee'] = (int) $stockMovement['id_employee']; + $stockMovement['physical_quantity'] = (int) $stockMovement['physical_quantity']; + $stockMovement['date_add'] = $date; + $stockMovement['sign'] = (int) $stockMovement['sign']; + $stockMovement['price_te'] = (float) $stockMovement['price_te']; + $stockMovement['last_wa'] = (float) $stockMovement['last_wa']; + $stockMovement['current_wa'] = (float) $stockMovement['current_wa']; + $stockMovement['referer'] = (int) $stockMovement['referer']; + $stockMovement['deleted'] = (bool) $stockMovement['deleted']; + $stockMovement['created_at'] = $date; + } + } +} diff --git a/src/Service/ShopContent/StocksService.php b/src/Service/ShopContent/StocksService.php new file mode 100644 index 00000000..12d20f2e --- /dev/null +++ b/src/Service/ShopContent/StocksService.php @@ -0,0 +1,128 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\StockRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class StocksService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var StockRepository */ + private $stockRepository; + + public function __construct(StockRepository $stockRepository) + { + $this->stockRepository = $stockRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->stockRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castStocks($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_STOCKS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->stockRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castStocks($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_STOCKS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->stockRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $stocks + * + * @return void + */ + private function castStocks(&$stocks) + { + foreach ($stocks as &$stock) { + $stock['id_stock_available'] = (int) $stock['id_stock_available']; + $stock['id_product'] = (int) $stock['id_product']; + $stock['id_product_attribute'] = (int) $stock['id_product_attribute']; + $stock['id_shop'] = (int) $stock['id_shop']; + $stock['id_shop_group'] = (int) $stock['id_shop_group']; + $stock['quantity'] = (int) $stock['quantity']; + + $stock['depends_on_stock'] = (bool) $stock['depends_on_stock']; + $stock['out_of_stock'] = (bool) $stock['out_of_stock']; + + // https://github.com/PrestaShop/PrestaShop/commit/2a3269ad93b1985f2615d6604458061d4989f0ea#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2186 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.2.0', '>=')) { + $stock['physical_quantity'] = (int) $stock['physical_quantity']; + $stock['reserved_quantity'] = (int) $stock['reserved_quantity']; + } + } + } +} diff --git a/src/Service/ShopContent/StoresService.php b/src/Service/ShopContent/StoresService.php new file mode 100644 index 00000000..ace871fd --- /dev/null +++ b/src/Service/ShopContent/StoresService.php @@ -0,0 +1,125 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\StoreRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class StoresService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var StoreRepository */ + private $storeRepository; + + public function __construct(StoreRepository $storeRepository) + { + $this->storeRepository = $storeRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->storeRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castStores($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_STORES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->storeRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castStores($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_STORES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->storeRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $stores + * + * @return void + */ + private function castStores(&$stores) + { + foreach ($stores as &$store) { + $store['id_store'] = (int) $store['id_store']; + $store['id_country'] = (int) $store['id_country']; + $store['id_state'] = (int) $store['id_state']; + $store['active'] = (bool) $store['active']; + $store['created_at'] = (string) $store['created_at']; + $store['updated_at'] = (string) $store['updated_at']; + + // https://github.com/PrestaShop/PrestaShop/commit/7dda2be62d8bd606edc269fa051c36ea68f81682#diff-e98d435095567c145b49744715fd575eaab7050328c211b33aa9a37158421ff4R2004 + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.3.0', '>=')) { + $store['id_lang'] = (int) $store['id_lang']; + $store['id_shop'] = (int) $store['id_shop']; + } + } + } +} diff --git a/src/Service/ShopContent/SuppliersService.php b/src/Service/ShopContent/SuppliersService.php new file mode 100644 index 00000000..50289157 --- /dev/null +++ b/src/Service/ShopContent/SuppliersService.php @@ -0,0 +1,119 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\SupplierRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class SuppliersService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var SupplierRepository */ + private $supplierRepository; + + public function __construct(SupplierRepository $supplierRepository) + { + $this->supplierRepository = $supplierRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->supplierRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castSuppliers($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_SUPPLIERS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->supplierRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castSuppliers($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_SUPPLIERS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->supplierRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $suppliers + * + * @return void + */ + private function castSuppliers(&$suppliers) + { + foreach ($suppliers as &$supplier) { + $supplier['id_supplier'] = (int) $supplier['id_supplier']; + $supplier['active'] = (bool) $supplier['active']; + $supplier['id_lang'] = (int) $supplier['id_lang']; + $supplier['id_shop'] = (int) $supplier['id_shop']; + $supplier['created_at'] = (string) $supplier['created_at']; + $supplier['updated_at'] = (string) $supplier['updated_at']; + } + } +} diff --git a/src/Service/ShopContent/TaxonomiesService.php b/src/Service/ShopContent/TaxonomiesService.php new file mode 100644 index 00000000..01f10a1a --- /dev/null +++ b/src/Service/ShopContent/TaxonomiesService.php @@ -0,0 +1,114 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\TaxonomyRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class TaxonomiesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var TaxonomyRepository */ + private $taxonomyRepository; + + public function __construct(TaxonomyRepository $taxonomyRepository) + { + $this->taxonomyRepository = $taxonomyRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->taxonomyRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castTaxonomies($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_TAXONOMIES, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->taxonomyRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castTaxonomies($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_TAXONOMIES, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->taxonomyRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $taxonomies + * + * @return void + */ + private function castTaxonomies(&$taxonomies) + { + foreach ($taxonomies as &$taxonomy) { + $googleTaxonomy['taxonomy_id'] = "{$taxonomy['id_category']}-{$taxonomy['id_category']}"; + } + } +} diff --git a/src/Service/ShopContent/ThemesService.php b/src/Service/ShopContent/ThemesService.php new file mode 100644 index 00000000..13b225d9 --- /dev/null +++ b/src/Service/ShopContent/ThemesService.php @@ -0,0 +1,179 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\PrestaShop\Core\Addon\Theme\ThemeManagerBuilder; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class ThemesService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var \Context */ + private $context; + + public function __construct(\Context $context) + { + $this->context = $context; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->getAllThemes(); + + if (empty($result)) { + return []; + } + + $themes = $this->formatThemes($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_THEMES, + 'properties' => $item, + ]; + }, $themes); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->getAllThemes(); + + $themes = []; + + if (!empty($result)) { + $themes = $this->formatThemes($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_THEMES, $themes, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return 0; + } + + /** + * Get all Themes + * + * @return mixed + * + * @throws \PrestaShopException + */ + private function getAllThemes() + { + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { + if ($this->context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + $themeRepository = (new ThemeManagerBuilder($this->context, \Db::getInstance()))->buildRepository($this->context->shop); + + return $themeRepository->getList(); + } else { + /* @phpstan-ignore-next-line */ + return \Theme::getAvailable(false); + } + } + + /** + * @param array $themes + * + * @return array + * + * @throws \PrestaShopException + */ + private function formatThemes($themes) + { + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { + if ($this->context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + $currentTheme = $this->context->shop->theme; + + return array_map(function ($key, $theme) use ($currentTheme) { + return [ + 'theme_id' => md5((string) $key), + 'name' => (string) $theme->getName(), + 'theme_version' => (string) $theme->get('version'), + 'active' => $theme->getName() == $currentTheme->getName(), + ]; + }, array_keys($themes), $themes); + } else { + return array_map(function ($theme) { + /* @phpstan-ignore-next-line */ + $themeObj = \Theme::getByDirectory($theme); + + /* @phpstan-ignore-next-line */ + if ($themeObj instanceof \Theme) { + /* @phpstan-ignore-next-line */ + $themeInfo = \Theme::getThemeInfo($themeObj->id); + + return [ + 'theme_id' => md5($theme), + 'name' => isset($themeInfo['theme_name']) ? $themeInfo['theme_name'] : '', + 'theme_version' => isset($themeInfo['theme_version']) ? $themeInfo['theme_version'] : '', + 'active' => isset($themeInfo['theme_version']) ? false : (string) $this->context->theme->id == (string) $themeInfo['theme_id'], + ]; + } else { + return [ + 'theme_id' => md5($theme), + 'name' => $theme, + 'theme_version' => '', + 'active' => false, + ]; + } + }, $themes); + } + } +} diff --git a/src/Service/ShopContent/TranslationsService.php b/src/Service/ShopContent/TranslationsService.php new file mode 100644 index 00000000..39bdbf41 --- /dev/null +++ b/src/Service/ShopContent/TranslationsService.php @@ -0,0 +1,119 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\TranslationRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class TranslationsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var TranslationRepository */ + private $translationRepository; + + public function __construct(TranslationRepository $translationRepository) + { + $this->translationRepository = $translationRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->translationRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castTranslations($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_TRANSLATIONS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->translationRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castTranslations($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_TRANSLATIONS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->translationRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $translations + * + * @return void + */ + private function castTranslations(&$translations) + { + foreach ($translations as &$translation) { + $translation['id_translation'] = (int) $translation['id_translation']; + $translation['id_lang'] = (int) $translation['id_lang']; + $translation['key'] = (string) $translation['key']; + $translation['translation'] = (string) $translation['translation']; + $translation['domain'] = (string) $translation['domain']; + $translation['theme'] = (string) $translation['theme']; + } + } +} diff --git a/src/Service/ShopContent/WishlistProductsService.php b/src/Service/ShopContent/WishlistProductsService.php new file mode 100644 index 00000000..2e5d6ea5 --- /dev/null +++ b/src/Service/ShopContent/WishlistProductsService.php @@ -0,0 +1,119 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\WishlistProductRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class WishlistProductsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var WishlistProductRepository */ + private $wishlistProductRepository; + + public function __construct(WishlistProductRepository $wishlistProductRepository) + { + $this->wishlistProductRepository = $wishlistProductRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->wishlistProductRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castWishlistProducts($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_WISHLIST_PRODUCTS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->wishlistProductRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castWishlistProducts($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_WISHLIST_PRODUCTS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->wishlistProductRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $wishlistProducts + * + * @return void + */ + private function castWishlistProducts(&$wishlistProducts) + { + foreach ($wishlistProducts as &$wishlistProduct) { + $wishlistProduct['id_wishlist_product'] = (int) $wishlistProduct['id_wishlist_product']; + $wishlistProduct['id_wishlist'] = (int) $wishlistProduct['id_wishlist']; + $wishlistProduct['id_product'] = (int) $wishlistProduct['id_product']; + $wishlistProduct['id_product_attribute'] = (int) $wishlistProduct['id_product_attribute']; + $wishlistProduct['quantity'] = (int) $wishlistProduct['quantity']; + $wishlistProduct['priority'] = (int) $wishlistProduct['priority']; + } + } +} diff --git a/src/Service/ShopContent/WishlistsService.php b/src/Service/ShopContent/WishlistsService.php new file mode 100644 index 00000000..2b559698 --- /dev/null +++ b/src/Service/ShopContent/WishlistsService.php @@ -0,0 +1,119 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Service\ShopContent; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\WishlistRepository; + +if (!defined('_PS_VERSION_')) { + exit; +} + +class WishlistsService extends ShopContentAbstractService implements ShopContentServiceInterface +{ + /** @var WishlistRepository */ + private $wishlistRepository; + + public function __construct(WishlistRepository $wishlistRepository) + { + $this->wishlistRepository = $wishlistRepository; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso) + { + $result = $this->wishlistRepository->retrieveContentsForFull($offset, $limit, $langIso); + + if (empty($result)) { + return []; + } + + $this->castWishlists($result); + + return array_map(function ($item) { + return [ + 'action' => Config::INCREMENTAL_TYPE_UPSERT, + 'collection' => Config::COLLECTION_WISHLISTS, + 'properties' => $item, + ]; + }, $result); + } + + /** + * @param int $limit + * @param array $upsertedContents + * @param array $deletedContents + * @param string $langIso + * + * @return array + */ + public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso) + { + $result = $this->wishlistRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso); + + if (!empty($result)) { + $this->castWishlists($result); + } + + return parent::formatIncrementalSyncResponse(Config::COLLECTION_WISHLISTS, $result, $deletedContents); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return $this->wishlistRepository->countFullSyncContentLeft($offset, $limit, $langIso); + } + + /** + * @param array $wishlists + * + * @return void + */ + private function castWishlists(&$wishlists) + { + foreach ($wishlists as &$wishlist) { + $wishlist['id_wishlist'] = (int) $wishlist['id_wishlist']; + $wishlist['id_customer'] = (int) $wishlist['id_customer']; + $wishlist['id_shop'] = (int) $wishlist['id_shop']; + $wishlist['id_shop_group'] = (int) $wishlist['id_shop_group']; + $wishlist['counter'] = (int) $wishlist['counter']; + $wishlist['default'] = (bool) $wishlist['default']; + } + } +} diff --git a/src/Service/SpecificPriceService.php b/src/Service/SpecificPriceService.php deleted file mode 100644 index bf029e80..00000000 --- a/src/Service/SpecificPriceService.php +++ /dev/null @@ -1,391 +0,0 @@ - */ - private static $_pricesLevel2; - - /** - * @var SpecificPriceRepository - */ - private $specificPriceRepository; - - public function __construct(SpecificPriceRepository $specificPriceRepository) - { - $this->specificPriceRepository = $specificPriceRepository; - } - - /** - * @param int $productId - * @param int $attributeId - * @param int $specificPriceId - * @param bool $useTax - * @param bool $usereduc - * @param \Context|null $context - * - * @return float|int|void - * - * @@throws \PrestaShopException - */ - public function getSpecificProductPrice($productId, $attributeId, $specificPriceId, $useTax, $usereduc, $context) - { - return $this->getPriceStatic($productId, $attributeId, $specificPriceId, $useTax, $usereduc, $context); - } - - /** - * @param int $id_product - * @param int $id_product_attribute - * @param int $specificPriceId - * @param bool $usetax - * @param bool $usereduc - * @param \Context|null $context - * @param int $decimals - * @param null $divisor - * @param bool $only_reduc - * @param null $id_customer - * @param null $id_cart - * @param null $id_address - * @param null $specific_price_output - * @param bool $use_group_reduction - * - * @return float|int|void - * - * @@throws \PrestaShopException - */ - private function getPriceStatic( - $id_product, - $id_product_attribute, - $specificPriceId, - $usetax = true, - $usereduc = true, - $context = null, - $decimals = 6, - $divisor = null, - $only_reduc = false, - $id_customer = null, - $id_cart = null, - $id_address = null, - &$specific_price_output = null, - $use_group_reduction = true - ) { - if (!$context) { - /** @var \Context $context */ - $context = \Context::getContext(); - } - - \Tools::displayParameterAsDeprecated('divisor'); - - if (!\Validate::isBool($usetax) || !\Validate::isUnsignedId($id_product)) { - exit(\Tools::displayError()); - } - - // Initializations - $id_group = (int) \Group::getCurrent()->id; - - /** @var \Currency $currency */ - $currency = $context->currency; - $id_currency = \Validate::isLoadedObject($currency) ? (int) $currency->id : (int) \Configuration::get('PS_CURRENCY_DEFAULT'); - - $current_cart = $context->cart; - if ($current_cart != null && \Validate::isLoadedObject($current_cart)) { - $id_address = $current_cart->{\Configuration::get('PS_TAX_ADDRESS_TYPE')}; - } - - // retrieve address informations - $address = \Address::initialize($id_address, true); - $id_country = (int) $address->id_country; - $id_state = (int) $address->id_state; - $zipcode = $address->postcode; - - if (\Tax::excludeTaxeOption()) { - $usetax = false; - } - - if ( - $usetax != false - && !empty($address->vat_number) - && $address->id_country != \Configuration::get('VATNUMBER_COUNTRY') - && \Configuration::get('VATNUMBER_MANAGEMENT') - ) { - $usetax = false; - } - - if ($context->shop == null) { - throw new \PrestaShopException('No shop context'); - } - - $shopId = (int) $context->shop->id; - - return $this->priceCalculation( - $shopId, - $id_product, - $id_product_attribute, - $specificPriceId, - $id_country, - $id_state, - $zipcode, - $id_currency, - $id_group, - $usetax, - $decimals, - $only_reduc, - $usereduc, - $specific_price_output, - $use_group_reduction - ); - } - - /** - * @param int $id_shop - * @param int $id_product - * @param int $id_product_attribute - * @param int $specificPriceId - * @param int $id_country - * @param int $id_state - * @param string $zipcode - * @param int $id_currency - * @param int $id_group - * @param bool $use_tax - * @param int $decimals - * @param bool $only_reduc - * @param bool $use_reduc - * @param null $specific_price - * @param bool $use_group_reduction - * @param int $id_customization - * - * @return float|int|void - * - * @@throws \PrestaShopDatabaseException - */ - private function priceCalculation( - $id_shop, - $id_product, - $id_product_attribute, - $specificPriceId, - $id_country, - $id_state, - $zipcode, - $id_currency, - $id_group, - $use_tax, - $decimals, - $only_reduc, - $use_reduc, - &$specific_price, - $use_group_reduction, - $id_customization = 0 - ) { - static $address = null; - static $context = null; - - if ($context == null) { - /** @var \Context $context */ - $context = \Context::getContext(); - $context = $context->cloneContext(); - } - - if ($address === null) { - if (is_object($context->cart) && $context->cart->{\Configuration::get('PS_TAX_ADDRESS_TYPE')} != null) { - $id_address = $context->cart->{\Configuration::get('PS_TAX_ADDRESS_TYPE')}; - $address = new \Address($id_address); - } else { - $address = new \Address(); - } - } - - if ($id_shop !== null && $context->shop->id != (int) $id_shop) { - $context->shop = new \Shop((int) $id_shop); - } - - if ($id_product_attribute == null) { - $id_product_attribute = \Product::getDefaultAttribute($id_product); - } - - // reference parameter is filled before any returns - /** @var array $specific_price */ - $specific_price = $this->getSpecificPrice($specificPriceId); - - // fetch price & attribute price - $cache_id_2 = $id_product . '-' . $id_shop . '-' . $specificPriceId; - if (!isset(self::$_pricesLevel2[$cache_id_2])) { - $sql = new \DbQuery(); - $sql->select('product_shop.`price`, product_shop.`ecotax`'); - $sql->from('product', 'p'); - $sql->innerJoin('product_shop', 'product_shop', '(product_shop.id_product=p.id_product AND product_shop.id_shop = ' . (int) $id_shop . ')'); - $sql->where('p.`id_product` = ' . (int) $id_product); - if (\Combination::isFeatureActive()) { - $sql->select('IFNULL(product_attribute_shop.id_product_attribute,0) id_product_attribute, product_attribute_shop.`price` AS attribute_price, product_attribute_shop.default_on'); - $sql->leftJoin('product_attribute_shop', 'product_attribute_shop', '(product_attribute_shop.id_product = p.id_product AND product_attribute_shop.id_shop = ' . (int) $id_shop . ')'); - } else { - $sql->select('0 as id_product_attribute'); - } - - $res = \Db::getInstance((bool) _PS_USE_SQL_SLAVE_)->executeS($sql); - - if (is_array($res) && count($res)) { - foreach ($res as $row) { - $array_tmp = [ - 'price' => $row['price'], - 'ecotax' => $row['ecotax'], - 'attribute_price' => (isset($row['attribute_price']) ? $row['attribute_price'] : null), - ]; - self::$_pricesLevel2[$cache_id_2][(int) $row['id_product_attribute']] = $array_tmp; - - if (isset($row['default_on']) && $row['default_on'] == 1) { - self::$_pricesLevel2[$cache_id_2][0] = $array_tmp; - } - } - } - } - - if (!isset(self::$_pricesLevel2[$cache_id_2][(int) $id_product_attribute])) { - return; - } - - $result = self::$_pricesLevel2[$cache_id_2][(int) $id_product_attribute]; - - if (!$specific_price || $specific_price['price'] < 0) { - $price = (float) $result['price']; - } else { - $price = (float) $specific_price['price']; - } - // convert only if the specific price is in the default currency (id_currency = 0) - if (!$specific_price || !($specific_price['price'] >= 0 && $specific_price['id_currency'])) { - $price = \Tools::convertPrice($price, $id_currency); - - if (isset($specific_price['price']) && $specific_price['price'] >= 0) { - $specific_price['price'] = $price; - } - } - - // Attribute price - if (is_array($result) && (!$specific_price || !$specific_price['id_product_attribute'] || $specific_price['price'] < 0)) { - $attribute_price = \Tools::convertPrice($result['attribute_price'] !== null ? (float) $result['attribute_price'] : 0, $id_currency); - // If you want the default combination, please use NULL value instead - if ($id_product_attribute !== false) { - $price += $attribute_price; - } - } - - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7.0.0', '>=')) { - // Customization price - if ((int) $id_customization) { - /* @phpstan-ignore-next-line */ - $price += \Tools::convertPrice(\Customization::getCustomizationPrice($id_customization), $id_currency); - } - } - - // Tax - $address->id_country = $id_country; - $address->id_state = $id_state; - $address->postcode = $zipcode; - - $tax_manager = \TaxManagerFactory::getManager($address, \Product::getIdTaxRulesGroupByIdProduct((int) $id_product, $context)); - $product_tax_calculator = $tax_manager->getTaxCalculator(); - - // Add Tax - if ($use_tax) { - $price = $product_tax_calculator->addTaxes((float) $price); - } - - // Eco Tax - if ($result['ecotax'] || isset($result['attribute_ecotax'])) { - $ecotax = $result['ecotax']; - if (isset($result['attribute_ecotax']) && $result['attribute_ecotax'] > 0) { - $ecotax = $result['attribute_ecotax']; - } - - if ($id_currency) { - $ecotax = \Tools::convertPrice($ecotax, $id_currency); - } - if ($use_tax) { - static $psEcotaxTaxRulesGroupId = null; - if ($psEcotaxTaxRulesGroupId === null) { - $psEcotaxTaxRulesGroupId = (int) \Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID'); - } - // reinit the tax manager for ecotax handling - $tax_manager = \TaxManagerFactory::getManager( - $address, - $psEcotaxTaxRulesGroupId - ); - $ecotax_tax_calculator = $tax_manager->getTaxCalculator(); - $price += $ecotax_tax_calculator->addTaxes($ecotax); - } else { - $price += $ecotax; - } - } - - // Reduction - $specific_price_reduction = 0; - if (($only_reduc || $use_reduc) && $specific_price) { - if ($specific_price['reduction_type'] == 'amount') { - $reduction_amount = $specific_price['reduction']; - - if (!$specific_price['id_currency']) { - $reduction_amount = \Tools::convertPrice($reduction_amount, $id_currency); - } - - $specific_price_reduction = $reduction_amount; - - // Adjust taxes if required - - if (!$use_tax && $specific_price['reduction_tax']) { - $specific_price_reduction = $product_tax_calculator->removeTaxes($specific_price_reduction); - } - if ($use_tax && !$specific_price['reduction_tax']) { - $specific_price_reduction = $product_tax_calculator->addTaxes($specific_price_reduction); - } - } else { - $specific_price_reduction = $price * $specific_price['reduction']; - } - } - - if ($use_reduc) { - $price -= $specific_price_reduction; - } - - // Group reduction - if ($use_group_reduction) { - $reduction_from_category = \GroupReduction::getValueForProduct($id_product, $id_group); - if ($reduction_from_category !== false) { - $group_reduction = $price * (float) $reduction_from_category; - } else { // apply group reduction if there is no group reduction for this category - $group_reduction = (($reduc = \Group::getReductionByIdGroup($id_group)) != 0) ? ($price * $reduc / 100) : 0; - } - - $price -= $group_reduction; - } - - if ($only_reduc) { - return \Tools::ps_round($specific_price_reduction, $decimals); - } - - $price = \Tools::ps_round((float) $price, $decimals); - - if ($price < 0) { - $price = 0; - } - - return $price; - } - - /** - * Returns the specificPrice information related to a given productId and context. - * - * @param int $specificPriceId - * - * @return array|bool|false|object|null - */ - private function getSpecificPrice($specificPriceId) - { - if (!\SpecificPrice::isFeatureActive()) { - return []; - } - - return $this->specificPriceRepository->getSpecificPrice($specificPriceId); - } -} diff --git a/src/Service/SynchronizationService.php b/src/Service/SynchronizationService.php index 1a105b77..f238a72d 100644 --- a/src/Service/SynchronizationService.php +++ b/src/Service/SynchronizationService.php @@ -1,27 +1,56 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ namespace PrestaShop\Module\PsEventbus\Service; use PrestaShop\Module\PsEventbus\Api\LiveSyncApiClient; -use PrestaShop\Module\PsEventbus\Decorator\PayloadDecorator; -use PrestaShop\Module\PsEventbus\Provider\PaginatedApiDataProviderInterface; -use PrestaShop\Module\PsEventbus\Repository\DeletedObjectsRepository; -use PrestaShop\Module\PsEventbus\Repository\EventbusSyncRepository; +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Handler\ErrorHandler\ErrorHandler; use PrestaShop\Module\PsEventbus\Repository\IncrementalSyncRepository; -use PrestaShop\Module\PsEventbus\Repository\LanguageRepository; use PrestaShop\Module\PsEventbus\Repository\LiveSyncRepository; +use PrestaShop\Module\PsEventbus\Repository\SyncRepository; +use PrestaShop\Module\PsEventbus\Service\ShopContent\LanguagesService; +use PrestaShop\Module\PsEventbus\Service\ShopContent\ShopContentServiceInterface; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; + +if (!defined('_PS_VERSION_')) { + exit; +} class SynchronizationService { /** - * @var \Ps_eventbus + * @var LiveSyncApiClient */ - private $module; + private $liveSyncApiClient; /** - * @var EventbusSyncRepository + * @var SyncRepository */ - private $eventbusSyncRepository; + private $syncRepository; /** * @var IncrementalSyncRepository @@ -34,130 +63,135 @@ class SynchronizationService private $liveSyncRepository; /** - * @var DeletedObjectsRepository - */ - private $deletedObjectsRepository; - - /** - * @var LanguageRepository - */ - private $languageRepository; - - /** - * @var PayloadDecorator + * @var LanguagesService */ - private $payloadDecorator; + private $languagesService; /** - * @var int + * @var ProxyServiceInterface */ - const RANDOM_SYNC_CHECK_MAX = 20; + private $proxyService; /** - * @var int + * @var ErrorHandler */ - const INCREMENTAL_SYNC_MAX_ITEMS_PER_SHOP_CONTENT = 100000; + private $errorHandler; public function __construct( - \Ps_eventbus $module, - EventbusSyncRepository $eventbusSyncRepository, + LiveSyncApiClient $liveSyncApiClient, + SyncRepository $syncRepository, IncrementalSyncRepository $incrementalSyncRepository, LiveSyncRepository $liveSyncRepository, - DeletedObjectsRepository $deletedObjectsRepository, - LanguageRepository $languageRepository, - PayloadDecorator $payloadDecorator + LanguagesService $languagesService, + ProxyServiceInterface $proxyService, + ErrorHandler $errorHandler ) { - $this->module = $module; - $this->eventbusSyncRepository = $eventbusSyncRepository; + $this->liveSyncApiClient = $liveSyncApiClient; + $this->syncRepository = $syncRepository; $this->incrementalSyncRepository = $incrementalSyncRepository; $this->liveSyncRepository = $liveSyncRepository; - $this->deletedObjectsRepository = $deletedObjectsRepository; - $this->languageRepository = $languageRepository; - $this->payloadDecorator = $payloadDecorator; + $this->languagesService = $languagesService; + $this->proxyService = $proxyService; + $this->errorHandler = $errorHandler; } /** - * @param PaginatedApiDataProviderInterface $dataProvider - * @param string $type + * @param string $shopContent * @param string $jobId * @param string $langIso * @param int $offset * @param int $limit + * @param int $startTime * @param string $dateNow - * @param int $scriptStartTime - * @param bool $isFull * * @return array * - * @@throws \PrestaShopDatabaseException|EnvVarException|ApiException + * @@throws PrestaShopDatabaseException|EnvVarException|ApiException */ - public function handleFullSync( - PaginatedApiDataProviderInterface $dataProvider, - $type, - $jobId, - $langIso, - $offset, - $limit, - $dateNow, - $scriptStartTime, - $isFull + public function sendFullSync( + string $shopContent, + string $jobId, + string $langIso, + int $offset, + int $limit, + int $startTime, + string $dateNow ) { $response = []; - $data = $dataProvider->getFormattedData($offset, $limit, $langIso); + $serviceName = str_replace('_', '', ucwords($shopContent, '_')); + $serviceId = 'PrestaShop\Module\PsEventbus\Service\ShopContent\\' . $serviceName . 'Service'; // faire un mapping entre le service et le nom du shopcontent - $this->payloadDecorator->convertDateFormat($data); + /** @var \Ps_eventbus */ + $module = \Module::getInstanceByName('ps_eventbus'); - if (!empty($data)) { - /** @var ProxyService */ - $proxyService = $this->module->getService('PrestaShop\Module\PsEventbus\Service\ProxyService'); + if (!$module->hasService($serviceId)) { + throw new ServiceNotFoundException($serviceId); + } + + /** @var ShopContentServiceInterface $shopContentApiService */ + $shopContentApiService = $module->getService($serviceId); + + $data = $shopContentApiService->getContentsForFull($offset, $limit, $langIso); + + CommonService::convertDateFormat($data); - $response = $proxyService->upload($jobId, $data, $scriptStartTime, $isFull); + if (!empty($data)) { + $response = $this->proxyService->upload($jobId, $data, $startTime, true); if ($response['httpCode'] == 201) { $offset += $limit; } } - $remainingObjects = (int) $dataProvider->getRemainingObjectsCount($offset, $langIso); + $remainingObjects = (int) $shopContentApiService->getFullSyncContentLeft($offset, $limit, $langIso); if ($remainingObjects <= 0) { $remainingObjects = 0; $offset = 0; } - $this->eventbusSyncRepository->updateTypeSync($type, $offset, $dateNow, $remainingObjects === 0, $langIso); + $this->syncRepository->upsertTypeSync($shopContent, $offset, $dateNow, $remainingObjects === 0, $langIso); return $this->returnSyncResponse($data, $response, $remainingObjects); } /** - * @param PaginatedApiDataProviderInterface $dataProvider - * @param string $type + * @param string $shopContent * @param string $jobId - * @param int $limit * @param string $langIso - * @param int $scriptStartTime - * @param bool $isFull + * @param int $limit + * @param int $startTime * * @return array * - * @@throws \PrestaShopDatabaseException|EnvVarException + * @@throws PrestaShopDatabaseException|EnvVarException */ - public function handleIncrementalSync( - PaginatedApiDataProviderInterface $dataProvider, - $type, - $jobId, - $limit, - $langIso, - $scriptStartTime, - $isFull + public function sendIncrementalSync( + string $shopContent, + string $jobId, + string $langIso, + int $limit, + int $startTime ) { $response = []; - $objectIds = $this->incrementalSyncRepository->getIncrementalSyncObjectIds($type, $langIso, $limit); + $serviceName = str_replace('_', '', ucwords($shopContent, '_')); + $serviceId = 'PrestaShop\Module\PsEventbus\Service\ShopContent\\' . $serviceName . 'Service'; + + /** @var \Ps_eventbus */ + $module = \Module::getInstanceByName('ps_eventbus'); + + if (!$module->hasService($serviceId)) { + throw new ServiceNotFoundException($serviceId); + } + + /** @var ShopContentServiceInterface $shopContentApiService */ + $shopContentApiService = $module->getService($serviceId); + + $contentsToSync = $this->incrementalSyncRepository->getIncrementalSyncObjects($shopContent, $langIso, $limit); - if (empty($objectIds)) { + if (empty($contentsToSync)) { return [ 'total_objects' => 0, 'has_remaining_objects' => false, @@ -165,24 +199,29 @@ public function handleIncrementalSync( ]; } - $data = $dataProvider->getFormattedDataIncremental($limit, $langIso, $objectIds); + $upsertedContents = array_filter($contentsToSync, function ($content) { + return $content['action'] == Config::INCREMENTAL_TYPE_UPSERT; + }); - $this->payloadDecorator->convertDateFormat($data); + $deletedContents = array_filter($contentsToSync, function ($content) { + return $content['action'] == Config::INCREMENTAL_TYPE_DELETE; + }); - if (!empty($data)) { - /** @var ProxyService */ - $proxyService = $this->module->getService('PrestaShop\Module\PsEventbus\Service\ProxyService'); + $data = $shopContentApiService->getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso); - $response = $proxyService->upload($jobId, $data, $scriptStartTime, $isFull); + CommonService::convertDateFormat($data); + + if (!empty($data)) { + $response = $this->proxyService->upload($jobId, $data, $startTime, false); if ($response['httpCode'] == 201) { - $this->incrementalSyncRepository->removeIncrementalSyncObjects($type, $objectIds, $langIso); + $this->incrementalSyncRepository->removeIncrementalSyncObjects($shopContent, array_column($contentsToSync, 'id'), $langIso); } } else { - $this->incrementalSyncRepository->removeIncrementalSyncObjects($type, $objectIds, $langIso); + $this->incrementalSyncRepository->removeIncrementalSyncObjects($shopContent, array_column($contentsToSync, 'id'), $langIso); } - $remainingObjects = $this->incrementalSyncRepository->getRemainingIncrementalObjects($type, $langIso); + $remainingObjects = $this->incrementalSyncRepository->getRemainingIncrementalObjects($shopContent, $langIso); return $this->returnSyncResponse($data, $response, $remainingObjects); } @@ -190,40 +229,42 @@ public function handleIncrementalSync( /** * liveSync * - * @param string $shopContent - * @param int $shopContentId - * @param string $action + * @param mixed $contents + * @param string $actionType * * @return void */ - public function sendLiveSync($shopContent, $shopContentId, $action) + public function sendLiveSync($contents, $actionType) { - $defaultIsoCode = $this->languageRepository->getDefaultLanguageIsoCode(); + if (!is_array($contents)) { + $contents = [$contents]; + } - if ($this->isFullSyncDone($shopContent, $defaultIsoCode) && $this->debounceLiveSync($shopContent)) { - try { - /** @var LiveSyncApiClient $liveSyncApiClient */ - $liveSyncApiClient = $this->module->getService('PrestaShop\Module\PsEventbus\Api\LiveSyncApiClient'); + $defaultIsoCode = $this->languagesService->getDefaultLanguageIsoCode(); - $liveSyncApiClient->liveSync($shopContent, (int) $shopContentId, $action); - } catch (\Exception $e) { - // FIXME : report this error somehow + foreach ($contents as $content) { + if ($this->isFullSyncDone($content, $defaultIsoCode) && $this->debounceLiveSync($content)) { + try { + $this->liveSyncApiClient->liveSync($content, $actionType); + } catch (\Exception $exception) { + $this->errorHandler->handle($exception); + } } } } /** - * @param int $objectId - * @param string $type + * @param array $contentTypesWithIds + * @param string $actionType * @param string $createdAt * @param int $shopId * @param bool $hasMultiLang * * @return void */ - public function insertIncrementalSyncObject($objectId, $type, $createdAt, $shopId, $hasMultiLang = null) + public function insertContentIntoIncremental($contentTypesWithIds, $actionType, $createdAt, $shopId, $hasMultiLang) { - if ((int) $objectId === 0) { + if (count($contentTypesWithIds) == 0) { return; } @@ -232,88 +273,90 @@ public function insertIncrementalSyncObject($objectId, $type, $createdAt, $shopI * When random number == 10, we count number of entry exist in database for this specific shop content * If count > 100 000, we removed all entry corresponding to this shop content, and we enable full sync for this */ - if (mt_rand() % $this::RANDOM_SYNC_CHECK_MAX == 0) { - $count = $this->incrementalSyncRepository->getIncrementalSyncObjectCountByType($type); - if ($count > $this::INCREMENTAL_SYNC_MAX_ITEMS_PER_SHOP_CONTENT) { - $hasDeleted = $this->incrementalSyncRepository->removeIncrementaSyncObjectByType($type); - - if ($hasDeleted) { - $this->eventbusSyncRepository->updateTypeSync( - $type, - 0, - $createdAt, - false, - $this->languageRepository->getDefaultLanguageIsoCode() - ); + if (mt_rand() % Config::INCREMENTAL_SYNC_TABLE_SIZE_CHECK_MOD == 0) { + foreach ($contentTypesWithIds as $contentType => $contentIds) { + $count = $this->incrementalSyncRepository->getIncrementalSyncObjectCountByType($contentType); + + if ($count > Config::INCREMENTAL_SYNC_MAX_TABLE_SIZE) { + $hasDeleted = $this->incrementalSyncRepository->removeIncrementaSyncObjectByType($contentType); + + if ($hasDeleted) { + $this->syncRepository->upsertTypeSync( + $contentType, + 0, + $createdAt, + false, + $this->languagesService->getDefaultLanguageIsoCode() + ); + } } - } - return; + return; + } } - $objectsData = []; + $contentToInsert = []; if ($hasMultiLang) { - $allIsoCodes = $this->languageRepository->getLanguagesIsoCodes(); + $allIsoCodes = $this->languagesService->getLanguagesIsoCodes(); foreach ($allIsoCodes as $langIso) { - if ($this->isFullSyncDone($type, $langIso)) { - array_push($objectsData, - [ - 'type' => $type, - 'id_object' => $objectId, - 'id_shop' => $shopId, - 'lang_iso' => $langIso, - 'created_at' => $createdAt, - ] - ); + foreach ($contentTypesWithIds as $contentType => $contentIds) { + if ($this->isFullSyncDone($contentType, $langIso)) { + if (!is_array($contentIds)) { + $contentIds = [$contentIds]; + } + + $finalContent = array_map(function ($contentId) use ($contentType, $shopId, $langIso, $actionType, $createdAt) { + return [ + 'type' => $contentType, + 'id_object' => $contentId, + 'id_shop' => $shopId, + 'lang_iso' => $langIso, + 'action' => $actionType, + 'created_at' => $createdAt, + ]; + }, $contentIds); + + $contentToInsert = array_merge($contentToInsert, $finalContent); + } } } } else { - $defaultIsoCode = $this->languageRepository->getDefaultLanguageIsoCode(); - - if ($this->isFullSyncDone($type, $defaultIsoCode)) { - array_push($objectsData, - [ - 'type' => $type, - 'id_object' => $objectId, - 'id_shop' => $shopId, - 'lang_iso' => $defaultIsoCode, - 'created_at' => $createdAt, - ] - ); + $defaultIsoCode = $this->languagesService->getDefaultLanguageIsoCode(); + + foreach ($contentTypesWithIds as $contentType => $contentIds) { + if ($this->isFullSyncDone($contentType, $defaultIsoCode)) { + if (!is_array($contentIds)) { + $contentIds = [$contentIds]; + } + + $finalContent = array_map(function ($contentId) use ($contentType, $shopId, $defaultIsoCode, $actionType, $createdAt) { + return [ + 'type' => $contentType, + 'id_object' => $contentId, + 'id_shop' => $shopId, + 'lang_iso' => $defaultIsoCode, + 'action' => $actionType, + 'created_at' => $createdAt, + ]; + }, $contentIds); + $contentToInsert = array_merge($contentToInsert, $finalContent); + } } } - if (empty($objectsData) == false) { - $this->incrementalSyncRepository->insertIncrementalObject($objectsData); + if (!empty($contentToInsert)) { + $this->incrementalSyncRepository->insertIncrementalObject($contentToInsert); } } - /** - * @param int $objectId - * @param string $type - * @param string $date - * @param int $shopId - * - * @return void - */ - public function insertDeletedObject($objectId, $type, $date, $shopId) - { - if ((int) $objectId === 0) { - return; - } - - $this->deletedObjectsRepository->insertDeletedObject($objectId, $type, $date, $shopId); - $this->incrementalSyncRepository->removeIncrementalSyncObject($type, $objectId); - } - /** * @param string $shopContentName * * @return bool * - * @@throws \PrestaShopDatabaseException + * @@throws PrestaShopDatabaseException */ private function debounceLiveSync($shopContentName) // @phpstan-ignore method.unused { @@ -337,13 +380,13 @@ private function debounceLiveSync($shopContentName) // @phpstan-ignore method.un * Return true if full sync is done for this shop content * * @param string $shopContent - * @param string|null $langIso + * @param string $langIso * * @return bool */ - private function isFullSyncDone($shopContent, $langIso = null) + private function isFullSyncDone($shopContent, $langIso) { - return $this->eventbusSyncRepository->isFullSyncDoneForThisTypeSync($shopContent, $langIso); + return $this->syncRepository->isFullSyncDoneForThisTypeSync($shopContent, $langIso); } /** @@ -359,21 +402,7 @@ private function returnSyncResponse($data, $syncResponse, $remainingObjects) 'total_objects' => count($data), 'has_remaining_objects' => $remainingObjects > 0, 'remaining_objects' => $remainingObjects, - 'md5' => $this->getPayloadMd5($data), + 'md5' => md5(serialize($data)), ], $syncResponse); } - - /** - * @param array $payload - * - * @return string - */ - private function getPayloadMd5($payload) - { - return md5( - implode(' ', array_map(function ($payloadItem) { - return $payloadItem['id']; - }, $payload)) - ); - } } diff --git a/src/Traits/UseHooks.php b/src/Traits/UseHooks.php new file mode 100644 index 00000000..7cedca00 --- /dev/null +++ b/src/Traits/UseHooks.php @@ -0,0 +1,1923 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\Module\PsEventbus\Traits; + +use PrestaShop\Module\PsEventbus\Config\Config; +use PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository; +use PrestaShop\Module\PsEventbus\Repository\StockRepository; +use PrestaShop\Module\PsEventbus\Service\SynchronizationService; + +if (!defined('_PS_VERSION_')) { + exit; +} + +trait UseHooks +{ + /** + * @return array + */ + public function getHooks() + { + // Retourne la liste des hooks a register + return [ + 'actionObjectCarrierAddAfter', + 'actionObjectCarrierDeleteAfter', + 'actionObjectCarrierUpdateAfter', + + 'actionObjectCartAddAfter', + 'actionObjectCartUpdateAfter', + + 'actionObjectCartRuleAddAfter', + 'actionObjectCartRuleDeleteAfter', + 'actionObjectCartRuleUpdateAfter', + + 'actionObjectCategoryAddAfter', + 'actionObjectCategoryDeleteAfter', + 'actionObjectCategoryUpdateAfter', + + 'actionObjectCombinationDeleteAfter', + + 'actionObjectCountryAddAfter', + 'actionObjectCountryDeleteAfter', + 'actionObjectCountryUpdateAfter', + + 'actionObjectCurrencyAddAfter', + 'actionObjectCurrencyUpdateAfter', + + 'actionObjectCustomerAddAfter', + 'actionObjectCustomerDeleteAfter', + 'actionObjectCustomerUpdateAfter', + + 'actionObjectImageAddAfter', + 'actionObjectImageDeleteAfter', + 'actionObjectImageUpdateAfter', + + 'actionObjectLanguageAddAfter', + 'actionObjectLanguageDeleteAfter', + 'actionObjectLanguageUpdateAfter', + + 'actionObjectManufacturerAddAfter', + 'actionObjectManufacturerDeleteAfter', + 'actionObjectManufacturerUpdateAfter', + + 'actionObjectOrderAddAfter', + 'actionObjectOrderUpdateAfter', + + 'actionObjectProductAddAfter', + 'actionObjectProductDeleteAfter', + 'actionObjectProductUpdateAfter', + + 'actionObjectSpecificPriceAddAfter', + 'actionObjectSpecificPriceDeleteAfter', + 'actionObjectSpecificPriceUpdateAfter', + + 'actionObjectStateAddAfter', + 'actionObjectStateDeleteAfter', + 'actionObjectStateUpdateAfter', + + 'actionObjectStockAddAfter', + 'actionObjectStockUpdateAfter', + + 'actionObjectStoreAddAfter', + 'actionObjectStoreDeleteAfter', + 'actionObjectStoreUpdateAfter', + + 'actionObjectSupplierAddAfter', + 'actionObjectSupplierDeleteAfter', + 'actionObjectSupplierUpdateAfter', + + 'actionObjectTaxAddAfter', + 'actionObjectTaxDeleteAfter', + 'actionObjectTaxRulesGroupAddAfter', + 'actionObjectTaxRulesGroupDeleteAfter', + 'actionObjectTaxRulesGroupUpdateAfter', + 'actionObjectTaxUpdateAfter', + + 'actionObjectWishlistAddAfter', + 'actionObjectWishlistDeleteAfter', + 'actionObjectWishlistUpdateAfter', + + 'actionObjectZoneAddAfter', + 'actionObjectZoneDeleteAfter', + 'actionObjectZoneUpdateAfter', + + 'actionShippingPreferencesPageSave', + + 'actionObjectEmployeeAddAfter', + 'actionObjectEmployeeDeleteAfter', + 'actionObjectEmployeeUpdateAfter', + + 'actionDispatcherBefore', + ]; + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectImageDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Image $image */ + $image = $parameters['object']; + + if ($image->id_product) { + $synchronizationService->sendLiveSync(Config::COLLECTION_IMAGES, Config::INCREMENTAL_TYPE_UPSERT); + + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_IMAGES => $image->id_image], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectImageAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Image $image */ + $image = $parameters['object']; + + if ($image->id_product) { + $synchronizationService->sendLiveSync(Config::COLLECTION_IMAGES,Config::INCREMENTAL_TYPE_UPSERT); + + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_IMAGES => $image->id_image], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectImageUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Image $image */ + $image = $parameters['object']; + + if ($image->id_product) { + $synchronizationService->sendLiveSync(Config::COLLECTION_IMAGES, Config::INCREMENTAL_TYPE_UPSERT); + + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_IMAGES => $image->id_image], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectImageTypeDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \ImageType $imageType */ + $imageType = $parameters['object']; + + if ($imageType->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_IMAGE_TYPES, Config::INCREMENTAL_TYPE_DELETE); + + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_IMAGE_TYPES => $imageType->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectImageTypeAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \ImageType $imageType */ + $imageType = $parameters['object']; + + if ($imageType->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_IMAGE_TYPES, Config::INCREMENTAL_TYPE_DELETE); + + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_IMAGE_TYPES => $imageType->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectImageTypeUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \ImageType $imageType */ + $imageType = $parameters['object']; + + if ($imageType->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_IMAGE_TYPES, Config::INCREMENTAL_TYPE_DELETE); + + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_IMAGE_TYPES => $imageType->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectLanguageDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Language $language */ + $language = $parameters['object']; + + if ($language->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_LANGUAGES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_LANGUAGES => $language->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectLanguageAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Language $language */ + $language = $parameters['object']; + + if ($language->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_LANGUAGES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_LANGUAGES => $language->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectLanguageUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Language $language */ + $language = $parameters['object']; + + if ($language->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_LANGUAGES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_LANGUAGES => $language->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectManufacturerDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Manufacturer $manufacturer */ + $manufacturer = $parameters['object']; + + if (isset($manufacturer->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_MANUFACTURERS, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_MANUFACTURERS => $manufacturer->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectManufacturerAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Manufacturer $manufacturer */ + $manufacturer = $parameters['object']; + + if (isset($manufacturer->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_MANUFACTURERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_MANUFACTURERS => $manufacturer->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectManufacturerUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Manufacturer $manufacturer */ + $manufacturer = $parameters['object']; + + if (isset($manufacturer->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_MANUFACTURERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_MANUFACTURERS => $manufacturer->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectSupplierDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Supplier $supplier */ + $supplier = $parameters['object']; + + if (isset($supplier->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_SUPPLIERS, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_SUPPLIERS => $supplier->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectSupplierAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Supplier $supplier */ + $supplier = $parameters['object']; + + if (isset($supplier->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_SUPPLIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_SUPPLIERS => $supplier->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectSupplierUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Supplier $supplier */ + $supplier = $parameters['object']; + + if (isset($supplier->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_SUPPLIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_SUPPLIERS => $supplier->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectProductDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Product $product */ + $product = $parameters['object']; + + if (isset($product->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_PRODUCTS, + Config::COLLECTION_BUNDLES, + Config::COLLECTION_PRODUCT_SUPPLIERS + ], + Config::INCREMENTAL_TYPE_DELETE + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_PRODUCTS => $product->id, + Config::COLLECTION_BUNDLES => $product->id, + Config::COLLECTION_PRODUCT_SUPPLIERS => $product->id + ], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectProductAddAfter($parameters) + { + /** @var \Product $product */ + $product = $parameters['object']; + + if (!isset($product->id)) { + return; + } + + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var CustomProductCarrierRepository $customProductCarrierRepository */ + $customProductCarrierRepository = $this->getService('PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository'); + $customProductCarriers = $customProductCarrierRepository->getCustomProductCarrierIdsByCarrierId($product->id); + $customProductCarrierIds = array_column($customProductCarriers, 'id_carrier_reference'); + + /** @var StockRepository $stockRepository */ + $stockRepository = $this->getService('PrestaShop\Module\PsEventbus\Repository\StockRepository'); + $stockId = $stockRepository->getStockIdByProductId($product->id); + + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_PRODUCTS, + Config::COLLECTION_BUNDLES, + Config::COLLECTION_PRODUCT_SUPPLIERS, + Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, + Config::COLLECTION_STOCKS, + CONFIG::COLLECTION_STOCK_MOVEMENTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_PRODUCTS => $product->id, + Config::COLLECTION_BUNDLES => $product->id, + Config::COLLECTION_PRODUCT_SUPPLIERS => $product->id, + Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS => $customProductCarrierIds, + Config::COLLECTION_STOCKS => $stockId, + CONFIG::COLLECTION_STOCK_MOVEMENTS => $stockId + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectProductUpdateAfter($parameters) + { + /** @var \Product $product */ + $product = $parameters['object']; + + if (!isset($product->id)) { + return; + } + + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var CustomProductCarrierRepository $customProductCarrierRepository */ + $customProductCarrierRepository = $this->getService('PrestaShop\Module\PsEventbus\Repository\CustomProductCarrierRepository'); + $customProductCarriers = $customProductCarrierRepository->getCustomProductCarrierIdsByCarrierId($product->id); + $customProductCarrierIds = array_column($customProductCarriers, 'id_carrier_reference'); + + /** @var StockRepository $stockRepository */ + $stockRepository = $this->getService('PrestaShop\Module\PsEventbus\Repository\StockRepository'); + $stockId = $stockRepository->getStockIdByProductId($product->id); + + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_PRODUCTS, + Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS, + Config::COLLECTION_STOCKS, + CONFIG::COLLECTION_STOCK_MOVEMENTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_PRODUCTS => $product->id, + Config::COLLECTION_CUSTOM_PRODUCT_CARRIERS => $customProductCarrierIds, + Config::COLLECTION_STOCKS => $stockId, + CONFIG::COLLECTION_STOCK_MOVEMENTS => $stockId + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectWishlistDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $wishlist = $parameters['object']; + + if ($wishlist->id) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_WISHLISTS, + Config::COLLECTION_WISHLIST_PRODUCTS + ], + Config::INCREMENTAL_TYPE_DELETE + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_WISHLISTS => $wishlist->id, + Config::COLLECTION_WISHLIST_PRODUCTS => $wishlist->id + ], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectWishlistAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $wishlist = $parameters['object']; + + if ($wishlist->id) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_WISHLISTS, + Config::COLLECTION_WISHLIST_PRODUCTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_WISHLISTS => $wishlist->id, + Config::COLLECTION_WISHLIST_PRODUCTS => $wishlist->id + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectWishlistUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $wishlist = $parameters['object']; + + if ($wishlist->id) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_WISHLISTS, + Config::COLLECTION_WISHLIST_PRODUCTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_WISHLISTS => $wishlist->id, + Config::COLLECTION_WISHLIST_PRODUCTS => $wishlist->id + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectStockAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Stock $stock */ + $stock = $parameters['object']; + + if (isset($stock->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_STOCKS, + Config::COLLECTION_STOCK_MOVEMENTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_STOCKS => $stock->id, + Config::COLLECTION_STOCK_MOVEMENTS => $stock->id + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectStockUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Stock $stock */ + $stock = $parameters['object']; + + if (isset($stock->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_STOCKS, + Config::COLLECTION_STOCK_MOVEMENTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_STOCKS => $stock->id, + Config::COLLECTION_STOCK_MOVEMENTS => $stock->id + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectStoreDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Store $store */ + $store = $parameters['object']; + + if ($store->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_STORES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_STORES => $store->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectStoreAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Store $store */ + $store = $parameters['object']; + + if ($store->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_STORES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_STORES => $store->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectStoreUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Store $store */ + $store = $parameters['object']; + + if ($store->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_STORES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_STORES => $store->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCombinationDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Combination $combination */ + $combination = $parameters['object']; + + if (isset($combination->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ATTRIBUTES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ATTRIBUTES => $combination->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCategoryAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Category $category * */ + $category = $parameters['object']; + + if (isset($category->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CATEGORIES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CATEGORIES => $category->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCategoryUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Category $category * */ + $category = $parameters['object']; + + if (isset($category->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CATEGORIES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CATEGORIES => $category->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCategoryDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Category $category * */ + $category = $parameters['object']; + + if (isset($category->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CATEGORIES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CATEGORIES => $category->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCustomerAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Customer $customer * */ + $customer = $parameters['object']; + + if ($customer->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CUSTOMERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CUSTOMERS => $customer->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCustomerUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Customer $customer * */ + $customer = $parameters['object']; + + if ($customer->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CUSTOMERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CUSTOMERS => $customer->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCustomerDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Customer $customer * */ + $customer = $parameters['object']; + + if ($customer->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CUSTOMERS, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CUSTOMERS => $customer->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCurrencyAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Currency $currency * */ + $currency = $parameters['object']; + + if (isset($currency->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CURRENCIES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CURRENCIES => $currency->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCurrencyUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Currency $currency * */ + $currency = $parameters['object']; + + if (isset($currency->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CURRENCIES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CURRENCIES => $currency->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCurrencyDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Currency $currency * */ + $currency = $parameters['object']; + + if (isset($currency->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CURRENCIES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CURRENCIES => $currency->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCartAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $cart = $parameters['object']; + + if (isset($cart->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_CARTS, + Config::COLLECTION_CART_PRODUCTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_CARTS => $cart->id, + Config::COLLECTION_CART_PRODUCTS => $cart->id + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCartUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $cart = $parameters['object']; + + if (isset($cart->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_CARTS, + Config::COLLECTION_CART_PRODUCTS + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_CARTS => $cart->id, + Config::COLLECTION_CART_PRODUCTS => $cart->id + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + true + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCartRuleAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $cartRule = $parameters['object']; + + if (isset($cartRule->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CART_RULES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CART_RULES => $cartRule->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCartRuleDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $cartRule = $parameters['object']; + + if (isset($cartRule->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CART_RULES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CART_RULES => $cartRule->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCartRuleUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $cartRule = $parameters['object']; + + if (isset($cartRule->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_CART_RULES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CART_RULES => $cartRule->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $order = $parameters['object']; + + if (isset($order->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_ORDERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_ORDERS => $order->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectOrderUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $order = $parameters['object']; + + if (isset($order->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_ORDERS, + Config::COLLECTION_ORDER_CART_RULES, + Config::COLLECTION_ORDER_DETAILS, + Config::COLLECTION_ORDER_STATUS_HISTORY, + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_ORDERS => $order->id, + Config::COLLECTION_ORDER_CART_RULES => $order->id, + Config::COLLECTION_ORDER_DETAILS => $order->id, + Config::COLLECTION_ORDER_STATUS_HISTORY => $order->id, + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCarrierAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Carrier $carrier */ + $carrier = $parameters['object']; + + if (isset($carrier->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_CARRIERS => $carrier->id, + Config::COLLECTION_CARRIER_DETAILS => $carrier->id, + Config::COLLECTION_CARRIER_TAXES => $carrier->id, + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_CARRIERS => $carrier->id, + Config::COLLECTION_CARRIER_DETAILS => $carrier->id, + Config::COLLECTION_CARRIER_TAXES => $carrier->id, + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCarrierUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \Carrier $carrier */ + $carrier = $parameters['object']; + + if (isset($carrier->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_CARRIERS, + Config::COLLECTION_CARRIER_DETAILS, + Config::COLLECTION_CARRIER_TAXES, + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_CARRIERS => $carrier->id, + Config::COLLECTION_CARRIER_DETAILS => $carrier->id, + Config::COLLECTION_CARRIER_TAXES => $carrier->id, + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectCarrierDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + /** @var \Carrier $carrier */ + $carrier = $parameters['object']; + + if (isset($carrier->id)) { + $synchronizationService->sendLiveSync( + [ + Config::COLLECTION_CARRIERS, + Config::COLLECTION_CARRIER_DETAILS, + Config::COLLECTION_CARRIER_TAXES, + ], + Config::INCREMENTAL_TYPE_UPSERT + ); + + $synchronizationService->insertContentIntoIncremental( + [ + Config::COLLECTION_CARRIERS => $carrier->id, + Config::COLLECTION_CARRIER_DETAILS => $carrier->id, + Config::COLLECTION_CARRIER_TAXES => $carrier->id, + ], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @return void + */ + public function hookActionObjectCountryAddAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectCountryUpdateAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectCountryDeleteAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectStateAddAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectStateUpdateAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectStateDeleteAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectZoneAddAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectZoneUpdateAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectZoneDeleteAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectTaxAddAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectTaxUpdateAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectTaxDeleteAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectTaxRulesGroupAddAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectTaxRulesGroupUpdateAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectTaxRulesGroupDeleteAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionShippingPreferencesPageSave() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_CARRIERS, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_CARRIERS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectEmployeeAddAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_EMPLOYEES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_EMPLOYEES => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectEmployeeDeleteAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_EMPLOYEES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_EMPLOYEES => 0], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * @return void + */ + public function hookActionObjectEmployeeUpdateAfter() + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $synchronizationService->sendLiveSync(Config::COLLECTION_EMPLOYEES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_EMPLOYEES => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + + /** + * This is global hook. This hook is called at the beginning of the dispatch method of the Dispatcher + * It's possible to use this hook all time when we don't have specific hook. + * Available since: 1.7.1 + * + * Unable to use hookActionDispatcherAfter. Seem to be have a strange effect. When i use + * this hook and try to dump() the content, no dump appears in the symfony debugger, and no more hooks appear. + * For security reasons, I like to use the before hook, and put it in a try/catch + * + * @param array $parameters + * + * @return void + */ + public function hookActionDispatcherBefore($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + try { + /* + * Class "ActionDispatcherLegacyHooksSubscriber" as implement in 1.7.3.0: + * https://github.com/PrestaShop/PrestaShop/commit/a4ae4544cc62c818aba8b3d9254308f538b7acdc + */ + if ($parameters['controller_type'] != 2) { + return; + } + + if (array_key_exists('route', $parameters)) { + $route = $parameters['route']; + + // when translation is edited or reset, add to incremental sync + if ($route == 'api_translation_value_edit' || $route == 'api_translation_value_reset') { + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_TRANSLATIONS => 0], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + } catch (\Exception $e) { + return; + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectSpecificPriceAddAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + $specificPrice = $parameters['object']; + + if ($specificPrice instanceof \SpecificPrice && isset($specificPrice->id)) { + $synchronizationService->sendLiveSync(Config::COLLECTION_SPECIFIC_PRICES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_SPECIFIC_PRICES => $specificPrice->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectSpecificPriceUpdateAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \SpecificPrice $specificPrice */ + $specificPrice = $parameters['object']; + + if ($specificPrice->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_SPECIFIC_PRICES, Config::INCREMENTAL_TYPE_UPSERT); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_SPECIFIC_PRICES => $specificPrice->id], + Config::INCREMENTAL_TYPE_UPSERT, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } + + /** + * @param array $parameters + * + * @return void + */ + public function hookActionObjectSpecificPriceDeleteAfter($parameters) + { + /** @var SynchronizationService $synchronizationService * */ + $synchronizationService = $this->getService(Config::SYNC_SERVICE_NAME); + + /** @var \SpecificPrice $specificPrice */ + $specificPrice = $parameters['object']; + + if ($specificPrice->id) { + $synchronizationService->sendLiveSync(Config::COLLECTION_SPECIFIC_PRICES, Config::INCREMENTAL_TYPE_DELETE); + $synchronizationService->insertContentIntoIncremental( + [Config::COLLECTION_SPECIFIC_PRICES => $specificPrice->id], + Config::INCREMENTAL_TYPE_DELETE, + date(DATE_ATOM), + $this->shopId, + false + ); + } + } +} diff --git a/tests/phpstan/phpstan-1-6.neon b/tests/phpstan/phpstan-1-6.neon index be2d56ce..050c969a 100644 --- a/tests/phpstan/phpstan-1-6.neon +++ b/tests/phpstan/phpstan-1-6.neon @@ -1,6 +1,6 @@ parameters: ignoreErrors: - - '#Parameter \#1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array given#' + - '#Parameter \#1 \$hook_name of method ModuleCore::registerHook\(\) expects string, array given#' - '#Access to undefined constant Module::MULTISTORE_COMPATIBILITY_YES#' - '#Property ObjectModelCore::\$id \(int\) in isset\(\) is not nullable#' - '#Call to method buildRepository\(\) on an unknown class PrestaShop\\PrestaShop\\Core\\Addon\\Theme\\ThemeManagerBuilder.#' diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon index 5114a8eb..0211e05d 100644 --- a/tests/phpstan/phpstan.neon +++ b/tests/phpstan/phpstan.neon @@ -17,13 +17,12 @@ parameters: - '#Cannot call method getOrRefreshToken\(\) on mixed.#' - '#Cannot call method getMetadata\(\) on mixed.#' - '#Method PrestaShop\\Module\\PsEventbus\\Api\\Post\\PostFileApi::getContent\(\) should return Psr\\Http\\Message\\StreamInterface but returns mixed.#' - - '#Property PrestaShop\\Module\\PsEventbus\\Controller\\AbstractApiController::[a-zA-Z0-9\\_\$\(\) ]+ does not accept mixed.#' - '#Cannot call method getShopUuid\(\) on mixed.#' - '#Cannot call method getPsAccountsService\(\) on mixed.#' - '#Cannot call method handle\(\) on mixed.#' - '#Cannot access property [a-z\$]+ on Context\|null.#' - '#Parameter \#2 \$currency of static method ToolsCore::convertPrice\(\) expects array\|object\|null, [a-z0-9<>,-\| ]+ given.#' - - '#Method PrestaShop\\Module\\PsEventbus\\Service\\SpecificPriceService::priceCalculation\(\) never returns void so it can be removed from the return type.#' + - '#Method PrestaShop\\Module\\PsEventbus\\Service\\ShopContent\\SpecificPricesService::priceCalculation\(\) never returns void so it can be removed from the return type.#' - '#Property PrestaShop\\Module\\PsEventbus\\Api\\Post\\Stream::\$stream \(resource\) does not accept null.#' - '#Cannot call method prepare\(\) on mysqli\|PDO\|resource.#' - '#Cannot call method bindParam\(\) on mysqli_stmt\|PDOStatement\|false.#' @@ -36,7 +35,7 @@ parameters: - '#Parameter \#2 \$type of static method TaxManagerFactoryCore::getManager\(\) expects string, int given.#' - '#Method PrestaShop\\Module\\PsEventbus\\Factory\\ContextFactory::getController\(\) has invalid return type PrestaShopBundle\\Bridge\\AdminController\\LegacyControllerBridgeInterface.#' - '#Cannot call method getService\(\) on ModuleCore\|false.#' - - '#Method PrestaShop\\Module\\PsEventbus\\Service\\SpecificPriceService::getPriceStatic\(\) never returns void so it can be removed from the return type.#' + - '#Method PrestaShop\\Module\\PsEventbus\\Service\\ShopContent\\SpecificPricesService::getPriceStatic\(\) never returns void so it can be removed from the return type.#' - '#Call to an undefined method object::findForUpdates\(\).#' - '#Property PrestaShop\\Module\\PsEventbus\\Helper\\ModuleHelper::\$moduleManager has unknown class PrestaShop\\PrestaShop\\Core\\Module\\ModuleManager as its type.#' @@ -46,4 +45,7 @@ parameters: - '#Property PrestaShop\\Module\\PsEventbus\\Helper\\ModuleHelper::\$moduleManager has unknown class PrestaShop\\PrestaShop\\Core\\Addon\\Module\\ModuleManager as its type.#' - '#Call to method isInstalled\(\) on an unknown class PrestaShop\\PrestaShop\\Core\\Addon\\Module\\ModuleManager.#' - '#Call to method isEnabled\(\) on an unknown class PrestaShop\\PrestaShop\\Core\\Addon\\Module\\ModuleManager.#' + - '#Constant PS_EVENTBUS_LOGS_ENABLED not found.#' + - '#Constant PS_EVENTBUS_VERBOSE_ENABLED not found.#' + - '#Constant PS_EVENTBUS_EXPLAIN_SQL_ENABLED not found.#' level: 8 diff --git a/translations/en.php b/translations/en.php index 3f27b6db..811bb906 100644 --- a/translations/en.php +++ b/translations/en.php @@ -1,4 +1,29 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + global $_MODULE; $_MODULE = array(); $_MODULE['<{ps_eventbus}prestashop>ps_eventbus_5aa8d80fbd2c1cd4eb908ed27db0e4f2'] = 'PrestaShop EventBus'; diff --git a/translations/es.php b/translations/es.php index 314ad396..e5a9d557 100644 --- a/translations/es.php +++ b/translations/es.php @@ -1,4 +1,29 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + global $_MODULE; $_MODULE = array(); $_MODULE['<{ps_eventbus}prestashop>ps_eventbus_5aa8d80fbd2c1cd4eb908ed27db0e4f2'] = 'PrestaShop EventBus'; diff --git a/translations/fr.php b/translations/fr.php index 8126e1f5..bf8693f5 100644 --- a/translations/fr.php +++ b/translations/fr.php @@ -1,4 +1,29 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + global $_MODULE; $_MODULE = array(); $_MODULE['<{ps_eventbus}prestashop>ps_eventbus_5aa8d80fbd2c1cd4eb908ed27db0e4f2'] = 'PrestaShop EventBus'; diff --git a/translations/it.php b/translations/it.php index 91fd9fc0..b1f0cf60 100644 --- a/translations/it.php +++ b/translations/it.php @@ -1,4 +1,29 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + global $_MODULE; $_MODULE = array(); $_MODULE['<{ps_eventbus}prestashop>ps_eventbus_5aa8d80fbd2c1cd4eb908ed27db0e4f2'] = 'PrestaShop EventBus'; diff --git a/upgrade/Upgrade-1.10.0.php b/upgrade/Upgrade-1.10.0.php index 0610a1fe..7ef36e4f 100644 --- a/upgrade/Upgrade-1.10.0.php +++ b/upgrade/Upgrade-1.10.0.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.10.3.php b/upgrade/Upgrade-1.10.3.php index 662a0e30..228f79b5 100644 --- a/upgrade/Upgrade-1.10.3.php +++ b/upgrade/Upgrade-1.10.3.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.10.7.php b/upgrade/Upgrade-1.10.7.php index 806e7fa0..ab10f02a 100644 --- a/upgrade/Upgrade-1.10.7.php +++ b/upgrade/Upgrade-1.10.7.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.10.8.php b/upgrade/Upgrade-1.10.8.php index 03fae974..2c67432f 100644 --- a/upgrade/Upgrade-1.10.8.php +++ b/upgrade/Upgrade-1.10.8.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.3.7.php b/upgrade/Upgrade-1.3.7.php index 7e0fa605..57d5a054 100644 --- a/upgrade/Upgrade-1.3.7.php +++ b/upgrade/Upgrade-1.3.7.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @param Ps_eventbus $module diff --git a/upgrade/Upgrade-1.5.1.php b/upgrade/Upgrade-1.5.1.php index 50e06306..cc577a95 100644 --- a/upgrade/Upgrade-1.5.1.php +++ b/upgrade/Upgrade-1.5.1.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.5.2.php b/upgrade/Upgrade-1.5.2.php index 111eac3b..7168e3f5 100644 --- a/upgrade/Upgrade-1.5.2.php +++ b/upgrade/Upgrade-1.5.2.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @param Ps_eventbus $module diff --git a/upgrade/Upgrade-1.6.9.php b/upgrade/Upgrade-1.6.9.php index 7319f00b..5035670b 100644 --- a/upgrade/Upgrade-1.6.9.php +++ b/upgrade/Upgrade-1.6.9.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @param Ps_eventbus $module diff --git a/upgrade/Upgrade-1.7.1.php b/upgrade/Upgrade-1.7.1.php index 11270927..04df0964 100644 --- a/upgrade/Upgrade-1.7.1.php +++ b/upgrade/Upgrade-1.7.1.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.7.11.php b/upgrade/Upgrade-1.7.11.php index 340a5f31..4364d5ac 100644 --- a/upgrade/Upgrade-1.7.11.php +++ b/upgrade/Upgrade-1.7.11.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.7.15.php b/upgrade/Upgrade-1.7.15.php index b9123b69..217fc9a0 100644 --- a/upgrade/Upgrade-1.7.15.php +++ b/upgrade/Upgrade-1.7.15.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.7.2.php b/upgrade/Upgrade-1.7.2.php index 804405cb..f546b7ec 100644 --- a/upgrade/Upgrade-1.7.2.php +++ b/upgrade/Upgrade-1.7.2.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} use PrestaShop\Module\PsEventbus\Config\Config; diff --git a/upgrade/Upgrade-1.8.1.php b/upgrade/Upgrade-1.8.1.php index 536a053f..7cf3e632 100644 --- a/upgrade/Upgrade-1.8.1.php +++ b/upgrade/Upgrade-1.8.1.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-1.9.3.php b/upgrade/Upgrade-1.9.3.php index 86110ba0..907cd115 100644 --- a/upgrade/Upgrade-1.9.3.php +++ b/upgrade/Upgrade-1.9.3.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @param Ps_eventbus $module diff --git a/upgrade/Upgrade-1.9.7.php b/upgrade/Upgrade-1.9.7.php index 1a5fe6f6..a376e878 100644 --- a/upgrade/Upgrade-1.9.7.php +++ b/upgrade/Upgrade-1.9.7.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-2.1.0.php b/upgrade/Upgrade-2.1.0.php index 3fd7136f..09daa220 100644 --- a/upgrade/Upgrade-2.1.0.php +++ b/upgrade/Upgrade-2.1.0.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-2.3.0.php b/upgrade/Upgrade-2.3.0.php index 4950c157..5667c050 100644 --- a/upgrade/Upgrade-2.3.0.php +++ b/upgrade/Upgrade-2.3.0.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-2.3.2.php b/upgrade/Upgrade-2.3.2.php index 16b9c5b6..18e110e2 100644 --- a/upgrade/Upgrade-2.3.2.php +++ b/upgrade/Upgrade-2.3.2.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-3.0.0.php b/upgrade/Upgrade-3.0.0.php index 381166aa..50e275cd 100644 --- a/upgrade/Upgrade-3.0.0.php +++ b/upgrade/Upgrade-3.0.0.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-3.0.12.php b/upgrade/Upgrade-3.0.12.php index cb99be1f..28310cd1 100644 --- a/upgrade/Upgrade-3.0.12.php +++ b/upgrade/Upgrade-3.0.12.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-3.0.13.php b/upgrade/Upgrade-3.0.13.php index 339c0cd4..6d2befa8 100644 --- a/upgrade/Upgrade-3.0.13.php +++ b/upgrade/Upgrade-3.0.13.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} use PrestaShop\Module\PsEventbus\Config\Config; diff --git a/upgrade/Upgrade-3.0.5.php b/upgrade/Upgrade-3.0.5.php index 8f7b8488..47a2ef1b 100644 --- a/upgrade/Upgrade-3.0.5.php +++ b/upgrade/Upgrade-3.0.5.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-3.2.1.php b/upgrade/Upgrade-3.2.1.php index aa0e23b3..d41f0e60 100644 --- a/upgrade/Upgrade-3.2.1.php +++ b/upgrade/Upgrade-3.2.1.php @@ -1,4 +1,31 @@ + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} /** * @return bool diff --git a/upgrade/Upgrade-4.0.0.php b/upgrade/Upgrade-4.0.0.php new file mode 100644 index 00000000..08c83fbf --- /dev/null +++ b/upgrade/Upgrade-4.0.0.php @@ -0,0 +1,99 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ +if (!defined('_PS_VERSION_')) { + exit; +} + +/** + * @return bool + */ +function upgrade_module_4_0_0() +{ + $db = Db::getInstance(); + + // Add primary key to eventbus_type_sync + $editTypeSyncTable = 'ALTER TABLE `' . _DB_PREFIX_ . 'eventbus_type_sync` ADD PRIMARY KEY (type, id_shop, lang_iso);'; + $editTypeSyncTableResult = $db->query($editTypeSyncTable); + + // If ALTER is failed, stop update process + if (!$editTypeSyncTableResult) { + return false; + } + + // Update eventbus_incremental_sync and add 'action' column + $editIncrementalTable = 'ALTER TABLE `' . _DB_PREFIX_ . 'eventbus_incremental_sync` ADD action varchar(50) NOT NULL;'; + $editIncrementalTableResult = $db->query($editIncrementalTable); + + // If ALTER is failed, stop update process + if (!$editIncrementalTableResult) { + return false; + } + + // Backup data from eventbus_deleted_objects + $backupDeletedTable = 'SELECT * FROM `' . _DB_PREFIX_ . 'eventbus_deleted_objects`'; + $backupDeletedTableResult = $db->executeS($backupDeletedTable); + + $elementsCount = count($backupDeletedTableResult); + $index = 0; + + // Insert data from backup into incremental table + $updateIncrementalTable = 'INSERT INTO `' . _DB_PREFIX_ . 'eventbus_incremental_sync` (type, id_object, id_shop, lang_iso, created_at, action) VALUES '; + + foreach ($backupDeletedTableResult as $deletedContent) { + $updateIncrementalTable .= "( + '{$db->escape($deletedContent['type'])}', + {$db->escape($deletedContent['id_object'])}, + {$db->escape($deletedContent['id_shop'])}, + {$db->escape($deletedContent['created_at'])}', + deleted' + )"; + + if (++$index < $elementsCount) { + $updateIncrementalTable .= ','; + } + } + + $updateIncrementalTable .= ' + ON DUPLICATE KEY UPDATE + type = VALUES(type), + id_object = VALUES(id_object), + id_shop = VALUES(id_shop), + created_at = VALUES(created_at) + action = deleted + '; + + $updateIncrementalTableResult = (bool) $db->query($updateIncrementalTable); + + // If insert backup is failed, stop update process + if (!$updateIncrementalTableResult) { + return false; + } + + // Drop eventbus_deleted_objects table + $dropDeletedTable = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'eventbus_deleted_objects`'; + + return (bool) $db->query($dropDeletedTable); +}