diff --git a/composer.lock b/composer.lock index 31601db..c9c5e2c 100644 --- a/composer.lock +++ b/composer.lock @@ -380,16 +380,16 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v3.3.3", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "adfb1f505deb6384dc8b39804c5065dd3c8c8c0a" + "reference": "8c784d071debd117328803d86b2097615b457500" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/adfb1f505deb6384dc8b39804c5065dd3c8c8c0a", - "reference": "adfb1f505deb6384dc8b39804c5065dd3c8c8c0a", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/8c784d071debd117328803d86b2097615b457500", + "reference": "8c784d071debd117328803d86b2097615b457500", "shasum": "" }, "require": { @@ -402,10 +402,14 @@ "require-dev": { "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.0", - "phpstan/phpstan-webmozart-assert": "^1.0", "phpunit/phpunit": "^7.0|^8.0|^9.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "autoload": { "psr-4": { "Cron\\": "src/Cron/" @@ -429,7 +433,7 @@ ], "support": { "issues": "https://github.com/dragonmantank/cron-expression/issues", - "source": "https://github.com/dragonmantank/cron-expression/tree/v3.3.3" + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.4.0" }, "funding": [ { @@ -437,7 +441,7 @@ "type": "github" } ], - "time": "2023-08-10T19:36:49+00:00" + "time": "2024-10-09T13:47:03+00:00" }, { "name": "egulias/email-validator", @@ -1168,16 +1172,16 @@ }, { "name": "laravel/framework", - "version": "v11.23.5", + "version": "v11.27.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "16b31ab0e1dad5cb2ed6dcc1818c02f02fc48453" + "reference": "a51d1f2b771c542324a3d9b76a98b1bbc75c0ee9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/16b31ab0e1dad5cb2ed6dcc1818c02f02fc48453", - "reference": "16b31ab0e1dad5cb2ed6dcc1818c02f02fc48453", + "url": "https://api.github.com/repos/laravel/framework/zipball/a51d1f2b771c542324a3d9b76a98b1bbc75c0ee9", + "reference": "a51d1f2b771c542324a3d9b76a98b1bbc75c0ee9", "shasum": "" }, "require": { @@ -1196,7 +1200,7 @@ "fruitcake/php-cors": "^1.3", "guzzlehttp/guzzle": "^7.8", "guzzlehttp/uri-template": "^1.0", - "laravel/prompts": "^0.1.18", + "laravel/prompts": "^0.1.18|^0.2.0|^0.3.0", "laravel/serializable-closure": "^1.3", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", @@ -1282,7 +1286,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.6", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^9.4.0", + "orchestra/testbench-core": "^9.5", "pda/pheanstalk": "^5.0", "phpstan/phpstan": "^1.11.5", "phpunit/phpunit": "^10.5|^11.0", @@ -1341,6 +1345,7 @@ "src/Illuminate/Filesystem/functions.php", "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Log/functions.php", + "src/Illuminate/Support/functions.php", "src/Illuminate/Support/helpers.php" ], "psr-4": { @@ -1372,25 +1377,25 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-09-13T13:36:30+00:00" + "time": "2024-10-09T04:17:35+00:00" }, { "name": "laravel/prompts", - "version": "v0.1.25", + "version": "v0.3.0", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "7b4029a84c37cb2725fc7f011586e2997040bc95" + "reference": "ea57a2261093986721d4a5f4f9524d76f21f9fa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/7b4029a84c37cb2725fc7f011586e2997040bc95", - "reference": "7b4029a84c37cb2725fc7f011586e2997040bc95", + "url": "https://api.github.com/repos/laravel/prompts/zipball/ea57a2261093986721d4a5f4f9524d76f21f9fa0", + "reference": "ea57a2261093986721d4a5f4f9524d76f21f9fa0", "shasum": "" }, "require": { + "composer-runtime-api": "^2.2", "ext-mbstring": "*", - "illuminate/collections": "^10.0|^11.0", "php": "^8.1", "symfony/console": "^6.2|^7.0" }, @@ -1399,6 +1404,7 @@ "laravel/framework": ">=10.17.0 <10.25.0" }, "require-dev": { + "illuminate/collections": "^10.0|^11.0", "mockery/mockery": "^1.5", "pestphp/pest": "^2.3", "phpstan/phpstan": "^1.11", @@ -1410,7 +1416,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.1.x-dev" + "dev-main": "0.3.x-dev" } }, "autoload": { @@ -1428,22 +1434,22 @@ "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.1.25" + "source": "https://github.com/laravel/prompts/tree/v0.3.0" }, - "time": "2024-08-12T22:06:33+00:00" + "time": "2024-09-30T14:27:51+00:00" }, { "name": "laravel/serializable-closure", - "version": "v1.3.4", + "version": "v1.3.5", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "61b87392d986dc49ad5ef64e75b1ff5fee24ef81" + "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/61b87392d986dc49ad5ef64e75b1ff5fee24ef81", - "reference": "61b87392d986dc49ad5ef64e75b1ff5fee24ef81", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", + "reference": "1dc4a3dbfa2b7628a3114e43e32120cce7cdda9c", "shasum": "" }, "require": { @@ -1491,7 +1497,7 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2024-08-02T07:48:17+00:00" + "time": "2024-09-23T13:33:08+00:00" }, { "name": "league/commonmark", @@ -1683,16 +1689,16 @@ }, { "name": "league/flysystem", - "version": "3.28.0", + "version": "3.29.1", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c" + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c", - "reference": "e611adab2b1ae2e3072fa72d62c62f52c2bf1f0c", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/edc1bb7c86fab0776c3287dbd19b5fa278347319", + "reference": "edc1bb7c86fab0776c3287dbd19b5fa278347319", "shasum": "" }, "require": { @@ -1760,22 +1766,22 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/3.28.0" + "source": "https://github.com/thephpleague/flysystem/tree/3.29.1" }, - "time": "2024-05-22T10:09:12+00:00" + "time": "2024-10-08T08:58:34+00:00" }, { "name": "league/flysystem-local", - "version": "3.28.0", + "version": "3.29.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-local.git", - "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40" + "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/13f22ea8be526ea58c2ddff9e158ef7c296e4f40", - "reference": "13f22ea8be526ea58c2ddff9e158ef7c296e4f40", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e0e8d52ce4b2ed154148453d321e97c8e931bd27", + "reference": "e0e8d52ce4b2ed154148453d321e97c8e931bd27", "shasum": "" }, "require": { @@ -1809,9 +1815,9 @@ "local" ], "support": { - "source": "https://github.com/thephpleague/flysystem-local/tree/3.28.0" + "source": "https://github.com/thephpleague/flysystem-local/tree/3.29.0" }, - "time": "2024-05-06T20:05:52+00:00" + "time": "2024-08-09T21:24:39+00:00" }, { "name": "league/mime-type-detection", @@ -2078,24 +2084,24 @@ }, { "name": "nette/schema", - "version": "v1.3.0", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188" + "reference": "da801d52f0354f70a638673c4a0f04e16529431d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", - "reference": "a6d3a6d1f545f01ef38e60f375d1cf1f4de98188", + "url": "https://api.github.com/repos/nette/schema/zipball/da801d52f0354f70a638673c4a0f04e16529431d", + "reference": "da801d52f0354f70a638673c4a0f04e16529431d", "shasum": "" }, "require": { "nette/utils": "^4.0", - "php": "8.1 - 8.3" + "php": "8.1 - 8.4" }, "require-dev": { - "nette/tester": "^2.4", + "nette/tester": "^2.5.2", "phpstan/phpstan-nette": "^1.0", "tracy/tracy": "^2.8" }, @@ -2134,9 +2140,9 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.0" + "source": "https://github.com/nette/schema/tree/v1.3.2" }, - "time": "2023-12-11T11:54:22+00:00" + "time": "2024-10-06T23:10:23+00:00" }, { "name": "nette/utils", @@ -2314,33 +2320,31 @@ }, { "name": "open-telemetry/api", - "version": "1.0.3", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "87de95d926f46262885d0d390060c095af13e2e5" + "reference": "62f2abc4c6d4ef6ea897256520052f9c29a0241f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/87de95d926f46262885d0d390060c095af13e2e5", - "reference": "87de95d926f46262885d0d390060c095af13e2e5", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/62f2abc4c6d4ef6ea897256520052f9c29a0241f", + "reference": "62f2abc4c6d4ef6ea897256520052f9c29a0241f", "shasum": "" }, "require": { "open-telemetry/context": "^1.0", - "php": "^7.4 || ^8.0", + "php": "^8.1", "psr/log": "^1.1|^2.0|^3.0", - "symfony/polyfill-php80": "^1.26", - "symfony/polyfill-php81": "^1.26", "symfony/polyfill-php82": "^1.26" }, "conflict": { - "open-telemetry/sdk": "<=1.0.4" + "open-telemetry/sdk": "<=1.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.1.x-dev" } }, "autoload": { @@ -2377,26 +2381,24 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-02-06T01:32:25+00:00" + "time": "2024-09-24T23:58:09+00:00" }, { "name": "open-telemetry/context", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/context.git", - "reference": "e9d254a7c89885e63fd2fde54e31e81aaaf52b7c" + "reference": "0cba875ea1953435f78aec7f1d75afa87bdbf7f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/e9d254a7c89885e63fd2fde54e31e81aaaf52b7c", - "reference": "e9d254a7c89885e63fd2fde54e31e81aaaf52b7c", + "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/0cba875ea1953435f78aec7f1d75afa87bdbf7f3", + "reference": "0cba875ea1953435f78aec7f1d75afa87bdbf7f3", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0", - "symfony/polyfill-php80": "^1.26", - "symfony/polyfill-php81": "^1.26", + "php": "^8.1", "symfony/polyfill-php82": "^1.26" }, "suggest": { @@ -2438,20 +2440,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-01-13T05:50:44+00:00" + "time": "2024-08-21T00:29:20+00:00" }, { "name": "php-http/discovery", - "version": "1.19.4", + "version": "1.20.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "0700efda8d7526335132360167315fdab3aeb599" + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/0700efda8d7526335132360167315fdab3aeb599", - "reference": "0700efda8d7526335132360167315fdab3aeb599", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", "shasum": "" }, "require": { @@ -2515,9 +2517,9 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.19.4" + "source": "https://github.com/php-http/discovery/tree/1.20.0" }, - "time": "2024-03-29T13:00:05+00:00" + "time": "2024-10-02T11:20:13+00:00" }, { "name": "php-http/httplug", @@ -4770,82 +4772,6 @@ ], "time": "2024-09-09T11:45:10+00:00" }, - { - "name": "symfony/polyfill-php81", - "version": "v1.31.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "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 backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.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": "2024-09-09T11:45:10+00:00" - }, { "name": "symfony/polyfill-php82", "version": "v1.31.0", @@ -5991,16 +5917,16 @@ "packages-dev": [ { "name": "brianium/paratest", - "version": "v7.5.5", + "version": "v7.5.7", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "f29c7d671afc5c4e1140bd7b9f2749e827902a1e" + "reference": "4890b17f569efea5e034e519dc883da53a67448d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/f29c7d671afc5c4e1140bd7b9f2749e827902a1e", - "reference": "f29c7d671afc5c4e1140bd7b9f2749e827902a1e", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/4890b17f569efea5e034e519dc883da53a67448d", + "reference": "4890b17f569efea5e034e519dc883da53a67448d", "shasum": "" }, "require": { @@ -6014,22 +5940,22 @@ "phpunit/php-code-coverage": "^11.0.6", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-timer": "^7.0.1", - "phpunit/phpunit": "^11.3.6", + "phpunit/phpunit": "^11.4.0", "sebastian/environment": "^7.2.0", - "symfony/console": "^6.4.11 || ^7.1.4", - "symfony/process": "^6.4.8 || ^7.1.3" + "symfony/console": "^6.4.11 || ^7.1.5", + "symfony/process": "^6.4.8 || ^7.1.5" }, "require-dev": { "doctrine/coding-standard": "^12.0.0", "ext-pcov": "*", "ext-posix": "*", - "infection/infection": "^0.29.6", - "phpstan/phpstan": "^1.12.4", + "infection/infection": "^0.29.7", + "phpstan/phpstan": "^1.12.6", "phpstan/phpstan-deprecation-rules": "^1.2.1", "phpstan/phpstan-phpunit": "^1.4.0", - "phpstan/phpstan-strict-rules": "^1.6.0", + "phpstan/phpstan-strict-rules": "^1.6.1", "squizlabs/php_codesniffer": "^3.10.3", - "symfony/filesystem": "^6.4.9 || ^7.1.2" + "symfony/filesystem": "^6.4.9 || ^7.1.5" }, "bin": [ "bin/paratest", @@ -6069,7 +5995,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.5.5" + "source": "https://github.com/paratestphp/paratest/tree/v7.5.7" }, "funding": [ { @@ -6081,7 +6007,7 @@ "type": "paypal" } ], - "time": "2024-09-20T12:57:46+00:00" + "time": "2024-10-07T06:27:54+00:00" }, { "name": "composer/semver", @@ -6472,26 +6398,26 @@ }, { "name": "filp/whoops", - "version": "2.15.4", + "version": "2.16.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546" + "reference": "befcdc0e5dce67252aa6322d82424be928214fa2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546", - "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546", + "url": "https://api.github.com/repos/filp/whoops/zipball/befcdc0e5dce67252aa6322d82424be928214fa2", + "reference": "befcdc0e5dce67252aa6322d82424be928214fa2", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0", + "php": "^7.1 || ^8.0", "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "require-dev": { - "mockery/mockery": "^0.9 || ^1.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", - "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^4.0 || ^5.0" }, "suggest": { "symfony/var-dumper": "Pretty print complex values better with var-dumper available", @@ -6531,7 +6457,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.15.4" + "source": "https://github.com/filp/whoops/tree/2.16.0" }, "funding": [ { @@ -6539,7 +6465,7 @@ "type": "github" } ], - "time": "2023-11-03T12:00:00+00:00" + "time": "2024-09-25T12:00:00+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -6755,16 +6681,16 @@ }, { "name": "laravel/pint", - "version": "v1.17.3", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "9d77be916e145864f10788bb94531d03e1f7b482" + "reference": "35c00c05ec43e6b46d295efc0f4386ceb30d50d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/9d77be916e145864f10788bb94531d03e1f7b482", - "reference": "9d77be916e145864f10788bb94531d03e1f7b482", + "url": "https://api.github.com/repos/laravel/pint/zipball/35c00c05ec43e6b46d295efc0f4386ceb30d50d9", + "reference": "35c00c05ec43e6b46d295efc0f4386ceb30d50d9", "shasum": "" }, "require": { @@ -6817,20 +6743,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-09-03T15:00:28+00:00" + "time": "2024-09-24T17:22:50+00:00" }, { "name": "laravel/tinker", - "version": "v2.9.0", + "version": "v2.10.0", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe" + "reference": "ba4d51eb56de7711b3a37d63aa0643e99a339ae5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/502e0fe3f0415d06d5db1f83a472f0f3b754bafe", - "reference": "502e0fe3f0415d06d5db1f83a472f0f3b754bafe", + "url": "https://api.github.com/repos/laravel/tinker/zipball/ba4d51eb56de7711b3a37d63aa0643e99a339ae5", + "reference": "ba4d51eb56de7711b3a37d63aa0643e99a339ae5", "shasum": "" }, "require": { @@ -6881,9 +6807,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.9.0" + "source": "https://github.com/laravel/tinker/tree/v2.10.0" }, - "time": "2024-01-04T16:10:04+00:00" + "time": "2024-09-23T13:32:56+00:00" }, { "name": "mockery/mockery", @@ -7030,16 +6956,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.2.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -7082,9 +7008,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-09-15T16:40:33+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "nunomaduro/collision", @@ -7185,25 +7111,25 @@ }, { "name": "orchestra/canvas", - "version": "v9.1.1", + "version": "v9.1.3", "source": { "type": "git", "url": "https://github.com/orchestral/canvas.git", - "reference": "c49867fac16b6286bf2b8360088620e697a2ea92" + "reference": "dbe51d918c4614f9c5ac9b7b7d3baac2360daf5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/canvas/zipball/c49867fac16b6286bf2b8360088620e697a2ea92", - "reference": "c49867fac16b6286bf2b8360088620e697a2ea92", + "url": "https://api.github.com/repos/orchestral/canvas/zipball/dbe51d918c4614f9c5ac9b7b7d3baac2360daf5d", + "reference": "dbe51d918c4614f9c5ac9b7b7d3baac2360daf5d", "shasum": "" }, "require": { "composer-runtime-api": "^2.2", "composer/semver": "^3.0", - "illuminate/console": "^11.20", - "illuminate/database": "^11.20", - "illuminate/filesystem": "^11.20", - "illuminate/support": "^11.20", + "illuminate/console": "^11.26", + "illuminate/database": "^11.26", + "illuminate/filesystem": "^11.26", + "illuminate/support": "^11.26", "orchestra/canvas-core": "^9.0", "orchestra/testbench-core": "^9.2", "php": "^8.2", @@ -7211,7 +7137,7 @@ "symfony/yaml": "^7.0" }, "require-dev": { - "laravel/framework": "^11.20", + "laravel/framework": "^11.26", "laravel/pint": "^1.17", "mockery/mockery": "^1.6", "phpstan/phpstan": "^1.11", @@ -7254,9 +7180,9 @@ "description": "Code Generators for Laravel Applications and Packages", "support": { "issues": "https://github.com/orchestral/canvas/issues", - "source": "https://github.com/orchestral/canvas/tree/v9.1.1" + "source": "https://github.com/orchestral/canvas/tree/v9.1.3" }, - "time": "2024-08-06T17:20:26+00:00" + "time": "2024-10-02T01:00:54+00:00" }, { "name": "orchestra/canvas-core", @@ -7328,16 +7254,16 @@ }, { "name": "orchestra/testbench", - "version": "v9.4.0", + "version": "v9.5.2", "source": { "type": "git", "url": "https://github.com/orchestral/testbench.git", - "reference": "f79c16b4cc9d22e3a71f8a2bc28326de392ff6aa" + "reference": "bc404d840ffbb722bf0bbb042251ef83223482f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench/zipball/f79c16b4cc9d22e3a71f8a2bc28326de392ff6aa", - "reference": "f79c16b4cc9d22e3a71f8a2bc28326de392ff6aa", + "url": "https://api.github.com/repos/orchestral/testbench/zipball/bc404d840ffbb722bf0bbb042251ef83223482f9", + "reference": "bc404d840ffbb722bf0bbb042251ef83223482f9", "shasum": "" }, "require": { @@ -7345,8 +7271,8 @@ "fakerphp/faker": "^1.23", "laravel/framework": "^11.11", "mockery/mockery": "^1.6", - "orchestra/testbench-core": "^9.4", - "orchestra/workbench": "^9.5", + "orchestra/testbench-core": "^9.5.3", + "orchestra/workbench": "^9.6", "php": "^8.2", "phpunit/phpunit": "^10.5 || ^11.0.1", "symfony/process": "^7.0", @@ -7377,22 +7303,22 @@ ], "support": { "issues": "https://github.com/orchestral/testbench/issues", - "source": "https://github.com/orchestral/testbench/tree/v9.4.0" + "source": "https://github.com/orchestral/testbench/tree/v9.5.2" }, - "time": "2024-08-26T05:10:07+00:00" + "time": "2024-10-06T13:07:57+00:00" }, { "name": "orchestra/testbench-core", - "version": "v9.4.1", + "version": "v9.5.3", "source": { "type": "git", "url": "https://github.com/orchestral/testbench-core.git", - "reference": "b1f1a046cafd07d2a7b0cb96e9a2911aee160515" + "reference": "9a5754622881f601951427a94c04c50e448cbf09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/b1f1a046cafd07d2a7b0cb96e9a2911aee160515", - "reference": "b1f1a046cafd07d2a7b0cb96e9a2911aee160515", + "url": "https://api.github.com/repos/orchestral/testbench-core/zipball/9a5754622881f601951427a94c04c50e448cbf09", + "reference": "9a5754622881f601951427a94c04c50e448cbf09", "shasum": "" }, "require": { @@ -7405,7 +7331,7 @@ "laravel/framework": "<11.11.0 || >=12.0.0", "laravel/serializable-closure": "<1.3.0 || >=2.0.0", "nunomaduro/collision": "<8.0.0 || >=9.0.0", - "phpunit/phpunit": "<10.5.0 || 11.0.0 || >=11.4.0" + "phpunit/phpunit": "<10.5.0 || 11.0.0 || >=11.5.0" }, "require-dev": { "fakerphp/faker": "^1.23", @@ -7469,7 +7395,7 @@ "issues": "https://github.com/orchestral/testbench/issues", "source": "https://github.com/orchestral/testbench-core" }, - "time": "2024-09-12T10:54:24+00:00" + "time": "2024-10-06T11:20:27+00:00" }, { "name": "orchestra/workbench", @@ -7539,37 +7465,37 @@ }, { "name": "pestphp/pest", - "version": "v3.1.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/pestphp/pest.git", - "reference": "5de0c2254ad8ef3271e0b9fa363772e43d6559b1" + "reference": "0a7bff0d246b10040e12e4152215e12a599e742a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/5de0c2254ad8ef3271e0b9fa363772e43d6559b1", - "reference": "5de0c2254ad8ef3271e0b9fa363772e43d6559b1", + "url": "https://api.github.com/repos/pestphp/pest/zipball/0a7bff0d246b10040e12e4152215e12a599e742a", + "reference": "0a7bff0d246b10040e12e4152215e12a599e742a", "shasum": "" }, "require": { - "brianium/paratest": "^7.5.4", + "brianium/paratest": "^7.5.6", "nunomaduro/collision": "^8.4.0", "nunomaduro/termwind": "^2.1.0", "pestphp/pest-plugin": "^3.0.0", "pestphp/pest-plugin-arch": "^3.0.0", - "pestphp/pest-plugin-mutate": "^3.0.4", + "pestphp/pest-plugin-mutate": "^3.0.5", "php": "^8.2.0", - "phpunit/phpunit": "^11.3.6" + "phpunit/phpunit": "^11.4.0" }, "conflict": { - "phpunit/phpunit": ">11.3.6", + "phpunit/phpunit": ">11.4.0", "sebastian/exporter": "<6.0.0", "webmozart/assert": "<1.11.0" }, "require-dev": { "pestphp/pest-dev-tools": "^3.0.0", - "pestphp/pest-plugin-type-coverage": "^3.0.0", - "symfony/process": "^7.1.3" + "pestphp/pest-plugin-type-coverage": "^3.1.0", + "symfony/process": "^7.1.5" }, "bin": [ "bin/pest" @@ -7634,7 +7560,7 @@ ], "support": { "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v3.1.0" + "source": "https://github.com/pestphp/pest/tree/v3.3.0" }, "funding": [ { @@ -7646,7 +7572,7 @@ "type": "github" } ], - "time": "2024-09-19T22:39:07+00:00" + "time": "2024-10-06T18:25:27+00:00" }, { "name": "pestphp/pest-plugin", @@ -8492,16 +8418,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.31.0", + "version": "1.32.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "249f15fb843bf240cf058372dad29e100cee6c17" + "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/249f15fb843bf240cf058372dad29e100cee6c17", - "reference": "249f15fb843bf240cf058372dad29e100cee6c17", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4", + "reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4", "shasum": "" }, "require": { @@ -8533,22 +8459,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.31.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.32.0" }, - "time": "2024-09-22T11:32:18+00:00" + "time": "2024-09-26T07:23:32+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.4", + "version": "1.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd" + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa517cb918591b93acc9b95c0bebdcd0e4538bd", - "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", "shasum": "" }, "require": { @@ -8593,7 +8519,7 @@ "type": "github" } ], - "time": "2024-09-19T07:58:01+00:00" + "time": "2024-10-06T15:03:59+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -8696,35 +8622,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.6", + "version": "11.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45" + "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ebdffc9e09585dafa71b9bffcdb0a229d4704c45", - "reference": "ebdffc9e09585dafa71b9bffcdb0a229d4704c45", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca", + "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.1.0", + "nikic/php-parser": "^5.3.1", "php": ">=8.2", - "phpunit/php-file-iterator": "^5.0.1", + "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-text-template": "^4.0.1", "sebastian/code-unit-reverse-lookup": "^4.0.1", "sebastian/complexity": "^4.0.1", "sebastian/environment": "^7.2.0", "sebastian/lines-of-code": "^3.0.1", - "sebastian/version": "^5.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.4.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -8762,7 +8688,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7" }, "funding": [ { @@ -8770,7 +8696,7 @@ "type": "github" } ], - "time": "2024-08-22T04:37:56+00:00" + "time": "2024-10-09T06:21:38+00:00" }, { "name": "phpunit/php-file-iterator", @@ -9019,16 +8945,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.3.6", + "version": "11.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b" + "reference": "89fe0c530133c08f7fff89d3d727154e4e504925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d62c45a19c665bb872c2a47023a0baf41a98bb2b", - "reference": "d62c45a19c665bb872c2a47023a0baf41a98bb2b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89fe0c530133c08f7fff89d3d727154e4e504925", + "reference": "89fe0c530133c08f7fff89d3d727154e4e504925", "shasum": "" }, "require": { @@ -9067,7 +8993,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.3-dev" + "dev-main": "11.4-dev" } }, "autoload": { @@ -9099,7 +9025,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.4.0" }, "funding": [ { @@ -9115,7 +9041,7 @@ "type": "tidelift" } ], - "time": "2024-09-19T10:54:28+00:00" + "time": "2024-10-05T08:39:03+00:00" }, { "name": "psy/psysh", @@ -9198,21 +9124,21 @@ }, { "name": "rector/rector", - "version": "1.2.5", + "version": "1.2.6", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339" + "reference": "6ca85da28159dbd3bb36211c5104b7bc91278e99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/e98aa793ca3fcd17e893cfaf9103ac049775d339", - "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/6ca85da28159dbd3bb36211c5104b7bc91278e99", + "reference": "6ca85da28159dbd3bb36211c5104b7bc91278e99", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.12.2" + "phpstan/phpstan": "^1.12.5" }, "conflict": { "rector/rector-doctrine": "*", @@ -9245,7 +9171,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.5" + "source": "https://github.com/rectorphp/rector/tree/1.2.6" }, "funding": [ { @@ -9253,7 +9179,7 @@ "type": "github" } ], - "time": "2024-09-08T17:43:24+00:00" + "time": "2024-10-03T08:56:44+00:00" }, { "name": "sebastian/cli-parser", @@ -10126,16 +10052,16 @@ }, { "name": "sebastian/version", - "version": "5.0.1", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/45c9debb7d039ce9b97de2f749c2cf5832a06ac4", - "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { @@ -10168,7 +10094,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -10176,7 +10102,7 @@ "type": "github" } ], - "time": "2024-07-03T05:13:08+00:00" + "time": "2024-10-09T05:16:32+00:00" }, { "name": "slevomat/coding-standard", @@ -11150,5 +11076,5 @@ "php": "^8.2" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/Connection.php b/src/Connection.php index 215f182..81536c6 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -12,6 +12,7 @@ use Illuminate\Support\Str; use PDPhilip\Elasticsearch\DSL\Bridge; use PDPhilip\Elasticsearch\DSL\Results; +use PDPhilip\Elasticsearch\Exceptions\LogicException; use RuntimeException; use function array_replace_recursive; @@ -74,10 +75,12 @@ class Connection extends BaseConnection protected mixed $elasticMetaHeader = null; - protected bool $rebuild = false; - protected string $connectionName; + protected bool $byPassMapValidation = false; + + protected int $insertChunkSize = 1000; + /** * @var Query\Processor */ @@ -91,6 +94,7 @@ public function __construct(array $config) $this->config = $config; $this->_sanitizeConfig(); + $this->_validateConnection(); $this->setOptions(); @@ -127,8 +131,34 @@ public function setOptions(): void : $this->config['error_log_index']; } + if (! empty($this->config['options']['bypass_map_validation'])) { + $this->byPassMapValidation = $this->config['options']['bypass_map_validation']; + } + + if (! empty($this->config['options']['insert_chunk_size'])) { + $this->insertChunkSize = $this->config['options']['insert_chunk_size']; + } + + } + + /** {@inheritdoc} */ + public function table($table, $as = null) + { + $query = new Query\Builder($this, new Query\Processor); + + return $query->from($table); + } + + /** {@inheritdoc} */ + public function disconnect(): void + { + $this->client = null; } + //---------------------------------------------------------------------- + // Getters + //---------------------------------------------------------------------- + /** {@inheritdoc} */ public function getTablePrefix(): ?string { @@ -177,21 +207,20 @@ public function getIndex(): string return $this->index; } - public function setIndex(string $index): string + /** {@inheritdoc} */ + public function getDriverName(): string { - $this->index = $this->indexPrefix && ! str_contains($index, $this->indexPrefix.'_') - ? $this->indexPrefix.'_'.$index - : $index; - - return $this->getIndex(); + return 'elasticsearch'; } - /** {@inheritdoc} */ - public function table($table, $as = null) + public function getClient(): ?Client { - $query = new Query\Builder($this, new Query\Processor); + return $this->client; + } - return $query->from($table); + public function getMaxSize(): int + { + return $this->maxSize; } /** @@ -202,41 +231,55 @@ public function getSchemaBuilder(): Schema\Builder return new Schema\Builder($this); } - /** {@inheritdoc} */ - public function disconnect(): void + public function getAllowIdSort(): bool { - $this->client = null; + return $this->allowIdSort; } - /** {@inheritdoc} */ - public function getDriverName(): string + public function getBypassMapValidation(): bool { - return 'elasticsearch'; + return $this->byPassMapValidation; } - public function rebuildConnection(): void + public function getInsertChunkSize(): int { - $this->rebuild = true; + return $this->insertChunkSize; } - public function getClient(): ?Client + /** {@inheritdoc} */ + protected function getDefaultPostProcessor(): Query\Processor { - return $this->client; + return new Query\Processor; } - public function getMaxSize(): int + /** {@inheritdoc} */ + protected function getDefaultQueryGrammar(): Query\Grammar { - return $this->maxSize; + return new Query\Grammar; } - public function setMaxSize($value): void + /** {@inheritdoc} */ + protected function getDefaultSchemaGrammar(): Schema\Grammar { - $this->maxSize = $value; + return new Schema\Grammar; } - public function getAllowIdSort(): bool + //---------------------------------------------------------------------- + // Setters + //---------------------------------------------------------------------- + + public function setIndex(string $index): string { - return $this->allowIdSort; + $this->index = $this->indexPrefix && ! str_contains($index, $this->indexPrefix.'_') + ? $this->indexPrefix.'_'.$index + : $index; + + return $this->getIndex(); + } + + public function setMaxSize($value): void + { + $this->maxSize = $value; } public function __call($method, $parameters) @@ -244,31 +287,20 @@ public function __call($method, $parameters) if (! $this->index) { $this->index = $this->indexPrefix.'*'; } - if ($this->rebuild) { + + // If we are missing a database connection client we need to reconnect. + if (! $this->client) { $this->client = $this->buildConnection(); - $this->rebuild = false; } $bridge = new Bridge($this); - return $bridge->{'process'.Str::studly($method)}(...$parameters); - } + $methodName = 'process'.Str::studly($method); - /** {@inheritdoc} */ - protected function getDefaultPostProcessor(): Query\Processor - { - return new Query\Processor; - } - - /** {@inheritdoc} */ - protected function getDefaultQueryGrammar(): Query\Grammar - { - return new Query\Grammar; - } + if (! method_exists($bridge, $methodName)) { + throw new LogicException("{$methodName} does not exist on the bridge."); + } - /** {@inheritdoc} */ - protected function getDefaultSchemaGrammar(): Schema\Grammar - { - return new Schema\Grammar; + return $bridge->{$methodName}(...$parameters); } /** @@ -288,8 +320,10 @@ private function _sanitizeConfig(): void 'password' => null, 'api_key' => null, 'api_id' => null, - 'index_prefix' => null, + 'index_prefix' => '', 'options' => [ + 'bypass_map_validation' => false, // This skips the safety checks for Elastic Specific queries. + 'insert_chunk_size' => 1000, // This is the maximum insert chunk size to use when bulk inserting 'logging' => false, 'allow_id_sort' => false, 'ssl_verification' => true, diff --git a/src/DSL/Bridge.php b/src/DSL/Bridge.php index d6ede48..9754292 100644 --- a/src/DSL/Bridge.php +++ b/src/DSL/Bridge.php @@ -20,7 +20,7 @@ class Bridge protected Connection $connection; - protected Client $client; + protected ?Client $client; protected ?string $errorLogger; @@ -1125,10 +1125,8 @@ public function parseRequiredKeywordMapping($field): ?string $fullMap = new Collection($mapping); $keywordFields = $fullMap->filter(fn ($value) => $value == 'keyword'); $this->cachedKeywordFields = $keywordFields; - // Log::info('cached'); } - // Log::info('returned'); $keywordFields = $this->cachedKeywordFields; if ($keywordFields->isEmpty()) { @@ -1430,7 +1428,6 @@ private function _throwError(Exception $exception, $params, $queryTag): QueryExc $errorMsg = $exception->getMessage(); $errorCode = $exception->getCode(); $queryTag = str_replace('_', '', $queryTag); - $this->connection->rebuildConnection(); $error = new Results([], [], $params, $queryTag); $error->setError($errorMsg, $errorCode); diff --git a/src/DSL/QueryBuilder.php b/src/DSL/QueryBuilder.php index 85b4ae8..b5a7b4a 100644 --- a/src/DSL/QueryBuilder.php +++ b/src/DSL/QueryBuilder.php @@ -337,20 +337,28 @@ private function _parseCondition($condition, $parentField = null): array $queryPart = ['bool' => ['must_not' => [['match' => [$field => $operand]]]]]; break; case 'in': - $keywordField = $this->parseRequiredKeywordMapping($field); - if (! $keywordField) { + if ($this->connection->getBypassMapValidation()) { $queryPart = ['terms' => [$field => $operand]]; } else { - $queryPart = ['terms' => [$keywordField => $operand]]; + $keywordField = $this->parseRequiredKeywordMapping($field); + if (! $keywordField) { + $queryPart = ['terms' => [$field => $operand]]; + } else { + $queryPart = ['terms' => [$keywordField => $operand]]; + } } break; case 'nin': - $keywordField = $this->parseRequiredKeywordMapping($field); - if (! $keywordField) { + if ($this->connection->getBypassMapValidation()) { $queryPart = ['bool' => ['must_not' => ['terms' => [$field => $operand]]]]; } else { - $queryPart = ['bool' => ['must_not' => ['terms' => [$keywordField => $operand]]]]; + $keywordField = $this->parseRequiredKeywordMapping($field); + if (! $keywordField) { + $queryPart = ['bool' => ['must_not' => ['terms' => [$field => $operand]]]]; + } else { + $queryPart = ['bool' => ['must_not' => ['terms' => [$keywordField => $operand]]]]; + } } break; @@ -367,10 +375,16 @@ private function _parseCondition($condition, $parentField = null): array $queryPart = ['match_phrase_prefix' => [$field => ['query' => $operand]]]; break; case 'exact': - $keywordField = $this->parseRequiredKeywordMapping($field); - if (! $keywordField) { - throw new ParameterException('Field ['.$field.'] is not a keyword field which is required for the [exact] operator.'); + + if ($this->connection->getBypassMapValidation()) { + $keywordField = $field; + } else { + $keywordField = $this->parseRequiredKeywordMapping($field); + if (! $keywordField) { + throw new ParameterException('Field ['.$field.'] is not a keyword field which is required for the [exact] operator.'); + } } + $queryPart = ['term' => [$keywordField => $operand]]; break; case 'group': diff --git a/src/Exceptions/LaravelElasticsearchException.php b/src/Exceptions/LaravelElasticsearchException.php new file mode 100644 index 0000000..d279708 --- /dev/null +++ b/src/Exceptions/LaravelElasticsearchException.php @@ -0,0 +1,9 @@ +applyBeforeQueryCallbacks(); - collect($values)->chunk(1000)->each(callback: function ($chunk) use (&$response, $returnData) { + $insertChunkSize = $this->getConnection()->getInsertChunkSize(); + + collect($values)->chunk($insertChunkSize)->each(callback: function ($chunk) use (&$response, $returnData) { $result = $this->connection->insertBulk($chunk->toArray(), $returnData, $this->refresh); if ((bool) $result['hasErrors']) { $response['hasErrors'] = true; diff --git a/tests/Eloquent/ElasticsearchConnectionOptionsTest.php b/tests/Eloquent/ElasticsearchConnectionOptionsTest.php new file mode 100644 index 0000000..a70a5d6 --- /dev/null +++ b/tests/Eloquent/ElasticsearchConnectionOptionsTest.php @@ -0,0 +1,40 @@ +state(['name' => 'John Smith'])->create(); + + $products = ProductUnsafe::whereExact('name', 'John Smith')->get(); + + expect($products)->toBeEmpty(); +}); + +test('whereExact when Unsafe queries is used and a keyword is specified.', function () { + Product::factory()->state(['name' => 'John Smith'])->create(); + + $products = ProductUnsafe::whereExact('name.keyword', 'John Smith')->get(); + + expect($products->first()->name)->toEqual('John Smith'); +}); + +test('fails whereExact on text field.', function () { + Post::factory()->state(['content' => 'John Smith'])->create(); + + $products = Post::whereExact('content', 'John Smith')->get(); + + expect($products->first()->name)->toEqual('John Smith'); +})->throws(PDPhilip\Elasticsearch\DSL\exceptions\ParameterException::class); + +test('does not fail whereExact on text field with Unsafe queries.', function () { + Post::factory()->state(['content' => 'John Smith'])->create(); + + $posts = PostUnsafe::whereExact('content', 'John Smith')->get(); + + expect($posts)->toBeEmpty(); +}); diff --git a/tests/TestCase.php b/tests/TestCase.php index 8d899c6..0d1149b 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -49,5 +49,15 @@ protected function getEnvironmentSetUp($app): void 'logging' => true, ], ]); + $app['config']->set('database.connections.elasticsearch_unsafe', [ + 'driver' => 'elasticsearch', + 'auth_type' => 'http', + 'hosts' => ['http://localhost:9200'], + 'options' => [ + 'bypass_map_validation' => true, + 'insert_chunk_size' => 10000, + 'logging' => true, + ], + ]); } } diff --git a/workbench/app/Models/PostUnsafe.php b/workbench/app/Models/PostUnsafe.php new file mode 100644 index 0000000..9a8b5b4 --- /dev/null +++ b/workbench/app/Models/PostUnsafe.php @@ -0,0 +1,37 @@ +in_stock > 0) { + return 'yes'; + } + + return 'no'; + } + + public function scopeGreen(Builder $query): Builder + { + return $query->where('color', 'green'); + } + + public function getAvgOrdersAttribute(): float|int + { + $orders = array_filter($this->order_values); + $avg = 0; + if (count($orders)) { + $avg = round(array_sum($orders) / count($orders)); + } + + return $avg; + } + + //Relationships ===================================== + + public function user(): \PDPhilip\Elasticsearch\Relations\BelongsTo + { + return $this->belongsTo(User::class); + } + + public static function newFactory(): ProductFactory + { + return ProductFactory::new(); + } +}