diff --git a/composer.lock b/composer.lock index 2a5302cd2..5933f4fc9 100644 --- a/composer.lock +++ b/composer.lock @@ -68,16 +68,16 @@ }, { "name": "composer/semver", - "version": "3.4.3", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", - "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", "shasum": "" }, "require": { @@ -129,7 +129,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.3" + "source": "https://github.com/composer/semver/tree/3.4.4" }, "funding": [ { @@ -139,33 +139,32 @@ { "url": "https://github.com/composer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2024-09-19T14:15:21+00:00" + "time": "2025-08-20T19:15:30+00:00" }, { "name": "google/protobuf", - "version": "v4.31.1", + "version": "v4.32.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "2b028ce8876254e2acbeceea7d9b573faad41864" + "reference": "9a9a92ecbe9c671dc1863f6d4a91ea3ea12c8646" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/2b028ce8876254e2acbeceea7d9b573faad41864", - "reference": "2b028ce8876254e2acbeceea7d9b573faad41864", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/9a9a92ecbe9c671dc1863f6d4a91ea3ea12c8646", + "reference": "9a9a92ecbe9c671dc1863f6d4a91ea3ea12c8646", "shasum": "" }, "require": { - "php": ">=7.0.0" + "php": ">=8.1.0" + }, + "provide": { + "ext-protobuf": "*" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0" + "phpunit/phpunit": ">=5.0.0 <8.5.27" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -187,9 +186,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.32.0" }, - "time": "2025-05-28T18:52:35+00:00" + "time": "2025-08-14T20:00:33+00:00" }, { "name": "nyholm/psr7", @@ -407,16 +406,16 @@ }, { "name": "open-telemetry/context", - "version": "1.2.1", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/context.git", - "reference": "1eb2b837ee9362db064a6b65d5ecce15a9f9f020" + "reference": "438f71812242db3f196fb4c717c6f92cbc819be6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/1eb2b837ee9362db064a6b65d5ecce15a9f9f020", - "reference": "1eb2b837ee9362db064a6b65d5ecce15a9f9f020", + "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/438f71812242db3f196fb4c717c6f92cbc819be6", + "reference": "438f71812242db3f196fb4c717c6f92cbc819be6", "shasum": "" }, "require": { @@ -462,7 +461,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-05-07T23:36:50+00:00" + "time": "2025-08-13T01:12:00+00:00" }, { "name": "open-telemetry/exporter-otlp", @@ -593,16 +592,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a" + "reference": "86287cf30fd6549444d7b8f7d8758d92e24086ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a", - "reference": "1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/86287cf30fd6549444d7b8f7d8758d92e24086ac", + "reference": "86287cf30fd6549444d7b8f7d8758d92e24086ac", "shasum": "" }, "require": { @@ -621,7 +620,7 @@ "ramsey/uuid": "^3.0 || ^4.0", "symfony/polyfill-mbstring": "^1.23", "symfony/polyfill-php82": "^1.26", - "tbachert/spi": "^1.0.1" + "tbachert/spi": "^1.0.5" }, "suggest": { "ext-gmp": "To support unlimited number of synchronous metric readers", @@ -635,6 +634,9 @@ "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderHttpConfig", "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderPeerConfig" ], + "OpenTelemetry\\SDK\\Common\\Configuration\\Resolver\\ResolverInterface": [ + "OpenTelemetry\\SDK\\Common\\Configuration\\Resolver\\SdkConfigurationResolver" + ], "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [ "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\ExtensionHookManager" ] @@ -683,20 +685,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-06-19T23:36:51+00:00" + "time": "2025-08-06T03:07:06+00:00" }, { "name": "open-telemetry/sem-conv", - "version": "1.32.1", + "version": "1.37.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22" + "reference": "8da7ec497c881e39afa6657d72586e27efbd29a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", - "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/8da7ec497c881e39afa6657d72586e27efbd29a1", + "reference": "8da7ec497c881e39afa6657d72586e27efbd29a1", "shasum": "" }, "require": { @@ -740,7 +742,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-06-24T02:32:27+00:00" + "time": "2025-09-03T12:08:10+00:00" }, { "name": "php-http/discovery", @@ -1307,16 +1309,16 @@ }, { "name": "symfony/http-client", - "version": "v7.3.1", + "version": "v7.3.3", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "4403d87a2c16f33345dca93407a8714ee8c05a64" + "reference": "333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/4403d87a2c16f33345dca93407a8714ee8c05a64", - "reference": "4403d87a2c16f33345dca93407a8714ee8c05a64", + "url": "https://api.github.com/repos/symfony/http-client/zipball/333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019", + "reference": "333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019", "shasum": "" }, "require": { @@ -1324,6 +1326,7 @@ "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-client-contracts": "~3.4.4|^3.5.2", + "symfony/polyfill-php83": "^1.29", "symfony/service-contracts": "^2.5|^3" }, "conflict": { @@ -1382,7 +1385,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.3.1" + "source": "https://github.com/symfony/http-client/tree/v7.3.3" }, "funding": [ { @@ -1393,12 +1396,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-06-28T07:58:39+00:00" + "time": "2025-08-27T07:45:05+00:00" }, { "name": "symfony/http-client-contracts", @@ -1480,7 +1487,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -1541,7 +1548,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" }, "funding": [ { @@ -1552,6 +1559,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1561,7 +1572,7 @@ }, { "name": "symfony/polyfill-php82", - "version": "v1.32.0", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php82.git", @@ -1617,7 +1628,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php82/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php82/tree/v1.33.0" }, "funding": [ { @@ -1628,6 +1639,10 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" @@ -1635,6 +1650,86 @@ ], "time": "2024-09-09T11:45:10+00:00" }, + { + "name": "symfony/polyfill-php83", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5", + "reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + }, + "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.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-07-08T02:45:35+00:00" + }, { "name": "symfony/service-contracts", "version": "v3.6.0", @@ -1720,16 +1815,16 @@ }, { "name": "tbachert/spi", - "version": "v1.0.4", + "version": "v1.0.5", "source": { "type": "git", "url": "https://github.com/Nevay/spi.git", - "reference": "86e355edfdd57f9cb720bd2ac3af7dde521ca0e7" + "reference": "e7078767866d0a9e0f91d3f9d42a832df5e39002" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nevay/spi/zipball/86e355edfdd57f9cb720bd2ac3af7dde521ca0e7", - "reference": "86e355edfdd57f9cb720bd2ac3af7dde521ca0e7", + "url": "https://api.github.com/repos/Nevay/spi/zipball/e7078767866d0a9e0f91d3f9d42a832df5e39002", + "reference": "e7078767866d0a9e0f91d3f9d42a832df5e39002", "shasum": "" }, "require": { @@ -1766,9 +1861,9 @@ ], "support": { "issues": "https://github.com/Nevay/spi/issues", - "source": "https://github.com/Nevay/spi/tree/v1.0.4" + "source": "https://github.com/Nevay/spi/tree/v1.0.5" }, - "time": "2025-06-28T20:18:22+00:00" + "time": "2025-06-29T15:42:06+00:00" }, { "name": "utopia-php/cache", @@ -1870,16 +1965,16 @@ }, { "name": "utopia-php/framework", - "version": "0.33.20", + "version": "0.33.24", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131" + "reference": "5112b1023342163e3fbedec99f38fc32c8700aa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/e1c7ab4e0b5b0a9a70256b1e00912e101e76a131", - "reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131", + "url": "https://api.github.com/repos/utopia-php/http/zipball/5112b1023342163e3fbedec99f38fc32c8700aa0", + "reference": "5112b1023342163e3fbedec99f38fc32c8700aa0", "shasum": "" }, "require": { @@ -1911,9 +2006,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.20" + "source": "https://github.com/utopia-php/http/tree/0.33.24" }, - "time": "2025-05-18T23:51:21+00:00" + "time": "2025-09-04T04:18:39+00:00" }, { "name": "utopia-php/pools", @@ -2154,16 +2249,16 @@ }, { "name": "laravel/pint", - "version": "v1.22.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "941d1927c5ca420c22710e98420287169c7bcaf7" + "reference": "0345f3b05f136801af8c339f9d16ef29e6b4df8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/941d1927c5ca420c22710e98420287169c7bcaf7", - "reference": "941d1927c5ca420c22710e98420287169c7bcaf7", + "url": "https://api.github.com/repos/laravel/pint/zipball/0345f3b05f136801af8c339f9d16ef29e6b4df8a", + "reference": "0345f3b05f136801af8c339f9d16ef29e6b4df8a", "shasum": "" }, "require": { @@ -2174,10 +2269,10 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.75.0", - "illuminate/view": "^11.44.7", - "larastan/larastan": "^3.4.0", - "laravel-zero/framework": "^11.36.1", + "friendsofphp/php-cs-fixer": "^3.82.2", + "illuminate/view": "^11.45.1", + "larastan/larastan": "^3.5.0", + "laravel-zero/framework": "^11.45.0", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3.1", "pestphp/pest": "^2.36.0" @@ -2187,6 +2282,9 @@ ], "type": "project", "autoload": { + "files": [ + "overrides/Runner/Parallel/ProcessFactory.php" + ], "psr-4": { "App\\": "app/", "Database\\Seeders\\": "database/seeders/", @@ -2216,20 +2314,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-05-08T08:38:12+00:00" + "time": "2025-07-10T18:09:32+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.13.1", + "version": "1.13.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", - "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", "shasum": "" }, "require": { @@ -2268,7 +2366,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" }, "funding": [ { @@ -2276,7 +2374,7 @@ "type": "tidelift" } ], - "time": "2025-04-29T12:36:36+00:00" + "time": "2025-08-01T08:46:24+00:00" }, { "name": "nikic/php-parser", @@ -2488,16 +2586,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.27", + "version": "1.12.28", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" + "reference": "fcf8b71aeab4e1a1131d1783cef97b23a51b87a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", - "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fcf8b71aeab4e1a1131d1783cef97b23a51b87a9", + "reference": "fcf8b71aeab4e1a1131d1783cef97b23a51b87a9", "shasum": "" }, "require": { @@ -2542,7 +2640,7 @@ "type": "github" } ], - "time": "2025-05-21T20:51:45+00:00" + "time": "2025-07-17T17:15:39+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2865,16 +2963,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.23", + "version": "9.6.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" + "reference": "049c011e01be805202d8eebedef49f769a8ec7b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/049c011e01be805202d8eebedef49f769a8ec7b7", + "reference": "049c011e01be805202d8eebedef49f769a8ec7b7", "shasum": "" }, "require": { @@ -2885,7 +2983,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.1", + "myclabs/deep-copy": "^1.13.4", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -2896,11 +2994,11 @@ "phpunit/php-timer": "^5.0.3", "sebastian/cli-parser": "^1.0.2", "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", + "sebastian/comparator": "^4.0.9", "sebastian/diff": "^4.0.6", "sebastian/environment": "^5.1.5", "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", + "sebastian/global-state": "^5.0.8", "sebastian/object-enumerator": "^4.0.4", "sebastian/resource-operations": "^3.0.4", "sebastian/type": "^3.2.1", @@ -2948,7 +3046,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.25" }, "funding": [ { @@ -2972,7 +3070,7 @@ "type": "tidelift" } ], - "time": "2025-05-02T06:40:34+00:00" + "time": "2025-08-20T14:38:31+00:00" }, { "name": "rregeer/phpunit-coverage-check", @@ -3189,16 +3287,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "4.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", "shasum": "" }, "require": { @@ -3251,15 +3349,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-08-10T06:51:50+00:00" }, { "name": "sebastian/complexity", @@ -3526,16 +3636,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", "shasum": "" }, "require": { @@ -3578,15 +3688,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2025-08-10T07:10:35+00:00" }, { "name": "sebastian/lines-of-code", @@ -3759,16 +3881,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", "shasum": "" }, "require": { @@ -3810,15 +3932,27 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2023-02-03T06:07:39+00:00" + "time": "2025-08-10T06:57:39+00:00" }, { "name": "sebastian/resource-operations", @@ -4121,7 +4255,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -4129,6 +4263,6 @@ "ext-pdo": "*", "ext-mbstring": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/src/Database/Adapter.php b/src/Database/Adapter.php index 1f2e8e306..b753ea523 100644 --- a/src/Database/Adapter.php +++ b/src/Database/Adapter.php @@ -749,7 +749,7 @@ abstract public function updateDocuments(Document $collection, Document $updates * @param array $changes * @return array */ - abstract public function createOrUpdateDocuments( + abstract public function upsertDocuments( Document $collection, string $attribute, array $changes diff --git a/src/Database/Adapter/Pool.php b/src/Database/Adapter/Pool.php index fc099178b..3c1c10a19 100644 --- a/src/Database/Adapter/Pool.php +++ b/src/Database/Adapter/Pool.php @@ -245,7 +245,7 @@ public function updateDocuments(Document $collection, Document $updates, array $ return $this->delegate(__FUNCTION__, \func_get_args()); } - public function createOrUpdateDocuments(Document $collection, string $attribute, array $changes): array + public function upsertDocuments(Document $collection, string $attribute, array $changes): array { return $this->delegate(__FUNCTION__, \func_get_args()); } diff --git a/src/Database/Adapter/SQL.php b/src/Database/Adapter/SQL.php index cc241c445..9e08d4b93 100644 --- a/src/Database/Adapter/SQL.php +++ b/src/Database/Adapter/SQL.php @@ -2090,7 +2090,7 @@ public function createDocuments(Document $collection, array $documents): array * @return array * @throws DatabaseException */ - public function createOrUpdateDocuments( + public function upsertDocuments( Document $collection, string $attribute, array $changes diff --git a/src/Database/Database.php b/src/Database/Database.php index 9b7a60ff0..2fec661a1 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -60,7 +60,7 @@ class Database public const VAR_LINESTRING = 'linestring'; public const VAR_POLYGON = 'polygon'; - public const SPATIAL_TYPES = [self::VAR_POINT,self::VAR_LINESTRING, self::VAR_POLYGON]; + public const SPATIAL_TYPES = [self::VAR_POINT, self::VAR_LINESTRING, self::VAR_POLYGON]; // Index Types public const INDEX_KEY = 'key'; @@ -3826,7 +3826,8 @@ public function createDocument(string $collection, Document $document): Document * @param string $collection * @param array $documents * @param int $batchSize - * @param callable|null $onNext + * @param (callable(Document): void)|null $onNext + * @param (callable(Throwable): void)|null $onError * @return int * @throws AuthorizationException * @throws StructureException @@ -3838,6 +3839,7 @@ public function createDocuments( array $documents, int $batchSize = self::INSERT_BATCH_SIZE, ?callable $onNext = null, + ?callable $onError = null, ): int { if (!$this->adapter->getSharedTables() && $this->adapter->getTenantPerDocument()) { throw new DatabaseException('Shared tables must be enabled if tenant per document is enabled.'); @@ -3914,7 +3916,13 @@ public function createDocuments( $document = $this->casting($collection, $document); $document = $this->decode($collection, $document); - $onNext && $onNext($document); + + try { + $onNext && $onNext($document); + } catch (\Throwable $e) { + $onError ? $onError($e) : throw $e; + } + $modified++; } } @@ -4283,7 +4291,7 @@ public function updateDocument(string $collection, string $id, Document $documen if ($document->offsetExists('$permissions')) { $originalPermissions = $old->getPermissions(); - $currentPermissions = $document->getPermissions(); + $currentPermissions = $document->getPermissions(); sort($originalPermissions); sort($currentPermissions); @@ -4473,8 +4481,8 @@ public function updateDocument(string $collection, string $id, Document $documen * @param Document $updates * @param array $queries * @param int $batchSize - * @param callable|null $onNext - * @param callable|null $onError + * @param (callable(Document $updated, Document $old): void)|null $onNext + * @param (callable(Throwable): void)|null $onError * @return int * @throws AuthorizationException * @throws ConflictException @@ -4597,12 +4605,12 @@ public function updateDocuments( break; } - $currentPermissions = $updates->getPermissions(); + $old = array_map(fn ($doc) => clone $doc, $batch); + $currentPermissions = $updates->getPermissions(); sort($currentPermissions); $this->withTransaction(function () use ($collection, $updates, &$batch, $currentPermissions) { foreach ($batch as $index => $document) { - $skipPermissionsUpdate = true; if ($updates->offsetExists('$permissions')) { @@ -4647,13 +4655,12 @@ public function updateDocuments( ); }); - foreach ($batch as $doc) { + foreach ($batch as $index => $doc) { $doc->removeAttribute('$skipPermissionsUpdate'); - $this->purgeCachedDocument($collection->getId(), $doc->getId()); $doc = $this->decode($collection, $doc); try { - $onNext && $onNext($doc); + $onNext && $onNext($doc, $old[$index]); } catch (Throwable $th) { $onError ? $onError($th) : throw $th; } @@ -5069,28 +5076,62 @@ private function getJunctionCollection(Document $collection, Document $relatedCo : '_' . $relatedCollection->getSequence() . '_' . $collection->getSequence(); } + /** + * Create or update a document. + * + * @param string $collection + * @param Document $document + * @return Document + * @throws StructureException + * @throws Throwable + */ + public function upsertDocument( + string $collection, + Document $document, + ): Document { + $result = null; + + $this->upsertDocumentsWithIncrease( + $collection, + '', + [$document], + function (Document $doc, ?Document $_old = null) use (&$result) { + $result = $doc; + } + ); + + if ($result === null) { + // No-op (unchanged): return the current persisted doc + $result = $this->getDocument($collection, $document->getId()); + } + return $result; + } + /** * Create or update documents. * * @param string $collection * @param array $documents * @param int $batchSize - * @param callable|null $onNext + * @param (callable(Document, ?Document): void)|null $onNext + * @param (callable(Throwable): void)|null $onError * @return int * @throws StructureException * @throws \Throwable */ - public function createOrUpdateDocuments( + public function upsertDocuments( string $collection, array $documents, int $batchSize = self::INSERT_BATCH_SIZE, ?callable $onNext = null, + ?callable $onError = null ): int { - return $this->createOrUpdateDocumentsWithIncrease( + return $this->upsertDocumentsWithIncrease( $collection, '', $documents, $onNext, + $onError, $batchSize ); } @@ -5101,18 +5142,20 @@ public function createOrUpdateDocuments( * @param string $collection * @param string $attribute * @param array $documents - * @param callable|null $onNext + * @param (callable(Document, ?Document): void)|null $onNext + * @param (callable(Throwable): void)|null $onError * @param int $batchSize * @return int * @throws StructureException * @throws \Throwable * @throws Exception */ - public function createOrUpdateDocumentsWithIncrease( + public function upsertDocumentsWithIncrease( string $collection, string $attribute, array $documents, ?callable $onNext = null, + ?callable $onError = null, int $batchSize = self::INSERT_BATCH_SIZE ): int { if (empty($documents)) { @@ -5144,7 +5187,7 @@ public function createOrUpdateDocumentsWithIncrease( if ($document->offsetExists('$permissions')) { $originalPermissions = $old->getPermissions(); - $currentPermissions = $document->getPermissions(); + $currentPermissions = $document->getPermissions(); sort($originalPermissions); sort($currentPermissions); @@ -5274,7 +5317,7 @@ public function createOrUpdateDocumentsWithIncrease( /** * @var array $chunk */ - $batch = $this->withTransaction(fn () => Authorization::skip(fn () => $this->adapter->createOrUpdateDocuments( + $batch = $this->withTransaction(fn () => Authorization::skip(fn () => $this->adapter->upsertDocuments( $collection, $attribute, $chunk @@ -5290,7 +5333,7 @@ public function createOrUpdateDocumentsWithIncrease( } } - foreach ($batch as $doc) { + foreach ($batch as $index => $doc) { if ($this->resolveRelationships) { $doc = $this->silent(fn () => $this->populateDocumentRelationships($collection, $doc)); } @@ -5305,7 +5348,13 @@ public function createOrUpdateDocumentsWithIncrease( $this->purgeCachedDocument($collection->getId(), $doc->getId()); } - $onNext && $onNext($doc); + $old = $chunk[$index]->getOld(); + + try { + $onNext && $onNext($doc, $old->isEmpty() ? null : $old); + } catch (\Throwable $th) { + $onError ? $onError($th) : throw $th; + } } } @@ -5972,8 +6021,8 @@ private function deleteCascade(Document $collection, Document $relatedCollection * @param string $collection * @param array $queries * @param int $batchSize - * @param callable|null $onNext - * @param callable|null $onError + * @param (callable(Document, Document): void)|null $onNext + * @param (callable(Throwable): void)|null $onError * @return int * @throws AuthorizationException * @throws DatabaseException @@ -6065,6 +6114,7 @@ public function deleteDocuments( break; } + $old = array_map(fn ($doc) => clone $doc, $batch); $sequences = []; $permissionIds = []; @@ -6101,7 +6151,7 @@ public function deleteDocuments( ); }); - foreach ($batch as $document) { + foreach ($batch as $index => $document) { if ($this->getSharedTables() && $this->getTenantPerDocument()) { $this->withTenant($document->getTenant(), function () use ($collection, $document) { $this->purgeCachedDocument($collection->getId(), $document->getId()); @@ -6110,7 +6160,7 @@ public function deleteDocuments( $this->purgeCachedDocument($collection->getId(), $document->getId()); } try { - $onNext && $onNext($document); + $onNext && $onNext($document, $old[$index]); } catch (Throwable $th) { $onError ? $onError($th) : throw $th; } @@ -6520,7 +6570,7 @@ public static function addFilter(string $name, callable $encode, callable $decod public function encode(Document $collection, Document $document): Document { $attributes = $collection->getAttribute('attributes', []); - $internalDateAttributes = ['$createdAt','$updatedAt']; + $internalDateAttributes = ['$createdAt', '$updatedAt']; foreach ($this->getInternalAttributes() as $attribute) { $attributes[] = $attribute; } @@ -6937,7 +6987,7 @@ public static function convertQuery(Document $collection, Query $query): Query } } - if (! $attribute->isEmpty()) { + if (!$attribute->isEmpty()) { $query->setOnArray($attribute->getAttribute('array', false)); if ($attribute->getAttribute('type') == Database::VAR_DATETIME) { @@ -7195,7 +7245,7 @@ public function decodeSpatialData(string $wkt): array // POINT(x y) if (str_starts_with($upper, 'POINT(')) { $start = strpos($wkt, '(') + 1; - $end = strrpos($wkt, ')'); + $end = strrpos($wkt, ')'); $inside = substr($wkt, $start, $end - $start); $coords = explode(' ', trim($inside)); @@ -7205,7 +7255,7 @@ public function decodeSpatialData(string $wkt): array // LINESTRING(x1 y1, x2 y2, ...) if (str_starts_with($upper, 'LINESTRING(')) { $start = strpos($wkt, '(') + 1; - $end = strrpos($wkt, ')'); + $end = strrpos($wkt, ')'); $inside = substr($wkt, $start, $end - $start); $points = explode(',', $inside); @@ -7218,7 +7268,7 @@ public function decodeSpatialData(string $wkt): array // POLYGON((x1,y1),(x2,y2)) if (str_starts_with($upper, 'POLYGON((')) { $start = strpos($wkt, '((') + 2; - $end = strrpos($wkt, '))'); + $end = strrpos($wkt, '))'); $inside = substr($wkt, $start, $end - $start); $rings = explode('),(', $inside); diff --git a/src/Database/Mirror.php b/src/Database/Mirror.php index 25df6c888..dac23a063 100644 --- a/src/Database/Mirror.php +++ b/src/Database/Mirror.php @@ -589,17 +589,14 @@ public function createDocuments( array $documents, int $batchSize = self::INSERT_BATCH_SIZE, ?callable $onNext = null, + ?callable $onError = null, ): int { - $modified = 0; - - $this->source->createDocuments( + $modified = $this->source->createDocuments( $collection, $documents, $batchSize, - function ($doc) use ($onNext, &$modified) { - $onNext && $onNext($doc); - $modified++; - }, + $onNext, + $onError, ); if ( @@ -638,7 +635,6 @@ function ($doc) use ($onNext, &$modified) { $collection, $clones, $batchSize, - null, ) ); @@ -715,18 +711,13 @@ public function updateDocuments( ?callable $onNext = null, ?callable $onError = null, ): int { - $modified = 0; - - $this->source->updateDocuments( + $modified = $this->source->updateDocuments( $collection, $updates, $queries, $batchSize, - function ($doc) use ($onNext, &$modified) { - $onNext && $onNext($doc); - $modified++; - }, - $onError + $onNext, + $onError, ); if ( @@ -754,14 +745,13 @@ function ($doc) use ($onNext, &$modified) { ); } - $modified = $this->destination->withPreserveDates( + $this->destination->withPreserveDates( fn () => $this->destination->updateDocuments( $collection, $clone, $queries, $batchSize, - null, ) ); @@ -781,17 +771,19 @@ function ($doc) use ($onNext, &$modified) { return $modified; } - public function createOrUpdateDocuments(string $collection, array $documents, int $batchSize = Database::INSERT_BATCH_SIZE, callable|null $onNext = null): int - { - $modified = 0; - $this->source->createOrUpdateDocuments( + public function upsertDocuments( + string $collection, + array $documents, + int $batchSize = Database::INSERT_BATCH_SIZE, + ?callable $onNext = null, + ?callable $onError = null, + ): int { + $modified = $this->source->upsertDocuments( $collection, $documents, $batchSize, - function ($doc) use ($onNext, &$modified) { - $onNext && $onNext($doc); - $modified++; - } + $onNext, + $onError, ); if ( @@ -824,13 +816,12 @@ function ($doc) use ($onNext, &$modified) { $clones[] = $clone; } - $modified = $this->destination->withPreserveDates( + $this->destination->withPreserveDates( fn () => - $this->destination->createOrUpdateDocuments( + $this->destination->upsertDocuments( $collection, $clones, $batchSize, - null, ) ); @@ -845,8 +836,9 @@ function ($doc) use ($onNext, &$modified) { } } } catch (\Throwable $err) { - $this->logError('createDocuments', $err); + $this->logError('upsertDocuments', $err); } + return $modified; } @@ -900,17 +892,12 @@ public function deleteDocuments( ?callable $onNext = null, ?callable $onError = null, ): int { - $modified = 0; - - $this->source->deleteDocuments( + $modified = $this->source->deleteDocuments( $collection, $queries, $batchSize, - function ($doc) use (&$modified, $onNext) { - $onNext && $onNext($doc); - $modified++; - }, - $onError + $onNext, + $onError, ); if ( @@ -935,11 +922,10 @@ function ($doc) use (&$modified, $onNext) { ); } - $modified = $this->destination->deleteDocuments( + $this->destination->deleteDocuments( $collection, $queries, $batchSize, - null, ); foreach ($this->writeFilters as $filter) { diff --git a/tests/e2e/Adapter/Scopes/DocumentTests.php b/tests/e2e/Adapter/Scopes/DocumentTests.php index bf7f2a905..500966cbf 100644 --- a/tests/e2e/Adapter/Scopes/DocumentTests.php +++ b/tests/e2e/Adapter/Scopes/DocumentTests.php @@ -532,7 +532,7 @@ public function testSkipPermissions(): void Authorization::disable(); $results = []; - $count = $database->createOrUpdateDocuments( + $count = $database->upsertDocuments( __FUNCTION__, $documents, onNext: function ($doc) use (&$results) { @@ -594,7 +594,7 @@ public function testUpsertDocuments(): void ]; $results = []; - $count = $database->createOrUpdateDocuments( + $count = $database->upsertDocuments( __FUNCTION__, $documents, onNext: function ($doc) use (&$results) { @@ -637,7 +637,7 @@ public function testUpsertDocuments(): void $documents[1]->setAttribute('integer', 10); $results = []; - $count = $database->createOrUpdateDocuments(__FUNCTION__, $documents, onNext: function ($doc) use (&$results) { + $count = $database->upsertDocuments(__FUNCTION__, $documents, onNext: function ($doc) use (&$results) { $results[] = $doc; }); @@ -714,7 +714,7 @@ public function testUpsertDocumentsInc(): void $documents[0]->setAttribute('integer', 1); $documents[1]->setAttribute('integer', 1); - $database->createOrUpdateDocumentsWithIncrease( + $database->upsertDocumentsWithIncrease( collection: __FUNCTION__, attribute: 'integer', documents: $documents @@ -729,7 +729,7 @@ public function testUpsertDocumentsInc(): void $documents[0]->setAttribute('integer', -1); $documents[1]->setAttribute('integer', -1); - $database->createOrUpdateDocumentsWithIncrease( + $database->upsertDocumentsWithIncrease( collection: __FUNCTION__, attribute: 'integer', documents: $documents @@ -764,10 +764,10 @@ public function testUpsertDocumentsPermissions(): void ], ]); - $database->createOrUpdateDocuments(__FUNCTION__, [$document]); + $database->upsertDocuments(__FUNCTION__, [$document]); try { - $database->createOrUpdateDocuments(__FUNCTION__, [$document->setAttribute('string', 'updated')]); + $database->upsertDocuments(__FUNCTION__, [$document->setAttribute('string', 'updated')]); $this->fail('Failed to throw exception'); } catch (Exception $e) { $this->assertInstanceOf(AuthorizationException::class, $e); @@ -782,10 +782,10 @@ public function testUpsertDocumentsPermissions(): void ], ]); - $database->createOrUpdateDocuments(__FUNCTION__, [$document]); + $database->upsertDocuments(__FUNCTION__, [$document]); $results = []; - $count = $database->createOrUpdateDocuments( + $count = $database->upsertDocuments( __FUNCTION__, [$document->setAttribute('string', 'updated')], onNext: function ($doc) use (&$results) { @@ -806,7 +806,7 @@ public function testUpsertDocumentsPermissions(): void ], ]); - $database->createOrUpdateDocuments(__FUNCTION__, [$document]); + $database->upsertDocuments(__FUNCTION__, [$document]); $newPermissions = [ Permission::read(Role::any()), @@ -815,7 +815,7 @@ public function testUpsertDocumentsPermissions(): void ]; $results = []; - $count = $database->createOrUpdateDocuments( + $count = $database->upsertDocuments( __FUNCTION__, [$document->setAttribute('$permissions', $newPermissions)], onNext: function ($doc) use (&$results) { @@ -862,7 +862,7 @@ public function testUpsertDocumentsAttributeMismatch(): void ]); // Ensure missing optionals on new document is allowed - $docs = $database->createOrUpdateDocuments(__FUNCTION__, [ + $docs = $database->upsertDocuments(__FUNCTION__, [ $existingDocument->setAttribute('first', 'updated'), $newDocument, ]); @@ -874,7 +874,7 @@ public function testUpsertDocumentsAttributeMismatch(): void $this->assertEquals('', $newDocument->getAttribute('last')); try { - $database->createOrUpdateDocuments(__FUNCTION__, [ + $database->upsertDocuments(__FUNCTION__, [ $existingDocument->removeAttribute('first'), $newDocument ]); @@ -884,7 +884,7 @@ public function testUpsertDocumentsAttributeMismatch(): void } // Ensure missing optionals on existing document is allowed - $docs = $database->createOrUpdateDocuments(__FUNCTION__, [ + $docs = $database->upsertDocuments(__FUNCTION__, [ $existingDocument ->setAttribute('first', 'first') ->removeAttribute('last'), @@ -899,7 +899,7 @@ public function testUpsertDocumentsAttributeMismatch(): void $this->assertEquals('last', $newDocument->getAttribute('last')); // Ensure set null on existing document is allowed - $docs = $database->createOrUpdateDocuments(__FUNCTION__, [ + $docs = $database->upsertDocuments(__FUNCTION__, [ $existingDocument ->setAttribute('first', 'first') ->setAttribute('last', null), @@ -926,7 +926,7 @@ public function testUpsertDocumentsAttributeMismatch(): void ]); // Ensure mismatch of attribute orders is allowed - $docs = $database->createOrUpdateDocuments(__FUNCTION__, [ + $docs = $database->upsertDocuments(__FUNCTION__, [ $doc3, $doc4 ]); @@ -967,11 +967,11 @@ public function testUpsertDocumentsNoop(): void ], ]); - $count = static::getDatabase()->createOrUpdateDocuments(__FUNCTION__, [$document]); + $count = static::getDatabase()->upsertDocuments(__FUNCTION__, [$document]); $this->assertEquals(1, $count); // No changes, should return 0 - $count = static::getDatabase()->createOrUpdateDocuments(__FUNCTION__, [$document]); + $count = static::getDatabase()->upsertDocuments(__FUNCTION__, [$document]); $this->assertEquals(0, $count); } @@ -990,7 +990,7 @@ public function testUpsertDuplicateIds(): void $doc2 = new Document(['$id' => 'dup', 'num' => 2]); try { - $db->createOrUpdateDocuments(__FUNCTION__, [$doc1, $doc2]); + $db->upsertDocuments(__FUNCTION__, [$doc1, $doc2]); $this->fail('Failed to throw exception'); } catch (\Throwable $e) { $this->assertInstanceOf(DuplicateException::class, $e, $e->getMessage()); @@ -1032,7 +1032,7 @@ public function testUpsertMixedPermissionDelta(): void Permission::read(Role::any()) ]); - $db->createOrUpdateDocuments(__FUNCTION__, [$d1, $d2]); + $db->upsertDocuments(__FUNCTION__, [$d1, $d2]); $this->assertEquals([ Permission::read(Role::any()), @@ -5547,7 +5547,7 @@ public function testUpsertDateOperations(): void // Test 1: Upsert new document with custom createdAt $upsertResults = []; - $database->createOrUpdateDocuments($collection, [ + $database->upsertDocuments($collection, [ new Document([ '$id' => 'upsert1', '$permissions' => $permissions, @@ -5566,7 +5566,7 @@ public function testUpsertDateOperations(): void $upsertDoc1->setAttribute('string', 'upsert1_updated'); $upsertDoc1->setAttribute('$updatedAt', $updateDate); $updatedUpsertResults = []; - $database->createOrUpdateDocuments($collection, [$upsertDoc1], onNext: function ($doc) use (&$updatedUpsertResults) { + $database->upsertDocuments($collection, [$upsertDoc1], onNext: function ($doc) use (&$updatedUpsertResults) { $updatedUpsertResults[] = $doc; }); $updatedUpsertDoc1 = $updatedUpsertResults[0]; @@ -5576,7 +5576,7 @@ public function testUpsertDateOperations(): void // Test 3: Upsert new document with both custom dates $upsertResults2 = []; - $database->createOrUpdateDocuments($collection, [ + $database->upsertDocuments($collection, [ new Document([ '$id' => 'upsert2', '$permissions' => $permissions, @@ -5597,7 +5597,7 @@ public function testUpsertDateOperations(): void $upsertDoc2->setAttribute('$createdAt', $date3); $upsertDoc2->setAttribute('$updatedAt', $date3); $updatedUpsertResults2 = []; - $database->createOrUpdateDocuments($collection, [$upsertDoc2], onNext: function ($doc) use (&$updatedUpsertResults2) { + $database->upsertDocuments($collection, [$upsertDoc2], onNext: function ($doc) use (&$updatedUpsertResults2) { $updatedUpsertResults2[] = $doc; }); $updatedUpsertDoc2 = $updatedUpsertResults2[0]; @@ -5610,7 +5610,7 @@ public function testUpsertDateOperations(): void $customDate = '2000-01-01T10:00:00.000+00:00'; $upsertResults3 = []; - $database->createOrUpdateDocuments($collection, [ + $database->upsertDocuments($collection, [ new Document([ '$id' => 'upsert3', '$permissions' => $permissions, @@ -5631,7 +5631,7 @@ public function testUpsertDateOperations(): void $upsertDoc3->setAttribute('$createdAt', $customDate); $upsertDoc3->setAttribute('$updatedAt', $customDate); $updatedUpsertResults3 = []; - $database->createOrUpdateDocuments($collection, [$upsertDoc3], onNext: function ($doc) use (&$updatedUpsertResults3) { + $database->upsertDocuments($collection, [$upsertDoc3], onNext: function ($doc) use (&$updatedUpsertResults3) { $updatedUpsertResults3[] = $doc; }); $updatedUpsertDoc3 = $updatedUpsertResults3[0]; @@ -5671,7 +5671,7 @@ public function testUpsertDateOperations(): void ]; $bulkUpsertResults = []; - $database->createOrUpdateDocuments($collection, $upsertDocuments, onNext: function ($doc) use (&$bulkUpsertResults) { + $database->upsertDocuments($collection, $upsertDocuments, onNext: function ($doc) use (&$bulkUpsertResults) { $bulkUpsertResults[] = $doc; }); @@ -5738,7 +5738,7 @@ public function testUpsertDateOperations(): void $this->assertNotEmpty($doc->getAttribute('$updatedAt'), "updatedAt mismatch for $id"); } - // Test 11: Bulk upsert operations with createOrUpdateDocuments + // Test 11: Bulk upsert operations with upsertDocuments $upsertUpdateDocuments = []; foreach ($upsertDocuments as $doc) { $updatedDoc = clone $doc; @@ -5749,7 +5749,7 @@ public function testUpsertDateOperations(): void } $upsertUpdateResults = []; - $countUpsertUpdate = $database->createOrUpdateDocuments($collection, $upsertUpdateDocuments, onNext: function ($doc) use (&$upsertUpdateResults) { + $countUpsertUpdate = $database->upsertDocuments($collection, $upsertUpdateDocuments, onNext: function ($doc) use (&$upsertUpdateResults) { $upsertUpdateResults[] = $doc; }); $this->assertEquals(4, $countUpsertUpdate); @@ -5774,7 +5774,7 @@ public function testUpsertDateOperations(): void } $upsertDisabledResults = []; - $countUpsertDisabled = $database->createOrUpdateDocuments($collection, $upsertDisabledDocuments, onNext: function ($doc) use (&$upsertDisabledResults) { + $countUpsertDisabled = $database->upsertDocuments($collection, $upsertDisabledDocuments, onNext: function ($doc) use (&$upsertDisabledResults) { $upsertDisabledResults[] = $doc; }); $this->assertEquals(4, $countUpsertDisabled); @@ -5829,7 +5829,7 @@ public function testUpdateDocumentsCount(): void ]) ]; $upsertUpdateResults = []; - $count = $database->createOrUpdateDocuments($collectionName, $docs, onNext: function ($doc) use (&$upsertUpdateResults) { + $count = $database->upsertDocuments($collectionName, $docs, onNext: function ($doc) use (&$upsertUpdateResults) { $upsertUpdateResults[] = $doc; }); $this->assertCount(4, $upsertUpdateResults); diff --git a/tests/e2e/Adapter/Scopes/GeneralTests.php b/tests/e2e/Adapter/Scopes/GeneralTests.php index 795f4d096..1664273c1 100644 --- a/tests/e2e/Adapter/Scopes/GeneralTests.php +++ b/tests/e2e/Adapter/Scopes/GeneralTests.php @@ -512,7 +512,7 @@ public function testSharedTablesTenantPerDocument(): void $database ->setTenant(null) ->setTenantPerDocument(true) - ->createOrUpdateDocuments(__FUNCTION__, [new Document([ + ->upsertDocuments(__FUNCTION__, [new Document([ '$id' => $doc3Id, '$tenant' => 3, 'name' => 'Superman3', @@ -550,7 +550,7 @@ public function testSharedTablesTenantPerDocument(): void $database ->setTenant(null) ->setTenantPerDocument(true) - ->createOrUpdateDocuments(__FUNCTION__, [new Document([ + ->upsertDocuments(__FUNCTION__, [new Document([ '$id' => $doc4Id, '$tenant' => 4, 'name' => 'Superman4', @@ -582,7 +582,7 @@ public function testSharedTablesTenantPerDocument(): void $database ->setTenant(null) ->setTenantPerDocument(true) - ->createOrUpdateDocuments(__FUNCTION__, [new Document([ + ->upsertDocuments(__FUNCTION__, [new Document([ '$id' => $doc4Id, '$tenant' => 4, 'name' => 'Superman4 updated', diff --git a/tests/e2e/Adapter/Scopes/SpatialTests.php b/tests/e2e/Adapter/Scopes/SpatialTests.php index b1d3d9866..3d93d233e 100644 --- a/tests/e2e/Adapter/Scopes/SpatialTests.php +++ b/tests/e2e/Adapter/Scopes/SpatialTests.php @@ -1581,7 +1581,7 @@ public function testSpatialBulkOperation(): void ]], $document->getAttribute('area')); } - // Test 3: createOrUpdateDocuments with spatial data + // Test 3: upsertDocuments with spatial data $upsertDocuments = [ new Document([ '$id' => 'upsert1', @@ -1622,7 +1622,7 @@ public function testSpatialBulkOperation(): void ]; $upsertResults = []; - $upsertCount = $database->createOrUpdateDocuments($collectionName, $upsertDocuments, onNext: function ($doc) use (&$upsertResults) { + $upsertCount = $database->upsertDocuments($collectionName, $upsertDocuments, onNext: function ($doc) use (&$upsertResults) { $upsertResults[] = $doc; });