From 19bde580479a6784cfd343dacf6edd39685e82f3 Mon Sep 17 00:00:00 2001 From: Ondra Jodas Date: Mon, 7 Feb 2022 00:05:03 +0100 Subject: [PATCH 1/3] migration script config -> configRow --- composer.json | 1 + composer.lock | 707 +++++++++++++++++---- docker-compose.yml | 4 + phpstan.neon | 2 +- src/Component.php | 6 + src/Configuration/Config.php | 5 + src/Configuration/MigrateConfiguration.php | 71 +++ src/Configuration/OldConfigDefinition.php | 1 + 8 files changed, 689 insertions(+), 108 deletions(-) create mode 100644 src/Configuration/MigrateConfiguration.php diff --git a/composer.json b/composer.json index d3d5c13..99eee2a 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "keboola/csv": "^1.1", "keboola/google-client-bundle": "^5.1", "keboola/php-component": "^8.1", + "keboola/storage-api-client": "^12.9", "symfony/config": "^5.2", "symfony/finder": "^5.2", "symfony/process": "^5.2" diff --git a/composer.lock b/composer.lock index 4718cbd..2acffb1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,149 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ad7ad93106d0603588980390f2761ecf", + "content-hash": "a0bd1867882eecf86b17c01680f6c6ca", "packages": [ + { + "name": "aws/aws-crt-php", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/awslabs/aws-crt-php.git", + "reference": "3942776a8c99209908ee0b287746263725685732" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/3942776a8c99209908ee0b287746263725685732", + "reference": "3942776a8c99209908ee0b287746263725685732", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35|^5.4.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "AWS SDK Common Runtime Team", + "email": "aws-sdk-common-runtime@amazon.com" + } + ], + "description": "AWS Common Runtime for PHP", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "crt", + "sdk" + ], + "support": { + "issues": "https://github.com/awslabs/aws-crt-php/issues", + "source": "https://github.com/awslabs/aws-crt-php/tree/v1.0.2" + }, + "time": "2021-09-03T22:57:30+00:00" + }, + { + "name": "aws/aws-sdk-php", + "version": "3.209.17", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "3ed5a5ff379e518a4e8c089e412207774daa25e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3ed5a5ff379e518a4e8c089e412207774daa25e7", + "reference": "3ed5a5ff379e518a4e8c089e412207774daa25e7", + "shasum": "" + }, + "require": { + "aws/aws-crt-php": "^1.0.2", + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0", + "guzzlehttp/promises": "^1.4.0", + "guzzlehttp/psr7": "^1.7.0|^2.0", + "mtdowling/jmespath.php": "^2.6", + "php": ">=5.5" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "paragonie/random_compat": ">= 2", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0", + "sebastian/comparator": "^1.2.3" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Aws\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "support": { + "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", + "issues": "https://github.com/aws/aws-sdk-php/issues", + "source": "https://github.com/aws/aws-sdk-php/tree/3.209.17" + }, + "time": "2022-02-03T19:19:22+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.5.5", @@ -79,16 +220,16 @@ }, { "name": "guzzlehttp/promises", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "60d379c243457e073cff02bc323a2a86cb355631" + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", - "reference": "60d379c243457e073cff02bc323a2a86cb355631", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", "shasum": "" }, "require": { @@ -100,7 +241,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -116,10 +257,25 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", @@ -128,22 +284,36 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.4.0" + "source": "https://github.com/guzzle/promises/tree/1.5.1" }, - "time": "2020-09-30T07:37:28+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:56:57+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.7.0", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" + "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", - "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", + "reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", "shasum": "" }, "require": { @@ -168,25 +338,46 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], @@ -203,9 +394,23 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.7.0" + "source": "https://github.com/guzzle/psr7/tree/1.8.3" }, - "time": "2020-09-30T07:37:11+00:00" + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2021-10-05T13:56:00+00:00" }, { "name": "keboola/common-exceptions", @@ -249,53 +454,38 @@ }, { "name": "keboola/csv", - "version": "1.4.2", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/keboola/php-csv.git", - "reference": "eb77f51e22d3e13a8e14a5d5a0b588cf9e8c56c5" + "reference": "d7e257096c42eab09b54b7b46a905ca953a8eb6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/keboola/php-csv/zipball/eb77f51e22d3e13a8e14a5d5a0b588cf9e8c56c5", - "reference": "eb77f51e22d3e13a8e14a5d5a0b588cf9e8c56c5", + "url": "https://api.github.com/repos/keboola/php-csv/zipball/d7e257096c42eab09b54b7b46a905ca953a8eb6f", + "reference": "d7e257096c42eab09b54b7b46a905ca953a8eb6f", "shasum": "" }, - "require": { - "php": ">=5.6" - }, "require-dev": { - "codeclimate/php-test-reporter": "^0.4", - "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "^3.2" + "phpunit/phpunit": "~3.7" }, "type": "library", "autoload": { - "psr-4": { - "Keboola\\Csv\\": "src/" + "psr-0": { + "Keboola\\Csv": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Keboola", - "email": "devel@keboola.com" - } - ], "description": "Keboola CSV reader and writer", "homepage": "http://keboola.com", - "keywords": [ - "csv", - "rfc4180" - ], "support": { "issues": "https://github.com/keboola/php-csv/issues", "source": "https://github.com/keboola/php-csv/tree/master" }, - "time": "2018-05-14T07:45:45+00:00" + "time": "2016-04-21T20:46:22+00:00" }, { "name": "keboola/google-client-bundle", @@ -412,6 +602,160 @@ }, "time": "2020-04-30T11:08:47+00:00" }, + { + "name": "keboola/storage-api-client", + "version": "v12.9.1", + "source": { + "type": "git", + "url": "https://github.com/keboola/storage-api-php-client.git", + "reference": "bba492e2538fff2d1b7f80a56355e048c73563a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/keboola/storage-api-php-client/zipball/bba492e2538fff2d1b7f80a56355e048c73563a8", + "reference": "bba492e2538fff2d1b7f80a56355e048c73563a8", + "shasum": "" + }, + "require": { + "aws/aws-sdk-php": "~3.2", + "guzzlehttp/guzzle": "~6.0", + "keboola/csv": "~1.1.3", + "microsoft/azure-storage-blob": "^1.4", + "php": ">=5.6", + "psr/log": "~1.0", + "symfony/filesystem": "^5.0||^4.0||^3.0||~2.3", + "symfony/process": "^5.0||^4.0||^3.0||~2.3" + }, + "require-dev": { + "apigen/apigen": "4.0.0-RC4", + "brianium/paratest": "2.*", + "ext-pdo": "*", + "ext-pdo_pgsql": "*", + "keboola/php-csv-db-import": "^2.2", + "keboola/retry": "^0.5.0", + "keboola/table-backend-utils": "^0.16", + "phpcompatibility/php-compatibility": "*", + "phpstan/phpstan": "^1.0", + "phpunit/phpunit": "^7.0", + "squizlabs/php_codesniffer": "^3" + }, + "type": "library", + "autoload": { + "files": [ + "src/Keboola/StorageApi/createSimpleJobPollDelay.php" + ], + "psr-0": { + "Keboola\\StorageApi": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Keboola Storage API PHP CLient", + "homepage": "http://keboola.com", + "support": { + "issues": "https://github.com/keboola/storage-api-php-client/issues", + "source": "https://github.com/keboola/storage-api-php-client/tree/v12.9.1" + }, + "time": "2021-12-10T10:22:40+00:00" + }, + { + "name": "microsoft/azure-storage-blob", + "version": "1.5.3", + "source": { + "type": "git", + "url": "https://github.com/Azure/azure-storage-blob-php.git", + "reference": "9aec3e152dab8cd9ec64fd89ed71129a0402c4be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Azure/azure-storage-blob-php/zipball/9aec3e152dab8cd9ec64fd89ed71129a0402c4be", + "reference": "9aec3e152dab8cd9ec64fd89ed71129a0402c4be", + "shasum": "" + }, + "require": { + "microsoft/azure-storage-common": "~1.5", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "MicrosoftAzure\\Storage\\Blob\\": "src/Blob" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Azure Storage PHP Client Library", + "email": "dmsh@microsoft.com" + } + ], + "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.", + "keywords": [ + "azure", + "blob", + "php", + "sdk", + "storage" + ], + "support": { + "issues": "https://github.com/Azure/azure-storage-blob-php/issues", + "source": "https://github.com/Azure/azure-storage-blob-php/tree/v1.5.3" + }, + "time": "2021-10-09T03:13:46+00:00" + }, + { + "name": "microsoft/azure-storage-common", + "version": "1.5.2", + "source": { + "type": "git", + "url": "https://github.com/Azure/azure-storage-common-php.git", + "reference": "8ca7b1bf4c9ca7c663e75a02a0035b05b37196a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Azure/azure-storage-common-php/zipball/8ca7b1bf4c9ca7c663e75a02a0035b05b37196a0", + "reference": "8ca7b1bf4c9ca7c663e75a02a0035b05b37196a0", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "~6.0|^7.0", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "MicrosoftAzure\\Storage\\Common\\": "src/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Azure Storage PHP Client Library", + "email": "dmsh@microsoft.com" + } + ], + "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.", + "keywords": [ + "azure", + "common", + "php", + "sdk", + "storage" + ], + "support": { + "issues": "https://github.com/Azure/azure-storage-common-php/issues", + "source": "https://github.com/Azure/azure-storage-common-php/tree/v1.5.2" + }, + "time": "2021-10-09T03:03:47+00:00" + }, { "name": "monolog/monolog", "version": "2.2.0", @@ -508,6 +852,67 @@ ], "time": "2020-12-14T13:15:25+00:00" }, + { + "name": "mtdowling/jmespath.php", + "version": "2.6.1", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/9b87907a81b87bc76d19a7fb2d61e61486ee9edb", + "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.17" + }, + "require-dev": { + "composer/xdebug-handler": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^7.5.15" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "JmesPath\\": "src/" + }, + "files": [ + "src/JmesPath.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "support": { + "issues": "https://github.com/jmespath/jmespath.php/issues", + "source": "https://github.com/jmespath/jmespath.php/tree/2.6.1" + }, + "time": "2021-06-14T00:11:39+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -563,16 +968,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -596,7 +1001,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -607,9 +1012,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "ralouphie/getallheaders", @@ -735,16 +1140,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.2.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { @@ -753,7 +1158,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -782,7 +1187,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/master" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -798,25 +1203,27 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/filesystem", - "version": "v5.2.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "bb92ba7f38b037e531908590a858a04d85c0e238" + "reference": "0f0c4bf1840420f4aef3f32044a9dbb24682731b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb92ba7f38b037e531908590a858a04d85c0e238", - "reference": "bb92ba7f38b037e531908590a858a04d85c0e238", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f0c4bf1840420f4aef3f32044a9dbb24682731b", + "reference": "0f0c4bf1840420f4aef3f32044a9dbb24682731b", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8" + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -841,10 +1248,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.2.0" + "source": "https://github.com/symfony/filesystem/tree/v5.4.3" }, "funding": [ { @@ -860,7 +1267,7 @@ "type": "tidelift" } ], - "time": "2020-11-12T09:58:18+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/finder", @@ -925,28 +1332,31 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.20.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -984,7 +1394,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -1000,20 +1410,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.20.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117" + "reference": "749045c69efb97c70d25d7463abba812e91f3a44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3b75acd829741c768bc8b1f84eb33265e7cc5117", - "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44", "shasum": "" }, "require": { @@ -1027,7 +1437,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1071,7 +1481,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.24.0" }, "funding": [ { @@ -1087,20 +1497,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-09-14T14:02:44+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.20.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "727d1096295d807c309fb01a851577302394c897" + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897", - "reference": "727d1096295d807c309fb01a851577302394c897", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { @@ -1112,7 +1522,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1155,7 +1565,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" }, "funding": [ { @@ -1171,20 +1581,103 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.20.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930" + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cede45fcdfabdd6043b3592e83678e42ec69e930", - "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", "shasum": "" }, "require": { @@ -1193,7 +1686,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1231,7 +1724,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.24.0" }, "funding": [ { @@ -1247,20 +1740,20 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-05-27T09:17:38+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.20.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de" + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de", - "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { @@ -1269,7 +1762,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -1314,7 +1807,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" }, "funding": [ { @@ -1330,25 +1823,25 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-09-13T13:58:33+00:00" }, { "name": "symfony/process", - "version": "v5.2.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "240e74140d4d956265048f3025c0aecbbc302d54" + "reference": "553f50487389a977eb31cf6b37faae56da00f753" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/240e74140d4d956265048f3025c0aecbbc302d54", - "reference": "240e74140d4d956265048f3025c0aecbbc302d54", + "url": "https://api.github.com/repos/symfony/process/zipball/553f50487389a977eb31cf6b37faae56da00f753", + "reference": "553f50487389a977eb31cf6b37faae56da00f753", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -1373,10 +1866,10 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.2.0" + "source": "https://github.com/symfony/process/tree/v5.4.3" }, "funding": [ { @@ -1392,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2020-11-02T15:47:15+00:00" + "time": "2022-01-26T16:28:35+00:00" }, { "name": "symfony/serializer", @@ -3761,5 +4254,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/docker-compose.yml b/docker-compose.yml index b2d3fb9..360d2f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,10 @@ services: - ACCESS_TOKEN - REFRESH_TOKEN - VIEW_ID + - KBC_URL + - KBC_TOKEN + - KBC_CONFIGID + - KBC_COMPONENTID dev: <<: *main diff --git a/phpstan.neon b/phpstan.neon index 73582c4..a6bb8ca 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,5 +2,5 @@ parameters: checkMissingIterableValueType: false ignoreErrors: - '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\).#' - - '#Cannot call method integerNode\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null\.#' + - '#Cannot call method scalarNode\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null\.#' - '#logger of class Keboola\\Google\\ClientBundle\\Google\\RestApi constructor expects Monolog\\Logger\|null, Psr\\Log\\LoggerInterface given\.#' diff --git a/src/Component.php b/src/Component.php index 21b612e..dc5820a 100644 --- a/src/Component.php +++ b/src/Component.php @@ -12,6 +12,7 @@ use Keboola\GoogleAnalyticsExtractor\Configuration\Config; use Keboola\GoogleAnalyticsExtractor\Configuration\ConfigDefinition; use Keboola\GoogleAnalyticsExtractor\Configuration\ConfigGetProfilesPropertiesDefinition; +use Keboola\GoogleAnalyticsExtractor\Configuration\MigrateConfiguration; use Keboola\GoogleAnalyticsExtractor\Configuration\OldConfigDefinition; use Keboola\GoogleAnalyticsExtractor\Exception\ApplicationException; use Keboola\GoogleAnalyticsExtractor\Extractor\Extractor; @@ -36,6 +37,11 @@ public function getConfig(): Config protected function run(): void { + if ($this->getConfig()->migrateConfiguration() === true) { + $migrateConfiguration = new MigrateConfiguration((string) getenv('KBC_CONFIGID')); + $migrateConfiguration->migrate(); + } + try { foreach ($this->getConfig()->getQueries($this->getConfigDefinitionClass()) as $query) { $this->runQuery($query); diff --git a/src/Configuration/Config.php b/src/Configuration/Config.php index 4abee2d..56099c0 100644 --- a/src/Configuration/Config.php +++ b/src/Configuration/Config.php @@ -8,6 +8,11 @@ class Config extends BaseConfig { + public function migrateConfiguration(): bool + { + return $this->getValue(['parameters', 'migrateConfiguration'], false); + } + public function hasProfiles(): bool { return !empty($this->getValue(['parameters', 'profiles'], false)); diff --git a/src/Configuration/MigrateConfiguration.php b/src/Configuration/MigrateConfiguration.php new file mode 100644 index 0000000..3d453ce --- /dev/null +++ b/src/Configuration/MigrateConfiguration.php @@ -0,0 +1,71 @@ +client = $this->getClient(); + $this->configurationId = $configurationId; + $this->componentId = (string) getenv('KBC_COMPONENTID'); + } + + public function migrate(): void + { + $components = new Components($this->client); + + $configuration = $components->getConfiguration($this->componentId, $this->configurationId); + + $configuration = $configuration['configuration']; + + $queries = $configuration['parameters']['queries']; + + unset($configuration['parameters']['queries']); + + $componentConfiguration = new Configuration(); + $componentConfiguration + ->setComponentId($this->componentId) + ->setConfigurationId($this->configurationId) + ->setChangeDescription('Migrate configuration to configRow.') + ->setConfiguration($configuration) + ; + + foreach ($queries as $query) { + $queryName = $query['name']; + $enabled = $query['enabled']; + unset($query['name'], $query['enabled']); + + $row = new ConfigurationRow($componentConfiguration); + $row + ->setName($queryName) + ->setConfiguration($query) + ->setIsDisabled(!$enabled) + ; + $components->addConfigurationRow($row); + } + + $components->updateConfiguration($componentConfiguration); + } + + private function getClient(): Client + { + return new Client([ + 'url' => getenv('KBC_URL'), + 'token' => getenv('KBC_TOKEN'), + ]); + } +} diff --git a/src/Configuration/OldConfigDefinition.php b/src/Configuration/OldConfigDefinition.php index 4b54051..4afd204 100644 --- a/src/Configuration/OldConfigDefinition.php +++ b/src/Configuration/OldConfigDefinition.php @@ -16,6 +16,7 @@ public function getParametersDefinition(): ArrayNodeDefinition $parametersNode ->ignoreExtraKeys() ->children() + ->booleanNode('migrateConfiguration')->defaultFalse()->end() ->scalarNode('outputBucket') ->isRequired() ->cannotBeEmpty() From 891732e10c21400ec5701c9fcb739c0da7c9b895 Mon Sep 17 00:00:00 2001 From: Ondra Jodas Date: Mon, 7 Feb 2022 00:12:05 +0100 Subject: [PATCH 2/3] test: migrate configuration --- .github/workflows/push.yml | 5 +- .../MigrateConfigurationTest.php | 135 ++++++++++++++++++ 2 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 tests/Keboola/GoogleAnalyticsExtractor/Configuration/MigrateConfigurationTest.php diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 965bd47..0e7612c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -11,6 +11,9 @@ env: KBC_DEVELOPERPORTAL_PASSWORD: ${{ secrets.KBC_DEVELOPERPORTAL_PASSWORD }} ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} + KBC_URL: "https://connection.keboola.com" + KBC_TOKEN: ${{ secrets.KBC_TOKEN }} + KBC_COMPONENTID: "keboola.ex-google-analytics-v4" jobs: Build: runs-on: ubuntu-latest @@ -23,7 +26,7 @@ jobs: - name: Build image and run tests run: | docker build -t $APP_IMAGE . - docker run -e CLIENT_ID -e CLIENT_SECRET -e ACCESS_TOKEN -e REFRESH_TOKEN -e VIEW_ID $APP_IMAGE composer ci + docker run -e CLIENT_ID -e CLIENT_SECRET -e ACCESS_TOKEN -e REFRESH_TOKEN -e VIEW_ID $APP_IMAGE -e KBC_URL -e KBC_TOKEN -e KBC_COMPONENTID composer ci - name: Push image to ECR run: | docker pull quay.io/keboola/developer-portal-cli-v2:latest diff --git a/tests/Keboola/GoogleAnalyticsExtractor/Configuration/MigrateConfigurationTest.php b/tests/Keboola/GoogleAnalyticsExtractor/Configuration/MigrateConfigurationTest.php new file mode 100644 index 0000000..38d5b5a --- /dev/null +++ b/tests/Keboola/GoogleAnalyticsExtractor/Configuration/MigrateConfigurationTest.php @@ -0,0 +1,135 @@ +client = new Client([ + 'url' => (string) getenv('KBC_URL'), + 'token' => (string) getenv('KBC_TOKEN'), + ]); + + parent::setUp(); + } + + public function testMigrate(): void + { + $configurationArray = json_decode($this->getConfig(), true); + + $components = new Components($this->client); + + $configuration = new Configuration(); + $configuration + ->setName('testMigrationConfig') + ->setComponentId('keboola.ex-google-analytics-v4') + ->setConfiguration($configurationArray) + ; + $savedConfig = $components->addConfiguration($configuration); + + $migrate = new MigrateConfiguration($savedConfig['id']); + $migrate->migrate(); + + $migratedConfiguration = $components->getConfiguration( + 'keboola.ex-google-analytics-v4', + $savedConfig['id'] + ); + + $query = $configurationArray['parameters']['queries'][0]; + unset($query['name'], $query['enabled']); + + Assert::assertEquals($query, $migratedConfiguration['rows'][0]['configuration']); + Assert::assertEquals( + $configurationArray['parameters']['profiles'], + $migratedConfiguration['configuration']['parameters']['profiles'] + ); + Assert::assertEquals( + $configurationArray['parameters']['outputBucket'], + $migratedConfiguration['configuration']['parameters']['outputBucket'] + ); + + $components->deleteConfiguration( + 'keboola.ex-google-analytics-v4', + $savedConfig['id'] + ); + } + + private function getConfig(): string + { + return << Date: Mon, 7 Feb 2022 00:14:02 +0100 Subject: [PATCH 3/3] fix CI --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 0e7612c..676c598 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -26,7 +26,7 @@ jobs: - name: Build image and run tests run: | docker build -t $APP_IMAGE . - docker run -e CLIENT_ID -e CLIENT_SECRET -e ACCESS_TOKEN -e REFRESH_TOKEN -e VIEW_ID $APP_IMAGE -e KBC_URL -e KBC_TOKEN -e KBC_COMPONENTID composer ci + docker run -e CLIENT_ID -e CLIENT_SECRET -e ACCESS_TOKEN -e REFRESH_TOKEN -e VIEW_ID -e KBC_URL -e KBC_TOKEN -e KBC_COMPONENTID $APP_IMAGE composer ci - name: Push image to ECR run: | docker pull quay.io/keboola/developer-portal-cli-v2:latest