diff --git a/.codex/skills/appwrite-testing/SKILL.md b/.codex/skills/appwrite-testing/SKILL.md new file mode 100644 index 0000000000..da191be824 --- /dev/null +++ b/.codex/skills/appwrite-testing/SKILL.md @@ -0,0 +1,74 @@ +--- +name: appwrite-testing +description: Choose, write, and review tests in the Appwrite server repository using a pragmatic test pyramid. Use when adding or changing PHPUnit tests, deciding between unit and e2e coverage, moving duplicated high-level coverage lower, testing API endpoints, workers, queues, permissions, auth/scopes, persistence, serialization, retry logic, validators, security regressions, or Swoole-sensitive behavior. +--- + +# Appwrite Testing + +## Core Rule + +Keep the test suite pyramid-shaped: many fast unit tests, fewer service/API e2e tests, and very few broad workflow tests. Push each assertion to the lowest level that still proves the behavior. + +Prefer fast feedback over formal labels. A narrow integration-style unit test with deterministic fakes is better than a slow e2e test when it proves the same behavior. + +## Choose The Test Level + +Use `tests/unit/...` for: + +- Pure validators, helpers, mappers, parsers, filters, retry classifiers, event builders, URL/security checks, and branching logic. +- Worker building blocks that can be called with fake adapters, in-memory collaborators, or scripted test doubles. +- Regression cases where inputs and observable outputs can be asserted without HTTP, Docker services, queues, Swoole coroutines, or real network calls. +- Boundary serialization/deserialization when the external side can be represented with a deterministic fake response or document. + +Use `tests/e2e/Services/{Service}` for: + +- HTTP route behavior, status codes, headers, cookies, response shape, SDK-visible contracts, and request validation through the real API path. +- Auth, scope, permission, project mode, platform, and side-specific behavior that depends on Appwrite's request lifecycle. +- Persistence, queue-visible behavior, worker integration, database adapter behavior, and DI/wiring that unit tests cannot prove. +- A small number of high-value service workflows that represent user-visible behavior across multiple Appwrite subsystems. + +Avoid broad e2e coverage for every edge case. Cover edge cases in unit tests and keep e2e focused on the integration contract that lower layers cannot exercise. + +## Appwrite Patterns + +Structure tests as Arrange, Act, Assert. Test observable behavior, not the order of private calls or internal implementation details. + +Write unit tests with `PHPUnit\Framework\TestCase` under the matching namespace in `tests/unit`. Use data providers for matrices. Prefer named fake classes over anonymous mocks when PHPStan clarity matters. + +Write service e2e tests with `Tests\E2E\Client` and the existing scope traits such as `Scope`, `ProjectCustom`, `SideClient`, `SideServer`, or `ProjectConsole`. Reuse local service base traits when they exist. + +Use deterministic test doubles for network, queue, mail, storage, database, and third-party boundaries whenever the point of the test is local behavior. Never call production third-party services from automated tests. + +Generate unique IDs, emails, and names for e2e data to survive parallel runs. Cache setup data only when the test does not require precise counts or fresh state. + +Keep assertions precise: status code, body fields, error type/message, permission outcome, retry count, adapter call count, or persisted value. Avoid asserting incidental full documents when a sparse behavior assertion is enough. + +## Duplication Policy + +If a higher-level test finds a bug and no lower-level test fails, add a lower-level regression test where practical. + +Do not repeat all conditional branches at e2e level once unit tests cover them. The e2e test should prove routing, auth, serialization, persistence, or wiring only. + +Delete or avoid high-level tests that no longer add confidence beyond lower-level coverage. Keep tests readable even if that means some local duplication in setup. + +## Swoole And Workers + +Be careful with Swoole coroutines in unit tests. Do not run coroutine integrations inside the shared unit process unless existing nearby tests prove the pattern is safe. + +For workers, unit-test pure pieces such as batching, classification, cursor construction, retry/backoff decisions, and adapter interaction with fakes. Cover coroutine scheduling, queues, and full worker lifecycle through e2e or existing integration patterns. + +Avoid sleeps and timing-sensitive assertions. If timing is unavoidable, isolate it, make it generous, and prefer polling helpers already used in the suite. + +## Commands + +Run focused checks first: + +```bash +docker compose exec appwrite test tests/unit/ +docker compose exec appwrite test tests/e2e/Services/[Service] +docker compose exec appwrite test tests/e2e/Services/[Service] --filter=[Method] +composer lint +composer analyze +``` + +Use the narrowest command that validates the change, then broaden only when the touched behavior crosses module, API, worker, or shared-helper boundaries. diff --git a/.codex/skills/appwrite-testing/agents/openai.yaml b/.codex/skills/appwrite-testing/agents/openai.yaml new file mode 100644 index 0000000000..1f9d0c12ac --- /dev/null +++ b/.codex/skills/appwrite-testing/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Appwrite Testing" + short_description: "Choose and write Appwrite tests using a pragmatic test pyramid." + default_prompt: "Use the Appwrite testing skill to choose the right test level and add focused PHPUnit coverage for this change." diff --git a/.env b/.env index aa7438f6bb..57deb8cc0a 100644 --- a/.env +++ b/.env @@ -150,3 +150,6 @@ _APP_POOL_ADAPTER=stack _APP_WORKER_SCREENSHOTS_ROUTER=http://appwrite _TESTS_OAUTH2_GITHUB_CLIENT_ID= _TESTS_OAUTH2_GITHUB_CLIENT_SECRET= + +_APP_WORKERS_NUM=1 +_APP_WORKER_MAX_COROUTINES=1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 343d22fdf2..96b579c006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,6 +139,26 @@ jobs: - name: Run Linter run: composer lint + refactor: + name: Checks / Refactor + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Setup PHP + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 + with: + php-version: '8.3' + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --ignore-platform-reqs + + - name: Run Rector + run: composer refactor:check + analyze: name: Checks / Analyze runs-on: ubuntu-latest @@ -209,44 +229,74 @@ jobs: outputs: databases: ${{ steps.generate.outputs.databases }} modes: ${{ steps.generate.outputs.modes }} + services: ${{ steps.generate.outputs.services }} steps: - name: Generate matrix id: generate uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | - const allDatabases = ['MariaDB', 'PostgreSQL', 'MongoDB']; - const allModes = ['dedicated', 'shared']; + const runner4 = `runs-on=${context.runId}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel`; + const runner8 = `runs-on=${context.runId}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel`; - const defaultDatabases = ['MongoDB']; - const defaultModes = ['dedicated']; + const services = [ + { name: 'Account', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Avatars', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Console', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Databases', runner: runner8, functional: false, processes: 3, timeout: 30 }, + { name: 'TablesDB', runner: runner8, functional: false, processes: 3, timeout: 30 }, + { name: 'Functions', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'FunctionsSchedule', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'GraphQL', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'Health', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Advisor', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Locale', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Projects', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Realtime', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'Sites', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Proxy', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Storage', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Tokens', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Teams', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Users', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'ProjectWebhooks', runner: runner4, functional: false, processes: null, timeout: 20 }, + { name: 'Webhooks', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'VCS', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Messaging', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Migrations', runner: runner4, functional: true, processes: 1, timeout: 20 }, + { name: 'Project', runner: runner4, functional: true, processes: null, timeout: 20 }, + { name: 'Presences', runner: runner4, functional: true, processes: null, timeout: 20 }, + ]; + core.setOutput('services', JSON.stringify(services)); const pr = context.payload.pull_request; - if (!pr) { - core.setOutput('databases', JSON.stringify(allDatabases)); - core.setOutput('modes', JSON.stringify(allModes)); + + const isDatabaseVersionChanged = async () => { + const getContent = (ref) => github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: 'composer.lock', + ref, + }); + + const getDbVersion = (lock) => lock.packages?.find(p => p.name === 'utopia-php/database')?.version; + const [{ data: base }, { data: head }] = await Promise.all([ + getContent(pr.base.sha), + getContent(pr.head.sha), + ]); + + const decode = (content) => JSON.parse(Buffer.from(content, 'base64').toString()); + return getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content)); + }; + + if (!pr || await isDatabaseVersionChanged()) { + core.setOutput('databases', JSON.stringify(['MariaDB', 'PostgreSQL', 'MongoDB'])); + core.setOutput('modes', JSON.stringify(['dedicated', 'shared'])); return; } - const getContent = (ref) => github.rest.repos.getContent({ - owner: context.repo.owner, - repo: context.repo.repo, - path: 'composer.lock', - ref, - }); - - const getDbVersion = (lock) => lock.packages?.find(p => p.name === 'utopia-php/database')?.version; - - const [{ data: base }, { data: head }] = await Promise.all([ - getContent(pr.base.sha), - getContent(pr.head.sha), - ]); - - const decode = (content) => JSON.parse(Buffer.from(content, 'base64').toString()); - const databaseChanged = getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content)); - - core.setOutput('databases', JSON.stringify(databaseChanged ? allDatabases : defaultDatabases)); - core.setOutput('modes', JSON.stringify(databaseChanged ? allModes : defaultModes)); + core.setOutput('databases', JSON.stringify(['MongoDB'])); + core.setOutput('modes', JSON.stringify(['dedicated'])); build: name: Build @@ -379,7 +429,7 @@ jobs: - name: Wait for Open Runtimes timeout-minutes: 3 run: | - while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + while ! docker logs exc1 | grep -q "Executor is ready."; do echo "Waiting for Executor to come online" sleep 1 done @@ -405,8 +455,8 @@ jobs: docker compose logs e2e_service: - name: Tests / E2E / ${{ matrix.database }} (${{ matrix.mode }}) / ${{ matrix.service }} - runs-on: ${{ matrix.runner || format('runs-on={0}/runner=4cpu-linux-x64/volume=120g/spot=false', github.run_id) }} + name: Tests / E2E / ${{ matrix.database }} (${{ matrix.mode }}) / ${{ matrix.service.name }} + runs-on: ${{ matrix.service.runner }} needs: [build, matrix] permissions: contents: read @@ -417,45 +467,7 @@ jobs: matrix: database: ${{ fromJSON(needs.matrix.outputs.databases) }} mode: ${{ fromJSON(needs.matrix.outputs.modes) }} - service: [ - Account, - Avatars, - Console, - Databases, - TablesDB, - Functions, - FunctionsSchedule, - GraphQL, - Health, - Advisor, - Locale, - Projects, - Realtime, - Sites, - Proxy, - Storage, - Tokens, - Teams, - Users, - ProjectWebhooks, - Webhooks, - VCS, - Messaging, - Migrations, - Project, - Presences - ] - include: - - service: Databases - runner: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/volume=120g/spot=false - paratest_processes: 3 - timeout_minutes: 30 - - service: TablesDB - runner: runs-on=${{ github.run_id }}/runner=8cpu-linux-x64/volume=120g/spot=false - paratest_processes: 3 - timeout_minutes: 30 - - service: Migrations - paratest_processes: 1 + service: ${{ fromJSON(needs.matrix.outputs.services) }} steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -513,7 +525,7 @@ jobs: - name: Wait for Open Runtimes timeout-minutes: 3 run: | - while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + while ! docker logs exc1 | grep -q "Executor is ready."; do echo "Waiting for Executor to come online" sleep 1 done @@ -523,20 +535,19 @@ jobs: with: max_attempts: 2 retry_wait_seconds: 60 - timeout_minutes: ${{ matrix.timeout_minutes || 20 }} + timeout_minutes: ${{ matrix.service.timeout }} job_id: ${{ job.check_run_id }} github_token: ${{ secrets.GITHUB_TOKEN }} - test_dir: tests/e2e/Services/${{ matrix.service }} + test_dir: tests/e2e/Services/${{ matrix.service.name }} command: | - SERVICE_PATH="/usr/src/code/tests/e2e/Services/${{ matrix.service }}" + SERVICE_PATH="/usr/src/code/tests/e2e/Services/${{ matrix.service.name }}" - # Services that rely on sequential test method execution (shared static state) - FUNCTIONAL_FLAG="--functional" - case "${{ matrix.service }}" in - Databases|TablesDB|Functions|Realtime|GraphQL|ProjectWebhooks) FUNCTIONAL_FLAG="" ;; - esac + FUNCTIONAL_FLAG="" + if [ "${{ matrix.service.functional }}" = "true" ]; then + FUNCTIONAL_FLAG="--functional" + fi - PARATEST_PROCESSES="${{ matrix.paratest_processes }}" + PARATEST_PROCESSES="${{ matrix.service.processes }}" if [ -z "$PARATEST_PROCESSES" ]; then PARATEST_PROCESSES="$(nproc)" fi @@ -545,7 +556,7 @@ jobs: -e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \ -e _TESTS_OAUTH2_GITHUB_CLIENT_ID="${{ secrets.TESTS_OAUTH2_GITHUB_CLIENT_ID }}" \ -e _TESTS_OAUTH2_GITHUB_CLIENT_SECRET="${{ secrets.TESTS_OAUTH2_GITHUB_CLIENT_SECRET }}" \ - appwrite vendor/bin/paratest --processes "$PARATEST_PROCESSES" $FUNCTIONAL_FLAG "$SERVICE_PATH" --exclude-group abuseEnabled --exclude-group screenshots --log-junit tests/e2e/Services/${{ matrix.service }}/junit.xml + appwrite vendor/bin/paratest --processes "$PARATEST_PROCESSES" $FUNCTIONAL_FLAG "$SERVICE_PATH" --exclude-group abuseEnabled --exclude-group screenshots --log-junit tests/e2e/Services/${{ matrix.service.name }}/junit.xml - name: Failure Logs if: failure() @@ -667,7 +678,7 @@ jobs: - name: Wait for Open Runtimes timeout-minutes: 3 run: | - while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + while ! docker logs exc1 | grep -q "Executor is ready."; do echo "Waiting for Executor to come online" sleep 1 done diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 68ab657213..a74afaf9f0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -33,7 +33,7 @@ jobs: id: meta uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 with: - images: appwrite/cloud + images: appwrite/ce tags: | type=ref,event=tag diff --git a/AGENTS.md b/AGENTS.md index b84bc89c3b..edaeff9ea5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -117,7 +117,7 @@ Common injections: `$response`, `$request`, `$dbForProject`, `$dbForPlatform`, ` ## Tracing with Utopia Span -In handlers, only call `Span::add($key, $value)`. **Never** call `Span::init`, `Span::error`, or `Span::finish` -- lifecycle is owned by the entry-point harness (`app/http.php`, `app/worker.php`, `app/realtime.php`, `Bus::dispatch`). For selective export, filter in the sampler in `app/init/span.php`. +In handlers, only call `Span::add($key, $value)`. **Never** call `Span::init`, `setError`, or `Span::finish` -- lifecycle is owned by the entry-point harness (`app/http.php`, `app/worker.php`, `app/realtime.php`, `Bus::dispatch`). For selective export, filter in the sampler in `app/init/span.php`. Keys are `snake_case` with dots only for child relationships: `project.id` (id of project), `storage.bucket.id`. No dot otherwise: `inbound_bytes`, not `inbound.bytes`. No camelCase, no bare top-level keys (`function.id`, not `functionId`). diff --git a/Dockerfile b/Dockerfile index 9a61635415..7ffd23f683 100755 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \ --no-plugins --no-scripts --prefer-dist \ `if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi` -FROM appwrite/base:1.4.1 AS base +FROM appwrite/base:1.4.3 AS base LABEL maintainer="team@appwrite.io" diff --git a/app/assets/dbip/dbip-country-lite-2025-12.mmdb b/app/assets/dbip/dbip-country-lite-2025-12.mmdb deleted file mode 100644 index 4ecabbf735..0000000000 Binary files a/app/assets/dbip/dbip-country-lite-2025-12.mmdb and /dev/null differ diff --git a/app/assets/dbip/dbip-country-lite-2026-06.mmdb b/app/assets/dbip/dbip-country-lite-2026-06.mmdb new file mode 100644 index 0000000000..df09a565b3 Binary files /dev/null and b/app/assets/dbip/dbip-country-lite-2026-06.mmdb differ diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 9c33d6e554..70b0730077 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -603,6 +603,13 @@ return [ 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => ID::custom('_key_type_expire'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['type', 'expire'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC, Database::ORDER_ASC], + ], ], ], diff --git a/app/config/console.php b/app/config/console.php index b7a3f2195a..bf1850182a 100644 --- a/app/config/console.php +++ b/app/config/console.php @@ -39,6 +39,7 @@ $console = [ 'membershipsMfa' => true, 'membershipsUserId' => true, 'membershipsUserPhone' => true, + 'membershipsUserAccessedAt' => true, 'mockNumbers' => [], 'invites' => System::getEnv('_APP_CONSOLE_INVITES', 'enabled') === 'enabled', 'limit' => (System::getEnv('_APP_CONSOLE_WHITELIST_ROOT', 'enabled') === 'enabled') ? 1 : 0, // limit signup to 1 user @@ -48,6 +49,7 @@ $console = [ 'disposableEmails' => false, 'canonicalEmails' => false, 'freeEmails' => false, + 'corporateEmails' => false, 'invalidateSessions' => true ], 'authWhitelistEmails' => (!empty(System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null))) ? \explode(',', System::getEnv('_APP_CONSOLE_WHITELIST_EMAILS', null)) : [], diff --git a/app/config/errors.php b/app/config/errors.php index 4a6f08d432..a548d75179 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -241,6 +241,11 @@ return [ 'description' => 'This email address must already be in its canonical form. Please remove aliases, tags, or provider-specific variations and try again.', 'code' => 400, ], + Exception::USER_EMAIL_NOT_CORPORATE => [ + 'name' => Exception::USER_EMAIL_NOT_CORPORATE, + 'description' => 'Only corporate email addresses are allowed. Please use a work email address and try again.', + 'code' => 400, + ], Exception::USER_PASSWORD_MISMATCH => [ 'name' => Exception::USER_PASSWORD_MISMATCH, 'description' => 'Passwords do not match. Please check the password and confirm password.', diff --git a/app/config/sdks.php b/app/config/sdks.php index e29b28690f..f3d89db3c2 100644 --- a/app/config/sdks.php +++ b/app/config/sdks.php @@ -156,6 +156,25 @@ return [ 'gitBranch' => 'dev', 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/react-native/CHANGELOG.md'), ], + [ + 'key' => 'unity', + 'name' => 'Unity', + 'version' => '0.1.0', + 'url' => 'https://github.com/appwrite/sdk-for-unity', + 'package' => 'https://github.com/appwrite/sdk-for-unity', + 'enabled' => true, + 'beta' => true, + 'dev' => true, + 'hidden' => false, + 'family' => APP_SDK_PLATFORM_CLIENT, + 'prism' => 'csharp', + 'source' => \realpath(__DIR__ . '/../sdks/client-unity'), + 'gitUrl' => 'git@github.com:appwrite/sdk-for-unity.git', + 'gitRepoName' => 'sdk-for-unity', + 'gitUserName' => 'appwrite', + 'gitBranch' => 'dev', + 'changelog' => \realpath(__DIR__ . '/../../docs/sdks/unity/CHANGELOG.md'), + ], [ 'key' => 'graphql', 'name' => 'GraphQL', diff --git a/app/config/services.php b/app/config/services.php index f829937623..73acd50861 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -281,6 +281,20 @@ return [ 'icon' => '', 'platforms' => ['client', 'server', 'console'], ], + 'organization' => [ + 'key' => 'organization', + 'name' => 'Organization', + 'subtitle' => 'The Organization service allows you to manage organization-level projects.', + 'description' => '', + 'controller' => '', // Uses modules + 'sdk' => true, + 'docs' => true, + 'docsUrl' => '', + 'tests' => false, + 'optional' => false, + 'icon' => '', + 'platforms' => ['server', 'console'], + ], 'migrations' => [ 'key' => 'migrations', 'name' => 'Migrations', diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 789fce6d71..a050e97b17 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -7,6 +7,7 @@ use Appwrite\Auth\Phrase; use Appwrite\Auth\Validator\Password; use Appwrite\Auth\Validator\PasswordDictionary; use Appwrite\Auth\Validator\PasswordHistory; +use Appwrite\Auth\Validator\PasswordStrength; use Appwrite\Auth\Validator\PersonalData; use Appwrite\Auth\Validator\Phone; use Appwrite\Bus\Events\SessionCreated; @@ -28,6 +29,7 @@ use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\MethodType; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Template\Template; use Appwrite\URL\URL as URLParser; use Appwrite\Usage\Context; @@ -71,6 +73,7 @@ use Utopia\Platform\Enum; use Utopia\Storage\Validator\FileName; use Utopia\System\System; use Utopia\Validator; +use Utopia\Validator\AllOf; use Utopia\Validator\ArrayList; use Utopia\Validator\Assoc; use Utopia\Validator\Boolean; @@ -255,7 +258,7 @@ Http::post('/v1/account') ->label('abuse-limit', 10) ->param('userId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) ->param('email', '', new EmailValidator(), 'User email.') - ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) ->inject('request') ->inject('response') @@ -348,6 +351,10 @@ Http::post('/v1/account') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + try { $userId = $userId == 'unique()' ? ID::unique() : $userId; $user->setAttributes([ @@ -1696,6 +1703,10 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $failureRedirect(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + $failureRedirect(Exception::USER_EMAIL_NOT_CORPORATE); + } + try { $userId = ID::unique(); $user->setAttributes([ @@ -1837,6 +1848,10 @@ Http::get('/v1/account/sessions/oauth2/:provider/redirect') $failureRedirect(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + $failureRedirect(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user->setAttribute('email', $email); $user->setAttribute('emailCanonical', $emailMetadata['emailCanonical']); $user->setAttribute('emailIsCanonical', $emailMetadata['emailIsCanonical']); @@ -2195,6 +2210,10 @@ Http::post('/v1/account/tokens/magic-url') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user->setAttributes([ '$id' => $userId, '$permissions' => [ @@ -2515,6 +2534,10 @@ Http::post('/v1/account/tokens/email') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user->setAttributes([ '$id' => $userId, '$permissions' => [ @@ -3271,8 +3294,8 @@ Http::patch('/v1/account/password') contentType: ContentType::JSON )) ->label('abuse-limit', 10) - ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) - ->param('oldPassword', '', new Password(), 'Current user password. Must be at least 8 chars.', true) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) + ->param('oldPassword', '', new PasswordFormat(new Text(256, 0)), 'Current user password. Max length: 256 chars.', true) ->inject('response') ->inject('user') ->inject('project') @@ -3436,6 +3459,10 @@ Http::patch('/v1/account/email') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !$emailMetadata['emailIsCorporate']) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user ->setAttribute('email', $email) ->setAttribute('emailVerification', false) // After this user needs to confirm mail again @@ -3888,7 +3915,7 @@ Http::put('/v1/account/recovery') ->label('abuse-key', 'url:{url},userId:{param-userId}') ->param('userId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'User ID.', false, ['dbForProject']) ->param('secret', '', new Text(256), 'Valid reset token.') - ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'New user password. Must be between 8 and 256 chars.', false, ['project', 'passwordsDictionary']) ->inject('response') ->inject('user') ->inject('dbForProject') diff --git a/app/controllers/api/graphql.php b/app/controllers/api/graphql.php index 4a509aefdd..1c596bb931 100644 --- a/app/controllers/api/graphql.php +++ b/app/controllers/api/graphql.php @@ -122,11 +122,11 @@ Http::post('/v1/graphql/mutation') ->action(function (Request $request, Response $response, GQLSchema $schema, Adapter $promiseAdapter) { $query = $request->getParams(); - if ($request->getHeader('x-sdk-graphql') == 'true') { + if ($request->getHeaderLine('x-sdk-graphql') == 'true') { $query = $query['query']; } - $type = $request->getHeader('content-type'); + $type = $request->getHeaderLine('content-type'); if (\str_starts_with($type, 'application/graphql')) { $query = parseGraphql($request); @@ -173,11 +173,11 @@ Http::post('/v1/graphql') ->action(function (Request $request, Response $response, GQLSchema $schema, Adapter $promiseAdapter) { $query = $request->getParams(); - if ($request->getHeader('x-sdk-graphql') == 'true') { + if ($request->getHeaderLine('x-sdk-graphql') == 'true') { $query = $query['query']; } - $type = $request->getHeader('content-type'); + $type = $request->getHeaderLine('content-type'); if (\str_starts_with($type, 'application/graphql')) { $query = parseGraphql($request); diff --git a/app/controllers/api/messaging.php b/app/controllers/api/messaging.php index 26f6bf21c4..13119ac2c6 100644 --- a/app/controllers/api/messaging.php +++ b/app/controllers/api/messaging.php @@ -17,6 +17,7 @@ use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CompoundUID; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Database\Validator\Queries\Messages; @@ -236,6 +237,100 @@ Http::post('/v1/messaging/providers/sendgrid') ->dynamic($provider, Response::MODEL_PROVIDER); }); +Http::post('/v1/messaging/providers/ses') + ->desc('Create Amazon SES provider') + ->groups(['api', 'messaging']) + ->label('audits.event', 'provider.create') + ->label('audits.resource', 'provider/{response.$id}') + ->label('event', 'providers.[providerId].create') + ->label('scope', 'providers.write') + ->label('resourceType', RESOURCE_TYPE_PROVIDERS) + ->label('sdk', new Method( + namespace: 'messaging', + group: 'providers', + name: 'createSesProvider', + description: '/docs/references/messaging/create-ses-provider.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_PROVIDER, + ) + ] + )) + ->param('providerId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) + ->param('name', '', new Text(128), 'Provider name.') + ->param('accessKey', '', new Text(0), 'AWS access key ID.', true) + ->param('secretKey', '', new Text(0), 'AWS secret access key.', true) + ->param('region', '', new Text(128), 'AWS region, for example us-east-1.', true) + ->param('fromName', '', new Text(128, 0), 'Sender Name.', true) + ->param('fromEmail', '', new Email(), 'Sender email address.', true) + ->param('replyToName', '', new Text(128, 0), 'Name set in the reply to field for the mail. Default value is sender name.', true) + ->param('replyToEmail', '', new Email(), 'Email set in the reply to field for the mail. Default value is sender email.', true) + ->param('enabled', null, new Nullable(new Boolean()), 'Set as enabled.', true) + ->inject('queueForEvents') + ->inject('dbForProject') + ->inject('response') + ->action(function (string $providerId, string $name, string $accessKey, string $secretKey, string $region, string $fromName, string $fromEmail, string $replyToName, string $replyToEmail, ?bool $enabled, Event $queueForEvents, Database $dbForProject, Response $response) { + $providerId = $providerId == 'unique()' ? ID::unique() : $providerId; + + $credentials = []; + + if (!empty($accessKey)) { + $credentials['accessKey'] = $accessKey; + } + + if (!empty($secretKey)) { + $credentials['secretKey'] = $secretKey; + } + + if (!empty($region)) { + $credentials['region'] = $region; + } + + $options = [ + 'fromName' => $fromName, + 'fromEmail' => $fromEmail, + 'replyToName' => $replyToName, + 'replyToEmail' => $replyToEmail, + ]; + + if ( + $enabled === true + && !empty($fromEmail) + && !empty($credentials['accessKey']) + && !empty($credentials['secretKey']) + && !empty($credentials['region']) + ) { + $enabled = true; + } else { + $enabled = false; + } + + $provider = new Document([ + '$id' => $providerId, + 'name' => $name, + 'provider' => 'ses', + 'type' => MESSAGE_TYPE_EMAIL, + 'enabled' => $enabled, + 'credentials' => $credentials, + 'options' => $options, + ]); + + try { + $provider = $dbForProject->createDocument('providers', $provider); + } catch (DuplicateException) { + throw new Exception(Exception::PROVIDER_ALREADY_EXISTS); + } + + $queueForEvents + ->setParam('providerId', $provider->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($provider, Response::MODEL_PROVIDER); + }); + Http::post('/v1/messaging/providers/resend') ->desc('Create Resend provider') ->groups(['api', 'messaging']) @@ -364,7 +459,7 @@ Http::post('/v1/messaging/providers/smtp') ->param('host', '', new Text(0), 'SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order.') ->param('port', 587, new Range(1, 65535), 'The default SMTP server port.', true) ->param('username', '', new Text(0), 'Authentication username.', true) - ->param('password', '', new Text(0), 'Authentication password.', true) + ->param('password', '', new PasswordFormat(new Text(0)), 'Authentication password.', true) ->param('encryption', '', new WhiteList(['none', 'ssl', 'tls']), 'Encryption type. Can be omitted, \'ssl\', or \'tls\'', true, enum: new Enum(name: 'SmtpEncryption')) ->param('autoTLS', true, new Boolean(), 'Enable SMTP AutoTLS feature.', true) ->param('mailer', '', new Text(0), 'The value to use for the X-Mailer header.', true) @@ -1458,6 +1553,119 @@ Http::patch('/v1/messaging/providers/sendgrid/:providerId') ->dynamic($provider, Response::MODEL_PROVIDER); }); +Http::patch('/v1/messaging/providers/ses/:providerId') + ->desc('Update Amazon SES provider') + ->groups(['api', 'messaging']) + ->label('audits.event', 'provider.update') + ->label('audits.resource', 'provider/{response.$id}') + ->label('event', 'providers.[providerId].update') + ->label('scope', 'providers.write') + ->label('resourceType', RESOURCE_TYPE_PROVIDERS) + ->label('sdk', new Method( + namespace: 'messaging', + group: 'providers', + name: 'updateSesProvider', + description: '/docs/references/messaging/update-ses-provider.md', + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_PROVIDER, + ) + ] + )) + ->param('providerId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Provider ID.', false, ['dbForProject']) + ->param('name', '', new Text(128), 'Provider name.', true) + ->param('enabled', null, new Nullable(new Boolean()), 'Set as enabled.', true) + ->param('accessKey', '', new Text(0), 'AWS access key ID.', true) + ->param('secretKey', '', new Text(0), 'AWS secret access key.', true) + ->param('region', '', new Text(128), 'AWS region, for example us-east-1.', true) + ->param('fromName', '', new Text(128), 'Sender Name.', true) + ->param('fromEmail', '', new Email(), 'Sender email address.', true) + ->param('replyToName', '', new Text(128), 'Name set in the Reply To field for the mail. Default value is Sender Name.', true) + ->param('replyToEmail', '', new Text(128), 'Email set in the Reply To field for the mail. Default value is Sender Email.', true) + ->inject('queueForEvents') + ->inject('dbForProject') + ->inject('response') + ->action(function (string $providerId, string $name, ?bool $enabled, string $accessKey, string $secretKey, string $region, string $fromName, string $fromEmail, string $replyToName, string $replyToEmail, Event $queueForEvents, Database $dbForProject, Response $response) { + $provider = $dbForProject->getDocument('providers', $providerId); + + if ($provider->isEmpty()) { + throw new Exception(Exception::PROVIDER_NOT_FOUND); + } + + $providerAttr = $provider->getAttribute('provider'); + + if ($providerAttr !== 'ses') { + throw new Exception(Exception::PROVIDER_INCORRECT_TYPE); + } + + if (!empty($name)) { + $provider->setAttribute('name', $name); + } + + $options = $provider->getAttribute('options'); + + if (!empty($fromName)) { + $options['fromName'] = $fromName; + } + + if (!empty($fromEmail)) { + $options['fromEmail'] = $fromEmail; + } + + if (!empty($replyToName)) { + $options['replyToName'] = $replyToName; + } + + if (!empty($replyToEmail)) { + $options['replyToEmail'] = $replyToEmail; + } + + $provider->setAttribute('options', $options); + + $credentials = $provider->getAttribute('credentials'); + + if (!empty($accessKey)) { + $credentials['accessKey'] = $accessKey; + } + + if (!empty($secretKey)) { + $credentials['secretKey'] = $secretKey; + } + + if (!empty($region)) { + $credentials['region'] = $region; + } + + $provider->setAttribute('credentials', $credentials); + + if (!\is_null($enabled)) { + if ($enabled) { + if ( + !empty($credentials['accessKey']) && + !empty($credentials['secretKey']) && + !empty($credentials['region']) && + !empty($options['fromEmail']) + ) { + $provider->setAttribute('enabled', true); + } else { + throw new Exception(Exception::PROVIDER_MISSING_CREDENTIALS); + } + } else { + $provider->setAttribute('enabled', false); + } + } + + $provider = $dbForProject->updateDocument('providers', $provider->getId(), $provider); + + $queueForEvents + ->setParam('providerId', $provider->getId()); + + $response + ->dynamic($provider, Response::MODEL_PROVIDER); + }); + Http::patch('/v1/messaging/providers/resend/:providerId') ->desc('Update Resend provider') ->groups(['api', 'messaging']) @@ -1602,7 +1810,7 @@ Http::patch('/v1/messaging/providers/smtp/:providerId') ->param('host', '', new Text(0), 'SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order.', true) ->param('port', null, new Nullable(new Range(1, 65535)), 'SMTP port.', true) ->param('username', '', new Text(0), 'Authentication username.', true) - ->param('password', '', new Text(0), 'Authentication password.', true) + ->param('password', '', new PasswordFormat(new Text(0)), 'Authentication password.', true) ->param('encryption', '', new WhiteList(['none', 'ssl', 'tls']), 'Encryption type. Can be \'ssl\' or \'tls\'', true, enum: new Enum(name: 'SmtpEncryption')) ->param('autoTLS', null, new Nullable(new Boolean()), 'Enable SMTP AutoTLS feature.', true) ->param('mailer', '', new Text(0), 'The value to use for the X-Mailer header.', true) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index 19cff6aa01..9d95f45049 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -6,6 +6,7 @@ use Appwrite\Auth\MFA\Type\TOTP; use Appwrite\Auth\Validator\Password; use Appwrite\Auth\Validator\PasswordDictionary; use Appwrite\Auth\Validator\PasswordHistory; +use Appwrite\Auth\Validator\PasswordStrength; use Appwrite\Auth\Validator\PersonalData; use Appwrite\Auth\Validator\Phone; use Appwrite\Deletes\Identities as DeleteIdentities; @@ -21,6 +22,7 @@ use Appwrite\SDK\ContentType; use Appwrite\SDK\Deprecated; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Database\Validator\Queries\Identities; use Appwrite\Utopia\Database\Validator\Queries\Memberships; @@ -65,6 +67,8 @@ use Utopia\Http\Http; use Utopia\Locale\Locale; use Utopia\Platform\Enum; use Utopia\System\System; +use Utopia\Validator; +use Utopia\Validator\AllOf; use Utopia\Validator\ArrayList; use Utopia\Validator\Assoc; use Utopia\Validator\Boolean; @@ -145,6 +149,10 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $hashedPassword = null; $isHashed = !$hash instanceof Plaintext; @@ -280,7 +288,7 @@ Http::post('/v1/users') ->param('userId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) ->param('email', null, new Nullable(new EmailValidator()), 'User email.', true) ->param('phone', null, new Nullable(new Phone()), 'Phone number. Format this number with a leading \'+\' and a country code, e.g., +16175551212.', true) - ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, $project->getAttribute('auths', [])['passwordDictionary'] ?? false), 'Plain text user password. Must be at least 8 chars.', true, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? []), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false)], Validator::TYPE_STRING)), 'Plain text user password. Must be at least 8 chars.', true, ['project', 'passwordsDictionary']) ->param('name', '', new Text(128), 'User name. Max length: 128 chars.', true) ->inject('response') ->inject('project') @@ -1431,7 +1439,7 @@ Http::patch('/v1/users/:userId/password') ] )) ->param('userId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'User ID.', false, ['dbForProject']) - ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false, allowEmpty: true), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) + ->param('password', '', fn ($project, $passwordsDictionary) => new PasswordFormat(new AllOf([new PasswordStrength($project->getAttribute('auths', [])['passwordStrength'] ?? [], allowEmpty: true), new PasswordDictionary($passwordsDictionary, enabled: $project->getAttribute('auths', [])['passwordDictionary'] ?? false, allowEmpty: true)], Validator::TYPE_STRING)), 'New user password. Must be at least 8 chars.', false, ['project', 'passwordsDictionary']) ->inject('response') ->inject('project') ->inject('dbForProject') @@ -1609,6 +1617,10 @@ Http::patch('/v1/users/:userId/email') throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $user ->setAttribute('email', $email) ->setAttribute('emailVerification', false) diff --git a/app/controllers/general.php b/app/controllers/general.php index 219c14774f..94caf4760d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -293,7 +293,12 @@ function router(Http $utopia, Database $dbForPlatform, callable $getProjectDB, S $body = $swooleRequest->getContent() ?: ''; $method = $swooleRequest->server['request_method']; - $requestHeaders = $request->getHeaders(); + // getHeaders() follows PSR-7 and returns each header as a list of values; + // collapse to single-line strings for the function/site header map below. + $requestHeaders = \array_map( + static fn (array $values) => \implode(', ', $values), + $request->getHeaders() + ); if ($resource->isEmpty() || !$resource->getAttribute('enabled')) { if ($type === 'function') { @@ -803,7 +808,7 @@ Http::init() ->inject('request') ->action(function (Document $project, Request $request) { if ($project->getId() === 'console') { - $message = empty($request->getHeader('x-appwrite-project')) ? + $message = empty($request->getHeaderLine('x-appwrite-project')) ? 'No Appwrite project was specified. Please specify your project ID when initializing your Appwrite SDK.' : 'This endpoint is not available for the console project. The Appwrite Console is a reserved project ID and cannot be used with the Appwrite SDKs and APIs. Please check if your project ID is correct.'; throw new AppwriteException(AppwriteException::GENERAL_ACCESS_FORBIDDEN, $message); @@ -861,7 +866,7 @@ Http::init() return; } - $requestFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + $requestFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if ($requestFormat) { if (version_compare($requestFormat, '1.4.0', '<')) { $request->addFilter(new RequestV16()); @@ -899,7 +904,7 @@ Http::init() } } - $localeParam = (string) $request->getParam('locale', $request->getHeader('x-appwrite-locale', '')); + $localeParam = (string) $request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', '')); if (\in_array($localeParam, $localeCodes)) { $locale->setDefault($localeParam); } @@ -919,7 +924,7 @@ Http::init() /* * Response format */ - $responseFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + $responseFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if ($responseFormat) { if (version_compare($responseFormat, '1.9.5', '<')) { $response->addFilter(new ResponseV26()); @@ -1006,7 +1011,7 @@ Http::init() // Application level CSRF protection $origin = $request->getOrigin(); - if (empty($origin) || !$devKey->isEmpty() || !empty($request->getHeader('x-appwrite-key'))) { + if (empty($origin) || !$devKey->isEmpty() || !empty($request->getHeaderLine('x-appwrite-key'))) { return; } $route = $request->getRoute(); @@ -1198,7 +1203,7 @@ Http::error() $line = $error->getLine(); $trace = $error->getTrace(); - Span::error($error); + Span::current()?->setError($error); switch ($class) { case Utopia\Http\Exception::class: @@ -1315,7 +1320,7 @@ Http::error() } $log->addTag('hostname', $request->getHostname()); - $log->addTag('locale', (string)$request->getParam('locale', $request->getHeader('x-appwrite-locale', ''))); + $log->addTag('locale', (string)$request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', ''))); $log->addExtra('file', $error->getFile()); $log->addExtra('line', $error->getLine()); diff --git a/app/controllers/mock.php b/app/controllers/mock.php index 00389085af..fcb17da717 100644 --- a/app/controllers/mock.php +++ b/app/controllers/mock.php @@ -46,7 +46,7 @@ Http::get('/v1/mock/tests/locale') ->inject('request') ->inject('response') ->action(function (Locale $locale, array $localeCodes, Request $request, Response $response) { - $localeParam = (string) $request->getParam('locale', $request->getHeader('x-appwrite-locale', '')); + $localeParam = (string) $request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', '')); if (\in_array($localeParam, $localeCodes)) { $locale->setDefault($localeParam); } diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index db1bf99edb..4b5f7170ff 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -201,19 +201,19 @@ Http::init() if (! empty($apiKey->getProjectId())) { $dbKey = $project->find( key: 'secret', - find: $request->getHeader('x-appwrite-key', ''), + find: $request->getHeaderLine('x-appwrite-key', ''), subject: 'keys' ); } elseif (! empty($apiKey->getUserId())) { $dbKey = $user->find( key: 'secret', - find: $request->getHeader('x-appwrite-key', ''), + find: $request->getHeaderLine('x-appwrite-key', ''), subject: 'keys' ); } elseif (! empty($apiKey->getTeamId())) { $dbKey = $team->find( key: 'secret', - find: $request->getHeader('x-appwrite-key', ''), + find: $request->getHeaderLine('x-appwrite-key', ''), subject: 'keys' ); } @@ -231,7 +231,7 @@ Http::init() } $sdkValidator = new WhiteList($servers, true); - $sdk = $request->getHeader('x-sdk-name', 'UNKNOWN'); + $sdk = $request->getHeaderLine('x-sdk-name', 'UNKNOWN'); if ($sdk !== 'UNKNOWN' && $sdkValidator->isValid($sdk)) { $sdks = $dbKey->getAttribute('sdks', []); diff --git a/app/http.php b/app/http.php index 6226026a16..94bc5d01ac 100644 --- a/app/http.php +++ b/app/http.php @@ -529,6 +529,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $app->setCompression(System::getEnv('_APP_COMPRESSION_ENABLED', 'enabled') === 'enabled'); $app->setCompressionMinSize(intval(System::getEnv('_APP_COMPRESSION_MIN_SIZE_BYTES', '1024'))); // 1KB + $error = null; try { $authorization = $app->context()->get('authorization'); @@ -542,7 +543,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $route = $app->match($request)?->route; Span::add('http.path', $route?->getPath() ?? 'unknown'); } catch (\Throwable $th) { - Span::error($th); + $error = $th; $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); @@ -577,7 +578,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $log->addTag('code', $th->getCode()); // $log->addTag('projectId', $project->getId()); // TODO: Figure out how to get ProjectID, if it becomes relevant $log->addTag('hostname', $request->getHostname()); - $log->addTag('locale', (string)$request->getParam('locale', $request->getHeader('x-appwrite-locale', ''))); + $log->addTag('locale', (string)$request->getParam('locale', $request->getHeaderLine('x-appwrite-locale', ''))); $log->addExtra('file', $th->getFile()); $log->addExtra('line', $th->getLine()); @@ -631,7 +632,7 @@ $swoole->onRequest(function ($utopiaRequest, $utopiaResponse) use ($files, $swoo $swooleResponse->end(\json_encode($output)); } finally { Span::add('http.response.code', $response->getStatusCode()); - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); diff --git a/app/init/constants.php b/app/init/constants.php index 545f3acafa..8e015a5e29 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -243,6 +243,12 @@ const RULE_STATUS_VERIFIED = 'verified'; // Message types const MESSAGE_SEND_TYPE_INTERNAL = 'internal'; const MESSAGE_SEND_TYPE_EXTERNAL = 'external'; +// External message fan-out tuning +const MESSAGE_RECIPIENTS_PAGE_SIZE = 5000; // Recipients resolved from the database per page while streaming a send; aligned with APP_LIMIT_COUNT to minimise round-trips on large topics +const MESSAGE_SEND_CONCURRENCY = 10; // Maximum adapter send requests running concurrently within a single send job +const MESSAGE_DELIVERY_ERRORS_LIMIT = 100; // Maximum number of per-recipient delivery errors retained on a message +const MESSAGE_SEND_MAX_RETRIES = 5; // Maximum number of attempts to deliver a batch when the provider throttles or fails transiently +const MESSAGE_SEND_RETRY_DELAY = 1.0; // Base seconds for exponential backoff between batch send retries; overridable in tests for an instant suite // Mail Types const MAIL_TYPE_VERIFICATION = 'verification'; const MAIL_TYPE_MAGIC_SESSION = 'magicSession'; diff --git a/app/init/database/filters.php b/app/init/database/filters.php index e171805c47..cba0c0cad6 100644 --- a/app/init/database/filters.php +++ b/app/init/database/filters.php @@ -231,6 +231,7 @@ Database::addFilter( return $database->getAuthorization()->skip(fn () => $database ->find('authenticators', [ Query::equal('userInternalId', [$document->getSequence()]), + Query::orderDesc('$createdAt'), Query::limit(APP_LIMIT_SUBQUERY), ])); } diff --git a/app/init/models.php b/app/init/models.php index 08ebc3af23..d0f665bb4e 100644 --- a/app/init/models.php +++ b/app/init/models.php @@ -168,6 +168,7 @@ use Appwrite\Utopia\Response\Model\PolicyMembershipPrivacy; use Appwrite\Utopia\Response\Model\PolicyPasswordDictionary; use Appwrite\Utopia\Response\Model\PolicyPasswordHistory; use Appwrite\Utopia\Response\Model\PolicyPasswordPersonalData; +use Appwrite\Utopia\Response\Model\PolicyPasswordStrength; use Appwrite\Utopia\Response\Model\PolicySessionAlert; use Appwrite\Utopia\Response\Model\PolicySessionDuration; use Appwrite\Utopia\Response\Model\PolicySessionInvalidation; @@ -460,6 +461,7 @@ Response::setModel(new OAuth2Microsoft()); Response::setModel(new OAuth2ProviderList()); Response::setModel(new PolicyPasswordDictionary()); Response::setModel(new PolicyPasswordHistory()); +Response::setModel(new PolicyPasswordStrength()); Response::setModel(new PolicyPasswordPersonalData()); Response::setModel(new PolicySessionAlert()); Response::setModel(new PolicySessionDuration()); diff --git a/app/init/realtime/connection.php b/app/init/realtime/connection.php index a090635bb5..397d077aa7 100644 --- a/app/init/realtime/connection.php +++ b/app/init/realtime/connection.php @@ -24,7 +24,7 @@ use Utopia\Validator\WhiteList; */ return function (Container $container): void { $getProjectId = static function (Request $request): string { - $projectId = $request->getHeader('x-appwrite-project', ''); + $projectId = $request->getHeaderLine('x-appwrite-project', ''); if (!empty($projectId)) { return $projectId; @@ -36,7 +36,7 @@ return function (Container $container): void { }; $getMode = static function (Request $request, Document $project) use ($getProjectId): string { - $mode = $request->getParam('mode', $request->getHeader('x-appwrite-mode', APP_MODE_DEFAULT)); + $mode = $request->getParam('mode', $request->getHeaderLine('x-appwrite-mode', APP_MODE_DEFAULT)); $projectId = $getProjectId($request); if (!empty($projectId) && $project->getId() !== $projectId) { @@ -113,7 +113,7 @@ return function (Container $container): void { }; $findDevKey = static function (Request $request, Document $project, array $servers, Authorization $authorization) use ($getDbForPlatform): Document { - $devKey = $request->getHeader('x-appwrite-dev-key', $request->getParam('devKey', '')); + $devKey = $request->getHeaderLine('x-appwrite-dev-key', $request->getParam('devKey', '')); $key = $project->find('secret', $devKey, 'devKeys'); if (!$key) { @@ -137,7 +137,7 @@ return function (Container $container): void { } $sdkValidator = new WhiteList($servers, true); - $sdk = \strtolower($request->getHeader('x-sdk-name', 'UNKNOWN')); + $sdk = \strtolower($request->getHeaderLine('x-sdk-name', 'UNKNOWN')); if ($sdk !== 'unknown' && $sdkValidator->isValid($sdk)) { $sdks = $key->getAttribute('sdks', []); @@ -233,7 +233,7 @@ return function (Container $container): void { ); if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { - $sessionHeader = $request->getHeader('x-appwrite-session', ''); + $sessionHeader = $request->getHeaderLine('x-appwrite-session', ''); if (!empty($sessionHeader)) { $store->decode($sessionHeader); @@ -241,7 +241,7 @@ return function (Container $container): void { } if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { - $fallback = \json_decode($request->getHeader('x-fallback-cookies', ''), true); + $fallback = \json_decode($request->getHeaderLine('x-fallback-cookies', ''), true); $store->decode((\is_array($fallback) && isset($fallback[$store->getKey()])) ? $fallback[$store->getKey()] : ''); } @@ -271,7 +271,7 @@ return function (Container $container): void { $user = new User([]); } - $authJWT = $request->getHeader('x-appwrite-jwt', ''); + $authJWT = $request->getHeaderLine('x-appwrite-jwt', ''); if (!empty($authJWT) && !$project->isEmpty()) { if (!$user->isEmpty()) { throw new Exception(Exception::USER_JWT_AND_COOKIE_SET); @@ -300,8 +300,8 @@ return function (Container $container): void { } } - $accountKey = $request->getHeader('x-appwrite-key', ''); - $accountKeyUserId = $request->getHeader('x-appwrite-user', ''); + $accountKey = $request->getHeaderLine('x-appwrite-key', ''); + $accountKeyUserId = $request->getHeaderLine('x-appwrite-user', ''); if (!empty($accountKeyUserId) && !empty($accountKey)) { if (!$user->isEmpty()) { @@ -329,9 +329,9 @@ return function (Container $container): void { // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeaderLine('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeaderLine('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeaderLine('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = ($mode === APP_MODE_ADMIN || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; diff --git a/app/init/registers.php b/app/init/registers.php index 9ea19eee24..e7ede8b025 100644 --- a/app/init/registers.php +++ b/app/init/registers.php @@ -222,12 +222,6 @@ $register->set('pools', function () { 'multiple' => false, 'schemes' => ['redis'], ], - 'consumer' => [ - 'type' => 'consumer', - 'dsns' => $fallbackForRedis, - 'multiple' => false, - 'schemes' => ['redis'], - ], 'pubsub' => [ 'type' => 'pubsub', 'dsns' => $fallbackForRedis, @@ -254,6 +248,10 @@ $register->set('pools', function () { $workerCount = intval(System::getEnv('_APP_CPU_NUM', swoole_cpu_num())) * intval(System::getEnv('_APP_WORKER_PER_CORE', 6)); $poolSize = max(1, (int)($instanceConnections / $workerCount)); + // Queue workers consume jobs concurrently with coroutines; each in-flight + // job may hold a connection, so pools must cover the coroutine count. + $poolSize = max($poolSize, (int) System::getEnv('_APP_WORKER_MAX_COROUTINES', 1)); + foreach ($connections as $key => $connection) { $type = $connection['type']; $multiple = $connection['multiple']; @@ -340,9 +338,10 @@ $register->set('pools', function () { // PubSub workers hold one long-lived subscribed connection and also need // spare capacity for publishes from the same process. - $connectionPoolSize = $type === 'pubsub' - ? max(2, $poolSize) - : $poolSize; + $connectionPoolSize = match ($type) { + 'pubsub' => max(2, $poolSize), + default => $poolSize, + }; $pool = new Pool($poolAdapter, $name, $connectionPoolSize, function () use ($type, $resource, $dsn) { // Get Adapter @@ -364,9 +363,12 @@ $register->set('pools', function () { default => null }; case 'publisher': - case 'consumer': + // Publishers never block on receive, so one connection backs both broker slots. return match ($dsn->getScheme()) { - 'redis' => new Queue\Broker\Redis(new Queue\Connection\Redis($dsn->getHost(), $dsn->getPort())), + 'redis' => (function () use ($dsn) { + $connection = new Queue\Connection\Redis($dsn->getHost(), $dsn->getPort()); + return new Queue\Broker\Redis($connection, $connection); + })(), default => null }; case 'cache': @@ -451,7 +453,7 @@ $register->set('smtp', function () { ); }); $register->set('geodb', function () { - return new Reader(__DIR__ . '/../assets/dbip/dbip-country-lite-2025-12.mmdb'); + return new Reader(__DIR__ . '/../assets/dbip/dbip-country-lite-2026-06.mmdb'); }); $register->set('passwordsDictionary', function () { $content = \file_get_contents(__DIR__ . '/../assets/security/10k-common-passwords'); diff --git a/app/init/resources/request.php b/app/init/resources/request.php index 416c294140..982cd13088 100644 --- a/app/init/resources/request.php +++ b/app/init/resources/request.php @@ -387,7 +387,7 @@ return function (Container $context): void { // Get session from header for SSR clients if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { - $sessionHeader = $request->getHeader('x-appwrite-session', ''); + $sessionHeader = $request->getHeaderLine('x-appwrite-session', ''); if (! empty($sessionHeader)) { $store->decode($sessionHeader); @@ -399,7 +399,7 @@ return function (Container $context): void { if (empty($store->getProperty('id', '')) && empty($store->getProperty('secret', ''))) { $response->addHeader('X-Debug-Fallback', 'true'); - $fallback = $request->getHeader('x-fallback-cookies', ''); + $fallback = $request->getHeaderLine('x-fallback-cookies', ''); $fallback = \json_decode($fallback, true); $store->decode(((is_array($fallback) && isset($fallback[$store->getKey()])) ? $fallback[$store->getKey()] : '')); } @@ -432,7 +432,7 @@ return function (Container $context): void { $user = new User([]); } - $authJWT = $request->getHeader('x-appwrite-jwt', ''); + $authJWT = $request->getHeaderLine('x-appwrite-jwt', ''); if (! empty($authJWT) && ! $project->isEmpty()) { // JWT authentication if (! $user->isEmpty()) { throw new Exception(Exception::USER_JWT_AND_COOKIE_SET); @@ -462,8 +462,8 @@ return function (Container $context): void { } // Account based on account API key - $accountKey = $request->getHeader('x-appwrite-key', ''); - $accountKeyUserId = $request->getHeader('x-appwrite-user', ''); + $accountKey = $request->getHeaderLine('x-appwrite-key', ''); + $accountKeyUserId = $request->getHeaderLine('x-appwrite-user', ''); if (! empty($accountKeyUserId) && ! empty($accountKey)) { if (! $user->isEmpty()) { throw new Exception(Exception::USER_API_KEY_AND_SESSION_SET); @@ -491,9 +491,9 @@ return function (Container $context): void { // Impersonation: if current user has impersonator capability and headers/params are set, act as another user // Query params mirror the header fallback pattern used by ?project= and ?devKey=, // allowing Console to embed impersonation in direct file/image URLs where headers cannot be set. - $impersonateUserId = $request->getHeader('x-appwrite-impersonate-user-id', (string)$request->getParam('impersonateUserId', '')); - $impersonateEmail = $request->getHeader('x-appwrite-impersonate-user-email', (string)$request->getParam('impersonateEmail', '')); - $impersonatePhone = $request->getHeader('x-appwrite-impersonate-user-phone', (string)$request->getParam('impersonatePhone', '')); + $impersonateUserId = $request->getHeaderLine('x-appwrite-impersonate-user-id', (string)($request->getParam('impersonateuserid', '') ?: $request->getParam('impersonateUserId', ''))); + $impersonateEmail = $request->getHeaderLine('x-appwrite-impersonate-user-email', (string)($request->getParam('impersonateemail', '') ?: $request->getParam('impersonateEmail', ''))); + $impersonatePhone = $request->getHeaderLine('x-appwrite-impersonate-user-phone', (string)($request->getParam('impersonatephone', '') ?: $request->getParam('impersonatePhone', ''))); if (!$user->isEmpty() && $user->getAttribute('impersonator', false)) { $userDb = (APP_MODE_ADMIN === $mode || $project->getId() === 'console') ? $dbForPlatform : $dbForProject; $targetUser = null; @@ -525,10 +525,10 @@ return function (Container $context): void { /** @var Appwrite\Utopia\Request $request */ /** @var Utopia\Database\Database $dbForPlatform */ /** @var Utopia\Database\Document $console */ - $projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', '')); + $projectId = $request->getParam('project', $request->getHeaderLine('x-appwrite-project', '')); // Realtime channel "project" can send project=Query array if (! \is_string($projectId)) { - $projectId = $request->getHeader('x-appwrite-project', ''); + $projectId = $request->getHeaderLine('x-appwrite-project', ''); } // Backwards compatibility for new services, originally project resources @@ -920,9 +920,9 @@ return function (Container $context): void { * - 'default' => Requests for Client and Server Side * - 'admin' => Request from the Console on non-console projects */ - $mode = $request->getParam('mode', $request->getHeader('x-appwrite-mode', APP_MODE_DEFAULT)); + $mode = $request->getParam('mode', $request->getHeaderLine('x-appwrite-mode', APP_MODE_DEFAULT)); - $projectId = $request->getParam('project', $request->getHeader('x-appwrite-project', '')); + $projectId = $request->getParam('project', $request->getHeaderLine('x-appwrite-project', '')); if (!empty($projectId) && $project->getId() !== $projectId) { $mode = APP_MODE_ADMIN; } @@ -932,7 +932,7 @@ return function (Container $context): void { $context->set('requestTimestamp', function ($request) { // TODO: Move this to the Request class itself - $timestampHeader = $request->getHeader('x-appwrite-timestamp'); + $timestampHeader = $request->getHeaderLine('x-appwrite-timestamp'); $requestTimestamp = null; if (! empty($timestampHeader)) { try { @@ -946,7 +946,7 @@ return function (Container $context): void { }, ['request']); $context->set('devKey', function (Request $request, Document $project, array $servers, Database $dbForPlatform, Authorization $authorization) { - $devKey = $request->getHeader('x-appwrite-dev-key', $request->getParam('devKey', '')); + $devKey = $request->getHeaderLine('x-appwrite-dev-key', $request->getParam('devKey', '')); // Check if given key match project's development keys $key = $project->find('secret', $devKey, 'devKeys'); @@ -972,7 +972,7 @@ return function (Container $context): void { // add sdk to key $sdkValidator = new WhiteList($servers, true); - $sdk = \strtolower($request->getHeader('x-sdk-name', 'UNKNOWN')); + $sdk = \strtolower($request->getHeaderLine('x-sdk-name', 'UNKNOWN')); if ($sdk !== 'unknown' && $sdkValidator->isValid($sdk)) { $sdks = $key->getAttribute('sdks', []); @@ -1001,7 +1001,7 @@ return function (Container $context): void { } else { $route = $utopia->match($request)?->route; $path = ! empty($route) ? $route->getPath() : $request->getURI(); - $orgHeader = $request->getHeader('x-appwrite-organization', ''); + $orgHeader = $request->getHeaderLine('x-appwrite-organization', ''); if (str_starts_with($path, '/v1/projects/:projectId')) { $uri = $request->getURI(); $pid = explode('/', $uri)[3]; @@ -1047,7 +1047,7 @@ return function (Container $context): void { } if ($allowed) { - $host = $request->getQuery('appwrite-hostname', $request->getHeader('x-appwrite-hostname', '')) ?? ''; + $host = $request->getQuery('appwrite-hostname', $request->getHeaderLine('x-appwrite-hostname', '')) ?? ''; if (! empty($host)) { return $host; } @@ -1057,7 +1057,7 @@ return function (Container $context): void { }, ['request', 'apiKey']); $context->set('apiKey', function (Request $request, Document $project, Document $team, Document $user): ?Key { - $key = $request->getHeader('x-appwrite-key'); + $key = $request->getHeaderLine('x-appwrite-key'); if (empty($key)) { return null; @@ -1065,9 +1065,9 @@ return function (Container $context): void { $key = Key::decode($project, $team, $user, $key); - $userHeader = $request->getHeader('x-appwrite-user'); - $organizationHeader = $request->getHeader('x-appwrite-organization'); - $projectHeader = $request->getHeader('x-appwrite-project'); + $userHeader = $request->getHeaderLine('x-appwrite-user'); + $organizationHeader = $request->getHeaderLine('x-appwrite-organization'); + $projectHeader = $request->getHeaderLine('x-appwrite-project'); if (! empty($key->getProjectId())) { if (empty($projectHeader) || $projectHeader !== $key->getProjectId()) { @@ -1170,7 +1170,7 @@ return function (Container $context): void { ['host' => \gethostname(), 'project' => $project->getId()] ); - $timeout = \intval($request->getHeader('x-appwrite-timeout')); + $timeout = \intval($request->getHeaderLine('x-appwrite-timeout')); if (!empty($timeout) && Http::isDevelopment()) { $database->setTimeout($timeout); } diff --git a/app/init/span.php b/app/init/span.php index f6871badfa..4249daa2ac 100644 --- a/app/init/span.php +++ b/app/init/span.php @@ -12,7 +12,7 @@ $traceProjectId = System::getEnv('_APP_TRACE_PROJECT_ID', ''); $traceFunctionId = System::getEnv('_APP_TRACE_FUNCTION_ID', ''); $traceEnabled = $traceProjectId !== '' || $traceFunctionId !== ''; -Span::addExporter(new Exporter\Pretty(), function (Span $span) use ($traceEnabled, $traceProjectId, $traceFunctionId): bool { +Span::setExporters(new Exporter\Pretty(sampler: function (Span $span) use ($traceEnabled, $traceProjectId, $traceFunctionId): bool { if (\str_starts_with($span->getAction(), 'listener.')) { return $span->getError() !== null; } @@ -29,4 +29,4 @@ Span::addExporter(new Exporter\Pretty(), function (Span $span) use ($traceEnable } return true; -}); +})); diff --git a/app/realtime.php b/app/realtime.php index c99e4c0857..39bdf103fe 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -699,8 +699,15 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats, ); } + // Restore authorization after subscribe - if ($authorization !== null) { + // meta can be empty as well as the channels are not required query param to connect + // channels and queries can be sent via message later on + // so if meta is empty we are not subscribing above to the projectId + if (!isset($realtime->connections[$connection])) { + $realtime->subscribe($projectId, $connection, '', $roles, [], [], $userId); + } + if ($authorization !== null && isset($realtime->connections[$connection])) { $realtime->connections[$connection]['authorization'] = $authorization; } @@ -845,6 +852,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, Span::add('realtime.origin', $request->getOrigin()); } + $error = null; try { /** @var Document $project */ $project = $connectionContainer->get('project'); @@ -914,7 +922,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $channels = Realtime::convertChannels($request->getQuery('channels', []), $user->getId()); $channelCount = \count($channels); - $updateStats = static function (string $projectId, ?string $teamId, string $payloadJson) use ($register, $stats): void { + $updateStats = static function (string $projectId, ?string $teamId) use ($register, $stats): void { $register->get('telemetry.connectionCounter')->add(1); $register->get('telemetry.workerClientCounter')->add(1, $register->get('telemetry.workerAttributes')); $register->get('telemetry.connectionCreatedCounter')->add(1); @@ -928,7 +936,6 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, triggerStats([ METRIC_REALTIME_CONNECTIONS => 1, - METRIC_REALTIME_OUTBOUND => \strlen($payloadJson), ], $projectId); }; @@ -949,9 +956,12 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $realtime->subscribe($project->getId(), $connection, '', $roles, [], [], $user->getId()); $realtime->connections[$connection]['authorization'] = $authorization; + $updateStats($project->getId(), $project->getAttribute('teamId')); $server->send([$connection], $connectedPayloadJson); $outboundBytes += \strlen($connectedPayloadJson); - $updateStats($project->getId(), $project->getAttribute('teamId'), $connectedPayloadJson); + triggerStats([ + METRIC_REALTIME_OUTBOUND => \strlen($connectedPayloadJson), + ], $project->getId()); $subscriptionMode = 'message'; $success = true; return; @@ -969,6 +979,8 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, throw new Exception(Exception::REALTIME_POLICY_VIOLATION, $e->getMessage()); } + $sanitizedUser = empty($user->getId()) ? null : $response->output($user, Response::MODEL_ACCOUNT); + $mapping = []; foreach ($subscriptions as $index => $subscription) { $subscriptionId = ID::unique(); @@ -985,31 +997,33 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, $mapping[$index] = $subscriptionId; } + + $realtime->connections[$connection]['authorization'] = $authorization; + $updateStats($project->getId(), $project->getAttribute('teamId')); + $subscriptionCount = \count($subscriptions); if (!empty($subscriptions)) { $register->get('telemetry.workerSubscriptionCounter')->add(\count($subscriptions), $register->get('telemetry.workerAttributes')); } - $realtime->connections[$connection]['authorization'] = $authorization; - - $user = empty($user->getId()) ? null : $response->output($user, Response::MODEL_ACCOUNT); - $connectedPayloadJson = json_encode([ 'type' => 'connected', 'data' => [ 'channels' => $names, 'subscriptions' => $mapping, - 'user' => $user + 'user' => $sanitizedUser ] ]); $server->send([$connection], $connectedPayloadJson); $outboundBytes += \strlen($connectedPayloadJson); - $updateStats($project->getId(), $project->getAttribute('teamId'), $connectedPayloadJson); + triggerStats([ + METRIC_REALTIME_OUTBOUND => \strlen($connectedPayloadJson), + ], $project->getId()); $success = true; } catch (Throwable $th) { - Span::error($th); + $error = $th; // Convert known Utopia DB exceptions to AppwriteException so isPublishable() // suppresses expected client errors (permission denied, query timeout) from Sentry. @@ -1067,7 +1081,7 @@ $server->onOpen(function (int $connection, SwooleRequest $request) use ($server, if (!empty($logUser?->getId())) { Span::add('user.id', $logUser->getId()); } - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); @@ -1086,6 +1100,7 @@ $server->onMessage(function (int $connection, string $message) use ($container, Span::add('realtime.inbound_bytes', $rawSize); Span::add('realtime.container.id', $containerId); + $error = null; try { $response = new Response(new SwooleResponse()); @@ -1207,13 +1222,16 @@ $server->onMessage(function (int $connection, string $message) use ($container, $outboundBytes += $bytes; if ($project !== null && !$project->isEmpty()) { - triggerStats([METRIC_REALTIME_OUTBOUND => $bytes], $project->getId()); + triggerStats([ + METRIC_REALTIME_OUTBOUND => $bytes, + METRIC_REALTIME_CONNECTIONS_MESSAGES_SENT => 1, + ], $project->getId()); } } $success = true; } catch (Throwable $th) { - Span::error($th); + $error = $th; // Convert known Utopia DB exceptions to AppwriteException so isPublishable() // suppresses expected client errors (permission denied, query timeout) from Sentry. @@ -1259,7 +1277,7 @@ $server->onMessage(function (int $connection, string $message) use ($container, Span::add('project.id', $project?->getId() ?? $projectId); Span::add('user.id', $realtime->connections[$connection]['userId'] ?? null); Span::add('realtime.message_type', $messageType); - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); @@ -1279,20 +1297,27 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ try { if (array_key_exists($connection, $realtime->connections)) { - $stats->decr($realtime->connections[$connection]['projectId'], 'connectionsTotal'); + // These decrements are symmetric with the increments in updateStats (onOpen), + // which run when the connection enters $realtime->connections — the same gate as the + // array_key_exists check above. The connectionsTotal stat is keyed by project, so it's + // additionally guarded: a connection can exist without a stored projectId (e.g. only an + // authorization entry left after an orphaning re-subscribe). $register->get('telemetry.connectionCounter')->add(-1); $register->get('telemetry.workerClientCounter')->add(-1, $register->get('telemetry.workerAttributes')); + if (!empty($projectId)) { + $stats->decr($projectId, 'connectionsTotal'); + } $subscriptionsBeforeClose = \count($realtime->getSubscriptionMetadata($connection)); if ($subscriptionsBeforeClose > 0) { $register->get('telemetry.workerSubscriptionCounter')->add(-$subscriptionsBeforeClose, $register->get('telemetry.workerAttributes')); } - $projectId = $realtime->connections[$connection]['projectId']; /** @var array $presencesById */ $presencesById = $realtime->connections[$connection]['presences'] ?? []; if ( !empty($presencesById) + && !empty($projectId) && $projectId !== 'console' ) { go(function () use ($presencesById, $projectId, $userId, $container, $presenceState): void { @@ -1346,7 +1371,7 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ ); $presenceState->triggerUsage($publisherForUsage, $project, -$deletionCount); } catch (Throwable $th) { - Span::error($th); + Span::current()?->setError($th); logError($th, 'realtimeOnClosePresenceDeletion', tags: [ 'projectId' => $projectId, 'presences' => \count($presences) @@ -1373,7 +1398,7 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ } } } catch (Throwable $th) { - Span::error($th); + Span::current()?->setError($th); logError($th, 'realtimeOnClosePresenceCleanup', tags: [ 'projectId' => $projectId, ]); @@ -1383,22 +1408,24 @@ $server->onClose(function (int $connection) use ($realtime, $stats, $register, $ }); } - triggerStats([ - METRIC_REALTIME_CONNECTIONS => -1, - ], $projectId); + if (!empty($projectId)) { + triggerStats([ + METRIC_REALTIME_CONNECTIONS => -1, + ], $projectId); + } } $success = true; } catch (\Throwable $th) { // Log only; do not rethrow. If we let this bubble, Swoole dumps full coroutine // backtraces and unsubscribe() below would never run (connection cleanup would fail). Console::error('Realtime onClose error: ' . $th->getMessage()); - Span::error($th); + Span::current()?->setError($th); } finally { try { $realtime->unsubscribe($connection); } catch (\Throwable $th) { Console::error('Realtime onClose unsubscribe error: ' . $th->getMessage()); - Span::error($th); + Span::current()?->setError($th); } Span::add('realtime.success', $success); diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 6ce1fb5cea..d71ccff0b4 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -983,12 +983,12 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); - appwrite openruntimes-executor: - container_name: openruntimes-executor + container_name: exc1 hostname: exc1 <<: *x-logging restart: unless-stopped stop_signal: SIGINT - image: openruntimes/executor:0.11.4 + image: openruntimes/executor:0.24.1 networks: - appwrite - runtimes @@ -1001,6 +1001,8 @@ $hostPath = rtrim($this->getParam('hostPath', ''), '/'); # It's not possible to share mount file between 2 containers without host mount (copying is too slow) - /tmp:/tmp:rw environment: + - OPR_EXECUTOR_CONNECTION_STORAGE=local://localhost + - OPR_EXECUTOR_CONNECTION_BUILD_CACHE_STORAGE= - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL - OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK @@ -1209,3 +1211,4 @@ volumes: appwrite-sites: appwrite-builds: appwrite-config: + openruntimes-node-modules-cache: diff --git a/app/worker.php b/app/worker.php index 169b8e9770..999bcbc9c6 100644 --- a/app/worker.php +++ b/app/worker.php @@ -12,9 +12,10 @@ use Utopia\Database\Validator\Authorization; use Utopia\Logger\Log; use Utopia\Logger\Logger; use Utopia\Platform\Service; -use Utopia\Pools\Group; use Utopia\Queue\Adapter\Swoole; -use Utopia\Queue\Broker\Pool as BrokerPool; +use Utopia\Queue\Broker\Redis as BrokerRedis; +use Utopia\Queue\Connection\Locking; +use Utopia\Queue\Connection\Redis as RedisConnection; use Utopia\Queue\Server; use Utopia\Span\Span; use Utopia\System\System; @@ -38,22 +39,6 @@ $container->set('project', fn () => new Document([]), []); $container->set('log', fn () => new Log(), []); -$container->set('consumer', function (Group $pools) { - return new BrokerPool(consumer: $pools->get('consumer')); -}, ['pools']); - -$container->set('consumerDatabases', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); - -$container->set('consumerMigrations', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); - -$container->set('consumerStatsUsage', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); - $container->set('certificates', function () { $email = System::getEnv('_APP_EMAIL_CERTIFICATES', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS')); if (empty($email)) { @@ -80,20 +65,27 @@ if (\str_starts_with($workerName, 'databases')) { $queueName = System::getEnv('_APP_QUEUE_NAME', 'v1-' . strtolower($workerName)); } -/** @var \Utopia\Pools\Group $pools */ -$pools = $container->get('pools'); +$redisHost = System::getEnv('_APP_REDIS_HOST', 'redis'); +$redisPort = (int) System::getEnv('_APP_REDIS_PORT', 6379); +// A dedicated connection drives the blocking receive loop; a lock-guarded one +// serializes acks/publishes from the per-message coroutines. $adapter = new Swoole( - $pools->get('consumer')->pop()->getResource(), + new BrokerRedis( + receive: new RedisConnection($redisHost, $redisPort), + commands: new Locking(new RedisConnection($redisHost, $redisPort)), + ), System::getEnv('_APP_WORKERS_NUM', 1), - $queueName + $queueName, + maxCoroutines: (int) System::getEnv('_APP_WORKER_MAX_COROUTINES', 1), + resources: $container, ); -$worker = new Server($adapter, $container); +$worker = new Server($adapter); try { $worker->init()->action(function () use ($worker, $registerWorkerMessageResources, $queueName) { - $registerWorkerMessageResources($worker->getContainer()); + $registerWorkerMessageResources($worker->context()); Span::init("worker.{$queueName}"); }); @@ -103,7 +95,7 @@ try { $container->set('bus', function ($register) use ($worker) { return $register->get('bus')->setResolver( - fn (string $name) => $worker->getContainer()->get($name) + fn (string $name) => $worker->context()->get($name) ); }, ['register']); @@ -126,7 +118,7 @@ $worker ->action(function (Throwable $error, ?Logger $logger, Log $log, Document $project, Authorization $authorization) use ($queueName) { $version = System::getEnv('_APP_VERSION', 'UNKNOWN'); - Span::error($error); + Span::current()?->setError($error); if ($logger) { $log->setNamespace('appwrite-worker'); diff --git a/composer.json b/composer.json index ad18771699..af7575c671 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,8 @@ "analyze": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G", "bench": "vendor/bin/phpbench run --report=benchmark", "check": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G", + "refactor": "vendor/bin/rector process", + "refactor:check": "vendor/bin/rector process --dry-run", "installer:clean": "php src/Appwrite/Platform/Installer/Server.php --clean", "installer:dev": "docker compose build && composer installer:clean && php src/Appwrite/Platform/Installer/Server.php --docker" }, @@ -57,7 +59,7 @@ "utopia-php/audit": "^2.4", "utopia-php/auth": "0.5.*", "utopia-php/cache": "^3.0", - "utopia-php/cli": "0.23.*", + "utopia-php/cli": "^0.24", "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", @@ -65,7 +67,7 @@ "utopia-php/detector": "0.2.*", "utopia-php/domains": "^2.2", "utopia-php/emails": "0.7.*", - "utopia-php/dns": "1.7.*", + "utopia-php/dns": "^1.8", "utopia-php/dsn": "0.2.1", "utopia-php/http": "^2.0@RC", "utopia-php/fetch": "^1.1", @@ -74,13 +76,13 @@ "utopia-php/locale": "0.8.*", "utopia-php/lock": "0.2.*", "utopia-php/logger": "0.8.*", - "utopia-php/messaging": "0.22.*", + "utopia-php/messaging": "1.0.*", "utopia-php/migration": "1.*", - "utopia-php/platform": "1.0.0-rc3", + "utopia-php/platform": "^1.0@RC", "utopia-php/pools": "1.*", - "utopia-php/span": "1.1.*", + "utopia-php/span": "3.0.*", "utopia-php/preloader": "0.2.*", - "utopia-php/queue": "0.18.*", + "utopia-php/queue": "^0.21", "utopia-php/servers": "0.4.*", "utopia-php/registry": "0.5.*", "utopia-php/storage": "2.*", @@ -100,14 +102,15 @@ }, "require-dev": { "ext-fileinfo": "*", - "appwrite/sdk-generator": "*", + "appwrite/sdk-generator": "^2.0", "brianium/paratest": "7.*", "phpunit/phpunit": "12.*", "swoole/ide-helper": "6.*", "phpstan/phpstan": "^2.0", "textalk/websocket": "1.5.*", "czproject/git-php": "4.*", - "laravel/pint": "1.*" + "laravel/pint": "1.*", + "rector/rector": "^2.4" }, "provide": { "ext-phpiredis": "*" diff --git a/composer.lock b/composer.lock index 70c843efe4..703189e5f9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ec80b1465e57bc223903fa102249f216", + "content-hash": "fe6368e3d42f385c63d7e5e2e911febd", "packages": [ { "name": "adhocore/jwt", - "version": "1.1.3", + "version": "v1.1.4", "source": { "type": "git", "url": "https://github.com/adhocore/php-jwt.git", - "reference": "ad417603d9d45578b6af2089ad5b78f101c82367" + "reference": "b7055ae9024a6627f19f9873b5db19b0f1dcc4e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/adhocore/php-jwt/zipball/ad417603d9d45578b6af2089ad5b78f101c82367", - "reference": "ad417603d9d45578b6af2089ad5b78f101c82367", + "url": "https://api.github.com/repos/adhocore/php-jwt/zipball/b7055ae9024a6627f19f9873b5db19b0f1dcc4e7", + "reference": "b7055ae9024a6627f19f9873b5db19b0f1dcc4e7", "shasum": "" }, "require": { @@ -53,7 +53,7 @@ ], "support": { "issues": "https://github.com/adhocore/php-jwt/issues", - "source": "https://github.com/adhocore/php-jwt/tree/1.1.3" + "source": "https://github.com/adhocore/php-jwt/tree/v1.1.4" }, "funding": [ { @@ -65,20 +65,20 @@ "type": "github" } ], - "time": "2025-02-18T01:00:50+00:00" + "time": "2026-05-30T07:58:15+00:00" }, { "name": "appwrite/appwrite", - "version": "23.1.1", + "version": "24.2.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-for-php.git", - "reference": "fd7c0f0bf5ddf334533534b20ed967cfb400f6ea" + "reference": "d3217b6524b9d174ab91fb7ffc555c68bfa1da97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/fd7c0f0bf5ddf334533534b20ed967cfb400f6ea", - "reference": "fd7c0f0bf5ddf334533534b20ed967cfb400f6ea", + "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/d3217b6524b9d174ab91fb7ffc555c68bfa1da97", + "reference": "d3217b6524b9d174ab91fb7ffc555c68bfa1da97", "shasum": "" }, "require": { @@ -104,10 +104,10 @@ "support": { "email": "team@appwrite.io", "issues": "https://github.com/appwrite/sdk-for-php/issues", - "source": "https://github.com/appwrite/sdk-for-php/tree/23.1.1", + "source": "https://github.com/appwrite/sdk-for-php/tree/24.2.0", "url": "https://appwrite.io/support" }, - "time": "2026-05-12T11:03:36+00:00" + "time": "2026-05-21T18:56:51+00:00" }, { "name": "appwrite/php-clamav", @@ -1703,137 +1703,6 @@ }, "time": "2025-09-24T15:06:41+00:00" }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "support": { - "email": "info@paragonie.com", - "issues": "https://github.com/paragonie/random_compat/issues", - "source": "https://github.com/paragonie/random_compat" - }, - "time": "2020-10-15T08:29:30+00:00" - }, - { - "name": "php-amqplib/php-amqplib", - "version": "v3.7.4", - "source": { - "type": "git", - "url": "https://github.com/php-amqplib/php-amqplib.git", - "reference": "381b6f7c600e0e0c7463cdd7f7a1a3bc6268e5fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/381b6f7c600e0e0c7463cdd7f7a1a3bc6268e5fd", - "reference": "381b6f7c600e0e0c7463cdd7f7a1a3bc6268e5fd", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "ext-sockets": "*", - "php": "^7.2||^8.0", - "phpseclib/phpseclib": "^2.0|^3.0" - }, - "conflict": { - "php": "7.4.0 - 7.4.1" - }, - "replace": { - "videlalvaro/php-amqplib": "self.version" - }, - "require-dev": { - "ext-curl": "*", - "nategood/httpful": "^0.2.20", - "phpunit/phpunit": "^7.5|^9.5", - "squizlabs/php_codesniffer": "^3.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpAmqpLib\\": "PhpAmqpLib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Alvaro Videla", - "role": "Original Maintainer" - }, - { - "name": "Raúl Araya", - "email": "nubeiro@gmail.com", - "role": "Maintainer" - }, - { - "name": "Luke Bakken", - "email": "luke@bakken.io", - "role": "Maintainer" - }, - { - "name": "Ramūnas Dronga", - "email": "github@ramuno.lt", - "role": "Maintainer" - } - ], - "description": "Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.", - "homepage": "https://github.com/php-amqplib/php-amqplib/", - "keywords": [ - "message", - "queue", - "rabbitmq" - ], - "support": { - "issues": "https://github.com/php-amqplib/php-amqplib/issues", - "source": "https://github.com/php-amqplib/php-amqplib/tree/v3.7.4" - }, - "time": "2025-11-23T17:00:56+00:00" - }, { "name": "php-http/discovery", "version": "1.20.0", @@ -1994,116 +1863,6 @@ ], "time": "2023-11-25T22:23:28+00:00" }, - { - "name": "phpseclib/phpseclib", - "version": "3.0.52", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "2adaefc83df2ec548558307690f376dd7d4f4fce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/2adaefc83df2ec548558307690f376dd7d4f4fce", - "reference": "2adaefc83df2ec548558307690f376dd7d4f4fce", - "shasum": "" - }, - "require": { - "paragonie/constant_time_encoding": "^1|^2|^3", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "suggest": { - "ext-dom": "Install the DOM extension to load XML formatted public keys.", - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib3\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "support": { - "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.52" - }, - "funding": [ - { - "url": "https://github.com/terrafrost", - "type": "github" - }, - { - "url": "https://www.patreon.com/phpseclib", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", - "type": "tidelift" - } - ], - "time": "2026-04-27T07:02:15+00:00" - }, { "name": "psr/clock", "version": "1.0.0", @@ -2571,16 +2330,16 @@ }, { "name": "spomky-labs/otphp", - "version": "11.4.2", + "version": "11.4.3", "source": { "type": "git", "url": "https://github.com/Spomky-Labs/otphp.git", - "reference": "2a1b503fd1c1a5c751ab3c5cd37f2d2d26ab74ad" + "reference": "46663316285bf1f001a31584213b327494b00ae7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/otphp/zipball/2a1b503fd1c1a5c751ab3c5cd37f2d2d26ab74ad", - "reference": "2a1b503fd1c1a5c751ab3c5cd37f2d2d26ab74ad", + "url": "https://api.github.com/repos/Spomky-Labs/otphp/zipball/46663316285bf1f001a31584213b327494b00ae7", + "reference": "46663316285bf1f001a31584213b327494b00ae7", "shasum": "" }, "require": { @@ -2625,7 +2384,7 @@ ], "support": { "issues": "https://github.com/Spomky-Labs/otphp/issues", - "source": "https://github.com/Spomky-Labs/otphp/tree/11.4.2" + "source": "https://github.com/Spomky-Labs/otphp/tree/11.4.3" }, "funding": [ { @@ -2637,7 +2396,7 @@ "type": "patreon" } ], - "time": "2026-01-23T10:53:01+00:00" + "time": "2026-05-31T12:42:43+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2895,16 +2654,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.38.1", + "version": "v1.38.2", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92" + "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/14c5439eec4ccff081ac14eca2dc57feb2a66d92", - "reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", + "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", "shasum": "" }, "require": { @@ -2956,7 +2715,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2" }, "funding": [ { @@ -2976,7 +2735,7 @@ "type": "tidelift" } ], - "time": "2026-05-26T12:51:13+00:00" + "time": "2026-05-27T06:59:30+00:00" }, { "name": "symfony/polyfill-php82", @@ -3060,16 +2819,16 @@ }, { "name": "symfony/polyfill-php83", - "version": "v1.38.1", + "version": "v1.38.2", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "8339098cae28673c15cce00d80734af0453054e2" + "reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/8339098cae28673c15cce00d80734af0453054e2", - "reference": "8339098cae28673c15cce00d80734af0453054e2", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/796a26abb75ce49f3a84433cd81bf1009d73d5f8", + "reference": "796a26abb75ce49f3a84433cd81bf1009d73d5f8", "shasum": "" }, "require": { @@ -3116,7 +2875,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.38.2" }, "funding": [ { @@ -3136,20 +2895,20 @@ "type": "tidelift" } ], - "time": "2026-05-26T12:51:13+00:00" + "time": "2026-05-27T06:51:48+00:00" }, { "name": "symfony/polyfill-php85", - "version": "v1.37.0", + "version": "v1.38.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php85.git", - "reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee" + "reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/fcfa4973a9917cef23f2e38774da74a2b7d115ee", - "reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1", + "reference": "ba2ba04f3352cfa2dcbbcb90aee13ed967f505b1", "shasum": "" }, "require": { @@ -3196,7 +2955,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php85/tree/v1.37.0" + "source": "https://github.com/symfony/polyfill-php85/tree/v1.38.1" }, "funding": [ { @@ -3216,7 +2975,7 @@ "type": "tidelift" } ], - "time": "2026-04-26T13:10:57+00:00" + "time": "2026-05-26T02:25:22+00:00" }, { "name": "symfony/service-contracts", @@ -3359,20 +3118,20 @@ }, { "name": "utopia-php/abuse", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "5d7efbe5c6b0cf7d06003114fd86e24ba785582f" + "reference": "00e59c89a1ac5f4ad771695e5dbee020b3c7ac44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/5d7efbe5c6b0cf7d06003114fd86e24ba785582f", - "reference": "5d7efbe5c6b0cf7d06003114fd86e24ba785582f", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/00e59c89a1ac5f4ad771695e5dbee020b3c7ac44", + "reference": "00e59c89a1ac5f4ad771695e5dbee020b3c7ac44", "shasum": "" }, "require": { - "appwrite/appwrite": "23.*", + "appwrite/appwrite": "24.*", "ext-curl": "*", "ext-pdo": "*", "ext-redis": "*", @@ -3405,9 +3164,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/1.3.0" + "source": "https://github.com/utopia-php/abuse/tree/1.3.1" }, - "time": "2026-05-11T08:07:02+00:00" + "time": "2026-06-03T07:30:05+00:00" }, { "name": "utopia-php/agents", @@ -3510,16 +3269,16 @@ }, { "name": "utopia-php/audit", - "version": "2.4.1", + "version": "2.4.2", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "eddd79d93f23ed2851c0df2b1e2e2dfb25ba06c6" + "reference": "6f15caaac5455c98cec06e02fe8da3af9477ff38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/eddd79d93f23ed2851c0df2b1e2e2dfb25ba06c6", - "reference": "eddd79d93f23ed2851c0df2b1e2e2dfb25ba06c6", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/6f15caaac5455c98cec06e02fe8da3af9477ff38", + "reference": "6f15caaac5455c98cec06e02fe8da3af9477ff38", "shasum": "" }, "require": { @@ -3554,26 +3313,27 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/2.4.1" + "source": "https://github.com/utopia-php/audit/tree/2.4.2" }, - "time": "2026-05-20T06:25:45+00:00" + "time": "2026-06-03T03:42:22+00:00" }, { "name": "utopia-php/auth", - "version": "0.5.0", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/utopia-php/auth.git", - "reference": "5ad0ded3a79f153ee904b97b49f8dfe4669e4fd0" + "reference": "9245a6342ed94f00425aef6963a32b8af9b0dc9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/auth/zipball/5ad0ded3a79f153ee904b97b49f8dfe4669e4fd0", - "reference": "5ad0ded3a79f153ee904b97b49f8dfe4669e4fd0", + "url": "https://api.github.com/repos/utopia-php/auth/zipball/9245a6342ed94f00425aef6963a32b8af9b0dc9d", + "reference": "9245a6342ed94f00425aef6963a32b8af9b0dc9d", "shasum": "" }, "require": { "ext-hash": "*", + "ext-openssl": "*", "ext-scrypt": "*", "ext-sodium": "*", "php": ">=8.0" @@ -3609,9 +3369,9 @@ ], "support": { "issues": "https://github.com/utopia-php/auth/issues", - "source": "https://github.com/utopia-php/auth/tree/0.5.0" + "source": "https://github.com/utopia-php/auth/tree/0.5.1" }, - "time": "2025-10-29T07:11:43+00:00" + "time": "2026-05-30T12:21:17+00:00" }, { "name": "utopia-php/cache", @@ -3731,27 +3491,23 @@ }, { "name": "utopia-php/cli", - "version": "0.23.4", + "version": "0.24.1", "source": { "type": "git", "url": "https://github.com/utopia-php/cli.git", - "reference": "59f66e72ec1f8350968d8b95c0039faaac7a6d6d" + "reference": "ba1eabbbfa56f0936de7455a26dcd1afc3246636" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cli/zipball/59f66e72ec1f8350968d8b95c0039faaac7a6d6d", - "reference": "59f66e72ec1f8350968d8b95c0039faaac7a6d6d", + "url": "https://api.github.com/repos/utopia-php/cli/zipball/ba1eabbbfa56f0936de7455a26dcd1afc3246636", + "reference": "ba1eabbbfa56f0936de7455a26dcd1afc3246636", "shasum": "" }, "require": { "php": ">=7.4", - "utopia-php/servers": "0.4.*" + "utopia-php/servers": "^0.4" }, "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.6", "swoole/ide-helper": "4.8.8", "utopia-php/console": "0.0.*" }, @@ -3776,31 +3532,34 @@ ], "support": { "issues": "https://github.com/utopia-php/cli/issues", - "source": "https://github.com/utopia-php/cli/tree/0.23.4" + "source": "https://github.com/utopia-php/cli/tree/0.24.1" }, - "time": "2026-05-21T14:42:15+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/compression", - "version": "0.1.4", + "version": "0.1.5", "source": { "type": "git", "url": "https://github.com/utopia-php/compression.git", - "reference": "68045cb9d714c1259582d2dfd0e76bd34f83e713" + "reference": "d39208e3f0f3ad0a793e8023046eb2e69b57bae3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/compression/zipball/68045cb9d714c1259582d2dfd0e76bd34f83e713", - "reference": "68045cb9d714c1259582d2dfd0e76bd34f83e713", + "url": "https://api.github.com/repos/utopia-php/compression/zipball/d39208e3f0f3ad0a793e8023046eb2e69b57bae3", + "reference": "d39208e3f0f3ad0a793e8023046eb2e69b57bae3", "shasum": "" }, "require": { "php": ">=8.1" }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpunit/phpunit": "^9.3", - "vimeo/psalm": "4.0.1" + "suggest": { + "ext-brotli": "Required for the Brotli algorithm", + "ext-lz4": "Required for the LZ4 algorithm", + "ext-snappy": "Required for the Snappy algorithm", + "ext-xz": "Required for the XZ algorithm", + "ext-zlib": "Required for the GZIP and Deflate algorithms", + "ext-zstd": "Required for the Zstd algorithm" }, "type": "library", "autoload": { @@ -3822,9 +3581,9 @@ ], "support": { "issues": "https://github.com/utopia-php/compression/issues", - "source": "https://github.com/utopia-php/compression/tree/0.1.4" + "source": "https://github.com/utopia-php/compression/tree/0.1.5" }, - "time": "2026-02-17T05:53:40+00:00" + "time": "2026-06-10T15:38:47+00:00" }, { "name": "utopia-php/config", @@ -3923,16 +3682,16 @@ }, { "name": "utopia-php/database", - "version": "5.9.0", + "version": "5.9.2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "477bae83e27631f78c159f45b0441c0c7dc69050" + "reference": "698952455dd645ff41057621c90a4cea977fb1bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/477bae83e27631f78c159f45b0441c0c7dc69050", - "reference": "477bae83e27631f78c159f45b0441c0c7dc69050", + "url": "https://api.github.com/repos/utopia-php/database/zipball/698952455dd645ff41057621c90a4cea977fb1bf", + "reference": "698952455dd645ff41057621c90a4cea977fb1bf", "shasum": "" }, "require": { @@ -3977,9 +3736,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/5.9.0" + "source": "https://github.com/utopia-php/database/tree/5.9.2" }, - "time": "2026-05-17T15:57:21+00:00" + "time": "2026-06-12T08:33:14+00:00" }, { "name": "utopia-php/detector", @@ -4028,16 +3787,16 @@ }, { "name": "utopia-php/di", - "version": "0.3.2", + "version": "0.3.3", "source": { "type": "git", "url": "https://github.com/utopia-php/di.git", - "reference": "07025d721ed5d9be27932e8e640acf1467fc4b9d" + "reference": "a0cee7ff9976bb6b596619aeac524948a8ee3dfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/di/zipball/07025d721ed5d9be27932e8e640acf1467fc4b9d", - "reference": "07025d721ed5d9be27932e8e640acf1467fc4b9d", + "url": "https://api.github.com/repos/utopia-php/di/zipball/a0cee7ff9976bb6b596619aeac524948a8ee3dfb", + "reference": "a0cee7ff9976bb6b596619aeac524948a8ee3dfb", "shasum": "" }, "require": { @@ -4045,10 +3804,7 @@ "psr/container": "^2.0" }, "require-dev": { - "laravel/pint": "^1.27", "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^9.5.25", "swoole/ide-helper": "4.8.3" }, "type": "library", @@ -4073,28 +3829,28 @@ ], "support": { "issues": "https://github.com/utopia-php/di/issues", - "source": "https://github.com/utopia-php/di/tree/0.3.2" + "source": "https://github.com/utopia-php/di/tree/0.3.3" }, - "time": "2026-03-21T07:42:10+00:00" + "time": "2026-06-10T14:22:41+00:00" }, { "name": "utopia-php/dns", - "version": "1.7.2", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/utopia-php/dns.git", - "reference": "5225f52a82d4128e69ad17c2a81fcfea6aa00ae1" + "reference": "c09469c396c6f95888789151a3157fd0928e740b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/dns/zipball/5225f52a82d4128e69ad17c2a81fcfea6aa00ae1", - "reference": "5225f52a82d4128e69ad17c2a81fcfea6aa00ae1", + "url": "https://api.github.com/repos/utopia-php/dns/zipball/c09469c396c6f95888789151a3157fd0928e740b", + "reference": "c09469c396c6f95888789151a3157fd0928e740b", "shasum": "" }, "require": { "php": ">=8.3", "utopia-php/domains": "^2.0", - "utopia-php/span": "1.1.*", + "utopia-php/span": "3.0.*", "utopia-php/telemetry": "*", "utopia-php/validators": "0.*" }, @@ -4130,9 +3886,9 @@ ], "support": { "issues": "https://github.com/utopia-php/dns/issues", - "source": "https://github.com/utopia-php/dns/tree/1.7.2" + "source": "https://github.com/utopia-php/dns/tree/1.8.0" }, - "time": "2026-05-20T04:49:11+00:00" + "time": "2026-06-12T04:44:06+00:00" }, { "name": "utopia-php/domains", @@ -4346,32 +4102,27 @@ }, { "name": "utopia-php/http", - "version": "2.0.0-rc4", + "version": "2.0.0-rc9", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "0396a959c6a3be7c16b4b72283347327a75d1f92" + "reference": "e4fdbc57ac6dc7cad1604eb904d3c95a31226ba9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/0396a959c6a3be7c16b4b72283347327a75d1f92", - "reference": "0396a959c6a3be7c16b4b72283347327a75d1f92", + "url": "https://api.github.com/repos/utopia-php/http/zipball/e4fdbc57ac6dc7cad1604eb904d3c95a31226ba9", + "reference": "e4fdbc57ac6dc7cad1604eb904d3c95a31226ba9", "shasum": "" }, "require": { "php": ">=8.3", - "utopia-php/compression": "0.1.*", - "utopia-php/di": "0.3.*", - "utopia-php/servers": "0.4.*", + "utopia-php/compression": "^0.1", + "utopia-php/di": "^0.3", + "utopia-php/servers": "^0.4", "utopia-php/telemetry": "^0.4", - "utopia-php/validators": "0.2.*" + "utopia-php/validators": "^0.2" }, "require-dev": { - "doctrine/instantiator": "^1.5", - "laravel/pint": "1.*", - "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^12.0", - "rector/rector": "^2.4", "swoole/ide-helper": "4.8.3" }, "suggest": { @@ -4396,9 +4147,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/2.0.0-rc4" + "source": "https://github.com/utopia-php/http/tree/2.0.0-rc9" }, - "time": "2026-06-02T04:17:22+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/image", @@ -4500,25 +4251,22 @@ }, { "name": "utopia-php/lock", - "version": "0.2.0", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/lock.git", - "reference": "49317c9493d8f747e4299aa24c22862aa5f6e106" + "reference": "9ef48d7094f5c68d1736f664f6e9b4b1ec656f21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/lock/zipball/49317c9493d8f747e4299aa24c22862aa5f6e106", - "reference": "49317c9493d8f747e4299aa24c22862aa5f6e106", + "url": "https://api.github.com/repos/utopia-php/lock/zipball/9ef48d7094f5c68d1736f664f6e9b4b1ec656f21", + "reference": "9ef48d7094f5c68d1736f664f6e9b4b1ec656f21", "shasum": "" }, "require": { "php": ">=8.3" }, "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "2.*", - "phpunit/phpunit": "11.*", "swoole/ide-helper": "*" }, "suggest": { @@ -4542,12 +4290,12 @@ "email": "team@appwrite.io" } ], - "description": "Mutex, semaphore, file and distributed locks for PHP — one interface, four backends.", + "description": "A simple lock library to coordinate access to shared resources across coroutines, processes and hosts", "support": { "issues": "https://github.com/utopia-php/lock/issues", - "source": "https://github.com/utopia-php/lock/tree/0.2.0" + "source": "https://github.com/utopia-php/lock/tree/0.2.1" }, - "time": "2026-04-24T10:47:56+00:00" + "time": "2026-06-10T15:55:36+00:00" }, { "name": "utopia-php/logger", @@ -4606,16 +4354,16 @@ }, { "name": "utopia-php/messaging", - "version": "0.22.3", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "67366d5f45cc92efe7adb6aab5d6dcd2342f2f9e" + "reference": "1aca8968c3bf3c78c428a399dfe97cbe9b366ec4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/67366d5f45cc92efe7adb6aab5d6dcd2342f2f9e", - "reference": "67366d5f45cc92efe7adb6aab5d6dcd2342f2f9e", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/1aca8968c3bf3c78c428a399dfe97cbe9b366ec4", + "reference": "1aca8968c3bf3c78c428a399dfe97cbe9b366ec4", "shasum": "" }, "require": { @@ -4651,26 +4399,26 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/0.22.3" + "source": "https://github.com/utopia-php/messaging/tree/1.0.0" }, - "time": "2026-05-19T05:31:20+00:00" + "time": "2026-06-02T14:54:22+00:00" }, { "name": "utopia-php/migration", - "version": "1.12.0", + "version": "1.13.2", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "3ee6e12af256726bddc3a0402c94535132abecc6" + "reference": "50526e121efcf73e11309446f194623a431d7e32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/3ee6e12af256726bddc3a0402c94535132abecc6", - "reference": "3ee6e12af256726bddc3a0402c94535132abecc6", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/50526e121efcf73e11309446f194623a431d7e32", + "reference": "50526e121efcf73e11309446f194623a431d7e32", "shasum": "" }, "require": { - "appwrite/appwrite": "23.*", + "appwrite/appwrite": "24.*", "ext-curl": "*", "ext-openssl": "*", "halaxa/json-machine": "^1.2", @@ -4706,9 +4454,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.12.0" + "source": "https://github.com/utopia-php/migration/tree/1.13.2" }, - "time": "2026-05-14T07:30:09+00:00" + "time": "2026-06-04T05:09:07+00:00" }, { "name": "utopia-php/mongo", @@ -4773,30 +4521,26 @@ }, { "name": "utopia-php/platform", - "version": "1.0.0-rc3", + "version": "1.0.0-rc9", "source": { "type": "git", "url": "https://github.com/utopia-php/platform.git", - "reference": "674fd3cea6d1f8db660b01c5be89e8333dfb6de9" + "reference": "5ae1fba6d797ba617816a1a582d9c1b1d188a1bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/platform/zipball/674fd3cea6d1f8db660b01c5be89e8333dfb6de9", - "reference": "674fd3cea6d1f8db660b01c5be89e8333dfb6de9", + "url": "https://api.github.com/repos/utopia-php/platform/zipball/5ae1fba6d797ba617816a1a582d9c1b1d188a1bc", + "reference": "5ae1fba6d797ba617816a1a582d9c1b1d188a1bc", "shasum": "" }, "require": { "ext-json": "*", "ext-redis": "*", "php": ">=8.3", - "utopia-php/cli": "0.23.*", + "utopia-php/cli": "^0.24", "utopia-php/http": "^2.0@RC", - "utopia-php/queue": "0.18.*", - "utopia-php/servers": "0.4.*" - }, - "require-dev": { - "laravel/pint": "1.2.*", - "phpunit/phpunit": "^9.3" + "utopia-php/queue": "^0.21", + "utopia-php/servers": "^0.4" }, "type": "library", "autoload": { @@ -4818,34 +4562,34 @@ ], "support": { "issues": "https://github.com/utopia-php/platform/issues", - "source": "https://github.com/utopia-php/platform/tree/1.0.0-rc3" + "source": "https://github.com/utopia-php/platform/tree/1.0.0-rc9" }, - "time": "2026-05-25T11:48:18+00:00" + "time": "2026-06-11T10:36:26+00:00" }, { "name": "utopia-php/pools", - "version": "1.0.3", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/utopia-php/pools.git", - "reference": "74de7c5457a2c447f27e7ec4d72e8412a7d68c10" + "reference": "e66e498d59cf3ac48c1f4c70be46f7eb6df7a63b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/pools/zipball/74de7c5457a2c447f27e7ec4d72e8412a7d68c10", - "reference": "74de7c5457a2c447f27e7ec4d72e8412a7d68c10", + "url": "https://api.github.com/repos/utopia-php/pools/zipball/e66e498d59cf3ac48c1f4c70be46f7eb6df7a63b", + "reference": "e66e498d59cf3ac48c1f4c70be46f7eb6df7a63b", "shasum": "" }, "require": { "php": ">=8.4", - "utopia-php/telemetry": "*" + "utopia-php/telemetry": "^0.4" }, "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "1.*", - "phpunit/phpunit": "11.*", "swoole/ide-helper": "6.*" }, + "suggest": { + "ext-swoole": "Required to use the Swoole pool adapter" + }, "type": "library", "autoload": { "psr-4": { @@ -4871,9 +4615,9 @@ ], "support": { "issues": "https://github.com/utopia-php/pools/issues", - "source": "https://github.com/utopia-php/pools/tree/1.0.3" + "source": "https://github.com/utopia-php/pools/tree/1.0.5" }, - "time": "2026-02-26T08:42:40+00:00" + "time": "2026-06-10T15:14:31+00:00" }, { "name": "utopia-php/preloader", @@ -4976,33 +4720,29 @@ }, { "name": "utopia-php/queue", - "version": "0.18.6", + "version": "0.21.1", "source": { "type": "git", "url": "https://github.com/utopia-php/queue.git", - "reference": "954cd3788b37697b83fd2757adcd93422f21a846" + "reference": "abc5173ff7079118ebf5a22cb8008e8cf0a150e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/queue/zipball/954cd3788b37697b83fd2757adcd93422f21a846", - "reference": "954cd3788b37697b83fd2757adcd93422f21a846", + "url": "https://api.github.com/repos/utopia-php/queue/zipball/abc5173ff7079118ebf5a22cb8008e8cf0a150e4", + "reference": "abc5173ff7079118ebf5a22cb8008e8cf0a150e4", "shasum": "" }, "require": { - "php": ">=8.3", - "php-amqplib/php-amqplib": "^3.7", - "utopia-php/di": "0.3.*", - "utopia-php/lock": "0.2.*", - "utopia-php/pools": "1.*", - "utopia-php/servers": "0.4.*", - "utopia-php/telemetry": "0.4.*", - "utopia-php/validators": "0.2.*" + "php": ">=8.4", + "utopia-php/di": "^0.3", + "utopia-php/lock": "^0.2", + "utopia-php/pools": "^1.0", + "utopia-php/servers": "^0.4", + "utopia-php/telemetry": "^0.4", + "utopia-php/validators": "^0.2" }, "require-dev": { "ext-redis": "*", - "laravel/pint": "^1.0", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^11.0", "swoole/ide-helper": "4.8.8", "workerman/workerman": "^4.0" }, @@ -5037,9 +4777,9 @@ ], "support": { "issues": "https://github.com/utopia-php/queue/issues", - "source": "https://github.com/utopia-php/queue/tree/0.18.6" + "source": "https://github.com/utopia-php/queue/tree/0.21.1" }, - "time": "2026-06-01T19:47:57+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/registry", @@ -5095,27 +4835,22 @@ }, { "name": "utopia-php/servers", - "version": "0.4.1", + "version": "0.4.3", "source": { "type": "git", "url": "https://github.com/utopia-php/servers.git", - "reference": "6e9241f587a19c0e9e7a3587fe3b15ffb2d4c2a4" + "reference": "a160268a804ae1a6d8a6ee41aed8dda1d2553da8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/servers/zipball/6e9241f587a19c0e9e7a3587fe3b15ffb2d4c2a4", - "reference": "6e9241f587a19c0e9e7a3587fe3b15ffb2d4c2a4", + "url": "https://api.github.com/repos/utopia-php/servers/zipball/a160268a804ae1a6d8a6ee41aed8dda1d2553da8", + "reference": "a160268a804ae1a6d8a6ee41aed8dda1d2553da8", "shasum": "" }, "require": { "php": ">=8.2", - "utopia-php/di": "0.3.*", - "utopia-php/validators": "0.*" - }, - "require-dev": { - "laravel/pint": "^0.2.3", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit": "^9.5.5" + "utopia-php/di": "^0.3", + "utopia-php/validators": "^0.2" }, "type": "library", "autoload": { @@ -5143,22 +4878,22 @@ ], "support": { "issues": "https://github.com/utopia-php/servers/issues", - "source": "https://github.com/utopia-php/servers/tree/0.4.1" + "source": "https://github.com/utopia-php/servers/tree/0.4.3" }, - "time": "2026-05-21T13:08:45+00:00" + "time": "2026-06-10T16:25:51+00:00" }, { "name": "utopia-php/span", - "version": "1.1.5", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/utopia-php/span.git", - "reference": "028406940ca92bdc88099f0b1a123a3b2cbdd4e5" + "reference": "97f0ab6e9125c000262f8b5b007423d11fd1a9b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/span/zipball/028406940ca92bdc88099f0b1a123a3b2cbdd4e5", - "reference": "028406940ca92bdc88099f0b1a123a3b2cbdd4e5", + "url": "https://api.github.com/repos/utopia-php/span/zipball/97f0ab6e9125c000262f8b5b007423d11fd1a9b3", + "reference": "97f0ab6e9125c000262f8b5b007423d11fd1a9b3", "shasum": "" }, "require": { @@ -5187,22 +4922,22 @@ "description": "Simple span tracing library for PHP with coroutine support", "support": { "issues": "https://github.com/utopia-php/span/issues", - "source": "https://github.com/utopia-php/span/tree/1.1.5" + "source": "https://github.com/utopia-php/span/tree/3.0.1" }, - "time": "2026-02-13T18:00:11+00:00" + "time": "2026-05-13T11:53:06+00:00" }, { "name": "utopia-php/storage", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "a604b0ee011c4f366d53167caf2cf6b0f1d62d7e" + "reference": "b8af52e8ae1f9e670b32255a8936bbb46634b711" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/a604b0ee011c4f366d53167caf2cf6b0f1d62d7e", - "reference": "a604b0ee011c4f366d53167caf2cf6b0f1d62d7e", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/b8af52e8ae1f9e670b32255a8936bbb46634b711", + "reference": "b8af52e8ae1f9e670b32255a8936bbb46634b711", "shasum": "" }, "require": { @@ -5239,9 +4974,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/2.0.4" + "source": "https://github.com/utopia-php/storage/tree/2.0.5" }, - "time": "2026-06-02T04:17:22+00:00" + "time": "2026-06-03T05:21:46+00:00" }, { "name": "utopia-php/system", @@ -5301,16 +5036,16 @@ }, { "name": "utopia-php/telemetry", - "version": "0.4.0", + "version": "0.4.1", "source": { "type": "git", "url": "https://github.com/utopia-php/telemetry.git", - "reference": "e0630df7d8176833cd4882f78814a5b893dcb0e0" + "reference": "028f3a85bb987b1e9357fb1632aa40f020d1b86e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/e0630df7d8176833cd4882f78814a5b893dcb0e0", - "reference": "e0630df7d8176833cd4882f78814a5b893dcb0e0", + "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/028f3a85bb987b1e9357fb1632aa40f020d1b86e", + "reference": "028f3a85bb987b1e9357fb1632aa40f020d1b86e", "shasum": "" }, "require": { @@ -5323,10 +5058,7 @@ "symfony/http-client": "7.*" }, "require-dev": { - "laravel/pint": "1.*", "phpbench/phpbench": "1.*", - "phpstan/phpstan": "2.*", - "phpunit/phpunit": "11.*", "swoole/ide-helper": "6.*" }, "suggest": { @@ -5343,6 +5075,7 @@ "license": [ "MIT" ], + "description": "A lite & fast telemetry library, with adapters for OpenTelemetry", "keywords": [ "framework", "php", @@ -5350,32 +5083,27 @@ ], "support": { "issues": "https://github.com/utopia-php/telemetry/issues", - "source": "https://github.com/utopia-php/telemetry/tree/0.4.0" + "source": "https://github.com/utopia-php/telemetry/tree/0.4.1" }, - "time": "2026-05-29T11:57:04+00:00" + "time": "2026-06-10T15:48:26+00:00" }, { "name": "utopia-php/validators", - "version": "0.2.4", + "version": "0.2.6", "source": { "type": "git", "url": "https://github.com/utopia-php/validators.git", - "reference": "b4ee60db4dbae5ffbe53968d01f69b6941251576" + "reference": "f1ac4f08d6876daf117a1d9af53a4c7b752c2c0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/validators/zipball/b4ee60db4dbae5ffbe53968d01f69b6941251576", - "reference": "b4ee60db4dbae5ffbe53968d01f69b6941251576", + "url": "https://api.github.com/repos/utopia-php/validators/zipball/f1ac4f08d6876daf117a1d9af53a4c7b752c2c0b", + "reference": "f1ac4f08d6876daf117a1d9af53a4c7b752c2c0b", "shasum": "" }, "require": { "php": ">=8.0" }, - "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "2.*", - "phpunit/phpunit": "11.*" - }, "type": "library", "autoload": { "psr-4": { @@ -5395,22 +5123,22 @@ ], "support": { "issues": "https://github.com/utopia-php/validators/issues", - "source": "https://github.com/utopia-php/validators/tree/0.2.4" + "source": "https://github.com/utopia-php/validators/tree/0.2.6" }, - "time": "2026-05-21T12:47:43+00:00" + "time": "2026-06-10T14:45:13+00:00" }, { "name": "utopia-php/vcs", - "version": "4.2.0", + "version": "4.2.2", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "49d7751f0ae94634b00057177d9823928f6777c6" + "reference": "bb42584d3efb95ff4eb241605bb15165c56974de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/49d7751f0ae94634b00057177d9823928f6777c6", - "reference": "49d7751f0ae94634b00057177d9823928f6777c6", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/bb42584d3efb95ff4eb241605bb15165c56974de", + "reference": "bb42584d3efb95ff4eb241605bb15165c56974de", "shasum": "" }, "require": { @@ -5444,9 +5172,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/4.2.0" + "source": "https://github.com/utopia-php/vcs/tree/4.2.2" }, - "time": "2026-05-17T15:58:27+00:00" + "time": "2026-06-10T08:08:48+00:00" }, { "name": "utopia-php/websocket", @@ -5639,16 +5367,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.31.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "3bc6c697e60807dd036b5c02c66d03183afad79f" + "reference": "60a2e804c1464494d763e5ff6bfff9b188502253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3bc6c697e60807dd036b5c02c66d03183afad79f", - "reference": "3bc6c697e60807dd036b5c02c66d03183afad79f", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/60a2e804c1464494d763e5ff6bfff9b188502253", + "reference": "60a2e804c1464494d763e5ff6bfff9b188502253", "shasum": "" }, "require": { @@ -5656,19 +5384,20 @@ "ext-json": "*", "ext-mbstring": "*", "matthiasmullie/minify": "1.3.*", - "php": ">=8.3", + "php": ">=8.5", "twig/twig": "3.27.*" }, "require-dev": { "brianium/paratest": "7.*", "phpunit/phpunit": "11.*", + "rector/rector": "^2.4", "squizlabs/php_codesniffer": "3.*" }, "type": "library", "autoload": { "psr-4": { - "Appwrite\\SDK\\": "src/SDK", - "Appwrite\\Spec\\": "src/Spec" + "Appwrite\\SDK\\": "src/SDK/", + "Appwrite\\Spec\\": "src/Spec/" } }, "notification-url": "https://packagist.org/downloads/", @@ -5681,12 +5410,12 @@ "email": "eldad@appwrite.io" } ], - "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", + "description": "SDK generator for Appwrite APIs across multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.31.8" + "source": "https://github.com/appwrite/sdk-generator/tree/2.0.0" }, - "time": "2026-05-28T05:01:17+00:00" + "time": "2026-06-11T05:54:24+00:00" }, { "name": "brianium/paratest", @@ -6395,11 +6124,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.55", + "version": "2.2.1", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9eaac3826ed5e9b8427350a43cac825eeca3f566", - "reference": "9eaac3826ed5e9b8427350a43cac825eeca3f566", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dea9c8f2d25cc849391042b71e429c1a4bf82660", + "reference": "dea9c8f2d25cc849391042b71e429c1a4bf82660", "shasum": "" }, "require": { @@ -6422,6 +6151,17 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], "description": "PHPStan - PHP Static Analysis Tool", "keywords": [ "dev", @@ -6444,20 +6184,20 @@ "type": "github" } ], - "time": "2026-05-18T11:57:34+00:00" + "time": "2026-05-28T14:44:12+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "12.5.6", + "version": "12.5.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "876099a072646c7745f673d7aeab5382c4439691" + "reference": "186dab580576598076de6818596d12b61801880e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/876099a072646c7745f673d7aeab5382c4439691", - "reference": "876099a072646c7745f673d7aeab5382c4439691", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/186dab580576598076de6818596d12b61801880e", + "reference": "186dab580576598076de6818596d12b61801880e", "shasum": "" }, "require": { @@ -6468,13 +6208,13 @@ "php": ">=8.3", "phpunit/php-text-template": "^5.0", "sebastian/complexity": "^5.0", - "sebastian/environment": "^8.0.3", - "sebastian/lines-of-code": "^4.0", + "sebastian/environment": "^8.1.2", + "sebastian/lines-of-code": "^4.0.1", "sebastian/version": "^6.0", "theseer/tokenizer": "^2.0.1" }, "require-dev": { - "phpunit/phpunit": "^12.5.1" + "phpunit/phpunit": "^12.5.28" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -6512,7 +6252,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/12.5.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.7" }, "funding": [ { @@ -6532,7 +6272,7 @@ "type": "tidelift" } ], - "time": "2026-04-15T08:23:17+00:00" + "time": "2026-06-01T13:24:19+00:00" }, { "name": "phpunit/php-file-iterator", @@ -6793,16 +6533,16 @@ }, { "name": "phpunit/phpunit", - "version": "12.5.25", + "version": "12.5.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "792c2980442dfce319226b88fa845b8b6de3b333" + "reference": "5895d05f5bf421ed230fbd76e1277e4b8955def4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/792c2980442dfce319226b88fa845b8b6de3b333", - "reference": "792c2980442dfce319226b88fa845b8b6de3b333", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5895d05f5bf421ed230fbd76e1277e4b8955def4", + "reference": "5895d05f5bf421ed230fbd76e1277e4b8955def4", "shasum": "" }, "require": { @@ -6821,15 +6561,15 @@ "phpunit/php-invoker": "^6.0.0", "phpunit/php-text-template": "^5.0.0", "phpunit/php-timer": "^8.0.0", - "sebastian/cli-parser": "^4.2.0", - "sebastian/comparator": "^7.1.6", + "sebastian/cli-parser": "^4.2.1", + "sebastian/comparator": "^7.1.8", "sebastian/diff": "^7.0.0", - "sebastian/environment": "^8.1.0", - "sebastian/exporter": "^7.0.2", + "sebastian/environment": "^8.1.2", + "sebastian/exporter": "^7.0.3", "sebastian/global-state": "^8.0.2", "sebastian/object-enumerator": "^7.0.0", "sebastian/recursion-context": "^7.0.1", - "sebastian/type": "^6.0.3", + "sebastian/type": "^6.0.4", "sebastian/version": "^6.0.0", "staabm/side-effects-detector": "^1.0.5" }, @@ -6871,7 +6611,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.25" + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.28" }, "funding": [ { @@ -6879,7 +6619,67 @@ "type": "other" } ], - "time": "2026-05-13T03:56:57+00:00" + "time": "2026-05-27T14:01:10+00:00" + }, + { + "name": "rector/rector", + "version": "2.4.5", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "cbd86024be5014d3c14d9f0b3f7aae8ecbffd62c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/cbd86024be5014d3c14d9f0b3f7aae8ecbffd62c", + "reference": "cbd86024be5014d3c14d9f0b3f7aae8ecbffd62c", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.1.56" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.4.5" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2026-05-26T21:03:22+00:00" }, { "name": "sebastian/cli-parser", @@ -6952,16 +6752,16 @@ }, { "name": "sebastian/comparator", - "version": "7.1.6", + "version": "7.1.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "c769009dee98f494e0edc3fd4f4087501688f11e" + "reference": "7c65c1e79836812819705b473a90c12399542485" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c769009dee98f494e0edc3fd4f4087501688f11e", - "reference": "c769009dee98f494e0edc3fd4f4087501688f11e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/7c65c1e79836812819705b473a90c12399542485", + "reference": "7c65c1e79836812819705b473a90c12399542485", "shasum": "" }, "require": { @@ -6969,10 +6769,10 @@ "ext-mbstring": "*", "php": ">=8.3", "sebastian/diff": "^7.0", - "sebastian/exporter": "^7.0" + "sebastian/exporter": "^7.0.3" }, "require-dev": { - "phpunit/phpunit": "^12.2" + "phpunit/phpunit": "^12.5.25" }, "suggest": { "ext-bcmath": "For comparing BcMath\\Number objects" @@ -7020,7 +6820,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/7.1.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/7.1.8" }, "funding": [ { @@ -7040,7 +6840,7 @@ "type": "tidelift" } ], - "time": "2026-04-14T08:23:15+00:00" + "time": "2026-05-21T04:45:25+00:00" }, { "name": "sebastian/complexity", @@ -7169,23 +6969,23 @@ }, { "name": "sebastian/environment", - "version": "8.1.0", + "version": "8.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "b121608b28a13f721e76ffbbd386d08eff58f3f6" + "reference": "9d32c685773823b1983e256ae4ecd48a10d6e439" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/b121608b28a13f721e76ffbbd386d08eff58f3f6", - "reference": "b121608b28a13f721e76ffbbd386d08eff58f3f6", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/9d32c685773823b1983e256ae4ecd48a10d6e439", + "reference": "9d32c685773823b1983e256ae4ecd48a10d6e439", "shasum": "" }, "require": { "php": ">=8.3" }, "require-dev": { - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^12.5.26" }, "suggest": { "ext-posix": "*" @@ -7221,7 +7021,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/8.1.0" + "source": "https://github.com/sebastianbergmann/environment/tree/8.1.2" }, "funding": [ { @@ -7241,7 +7041,7 @@ "type": "tidelift" } ], - "time": "2026-04-15T12:13:01+00:00" + "time": "2026-05-25T13:40:20+00:00" }, { "name": "sebastian/exporter", @@ -7335,26 +7135,26 @@ }, { "name": "sebastian/global-state", - "version": "8.0.2", + "version": "8.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "ef1377171613d09edd25b7816f05be8313f9115d" + "reference": "b164d3274d6537ab462591c5755f76a8f5b1aae9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d", - "reference": "ef1377171613d09edd25b7816f05be8313f9115d", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b164d3274d6537ab462591c5755f76a8f5b1aae9", + "reference": "b164d3274d6537ab462591c5755f76a8f5b1aae9", "shasum": "" }, "require": { "php": ">=8.3", "sebastian/object-reflector": "^5.0", - "sebastian/recursion-context": "^7.0" + "sebastian/recursion-context": "^7.0.1" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^12.5.28" }, "type": "library", "extra": { @@ -7385,7 +7185,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.3" }, "funding": [ { @@ -7405,7 +7205,7 @@ "type": "tidelift" } ], - "time": "2025-08-29T11:29:25+00:00" + "time": "2026-06-01T15:10:33+00:00" }, { "name": "sebastian/lines-of-code", @@ -7876,23 +7676,29 @@ }, { "name": "symfony/console", - "version": "v8.0.11", + "version": "v8.1.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3156577f46a38aa1b9323aad223de7a9cd426782" + "reference": "f5a856c6ecb56b3c21ed94a5b7bf940d857d110a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3156577f46a38aa1b9323aad223de7a9cd426782", - "reference": "3156577f46a38aa1b9323aad223de7a9cd426782", + "url": "https://api.github.com/repos/symfony/console/zipball/f5a856c6ecb56b3c21ed94a5b7bf940d857d110a", + "reference": "f5a856c6ecb56b3c21ed94a5b7bf940d857d110a", "shasum": "" }, "require": { - "php": ">=8.4", + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php85": "^1.32", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^7.4|^8.0" + "symfony/string": "^7.4.6|^8.0.6" + }, + "conflict": { + "symfony/dependency-injection": "<8.1", + "symfony/event-dispatcher": "<8.1" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" @@ -7900,14 +7706,18 @@ "require-dev": { "psr/log": "^1|^2|^3", "symfony/config": "^7.4|^8.0", - "symfony/dependency-injection": "^7.4|^8.0", - "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1", + "symfony/event-dispatcher": "^8.1", + "symfony/filesystem": "^7.4|^8.0", "symfony/http-foundation": "^7.4|^8.0", "symfony/http-kernel": "^7.4|^8.0", "symfony/lock": "^7.4|^8.0", "symfony/messenger": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", "symfony/process": "^7.4|^8.0", "symfony/stopwatch": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", @@ -7942,7 +7752,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.0.11" + "source": "https://github.com/symfony/console/tree/v8.1.0" }, "funding": [ { @@ -7962,7 +7772,7 @@ "type": "tidelift" } ], - "time": "2026-05-13T12:07:53+00:00" + "time": "2026-05-29T05:06:50+00:00" }, { "name": "symfony/polyfill-ctype", @@ -8049,16 +7859,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.37.0", + "version": "v1.38.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e" + "reference": "e9247d281d694a5120554d9afaf54e070e88a603" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/4864388bfbd3001ce88e234fab652acd91fdc57e", - "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e9247d281d694a5120554d9afaf54e070e88a603", + "reference": "e9247d281d694a5120554d9afaf54e070e88a603", "shasum": "" }, "require": { @@ -8107,7 +7917,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.37.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.38.1" }, "funding": [ { @@ -8127,20 +7937,20 @@ "type": "tidelift" } ], - "time": "2026-04-26T13:13:48+00:00" + "time": "2026-05-26T05:58:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.37.0", + "version": "v1.38.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "3833d7255cc303546435cb650316bff708a1c75c" + "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", - "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b", + "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b", "shasum": "" }, "require": { @@ -8192,7 +8002,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.37.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0" }, "funding": [ { @@ -8212,24 +8022,24 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2026-05-25T13:48:31+00:00" }, { "name": "symfony/process", - "version": "v8.0.11", + "version": "v8.1.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "26d89e459f037d2873300605d0a07e7a8ef84db0" + "reference": "c4a9e58f235a6bf7f97ffbfedae2687353ac79e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/26d89e459f037d2873300605d0a07e7a8ef84db0", - "reference": "26d89e459f037d2873300605d0a07e7a8ef84db0", + "url": "https://api.github.com/repos/symfony/process/zipball/c4a9e58f235a6bf7f97ffbfedae2687353ac79e5", + "reference": "c4a9e58f235a6bf7f97ffbfedae2687353ac79e5", "shasum": "" }, "require": { - "php": ">=8.4" + "php": ">=8.4.1" }, "type": "library", "autoload": { @@ -8257,7 +8067,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.0.11" + "source": "https://github.com/symfony/process/tree/v8.1.0" }, "funding": [ { @@ -8277,24 +8087,24 @@ "type": "tidelift" } ], - "time": "2026-05-11T16:56:32+00:00" + "time": "2026-05-29T05:06:50+00:00" }, { "name": "symfony/string", - "version": "v8.0.11", + "version": "v8.1.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "39be2ad058a3c0bd558edca23e65f009865d75ff" + "reference": "afd5944f4005862d961efb85c8bbd5c523c4e3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/39be2ad058a3c0bd558edca23e65f009865d75ff", - "reference": "39be2ad058a3c0bd558edca23e65f009865d75ff", + "url": "https://api.github.com/repos/symfony/string/zipball/afd5944f4005862d961efb85c8bbd5c523c4e3c9", + "reference": "afd5944f4005862d961efb85c8bbd5c523c4e3c9", "shasum": "" }, "require": { - "php": ">=8.4", + "php": ">=8.4.1", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-intl-grapheme": "^1.33", "symfony/polyfill-intl-normalizer": "^1.0", @@ -8347,7 +8157,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.0.11" + "source": "https://github.com/symfony/string/tree/v8.1.0" }, "funding": [ { @@ -8367,7 +8177,7 @@ "type": "tidelift" } ], - "time": "2026-05-13T12:07:53+00:00" + "time": "2026-05-29T05:06:50+00:00" }, { "name": "textalk/websocket", @@ -8470,16 +8280,16 @@ }, { "name": "twig/twig", - "version": "v3.27.0", + "version": "v3.27.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "04ae1bfe9463c816cf72ca0abe7eae2c77a9a9ed" + "reference": "ae2071bffb38f04847fc0864d730c94b9cb8ab74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/04ae1bfe9463c816cf72ca0abe7eae2c77a9a9ed", - "reference": "04ae1bfe9463c816cf72ca0abe7eae2c77a9a9ed", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/ae2071bffb38f04847fc0864d730c94b9cb8ab74", + "reference": "ae2071bffb38f04847fc0864d730c94b9cb8ab74", "shasum": "" }, "require": { @@ -8534,7 +8344,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.27.0" + "source": "https://github.com/twigphp/Twig/tree/v3.27.1" }, "funding": [ { @@ -8546,13 +8356,14 @@ "type": "tidelift" } ], - "time": "2026-05-27T13:05:51+00:00" + "time": "2026-05-30T17:09:26+00:00" } ], "aliases": [], "minimum-stability": "dev", "stability-flags": { - "utopia-php/http": 5 + "utopia-php/http": 5, + "utopia-php/platform": 5 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/docker-compose.yml b/docker-compose.yml index ab51ad32c0..d4b2aacd03 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -349,6 +349,8 @@ services: - appwrite-embedding environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -383,6 +385,8 @@ services: - appwrite-embedding environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -424,6 +428,8 @@ services: environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -484,6 +490,8 @@ services: - appwrite-embedding environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -504,7 +512,6 @@ services: - _APP_DB_USER_VECTORSDB - _APP_DB_PASS_VECTORSDB - _APP_LOGGING_CONFIG - - _APP_WORKERS_NUM - _APP_QUEUE_NAME - _APP_DATABASE_SHARED_TABLES @@ -527,6 +534,8 @@ services: - appwrite-embedding environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -605,6 +614,8 @@ services: - _APP_OPTIONS_FORCE_HTTPS # Basic - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_LOGGING_CONFIG @@ -665,6 +676,8 @@ services: - ./src:/usr/src/code/src environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -705,6 +718,8 @@ services: - ${_APP_DB_HOST:-mongodb} environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -736,6 +751,8 @@ services: - redis environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=8 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -782,6 +799,8 @@ services: # - smtp environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -823,6 +842,8 @@ services: - redis environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -883,6 +904,8 @@ services: - ${_APP_DB_HOST:-mongodb} environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -1044,6 +1067,8 @@ services: - ${_APP_DB_HOST:-mongodb} environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -1078,6 +1103,8 @@ services: - appwrite-embedding environment: - _APP_ENV + - _APP_WORKERS_NUM=1 + - _APP_WORKER_MAX_COROUTINES=1 - _APP_WORKER_PER_CORE - _APP_POOL_ADAPTER - _APP_OPENSSL_KEY_V1 @@ -1218,11 +1245,11 @@ services: - appwrite openruntimes-executor: - container_name: openruntimes-executor + container_name: exc1 hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.11.4 + image: openruntimes/executor:0.24.1 restart: unless-stopped networks: - appwrite @@ -1236,6 +1263,8 @@ services: # It's not possible to share mount file between 2 containers without host mount (copying is too slow) - /tmp:/tmp:rw environment: + - OPR_EXECUTOR_CONNECTION_STORAGE=local://localhost + - OPR_EXECUTOR_CONNECTION_BUILD_CACHE_STORAGE= - OPR_EXECUTOR_IMAGE_PULL=enabled - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL @@ -1356,7 +1385,11 @@ services: timeout: 5s retries: 10 start_period: 10s - command: "postgres" + command: > + postgres + -c fsync=off + -c synchronous_commit=off + -c full_page_writes=off appwrite-embedding: image: appwrite/embedding:0.1.0 @@ -1494,3 +1527,4 @@ volumes: appwrite-builds: appwrite-config: appwrite-models: + openruntimes-node-modules-cache: diff --git a/docs/references/messaging/create-ses-provider.md b/docs/references/messaging/create-ses-provider.md new file mode 100644 index 0000000000..c612414f99 --- /dev/null +++ b/docs/references/messaging/create-ses-provider.md @@ -0,0 +1 @@ +Create a new Amazon SES provider. \ No newline at end of file diff --git a/docs/references/messaging/update-ses-provider.md b/docs/references/messaging/update-ses-provider.md new file mode 100644 index 0000000000..79947186e8 --- /dev/null +++ b/docs/references/messaging/update-ses-provider.md @@ -0,0 +1 @@ +Update an Amazon SES provider by its unique ID. \ No newline at end of file diff --git a/docs/sdks/unity/CHANGELOG.md b/docs/sdks/unity/CHANGELOG.md new file mode 100644 index 0000000000..bbfc68354e --- /dev/null +++ b/docs/sdks/unity/CHANGELOG.md @@ -0,0 +1,5 @@ +# Change Log + +## 0.1.0 + +* Initial release diff --git a/rector.php b/rector.php new file mode 100644 index 0000000000..ad224f77f6 --- /dev/null +++ b/rector.php @@ -0,0 +1,19 @@ +withBootstrapFiles([ + __DIR__ . '/app/init/constants.php', + ]) + ->withPaths([ + __DIR__ . '/tests', + ]) + ->withSkipPath(__DIR__ . '/vendor') + ->withSkipPath(__DIR__ . '/tests/resources') + ->withSets([ + PHPUnitSetList::PHPUNIT_CODE_QUALITY, + ]); diff --git a/src/Appwrite/Auth/Validator/PasswordStrength.php b/src/Appwrite/Auth/Validator/PasswordStrength.php new file mode 100644 index 0000000000..a9772cbd22 --- /dev/null +++ b/src/Appwrite/Auth/Validator/PasswordStrength.php @@ -0,0 +1,89 @@ +min = $policy['min'] ?? 8; + $this->uppercase = $policy['uppercase'] ?? false; + $this->lowercase = $policy['lowercase'] ?? false; + $this->number = $policy['number'] ?? false; + $this->symbols = $policy['symbols'] ?? false; + } + + public function getDescription(): string + { + $requirements = [ + 'between ' . $this->min . ' and 256 characters long', + ]; + + if ($this->uppercase) { + $requirements[] = 'include an uppercase letter'; + } + + if ($this->lowercase) { + $requirements[] = 'include a lowercase letter'; + } + + if ($this->number) { + $requirements[] = 'include a number'; + } + + if ($this->symbols) { + $requirements[] = 'include a symbol'; + } + + return 'Password must be ' . \implode(', ', $requirements) . '.'; + } + + /** + * @param mixed $value + */ + public function isValid($value): bool + { + if (!parent::isValid($value)) { + return false; + } + + if ($this->allowEmpty && \strlen($value) === 0) { + return true; + } + + if (\strlen($value) < $this->min) { + return false; + } + + if ($this->uppercase && !\preg_match('/[A-Z]/', $value)) { + return false; + } + + if ($this->lowercase && !\preg_match('/[a-z]/', $value)) { + return false; + } + + if ($this->number && !\preg_match('/\d/', $value)) { + return false; + } + + if ($this->symbols && !\preg_match('/[^\p{L}\p{N}\s]/u', $value)) { + return false; + } + + return true; + } +} diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 6506127c59..ca114550b7 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -84,6 +84,7 @@ class Exception extends \Exception public const string USER_EMAIL_ALREADY_EXISTS = 'user_email_already_exists'; public const string USER_EMAIL_DISPOSABLE = 'user_email_disposable'; public const string USER_EMAIL_FREE = 'user_email_free'; + public const string USER_EMAIL_NOT_CORPORATE = 'user_email_not_corporate'; public const string USER_EMAIL_NOT_CANONICAL = 'user_email_not_canonical'; public const string USER_PASSWORD_MISMATCH = 'user_password_mismatch'; public const string USER_SESSION_NOT_FOUND = 'user_session_not_found'; diff --git a/src/Appwrite/GraphQL/Resolvers.php b/src/Appwrite/GraphQL/Resolvers.php index ab98e6df0c..7f542346ee 100644 --- a/src/Appwrite/GraphQL/Resolvers.php +++ b/src/Appwrite/GraphQL/Resolvers.php @@ -40,8 +40,9 @@ class Resolvers ); } + // Response headers follow PSR-7: keys are lowercased and values are lists. $headers = $from->getHeaders(); - $fallbackCookies = $headers['X-Fallback-Cookies'] ?? null; + $fallbackCookies = $headers['x-fallback-cookies'] ?? null; if ($fallbackCookies === null) { return; } @@ -347,7 +348,7 @@ class Resolvers $request->addHeader('x-appwrite-source', 'graphql'); // Drop json content type so post args are used directly. - if (\str_starts_with($request->getHeader('content-type'), 'application/json')) { + if (\str_starts_with($request->getHeaderLine('content-type'), 'application/json')) { $request->removeHeader('content-type'); } diff --git a/src/Appwrite/Migration/Version/V24.php b/src/Appwrite/Migration/Version/V24.php index 0aa67cb74e..65da1bd20d 100644 --- a/src/Appwrite/Migration/Version/V24.php +++ b/src/Appwrite/Migration/Version/V24.php @@ -213,6 +213,15 @@ class V24 extends Migration $this->dbForProject->purgeCachedCollection($id); break; + case 'tokens': + try { + $this->createIndexFromCollection($this->dbForProject, $id, '_key_type_expire'); + } catch (Throwable $th) { + Console::warning("Failed to create index \"_key_type_expire\" from {$id}: {$th->getMessage()}"); + } + $this->dbForProject->purgeCachedCollection($id); + break; + case 'databases': if ($collectionType === 'projects') { try { diff --git a/src/Appwrite/Platform/Installer/Http/Installer/Install.php b/src/Appwrite/Platform/Installer/Http/Installer/Install.php index e7e9008e3b..a3368a75b1 100644 --- a/src/Appwrite/Platform/Installer/Http/Installer/Install.php +++ b/src/Appwrite/Platform/Installer/Http/Installer/Install.php @@ -73,7 +73,7 @@ class Install extends Action Config $config, array $paths ): void { - $acceptHeader = $request->getHeader('accept'); + $acceptHeader = $request->getHeaderLine('accept'); $wantsStream = stripos($acceptHeader, 'text/event-stream') !== false; if ($wantsStream) { diff --git a/src/Appwrite/Platform/Installer/Http/Installer/Validate.php b/src/Appwrite/Platform/Installer/Http/Installer/Validate.php index 9a2e0b4528..9b8006d971 100644 --- a/src/Appwrite/Platform/Installer/Http/Installer/Validate.php +++ b/src/Appwrite/Platform/Installer/Http/Installer/Validate.php @@ -38,7 +38,7 @@ class Validate extends Action public static function validateCsrf(Request $request): bool { $cookie = $request->getCookie(Server::CSRF_COOKIE); - $header = $request->getHeader('x-appwrite-installer-csrf'); + $header = $request->getHeaderLine('x-appwrite-installer-csrf'); return $cookie !== '' && $header !== '' && hash_equals($cookie, $header); } diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php index cc30f014bc..24529759d9 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Browsers/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-browser.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php index 3bae32c862..28149b3945 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/CreditCards/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-credit-card.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php index 6faa0fe223..de02f59873 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.php @@ -54,6 +54,7 @@ class Get extends Action description: '/docs/references/avatars/get-favicon.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php index ef9f8c0e47..7f32cdaa45 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Flags/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-flag.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php index 315202d4d5..ad4ed2ff37 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Image/Get.php @@ -45,6 +45,7 @@ class Get extends Action description: '/docs/references/avatars/get-image.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php index c73d20fb0c..4808cb7267 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Initials/Get.php @@ -44,6 +44,7 @@ class Get extends Action description: '/docs/references/avatars/get-initials.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php index f3448f5264..ac08e060f2 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/QR/Get.php @@ -42,6 +42,7 @@ class Get extends Action description: '/docs/references/avatars/get-qr.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php index 51d4df2a49..15b9408616 100644 --- a/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php +++ b/src/Appwrite/Platform/Modules/Avatars/Http/Screenshots/Get.php @@ -57,6 +57,7 @@ class Get extends Action description: '/docs/references/avatars/get-screenshot.md', auth: [AuthType::ADMIN, AuthType::SESSION, AuthType::KEY, AuthType::JWT], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], responses: [ new SDKResponse( code: Response::STATUS_CODE_OK, diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index f7bc954bd7..5e1aba372c 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -144,18 +144,6 @@ class Base extends Action 'activate' => $activate, ])); - $function = $function - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $publisherForBuilds->enqueue(new BuildMessage( project: $project, resource: $function, @@ -258,18 +246,6 @@ class Base extends Action 'activate' => $activate, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index a0ee24db87..b2e783bccd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -103,6 +103,15 @@ class Create extends Action // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions) ?? []; + // Resolve the data-plane database BEFORE writing the metadata row. For a + // dedicated product database this throws while provisioning (no DSN yet); + // writing the row first would leave an orphaned collection with no backing + // collection, which lists fine but fails every document operation. + /** + * @var Database $dbForDatabases + */ + $dbForDatabases = $getDatabasesDB($database); + try { $collection = $dbForProject->createDocument('database_' . $database->getSequence(), new Document([ '$id' => $collectionId, @@ -122,11 +131,6 @@ class Create extends Action throw new Exception(Exception::DATABASE_NOT_FOUND, params: [$databaseId]); } - /** - * @var Database $dbForDatabases - */ - $dbForDatabases = $getDatabasesDB($database); - $collectionKey = 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(); $databaseKey = 'database_' . $database->getSequence(); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php index 294a6712a9..870ee4116e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php @@ -199,6 +199,24 @@ class Create extends Action $database = $dbForProject->getDocument('databases', $databaseId); + $this->createMetadataCollection($dbForProject, $database); + + $queueForEvents->setParam('databaseId', $database->getId()); + + $response + ->setStatusCode(SwooleResponse::STATUS_CODE_CREATED) + ->dynamic($database, UtopiaResponse::MODEL_DATABASE); + } + + /** + * Create the per-database metadata collection (`database_{internalId}`) that holds + * the database's collection definitions. Extracted so product overrides that + * provision a backend asynchronously (e.g. documentsdb, vectorsdb) can initialise + * the metadata exactly like a standard database create instead of leaving it + * uninitialised, which makes the first collection create fail. + */ + protected function createMetadataCollection(Database $dbForProject, Document $database): void + { $collections = $this->getDatabaseCollection(); if (empty($collections)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'The "collections" collection is not configured.'); @@ -217,19 +235,11 @@ class Create extends Action try { $dbForProject->createCollection('database_' . $database->getSequence(), $attributes, $indexes); } catch (DuplicateException) { - throw new Exception(Exception::DATABASE_ALREADY_EXISTS, params: [$databaseId]); + throw new Exception(Exception::DATABASE_ALREADY_EXISTS, params: [$database->getId()]); } catch (IndexException $e) { throw new Exception(Exception::INDEX_INVALID); } catch (LimitException) { - // TODO: @Jake, how do we handle this collection/table? - // there's no context awareness at this level on what the api is. - throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED, params: [$databaseId]); + throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED, params: [$database->getId()]); } - - $queueForEvents->setParam('databaseId', $database->getId()); - - $response - ->setStatusCode(SwooleResponse::STATUS_CODE_CREATED) - ->dynamic($database, UtopiaResponse::MODEL_DATABASE); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php index 87f6e3ee8d..3a9b59d064 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Init/Timeout.php @@ -25,7 +25,7 @@ class Timeout extends Action ->inject('request') ->inject('dbForProject') ->callback(function (Request $request, Database $dbForProject) { - $timeout = \intval($request->getHeader('x-appwrite-timeout')); + $timeout = \intval($request->getHeaderLine('x-appwrite-timeout')); if (!empty($timeout) && Http::isDevelopment()) { $dbForProject->setTimeout($timeout); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php index 44c1a06da8..c4ff9055fb 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Columns/Datetime/Update.php @@ -33,7 +33,7 @@ class Update extends DatetimeUpdate $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PATCH) ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/columns/datetime/:key') - ->desc('Update dateTime column') + ->desc('Update datetime column') ->groups(['api', 'database', 'schema']) ->label('scope', ['tables.write', 'collections.write', 'columns.write', 'attributes.write']) ->label('resourceType', RESOURCE_TYPE_DATABASES) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php index 58433c7deb..3b346bb7c0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Collections/Create.php @@ -94,6 +94,13 @@ class Create extends CollectionAction // Map aggregate permissions into the multiple permissions they represent. $permissions = Permission::aggregate($permissions) ?? []; + // Resolve the data-plane database BEFORE writing the metadata row. For a + // dedicated product database this throws while provisioning (no DSN yet); + // writing the row first would leave an orphaned collection with no backing + // collection, which lists fine but fails every document operation. + /** @var Database $dbForDatabases */ + $dbForDatabases = $getDatabasesDB($database); + try { $collection = $dbForProject->createDocument('database_' . $database->getSequence(), new Document([ '$id' => $collectionId, @@ -114,8 +121,6 @@ class Create extends CollectionAction } catch (NotFoundException) { throw new Exception(Exception::DATABASE_NOT_FOUND); } - /** @var Database $dbForDatabases */ - $dbForDatabases = $getDatabasesDB($database); $attributes = []; $indexes = []; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php index 05512e3151..6cf2f47910 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorsDB/Embeddings/Text/Create.php @@ -44,7 +44,7 @@ class Create extends CreateDocumentAction $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_POST) ->setHttpPath('/v1/vectorsdb/embeddings/text') - ->desc('Create Text Embeddings') + ->desc('Create text embeddings') ->groups(['api', 'database']) ->label('scope', 'documents.write') ->label('resourceType', RESOURCE_TYPE_EMBEDDINGS_TEXT) diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php index 25863d424c..0269c3df19 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -166,7 +166,7 @@ class Create extends Action throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); } - $contentRange = $request->getHeader('content-range'); + $contentRange = $request->getHeaderLine('content-range'); $deploymentId = ID::unique(); $chunk = 1; $chunks = 1; @@ -175,7 +175,7 @@ class Create extends Action $start = $request->getContentRangeStart(); $end = $request->getContentRangeEnd(); $fileSize = $request->getContentRangeSize(); - $deploymentId = $request->getHeader('x-appwrite-id', $deploymentId); + $deploymentId = $request->getHeaderLine('x-appwrite-id', $deploymentId); // TODO make `end >= $fileSize` in next breaking version if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); @@ -202,8 +202,27 @@ class Create extends Action $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; $completed = false; + $mergeUploadMetadata = function (array $stored, array $current): array { + $merged = \array_merge($stored, $current); + + if (isset($stored['parts']) || isset($current['parts'])) { + $parts = $stored['parts'] ?? []; + foreach (($current['parts'] ?? []) as $part => $value) { + $parts[(int) $part] = $value; + } + \ksort($parts); + + $merged['parts'] = $parts; + $merged['chunks'] = \count($parts); + } + + return $merged; + }; + + $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + try { - $locks($lockKey, 600, function () use (&$chunks, $dbForProject, $deploymentId, &$metadata, &$completed, $response): void { + $locks($lockKey, 600, function () use ($activate, &$chunks, $commands, $contentRange, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, &$metadata, $path, $type, &$completed, $response): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); if (!$deployment->isEmpty()) { @@ -220,6 +239,35 @@ class Create extends Action return; } } + + if ($deployment->isEmpty()) { + $deviceForFunctions->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata); + + if (!empty($contentRange)) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $function->getSequence(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', + 'entrypoint' => $entrypoint, + 'buildCommands' => $commands, + 'startCommand' => $function->getAttribute('startCommand', ''), + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'sourceChunksTotal' => $chunks, + 'sourceChunksUploaded' => 0, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type + ])); + } + } }, timeout: 120.0); } catch (LockContention) { $response->addHeader('Retry-After', '5'); @@ -231,23 +279,21 @@ class Create extends Action return; } - $chunksUploaded = $deviceForFunctions->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + $chunksUploaded = $deviceForFunctions->uploadChunk($fileTmpName, $path, $chunk, $chunks, $metadata); if (empty($chunksUploaded)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); } - $type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'; - try { - $locks($lockKey, 600, function () use ($activate, &$chunks, $chunksUploaded, $commands, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, $functionId, $path, &$metadata, $platform, $project, $publisherForBuilds, $queueForEvents, $response, $type): void { + $locks($lockKey, 600, function () use ($activate, &$chunks, $chunksUploaded, $commands, $dbForProject, $deploymentId, $deviceForFunctions, $entrypoint, $fileSize, &$function, $functionId, $path, &$metadata, $mergeUploadMetadata, $platform, $project, $publisherForBuilds, $queueForEvents, $response, $type): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); $uploaded = 0; if (!$deployment->isEmpty()) { $chunks = $deployment->getAttribute('sourceChunksTotal', 1); $uploaded = $deployment->getAttribute('sourceChunksUploaded', 0); - $metadata = \array_merge($deployment->getAttribute('sourceMetadata', []), $metadata); + $metadata = $mergeUploadMetadata($deployment->getAttribute('sourceMetadata', []), $metadata); if ($uploaded === $chunks) { $queueForEvents->reset(); @@ -259,9 +305,11 @@ class Create extends Action } } - $chunksUploaded = max($uploaded, $chunksUploaded); + $chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0)); if ($chunksUploaded === $chunks && $uploaded < $chunks) { + $deviceForFunctions->finalizeUpload($path, $chunks, $metadata); + if ($activate) { // Remove deploy for all other deployments. $activeDeployments = $dbForProject->find('deployments', [ @@ -303,12 +351,6 @@ class Create extends Action 'type' => $type ])); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); } else { $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ 'sourceSize' => $fileSize, @@ -326,42 +368,10 @@ class Create extends Action platform: $platform, )); } else { - if ($deployment->isEmpty()) { - $deployment = $dbForProject->createDocument('deployments', new Document([ - '$id' => $deploymentId, - '$permissions' => [ - Permission::read(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'resourceInternalId' => $function->getSequence(), - 'resourceId' => $function->getId(), - 'resourceType' => 'functions', - 'entrypoint' => $entrypoint, - 'buildCommands' => $commands, - 'startCommand' => $function->getAttribute('startCommand', ''), - 'sourcePath' => $path, - 'sourceSize' => $fileSize, - 'totalSize' => $fileSize, - 'sourceChunksTotal' => $chunks, - 'sourceChunksUploaded' => $chunksUploaded, - 'activate' => $activate, - 'sourceMetadata' => $metadata, - 'type' => $type - ])); - - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - } else { - $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ - 'sourceChunksUploaded' => $chunksUploaded, - 'sourceMetadata' => $metadata, - ])); - } + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ + 'sourceChunksUploaded' => $chunksUploaded, + 'sourceMetadata' => $metadata, + ])); } $metadata = null; diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php index be4437ffe3..6862b0d776 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -89,8 +90,16 @@ class Delete extends Action throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); } - if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + try { + if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } + } catch (TransactionException) { + $deploymentExists = !$dbForProject->getDocument('deployments', $deployment->getId())->isEmpty(); + + if ($deploymentExists && !$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } } if (!empty($deployment->getAttribute('sourcePath', ''))) { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php index c92e3c1406..2d57ec5525 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -52,7 +52,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('deploymentId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Deployment ID.', false, ['dbForProject']) @@ -106,7 +107,7 @@ class Get extends Action ->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '-' . $type . '.tar.gz"'); $size = $device->getFileSize($path); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php index 76070c8bf5..93f34ebb05 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -120,18 +120,6 @@ class Create extends Action 'buildLogs' => '', ])); - $function = $function - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $function->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $function->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $function->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'), - ])); - $publisherForBuilds->enqueue(new BuildMessage( project: $project, resource: $function, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php index dab477ef1f..85d93c14c1 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php @@ -12,6 +12,7 @@ use Executor\Executor; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -91,17 +92,30 @@ class Update extends Action $endTime = new \DateTime('now'); $duration = $endTime->getTimestamp() - $startTime->getTimestamp(); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildEndedAt' => DateTime::now(), - 'buildDuration' => $duration, - 'status' => 'canceled' - ])); - - if ($deployment->getSequence() === $function->getAttribute('latestDeploymentInternalId', '')) { - $function = $function->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'), + try { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' ])); + } catch (TransactionException) { + $deployment = $dbForProject->getDocument('deployments', $deployment->getId()); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) { + throw new Exception(Exception::BUILD_ALREADY_COMPLETED); + } + + if ($deployment->getAttribute('status') !== 'canceled') { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' + ])); + } } try { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php index 87d1282d8b..136549e9c9 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -174,19 +174,6 @@ class Create extends Base 'activate' => $activate, ])); - $function = $function - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $function->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $function->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $function->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'), - ])); - - $this->updateEmptyManualRule($project, $function, $deployment, $dbForPlatform, $authorization); $publisherForBuilds->enqueue(new BuildMessage( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index ba36b47884..2c2b03a204 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -13,7 +13,6 @@ use Appwrite\Extend\Exception as AppwriteException; use Appwrite\Functions\Validator\Headers; use Appwrite\Platform\Modules\Compute\Base; use Appwrite\SDK\AuthType; -use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Usage\Context; @@ -81,7 +80,6 @@ class Create extends Base model: Response::MODEL_EXECUTION, ) ], - contentType: ContentType::MULTIPART, )) ->param('functionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Function ID.', false, ['dbForProject']) ->param('body', '', new Text(10485760, 0), 'HTTP body of execution. Default value is empty string.', true) @@ -519,7 +517,7 @@ class Create extends Base $execution->setAttribute('responseBody', $executionResponse['body'] ?? ''); $execution->setAttribute('responseHeaders', $headers); - $acceptTypes = \explode(', ', $request->getHeader('accept')); + $acceptTypes = \explode(', ', $request->getHeaderLine('accept')); foreach ($acceptTypes as $acceptType) { if (\str_starts_with($acceptType, 'application/json') || \str_starts_with($acceptType, 'application/*')) { $response->setContentType(Response::CONTENT_TYPE_JSON); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php index eaafe561df..601025c794 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -308,7 +308,7 @@ class Create extends Base ])); // Backwards compatibility with 1.6 behaviour - $requestFormat = $request->getHeader('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); + $requestFormat = $request->getHeaderLine('x-appwrite-response-format', System::getEnv('_APP_SYSTEM_RESPONSE_FORMAT', '')); if ($requestFormat && version_compare($requestFormat, '1.7.0', '<')) { // build from template $template = new Document([]); @@ -344,12 +344,6 @@ class Create extends Base referenceType: 'branch' ); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); } elseif (!$template->isEmpty()) { // Deploy non-VCS from template $deploymentId = ID::unique(); @@ -370,13 +364,6 @@ class Create extends Base 'activate' => true, ])); - $function = $dbForProject->updateDocument('functions', $function->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $publisherForBuilds->enqueue(new BuildMessage( project: $project, resource: $function, diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php index 5fbe010f05..fd89651800 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -182,6 +182,17 @@ class Update extends Base $isConnected = !empty($function->getAttribute('providerRepositoryId', '')); + // Omitted providerRepositoryId (null) on a connected function — preserve existing VCS values + if ($isConnected && $providerRepositoryId === null) { + $providerRepositoryId = $function->getAttribute('providerRepositoryId', ''); + $installationId = $function->getAttribute('installationId', ''); + $providerBranch = $providerBranch ?: $function->getAttribute('providerBranch', ''); + $providerRootDirectory = $providerRootDirectory ?: $function->getAttribute('providerRootDirectory', ''); + $repositoryId = $function->getAttribute('repositoryId', ''); + $repositoryInternalId = $function->getAttribute('repositoryInternalId', ''); + $installation = $dbForPlatform->getDocument('installations', $installationId); + } + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index dd0f9d541b..2550db36e2 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -30,6 +30,7 @@ use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Duplicate; use Utopia\Database\Exception\Restricted; use Utopia\Database\Exception\Structure; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Detector\Detection\Rendering\SSR; use Utopia\Detector\Detection\Rendering\XStatic; @@ -247,24 +248,32 @@ class Builds extends Action ->setParam('deploymentId', $deployment->getId()); if ($deployment->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $resource = $this->updateLatestDeployment($dbForProject, $resource); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } $deploymentId = $deployment->getId(); - $deployment->setAttribute('buildStartedAt', $startTime); - $deployment->setAttribute('status', 'processing'); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + $updated = $dbForProject->updateDocuments('deployments', new Document([ 'buildStartedAt' => $startTime, 'status' => 'processing', - ])); + ]), [ + Query::equal('$id', [$deploymentId]), + Query::notEqual('status', 'canceled'), + ]); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); + if ($updated === 0) { + $resource = $this->updateLatestDeployment($dbForProject, $resource); + $this->finalizeCanceledDeployment($deploymentId, $dbForProject, $queueForRealtime); + return; } + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + $resource = $this->updateLatestDeployment($dbForProject, $resource); + Span::add('deployment.status', 'processing'); $queueForRealtime @@ -389,7 +398,7 @@ class Builds extends Action Console::execute('mkdir -p ' . \escapeshellarg('/tmp/builds/' . $deploymentId), '', $stdout, $stderr); if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -531,15 +540,22 @@ class Builds extends Action } /** Request the executor to build the code... */ - $deployment->setAttribute('status', 'building'); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + $updated = $dbForProject->updateDocuments('deployments', new Document([ 'status' => 'building', - ])); + ]), [ + Query::equal('$id', [$deploymentId]), + Query::notEqual('status', 'canceled'), + ]); + + if ($updated === 0) { + $this->finalizeCanceledDeployment($deploymentId, $dbForProject, $queueForRealtime); + return; + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); Span::add('deployment.status', 'building'); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); $queueForRealtime ->setPayload($deployment->getArrayCopy()) @@ -670,11 +686,16 @@ class Builds extends Action deployment: $deployment ); + $cacheKey = $this->getNodeModulesCacheKey($project, $resource, $runtime, $version, $command); + + Span::add('build.node_modules_cache.enabled', $cacheKey !== ''); + Span::add('build.node_modules_cache.key', $cacheKey); + $response = null; $err = null; if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -683,32 +704,14 @@ class Builds extends Action $span = Span::current(); Co::join([ - Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cpus, $memory, $timeout, &$err, $version, $span) { + Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cacheKey, $cpus, $memory, $timeout, &$err, $version, $span) { try { if ($version === 'v2') { $command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh'; } else { $outputDirectory = $deployment->getAttribute('buildOutput') ?? $resource->getAttribute('outputDirectory'); if ($resource->getCollection() === 'sites') { - $listFilesCommand = ''; - - // Start separation, enter build folder - $listFilesCommand .= 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; - - // Enter output directory, if set - if (! empty($outputDirectory)) { - $listFilesCommand .= ' && cd ' . \escapeshellarg($outputDirectory); - } - - // Print files, and end separation - $listFilesCommand .= ' && find . -name \'node_modules\' -prune -o -type f -print && echo "{APPWRITE_DETECTION_SEPARATOR_END}"'; - - // Use SSR file listing - if (empty($command)) { - $command = $listFilesCommand; - } else { - $command .= ' && ' . $listFilesCommand; - } + $command = $this->prepareSiteBuildCommand($command, $outputDirectory ?? ''); } $command = 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh ' . \trim(\escapeshellarg($command)); @@ -728,7 +731,8 @@ class Builds extends Action destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}", variables: $vars, command: $command, - outputDirectory: $outputDirectory ?? '' + outputDirectory: $outputDirectory ?? '', + cacheKey: $cacheKey ); } catch (ExecutorTimeout $error) { @@ -809,6 +813,10 @@ class Builds extends Action $streamLog = \str_replace('{APPWRITE_LINEBREAK_PLACEHOLDER}', "\n", $streamLog); $streamParts = \explode(' ', $streamLog, 2); + if (! isset($streamParts[1])) { + continue; + } + // TODO: use part[0] as timestamp when switching to dbForLogs for build logs $currentLogs .= $streamParts[1]; @@ -843,7 +851,7 @@ class Builds extends Action $latestDeployment = $dbForProject->getDocument('deployments', $deploymentId); if ($latestDeployment->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -871,31 +879,13 @@ class Builds extends Action $logs .= $log['content']; } - // Separate logs for SSR detection - $detectionLogs = ''; - if (\str_contains($logs, '{APPWRITE_DETECTION_SEPARATOR_START}')) { - [$logsBefore, $detectionLogsStart] = \explode('{APPWRITE_DETECTION_SEPARATOR_START}', $logs, 2); - [$detectionLogs, $logsAfter] = \explode('{APPWRITE_DETECTION_SEPARATOR_END}', $detectionLogsStart, 2); - $logs = $logsBefore . $logsAfter; - } + ['logs' => $logs, 'detectionLogs' => $detectionLogs] = $this->splitSiteDetectionLogs($logs); $deployment->setAttribute('buildLogs', $logs); $adapter = null; if ($resource->getCollection() === 'sites' && ! empty($detectionLogs)) { - $files = \explode("\n", $detectionLogs); // Parse output - $files = \array_filter($files); // Remove empty - $files = \array_map(fn ($file) => \trim($file), $files); // Remove whitepsaces - $files = \array_map(fn ($file) => \str_starts_with($file, './') ? \substr($file, 2) : $file, $files); // Remove beginning ./ - - $detector = new Rendering($resource->getAttribute('framework', '')); - foreach ($files as $file) { - $detector->addInput($file); - } - $detector - ->addOption(new SSR()) - ->addOption(new XStatic()); - $detection = $detector->detect(); + $detection = $this->detectSiteRendering($resource->getAttribute('framework', ''), $detectionLogs); $adapter = $resource->getAttribute('adapter', ''); if (empty($adapter)) { @@ -930,16 +920,21 @@ class Builds extends Action $deployment->setAttribute('buildLogs', $logs); /** Update the status */ + $endTime = DateTime::now(); + $durationEnd = \microtime(true); + $deployment->setAttribute('buildEndedAt', $endTime); + $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); $deployment->setAttribute('status', 'ready'); $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ + 'buildEndedAt' => $deployment->getAttribute('buildEndedAt'), + 'buildDuration' => $deployment->getAttribute('buildDuration'), 'buildLogs' => $deployment->getAttribute('buildLogs'), 'status' => 'ready', ])); Span::add('deployment.status', 'ready'); + Span::add('build.duration', $deployment->getAttribute('buildDuration')); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); if ($isVcsEnabled) { $this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform, $queueForRealtime, $platform); @@ -1026,6 +1021,8 @@ class Builds extends Action Span::add('build.activated', true); } + $resource = $this->updateLatestDeployment($dbForProject, $resource); + $this->afterDeploymentSuccess( $project, $deployment, @@ -1095,19 +1092,12 @@ class Builds extends Action } } - $endTime = DateTime::now(); - $durationEnd = \microtime(true); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildEndedAt' => $endTime, - 'buildDuration' => \intval(\ceil($durationEnd - $durationStart)), - ])); - Span::add('build.duration', $deployment->getAttribute('buildDuration')); $queueForRealtime ->setPayload($deployment->getArrayCopy()) ->trigger(); if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -1139,7 +1129,7 @@ class Builds extends Action } } catch (\Throwable $th) { if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { - $this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime); + $this->finalizeCanceledDeployment($deployment->getId(), $dbForProject, $queueForRealtime); return; } @@ -1182,9 +1172,7 @@ class Builds extends Action 'buildLogs' => $message, ])); - if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) { - $resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')])); - } + $resource = $this->updateLatestDeployment($dbForProject, $resource); $queueForRealtime ->setPayload($deployment->getArrayCopy()) @@ -1333,6 +1321,79 @@ class Builds extends Action return ''; } + protected function getNodeModulesCacheKey(Document $project, Document $resource, array $runtime, string $version, string $command): string + { + if ($version !== 'v5' || $command === '' || $command === '0') { + return ''; + } + + $hashContext = [ + 'version' => 'v1', + 'projectId' => $project->getId(), + 'resourceType' => $resource->getCollection(), + 'resourceId' => $resource->getId(), + 'runtime' => $runtime['image'] ?? '', + ]; + + return \substr(\hash('sha256', \json_encode($hashContext, JSON_THROW_ON_ERROR)), 0, 48); + } + + protected function prepareSiteBuildCommand(string $command, string $outputDirectory): string + { + $listFilesCommand = 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; + + if (! empty($outputDirectory)) { + $listFilesCommand .= ' && cd ' . \escapeshellarg($outputDirectory); + } + + $listFilesCommand .= ' && find . -name \'node_modules\' -prune -o -type f -print && echo "{APPWRITE_DETECTION_SEPARATOR_END}"'; + + if (empty($command)) { + return $listFilesCommand; + } + + return "{$command} && {$listFilesCommand}"; + } + + /** + * @return array{logs: string, detectionLogs: string} + */ + protected function splitSiteDetectionLogs(string $logs): array + { + if (! \str_contains($logs, '{APPWRITE_DETECTION_SEPARATOR_START}')) { + return [ + 'logs' => $logs, + 'detectionLogs' => '', + ]; + } + + [$logsBefore, $detectionLogsStart] = \explode('{APPWRITE_DETECTION_SEPARATOR_START}', $logs, 2); + [$detectionLogs, $logsAfter] = \explode('{APPWRITE_DETECTION_SEPARATOR_END}', $detectionLogsStart, 2); + + return [ + 'logs' => "{$logsBefore}{$logsAfter}", + 'detectionLogs' => $detectionLogs, + ]; + } + + protected function detectSiteRendering(string $framework, string $detectionLogs): object + { + $files = \explode("\n", $detectionLogs); + $files = \array_filter($files); + $files = \array_map(\trim(...), $files); + $files = \array_map(fn ($file) => \str_starts_with($file, './') ? \substr($file, 2) : $file, $files); + + $detector = new Rendering($framework); + foreach ($files as $file) { + $detector->addInput($file); + } + + return $detector + ->addOption(new SSR()) + ->addOption(new XStatic()) + ->detect(); + } + /** * @throws Structure * @throws \Utopia\Database\Exception @@ -1472,20 +1533,61 @@ class Builds extends Action } } - private function cancelDeployment(string $deploymentId, Database $dbForProject, Realtime $queueForRealtime) + private function updateLatestDeployment(Database $dbForProject, Document $resource): Document + { + $latestDeployment = $dbForProject->findOne('deployments', [ + Query::equal('resourceType', [$resource->getCollection()]), + Query::equal('resourceInternalId', [$resource->getSequence()]), + Query::orderDesc('$createdAt'), + ]); + + $updates = $latestDeployment->isEmpty() + ? [ + 'latestDeploymentCreatedAt' => '', + 'latestDeploymentInternalId' => '', + 'latestDeploymentId' => '', + 'latestDeploymentStatus' => '', + ] + : [ + 'latestDeploymentCreatedAt' => $latestDeployment->getCreatedAt(), + 'latestDeploymentInternalId' => $latestDeployment->getSequence(), + 'latestDeploymentId' => $latestDeployment->getId(), + 'latestDeploymentStatus' => $latestDeployment->getAttribute('status', ''), + ]; + + return $dbForProject->updateDocument( + $resource->getCollection(), + $resource->getId(), + new Document($updates) + ); + } + + private function finalizeCanceledDeployment(string $deploymentId, Database $dbForProject, Realtime $queueForRealtime) { Span::add('deployment.status', 'canceled'); - $deployment = $dbForProject->getDocument('deployments', $deploymentId); + $attempts = 0; - $logs = $deployment->getAttribute('buildLogs', ''); - $date = \date('H:i:s'); - $logs .= "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[33m Build has been canceled. \033[0m\n"; + while (true) { + try { + $deployment = $dbForProject->getDocument('deployments', $deploymentId); - $deployment->setAttribute('buildLogs', $logs); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildLogs' => $deployment->getAttribute('buildLogs'), - ])); + $logs = $deployment->getAttribute('buildLogs', ''); + $date = \date('H:i:s'); + $logs .= "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[33m Build has been canceled. \033[0m\n"; + + $deployment->setAttribute('buildLogs', $logs); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildLogs' => $deployment->getAttribute('buildLogs'), + ])); + + break; + } catch (TransactionException $exception) { + if (++$attempts >= 5) { + throw $exception; + } + } + } $queueForRealtime ->setPayload($deployment->getArrayCopy()) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php index c766f73929..35cbe63a15 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Screenshots.php @@ -10,7 +10,6 @@ use Appwrite\Role; use Exception; use Utopia\Compression\Compression; use Utopia\Config\Config; -use Utopia\Console; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; @@ -18,6 +17,7 @@ use Utopia\Database\Query; use Utopia\Fetch\Client as FetchClient; use Utopia\Platform\Action; use Utopia\Queue\Message; +use Utopia\Span\Span; use Utopia\Storage\Device; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; @@ -59,7 +59,7 @@ class Screenshots extends Action Device $deviceForFiles, Telemetry $telemetry ): void { - Console::log('Screenshot action started'); + Span::add('project.id', $project->getId()); $payload = $message->getPayload(); @@ -70,9 +70,8 @@ class Screenshots extends Action $screenshotMessage = Screenshot::fromArray($payload); $counter = $telemetry->createCounter('worker.screenshots.capture'); - Console::log('Site screenshot started'); - $deploymentId = $screenshotMessage->deploymentId; + Span::add('deployment.id', $deploymentId); $deployment = $dbForProject->getDocument('deployments', $deploymentId); if ($deployment->isEmpty()) { @@ -80,12 +79,15 @@ class Screenshots extends Action } $siteId = $deployment->getAttribute('resourceId'); + Span::add('site.id', $siteId); $site = $dbForProject->getDocument('sites', $siteId); if ($site->isEmpty()) { throw new \Exception('Site not found'); } + Span::add('site.framework', $site->getAttribute('framework', '')); + // Realtime preparation $event = "sites.[siteId].deployments.[deploymentId].update"; $queueForRealtime @@ -205,6 +207,8 @@ class Screenshots extends Action throw new \Exception($screenshotError); } + Span::add('screenshot.count', \count($screenshots)); + $mimeType = "image/png"; $updates = new Document([]); @@ -268,10 +272,6 @@ class Screenshots extends Action 'deploymentScreenshotLight' => $deployment->getAttribute('screenshotLight', ''), ])); } catch (\Throwable $th) { - Console::warning("Screenshot failed to generate:"); - Console::warning($th->getMessage()); - Console::warning($th->getTraceAsString()); - $date = \date('H:i:s'); $this->appendToLogs($dbForProject, $deployment->getId(), $queueForRealtime, "[$date] [appwrite] Screenshot capturing failed. Deployment will continue. \n"); diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php index c3a299ccd5..8f0523a14c 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Create.php @@ -9,6 +9,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; @@ -60,7 +61,7 @@ class Create extends Action ->param('adminSecret', '', new Text(512), 'Source\'s Admin Secret') ->param('database', '', new Text(512), 'Source\'s Database Name') ->param('username', '', new Text(512), 'Source\'s Database Username') - ->param('password', '', new Text(512), 'Source\'s Database Password') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password') ->param('port', 5432, new Integer(true), 'Source\'s Database Port', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php index a16d47f53d..4f70aca481 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/NHost/Report/Get.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Document; use Utopia\Migration\Sources\NHost; @@ -53,7 +54,7 @@ class Get extends Action ->param('adminSecret', '', new Text(512), 'Source\'s Admin Secret.') ->param('database', '', new Text(512), 'Source\'s Database Name.') ->param('username', '', new Text(512), 'Source\'s Database Username.') - ->param('password', '', new Text(512), 'Source\'s Database Password.') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password.') ->param('port', 5432, new Integer(true), 'Source\'s Database Port.', true) ->inject('response') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php index dc835158ab..1cf8849503 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Create.php @@ -9,6 +9,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; @@ -60,7 +61,7 @@ class Create extends Action ->param('apiKey', '', new Text(512), 'Source\'s API Key') ->param('databaseHost', '', new Text(512), 'Source\'s Database Host') ->param('username', '', new Text(512), 'Source\'s Database Username') - ->param('password', '', new Text(512), 'Source\'s Database Password') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password') ->param('port', 5432, new Integer(true), 'Source\'s Database Port', true) ->inject('response') ->inject('dbForProject') diff --git a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php index d88fa0e2fb..df0455455e 100644 --- a/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php +++ b/src/Appwrite/Platform/Modules/Migrations/Http/Migrations/Supabase/Report/Get.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Document; use Utopia\Migration\Sources\Supabase; @@ -53,7 +54,7 @@ class Get extends Action ->param('apiKey', '', new Text(512), 'Source\'s API Key.') ->param('databaseHost', '', new Text(512), 'Source\'s Database Host.') ->param('username', '', new Text(512), 'Source\'s Database Username.') - ->param('password', '', new Text(512), 'Source\'s Database Password.') + ->param('password', '', new PasswordFormat(new Text(512)), 'Source\'s Database Password.') ->param('port', 5432, new Integer(true), 'Source\'s Database Port.', true) ->inject('response') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php index 785fddf233..90c3781701 100644 --- a/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Organization/Http/Projects/Create.php @@ -94,6 +94,7 @@ class Create extends Action 'disposableEmails' => false, 'canonicalEmails' => false, 'freeEmails' => false, + 'corporateEmails' => false, 'mockNumbers' => [], 'sessionAlerts' => false, 'membershipsUserName' => false, diff --git a/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php b/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php index 9b5163fdbf..9e691e4647 100644 --- a/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php +++ b/src/Appwrite/Platform/Modules/Presences/HTTP/Upsert.php @@ -156,7 +156,7 @@ class Upsert extends PlatformAction if (empty($userInternalId)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to resolve valid user internal ID.'); } - $isGraphQL = $request->getHeader('x-appwrite-source') === 'graphql'; + $isGraphQL = $request->getHeaderLine('x-appwrite-source') === 'graphql'; $presenceData = [ 'userInternalId' => $userInternalId, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/Get.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/Get.php index c0c247936d..3ac3c9823a 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/Get.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/Get.php @@ -77,6 +77,7 @@ class Get extends Action return [ 'password-dictionary' => Response::MODEL_POLICY_PASSWORD_DICTIONARY, 'password-history' => Response::MODEL_POLICY_PASSWORD_HISTORY, + 'password-strength' => Response::MODEL_POLICY_PASSWORD_STRENGTH, 'password-personal-data' => Response::MODEL_POLICY_PASSWORD_PERSONAL_DATA, 'session-alert' => Response::MODEL_POLICY_SESSION_ALERT, 'session-duration' => Response::MODEL_POLICY_SESSION_DURATION, @@ -109,6 +110,18 @@ class Get extends Action ]), Response::MODEL_POLICY_PASSWORD_HISTORY, ], + 'password-strength' => [ + new Document(\array_merge([ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ], $auths['passwordStrength'] ?? [], [ + '$id' => 'password-strength', + ])), + Response::MODEL_POLICY_PASSWORD_STRENGTH, + ], 'password-personal-data' => [ new Document([ '$id' => 'password-personal-data', @@ -159,6 +172,7 @@ class Get extends Action 'userPhone' => $auths['membershipsUserPhone'] ?? false, 'userName' => $auths['membershipsUserName'] ?? false, 'userMFA' => $auths['membershipsMfa'] ?? false, + 'userAccessedAt' => $auths['membershipsUserAccessedAt'] ?? false, ]), Response::MODEL_POLICY_MEMBERSHIP_PRIVACY, ], diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php index 41a6168b07..5d7043fedf 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/MembershipPrivacy/Update.php @@ -55,6 +55,7 @@ class Update extends Action ->param('userPhone', null, new Boolean(), 'Set to true if you want make user phone number visible to all team members, or false to hide it.', optional: true) ->param('userName', null, new Boolean(), 'Set to true if you want make user name visible to all team members, or false to hide it.', optional: true) ->param('userMFA', null, new Boolean(), 'Set to true if you want make user MFA status visible to all team members, or false to hide it.', optional: true) + ->param('userAccessedAt', null, new Boolean(), 'Set to true if you want make user last access time visible to all team members, or false to hide it.', optional: true) ->inject('response') ->inject('dbForPlatform') ->inject('project') @@ -69,6 +70,7 @@ class Update extends Action ?bool $userPhone, ?bool $userName, ?bool $userMFA, + ?bool $userAccessedAt, Response $response, Database $dbForPlatform, Document $project, @@ -92,6 +94,9 @@ class Update extends Action if ($userMFA !== null) { $auths['membershipsMfa'] = $userMFA; } + if ($userAccessedAt !== null) { + $auths['membershipsUserAccessedAt'] = $userAccessedAt; + } $updates = new Document([ 'auths' => $auths, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php new file mode 100644 index 0000000000..3fbcbe8b30 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/PasswordStrength/Update.php @@ -0,0 +1,115 @@ +setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/project/policies/password-strength') + ->desc('Update password strength policy') + ->groups(['api', 'project']) + ->label('scope', ['policies.write', 'project.policies.write']) + ->label('event', 'projects.[projectId].policies.[policy].update') + ->label('audits.event', 'projects.[projectId].policies.[policy].update') + ->label('audits.resource', 'project/{response.$id}') + ->label('sdk', new Method( + namespace: 'project', + group: 'policies', + name: 'updatePasswordStrengthPolicy', + description: <<<'EOT' + Update the password strength requirements for users in the project. + EOT, + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_POLICY_PASSWORD_STRENGTH, + ), + ], + )) + ->param('min', null, new Range(8, 256), 'Minimum password length. Value must be between 8 and 256. Default is 8.', optional: true) + ->param('uppercase', null, new Boolean(), 'Whether passwords must include at least one uppercase letter.', optional: true) + ->param('lowercase', null, new Boolean(), 'Whether passwords must include at least one lowercase letter.', optional: true) + ->param('number', null, new Boolean(), 'Whether passwords must include at least one number.', optional: true) + ->param('symbols', null, new Boolean(), 'Whether passwords must include at least one symbol.', optional: true) + ->inject('response') + ->inject('dbForPlatform') + ->inject('project') + ->inject('authorization') + ->inject('queueForEvents') + ->callback($this->action(...)); + } + + public function action( + ?int $min, + ?bool $uppercase, + ?bool $lowercase, + ?bool $number, + ?bool $symbols, + Response $response, + Database $dbForPlatform, + Document $project, + Authorization $authorization, + Event $queueForEvents, + ): void { + $auths = $project->getAttribute('auths', []); + $auths['passwordStrength'] = \array_merge([ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ], $auths['passwordStrength'] ?? []); + + if ($min !== null) { + $auths['passwordStrength']['min'] = $min; + } + if ($uppercase !== null) { + $auths['passwordStrength']['uppercase'] = $uppercase; + } + if ($lowercase !== null) { + $auths['passwordStrength']['lowercase'] = $lowercase; + } + if ($number !== null) { + $auths['passwordStrength']['number'] = $number; + } + if ($symbols !== null) { + $auths['passwordStrength']['symbols'] = $symbols; + } + + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'auths' => $auths, + ]))); + + $queueForEvents + ->setParam('projectId', $project->getId()) + ->setParam('policy', 'password-strength'); + + $response->dynamic(new Document(\array_merge($auths['passwordStrength'], [ + '$id' => 'password-strength', + ])), Response::MODEL_POLICY_PASSWORD_STRENGTH); + } +} diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/XList.php b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/XList.php index 7057803c8a..0c74b86547 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/XList.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/Policies/XList.php @@ -103,6 +103,15 @@ class XList extends Action '$id' => 'password-history', 'total' => $auths['passwordHistory'] ?? 0, ]), + new Document(\array_merge([ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ], $auths['passwordStrength'] ?? [], [ + '$id' => 'password-strength', + ])), new Document([ '$id' => 'password-personal-data', 'enabled' => $auths['personalDataCheck'] ?? false, diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php index fa35b8d6d5..df5b650d5d 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Tests/Create.php @@ -10,6 +10,7 @@ use Appwrite\SDK\AuthType; use Appwrite\SDK\ContentType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Template\Template; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response as UtopiaResponse; @@ -64,7 +65,7 @@ class Create extends Action ->param('host', '', new Hostname(), 'SMTP server host name', optional: true, deprecated: true) // Backwards compatibility ->param('port', null, new Integer(), 'SMTP server port', optional: true, deprecated: true) // Backwards compatibility ->param('username', '', new Text(256), 'SMTP server username', optional: true, deprecated: true) // Backwards compatibility - ->param('password', '', new Text(256), 'SMTP server password', optional: true, deprecated: true) // Backwards compatibility + ->param('password', '', new PasswordFormat(new Text(256)), 'SMTP server password', optional: true, deprecated: true) // Backwards compatibility ->param('secure', '', new WhiteList(['tls', 'ssl'], true), 'Does SMTP server use secure connection', optional: true, deprecated: true) // Backwards compatibility ->inject('response') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php index c3fe222298..bf513f5dac 100644 --- a/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php +++ b/src/Appwrite/Platform/Modules/Project/Http/Project/SMTP/Update.php @@ -7,6 +7,7 @@ use Appwrite\Platform\Action; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use PHPMailer\PHPMailer\PHPMailer; use Throwable; @@ -62,7 +63,7 @@ class Update extends Action ->param('host', null, new Nullable(new Hostname()), 'SMTP server hostname (domain)', optional: true) ->param('port', null, new Nullable(new Integer()), 'SMTP server port', optional: true) ->param('username', null, new Nullable(new Text(256, 0)), 'SMTP server username. Pass an empty string to clear a previously set value.', optional: true) - ->param('password', null, new Nullable(new Text(256, 0)), 'SMTP server password. Pass an empty string to clear a previously set value. This property is stored securely and cannot be read in future (write-only).', optional: true) + ->param('password', null, new Nullable(new PasswordFormat(new Text(256, 0))), 'SMTP server password. Pass an empty string to clear a previously set value. This property is stored securely and cannot be read in future (write-only).', optional: true) ->param('senderEmail', null, new Nullable(new Email(allowEmpty: true)), 'Email address shown in inbox as the sender of the email. Pass an empty string to clear a previously set value.', optional: true) ->param('senderName', null, new Nullable(new Text(256, 0)), 'Name shown in inbox as the sender of the email. Pass an empty string to clear a previously set value.', optional: true) ->param('replyToEmail', null, new Nullable(new Email(allowEmpty: true)), 'Email used when user replies to the email. Pass an empty string to clear a previously set value.', optional: true) diff --git a/src/Appwrite/Platform/Modules/Project/Services/Http.php b/src/Appwrite/Platform/Modules/Project/Services/Http.php index 3fe9f63d9e..a8eec3abd0 100644 --- a/src/Appwrite/Platform/Modules/Project/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Project/Services/Http.php @@ -80,6 +80,7 @@ use Appwrite\Platform\Modules\Project\Http\Project\Policies\MembershipPrivacy\Up use Appwrite\Platform\Modules\Project\Http\Project\Policies\PasswordDictionary\Update as UpdatePasswordDictionaryPolicy; use Appwrite\Platform\Modules\Project\Http\Project\Policies\PasswordHistory\Update as UpdatePasswordHistoryPolicy; use Appwrite\Platform\Modules\Project\Http\Project\Policies\PasswordPersonalData\Update as UpdatePasswordPersonalDataPolicy; +use Appwrite\Platform\Modules\Project\Http\Project\Policies\PasswordStrength\Update as UpdatePasswordStrengthPolicy; use Appwrite\Platform\Modules\Project\Http\Project\Policies\SessionAlert\Update as UpdateSessionAlertPolicy; use Appwrite\Platform\Modules\Project\Http\Project\Policies\SessionDuration\Update as UpdateSessionDurationPolicy; use Appwrite\Platform\Modules\Project\Http\Project\Policies\SessionInvalidation\Update as UpdateSessionInvalidationPolicy; @@ -168,6 +169,7 @@ class Http extends Service $this->addAction(UpdateMembershipPrivacyPolicy::getName(), new UpdateMembershipPrivacyPolicy()); $this->addAction(UpdatePasswordDictionaryPolicy::getName(), new UpdatePasswordDictionaryPolicy()); $this->addAction(UpdatePasswordHistoryPolicy::getName(), new UpdatePasswordHistoryPolicy()); + $this->addAction(UpdatePasswordStrengthPolicy::getName(), new UpdatePasswordStrengthPolicy()); $this->addAction(UpdatePasswordPersonalDataPolicy::getName(), new UpdatePasswordPersonalDataPolicy()); $this->addAction(UpdateSessionAlertPolicy::getName(), new UpdateSessionAlertPolicy()); $this->addAction(UpdateSessionDurationPolicy::getName(), new UpdateSessionDurationPolicy()); diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php index 9204f99d67..28405fe1da 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php @@ -83,6 +83,13 @@ class Create extends Action $auths = [ 'limit' => 0, 'maxSessions' => 0, + 'passwordStrength' => [ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ], 'passwordHistory' => 0, 'passwordDictionary' => false, 'duration' => TOKEN_EXPIRATION_LOGIN_LONG, @@ -90,6 +97,7 @@ class Create extends Action 'disposableEmails' => false, 'canonicalEmails' => false, 'freeEmails' => false, + 'corporateEmails' => false, 'mockNumbers' => [], 'sessionAlerts' => false, 'membershipsUserName' => false, diff --git a/src/Appwrite/Platform/Modules/Proxy/Action.php b/src/Appwrite/Platform/Modules/Proxy/Action.php index f2ffc58568..959a27b48b 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Action.php +++ b/src/Appwrite/Platform/Modules/Proxy/Action.php @@ -54,10 +54,11 @@ class Action extends PlatformAction return $dbForPlatform->getDocument('rules', $rule->getId()); }); - if ( - $existingRule->isEmpty() || - $existingRule->getAttribute('domain', '') !== $rule->getAttribute('domain', '') - ) { + if ($existingRule->isEmpty()) { + return true; + } + + if ($existingRule->getAttribute('domain', '') !== $rule->getAttribute('domain', '')) { return false; } diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php index 24abbf49ba..c15bc3b1d9 100644 --- a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -40,7 +40,7 @@ class Create extends Action ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) ->setHttpPath('/v1/proxy/rules/redirect') ->groups(['api', 'proxy']) - ->desc('Create Redirect rule') + ->desc('Create redirect rule') ->label('scope', 'rules.write') ->label('event', 'rules.[ruleId].create') ->label('audits.event', 'rule.create') diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php index 5fd724346c..253abbb495 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -166,7 +166,7 @@ class Create extends Action throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); } - $contentRange = $request->getHeader('content-range'); + $contentRange = $request->getHeaderLine('content-range'); $deploymentId = ID::unique(); $chunk = 1; $chunks = 1; @@ -175,7 +175,7 @@ class Create extends Action $start = $request->getContentRangeStart(); $end = $request->getContentRangeEnd(); $fileSize = $request->getContentRangeSize(); - $deploymentId = $request->getHeader('x-appwrite-id', $deploymentId); + $deploymentId = $request->getHeaderLine('x-appwrite-id', $deploymentId); // TODO make `end >= $fileSize` in next breaking version if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); @@ -202,8 +202,35 @@ class Create extends Action $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; $completed = false; + $mergeUploadMetadata = function (array $stored, array $current): array { + $merged = \array_merge($stored, $current); + + if (isset($stored['parts']) || isset($current['parts'])) { + $parts = $stored['parts'] ?? []; + foreach (($current['parts'] ?? []) as $part => $value) { + $parts[(int) $part] = $value; + } + \ksort($parts); + + $merged['parts'] = $parts; + $merged['chunks'] = \count($parts); + } + + return $merged; + }; + + $type = $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + + $commands = []; + if (!empty($installCommand)) { + $commands[] = $installCommand; + } + if (!empty($buildCommand)) { + $commands[] = $buildCommand; + } + try { - $locks($lockKey, 600, function () use (&$chunks, $dbForProject, $deploymentId, &$metadata, &$completed, $response): void { + $locks($lockKey, 600, function () use ($activate, $authorization, &$chunks, $commands, $contentRange, $dbForPlatform, $dbForProject, $deploymentId, $deviceForSites, $fileSize, &$metadata, $outputDirectory, $path, $platform, $project, &$site, $type, &$completed, $response): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); if (!$deployment->isEmpty()) { @@ -220,6 +247,65 @@ class Create extends Action return; } } + + if ($deployment->isEmpty()) { + $deviceForSites->prepareUpload($path, $metadata['content_type'] ?? '', $chunks, $metadata); + + if (!empty($contentRange)) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $site->getSequence(), + 'resourceId' => $site->getId(), + 'resourceType' => 'sites', + 'buildCommands' => \implode(' && ', $commands), + 'startCommand' => $site->getAttribute('startCommand', ''), + 'buildOutput' => $outputDirectory, + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'sourceChunksTotal' => $chunks, + 'sourceChunksUploaded' => 0, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type, + ])); + + $sitesDomain = $platform['sitesDomain']; + $domain = ID::unique() . "." . $sitesDomain; + + // TODO: (@Meldiron) Remove after 1.7.x migration + $isMd5 = System::getEnv('_APP_RULES_FORMAT') === 'md5'; + $ruleId = $isMd5 ? md5($domain) : ID::unique(); + + $authorization->skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getSequence(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getSequence(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getSequence(), + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + } + } }, timeout: 120.0); } catch (LockContention) { $response->addHeader('Retry-After', '5'); @@ -231,31 +317,21 @@ class Create extends Action return; } - $chunksUploaded = $deviceForSites->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + $chunksUploaded = $deviceForSites->uploadChunk($fileTmpName, $path, $chunk, $chunks, $metadata); if (empty($chunksUploaded)) { throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); } - $type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'; - - $commands = []; - if (!empty($installCommand)) { - $commands[] = $installCommand; - } - if (!empty($buildCommand)) { - $commands[] = $buildCommand; - } - try { - $locks($lockKey, 600, function () use ($activate, $authorization, $commands, &$chunks, $chunksUploaded, $dbForPlatform, $dbForProject, $deploymentId, $deviceForSites, $fileSize, &$metadata, $outputDirectory, $path, $platform, $project, $publisherForBuilds, $queueForEvents, $response, &$site, $siteId, $type): void { + $locks($lockKey, 600, function () use ($activate, $authorization, $commands, &$chunks, $chunksUploaded, $dbForPlatform, $dbForProject, $deploymentId, $deviceForSites, $fileSize, &$metadata, $mergeUploadMetadata, $outputDirectory, $path, $platform, $project, $publisherForBuilds, $queueForEvents, $response, &$site, $siteId, $type): void { $deployment = $dbForProject->getDocument('deployments', $deploymentId); $uploaded = 0; if (!$deployment->isEmpty()) { $chunks = $deployment->getAttribute('sourceChunksTotal', 1); $uploaded = $deployment->getAttribute('sourceChunksUploaded', 0); - $metadata = \array_merge($deployment->getAttribute('sourceMetadata', []), $metadata); + $metadata = $mergeUploadMetadata($deployment->getAttribute('sourceMetadata', []), $metadata); if ($uploaded === $chunks) { $queueForEvents->reset(); @@ -267,9 +343,11 @@ class Create extends Action } } - $chunksUploaded = max($uploaded, $chunksUploaded); + $chunksUploaded = max($uploaded, $chunksUploaded, (int) ($metadata['chunks'] ?? 0)); if ($chunksUploaded === $chunks && $uploaded < $chunks) { + $deviceForSites->finalizeUpload($path, $chunks, $metadata); + if ($activate) { // Remove deploy for all other deployments. $activeDeployments = $dbForProject->find('deployments', [ @@ -311,18 +389,6 @@ class Create extends Action 'type' => $type, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $deployment->getId(), - 'latestDeploymentInternalId' => $deployment->getSequence(), - 'latestDeploymentCreatedAt' => $deployment->getCreatedAt(), - 'latestDeploymentStatus' => $deployment->getAttribute('status', ''), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; @@ -367,73 +433,10 @@ class Create extends Action platform: $platform, )); } else { - if ($deployment->isEmpty()) { - $deployment = $dbForProject->createDocument('deployments', new Document([ - '$id' => $deploymentId, - '$permissions' => [ - Permission::read(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'resourceInternalId' => $site->getSequence(), - 'resourceId' => $site->getId(), - 'resourceType' => 'sites', - 'buildCommands' => \implode(' && ', $commands), - 'startCommand' => $site->getAttribute('startCommand', ''), - 'buildOutput' => $outputDirectory, - 'adapter' => $site->getAttribute('adapter', ''), - 'fallbackFile' => $site->getAttribute('fallbackFile', ''), - 'sourcePath' => $path, - 'sourceSize' => $fileSize, - 'totalSize' => $fileSize, - 'sourceChunksTotal' => $chunks, - 'sourceChunksUploaded' => $chunksUploaded, - 'activate' => $activate, - 'sourceMetadata' => $metadata, - 'type' => $type, - ])); - - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $site->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), - ])); - - $sitesDomain = $platform['sitesDomain']; - $domain = ID::unique() . "." . $sitesDomain; - $ruleId = md5($domain); - $authorization->skip( - fn () => $dbForPlatform->createDocument('rules', new Document([ - '$id' => $ruleId, - 'projectId' => $project->getId(), - 'projectInternalId' => $project->getSequence(), - 'domain' => $domain, - 'type' => 'deployment', - 'trigger' => 'deployment', - 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), - 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getSequence(), - 'deploymentResourceType' => 'site', - 'deploymentResourceId' => $site->getId(), - 'deploymentResourceInternalId' => $site->getSequence(), - 'status' => 'verified', - 'certificateId' => '', - 'search' => implode(' ', [$ruleId, $domain]), - 'owner' => 'Appwrite', - 'region' => $project->getAttribute('region') - ])) - ); - } else { - $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ - 'sourceChunksUploaded' => $chunksUploaded, - 'sourceMetadata' => $metadata, - ])); - } + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([ + 'sourceChunksUploaded' => $chunksUploaded, + 'sourceMetadata' => $metadata, + ])); } $metadata = null; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php index b50e9b54f4..a1ccf6cad5 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -89,8 +90,16 @@ class Delete extends Action throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); } - if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + try { + if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } + } catch (TransactionException) { + $deploymentExists = !$dbForProject->getDocument('deployments', $deployment->getId())->isEmpty(); + + if ($deploymentExists && !$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } } if (!empty($deployment->getAttribute('sourcePath', ''))) { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php index 0ab998292d..fa84b2f22f 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -51,6 +51,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], contentType: ContentType::ANY, )) ->param('siteId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Site ID.', false, ['dbForProject']) @@ -99,7 +100,7 @@ class Get extends Action } $size = $device->getFileSize($path); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); $response ->setContentType('application/gzip') diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index b3619c6017..e575fbbf07 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -135,19 +135,7 @@ class Create extends Action 'status' => 'waiting', 'buildPath' => '', 'buildLogs' => '', - 'type' => $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual' - ])); - - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $site->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), + 'type' => $request->getHeaderLine('x-sdk-language') === 'cli' ? 'cli' : 'manual' ])); // Preview deployments for sites diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php index 7ea5cc87cb..a28a7465e6 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php @@ -12,6 +12,7 @@ use Executor\Executor; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Exception\Transaction as TransactionException; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -89,17 +90,30 @@ class Update extends Action $endTime = new \DateTime('now'); $duration = $endTime->getTimestamp() - $startTime->getTimestamp(); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ - 'buildEndedAt' => DateTime::now(), - 'buildDuration' => $duration, - 'status' => 'canceled' - ])); - - if ($deployment->getSequence() === $site->getAttribute('latestDeploymentInternalId', '')) { - $site = $site->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), + try { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' ])); + } catch (TransactionException) { + $deployment = $dbForProject->getDocument('deployments', $deployment->getId()); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) { + throw new Exception(Exception::BUILD_ALREADY_COMPLETED); + } + + if ($deployment->getAttribute('status') !== 'canceled') { + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' + ])); + } } try { diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php index b0d39ad6f9..2d6b441616 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -184,18 +184,6 @@ class Create extends Base 'activate' => $activate, ])); - $site = $site - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $dbForProject->updateDocument('sites', $site->getId(), new Document([ - 'latestDeploymentId' => $site->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'), - ])); - $sitesDomain = $platform['sitesDomain']; $domain = ID::unique() . "." . $sitesDomain; diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php index 0a2f5cdd71..a9082b7436 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -183,6 +183,17 @@ class Update extends Base $isConnected = !empty($site->getAttribute('providerRepositoryId', '')); + // Omitted providerRepositoryId (null) on a connected site — preserve existing VCS values + if ($isConnected && $providerRepositoryId === null) { + $providerRepositoryId = $site->getAttribute('providerRepositoryId', ''); + $installationId = $site->getAttribute('installationId', ''); + $providerBranch = $providerBranch ?: $site->getAttribute('providerBranch', ''); + $providerRootDirectory = $providerRootDirectory ?: $site->getAttribute('providerRootDirectory', ''); + $repositoryId = $site->getAttribute('repositoryId', ''); + $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); + $installation = $dbForPlatform->getDocument('installations', $installationId); + } + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { $repositories = $dbForPlatform->find('repositories', [ diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php index 69b27af25c..c5252a299f 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Create.php @@ -187,7 +187,7 @@ class Create extends Action $fileTmpName = (\is_array($file['tmp_name']) && isset($file['tmp_name'][0])) ? $file['tmp_name'][0] : $file['tmp_name']; $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; - $contentRange = $request->getHeader('content-range'); + $contentRange = $request->getHeaderLine('content-range'); $fileId = $fileId === 'unique()' ? ID::unique() : $fileId; $chunk = 1; $chunks = 1; @@ -196,7 +196,7 @@ class Create extends Action $start = $request->getContentRangeStart(); $end = $request->getContentRangeEnd(); $fileSize = $request->getContentRangeSize(); - $fileId = $request->getHeader('x-appwrite-id', $fileId); + $fileId = $request->getHeaderLine('x-appwrite-id', $fileId); // TODO make `end >= $fileSize` in next breaking version if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); @@ -260,8 +260,8 @@ class Create extends Action }; try { - $locks($lockKey, 600, function () use ($bucket, &$chunks, $contentRange, $dbForProject, $deviceForFiles, $fileId, $fileName, $fileSize, &$metadata, $path, $permissions, $response, &$completed): void { - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + $locks($lockKey, 600, function () use ($authorization, $bucket, &$chunks, $contentRange, $dbForProject, $deviceForFiles, $fileId, $fileName, $fileSize, &$metadata, $path, $permissions, $response, &$completed): void { + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); if (!$file->isEmpty()) { $chunks = $file->getAttribute('chunksTotal', 1); $uploaded = $file->getAttribute('chunksUploaded', 0); @@ -325,7 +325,7 @@ class Create extends Action } $finalizeUpload = function (int $chunksUploaded) use ($authorization, $bucket, &$chunks, $contentRange, $dbForProject, $deviceForFiles, $fileId, $fileName, $fileSize, &$metadata, $mergeUploadMetadata, $path, $permissions, $queueForEvents, $response): void { - $file = $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId); + $file = $authorization->skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getSequence(), $fileId)); $uploaded = 0; if (!$file->isEmpty()) { diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php index 7e5d7d6879..ed02a295c8 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Download/Get.php @@ -57,7 +57,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('bucketId', '', new UID(), 'Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') @@ -127,7 +128,7 @@ class Get extends Action $size = $file->getAttribute('sizeOriginal', 0); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); $end = $request->getRangeEnd(); diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php index 9c316a3b57..2a2686b544 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Preview/Get.php @@ -71,6 +71,7 @@ class Get extends Action ) ], type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], contentType: ContentType::IMAGE )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php index f069b1cc2a..2b2d23c1fa 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/Push/Get.php @@ -119,7 +119,7 @@ class Get extends Action $size = $file->getAttribute('sizeOriginal', 0); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); $end = $request->getRangeEnd(); diff --git a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php index b78d582c47..01e8b56fbe 100644 --- a/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php +++ b/src/Appwrite/Platform/Modules/Storage/Http/Buckets/Files/View/Get.php @@ -58,7 +58,8 @@ class Get extends Action ) ], contentType: ContentType::ANY, - type: MethodType::LOCATION + type: MethodType::LOCATION, + locationAuth: ['Project', 'ImpersonateUserId'], )) ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') ->param('fileId', '', new UID(), 'File ID.') @@ -136,7 +137,7 @@ class Get extends Action $size = $file->getAttribute('sizeOriginal', 0); - $rangeHeader = $request->getHeader('range'); + $rangeHeader = $request->getHeaderLine('range'); if (!empty($rangeHeader)) { $start = $request->getRangeStart(); $end = $request->getRangeEnd(); diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php index 3bffb091ba..19d9237ff1 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Create.php @@ -204,6 +204,10 @@ class Create extends Action throw new Exception(Exception::USER_EMAIL_FREE); } + if ((($project->getId() === 'console') || ($plan['supportsCorporateEmailValidation'] ?? false)) && ($project->getAttribute('auths', [])['corporateEmails'] ?? false) && !($emailMetadata['emailIsCorporate'] ?? true)) { + throw new Exception(Exception::USER_EMAIL_NOT_CORPORATE); + } + $hash = $proofForPassword->hash($proofForPassword->generate()); $userId = ID::unique(); diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Get.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Get.php index 0a856bb5a8..a39b05158e 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Get.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/Get.php @@ -81,6 +81,7 @@ class Get extends Action 'mfa' => $project->getAttribute('auths', [])['membershipsMfa'] ?? true, 'userId' => $project->getAttribute('auths', [])['membershipsUserId'] ?? true, 'userPhone' => $project->getAttribute('auths', [])['membershipsUserPhone'] ?? true, + 'userAccessedAt' => $project->getAttribute('auths', [])['membershipsUserAccessedAt'] ?? false, ]; $roles = $authorization->getRoles(); @@ -130,6 +131,10 @@ class Get extends Action $membership->setAttribute('userPhone', $memberUser->getAttribute('phone')); } + if ($membershipsPrivacy['userAccessedAt']) { + $membership->setAttribute('userAccessedAt', $memberUser->getAttribute('accessedAt')); + } + $membership->setAttribute('teamName', $team->getAttribute('name')); $response->dynamic($membership, Response::MODEL_MEMBERSHIP); diff --git a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/XList.php b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/XList.php index 45f7eb33aa..ee6e69672a 100644 --- a/src/Appwrite/Platform/Modules/Teams/Http/Memberships/XList.php +++ b/src/Appwrite/Platform/Modules/Teams/Http/Memberships/XList.php @@ -130,6 +130,7 @@ class XList extends Action 'mfa' => $project->getAttribute('auths', [])['membershipsMfa'] ?? true, 'userId' => $project->getAttribute('auths', [])['membershipsUserId'] ?? true, 'userPhone' => $project->getAttribute('auths', [])['membershipsUserPhone'] ?? true, + 'userAccessedAt' => $project->getAttribute('auths', [])['membershipsUserAccessedAt'] ?? false, ]; $roles = $authorization->getRoles(); @@ -180,6 +181,10 @@ class XList extends Action $membership->setAttribute('userPhone', $memberUser->getAttribute('phone')); } + if ($membershipsPrivacy['userAccessedAt']) { + $membership->setAttribute('userAccessedAt', $memberUser->getAttribute('accessedAt')); + } + $membership->setAttribute('teamName', $team->getAttribute('name')); return $membership; diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php index cde39e9292..d172fdc688 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php @@ -392,18 +392,6 @@ trait Deployment 'activate' => $activate, ]))); - $resource = $resource - ->setAttribute('latestDeploymentId', $deployment->getId()) - ->setAttribute('latestDeploymentInternalId', $deployment->getSequence()) - ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) - ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); - $authorization->skip(fn () => $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document([ - 'latestDeploymentId' => $resource->getAttribute('latestDeploymentId'), - 'latestDeploymentInternalId' => $resource->getAttribute('latestDeploymentInternalId'), - 'latestDeploymentCreatedAt' => $resource->getAttribute('latestDeploymentCreatedAt'), - 'latestDeploymentStatus' => $resource->getAttribute('latestDeploymentStatus'), - ]))); - if ($resource->getCollection() === 'sites') { $projectId = $project->getId(); diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index c79df05f8a..420715ddc6 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -58,11 +58,11 @@ class Create extends Action ) { $this->preprocessEvent($request); - $event = $request->getHeader('x-github-event', ''); + $event = $request->getHeaderLine('x-github-event', ''); Span::add('vcs.github.event.name', $event); $payload = $request->getRawPayload(); - $signature = $request->getHeader('x-hub-signature-256', ''); + $signature = $request->getHeaderLine('x-hub-signature-256', ''); $secretKey = System::getEnv('_APP_VCS_GITHUB_WEBHOOK_SECRET', ''); $valid = empty($secretKey) ? true : $github->validateWebhookEvent($payload, $signature, $secretKey); diff --git a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php index fda462159f..c1a86c5597 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/Installations/Repositories/Branches/XList.php @@ -96,11 +96,7 @@ class XList extends Action throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND); } - $branches = $github->listBranches($owner, $repositoryName); - - if (!empty($search)) { - $branches = \array_values(\array_filter($branches, fn (string $branch) => \stripos($branch, $search) !== false)); - } + $branches = $github->listBranches($owner, $repositoryName, search: $search); $total = \count($branches); [ diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php index e192dff2a0..38196420be 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Create.php @@ -8,6 +8,7 @@ use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Database\Validator\CustomId; use Appwrite\Utopia\Response; use Utopia\Database\Database; @@ -68,7 +69,7 @@ class Create extends Action ->param('enabled', true, new Boolean(), 'Enable or disable a webhook.', true) ->param('tls', false, new Boolean(), 'Certificate verification, false for disabled or true for enabled.', true) ->param('authUsername', '', new Text(256), 'Webhook HTTP user. Max length: 256 chars.', true) - ->param('authPassword', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true) + ->param('authPassword', '', new PasswordFormat(new Text(256)), 'Webhook HTTP password. Max length: 256 chars.', true) ->param('secret', null, new Nullable(new Text(256, 8)), 'Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters.', optional: true) ->inject('response') ->inject('project') diff --git a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php index e7b516449e..17b93812f3 100644 --- a/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php +++ b/src/Appwrite/Platform/Modules/Webhooks/Http/Webhooks/Update.php @@ -8,6 +8,7 @@ use Appwrite\Extend\Exception; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; +use Appwrite\SDK\Specification\Validator\PasswordFormat; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; @@ -65,7 +66,7 @@ class Update extends Action ->param('enabled', true, new Boolean(), 'Enable or disable a webhook.', true) ->param('tls', false, new Boolean(), 'Certificate verification, false for disabled or true for enabled.', true) ->param('authUsername', '', new Text(256), 'Webhook HTTP user. Max length: 256 chars.', true) - ->param('authPassword', '', new Text(256), 'Webhook HTTP password. Max length: 256 chars.', true) + ->param('authPassword', '', new PasswordFormat(new Text(256)), 'Webhook HTTP password. Max length: 256 chars.', true) ->inject('response') ->inject('project') ->inject('queueForEvents') diff --git a/src/Appwrite/Platform/Tasks/Interval.php b/src/Appwrite/Platform/Tasks/Interval.php index 836508c73d..aaf09c494e 100644 --- a/src/Appwrite/Platform/Tasks/Interval.php +++ b/src/Appwrite/Platform/Tasks/Interval.php @@ -60,12 +60,13 @@ class Interval extends Action $timers[] = Timer::tick($task['interval'], function () use ($task, $dbForPlatform, $getProjectDB, $publisherForCertificates) { $taskName = $task['name']; Span::init("interval.{$taskName}"); + $error = null; try { $task['callback']($dbForPlatform, $getProjectDB, $publisherForCertificates); } catch (\Exception $e) { - Span::error($e); + $error = $e; } finally { - Span::current()?->finish(); + Span::current()?->finish(error: $error); } }); } diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 5d52d905f6..b3802b8eac 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -24,10 +24,11 @@ use Appwrite\SDK\Language\REST; use Appwrite\SDK\Language\Ruby; use Appwrite\SDK\Language\Rust; use Appwrite\SDK\Language\Swift; +use Appwrite\SDK\Language\Unity; use Appwrite\SDK\Language\Web; use Appwrite\SDK\SDK; +use Appwrite\Spec\OpenAPI3; use Appwrite\Spec\StaticSpec; -use Appwrite\Spec\Swagger2; use CzProject\GitPhp\Git; use Utopia\Agents\Adapters\OpenAI; use Utopia\Agents\DiffCheck\DiffCheck; @@ -301,14 +302,14 @@ class SDKs extends Action } Console::info("━━━ {$language['name']} SDK ({$platform['name']}, {$version}) ━━━"); - $specFormat = $language['spec'] ?? 'swagger2'; + $specFormat = $language['spec'] ?? 'openapi3'; $spec = null; if ($specFormat === 'static') { Console::log(' Using static SDK spec...'); } else { Console::log(' Fetching API spec...'); - $specPath = __DIR__ . '/../../../../app/config/specs/swagger2-' . $version . '-' . $language['family'] . '.json'; + $specPath = __DIR__ . '/../../../../app/config/specs/open-api3-' . $version . '-' . $language['family'] . '.json'; if (!file_exists($specPath)) { throw new \Exception('Spec file not found: ' . $specPath . '. Please run "docker compose exec appwrite specs --version=' . $version . '" first to generate the specs.'); @@ -431,6 +432,11 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND $cover = ''; $config = new DotNet(); break; + case 'unity': + $cover = ''; + $config = new Unity(); + $config->setPackageName('io.appwrite.unity'); + break; case 'android': $config = new Android(); break; @@ -477,7 +483,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND licenseName: 'BSD-3-Clause', licenseURL: 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE', ) - : new Swagger2($spec) + : new OpenAPI3($spec) ); $sdk diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 1213f78924..dfa33fad38 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -244,6 +244,7 @@ abstract class ScheduleBase extends Action } // Only process updated/new schedules, not all schedules + $scheduleIdsToDelete = []; foreach ($updatedSequences as $sequence) { $schedule = $this->schedules[$sequence] ?? null; if ($schedule === null) { @@ -279,6 +280,7 @@ abstract class ScheduleBase extends Action if ($resource->isEmpty()) { Console::error("Resource not found: projectId::{$schedule['projectId']} resourceId::{$schedule['resourceId']}"); + $scheduleIdsToDelete[] = $schedule['$id']; unset($this->schedules[$sequence]); continue; } @@ -286,6 +288,16 @@ abstract class ScheduleBase extends Action $this->schedules[$sequence]['resource'] = $resource; } + if (!empty($scheduleIdsToDelete)) { + Console::info('Deleting ' . count($scheduleIdsToDelete) . ' orphaned schedules'); + + go(function () use ($dbForPlatform, $scheduleIdsToDelete) { + $dbForPlatform->deleteDocuments('schedules', [ + Query::equal('$id', $scheduleIdsToDelete), + ]); + }); + } + $lastSyncUpdate = $time; $duration = microtime(true) - $loadStart; $this->collectSchedulesTelemetryDuration->record($duration, ['initial' => $initialLoad, 'resourceType' => static::getSupportedResource()]); diff --git a/src/Appwrite/Platform/Tasks/Specs.php b/src/Appwrite/Platform/Tasks/Specs.php index c8120bd017..bd2a03ecf0 100644 --- a/src/Appwrite/Platform/Tasks/Specs.php +++ b/src/Appwrite/Platform/Tasks/Specs.php @@ -6,7 +6,6 @@ use Appwrite\Network\Validator\Redirect; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Specification\Format\OpenAPI3; -use Appwrite\SDK\Specification\Format\Swagger2; use Appwrite\SDK\Specification\Specification; use Appwrite\Utopia\Request as AppwriteRequest; use Appwrite\Utopia\Response as AppwriteResponse; @@ -62,7 +61,6 @@ class Specs extends Action protected function getFormatInstance(string $format, array $arguments) { return match ($format) { - 'swagger2' => new Swagger2(...$arguments), 'open-api3' => new OpenAPI3(...$arguments), default => throw new Exception('Format not found: ' . $format) }; @@ -139,6 +137,16 @@ class Specs extends Action 'description' => 'Your project ID', 'in' => 'header', ], + 'ProjectPath' => [ + 'type' => 'apiKey', + 'name' => 'project', + 'description' => 'Your project ID', + 'in' => 'query', + 'x-appwrite' => [ + 'location' => 'path', + 'param' => 'project_id', + ], + ], 'JWT' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-JWT', @@ -195,6 +203,16 @@ class Specs extends Action 'description' => 'Your project ID', 'in' => 'header', ], + 'ProjectPath' => [ + 'type' => 'apiKey', + 'name' => 'project', + 'description' => 'Your project ID', + 'in' => 'query', + 'x-appwrite' => [ + 'location' => 'path', + 'param' => 'project_id', + ], + ], 'Key' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Key', @@ -263,6 +281,16 @@ class Specs extends Action 'description' => 'Your project ID', 'in' => 'header', ], + 'ProjectPath' => [ + 'type' => 'apiKey', + 'name' => 'project', + 'description' => 'Your project ID', + 'in' => 'query', + 'x-appwrite' => [ + 'location' => 'path', + 'param' => 'project_id', + ], + ], 'Key' => [ 'type' => 'apiKey', 'name' => 'X-Appwrite-Key', @@ -630,7 +658,7 @@ class Specs extends Action $platform ]; - foreach (['swagger2', 'open-api3'] as $format) { + foreach (['open-api3'] as $format) { $formatInstance = $this->getFormatInstance($format, $arguments); $specs = new Specification($formatInstance); diff --git a/src/Appwrite/Platform/Workers/Audits.php b/src/Appwrite/Platform/Workers/Audits.php index 09863b8626..e0f50756cb 100644 --- a/src/Appwrite/Platform/Workers/Audits.php +++ b/src/Appwrite/Platform/Workers/Audits.php @@ -10,8 +10,6 @@ use Utopia\Database\Document; use Utopia\Database\Exception\Structure; use Utopia\Platform\Action; use Utopia\Queue\Message; -use Utopia\Queue\Result\Commit; -use Utopia\Queue\Result\NoCommit; use Utopia\System\System; class Audits extends Action @@ -51,12 +49,11 @@ class Audits extends Action /** * @param Message $message * @param callable(Document): \Utopia\Audit\Audit $getAudit - * @return Commit|NoCommit * @throws Throwable * @throws \Utopia\Database\Exception * @throws Structure */ - public function action(Message $message, callable $getAudit): Commit|NoCommit + public function action(Message $message, callable $getAudit): void { $payload = $message->getPayload(); @@ -148,7 +145,7 @@ class Audits extends Action } if (!$shouldProcessBatch) { - return new NoCommit(); + return; } foreach ($this->logs as $sequence => $projectLogs) { @@ -168,6 +165,5 @@ class Audits extends Action } $this->lastTriggeredTime = time(); - return new Commit(); } } diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 0a066570d3..9eda3dbd52 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -221,6 +221,7 @@ class Deletes extends Action $this->deleteAuditLogs($project, $getAudit, $auditRetention); $this->deleteUsageStats($project, $getProjectDB, $getLogsDB, $hourlyUsageRetentionDatetime); $this->deleteExpiredSessions($project, $getProjectDB); + $this->deleteExpiredOAuth2Grants($project, $getProjectDB); $this->deleteExpiredTransactions($project, $getProjectDB); $this->deleteExpiredPresences($project, $getProjectDB, $publisherForUsage); $this->deleteOldDeployments($publisherForDeletes, $project, $getProjectDB); @@ -1147,6 +1148,27 @@ class Deletes extends Action ], $dbForProject); } + /** + * @param Document $project + * @param callable $getProjectDB + * @return void + * @throws Exception|Throwable + */ + private function deleteExpiredOAuth2Grants(Document $project, callable $getProjectDB): void + { + Console::info('Delete expired OAuth2 grants'); + + $dbForProject = $getProjectDB($project); + + $this->deleteByGroup('tokens', [ + Query::select([...$this->selects, 'expire']), + Query::equal('type', [TOKEN_TYPE_OAUTH2]), + Query::lessThan('expire', DateTime::format(new \DateTime())), + Query::orderAsc('expire'), + Query::orderAsc(), + ], $dbForProject); + } + /** * @param Database $dbForPlatform * @param Device $deviceForFiles diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 7af079e914..ddd7edf641 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -16,11 +16,13 @@ use Utopia\Database\Document; use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\DSN\DSN; +use Utopia\Lock\Semaphore; use Utopia\Logger\Log; use Utopia\Messaging\Adapter\Email as EmailAdapter; use Utopia\Messaging\Adapter\Email\Mailgun; use Utopia\Messaging\Adapter\Email\Resend; use Utopia\Messaging\Adapter\Email\Sendgrid; +use Utopia\Messaging\Adapter\Email\SES; use Utopia\Messaging\Adapter\Email\SMTP; use Utopia\Messaging\Adapter\Push\APNS; use Utopia\Messaging\Adapter\Push as PushAdapter; @@ -52,8 +54,6 @@ use function Swoole\Coroutine\batch; class Messaging extends Action { - private ?Local $localDevice = null; - private ?SMSAdapter $adapter = null; public static function getName(): string @@ -130,69 +130,19 @@ class Messaging extends Action Document $project, UsagePublisher $publisherForUsage ): void { + $status = $message->getAttribute('status'); + + // Idempotency guard: queue redelivery can hand us a message that already finished. + if (\in_array($status, [MessageStatus::SENT, MessageStatus::FAILED], true)) { + Span::add('message.skipped', 'already_processed'); + return; + } + $topicIds = $message->getAttribute('topics', []); $targetIds = $message->getAttribute('targets', []); $userIds = $message->getAttribute('users', []); $providerType = $message->getAttribute('providerType'); - /** - * @var array $allTargets - */ - $allTargets = []; - - if (\count($topicIds) > 0) { - $topics = $dbForProject->find('topics', [ - Query::equal('$id', $topicIds), - Query::limit(\count($topicIds)), - ]); - foreach ($topics as $topic) { - $targets = \array_filter($topic->getAttribute('targets'), function (Document $target) use ($providerType) { - return $target->getAttribute('providerType') === $providerType; - }); - - \array_push($allTargets, ...$targets); - } - } - - if (\count($userIds) > 0) { - $limit = 1000; - $offset = 0; - - do { - $targets = $dbForProject->find('targets', [ - Query::equal('userId', $userIds), - Query::select(['providerId', 'identifier']), - Query::equal('providerType', [$providerType]), - Query::limit($limit), - Query::offset($offset), - ]); - - \array_push($allTargets, ...$targets); - $offset += \count($targets); - } while (\count($targets) === $limit); - } - - if (\count($targetIds) > 0) { - $targets = $dbForProject->find('targets', [ - Query::select(['providerId', 'identifier']), - Query::equal('$id', $targetIds), - Query::equal('providerType', [$providerType]), - Query::limit(\count($targetIds)), - ]); - - \array_push($allTargets, ...$targets); - } - - if (empty($allTargets)) { - $dbForProject->updateDocument('messages', $message->getId(), $message->setAttributes([ - 'status' => MessageStatus::FAILED, - 'deliveryErrors' => ['No valid recipients found.'] - ])); - - Span::add('message.skipped', 'no_valid_recipients'); - return; - } - $default = $dbForProject->findOne('providers', [ Query::equal('enabled', [true]), Query::equal('type', [$providerType]), @@ -209,55 +159,33 @@ class Messaging extends Action } /** - * @var array> $identifiers - */ - $identifiers = []; - - /** - * @var array $providers + * Resolved providers cached for the lifetime of this job, keyed by provider id. + * Seeded with the default provider so most sends never touch the providers collection. + * + * @var array $providers */ $providers = [ - $default->getId() => $default + $default->getId() => $default, ]; - foreach ($allTargets as $target) { - $providerId = $target->getAttribute('providerId'); + $semaphore = new Semaphore(MESSAGE_SEND_CONCURRENCY); - if (!$providerId) { - $providerId = $default->getId(); - } + $deliveredTotal = 0; + $failedTotal = 0; + $deliveryErrors = []; + $hasRecipients = false; - if ($providerId) { - if (!\array_key_exists($providerId, $identifiers)) { - $identifiers[$providerId] = []; - } - // Use null as value to avoid duplicate keys - $identifiers[$providerId][$target->getAttribute('identifier')] = null; - } - } + foreach ($this->streamRecipients($dbForProject, $topicIds, $userIds, $targetIds, $providerType, $default) as $page) { + /** + * @var array $tasks + */ + $tasks = []; - /** - * @var array $results - */ - $results = batch(\array_map(function ($providerId) use ($identifiers, &$providers, $default, $message, $dbForProject, $deviceForFiles, $project, $publisherForUsage) { - return function () use ($providerId, $identifiers, &$providers, $default, $message, $dbForProject, $deviceForFiles, $project, $publisherForUsage) { - if (\array_key_exists($providerId, $providers)) { - $provider = $providers[$providerId]; - } else { - $provider = $dbForProject->getDocument('providers', $providerId); + foreach ($page as $providerId => $identifiers) { + $provider = $this->resolveProvider($dbForProject, $providerId, $providers, $default); + $resolvedProviderType = $provider->getAttribute('type'); - if ($provider->isEmpty() || !$provider->getAttribute('enabled')) { - $provider = $default; - } else { - $providers[$providerId] = $provider; - } - } - - $identifiersForProvider = $identifiers[$providerId]; - - $providerType = $provider->getAttribute('type'); - - $adapter = match ($providerType) { + $adapter = match ($resolvedProviderType) { MESSAGE_TYPE_SMS => $this->getSmsAdapter($provider), MESSAGE_TYPE_PUSH => $this->getPushAdapter($provider), MESSAGE_TYPE_EMAIL => $this->getEmailAdapter($provider), @@ -265,101 +193,74 @@ class Messaging extends Action }; $batches = \array_chunk( - \array_keys($identifiersForProvider), + \array_keys($identifiers), $adapter->getMaxMessagesPerRequest() ); - return batch(\array_map(function ($batch) use ($message, $provider, $providerType, $adapter, $dbForProject, $deviceForFiles, $project, $publisherForUsage) { - return function () use ($batch, $message, $provider, $providerType, $adapter, $dbForProject, $deviceForFiles, $project, $publisherForUsage) { - $deliveredTotal = 0; - $deliveryErrors = []; - $messageData = clone $message; - $messageData->setAttribute('to', $batch); + foreach ($batches as $batch) { + $tasks[] = fn (): array => $semaphore->withLock( + fn (): array => $this->sendBatch( + $batch, + $message, + $provider, + $resolvedProviderType, + $adapter, + $dbForProject, + $deviceForFiles, + $project, + $publisherForUsage + ) + ); + } + } - $data = match ($providerType) { - MESSAGE_TYPE_SMS => $this->buildSmsMessage($messageData, $provider), - MESSAGE_TYPE_PUSH => $this->buildPushMessage($messageData), - MESSAGE_TYPE_EMAIL => $this->buildEmailMessage($dbForProject, $messageData, $provider, $deviceForFiles, $project), - }; + // A page can resolve to zero identifiers (e.g. subscribers whose targetInternalId matches no targets + // row), so an empty task list must not count as recipients or run batch() for nothing. + if (empty($tasks)) { + continue; + } - try { - $response = $adapter->send($data); - $deliveredTotal += (int) $response['deliveredTo']; - foreach ($response['results'] as $result) { - if ($result['status'] === 'failure') { - $deliveryErrors[] = "Failed sending to target {$result['recipient']} with error: {$result['error']}"; - } + $hasRecipients = true; - // Deleting push targets when token has expired. - if (($result['error'] ?? '') === 'Expired device token') { - $target = $dbForProject->findOne('targets', [ - Query::equal('identifier', [$result['recipient']]) - ]); + /** + * @var array}> $results + */ + $results = batch($tasks); - if (!$target->isEmpty()) { - $dbForProject->updateDocument( - 'targets', - $target->getId(), - $target->setAttribute('expired', true) - ); - } - } - } - } catch (\Throwable $e) { - $deliveryErrors[] = 'Failed sending to targets with error: ' . $e->getMessage(); - } finally { - $errorTotal = \count($deliveryErrors); - $usage = new UsageContext(); - $usage - ->addMetric(METRIC_MESSAGES, ($deliveredTotal + $errorTotal)) - ->addMetric(METRIC_MESSAGES_SENT, $deliveredTotal) - ->addMetric(METRIC_MESSAGES_FAILED, $errorTotal) - ->addMetric(str_replace('{type}', $provider->getAttribute('type'), METRIC_MESSAGES_TYPE), ($deliveredTotal + $errorTotal)) - ->addMetric(str_replace('{type}', $provider->getAttribute('type'), METRIC_MESSAGES_TYPE_SENT), $deliveredTotal) - ->addMetric(str_replace('{type}', $provider->getAttribute('type'), METRIC_MESSAGES_TYPE_FAILED), $errorTotal) - ->addMetric(str_replace(['{type}', '{provider}'], [$provider->getAttribute('type'), $provider->getAttribute('provider')], METRIC_MESSAGES_TYPE_PROVIDER), ($deliveredTotal + $errorTotal)) - ->addMetric(str_replace(['{type}', '{provider}'], [$provider->getAttribute('type'), $provider->getAttribute('provider')], METRIC_MESSAGES_TYPE_PROVIDER_SENT), $deliveredTotal) - ->addMetric(str_replace(['{type}', '{provider}'], [$provider->getAttribute('type'), $provider->getAttribute('provider')], METRIC_MESSAGES_TYPE_PROVIDER_FAILED), $errorTotal); + foreach ($results as $result) { + $deliveredTotal += $result['delivered']; + $failedTotal += $result['recipients'] - $result['delivered']; - $publisherForUsage->enqueue(new Usage( - project: $project, - metrics: $usage->getMetrics(), - )); + foreach ($result['errors'] as $error) { + if (\count($deliveryErrors) >= MESSAGE_DELIVERY_ERRORS_LIMIT) { + break; + } - return [ - 'deliveredTotal' => $deliveredTotal, - 'deliveryErrors' => $deliveryErrors, - ]; - } - }; - }, $batches)); - }; - }, \array_keys($identifiers))); + $deliveryErrors[] = $error; + } + } + } - $results = \array_merge(...$results); + if (!$hasRecipients) { + $dbForProject->updateDocument('messages', $message->getId(), $message->setAttributes([ + 'status' => MessageStatus::FAILED, + 'deliveryErrors' => ['No valid recipients found.'] + ])); - $deliveredTotal = 0; - $deliveryErrors = []; - - foreach ($results as $result) { - $deliveredTotal += $result['deliveredTotal']; - $deliveryErrors = \array_merge($deliveryErrors, $result['deliveryErrors']); + Span::add('message.skipped', 'no_valid_recipients'); + return; } if (empty($deliveryErrors) && $deliveredTotal === 0) { $deliveryErrors[] = 'Unknown error'; } + $hasFailures = $failedTotal > 0 || \count($deliveryErrors) > 0; + $message->setAttribute('status', $hasFailures ? MessageStatus::FAILED : MessageStatus::SENT); $message->setAttribute('deliveryErrors', $deliveryErrors); - if (\count($message->getAttribute('deliveryErrors')) > 0) { - $message->setAttribute('status', MessageStatus::FAILED); - } else { - $message->setAttribute('status', MessageStatus::SENT); - } - Span::add('message.delivered_total', $deliveredTotal); - Span::add('message.errors_total', \count($deliveryErrors)); + Span::add('message.errors_total', $failedTotal); $message->removeAttribute('to'); @@ -410,6 +311,461 @@ class Messaging extends Action } } + /** + * Stream a message's recipients in bounded pages, grouped by provider and deduplicated by identifier within each page. + * + * Peak memory is O(MESSAGE_RECIPIENTS_PAGE_SIZE), never O(topic size): topics are walked through the + * subscribers collection with cursor pagination rather than reading the topic's `targets` attribute, which + * triggers the subQueryTopicTargets filter and loads up to APP_LIMIT_SUBSCRIBERS_SUBQUERY rows at once. + * + * @param array $topicIds + * @param array $userIds + * @param array $targetIds + * @return \Generator>> + * @throws \Exception + */ + private function streamRecipients( + Database $dbForProject, + array $topicIds, + array $userIds, + array $targetIds, + string $providerType, + Document $default + ): \Generator { + if (\count($topicIds) > 0) { + $topics = $dbForProject->find('topics', [ + Query::select(['$sequence']), + Query::equal('$id', $topicIds), + Query::limit(\count($topicIds)), + ]); + + foreach ($topics as $topic) { + $cursor = null; + + do { + $queries = [ + Query::equal('topicInternalId', [$topic->getSequence()]), + Query::equal('providerType', [$providerType]), + Query::select(['$sequence', 'targetInternalId']), + Query::orderAsc('$sequence'), + Query::limit(MESSAGE_RECIPIENTS_PAGE_SIZE), + ]; + + if ($cursor !== null) { + $queries[] = Query::cursorAfter($cursor); + } + + $subscribers = $dbForProject->getAuthorization()->skip( + fn () => $dbForProject->find('subscribers', $queries) + ); + + $count = \count($subscribers); + + if ($count === 0) { + break; + } + + $cursor = $subscribers[$count - 1]; + + $targetInternalIds = \array_map( + fn (Document $subscriber) => $subscriber->getAttribute('targetInternalId'), + $subscribers + ); + + $targets = $dbForProject->skipValidation( + fn () => $dbForProject->getAuthorization()->skip( + fn () => $dbForProject->find('targets', [ + Query::equal('$sequence', $targetInternalIds), + Query::select(['providerId', 'identifier']), + Query::limit(\count($targetInternalIds)), + ]) + ) + ); + + yield $this->groupTargetsByProvider($targets, $default); + } while ($count === MESSAGE_RECIPIENTS_PAGE_SIZE); + } + } + + if (\count($userIds) > 0) { + $cursor = null; + + do { + $queries = [ + Query::equal('userId', $userIds), + Query::equal('providerType', [$providerType]), + Query::select(['$sequence', 'providerId', 'identifier']), + Query::orderAsc('$sequence'), + Query::limit(MESSAGE_RECIPIENTS_PAGE_SIZE), + ]; + + if ($cursor !== null) { + $queries[] = Query::cursorAfter($cursor); + } + + $targets = $dbForProject->find('targets', $queries); + $count = \count($targets); + + if ($count === 0) { + break; + } + + $cursor = $targets[$count - 1]; + + yield $this->groupTargetsByProvider($targets, $default); + } while ($count === MESSAGE_RECIPIENTS_PAGE_SIZE); + } + + if (\count($targetIds) > 0) { + $cursor = null; + + do { + $queries = [ + Query::equal('$id', $targetIds), + Query::equal('providerType', [$providerType]), + Query::select(['$sequence', 'providerId', 'identifier']), + Query::orderAsc('$sequence'), + Query::limit(MESSAGE_RECIPIENTS_PAGE_SIZE), + ]; + + if ($cursor !== null) { + $queries[] = Query::cursorAfter($cursor); + } + + $targets = $dbForProject->find('targets', $queries); + $count = \count($targets); + + if ($count === 0) { + break; + } + + $cursor = $targets[$count - 1]; + + yield $this->groupTargetsByProvider($targets, $default); + } while ($count === MESSAGE_RECIPIENTS_PAGE_SIZE); + } + } + + /** + * Group a page of target documents by provider id, deduplicating identifiers within the page. + * + * @param array $targets + * @return array> + */ + private function groupTargetsByProvider(array $targets, Document $default): array + { + /** + * @var array> $identifiers + */ + $identifiers = []; + + foreach ($targets as $target) { + $providerId = $target->getAttribute('providerId') ?: $default->getId(); + + if (!\array_key_exists($providerId, $identifiers)) { + $identifiers[$providerId] = []; + } + + // Null values keep identifiers unique without a second lookup structure. + $identifiers[$providerId][$target->getAttribute('identifier')] = null; + } + + return $identifiers; + } + + /** + * Resolve and cache a provider for the lifetime of a send job, falling back to the default provider. + * + * @param array $providers + */ + private function resolveProvider( + Database $dbForProject, + string $providerId, + array &$providers, + Document $default + ): Document { + if (\array_key_exists($providerId, $providers)) { + return $providers[$providerId]; + } + + $provider = $dbForProject->getDocument('providers', $providerId); + + if ($provider->isEmpty() || !$provider->getAttribute('enabled')) { + // Cache the fallback under this id too, so a topic full of targets pointing at the same + // disabled/missing provider does not re-query the providers collection once per page. + $providers[$providerId] = $default; + + return $default; + } + + $providers[$providerId] = $provider; + + return $provider; + } + + /** + * Send a single adapter-sized batch and report delivery counts plus a bounded error list. + * + * Wraps the provider call in a backoff/retry loop that reacts to provider rate limiting and transient + * failures (see {@see retrySend()}). Accounting stays exact: only still-failing recipients are ever + * retried, so `delivered` is summed across attempts without double-counting, and `recipients` always + * reports the original batch size so the caller's `failed = recipients - delivered` holds. + * + * @param array $batch + * @return array{delivered: int, recipients: int, errors: array} + */ + private function sendBatch( + array $batch, + Document $message, + Document $provider, + string $providerType, + EmailAdapter|SMSAdapter|PushAdapter $adapter, + Database $dbForProject, + Device $deviceForFiles, + Document $project, + UsagePublisher $publisherForUsage + ): array { + $recipients = \count($batch); + + [ + 'delivered' => $delivered, + 'errors' => $errors, + ] = $this->retrySend($batch, $message, $provider, $providerType, $adapter, $dbForProject, $deviceForFiles, $project); + + $failed = $recipients - $delivered; + $usage = new UsageContext(); + $usage + ->addMetric(METRIC_MESSAGES, $recipients) + ->addMetric(METRIC_MESSAGES_SENT, $delivered) + ->addMetric(METRIC_MESSAGES_FAILED, $failed) + ->addMetric(str_replace('{type}', $provider->getAttribute('type'), METRIC_MESSAGES_TYPE), $recipients) + ->addMetric(str_replace('{type}', $provider->getAttribute('type'), METRIC_MESSAGES_TYPE_SENT), $delivered) + ->addMetric(str_replace('{type}', $provider->getAttribute('type'), METRIC_MESSAGES_TYPE_FAILED), $failed) + ->addMetric(str_replace(['{type}', '{provider}'], [$provider->getAttribute('type'), $provider->getAttribute('provider')], METRIC_MESSAGES_TYPE_PROVIDER), $recipients) + ->addMetric(str_replace(['{type}', '{provider}'], [$provider->getAttribute('type'), $provider->getAttribute('provider')], METRIC_MESSAGES_TYPE_PROVIDER_SENT), $delivered) + ->addMetric(str_replace(['{type}', '{provider}'], [$provider->getAttribute('type'), $provider->getAttribute('provider')], METRIC_MESSAGES_TYPE_PROVIDER_FAILED), $failed); + + $publisherForUsage->enqueue(new Usage( + project: $project, + metrics: $usage->getMetrics(), + )); + + return [ + 'delivered' => $delivered, + 'recipients' => $recipients, + 'errors' => $errors, + ]; + } + + /** + * Drive a batch through provider sends with exponential backoff, reacting to throttling and transient + * errors by retrying only the recipients that are still failing. + * + * Partitioning per attempt: the provider's per-recipient results are split into delivered (summed into + * the running total, never retried) and failures. A failure whose error matches {@see isRetryableError()} + * stays pending for the next attempt; any other failure becomes a terminal error immediately. When + * `send()` throws, the throw is retryable only if its message matches; otherwise every still-pending + * recipient is recorded as terminal. The next attempt rebuilds the provider message with only the pending + * recipients in `to`, so an already-delivered recipient is never re-sent. After {@see MESSAGE_SEND_MAX_RETRIES} + * attempts, any recipients still pending are flushed to terminal errors. + * + * Note: provider `Retry-After` hints are not honored — the agnostic adapter {@see \Utopia\Messaging\Response} + * exposes only generic per-recipient strings, never a structured retry delay, so we keep the library + * adapter-agnostic and rely on exponential backoff alone. + * + * @param array $batch + * @return array{delivered: int, errors: array} + */ + private function retrySend( + array $batch, + Document $message, + Document $provider, + string $providerType, + EmailAdapter|SMSAdapter|PushAdapter $adapter, + Database $dbForProject, + Device $deviceForFiles, + Document $project + ): array { + $delivered = 0; + $errors = []; + + // Recipients still awaiting a successful (or terminal) outcome; shrinks to only the failing ones each attempt. + $pending = $batch; + + for ($attempt = 1; $attempt <= MESSAGE_SEND_MAX_RETRIES; $attempt++) { + $hasRetriesLeft = $attempt < MESSAGE_SEND_MAX_RETRIES; + + // Rebuild the provider message scoped to only the still-pending recipients so a partially-delivered + // batch never re-sends to recipients that already succeeded on an earlier attempt. + $data = $this->buildMessage($pending, $message, $provider, $providerType, $dbForProject, $deviceForFiles, $project); + + $retry = []; + + // The try/catch wraps ONLY the provider send. A whole-batch throw is retryable when transient, + // otherwise it records one representative terminal error. The previous behaviour of resetting + // $delivered to 0 on a throw is gone — the retry refactor sums delivered across attempts, and the + // expired-device-token cleanup below is isolated in its own try so a DB hiccup there can never be + // misattributed as a send failure. + try { + $response = $adapter->send($data); + } catch (\Throwable $e) { + if ($hasRetriesLeft && $this->isRetryableError($e->getMessage())) { + $retry = $pending; + } else { + $this->recordError($errors, 'Failed sending to targets with error: ' . $e->getMessage()); + } + + $response = null; + } + + if ($response !== null) { + $delivered += (int) $response['deliveredTo']; + + foreach ($response['results'] as $result) { + if ($result['status'] !== 'failure') { + continue; + } + + $error = $result['error'] ?? null; + $recipient = $result['recipient']; + + // Best-effort: deleting push targets when the token has expired. Isolated so a transient DB + // error here never affects delivery accounting or the retry decision below. + if ($error === 'Expired device token') { + try { + $target = $dbForProject->findOne('targets', [ + Query::equal('identifier', [$recipient]) + ]); + + if (!$target->isEmpty()) { + $dbForProject->updateDocument( + 'targets', + $target->getId(), + $target->setAttribute('expired', true) + ); + } + } catch (\Throwable) { + // Best-effort; must not affect accounting or retries. + } + } + + if ($hasRetriesLeft && $this->isRetryableError($error)) { + $retry[] = $recipient; + continue; + } + + $this->recordError($errors, "Failed sending to target {$recipient} with error: {$error}"); + } + } + + $pending = $retry; + + if (empty($pending)) { + break; + } + + // Exponential backoff with jitter; non-blocking under Swoole so sibling sends keep progressing. + // Skip a non-positive delay: Swoole\Coroutine::sleep() rejects 0/negative values (which tests + // produce by overriding the base delay to 0 for speed), and it would otherwise emit a warning. + $delay = $this->retryDelay() * (2 ** ($attempt - 1)); + $delay += $delay * (\random_int(0, 100) / 1000); + if ($delay > 0) { + \Swoole\Coroutine::sleep($delay); + } + } + + return [ + 'delivered' => $delivered, + 'errors' => $errors, + ]; + } + + /** + * Append a delivery error while keeping the retained list bounded by {@see MESSAGE_DELIVERY_ERRORS_LIMIT}. + * + * @param array $errors + */ + private function recordError(array &$errors, string $error): void + { + if (\count($errors) >= MESSAGE_DELIVERY_ERRORS_LIMIT) { + return; + } + + $errors[] = $error; + } + + /** + * Conservatively classify a provider error string as retryable. The agnostic adapter + * {@see \Utopia\Messaging\Response} returns only free-form error strings, so string matching is the only + * provider-agnostic signal available. The pattern list is intentionally narrow — throttling, rate limits, + * quota, service-unavailable and timeout phrasing — so permanent failures (e.g. invalid recipients) are + * never retried. + */ + private function isRetryableError(?string $error): bool + { + if ($error === null || $error === '') { + return false; + } + + $patterns = [ + 'throttl', + 'rate exceeded', + 'rate limit', + 'too many requests', + '429', + 'quota', + 'service unavailable', + '503', + 'timed out', + 'timeout', + 'temporarily', + ]; + + $needle = \strtolower($error); + + foreach ($patterns as $pattern) { + if (\str_contains($needle, $pattern)) { + return true; + } + } + + return false; + } + + /** + * Base seconds for exponential backoff between send retries. Isolated so tests can override it to keep the + * suite instant without touching the production constant. + */ + protected function retryDelay(): float + { + return MESSAGE_SEND_RETRY_DELAY; + } + + /** + * Build the provider-specific message for a set of recipients. + * + * @param array $to + */ + private function buildMessage( + array $to, + Document $message, + Document $provider, + string $providerType, + Database $dbForProject, + Device $deviceForFiles, + Document $project + ): Email|SMS|Push { + $messageData = clone $message; + $messageData->setAttribute('to', $to); + + return match ($providerType) { + MESSAGE_TYPE_SMS => $this->buildSmsMessage($messageData, $provider), + MESSAGE_TYPE_PUSH => $this->buildPushMessage($messageData), + MESSAGE_TYPE_EMAIL => $this->buildEmailMessage($dbForProject, $messageData, $provider, $deviceForFiles, $project), + default => throw new \Exception('Provider with the requested ID is of the incorrect type') + }; + } + private function sendInternalSMSMessage(Document $message, Document $project, array $recipients, Log $log): void { if ($this->adapter === null) { @@ -451,7 +807,7 @@ class Messaging extends Action } - private function getSmsAdapter(Document $provider): ?SMSAdapter + protected function getSmsAdapter(Document $provider): ?SMSAdapter { $credentials = $provider->getAttribute('credentials'); @@ -494,7 +850,7 @@ class Messaging extends Action }; } - private function getPushAdapter(Document $provider): ?PushAdapter + protected function getPushAdapter(Document $provider): ?PushAdapter { $credentials = $provider->getAttribute('credentials'); $options = $provider->getAttribute('options'); @@ -513,7 +869,7 @@ class Messaging extends Action }; } - private function getEmailAdapter(Document $provider): ?EmailAdapter + protected function getEmailAdapter(Document $provider): ?EmailAdapter { $credentials = $provider->getAttribute('credentials', []); $options = $provider->getAttribute('options', []); @@ -537,6 +893,12 @@ class Messaging extends Action ), 'sendgrid' => new Sendgrid($apiKey), 'resend' => new Resend($apiKey), + 'ses' => new SES( + $credentials['accessKey'] ?? '', + $credentials['secretKey'] ?? '', + $credentials['region'] ?? '', + $credentials['sessionToken'] ?? null, + ), default => null }; } @@ -709,11 +1071,9 @@ class Messaging extends Action private function getLocalDevice($project): Local { - if ($this->localDevice === null) { - $this->localDevice = new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId()); - } - - return $this->localDevice; + // Not cached: the path is project-scoped and the worker handles + // messages from many projects (and coroutines run them concurrently). + return new Local(APP_STORAGE_UPLOADS . '/app-' . $project->getId()); } private function createInternalSMSAdapter(): ?SMSAdapter diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 6b0a33dfd7..a6f65fc742 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -425,6 +425,8 @@ class Migrations extends Action 'targets.write', 'webhooks.read', 'webhooks.write', + 'rules.read', + 'rules.write', 'project.read', 'project.write', 'keys.read', diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index 48f12d3ee9..d91425d59b 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -20,7 +20,6 @@ use Utopia\System\System; class Webhooks extends Action { - private array $errors = []; private const MAX_FILE_SIZE = 5242880; // 5 MB public static function getName(): string @@ -58,11 +57,8 @@ class Webhooks extends Action */ public function action(Message $message, Document $project, Database $dbForPlatform, MailPublisher $publisherForMails, UsagePublisher $publisherForUsage, Log $log, array $plan): void { - $this->errors = []; $payload = $message->getPayload(); - - if (empty($payload)) { throw new Exception('Missing payload'); } @@ -73,14 +69,18 @@ class Webhooks extends Action $log->addTag('projectId', $project->getId()); + $errors = []; foreach ($project->getAttribute('webhooks', []) as $webhook) { if (array_intersect($webhook->getAttribute('events', []), $events)) { - $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $publisherForMails, $publisherForUsage, $plan); + $error = $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $publisherForMails, $publisherForUsage, $plan); + if ($error !== null) { + $errors[] = $error; + } } } - if (!empty($this->errors)) { - throw new Exception(\implode(" / \n\n", $this->errors)); + if (!empty($errors)) { + throw new Exception(\implode(" / \n\n", $errors)); } } @@ -93,12 +93,12 @@ class Webhooks extends Action * @param Database $dbForPlatform * @param MailPublisher $publisherForMails * @param array $plan - * @return void + * @return string|null The error log if the delivery failed, otherwise null */ - private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, MailPublisher $publisherForMails, UsagePublisher $publisherForUsage, array $plan): void + private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, MailPublisher $publisherForMails, UsagePublisher $publisherForUsage, array $plan): ?string { if ($webhook->getAttribute('enabled') !== true) { - return; + return null; } $url = \rawurldecode($webhook->getAttribute('url')); @@ -107,8 +107,7 @@ class Webhooks extends Action $host = \parse_url($url, PHP_URL_HOST) ?? ''; $hostnameValidator = new PublicHostname(); if (!$hostnameValidator->isValid($host)) { - $this->errors[] = 'Webhook target ' . $host . ' rejected: ' . $hostnameValidator->getDescription(); - return; + return 'Webhook target ' . $host . ' rejected: ' . $hostnameValidator->getDescription(); } } @@ -159,6 +158,8 @@ class Webhooks extends Action $curlError = \curl_error($ch); $statusCode = \curl_getinfo($ch, CURLINFO_RESPONSE_CODE); + $error = null; + if (!empty($curlError) || $statusCode >= 400) { $dbForPlatform->increaseDocumentAttribute('webhooks', $webhook->getId(), 'attempts', 1); $webhook = $dbForPlatform->getDocument('webhooks', $webhook->getId()); @@ -189,7 +190,7 @@ class Webhooks extends Action $dbForPlatform->updateDocument('webhooks', $webhook->getId(), new Document($updatePayload)); $dbForPlatform->purgeCachedDocument('projects', $project->getId()); - $this->errors[] = $logs; + $error = $logs; $usage = (new UsageContext()) ->addMetric(METRIC_WEBHOOKS_FAILED, 1) ->addMetric(str_replace('{webhookInternalId}', $webhook->getSequence(), METRIC_WEBHOOK_ID_FAILED), 1); @@ -207,6 +208,8 @@ class Webhooks extends Action project: $project, metrics: $usage->getMetrics(), )); + + return $error; } /** diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index c74406b2a6..f1b327513f 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -32,6 +32,7 @@ class Method * @param array $additionalParameters * @param string $desc * @param bool $public Whether this method should be rendered on the website/documentation + * @param array $locationAuth Security scheme keys injected for location-type methods (includes project auth) */ public function __construct( protected string $namespace, @@ -49,7 +50,8 @@ class Method protected array $parameters = [], protected array $additionalParameters = [], protected string $desc = '', - protected bool $public = true + protected bool $public = true, + protected array $locationAuth = [] ) { $this->validateMethod($name, $namespace); $this->validateAuthTypes($auth); @@ -223,6 +225,11 @@ class Method return $this->additionalParameters; } + public function getLocationAuth(): array + { + return $this->locationAuth; + } + public function setNamespace(string $namespace): self { $this->namespace = $namespace; diff --git a/src/Appwrite/SDK/Specification/Format.php b/src/Appwrite/SDK/Specification/Format.php index 29ad2d84b8..bedd8e4c1e 100644 --- a/src/Appwrite/SDK/Specification/Format.php +++ b/src/Appwrite/SDK/Specification/Format.php @@ -101,6 +101,60 @@ abstract class Format return $this->params[$key] ?? $default; } + /** + * @return array + */ + protected function getArrayItemsSchema(mixed $example): array + { + if (\is_string($example)) { + $decoded = \json_decode($example, true); + if (\is_array($decoded)) { + $example = $decoded; + } + } + + if (!\is_array($example) || empty($example)) { + return ['type' => 'object']; + } + + foreach ($example as $item) { + if ($item === null) { + continue; + } + + if (\is_array($item)) { + if (!\array_is_list($item)) { + return [ + 'type' => 'object', + 'additionalProperties' => true, + ]; + } + + return [ + 'type' => 'array', + 'items' => $this->getArrayItemsSchema($item), + ]; + } + + if (\is_int($item) || \is_float($item)) { + return [ + 'type' => 'number', + 'format' => 'double', + ]; + } + + return [ + 'type' => match (\gettype($item)) { + 'boolean' => 'boolean', + 'string' => 'string', + default => 'object', + }, + ]; + } + + return ['type' => 'object']; + } + /** * Set Services. * diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 8d07938bc8..38f81bca69 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -81,24 +81,20 @@ class OpenAPI3 extends Format ], ]; - if (isset($output['components']['securitySchemes']['Project'])) { - $output['components']['securitySchemes']['Project']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['Key'])) { - $output['components']['securitySchemes']['Key']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['JWT'])) { - $output['components']['securitySchemes']['JWT']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['components']['securitySchemes']['Locale'])) { - $output['components']['securitySchemes']['Locale']['x-appwrite'] = ['demo' => 'en']; - } - - if (isset($output['components']['securitySchemes']['Mode'])) { - $output['components']['securitySchemes']['Mode']['x-appwrite'] = ['demo' => '']; + foreach ([ + 'Project' => '', + 'ProjectPath' => '', + 'Key' => '', + 'JWT' => '', + 'Locale' => 'en', + 'Mode' => '', + ] as $key => $demo) { + if (isset($output['components']['securitySchemes'][$key])) { + $output['components']['securitySchemes'][$key]['x-appwrite'] = \array_merge( + $output['components']['securitySchemes'][$key]['x-appwrite'] ?? [], + ['demo' => $demo] + ); + } } $usedModels = []; @@ -133,6 +129,7 @@ class OpenAPI3 extends Format $specs = new Specs(); $sdkPlatforms = $specs->getSDKPlatformsForRouteSecurity($routeSecurity); + $sdkPlatforms = array_values(array_unique($sdkPlatforms)); $namespace = $sdk->getNamespace(); $descContents = $this->getDescriptionContents($desc); @@ -184,7 +181,7 @@ class OpenAPI3 extends Format continue; } - $methodSecurities = ['Project' => []]; + $methodSecurities = [($methodObj->getLocationAuth()[0] ?? 'Project') => []]; foreach ($methodObj->getAuth() as $security) { if (\array_key_exists($security->value, $this->keys)) { $methodSecurities[$security->value] = []; @@ -327,6 +324,17 @@ class OpenAPI3 extends Format 'image/bmp', ]) ? 'Image' : 'File', ]; + + if ($produces !== '') { + $temp['responses'][(string)$response->getCode()]['content'] = [ + $produces => [ + 'schema' => [ + 'type' => 'string', + 'format' => 'binary', + ], + ], + ]; + } } else { if (\is_array($model)) { $modelDescription = \join(', or ', \array_map(fn ($m) => $m->getName(), $model)); @@ -363,14 +371,31 @@ class OpenAPI3 extends Format } } - if ($response->getCode() === 204) { + if (in_array($response->getCode(), [204, 301, 302, 308], true)) { $temp['responses'][(string)$response->getCode()]['description'] = 'No content'; + } + + if ($response->getCode() === 204) { unset($temp['responses'][(string)$response->getCode()]['content']); } } + // No response declares content (e.g. 204 No content): keep the produced + // content type available for SDK generation. + $hasResponseContent = false; + foreach ($temp['responses'] as $responseData) { + if (isset($responseData['content'])) { + $hasResponseContent = true; + break; + } + } + + if (!$hasResponseContent && $produces !== '') { + $temp['x-appwrite']['produces'] = [$produces]; + } + if (!empty($scope)) { - $securities = ['Project' => []]; + $securities = [($sdk->getLocationAuth()[0] ?? 'Project') => []]; foreach ($sdk->getAuth() as $security) { /** @var AuthType $security */ @@ -380,6 +405,16 @@ class OpenAPI3 extends Format } $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); + + if ($sdk->getType() === MethodType::LOCATION) { + foreach ($sdk->getLocationAuth() as $key) { + if (\array_key_exists($key, $this->keys)) { + $securities[$key] = []; + $temp['x-appwrite']['auth'][$key] = []; + } + } + } + $temp['security'][] = $securities; } @@ -396,7 +431,12 @@ class OpenAPI3 extends Format $bodyRequired = []; - foreach ($route->getParams() as $name => $param) { // Set params + $parameters = \array_merge( + $route->getParams(), + $sdk->getAdditionalParameters(), + ); + + foreach ($parameters as $name => $param) { // Set params if (($param['deprecated'] ?? false) === true) { continue; } @@ -478,6 +518,9 @@ class OpenAPI3 extends Format $node['schema']['x-upload-id'] = true; } $node['schema']['type'] = $validator->getType(); + $node['schema']['x-appwrite'] = [ + 'idGenerator' => 'ID.unique', + ]; $node['schema']['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; break; case \Utopia\Database\Validator\Datetime::class: @@ -488,11 +531,36 @@ class OpenAPI3 extends Format case \Utopia\Database\Validator\Spatial::class: /** @var Spatial $validator */ $node['schema']['type'] = 'array'; - $node['schema']['items'] = [ - 'oneOf' => [ - ['type' => 'array'] - ] - ]; + $node['schema']['items'] = match ($validator->getSpatialType()) { + Database::VAR_POINT => [ + 'type' => 'number', + 'format' => 'double', + ], + Database::VAR_LINESTRING => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + Database::VAR_POLYGON => [ + 'type' => 'array', + 'items' => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + ], + default => [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + }; $node['schema']['x-example'] = ($param['example'] ?? '') ?: match ($validator->getSpatialType()) { Database::VAR_POINT => '[1, 2]', Database::VAR_LINESTRING => '[[1, 2], [3, 4], [5, 6]]', @@ -514,8 +582,8 @@ class OpenAPI3 extends Format break; case \Utopia\Validator\JSON::class: case \Utopia\Validator\Assoc::class: - $param['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; $node['schema']['type'] = 'object'; + $node['schema']['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; $node['schema']['x-example'] = ($param['example'] ?? '') ?: '{}'; break; case \Utopia\Storage\Validator\File::class: @@ -583,6 +651,7 @@ class OpenAPI3 extends Format $node['schema']['x-example'] = ($param['example'] ?? '') ?: '["' . Role::any()->toString() . '"]'; break; case \Appwrite\Auth\Validator\Password::class: + case \Appwrite\SDK\Specification\Validator\PasswordFormat::class: $node['schema']['type'] = $validator->getType(); $node['schema']['format'] = 'password'; $node['schema']['x-example'] = ($param['example'] ?? '') ?: 'password'; @@ -644,19 +713,15 @@ class OpenAPI3 extends Format } $enumKeys = []; - if (!empty($enum->map)) { - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } + foreach ($enumValues as $enumValue) { + $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; } $node['schema']['items']['enum'] = $enumValues; if (!empty($enum->name)) { $node['schema']['items']['x-enum-name'] = $enum->name; } - if (!empty($enumKeys)) { - $node['schema']['items']['x-enum-keys'] = $enumKeys; - } + $node['schema']['items']['x-enum-keys'] = $enumKeys; } } if ($validator->getType() === 'integer') { @@ -685,19 +750,15 @@ class OpenAPI3 extends Format } $enumKeys = []; - if (!empty($enum->map)) { - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } + foreach ($enumValues as $enumValue) { + $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; } $node['schema']['enum'] = $enumValues; if (!empty($enum->name)) { $node['schema']['x-enum-name'] = $enum->name; } - if (!empty($enumKeys)) { - $node['schema']['x-enum-keys'] = $enumKeys; - } + $node['schema']['x-enum-keys'] = $enumKeys; } } if ($validator->getType() === 'integer') { @@ -767,7 +828,7 @@ class OpenAPI3 extends Format if ($isPathParam) { // Param is in URL path (directly or through alias) $node['in'] = 'path'; $temp['parameters'][] = $node; - } elseif ($route->getMethod() == 'GET') { // Param is in query + } elseif (\in_array($route->getMethod(), ['GET', 'DELETE'], true)) { // Param is in query $node['in'] = 'query'; $temp['parameters'][] = $node; } else { // Param is in payload @@ -794,15 +855,17 @@ class OpenAPI3 extends Format /// If the enum flag is Set, add the enum values to the body $body['content'][$consumes[0]]['schema']['properties'][$name]['enum'] = $node['schema']['enum']; $body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-name'] = $node['schema']['x-enum-name'] ?? null; - if (isset($node['schema']['x-enum-keys'])) { - $body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-keys'] = $node['schema']['x-enum-keys']; - } + $body['content'][$consumes[0]]['schema']['properties'][$name]['x-enum-keys'] = $node['schema']['x-enum-keys']; } if ($node['schema']['x-upload-id'] ?? false) { $body['content'][$consumes[0]]['schema']['properties'][$name]['x-upload-id'] = $node['schema']['x-upload-id']; } + if (isset($node['schema']['x-appwrite'])) { + $body['content'][$consumes[0]]['schema']['properties'][$name]['x-appwrite'] = $node['schema']['x-appwrite']; + } + if (\array_key_exists('items', $node['schema'])) { $body['content'][$consumes[0]]['schema']['properties'][$name]['items'] = $node['schema']['items']; } @@ -838,7 +901,7 @@ class OpenAPI3 extends Format } foreach ($this->models as $model) { - if (!in_array($model->getType(), $usedModels) && $model->getType() !== 'error') { + if (!in_array($model->getType(), $usedModels)) { continue; } @@ -869,7 +932,7 @@ class OpenAPI3 extends Format } $type = ''; - $format = null; + $format = $rule['format'] ?? null; $items = null; $examples[$name] = $rule['example'] ?? null; @@ -891,11 +954,11 @@ class OpenAPI3 extends Format case 'json': $type = 'object'; - $output['components']['schemas'][$model->getType()]['properties'][$name]['additionalProperties'] = true; break; case 'array': $type = 'array'; + $items = $this->getArrayItemsSchema($rule['example'] ?? []); break; case 'integer': @@ -956,6 +1019,20 @@ class OpenAPI3 extends Format } $readOnly = $rule['readOnly'] ?? false; + if ($rule['type'] == 'json') { + $output['components']['schemas'][$model->getType()]['properties'][$name] = [ + 'type' => $type, + 'additionalProperties' => true, + 'description' => $rule['description'] ?? '', + 'x-example' => $rule['example'] ?? null, + ]; + + if ($readOnly) { + $output['components']['schemas'][$model->getType()]['properties'][$name]['readOnly'] = true; + } + continue; + } + if ($rule['array']) { $output['components']['schemas'][$model->getType()]['properties'][$name] = [ 'type' => 'array', @@ -987,7 +1064,19 @@ class OpenAPI3 extends Format } } if ($items) { - $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items; + if ($rule['array'] || $rule['type'] === 'array') { + $output['components']['schemas'][$model->getType()]['properties'][$name]['items'] = $items; + } else { + if (isset($items['$ref']) || isset($items['oneOf'])) { + $items = ['allOf' => [$items]]; + } + /** @var array $property */ + $property = $output['components']['schemas'][$model->getType()]['properties'][$name]; + $output['components']['schemas'][$model->getType()]['properties'][$name] = [ + ...$property, + ...$items, + ]; + } } if ($rule['type'] === 'enum' && !empty($rule['enum'])) { if ($rule['array']) { diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php deleted file mode 100644 index 9265e1ec60..0000000000 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ /dev/null @@ -1,999 +0,0 @@ - '2.0', - 'info' => [ - 'version' => $this->getParam('version'), - 'title' => $this->getParam('name'), - 'description' => $this->getParam('description'), - 'termsOfService' => $this->getParam('terms'), - 'contact' => [ - 'name' => $this->getParam('contact.name'), - 'url' => $this->getParam('contact.url'), - 'email' => $this->getParam('contact.email'), - ], - 'license' => [ - 'name' => 'BSD-3-Clause', - 'url' => 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE', - ], - ], - 'host' => \parse_url($this->getParam('endpoint', ''), PHP_URL_HOST), - 'x-host-docs' => \parse_url($this->getParam('endpoint.docs', ''), PHP_URL_HOST), - 'basePath' => \parse_url($this->getParam('endpoint', ''), PHP_URL_PATH), - 'schemes' => [\parse_url($this->getParam('endpoint', ''), PHP_URL_SCHEME)], - 'consumes' => ['application/json', 'multipart/form-data'], - 'produces' => ['application/json'], - 'securityDefinitions' => $this->keys, - 'paths' => [], - 'tags' => $this->services, - 'definitions' => [], - 'externalDocs' => [ - 'description' => $this->getParam('docs.description'), - 'url' => $this->getParam('docs.url'), - ], - ]; - - if (isset($output['securityDefinitions']['Project'])) { - $output['securityDefinitions']['Project']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['Key'])) { - $output['securityDefinitions']['Key']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['JWT'])) { - $output['securityDefinitions']['JWT']['x-appwrite'] = ['demo' => '']; - } - - if (isset($output['securityDefinitions']['Locale'])) { - $output['securityDefinitions']['Locale']['x-appwrite'] = ['demo' => 'en']; - } - - if (isset($output['securityDefinitions']['Mode'])) { - $output['securityDefinitions']['Mode']['x-appwrite'] = ['demo' => '']; - } - - $usedModels = []; - - foreach ($this->routes as $route) { - /** @var Route $route */ - $url = \str_replace('/v1', '', $route->getPath()); - - $scope = $route->getLabel('scope', ''); - - $sdk = $route->getLabel('sdk', false); - - if ($sdk === false) { - continue; - } - - $additionalMethods = null; - if (\is_array($sdk)) { - $additionalMethods = $sdk; - $sdkValues = \array_values($sdk); - /** @var Method $sdk */ - $sdk = $sdkValues[0]; - } - - $consumes = []; - if (strtoupper($route->getMethod()) !== 'GET' && strtoupper($route->getMethod()) !== 'HEAD') { - $consumes = [$sdk->getRequestType()->value]; - } - - $methodName = $sdk->getMethodName(); - - $desc = $sdk->getDescriptionFilePath() ?: $sdk->getDescription(); - $produces = ($sdk->getContentType())->value; - $routeSecurity = $sdk->getAuth(); - - $specs = new Specs(); - $sdkPlatforms = $specs->getSDKPlatformsForRouteSecurity($routeSecurity); - - $sdkPlatforms = array_values(array_unique($sdkPlatforms)); - $namespace = $sdk->getNamespace(); - - $descContents = $this->getDescriptionContents($desc); - - $temp = [ - 'summary' => $route->getDesc(), - 'operationId' => $namespace . ucfirst($methodName), - 'consumes' => [], - 'produces' => [], - 'tags' => [$namespace], - 'description' => $descContents, - 'responses' => [], - 'deprecated' => $sdk->isDeprecated(), - 'x-appwrite' => [ // Appwrite related metadata - 'method' => $methodName, - 'group' => $sdk->getGroup(), - 'cookies' => $route->getLabel('sdk.cookies', false), - 'type' => $sdk->getType()->value ?? '', - 'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodName) . '.md', - 'rate-limit' => $route->getLabel('abuse-limit', 0), - 'rate-time' => $route->getLabel('abuse-time', 3600), - 'rate-key' => $route->getLabel('abuse-key', 'url:{url},ip:{ip}'), - 'scope' => $route->getLabel('scope', ''), - 'platforms' => $sdkPlatforms, - 'packaging' => $sdk->isPackaging(), - 'public' => $sdk->isPublic(), - ], - ]; - - if ($sdk->getDescriptionFilePath() !== null) { - $temp['x-appwrite']['edit'] = 'https://github.com/appwrite/appwrite/edit/master' . $sdk->getDescription(); - } - - if ($sdk->getDeprecated()) { - $temp['x-appwrite']['deprecated'] = [ - 'since' => $sdk->getDeprecated()->getSince(), - 'replaceWith' => $sdk->getDeprecated()->getReplaceWith(), - ]; - } - - if ($produces) { - $temp['produces'][] = $produces; - } - - if (\is_array($additionalMethods) && \count($additionalMethods) > 0) { - $temp['x-appwrite']['methods'] = []; - foreach ($additionalMethods as $methodObj) { - /** @var Method $methodObj */ - $desc = $methodObj->getDescriptionFilePath(); - - $methodSecurities = $methodObj->getAuth(); - $methodSdkPlatforms = $specs->getSDKPlatformsForRouteSecurity($methodSecurities); - - if (!\in_array($this->platform, $methodSdkPlatforms)) { - continue; - } - - $methodSecurities = ['Project' => []]; - foreach ($methodObj->getAuth() as $security) { - /** @var AuthType $security */ - if (\array_key_exists($security->value, $this->keys)) { - $methodSecurities[$security->value] = []; - } - } - - $additionalMethod = [ - 'name' => $methodObj->getMethodName(), - 'namespace' => $methodObj->getNamespace(), - 'desc' => $methodObj->getDesc(), - 'auth' => \array_slice($methodSecurities, 0, $this->authCount), - 'parameters' => [], - 'required' => [], - 'responses' => [], - 'description' => $this->getDescriptionContents($desc), - 'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md', - 'public' => $methodObj->isPublic(), - ]; - - // add deprecation only if method has it! - if ($methodObj->getDeprecated()) { - $additionalMethod['deprecated'] = [ - 'since' => $methodObj->getDeprecated()->getSince(), - 'replaceWith' => $methodObj->getDeprecated()->getReplaceWith(), - ]; - } - - // If additional method has no parameters, inherit from route - if (empty($methodObj->getParameters())) { - foreach ($route->getParams() as $name => $param) { - $additionalMethod['parameters'][] = $name; - if (!$param['optional']) { - $additionalMethod['required'][] = $name; - } - } - } else { - // Use method's own parameters - foreach ($methodObj->getParameters() as $parameter) { - $additionalMethod['parameters'][] = $parameter->getName(); - if (!$parameter->getOptional()) { - $additionalMethod['required'][] = $parameter->getName(); - } - } - } - - foreach ($methodObj->getResponses() as $response) { - /** @var Response|array $response */ - $responseModel = $response->getModel(); - if (\is_array($responseModel)) { - foreach ($responseModel as $modelName) { - foreach ($this->models as $value) { - if ($value->getType() === $modelName) { - $usedModels[] = $modelName; - break; - } - } - } - $additionalMethod['responses'][] = [ - 'code' => $response->getCode(), - 'model' => \array_map(fn ($m) => '#/definitions/' . $m, $responseModel) - ]; - } else { - $responseData = [ - 'code' => $response->getCode(), - ]; - - // lets not assume stuff here! - if ($response->getCode() !== 204) { - $responseData['model'] = '#/definitions/' . $responseModel; - foreach ($this->models as $value) { - if ($value->getType() === $responseModel) { - $usedModels[] = $responseModel; - break; - } - } - } - - $additionalMethod['responses'][] = $responseData; - } - } - - $temp['x-appwrite']['methods'][] = $additionalMethod; - } - } - - // Handle Responses - foreach ($sdk->getResponses() as $response) { - /** @var Response $response */ - $model = $response->getModel(); - - foreach ($this->models as $value) { - if (\is_array($model)) { - $model = \array_map(fn ($m) => $m === $value->getType() ? $value : $m, $model); - } else { - if ($value->getType() === $model) { - $model = $value; - break; - } - } - } - - if (\is_string($model)) { - throw new \RuntimeException("Unresolved response model '{$model}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered."); - } - - if (\is_array($model)) { - foreach ($model as $m) { - if (\is_string($m)) { - throw new \RuntimeException("Unresolved response model '{$m}' for method '{$sdk->getNamespace()}.{$sdk->getMethodName()}'. Ensure the model is registered."); - } - } - } - - if (!(\is_array($model)) && $model->isNone()) { - if ($produces === ContentType::TEXT->value && !\in_array($response->getCode(), [204, 301, 302, 308], true)) { - $temp['responses'][(string)$response->getCode()] = [ - 'description' => 'Text', - 'schema' => [ - 'type' => 'string', - ], - ]; - - continue; - } - - $temp['responses'][(string)$response->getCode()] = [ - 'description' => in_array($produces, [ - 'image/*', - 'image/jpeg', - 'image/gif', - 'image/png', - 'image/webp', - 'image/svg-x', - 'image/x-icon', - 'image/bmp', - ]) ? 'Image' : 'File', - 'schema' => [ - 'type' => 'file' - ], - ]; - } else { - if (\is_array($model)) { - $modelDescription = \join(', or ', \array_map(fn ($m) => $m->getName(), $model)); - // model has multiple possible responses, we will use oneOf - foreach ($model as $m) { - $usedModels[] = $m->getType(); - } - $temp['responses'][(string)$response->getCode()] = [ - 'description' => $modelDescription, - 'schema' => \array_filter([ - 'x-oneOf' => \array_map(function ($m) { - return ['$ref' => '#/definitions/' . $m->getType()]; - }, $model), - 'x-discriminator' => $this->getDiscriminator($model, '#/definitions/'), - ]), - ]; - } else { - // Response definition using one type - $usedModels[] = $model->getType(); - $temp['responses'][(string)$response->getCode()] = [ - 'description' => $model->getName(), - 'schema' => [ - '$ref' => '#/definitions/' . $model->getType(), - ], - ]; - } - } - - if (in_array($response->getCode(), [204, 301, 302, 308], true)) { - $temp['responses'][(string)$response->getCode()]['description'] = 'No content'; - unset($temp['responses'][(string)$response->getCode()]['schema']); - } - } - - if (!empty($scope)) { - $securities = ['Project' => []]; - - foreach ($sdk->getAuth() as $security) { - if (\array_key_exists($security->value, $this->keys)) { - $securities[$security->value] = []; - } - } - - $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); - $temp['security'][] = $securities; - } - - $body = [ - 'name' => 'payload', - 'in' => 'body', - 'schema' => [ - 'type' => 'object', - 'properties' => [], - ], - ]; - - $bodyRequired = []; - - $parameters = \array_merge( - $route->getParams(), - $sdk->getAdditionalParameters() ?? [], - ); - - foreach ($parameters as $name => $param) { // Set params - if (($param['deprecated'] ?? false) === true) { - continue; - } - - /** @var Validator $validator */ - $validator = $this->getValidator($param); - - $isNullable = $validator instanceof Nullable; - - $parameter = $this->getRequestParameterConfig( - $param['optional'], - $isNullable, - $param['default'], - $sdk->getNamespace() . '.' . $sdk->getMethodName(), - $name, - ); - - $node = [ - 'name' => $name, - 'description' => $param['description'], - 'required' => $parameter['required'], - ]; - - if ($isNullable) { - /** @var Nullable $validator */ - $validator = $validator->getValidator(); - } - - $class = \get_class($validator); - - $base = \get_parent_class($class); - - switch ($base) { - case \Appwrite\Utopia\Database\Validator\Queries\Base::class: - $class = $base; - break; - } - - if ($class === \Utopia\Validator\AnyOf::class) { - $validator = $param['validator']->getValidators()[0]; - $class = \get_class($validator); - } - - $array = false; - if ($class === \Utopia\Validator\ArrayList::class) { - $array = true; - $subclass = \get_class($validator->getValidator()); - switch ($subclass) { - case \Appwrite\Utopia\Database\Validator\Operation::class: - case \Utopia\Validator\WhiteList::class: - $class = $subclass; - break; - } - } - - switch ($class) { - case \Utopia\Validator\Text::class: - case \Utopia\Database\Validator\UID::class: - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; - break; - case \Utopia\Validator\Boolean::class: - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: false; - break; - case \Appwrite\Utopia\Database\Validator\CustomId::class: - if ($sdk->getType() === MethodType::UPLOAD) { - $node['x-upload-id'] = true; - } - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: '<' . \strtoupper(Template::fromCamelCaseToSnake($node['name'])) . '>'; - break; - case \Utopia\Database\Validator\Datetime::class: - $node['type'] = $validator->getType(); - $node['format'] = 'datetime'; - $node['x-example'] = ($param['example'] ?? '') ?: Model::TYPE_DATETIME_EXAMPLE; - break; - case \Utopia\Database\Validator\Spatial::class: - /** @var Spatial $validator */ - $node['type'] = 'array'; - $node['schema']['items'] = [ - 'oneOf' => [ - ['type' => 'array'] - ] - ]; - $node['x-example'] = ($param['example'] ?? '') ?: match ($validator->getSpatialType()) { - Database::VAR_POINT => '[1, 2]', - Database::VAR_LINESTRING => '[[1, 2], [3, 4], [5, 6]]', - Database::VAR_POLYGON => '[[[1, 2], [3, 4], [5, 6], [1, 2]]]', - default => '', - }; - break; - case \Utopia\Emails\Validator\Email::class: - $node['type'] = $validator->getType(); - $node['format'] = 'email'; - $node['x-example'] = ($param['example'] ?? '') ?: 'email@example.com'; - break; - case \Utopia\Validator\Host::class: - case \Utopia\Validator\URL::class: - case \Appwrite\Network\Validator\Redirect::class: - $node['type'] = $validator->getType(); - $node['format'] = 'url'; - $node['x-example'] = ($param['example'] ?? '') ?: 'https://example.com'; - break; - case \Utopia\Validator\ArrayList::class: - /** @var ArrayList $validator */ - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => $validator->getValidator()->getType(), - ]; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - case \Utopia\Validator\JSON::class: - case \Utopia\Validator\Assoc::class: - $node['type'] = 'object'; - $node['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; - $node['x-example'] = ($param['example'] ?? '') ?: '{}'; - break; - case \Utopia\Storage\Validator\File::class: - $consumes = ['multipart/form-data']; - $node['type'] = 'file'; - break; - case \Appwrite\Functions\Validator\Payload::class: - $consumes = ['multipart/form-data']; - $node['type'] = 'payload'; - break; - case \Appwrite\Utopia\Database\Validator\Queries\Base::class: - case \Utopia\Database\Validator\Queries::class: - case \Utopia\Database\Validator\Queries\Document::class: - case \Utopia\Database\Validator\Queries\Documents::class: - case \Appwrite\Utopia\Database\Validator\Queries\Branches::class: - case \Appwrite\Utopia\Database\Validator\Queries\Columns::class: - case \Appwrite\Utopia\Database\Validator\Queries\Tables::class: - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => 'string', - ]; - break; - case \Utopia\Database\Validator\Permissions::class: - $node['type'] = $validator->getType(); - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => 'string', - ]; - $node['x-example'] = ($param['example'] ?? '') ?: '["' . Permission::read(Role::any()) . '"]'; - break; - case \Utopia\Database\Validator\Roles::class: - $node['type'] = $validator->getType(); - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => 'string', - ]; - $node['x-example'] = ($param['example'] ?? '') ?: '["' . Role::any()->toString() . '"]'; - break; - case \Appwrite\Auth\Validator\Password::class: - $node['type'] = $validator->getType(); - $node['format'] = 'password'; - $node['x-example'] = ($param['example'] ?? '') ?: 'password'; - break; - case \Appwrite\Auth\Validator\Phone::class: - $node['type'] = $validator->getType(); - $node['format'] = 'phone'; - $node['x-example'] = ($param['example'] ?? '') ?: '+12065550100'; - break; - case \Utopia\Validator\Range::class: - /** @var Range $validator */ - $node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number' : $validator->getType(); - $node['format'] = $validator->getType() == Validator::TYPE_INTEGER ? 'int32' : 'float'; - $node['x-example'] = ($param['example'] ?? '') ?: $validator->getMin(); - break; - case \Utopia\Validator\Integer::class: - $node['type'] = $validator->getType(); - $node['format'] = $validator->getFormat(); - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - case \Utopia\Validator\Numeric::class: - case \Utopia\Validator\FloatValidator::class: - $node['type'] = 'number'; - $node['format'] = 'float'; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - case \Utopia\Validator\WhiteList::class: - if ($array) { - $validator = $validator->getValidator(); - - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = [ - 'type' => $validator->getType(), - ]; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - - if ($validator->getType() === 'string') { - $enum = $param['enum'] ?? null; - - if ($enum instanceof Enum) { - $enumValues = \array_values($validator->getList()); - - if (!empty($enum->exclude)) { - $keepIndices = []; - foreach ($enumValues as $index => $value) { - if (!\in_array($value, $enum->exclude, true)) { - $keepIndices[] = $index; - } - } - - $enumValues = \array_values(\array_intersect_key($enumValues, \array_flip($keepIndices))); - $node['description'] = $this->parseDescription($node['description'], $enum->exclude); - } - - $enumKeys = []; - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } - - $node['items']['enum'] = $enumValues; - if (!empty($enum->name)) { - $node['items']['x-enum-name'] = $enum->name; - } - $node['items']['x-enum-keys'] = $enumKeys; - } - } - if ($validator->getType() === 'integer') { - $node['items']['format'] = $validator->getFormat(); - } - } else { - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: $validator->getList()[0]; - - if ($validator->getType() === 'string') { - $enum = $param['enum'] ?? null; - - if ($enum instanceof Enum) { - $enumValues = \array_values($validator->getList()); - - if (!empty($enum->exclude)) { - $keepIndices = []; - foreach ($enumValues as $index => $value) { - if (!\in_array($value, $enum->exclude, true)) { - $keepIndices[] = $index; - } - } - - $enumValues = \array_values(\array_intersect_key($enumValues, \array_flip($keepIndices))); - $node['description'] = $this->parseDescription($node['description'], $enum->exclude); - } - - $enumKeys = []; - foreach ($enumValues as $enumValue) { - $enumKeys[] = $enum->map[$enumValue] ?? $enumValue; - } - - $node['enum'] = $enumValues; - if (!empty($enum->name)) { - $node['x-enum-name'] = $enum->name; - } - $node['x-enum-keys'] = $enumKeys; - } - } - if ($validator->getType() === 'integer') { - $node['format'] = $validator->getFormat(); - } - } - break; - case \Appwrite\Utopia\Database\Validator\CompoundUID::class: - $node['type'] = $validator->getType(); - $node['x-example'] = ($param['example'] ?? '') ?: ''; - break; - case \Appwrite\Utopia\Database\Validator\Operation::class: - if ($array) { - $validator = $validator->getValidator(); - } - - /** @var Operation $validator */ - $collectionIdKey = $validator->getCollectionIdKey(); - $documentIdKey = $validator->getDocumentIdKey(); - if ($array) { - $node['type'] = 'array'; - $node['collectionFormat'] = 'multi'; - $node['items'] = ['type' => 'object']; - } else { - $node['type'] = 'object'; - } - if (empty($param['example'])) { - $example = [ - 'action' => 'create', - 'databaseId' => '', - $collectionIdKey => '<'.\strtoupper(Template::fromCamelCaseToSnake($collectionIdKey)).'>', - $documentIdKey => '<'.\strtoupper(Template::fromCamelCaseToSnake($documentIdKey)).'>', - 'data' => [ - 'name' => 'Walter O\'Brien', - ], - ]; - if ($array) { - $example = [$example]; - } - $node['x-example'] = \str_replace("\n", "\n\t", \json_encode($example, JSON_PRETTY_PRINT)); - } else { - $node['x-example'] = $param['example']; - } - break; - default: - $node['type'] = 'string'; - if (!empty($param['example'])) { - $node['x-example'] = $param['example']; - } - break; - } - - if ($parameter['emitDefault'] && $this->shouldEmitDefaultForSchema($param['default'], $node)) { // Param has default value - $node['default'] = $param['default']; - } - - $pathAliases = [$name, ...($param['aliases'] ?? [])]; - $pathAliasMap = \array_flip($pathAliases); - $isPathParam = false; - - foreach (\explode('/', $url) as $segment) { - if ($segment !== '' && $segment[0] === ':' && isset($pathAliasMap[\substr($segment, 1)])) { - $isPathParam = true; - break; - } - } - - if ($isPathParam) { // Param is in URL path (directly or through alias) - $node['in'] = 'path'; - $temp['parameters'][] = $node; - } elseif ($route->getMethod() == 'GET') { // Param is in query - $node['in'] = 'query'; - $temp['parameters'][] = $node; - } else { // Param is in payload - if (\in_array('multipart/form-data', $consumes)) { - $node['in'] = 'formData'; - $temp['parameters'][] = $node; - - continue; - } - - if ($node['required']) { - $bodyRequired[] = $name; - } - - $body['schema']['properties'][$name] = [ - 'type' => $node['type'], - 'description' => $node['description'], - ]; - - if (\array_key_exists('default', $node)) { - $body['schema']['properties'][$name]['default'] = $node['default']; - } - - $body['schema']['properties'][$name]['x-example'] = $node['x-example'] ?? null; - - if (isset($node['format'])) { - $body['schema']['properties'][$name]['format'] = $node['format']; - } - - if (isset($node['enum'])) { - /// If the enum flag is Set, add the enum values to the body - $body['schema']['properties'][$name]['enum'] = $node['enum']; - $body['schema']['properties'][$name]['x-enum-name'] = $node['x-enum-name'] ?? null; - $body['schema']['properties'][$name]['x-enum-keys'] = $node['x-enum-keys']; - } - - if ($parameter['nullable']) { - $body['schema']['properties'][$name]['x-nullable'] = true; - } - - if (\array_key_exists('items', $node)) { - $body['schema']['properties'][$name]['items'] = $node['items']; - } - } - - $segments = \explode('/', $url); - foreach ($segments as &$segment) { - if ($segment !== '' && $segment[0] === ':' && isset($pathAliasMap[\substr($segment, 1)])) { - $segment = '{' . $name . '}'; - } - } - unset($segment); - $url = \implode('/', $segments); - } - - if (!empty($bodyRequired)) { - $body['schema']['required'] = $bodyRequired; - } - - if (!empty($body['schema']['properties'])) { - $temp['parameters'][] = $body; - } - - $temp['consumes'] = $consumes; - - $output['paths'][$url][\strtolower($route->getMethod())] = $temp; - } - - foreach ($this->models as $model) { - $this->getNestedModels($model, $usedModels); - } - - foreach ($this->models as $model) { - if (!in_array($model->getType(), $usedModels)) { - continue; - } - - $required = $model->getRequired(); - $rules = $model->getRules(); - $examples = []; - - $output['definitions'][$model->getType()] = [ - 'description' => $model->getName(), - 'type' => 'object', - ]; - - if (!empty($rules)) { - $output['definitions'][$model->getType()]['properties'] = []; - } - - if ($model->isAny()) { - $output['definitions'][$model->getType()]['additionalProperties'] = true; - } - - if (!empty($required)) { - $output['definitions'][$model->getType()]['required'] = $required; - } - - foreach ($model->getRules() as $name => $rule) { - if (($rule['hidden'] ?? false) === true) { - continue; - } - - $type = ''; - $format = null; - $items = null; - - $examples[$name] = $rule['example'] ?? null; - - switch ($rule['type']) { - case 'string': - case 'datetime': - $type = 'string'; - break; - - case 'id': - $type = 'string'; - break; - - case 'enum': - $type = 'string'; - break; - - case 'json': - $type = 'object'; - break; - - case 'array': - $type = 'array'; - break; - - case 'integer': - $type = 'integer'; - $format = $rule['format'] ?? 'int32'; - break; - - case 'float': - $type = 'number'; - $format = 'float'; - break; - - case 'double': - $type = 'number'; - $format = 'double'; - break; - - case 'boolean': - $type = 'boolean'; - break; - - case 'payload': - $type = 'payload'; - break; - - default: - $type = 'object'; - $rule['type'] = ($rule['type']) ?: 'none'; - - if (\is_array($rule['type'])) { - $resolvedModels = \array_map(function (string $type) { - foreach ($this->models as $model) { - if ($model->getType() === $type) { - return $model; - } - } - - throw new \RuntimeException("Unresolved model '{$type}'. Ensure the model is registered."); - }, $rule['type']); - $xDiscriminator = $this->getDiscriminator($resolvedModels, '#/definitions/'); - - if ($rule['array']) { - $items = \array_filter([ - 'x-anyOf' => \array_map(fn ($type) => ['$ref' => '#/definitions/' . $type], $rule['type']), - 'x-discriminator' => $xDiscriminator, - ]); - } else { - $items = \array_filter([ - 'x-oneOf' => \array_map(fn ($type) => ['$ref' => '#/definitions/' . $type], $rule['type']), - 'x-discriminator' => $xDiscriminator, - ]); - } - } else { - $items = [ - 'type' => $type, - '$ref' => '#/definitions/' . $rule['type'], - ]; - } - break; - } - - $readOnly = $rule['readOnly'] ?? false; - if ($rule['type'] == 'json') { - $output['definitions'][$model->getType()]['properties'][$name] = [ - 'type' => $type, - 'additionalProperties' => true, - 'description' => $rule['description'] ?? '', - 'x-example' => $rule['example'] ?? null, - ]; - - if ($readOnly) { - $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; - } - continue; - } - - if ($rule['array']) { - $output['definitions'][$model->getType()]['properties'][$name] = [ - 'type' => 'array', - 'description' => $rule['description'] ?? '', - 'items' => [ - 'type' => $type, - ], - 'x-example' => $rule['example'] ?? null, - ]; - - if ($format) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['format'] = $format; - } - if ($readOnly) { - $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; - } - } else { - $output['definitions'][$model->getType()]['properties'][$name] = [ - 'type' => $type, - 'description' => $rule['description'] ?? '', - 'x-example' => $rule['example'] ?? null, - ]; - - if ($format) { - $output['definitions'][$model->getType()]['properties'][$name]['format'] = $format; - } - if ($readOnly) { - $output['definitions'][$model->getType()]['properties'][$name]['readOnly'] = true; - } - } - if ($items) { - $output['definitions'][$model->getType()]['properties'][$name]['items'] = $items; - } - if ($rule['type'] === 'enum' && !empty($rule['enum'])) { - if ($rule['array']) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['enum'] = \array_values($rule['enum']); - if (!empty($rule['enumSDKName'])) { - $output['definitions'][$model->getType()]['properties'][$name]['items']['x-enum-name'] = $rule['enumSDKName']; - } - } else { - $output['definitions'][$model->getType()]['properties'][$name]['enum'] = \array_values($rule['enum']); - if (!empty($rule['enumSDKName'])) { - $output['definitions'][$model->getType()]['properties'][$name]['x-enum-name'] = $rule['enumSDKName']; - } - } - } - if (!in_array($name, $required)) { - $output['definitions'][$model->getType()]['properties'][$name]['x-nullable'] = true; - } - } - - /** @var Any $model */ - if ($model->isAny() && !empty($model->getSampleData())) { - $examples = array_merge($examples, $model->getSampleData()); - } - - $output['definitions'][$model->getType()]['example'] = $examples; - } - - \ksort($output['paths']); - - return $output; - } -} diff --git a/src/Appwrite/SDK/Specification/Validator/PasswordFormat.php b/src/Appwrite/SDK/Specification/Validator/PasswordFormat.php new file mode 100644 index 0000000000..5e3dc1cf8f --- /dev/null +++ b/src/Appwrite/SDK/Specification/Validator/PasswordFormat.php @@ -0,0 +1,32 @@ +validator->getDescription(); + } + + public function isArray(): bool + { + return $this->validator->isArray(); + } + + public function getType(): string + { + return $this->validator->getType(); + } + + public function isValid(mixed $value): bool + { + return $this->validator->isValid($value); + } +} diff --git a/src/Appwrite/Utopia/Request.php b/src/Appwrite/Utopia/Request.php index 1070d993c8..be23c2f211 100644 --- a/src/Appwrite/Utopia/Request.php +++ b/src/Appwrite/Utopia/Request.php @@ -180,53 +180,29 @@ class Request extends UtopiaRequest /** * Get headers * - * Method for getting all HTTP header parameters, including cookies. + * Method for getting all HTTP headers, including a synthesized `cookie` + * header. Swoole parses the incoming Cookie header into its own cookie jar, + * so it is absent from the raw header map; rebuild it here so consumers that + * forward request headers (e.g. function/site executions) still receive it. * - * @return array + * @return array> */ public function getHeaders(): array { - try { - $headers = $this->generateHeaders(); - } catch (\Throwable) { - $headers = []; - } + $headers = parent::getHeaders(); - if (empty($this->swoole->cookie)) { - return $headers; - } - - $cookieHeaders = []; - foreach ($this->swoole->cookie as $key => $value) { - $cookieHeaders[] = "{$key}={$value}"; - } - - if (!empty($cookieHeaders)) { - $headers['cookie'] = \implode('; ', $cookieHeaders); + $cookies = $this->getCookieParams(); + if (!empty($cookies)) { + $pairs = []; + foreach ($cookies as $key => $value) { + $pairs[] = "{$key}={$value}"; + } + $headers['cookie'] = [\implode('; ', $pairs)]; } return $headers; } - /** - * Get header - * - * Method for querying HTTP header parameters. If $key is not found $default value will be returned. - * - * @param string $key - * @param string $default - * @return string - */ - public function getHeader(string $key, string $default = ''): string - { - $headers = $this->getHeaders(); - $value = $headers[$key] ?? $default; - if (\is_array($value)) { - $value = $value[0] ?? $default; - } - return \is_string($value) ? $value : $default; - } - /** * Get User Agent * @@ -237,7 +213,7 @@ class Request extends UtopiaRequest */ public function getUserAgent(string $default = ''): string { - $forwardedUserAgent = $this->getHeader('x-forwarded-user-agent'); + $forwardedUserAgent = $this->getHeaderLine('x-forwarded-user-agent'); if (!empty($forwardedUserAgent)) { $roles = $this->authorization->getRoles(); $isAppUser = $this->user?->isKey($roles) ?? false; @@ -264,7 +240,7 @@ class Request extends UtopiaRequest $params = array_intersect_key($params, array_flip($allowedParams)); } if (!isset($params['project'])) { - $params['project'] = $this->getHeader('x-appwrite-project', ''); + $params['project'] = $this->getHeaderLine('x-appwrite-project', ''); } ksort($params); return md5($this->getURI() . '*' . serialize($params) . '*' . APP_CACHE_BUSTER); diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index c8b573fc49..d6b57990a4 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -267,6 +267,7 @@ class Response extends SwooleResponse public const MODEL_POLICY_LIST = 'policyList'; public const MODEL_POLICY_PASSWORD_DICTIONARY = 'policyPasswordDictionary'; public const MODEL_POLICY_PASSWORD_HISTORY = 'policyPasswordHistory'; + public const MODEL_POLICY_PASSWORD_STRENGTH = 'policyPasswordStrength'; public const MODEL_POLICY_PASSWORD_PERSONAL_DATA = 'policyPasswordPersonalData'; public const MODEL_POLICY_SESSION_ALERT = 'policySessionAlert'; public const MODEL_POLICY_SESSION_DURATION = 'policySessionDuration'; diff --git a/src/Appwrite/Utopia/Response/Filters/V26.php b/src/Appwrite/Utopia/Response/Filters/V26.php index 3867ba907f..0f53290749 100644 --- a/src/Appwrite/Utopia/Response/Filters/V26.php +++ b/src/Appwrite/Utopia/Response/Filters/V26.php @@ -51,6 +51,7 @@ class V26 extends Filter $content['authDisposableEmails'] = $auths->getAttribute('disposableEmails', false); $content['authCanonicalEmails'] = $auths->getAttribute('canonicalEmails', false); $content['authFreeEmails'] = $auths->getAttribute('freeEmails', false); + $content['authCorporateEmails'] = $auths->getAttribute('corporateEmails', false); $content['authMockNumbers'] = $auths->getAttribute('mockNumbers', []); $content['authSessionAlerts'] = $auths->getAttribute('sessionAlerts', false); $content['authMembershipsUserName'] = $auths->getAttribute('membershipsUserName', false); @@ -58,6 +59,7 @@ class V26 extends Filter $content['authMembershipsMfa'] = $auths->getAttribute('membershipsMfa', false); $content['authMembershipsUserId'] = $auths->getAttribute('membershipsUserId', false); $content['authMembershipsUserPhone'] = $auths->getAttribute('membershipsUserPhone', false); + $content['authMembershipsUserAccessedAt'] = $auths->getAttribute('membershipsUserAccessedAt', false); $content['authInvalidateSessions'] = $auths->getAttribute('invalidateSessions', false); $content['description'] = $raw->getAttribute('description', ''); diff --git a/src/Appwrite/Utopia/Response/Model/Account.php b/src/Appwrite/Utopia/Response/Model/Account.php index aaaf501a88..fb03bdb155 100644 --- a/src/Appwrite/Utopia/Response/Model/Account.php +++ b/src/Appwrite/Utopia/Response/Model/Account.php @@ -78,6 +78,41 @@ class Account extends Model 'default' => false, 'example' => true, ]) + ->addRule('emailCanonical', [ + 'type' => self::TYPE_STRING, + 'description' => 'Canonical form of the user email address.', + 'required' => false, + 'default' => '', + 'example' => 'john@appwrite.io', + ]) + ->addRule('emailIsFree', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is from a free email provider.', + 'required' => false, + 'default' => null, + 'example' => true, + ]) + ->addRule('emailIsDisposable', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is from a disposable email provider.', + 'required' => false, + 'default' => null, + 'example' => false, + ]) + ->addRule('emailIsCorporate', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is from a corporate domain.', + 'required' => false, + 'default' => null, + 'example' => true, + ]) + ->addRule('emailIsCanonical', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is in its canonical form.', + 'required' => false, + 'default' => null, + 'example' => true, + ]) ->addRule('phoneVerification', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Phone verification status.', diff --git a/src/Appwrite/Utopia/Response/Model/Membership.php b/src/Appwrite/Utopia/Response/Model/Membership.php index 9be7102145..f07ef79398 100644 --- a/src/Appwrite/Utopia/Response/Model/Membership.php +++ b/src/Appwrite/Utopia/Response/Model/Membership.php @@ -88,6 +88,12 @@ class Membership extends Model 'default' => false, 'example' => false, ]) + ->addRule('userAccessedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Most recent access date in ISO 8601 format. Show this attribute by toggling membership privacy in the Console.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) ->addRule('roles', [ 'type' => self::TYPE_STRING, 'description' => 'User list of roles', diff --git a/src/Appwrite/Utopia/Response/Model/MigrationReport.php b/src/Appwrite/Utopia/Response/Model/MigrationReport.php index 388630af3f..f2304fa16d 100644 --- a/src/Appwrite/Utopia/Response/Model/MigrationReport.php +++ b/src/Appwrite/Utopia/Response/Model/MigrationReport.php @@ -59,6 +59,72 @@ class MigrationReport extends Model 'default' => 0, 'example' => 5, ]) + ->addRule(Resource::TYPE_API_KEY, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of API keys to be migrated.', + 'default' => 0, + 'example' => 5, + ]) + ->addRule(Resource::TYPE_PROJECT_VARIABLE, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of project variables to be migrated.', + 'default' => 0, + 'example' => 5, + ]) + ->addRule(Resource::TYPE_WEBHOOK, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of webhooks to be migrated.', + 'default' => 0, + 'example' => 5, + ]) + ->addRule(Resource::TYPE_AUTH_METHODS, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of auth-method configs to be migrated (always 0 or 1 — the project-level flag bundle).', + 'default' => 0, + 'example' => 1, + ]) + ->addRule(Resource::TYPE_PROJECT_PROTOCOLS, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of protocol configs to be migrated (always 0 or 1 — the project-level REST/GraphQL/WebSocket flags).', + 'default' => 0, + 'example' => 1, + ]) + ->addRule(Resource::TYPE_PROJECT_LABELS, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of label sets to be migrated (always 0 or 1 — the project-level RBAC label array).', + 'default' => 0, + 'example' => 1, + ]) + ->addRule(Resource::TYPE_PROJECT_SERVICES, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of service configs to be migrated (always 0 or 1 — the project-level enable/disable flags for all 17 services).', + 'default' => 0, + 'example' => 1, + ]) + ->addRule(Resource::TYPE_POLICIES, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of policy bundles to be migrated (always 0 or 1 — the project-level security policies covering password rules, session behavior, user limits, and membership privacy).', + 'default' => 0, + 'example' => 1, + ]) + ->addRule(Resource::TYPE_SMTP, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of SMTP configurations to be migrated (always 0 or 1 — the project-level custom SMTP settings; password is not exposed by the source API).', + 'default' => 0, + 'example' => 1, + ]) + ->addRule(Resource::TYPE_RULE, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of custom-domain proxy rules to be migrated. Auto-generated `.appwrite.network` rules are skipped — they are recreated by parent Function/Site migration.', + 'default' => 0, + 'example' => 5, + ]) + ->addRule(Resource::TYPE_PROJECT_EMAIL_TEMPLATE, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of custom email templates to be migrated (one per templateId × locale pair).', + 'default' => 0, + 'example' => 7, + ]) ->addRule(Resource::TYPE_SITE, [ 'type' => self::TYPE_INTEGER, 'description' => 'Number of sites to be migrated.', @@ -101,6 +167,13 @@ class MigrationReport extends Model 'default' => '', 'example' => '1.4.0', ]); + + $this->addRule(Resource::TYPE_OAUTH2_PROVIDER, [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Number of OAuth2 provider configurations to be migrated. Secrets (clientSecret, p8File) are never migrated — destination admin must re-enter them per provider.', + 'default' => 0, + 'example' => 5, + ]); } /** diff --git a/src/Appwrite/Utopia/Response/Model/PolicyList.php b/src/Appwrite/Utopia/Response/Model/PolicyList.php index 11704cdbff..0c61f15097 100644 --- a/src/Appwrite/Utopia/Response/Model/PolicyList.php +++ b/src/Appwrite/Utopia/Response/Model/PolicyList.php @@ -14,7 +14,7 @@ class PolicyList extends Model 'type' => self::TYPE_INTEGER, 'description' => 'Total number of policies in the given project.', 'default' => 0, - 'example' => 9, + 'example' => 10, ]) ->addRule('policies', [ 'type' => $this->getPolicyModels(), @@ -32,6 +32,7 @@ class PolicyList extends Model return [ Response::MODEL_POLICY_PASSWORD_DICTIONARY, Response::MODEL_POLICY_PASSWORD_HISTORY, + Response::MODEL_POLICY_PASSWORD_STRENGTH, Response::MODEL_POLICY_PASSWORD_PERSONAL_DATA, Response::MODEL_POLICY_SESSION_ALERT, Response::MODEL_POLICY_SESSION_DURATION, diff --git a/src/Appwrite/Utopia/Response/Model/PolicyMembershipPrivacy.php b/src/Appwrite/Utopia/Response/Model/PolicyMembershipPrivacy.php index fe2851d35b..bb89462a3c 100644 --- a/src/Appwrite/Utopia/Response/Model/PolicyMembershipPrivacy.php +++ b/src/Appwrite/Utopia/Response/Model/PolicyMembershipPrivacy.php @@ -44,6 +44,12 @@ class PolicyMembershipPrivacy extends PolicyBase 'description' => 'Whether user MFA status is visible in memberships.', 'default' => false, 'example' => true, + ]) + ->addRule('userAccessedAt', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether user last access time is visible in memberships.', + 'default' => false, + 'example' => true, ]); } diff --git a/src/Appwrite/Utopia/Response/Model/PolicyPasswordStrength.php b/src/Appwrite/Utopia/Response/Model/PolicyPasswordStrength.php new file mode 100644 index 0000000000..2a56cfa7e9 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/PolicyPasswordStrength.php @@ -0,0 +1,59 @@ + 'password-strength', + ]; + + public function __construct() + { + parent::__construct(); + + $this + ->addRule('min', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Minimum password length required for user passwords.', + 'default' => 8, + 'example' => 12, + ]) + ->addRule('uppercase', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether passwords must include at least one uppercase letter.', + 'default' => false, + 'example' => true, + ]) + ->addRule('lowercase', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether passwords must include at least one lowercase letter.', + 'default' => false, + 'example' => true, + ]) + ->addRule('number', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether passwords must include at least one number.', + 'default' => false, + 'example' => true, + ]) + ->addRule('symbols', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether passwords must include at least one symbol.', + 'default' => false, + 'example' => true, + ]); + } + + public function getName(): string + { + return 'Policy Password Strength'; + } + + public function getType(): string + { + return Response::MODEL_POLICY_PASSWORD_STRENGTH; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index c788833e88..3d5fd76de3 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -43,6 +43,12 @@ class Project extends Model 'default' => '', 'example' => '1592981250', ]) + ->addRule('region', [ + 'type' => self::TYPE_STRING, + 'description' => 'Project region.', + 'default' => 'default', + 'example' => 'fra', + ]) // Resource: Dev Keys ->addRule('devKeys', [ @@ -105,9 +111,10 @@ class Project extends Model ]) ->addRule('smtpPassword', [ 'type' => self::TYPE_STRING, + 'format' => 'password', 'description' => 'SMTP server password. This property is write-only and always returned empty.', 'default' => '', - 'example' => '', + 'example' => 'smtp-password', ]) ->addRule('smtpSecure', [ 'type' => self::TYPE_STRING, @@ -173,6 +180,19 @@ class Project extends Model 'example' => new \stdClass(), 'array' => true, ]) + ->addRule('blocks', [ + 'type' => self::TYPE_STRING, + 'description' => 'Project blocks information.', + 'default' => [], + 'example' => [], + 'array' => true, + ]) + ->addRule('consoleAccessedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Last time the project was accessed via console.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) ; } @@ -207,10 +227,16 @@ class Project extends Model $this->expandServices($document); $this->expandProtocols($document); $this->expandAuthMethods($document); + $this->expandConsoleAccessedAt($document); return $document; } + private function expandConsoleAccessedAt(Document $document): void + { + $document->setAttribute('consoleAccessedAt', $document->getAttribute('accessedAt', '')); + } + private function expandSmtpFields(Document $document): void { if (!$document->isSet('smtp')) { diff --git a/src/Appwrite/Utopia/Response/Model/User.php b/src/Appwrite/Utopia/Response/Model/User.php index 01447ccfc2..f255519bfd 100644 --- a/src/Appwrite/Utopia/Response/Model/User.php +++ b/src/Appwrite/Utopia/Response/Model/User.php @@ -108,6 +108,41 @@ class User extends Model 'default' => false, 'example' => true, ]) + ->addRule('emailCanonical', [ + 'type' => self::TYPE_STRING, + 'description' => 'Canonical form of the user email address.', + 'required' => false, + 'default' => '', + 'example' => 'john@appwrite.io', + ]) + ->addRule('emailIsFree', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is from a free email provider.', + 'required' => false, + 'default' => null, + 'example' => true, + ]) + ->addRule('emailIsDisposable', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is from a disposable email provider.', + 'required' => false, + 'default' => null, + 'example' => false, + ]) + ->addRule('emailIsCorporate', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is from a corporate domain.', + 'required' => false, + 'default' => null, + 'example' => true, + ]) + ->addRule('emailIsCanonical', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Whether the user email is in its canonical form.', + 'required' => false, + 'default' => null, + 'example' => true, + ]) ->addRule('phoneVerification', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Phone verification status.', diff --git a/src/Appwrite/Utopia/Response/Model/Webhook.php b/src/Appwrite/Utopia/Response/Model/Webhook.php index 6a0197e4a1..c3a1c288ea 100644 --- a/src/Appwrite/Utopia/Response/Model/Webhook.php +++ b/src/Appwrite/Utopia/Response/Model/Webhook.php @@ -65,9 +65,10 @@ class Webhook extends Model ]) ->addRule('authPassword', [ 'type' => self::TYPE_STRING, + 'format' => 'password', 'description' => 'HTTP basic authentication password.', 'default' => '', - 'example' => 'password', + 'example' => 'webhook-password', ]) ->addRule('secret', [ 'type' => self::TYPE_STRING, diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index c570970732..53c86f1287 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -71,7 +71,8 @@ class Executor array $variables = [], ?string $command = null, string $outputDirectory = '', - string $runtimeEntrypoint = '' + string $runtimeEntrypoint = '', + string $cacheKey = '' ) { $runtimeId = "$projectId-$deploymentId-build"; $route = "/runtimes"; @@ -95,7 +96,8 @@ class Executor 'version' => $version, 'timeout' => $timeout, 'outputDirectory' => $outputDirectory, - 'runtimeEntrypoint' => $runtimeEntrypoint + 'runtimeEntrypoint' => $runtimeEntrypoint, + 'cacheKey' => $cacheKey ]; diff --git a/tests/e2e/General/AbuseTest.php b/tests/e2e/General/AbuseTest.php index e30186bcc0..fbda7b7ad4 100644 --- a/tests/e2e/General/AbuseTest.php +++ b/tests/e2e/General/AbuseTest.php @@ -1,5 +1,7 @@ assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('# humanstxt.org/', $response['body']); + $this->assertStringContainsString('# humanstxt.org/', (string) $response['body']); } public function testRobots() @@ -67,7 +69,7 @@ class HTTPTest extends Scope ])); $this->assertEquals(200, $response['headers']['status-code'], "Simple GET /robots.txt HTTP request failed: " . \json_encode($response)); - $this->assertStringContainsString('# robotstxt.org/', $response['body']); + $this->assertStringContainsString('# robotstxt.org/', (string) $response['body']); } public function testAcmeChallenge() diff --git a/tests/e2e/General/HooksTest.php b/tests/e2e/General/HooksTest.php index 812fb61496..58e8d0d921 100644 --- a/tests/e2e/General/HooksTest.php +++ b/tests/e2e/General/HooksTest.php @@ -1,5 +1,7 @@ assertEquals('90d', $response['body']['range']); - $this->assertEquals(90, count($response['body']['users'])); - $this->assertEquals(90, count($response['body']['sessions'])); + $this->assertCount(90, $response['body']['users']); + $this->assertCount(90, $response['body']['sessions']); $this->assertEquals((self::CREATE / 2), $response['body']['users'][array_key_last($response['body']['users'])]['value']); }); } @@ -412,7 +414,7 @@ class UsageTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('90d', $response['body']['range']); - $this->assertEquals(90, count($response['body']['presences'])); + $this->assertCount(90, $response['body']['presences']); $this->assertEquals(2, $response['body']['usersOnlineTotal']); $this->assertEquals(2, $response['body']['presences'][array_key_last($response['body']['presences'])]['value']); $this->validateDates($response['body']['presences']); @@ -1707,7 +1709,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(24, count($response['body'])); + $this->assertCount(24, $response['body']); $this->assertEquals('30d', $response['body']['range']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); @@ -1734,8 +1736,8 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(25, count($response['body'])); - $this->assertEquals($response['body']['range'], '30d'); + $this->assertCount(25, $response['body']); + $this->assertEquals('30d', $response['body']['range']); $this->assertIsArray($response['body']['functions']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); @@ -1845,7 +1847,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(30, count($response['body'])); + $this->assertCount(30, $response['body']); $this->assertEquals('30d', $response['body']['range']); $this->assertIsArray($response['body']['deployments']); $this->assertEquals($deploymentsSuccess, $response['body']['buildsSuccessTotal']); @@ -1879,8 +1881,8 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(31, count($response['body'])); - $this->assertEquals($response['body']['range'], '30d'); + $this->assertCount(31, $response['body']); + $this->assertEquals('30d', $response['body']['range']); $this->assertIsArray($response['body']['sites']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); @@ -1957,7 +1959,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $functionsResponse['headers']['status-code']); - $this->assertEquals(24, count($functionsResponse['body'])); + $this->assertCount(24, $functionsResponse['body']); $this->assertEquals('30d', $functionsResponse['body']['range']); $projectResponse = $this->client->call( @@ -1996,7 +1998,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(24, count($response['body'])); + $this->assertCount(24, $response['body']); $this->assertEquals('30d', $response['body']['range']); // Check if the new values are greater than the old values diff --git a/tests/e2e/Scopes/ApiVectorsDB.php b/tests/e2e/Scopes/ApiVectorsDB.php deleted file mode 100644 index 09494d3c10..0000000000 --- a/tests/e2e/Scopes/ApiVectorsDB.php +++ /dev/null @@ -1,110 +0,0 @@ - 'console', ], [ 'keyId' => ID::unique(), - 'name' => 'Demo Project Key', + 'name' => 'Demo Project Key ' . $project['body']['$id'], 'scopes' => [ 'users.read', 'users.write', diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 8c62c0c14a..e657f5e744 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -1,5 +1,7 @@ assertNotEmpty($response['body']['accessedAt']); $this->assertArrayHasKey('targets', $response['body']); $this->assertEquals($email, $response['body']['targets'][0]['identifier']); - $this->assertArrayNotHasKey('emailCanonical', $response['body']); - $this->assertArrayNotHasKey('emailIsFree', $response['body']); - $this->assertArrayNotHasKey('emailIsDisposable', $response['body']); - $this->assertArrayNotHasKey('emailIsCorporate', $response['body']); - $this->assertArrayNotHasKey('emailIsCanonical', $response['body']); + $this->assertEquals($email, $response['body']['emailCanonical']); + $this->assertIsBool($response['body']['emailIsFree']); + $this->assertIsBool($response['body']['emailIsDisposable']); + $this->assertIsBool($response['body']['emailIsCorporate']); + $this->assertIsBool($response['body']['emailIsCanonical']); /** * Test for FAILURE diff --git a/tests/e2e/Services/Account/AccountConsoleClientTest.php b/tests/e2e/Services/Account/AccountConsoleClientTest.php index cd2c43381c..5a3b18285e 100644 --- a/tests/e2e/Services/Account/AccountConsoleClientTest.php +++ b/tests/e2e/Services/Account/AccountConsoleClientTest.php @@ -1,5 +1,7 @@ $name, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ 'origin' => 'http://localhost', @@ -47,7 +49,7 @@ class AccountConsoleClientTest extends Scope 'password' => $password, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; @@ -61,7 +63,7 @@ class AccountConsoleClientTest extends Scope 'teamId' => 'unique()', 'name' => 'myteam' ]); - $this->assertEquals($team['headers']['status-code'], 201); + $this->assertEquals(201, $team['headers']['status-code']); // Account deletion should succeed even with active membership $response = $this->client->call(Client::METHOD_DELETE, '/account', array_merge([ @@ -94,7 +96,7 @@ class AccountConsoleClientTest extends Scope 'name' => $name, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ 'origin' => 'http://localhost', @@ -105,7 +107,7 @@ class AccountConsoleClientTest extends Scope 'password' => $password, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; @@ -169,10 +171,10 @@ class AccountConsoleClientTest extends Scope $lastEmail = $this->getLastEmailByAddress($email); $this->assertNotEmpty($lastEmail, 'Email not found for address: ' . $email); - $this->assertStringContainsString('Security alert: new session', $lastEmail['subject']); - $this->assertStringContainsString($response['body']['ip'], $lastEmail['text']); // IP Address - $this->assertStringContainsString('Unknown', $lastEmail['text']); // Country - $this->assertStringContainsString($response['body']['clientName'], $lastEmail['text']); // Client name + $this->assertStringContainsString('Security alert: new session', (string) $lastEmail['subject']); + $this->assertStringContainsString($response['body']['ip'], (string) $lastEmail['text']); // IP Address + $this->assertStringContainsString('Unknown', (string) $lastEmail['text']); // Country + $this->assertStringContainsString($response['body']['clientName'], (string) $lastEmail['text']); // Client name $this->assertStringContainsStringIgnoringCase('Appwrite logo', $lastEmail['html']); // Verify no alert sent in OTP login @@ -185,7 +187,7 @@ class AccountConsoleClientTest extends Scope 'email' => 'otpuser2@appwrite.io' ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertNotEmpty($response['body']['$createdAt']); $this->assertNotEmpty($response['body']['userId']); @@ -247,7 +249,7 @@ class AccountConsoleClientTest extends Scope 'name' => $name, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ 'origin' => 'http://localhost', @@ -258,7 +260,7 @@ class AccountConsoleClientTest extends Scope 'password' => $password, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index 5b0d947198..1928b0b1c8 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -1,5 +1,7 @@ now(); + + if ($otp !== $previousOtp) { + return $otp; + } + } while (time() < $deadline); + + $this->fail('TOTP did not rotate within the expected time window.'); + } + /** * Helper to set up a basic account */ @@ -383,7 +401,7 @@ class AccountCustomClientTest extends Scope ]); $lastEmail = $this->getLastEmailByAddress($email, function ($email) { - $this->assertStringContainsString('Password Reset', $email['subject']); + $this->assertStringContainsString('Password Reset', (string) $email['subject']); }); $tokens = $this->extractQueryParamsFromEmailLink($lastEmail['html']); $recovery = $tokens['secret']; @@ -410,7 +428,7 @@ class AccountCustomClientTest extends Scope // Use a truly unique phone number for parallel test safety // Combine microtime, PID, and random digits to avoid collisions across parallel processes - $number = '+1' . substr(str_replace('.', '', microtime(true)) . getmypid() . random_int(100, 999), -9); + $number = '+1' . substr(str_replace('.', '', (string) microtime(true)) . getmypid() . random_int(100, 999), -9); $response = $this->client->call(Client::METHOD_POST, '/account/tokens/phone', array_merge([ 'origin' => 'http://localhost', @@ -569,7 +587,7 @@ class AccountCustomClientTest extends Scope $data = $this->setupPhoneConvertedToPassword(); $session = $data['session']; // Use a truly unique phone number to avoid target conflicts across parallel test runs - $newPhone = '+456' . substr(str_replace('.', '', microtime(true)) . getmypid() . random_int(100, 999), -8); + $newPhone = '+456' . substr(str_replace('.', '', (string) microtime(true)) . getmypid() . random_int(100, 999), -8); $response = $this->client->call(Client::METHOD_PATCH, '/account/phone', array_merge([ 'origin' => 'http://localhost', @@ -1128,7 +1146,7 @@ class AccountCustomClientTest extends Scope $this->assertIsArray($logsWithIncludeTotalFalse['body']); $this->assertIsArray($logsWithIncludeTotalFalse['body']['logs']); $this->assertIsInt($logsWithIncludeTotalFalse['body']['total']); - $this->assertEquals(0, $logsWithIncludeTotalFalse['body']['total']); + $this->assertSame(0, $logsWithIncludeTotalFalse['body']['total']); $this->assertGreaterThan(0, count($logsWithIncludeTotalFalse['body']['logs'])); /** @@ -1901,7 +1919,7 @@ class AccountCustomClientTest extends Scope $this->assertTrue((new DatetimeValidator())->isValid($response['body']['expire'])); $lastEmail = $this->getLastEmailByAddress($email, function ($email) { - $this->assertStringContainsString('Password Reset', $email['subject']); + $this->assertStringContainsString('Password Reset', (string) $email['subject']); }); $this->assertNotEmpty($lastEmail, 'Email not found for address: ' . $email); @@ -2081,10 +2099,10 @@ class AccountCustomClientTest extends Scope $lastEmail = $this->getLastEmailByAddress($email); $this->assertNotEmpty($lastEmail, 'Email not found for address: ' . $email); - $this->assertStringContainsString('Security alert: new session', $lastEmail['subject']); - $this->assertStringContainsString($response['body']['ip'], $lastEmail['text']); // IP Address - $this->assertStringContainsString('Unknown', $lastEmail['text']); // Country - $this->assertStringContainsString($response['body']['clientName'], $lastEmail['text']); // Client name + $this->assertStringContainsString('Security alert: new session', (string) $lastEmail['subject']); + $this->assertStringContainsString($response['body']['ip'], (string) $lastEmail['text']); // IP Address + $this->assertStringContainsString('Unknown', (string) $lastEmail['text']); // Country + $this->assertStringContainsString($response['body']['clientName'], (string) $lastEmail['text']); // Client name $this->assertStringNotContainsStringIgnoringCase('Appwrite logo', $lastEmail['html']); // Verify no alert sent in OTP login @@ -2097,7 +2115,7 @@ class AccountCustomClientTest extends Scope 'email' => 'otpuser3@appwrite.io' ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); $this->assertNotEmpty($response['body']['$createdAt']); $this->assertNotEmpty($response['body']['userId']); @@ -2547,7 +2565,7 @@ class AccountCustomClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('a_session_' . $this->getProject()['$id'] . '=deleted', $response['headers']['set-cookie']); + $this->assertStringContainsString('a_session_' . $this->getProject()['$id'] . '=deleted', (string) $response['headers']['set-cookie']); $this->assertEquals('[]', $response['headers']['x-fallback-cookies']); $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ @@ -3459,7 +3477,7 @@ class AccountCustomClientTest extends Scope public function testUpdatePhone(): void { $data = $this->setupPhoneConvertedToPassword(); - $newPhone = '+456' . substr(str_replace('.', '', microtime(true)) . getmypid() . random_int(100, 999), -8); + $newPhone = '+456' . substr(str_replace('.', '', (string) microtime(true)) . getmypid() . random_int(100, 999), -8); $session = $data['session']; /** @@ -4142,6 +4160,278 @@ class AccountCustomClientTest extends Scope $this->assertEquals(401, $verification3['headers']['status-code']); } + public function testRegenerateMFARecoveryCodesRequiresRecentChallenge(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $recoveryCodes = $this->client->call(Client::METHOD_POST, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(201, $recoveryCodes['headers']['status-code']); + $this->assertNotEmpty($recoveryCodes['body']['recoveryCodes']); + + $regenerateWithoutChallenge = $this->client->call(Client::METHOD_PATCH, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(401, $regenerateWithoutChallenge['headers']['status-code']); + $this->assertEquals('user_challenge_required', $regenerateWithoutChallenge['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ + 'factor' => 'recoveryCode', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $recoveryCodes['body']['recoveryCodes'][0], + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $regeneratedCodes = $this->client->call(Client::METHOD_PATCH, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(200, $regeneratedCodes['headers']['status-code']); + $this->assertNotEmpty($regeneratedCodes['body']['recoveryCodes']); + $this->assertNotEquals($recoveryCodes['body']['recoveryCodes'], $regeneratedCodes['body']['recoveryCodes']); + } + + public function testDeleteMFAAuthenticatorRequiresRecentChallenge(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + + $recoveryCodes = $this->client->call(Client::METHOD_POST, '/account/mfa/recovery-codes', $headers); + + $this->assertEquals(201, $recoveryCodes['headers']['status-code']); + $this->assertNotEmpty($recoveryCodes['body']['recoveryCodes']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + $enrollmentOtp = $totp->now(); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $enrollmentOtp, + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $deleteWithoutChallenge = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(401, $deleteWithoutChallenge['headers']['status-code']); + $this->assertEquals('user_challenge_required', $deleteWithoutChallenge['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ + 'factor' => 'recoveryCode', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $recoveryCodes['body']['recoveryCodes'][0], + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertArrayHasKey('mfaUpdatedAt', $challengeVerification['body']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $delete = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(204, $delete['headers']['status-code']); + } + + public function testMFAAuthenticatorLifecycle(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $factors = $this->client->call(Client::METHOD_GET, '/account/mfa/factors', $headers); + + $this->assertEquals(200, $factors['headers']['status-code']); + $this->assertFalse($factors['body']['totp']); + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + $this->assertNotEmpty($authenticator['body']['uri']); + + $factors = $this->client->call(Client::METHOD_GET, '/account/mfa/factors', $headers); + + $this->assertEquals(200, $factors['headers']['status-code']); + $this->assertFalse($factors['body']['totp']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + $invalidOtp = $totp->now() === '000000' ? '111111' : '000000'; + + $invalidVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $invalidOtp, + ]); + + $this->assertEquals(401, $invalidVerification['headers']['status-code']); + $this->assertEquals('user_invalid_token', $invalidVerification['body']['type']); + + $enrollmentOtp = $totp->now(); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $enrollmentOtp, + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $factors = $this->client->call(Client::METHOD_GET, '/account/mfa/factors', $headers); + + $this->assertEquals(200, $factors['headers']['status-code']); + $this->assertTrue($factors['body']['totp']); + + $duplicateAuthenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(409, $duplicateAuthenticator['headers']['status-code']); + $this->assertEquals('user_authenticator_already_verified', $duplicateAuthenticator['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $headers, [ + 'factor' => 'totp', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $invalidChallengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $invalidOtp, + ]); + + $this->assertEquals(401, $invalidChallengeVerification['headers']['status-code']); + $this->assertEquals('user_invalid_token', $invalidChallengeVerification['body']['type']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $headers, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $this->getNextTOTP($totp, $enrollmentOtp), + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertContains('totp', $challengeVerification['body']['factors']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $delete = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(204, $delete['headers']['status-code']); + + $deleteAgain = $this->client->call(Client::METHOD_DELETE, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(404, $deleteAgain['headers']['status-code']); + $this->assertEquals('user_authenticator_not_found', $deleteAgain['body']['type']); + } + + public function testMFAAuthenticatorCompletesEmailPasswordSession(): void + { + $data = $this->createFreshAccountWithSession(); + $projectId = $this->getProject()['$id']; + + $headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $data['session'], + ]; + + $authenticator = $this->client->call(Client::METHOD_POST, '/account/mfa/authenticators/totp', $headers); + + $this->assertEquals(200, $authenticator['headers']['status-code']); + $this->assertNotEmpty($authenticator['body']['secret']); + + $totp = \OTPHP\TOTP::create($authenticator['body']['secret']); + $enrollmentOtp = $totp->now(); + + $verification = $this->client->call(Client::METHOD_PUT, '/account/mfa/authenticators/totp', $headers, [ + 'otp' => $enrollmentOtp, + ]); + + $this->assertEquals(200, $verification['headers']['status-code']); + + $mfa = $this->client->call(Client::METHOD_PATCH, '/account/mfa', $headers, [ + 'mfa' => true, + ]); + + $this->assertEquals(200, $mfa['headers']['status-code']); + $this->assertTrue($mfa['body']['mfa']); + + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => $data['email'], + 'password' => $data['password'], + ]); + + $this->assertEquals(201, $session['headers']['status-code']); + $this->assertEquals(['password'], $session['body']['factors']); + $this->assertNotEmpty($session['cookies']['a_session_' . $projectId]); + + $newSessionHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $session['cookies']['a_session_' . $projectId], + ]; + + $account = $this->client->call(Client::METHOD_GET, '/account', $newSessionHeaders); + + $this->assertEquals(401, $account['headers']['status-code']); + $this->assertEquals('user_more_factors_required', $account['body']['type']); + + $challenge = $this->client->call(Client::METHOD_POST, '/account/mfa/challenges', $newSessionHeaders, [ + 'factor' => 'totp', + ]); + + $this->assertEquals(201, $challenge['headers']['status-code']); + $this->assertNotEmpty($challenge['body']['$id']); + + $challengeVerification = $this->client->call(Client::METHOD_PUT, '/account/mfa/challenges', $newSessionHeaders, [ + 'challengeId' => $challenge['body']['$id'], + 'otp' => $this->getNextTOTP($totp, $enrollmentOtp), + ]); + + $this->assertEquals(200, $challengeVerification['headers']['status-code']); + $this->assertContains('password', $challengeVerification['body']['factors']); + $this->assertContains('totp', $challengeVerification['body']['factors']); + $this->assertNotEmpty($challengeVerification['body']['mfaUpdatedAt']); + + $account = $this->client->call(Client::METHOD_GET, '/account', $newSessionHeaders); + + $this->assertEquals(200, $account['headers']['status-code']); + $this->assertEquals($data['id'], $account['body']['$id']); + } + public function testRefreshEmailPasswordSession(): void { $email = uniqid() . 'user@localhost.test'; diff --git a/tests/e2e/Services/Account/AccountCustomServerTest.php b/tests/e2e/Services/Account/AccountCustomServerTest.php index b5c4ebe103..fa77e4a1a6 100644 --- a/tests/e2e/Services/Account/AccountCustomServerTest.php +++ b/tests/e2e/Services/Account/AccountCustomServerTest.php @@ -1,5 +1,7 @@ getHeaders(), )); - $this->assertEquals($response['headers']['status-code'], 200); + $this->assertEquals(200, $response['headers']['status-code']); $this->assertArrayHasKey('accessedAt', $response['body']); $this->assertNotEmpty($response['body']['accessedAt']); @@ -375,7 +377,7 @@ class AccountCustomServerTest extends Scope ] )); - $this->assertEquals($response['headers']['status-code'], 200); + $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']); $this->assertNotEmpty($response['body']['$id']); $this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['registration'])); diff --git a/tests/e2e/Services/Advisor/AdvisorCustomServerTest.php b/tests/e2e/Services/Advisor/AdvisorCustomServerTest.php index d91f95035e..23914e1d05 100644 --- a/tests/e2e/Services/Advisor/AdvisorCustomServerTest.php +++ b/tests/e2e/Services/Advisor/AdvisorCustomServerTest.php @@ -1,5 +1,7 @@ assertIsInt($response['body']['total']); $this->assertIsArray($response['body']['oAuth2Providers']); $this->assertGreaterThan(0, $response['body']['total']); - $this->assertEquals($response['body']['total'], \count($response['body']['oAuth2Providers'])); + $this->assertCount($response['body']['total'], $response['body']['oAuth2Providers']); $providerIds = \array_column($response['body']['oAuth2Providers'], '$id'); $this->assertEquals('amazon', $providerIds[0]); @@ -142,7 +144,7 @@ class ConsoleConsoleClientTest extends Scope $this->assertIsInt($response['body']['total']); $this->assertIsArray($response['body']['scopes']); $this->assertGreaterThan(0, $response['body']['total']); - $this->assertEquals($response['body']['total'], \count($response['body']['scopes'])); + $this->assertCount($response['body']['total'], $response['body']['scopes']); $scopeIds = \array_column($response['body']['scopes'], '$id'); @@ -187,7 +189,7 @@ class ConsoleConsoleClientTest extends Scope $this->assertIsInt($response['body']['total']); $this->assertIsArray($response['body']['scopes']); $this->assertGreaterThan(0, $response['body']['total']); - $this->assertEquals($response['body']['total'], \count($response['body']['scopes'])); + $this->assertCount($response['body']['total'], $response['body']['scopes']); $scopeIds = \array_column($response['body']['scopes'], '$id'); diff --git a/tests/e2e/Services/Console/ConsoleCustomClientTest.php b/tests/e2e/Services/Console/ConsoleCustomClientTest.php index 4b78b7f43c..c2b32d8b9f 100644 --- a/tests/e2e/Services/Console/ConsoleCustomClientTest.php +++ b/tests/e2e/Services/Console/ConsoleCustomClientTest.php @@ -1,5 +1,7 @@ authorization)) { - return $this->authorization; - } - - $this->authorization = new Authorization(); - - return $this->authorization; - } - - public function createCollection(): array - { - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::unique(), - 'name' => 'VectorGuestDB', - ]); - $this->assertEquals(201, $database['headers']['status-code']); - $this->assertEquals('VectorGuestDB', $database['body']['name']); - - $databaseId = $database['body']['$id']; - $publicMovies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), - 'name' => 'Movies', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::any()), - Permission::create(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - ]); - $privateMovies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), - 'name' => 'Movies', - 'dimension' => 3, - 'permissions' => [], - 'documentSecurity' => true, - ]); - - $publicCollection = ['id' => $publicMovies['body']['$id']]; - $privateCollection = ['id' => $privateMovies['body']['$id']]; - - return [ - 'databaseId' => $databaseId, - 'publicCollectionId' => $publicCollection['id'], - 'privateCollectionId' => $privateCollection['id'], - ]; - } - - public static function permissionsProvider(): array - { - return [ - [[Permission::read(Role::any())]], - [[Permission::read(Role::users())]], - [[Permission::update(Role::any()), Permission::delete(Role::any())]], - [[Permission::read(Role::any()), Permission::update(Role::any()), Permission::delete(Role::any())]], - [[Permission::read(Role::users()), Permission::update(Role::users()), Permission::delete(Role::users())]], - [[Permission::read(Role::any()), Permission::update(Role::users()), Permission::delete(Role::users())]], - ]; - } - - #[DataProvider('permissionsProvider')] - public function testReadDocuments($permissions) - { - $data = $this->createCollection(); - $publicCollectionId = $data['publicCollectionId']; - $privateCollectionId = $data['privateCollectionId']; - $databaseId = $data['databaseId']; - - $publicResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ], - 'permissions' => $permissions, - ]); - $privateResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ], - 'permissions' => $permissions, - ]); - - $this->assertEquals(201, $publicResponse['headers']['status-code']); - $this->assertEquals(201, $privateResponse['headers']['status-code']); - - $roles = $this->getAuthorization()->getRoles(); - $this->getAuthorization()->cleanRoles(); - - $publicDocuments = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ]); - $privateDocuments = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ]); - - $this->assertEquals(1, $publicDocuments['body']['total']); - $this->assertEquals($permissions, $publicDocuments['body']['documents'][0]['$permissions']); - - if (\in_array(Permission::read(Role::any()), $permissions)) { - $this->assertEquals(1, $privateDocuments['body']['total']); - $this->assertEquals($permissions, $privateDocuments['body']['documents'][0]['$permissions']); - } else { - $this->assertEquals(0, $privateDocuments['body']['total']); - } - - foreach ($roles as $role) { - $this->getAuthorization()->addRole($role); - } - } - - public function testWriteDocument() - { - $data = $this->createCollection(); - $publicCollectionId = $data['publicCollectionId']; - $privateCollectionId = $data['privateCollectionId']; - $databaseId = $data['databaseId']; - - $roles = $this->getAuthorization()->getRoles(); - $this->getAuthorization()->cleanRoles(); - - $publicResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ] - ]); - - $publicDocumentId = $publicResponse['body']['$id']; - $this->assertEquals(201, $publicResponse['headers']['status-code']); - - $privateResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ], - ]); - - $this->assertEquals(401, $privateResponse['headers']['status-code']); - - // Create a document in private collection with API key so we can test that update and delete are also not allowed - $privateResponse = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 0.0, 1.0], - 'metadata' => ['title' => 'Lorem'], - ], - ]); - - $this->assertEquals(201, $privateResponse['headers']['status-code']); - $privateDocumentId = $privateResponse['body']['$id']; - - $publicDocument = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents/' . $publicDocumentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], [ - 'data' => [ - 'embeddings' => [0.5, 0.5, 0.0], - 'metadata' => ['title' => 'Thor: Ragnarok'], - ], - ]); - - $this->assertEquals(200, $publicDocument['headers']['status-code']); - $this->assertEquals('Thor: Ragnarok', $publicDocument['body']['metadata']['title']); - - $privateDocument = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents/' . $privateDocumentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], [ - 'data' => [ - 'embeddings' => [0.2, 0.3, 0.5], - 'metadata' => ['title' => 'Thor: Ragnarok'], - ], - ]); - - $this->assertEquals(401, $privateDocument['headers']['status-code']); - - $publicDocument = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/' . $publicCollectionId . '/documents/' . $publicDocumentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ]); - - $this->assertEquals(204, $publicDocument['headers']['status-code']); - - $privateDocument = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/' . $privateCollectionId . '/documents/' . $privateDocumentId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ]); - - $this->assertEquals(401, $privateDocument['headers']['status-code']); - - foreach ($roles as $role) { - $this->getAuthorization()->addRole($role); - } - } - - public function testWriteDocumentWithPermissions() - { - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::unique(), - 'name' => 'VectorGuestPermsWrite', - ]); - $this->assertEquals(201, $database['headers']['status-code']); - $this->assertEquals('VectorGuestPermsWrite', $database['body']['name']); - - $databaseId = $database['body']['$id']; - $movies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), - 'name' => 'Movies', - 'dimension' => 3, - 'permissions' => [ - Permission::create(Role::any()), - ], - 'documentSecurity' => true - ]); - - $moviesId = $movies['body']['$id']; - - $document = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $moviesId . '/documents', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['title' => 'Thor: Ragnarok'], - ], - 'permissions' => [ - Permission::read(Role::any()), - ] - ]); - - $this->assertEquals(201, $document['headers']['status-code']); - $this->assertEquals('Thor: Ragnarok', $document['body']['metadata']['title']); - } -} diff --git a/tests/e2e/Services/Databases/Permissions/VectorsDBPermissionsMemberTest.php b/tests/e2e/Services/Databases/Permissions/VectorsDBPermissionsMemberTest.php deleted file mode 100644 index 3043a42dd5..0000000000 --- a/tests/e2e/Services/Databases/Permissions/VectorsDBPermissionsMemberTest.php +++ /dev/null @@ -1,197 +0,0 @@ - $this->createUser('user1', 'lorem@ipsum.com'), - 'user2' => $this->createUser('user2', 'dolor@ipsum.com'), - ]; - } - - public static function permissionsProvider(): array - { - return [ - [[Permission::read(Role::any())], 1, 1, 1], - [[Permission::read(Role::users())], 2, 2, 2], - [[Permission::read(Role::user(ID::custom('random')))], 3, 3, 2], - [[Permission::read(Role::user(ID::custom('lorem'))), Permission::update(Role::user('lorem')), Permission::delete(Role::user('lorem'))], 4, 4, 2], - [[Permission::read(Role::user(ID::custom('dolor'))), Permission::update(Role::user('dolor')), Permission::delete(Role::user('dolor'))], 5, 5, 2], - [[Permission::read(Role::user(ID::custom('dolor'))), Permission::read(Role::user('lorem')), Permission::update(Role::user('dolor')), Permission::delete(Role::user('dolor'))], 6, 6, 2], - [[Permission::update(Role::any()), Permission::delete(Role::any())], 7, 7, 2], - [[Permission::read(Role::any()), Permission::update(Role::any()), Permission::delete(Role::any())], 8, 8, 3], - [[Permission::read(Role::any()), Permission::update(Role::users()), Permission::delete(Role::users())], 9, 9, 4], - [[Permission::read(Role::user(ID::custom('user1')))], 10, 10, 5], - [[Permission::read(Role::user(ID::custom('user1'))), Permission::read(Role::user(ID::custom('user1')))], 11, 11, 6], - [[Permission::read(Role::users()), Permission::update(Role::users()), Permission::delete(Role::users())], 12, 12, 7], - ]; - } - - /** - * Setup database - * - * Data providers lose object state so explicitly pass [$users, $collections] to each iteration - * - * @return array - * @throws \Exception - */ - public function testSetupDatabase(): array - { - $this->createUsers(); - - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', $this->getServerHeader(), [ - 'databaseId' => ID::unique(), - 'name' => 'Test Database', - ]); - $this->assertEquals(201, $db['headers']['status-code']); - - $databaseId = $db['body']['$id']; - - $public = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), - 'name' => 'Movies', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::any()), - Permission::create(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'documentSecurity' => true, - ]); - $this->assertEquals(201, $public['headers']['status-code']); - $this->collections = ['public' => $public['body']['$id']]; - - $private = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), - 'name' => 'Private Movies', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::users()), - Permission::create(Role::users()), - Permission::update(Role::users()), - Permission::delete(Role::users()), - ], - 'documentSecurity' => true, - ]); - $this->assertEquals(201, $private['headers']['status-code']); - $this->collections['private'] = $private['body']['$id']; - - $doconly = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::unique(), - 'name' => 'Document Only Movies', - 'dimension' => 3, - 'permissions' => [], - 'documentSecurity' => true, - ]); - $this->assertEquals(201, $private['headers']['status-code']); - $this->collections['doconly'] = $doconly['body']['$id']; - - return [ - 'users' => $this->users, - 'collections' => $this->collections, - 'databaseId' => $databaseId - ]; - } - - /** - * Data provider params are passed before test dependencies. - */ - #[DataProvider('permissionsProvider')] - #[Depends('testSetupDatabase')] - public function testReadDocuments($permissions, $anyCount, $usersCount, $docOnlyCount, $data) - { - $users = $data['users']; - $collections = $data['collections']; - $databaseId = $data['databaseId']; - - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $collections['public'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ], - 'permissions' => $permissions - ]); - $this->assertEquals(201, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $collections['private'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ], - 'permissions' => $permissions - ]); - $this->assertEquals(201, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 0.0, 1.0], - 'metadata' => ['title' => 'Lorem'], - ], - 'permissions' => $permissions - ]); - $this->assertEquals(201, $response['headers']['status-code']); - - /** - * Check "any" permission collection - */ - $documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collections['public'] . '/documents', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $users['user1']['session'], - ]); - - $this->assertEquals(200, $documents['headers']['status-code']); - $this->assertEquals($anyCount, $documents['body']['total']); - - /** - * Check "users" permission collection - */ - $documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collections['private'] . '/documents', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $users['user1']['session'], - ]); - - $this->assertEquals(200, $documents['headers']['status-code']); - $this->assertEquals($usersCount, $documents['body']['total']); - - /** - * Check "user:user1" document only permission collection - */ - $documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collections['doconly'] . '/documents', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $users['user1']['session'], - ]); - - $this->assertEquals(200, $documents['headers']['status-code']); - $this->assertEquals($docOnlyCount, $documents['body']['total']); - } -} diff --git a/tests/e2e/Services/Databases/Permissions/VectorsDBPermissionsTeamTest.php b/tests/e2e/Services/Databases/Permissions/VectorsDBPermissionsTeamTest.php deleted file mode 100644 index 11709ed729..0000000000 --- a/tests/e2e/Services/Databases/Permissions/VectorsDBPermissionsTeamTest.php +++ /dev/null @@ -1,200 +0,0 @@ - $this->createTeam('team1', 'Team 1'), - 'team2' => $this->createTeam('team2', 'Team 2'), - ]; - } - - public function createUsers(): array - { - return [ - 'user1' => $this->createUser('user1', 'lorem@ipsum.com'), - 'user2' => $this->createUser('user2', 'dolor@ipsum.com'), - 'user3' => $this->createUser('user3', 'sit@ipsum.com'), - ]; - } - - public function createCollections($teams) - { - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', $this->getServerHeader(), [ - 'databaseId' => $this->databaseId, - 'name' => 'Test Database', - ]); - $this->assertEquals(201, $db['headers']['status-code']); - - $collection1 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::custom('collection1'), - 'name' => 'Collection 1', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::team($teams['team1']['$id'])), - Permission::create(Role::team($teams['team1']['$id'], 'admin')), - Permission::update(Role::team($teams['team1']['$id'], 'admin')), - Permission::delete(Role::team($teams['team1']['$id'], 'admin')), - ], - ]); - - $this->collections['collection1'] = $collection1['body']['$id']; - - $collection2 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections', $this->getServerHeader(), [ - 'collectionId' => ID::custom('collection2'), - 'name' => 'Collection 2', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::team($teams['team2']['$id'])), - Permission::create(Role::team($teams['team2']['$id'], 'owner')), - Permission::update(Role::team($teams['team2']['$id'], 'owner')), - Permission::delete(Role::team($teams['team2']['$id'], 'owner')), - ] - ]); - - $this->collections['collection2'] = $collection2['body']['$id']; - - return $this->collections; - } - - /* - * $success = can $user read from $collection - * [$user, $collection, $success] - */ - public static function readDocumentsProvider(): array - { - return [ - ['user1', 'collection1', true], - ['user2', 'collection1', false], - ['user3', 'collection1', true], - ['user1', 'collection2', false], - ['user2', 'collection2', true], - ['user3', 'collection2', true], - ]; - } - - /* - * $success = can $user write to $collection - * [$user, $collection, $success] - */ - public static function writeDocumentsProvider(): array - { - return [ - ['user1', 'collection1', true], - ['user2', 'collection1', false], - ['user3', 'collection1', false], - ['user1', 'collection2', false], - ['user2', 'collection2', true], - ['user3', 'collection2', false], - ]; - } - - /** - * Setup database - * - * Data providers lose object state - * so explicitly pass $users to each iteration - * @return array $users - */ - public function testSetupDatabase(): array - { - $this->createUsers(); - $this->createTeams(); - - $this->addToTeam('user1', 'team1', ['admin']); - $this->addToTeam('user2', 'team2', ['owner']); - - // user3 in both teams but with no roles - $this->addToTeam('user3', 'team1'); - $this->addToTeam('user3', 'team2'); - - $this->createCollections($this->teams); - - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections/' . $this->collections['collection1'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['title' => 'Lorem'], - ], - ]); - $this->assertEquals(201, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections/' . $this->collections['collection2'] . '/documents', $this->getServerHeader(), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['title' => 'Ipsum'], - ], - ]); - $this->assertEquals(201, $response['headers']['status-code']); - - return $this->users; - } - - /** - * Data provider params are passed before test dependencies. - */ - #[Depends('testSetupDatabase')] - #[DataProvider('readDocumentsProvider')] - public function testReadDocuments($user, $collection, $success, $users) - { - $documents = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $this->databaseId . '/collections/' . $collection . '/documents', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $users[$user]['session'], - ]); - - if ($success) { - $this->assertCount(1, $documents['body']['documents']); - } else { - $this->assertEquals(401, $documents['headers']['status-code']); - } - } - - #[Depends('testSetupDatabase')] - #[DataProvider('writeDocumentsProvider')] - public function testWriteDocuments($user, $collection, $success, $users) - { - $documents = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $this->databaseId . '/collections/' . $collection . '/documents', [ - 'origin' => 'http://localhost', - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $users[$user]['session'], - ], [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.2, 0.3, 0.5], - 'metadata' => ['title' => 'Ipsum'], - ], - ]); - - if ($success) { - $this->assertEquals(201, $documents['headers']['status-code']); - } else { - // 401 if user is a part of team, 404 otherwise - $this->assertContains($documents['headers']['status-code'], [401, 404]); - } - } -} diff --git a/tests/e2e/Services/Databases/Transactions/DocumentsDBACIDTest.php b/tests/e2e/Services/Databases/Transactions/DocumentsDBACIDTest.php index eb597e3488..3839b3afb2 100644 --- a/tests/e2e/Services/Databases/Transactions/DocumentsDBACIDTest.php +++ b/tests/e2e/Services/Databases/Transactions/DocumentsDBACIDTest.php @@ -1,5 +1,7 @@ client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::unique(), - 'name' => 'AtomicityTestDB' - ]); - - $this->assertEquals(201, $database['headers']['status-code']); - $databaseId = $database['body']['$id']; - - // Create collection for the test - $collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'collectionId' => ID::unique(), - 'name' => 'AtomicityTest', - 'dimension' => 3, - 'documentSecurity' => false, - 'permissions' => [ - Permission::create(Role::any()), - Permission::read(Role::any()), - ], - ]); - - $this->assertEquals(201, $collection['headers']['status-code']); - $collectionId = $collection['body']['$id']; - - // Create a document outside the transaction - $existingDocumentId = 'existing_doc'; - $doc1 = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'documentId' => $existingDocumentId, - 'data' => [ - 'embeddings' => $this->generateEmbeddings(3), - 'metadata' => ['email' => 'existing@example.com'], - ], - ]); - - $this->assertEquals(201, $doc1['headers']['status-code']); - - // Create transaction - $transaction = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - - $this->assertEquals(201, $transaction['headers']['status-code'], 'Transaction creation should succeed. Response: ' . json_encode($transaction)); - $this->assertArrayHasKey('$id', $transaction['body'], 'Transaction response should have $id. Response body: ' . json_encode($transaction['body'])); - $transactionId = $transaction['body']['$id']; - - // Add operations - second create reuses an existing documentId and should cause the commit to fail - $response = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'documents' => [ - [ - '$id' => 'txn_doc_1', - 'embeddings' => $this->generateEmbeddings(3, 0.2), - 'metadata' => ['email' => 'newuser@example.com'], - ], - [ - '$id' => $existingDocumentId, - 'embeddings' => $this->generateEmbeddings(3, 0.3), - 'metadata' => ['email' => 'duplicate@example.com'], - ], - [ - '$id' => 'txn_doc_2', - 'embeddings' => $this->generateEmbeddings(3, 0.4), - 'metadata' => ['email' => 'should-not-exist@example.com'], - ], - ], - 'transactionId' => $transactionId, - ]); - - $this->assertEquals(200, $response['headers']['status-code'], 'Adding documents via normal route should succeed. Response: ' . json_encode($response['body'])); - - // Attempt to commit - should fail due to duplicate document ID - $response = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId}", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'commit' => true - ]); - - $this->assertEquals(409, $response['headers']['status-code']); - - // Verify NO new documents were created (atomicity) - $documents = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(1, $documents['body']['total']); - $this->assertEquals('existing@example.com', $documents['body']['documents'][0]['metadata']['email']); - } - - /** - * Test consistency - schema validation and constraints - */ - public function testConsistency(): void - { - // Create database - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::unique(), - 'name' => 'ConsistencyTestDB' - ]); - - $this->assertEquals(201, $database['headers']['status-code']); - $databaseId = $database['body']['$id']; - - // Create collection - $collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'collectionId' => ID::unique(), - 'name' => 'ConsistencyTest', - 'dimension' => 3, - 'documentSecurity' => false, - 'permissions' => [ - Permission::create(Role::any()), - Permission::read(Role::any()), - ], - ]); - - $this->assertEquals(201, $collection['headers']['status-code']); - $collectionId = $collection['body']['$id']; - - // Create transaction - $transaction = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - - $transactionId = $transaction['body']['$id']; - - // Stage operations with valid and invalid data (embedding length mismatch) - $response = $this->client->call(Client::METHOD_POST, "/vectorsdb/transactions/{$transactionId}/operations", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'operations' => [ - [ - 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'action' => 'create', - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => $this->generateEmbeddings(3, 0.2), - 'metadata' => ['name' => 'Valid User'], - ], - ], - [ - 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'action' => 'create', - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => $this->generateEmbeddings(2, 0.5), // Invalid dimensions - 'metadata' => ['name' => 'Invalid User'], - ], - ], - [ - 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'action' => 'create', - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => $this->generateEmbeddings(3, 0.6), - 'metadata' => ['name' => 'Should Not Persist'], - ], - ], - ], - ]); - - $this->assertEquals(201, $response['headers']['status-code']); - - // Attempt to commit - should fail due to invalid embeddings - $response = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId}", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'commit' => true - ]); - - $this->assertContains($response['headers']['status-code'], [400, 409, 500], 'Transaction commit should fail due to validation. Response: ' . json_encode($response['body'])); - - // Verify no documents were created - $documents = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(0, $documents['body']['total']); - } - - /** - * Test isolation - concurrent transactions on same data - */ - public function testIsolation(): void - { - // Create database - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::unique(), - 'name' => 'IsolationTestDB' - ]); - - $this->assertEquals(201, $database['headers']['status-code']); - $databaseId = $database['body']['$id']; - - // Create collection - $collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'collectionId' => ID::unique(), - 'name' => 'IsolationTest', - 'dimension' => 3, - 'documentSecurity' => false, - 'permissions' => [ - Permission::create(Role::any()), - Permission::read(Role::any()), - Permission::update(Role::any()), - ], - ]); - - $collectionId = $collection['body']['$id']; - - // Create initial document with status metadata - $doc = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'documentId' => 'shared_doc', - 'data' => [ - 'embeddings' => $this->generateEmbeddings(3), - 'metadata' => ['status' => 'pending'], - ], - ]); - - $this->assertEquals(201, $doc['headers']['status-code']); - - // Create first transaction - $transaction1 = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - - $this->assertEquals(201, $transaction1['headers']['status-code'], 'Transaction 1 creation should succeed'); - $this->assertArrayHasKey('$id', $transaction1['body'], 'Transaction 1 response should have $id'); - $transactionId1 = $transaction1['body']['$id']; - - // Transaction 1: update status to approved - $this->client->call(Client::METHOD_POST, "/vectorsdb/transactions/{$transactionId1}/operations", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'operations' => [ - [ - 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'action' => 'update', - 'documentId' => 'shared_doc', - 'data' => [ - 'metadata' => ['status' => 'approved'], - ], - ], - ], - ]); - - // Commit first transaction - $response1 = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId1}", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'commit' => true - ]); - $this->assertEquals(200, $response1['headers']['status-code']); - - // Document should reflect the first transaction's update - $document = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/shared_doc", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals('approved', $document['body']['metadata']['status']); - - // Create second transaction after first commit - $transaction2 = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - - $this->assertEquals(201, $transaction2['headers']['status-code'], 'Transaction 2 creation should succeed'); - $this->assertArrayHasKey('$id', $transaction2['body'], 'Transaction 2 response should have $id'); - $transactionId2 = $transaction2['body']['$id']; - - // Transaction 2: update status to declined - $this->client->call(Client::METHOD_POST, "/vectorsdb/transactions/{$transactionId2}/operations", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'operations' => [ - [ - 'databaseId' => $databaseId, - 'collectionId' => $collectionId, - 'action' => 'update', - 'documentId' => 'shared_doc', - 'data' => [ - 'metadata' => ['status' => 'declined'], - ], - ], - ], - ]); - - // Commit second transaction and ensure isolation guarantees - $response2 = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId2}", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'commit' => true - ]); - - $this->assertEquals(200, $response2['headers']['status-code']); - - // Final document should reflect the second transaction's update - $document = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/shared_doc", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals('declined', $document['body']['metadata']['status']); - } - - /** - * Test durability - committed data persists - */ - public function testDurability(): void - { - // Create database - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::unique(), - 'name' => 'DurabilityTestDB' - ]); - - $this->assertEquals(201, $database['headers']['status-code']); - $databaseId = $database['body']['$id']; - - // Create collection - $collection = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'collectionId' => ID::unique(), - 'name' => 'DurabilityTest', - 'dimension' => 3, - 'documentSecurity' => false, - 'permissions' => [ - Permission::create(Role::any()), - Permission::read(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - ]); - - $this->assertEquals(201, $collection['headers']['status-code']); - $collectionId = $collection['body']['$id']; - - // Create transaction with multiple operations - $transaction = $this->client->call(Client::METHOD_POST, '/vectorsdb/transactions', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - - $this->assertEquals(201, $transaction['headers']['status-code'], 'Transaction creation should succeed'); - $this->assertArrayHasKey('$id', $transaction['body'], 'Transaction response should have $id'); - $transactionId = $transaction['body']['$id']; - - // Create two documents via normal route inside transaction - $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'documents' => [ - [ - '$id' => 'durable_doc_1', - 'embeddings' => $this->generateEmbeddings(3, 0.3), - 'metadata' => ['data' => 'Important data 1'], - ], - [ - '$id' => 'durable_doc_2', - 'embeddings' => $this->generateEmbeddings(3, 0.5), - 'metadata' => ['data' => 'Important data 2'], - ], - ], - 'transactionId' => $transactionId, - ]); - - // Update first document inside the same transaction - $this->client->call(Client::METHOD_PATCH, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'data' => [ - 'metadata' => ['data' => 'Updated important data 1'], - ], - 'transactionId' => $transactionId, - ]); - - // Commit transaction - $response = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/transactions/{$transactionId}", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'commit' => true - ]); - - $this->assertEquals(200, $response['headers']['status-code'], 'Commit should succeed. Response: ' . json_encode($response['body'])); - $this->assertEquals('committed', $response['body']['status']); - - // Verify documents exist and have correct data - $document1 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(200, $document1['headers']['status-code']); - $this->assertEquals('Updated important data 1', $document1['body']['metadata']['data']); - - $document2 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_2", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(200, $document2['headers']['status-code']); - $this->assertEquals('Important data 2', $document2['body']['metadata']['data']); - - // Further update outside transaction to ensure persistence - $update = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'data' => [ - 'metadata' => ['data' => 'Modified outside transaction'], - ], - ]); - $this->assertEquals(200, $update['headers']['status-code']); - - // Verify the update persisted - $document1 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/durable_doc_1", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals('Modified outside transaction', $document1['body']['metadata']['data']); - - // List all documents to verify total count - $documents = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(2, $documents['body']['total']); - } -} diff --git a/tests/e2e/Services/Databases/Transactions/VectorsDBTransactionsConsoleClientTest.php b/tests/e2e/Services/Databases/Transactions/VectorsDBTransactionsConsoleClientTest.php deleted file mode 100644 index f6f217ab69..0000000000 --- a/tests/e2e/Services/Databases/Transactions/VectorsDBTransactionsConsoleClientTest.php +++ /dev/null @@ -1,15 +0,0 @@ -assertEquals(201, $movies['headers']['status-code']); - $this->assertEquals($movies['body']['name'], 'Movies'); + $this->assertEquals('Movies', $movies['body']['name']); /** * Test when database is disabled but can still create collections @@ -94,7 +96,7 @@ class DatabasesConsoleClientTest extends Scope ]); $this->assertEquals(201, $tvShows['headers']['status-code']); - $this->assertEquals($tvShows['body']['name'], 'TvShows'); + $this->assertEquals('TvShows', $tvShows['body']['name']); return ['moviesId' => $movies['body']['$id'], 'databaseId' => $databaseId, 'tvShowsId' => $tvShows['body']['$id']]; } @@ -174,7 +176,7 @@ class DatabasesConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); - $this->assertEquals($response['body'], ""); + $this->assertEquals("", $response['body']); } #[Depends('testCreateCollection')] @@ -206,7 +208,7 @@ class DatabasesConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(11, count($response['body'])); + $this->assertCount(11, $response['body']); $this->assertEquals('24h', $response['body']['range']); $this->assertIsNumeric($response['body']['documentsTotal']); $this->assertIsNumeric($response['body']['collectionsTotal']); @@ -251,7 +253,7 @@ class DatabasesConsoleClientTest extends Scope 'range' => '24h' ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(3, count($response['body'])); + $this->assertCount(3, $response['body']); $this->assertEquals('24h', $response['body']['range']); $this->assertIsNumeric($response['body']['documentsTotal']); $this->assertIsArray($response['body']['documents']); diff --git a/tests/e2e/Services/Databases/VectorsDB/DatabasesCustomClientTest.php b/tests/e2e/Services/Databases/VectorsDB/DatabasesCustomClientTest.php index b27cb420b4..0ff3b7a46e 100644 --- a/tests/e2e/Services/Databases/VectorsDB/DatabasesCustomClientTest.php +++ b/tests/e2e/Services/Databases/VectorsDB/DatabasesCustomClientTest.php @@ -1,5 +1,7 @@ client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'databaseId' => ID::unique(), - 'name' => 'Vector Console DB', - ]); - $this->assertEquals(201, $database['headers']['status-code']); - $this->assertEquals('Vector Console DB', $database['body']['name']); - $this->assertTrue($database['body']['enabled']); - - $databaseId = $database['body']['$id']; - - /** - * Test for SUCCESS - */ - $movies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'collectionId' => ID::unique(), - 'name' => 'Movies', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::any()), - Permission::create(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'documentSecurity' => true, - ]); - - $this->assertEquals(201, $movies['headers']['status-code']); - $this->assertEquals($movies['body']['name'], 'Movies'); - - /** - * Test when database is disabled but can still create collections - */ - $database = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => 'Vector Console DB Updated', - 'enabled' => false, - ]); - - $this->assertFalse($database['body']['enabled']); - - $tvShows = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'collectionId' => ID::unique(), - 'name' => 'TvShows', - 'dimension' => 3, - 'permissions' => [ - Permission::read(Role::any()), - Permission::create(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'documentSecurity' => true, - ]); - - /** - * Test when collection is disabled but can still modify collections - */ - $database = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $movies['body']['$id'], array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => 'Movies', - 'enabled' => false, - ]); - - $this->assertEquals(201, $tvShows['headers']['status-code']); - $this->assertEquals($tvShows['body']['name'], 'TvShows'); - - return ['moviesId' => $movies['body']['$id'], 'databaseId' => $databaseId, 'tvShowsId' => $tvShows['body']['$id']]; - } - - #[Depends('testCreateCollection')] - public function testListCollection(array $data) - { - /** - * Test when database is disabled but can still call list collections - */ - $databaseId = $data['databaseId']; - - $collections = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders())); - - $this->assertEquals(200, $collections['headers']['status-code']); - $this->assertEquals(2, $collections['body']['total']); - } - - #[Depends('testCreateCollection')] - public function testGetCollection(array $data) - { - $databaseId = $data['databaseId']; - $moviesCollectionId = $data['moviesId']; - - /** - * Test when database and collection are disabled but can still call get collection - */ - $collection = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $moviesCollectionId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(200, $collection['headers']['status-code']); - $this->assertEquals('Movies', $collection['body']['name']); - $this->assertEquals($moviesCollectionId, $collection['body']['$id']); - $this->assertFalse($collection['body']['enabled']); - } - - #[Depends('testCreateCollection')] - public function testUpdateCollection(array $data) - { - $databaseId = $data['databaseId']; - $moviesCollectionId = $data['moviesId']; - - /** - * Test When database and collection are disabled but can still call update collection - */ - $collection = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $moviesCollectionId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'name' => 'Movies Updated', - 'enabled' => false - ]); - - $this->assertEquals(200, $collection['headers']['status-code']); - $this->assertEquals('Movies Updated', $collection['body']['name']); - $this->assertEquals($moviesCollectionId, $collection['body']['$id']); - $this->assertFalse($collection['body']['enabled']); - } - - #[Depends('testCreateCollection')] - public function testDeleteCollection(array $data) - { - $databaseId = $data['databaseId']; - $tvShowsId = $data['tvShowsId']; - - /** - * Test when database and collection are disabled but can still call delete collection - */ - $response = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/' . $tvShowsId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(204, $response['headers']['status-code']); - $this->assertEquals($response['body'], ""); - } - - #[Depends('testCreateCollection')] - public function testGetDatabaseUsage(array $data) - { - $databaseId = $data['databaseId']; - /** - * Test for FAILURE - */ - - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/usage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), [ - 'range' => '32h' - ]); - - $this->assertEquals(400, $response['headers']['status-code']); - - /** - * Test for SUCCESS - */ - - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/usage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), [ - 'range' => '24h' - ]); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(11, count($response['body'])); - $this->assertEquals('24h', $response['body']['range']); - $this->assertIsNumeric($response['body']['documentsTotal']); - $this->assertIsNumeric($response['body']['collectionsTotal']); - $this->assertIsArray($response['body']['collections']); - $this->assertIsArray($response['body']['documents']); - } - - - #[Depends('testCreateCollection')] - public function testGetCollectionUsage(array $data) - { - $databaseId = $data['databaseId']; - /** - * Test for FAILURE - */ - - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $data['moviesId'] . '/usage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), [ - 'range' => '32h' - ]); - - $this->assertEquals(400, $response['headers']['status-code']); - - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/randomCollectionId/usage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), [ - 'range' => '24h' - ]); - - $this->assertEquals(404, $response['headers']['status-code']); - - /** - * Test for SUCCESS - */ - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $data['moviesId'] . '/usage', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), [ - 'range' => '24h' - ]); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(3, count($response['body'])); - $this->assertEquals('24h', $response['body']['range']); - $this->assertIsNumeric($response['body']['documentsTotal']); - $this->assertIsArray($response['body']['documents']); - } - -} diff --git a/tests/e2e/Services/Databases/VectorsDBCustomClientTest.php b/tests/e2e/Services/Databases/VectorsDBCustomClientTest.php deleted file mode 100644 index 632b1a62de..0000000000 --- a/tests/e2e/Services/Databases/VectorsDBCustomClientTest.php +++ /dev/null @@ -1,207 +0,0 @@ -client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::unique(), - 'name' => 'Test Database' - ]); - - $databaseId = $database['body']['$id']; - - // Collection aliases write to create, update, delete - $movies = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'collectionId' => ID::unique(), - 'name' => 'Movies', - 'dimension' => 3, - 'documentSecurity' => true, - 'permissions' => [ - Permission::write(Role::user($this->getUser()['$id'])), - ], - ]); - - $moviesId = $movies['body']['$id']; - - $this->assertContains(Permission::create(Role::user($this->getUser()['$id'])), $movies['body']['$permissions']); - $this->assertContains(Permission::update(Role::user($this->getUser()['$id'])), $movies['body']['$permissions']); - $this->assertContains(Permission::delete(Role::user($this->getUser()['$id'])), $movies['body']['$permissions']); - - // VectorsDB uses fixed schema (embeddings, metadata). No attribute creation needed. - - // Document aliases write to update, delete - $document1 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $moviesId . '/documents', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['k' => 'v'], - ], - 'permissions' => [ - Permission::write(Role::user($this->getUser()['$id'])), - ] - ]); - - $this->assertNotContains(Permission::create(Role::user($this->getUser()['$id'])), $document1['body']['$permissions']); - $this->assertContains(Permission::update(Role::user($this->getUser()['$id'])), $document1['body']['$permissions']); - $this->assertContains(Permission::delete(Role::user($this->getUser()['$id'])), $document1['body']['$permissions']); - - /** - * Test for FAILURE - */ - - // Document does not allow create permission - $document2 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/' . $moviesId . '/documents', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'documentId' => ID::unique(), - 'data' => [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['k' => 'v'], - ], - 'permissions' => [ - Permission::create(Role::user($this->getUser()['$id'])), - ] - ]); - - $this->assertEquals(400, $document2['headers']['status-code']); - } - - public function testUpdateWithoutPermission(): array - { - // As a part of preparation, we get ID of currently logged-in user - $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(200, $response['headers']['status-code']); - - $userId = $response['body']['$id']; - - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'databaseId' => ID::custom('permissionCheckDatabase'), - 'name' => 'Test Database', - ]); - $this->assertEquals(201, $database['headers']['status-code']); - $this->assertEquals('Test Database', $database['body']['name']); - - $databaseId = $database['body']['$id']; - // Create collection - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'collectionId' => ID::custom('permissionCheck'), - 'name' => 'permissionCheck', - 'dimension' => 3, - 'permissions' => [], - 'documentSecurity' => true, - ]); - $this->assertEquals(201, $response['headers']['status-code']); - - // Creating document by server, give read permission to our user + some other user - $response = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections/permissionCheck/documents', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]), [ - 'documentId' => ID::custom('permissionCheckDocument'), - 'data' => [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['name' => 'AppwriteBeginner'], - ], - 'permissions' => [ - Permission::read(Role::user(ID::custom('user2'))), - Permission::read(Role::user($userId)), - Permission::update(Role::user($userId)), - Permission::delete(Role::user($userId)), - ], - ]); - - $this->assertEquals(201, $response['headers']['status-code']); - - // Update document - // This is the point of this test. We should be allowed to do this action, and it should not fail on permission check - $response = $this->client->call(Client::METHOD_PATCH, '/vectorsdb/' . $databaseId . '/collections/permissionCheck/documents/permissionCheckDocument', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), [ - 'data' => [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['name' => 'AppwriteExpert'], - ] - ]); - - $this->assertEquals(200, $response['headers']['status-code']); - - // Get name of the document, should be the new one - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/permissionCheck/documents/permissionCheckDocument', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals("AppwriteExpert", $response['body']['metadata']['name']); - - // Cleanup to prevent collision with other tests - // Delete collection - $response = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/permissionCheck', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - - $this->assertEquals(204, $response['headers']['status-code']); - - - // Wait for database worker to finish deleting collection - sleep(2); - - // Make sure collection has been deleted - $response = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/permissionCheck', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); - $this->assertEquals(404, $response['headers']['status-code']); - - return []; - } -} diff --git a/tests/e2e/Services/Databases/VectorsDBCustomServerTest.php b/tests/e2e/Services/Databases/VectorsDBCustomServerTest.php deleted file mode 100644 index 12fef2ddd2..0000000000 --- a/tests/e2e/Services/Databases/VectorsDBCustomServerTest.php +++ /dev/null @@ -1,963 +0,0 @@ -client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::custom('first'), - 'name' => 'Test 1', - ]); - $this->assertEquals(201, $db1['headers']['status-code']); - $this->assertEquals('Test 1', $db1['body']['name']); - $this->assertEquals('vectorsdb', $db1['body']['type']); - // Validate database response model fields on create - $this->assertArrayHasKey('$id', $db1['body']); - $this->assertArrayHasKey('$createdAt', $db1['body']); - $this->assertArrayHasKey('$updatedAt', $db1['body']); - $this->assertArrayHasKey('enabled', $db1['body']); - - $db2 = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::custom('second'), - 'name' => 'Test 2', - ]); - $this->assertEquals(201, $db2['headers']['status-code']); - $this->assertEquals('Test 2', $db2['body']['name']); - $this->assertEquals('vectorsdb', $db2['body']['type']); - - $list = $this->client->call(Client::METHOD_GET, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $list['headers']['status-code']); - $this->assertIsInt($list['body']['total']); - $this->assertGreaterThanOrEqual(2, $list['body']['total']); - $this->assertIsArray($list['body']['databases']); - $this->assertArrayHasKey('$id', $list['body']['databases'][0]); - $this->assertArrayHasKey('name', $list['body']['databases'][0]); - $this->assertArrayHasKey('type', $list['body']['databases'][0]); - - return ['databaseId' => $db1['body']['$id']]; - } - - #[Depends('testListDatabases')] - public function testGetDatabase(array $data): array - { - $databaseId = $data['databaseId']; - $res = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $res['headers']['status-code']); - $this->assertEquals($databaseId, $res['body']['$id']); - $this->assertEquals('Test 1', $res['body']['name']); - $this->assertEquals('vectorsdb', $res['body']['type']); - return ['databaseId' => $databaseId]; - } - - #[Depends('testListDatabases')] - public function testUpdateDatabase(array $data): array - { - $databaseId = $data['databaseId']; - $res = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test 1 Updated', - ]); - $this->assertEquals(200, $res['headers']['status-code']); - $this->assertEquals('Test 1 Updated', $res['body']['name']); - $this->assertEquals('vectorsdb', $res['body']['type']); - return ['databaseId' => $databaseId]; - } - - #[Depends('testListDatabases')] - public function testDeleteDatabase(array $data): void - { - $databaseId = $data['databaseId']; - $del = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(204, $del['headers']['status-code']); - $this->assertEquals("", $del['body']); - - $get = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(404, $get['headers']['status-code']); - } - - public function testCollectionsCRUD(): array - { - // Create database for collections tests - $database = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::unique(), - 'name' => 'Collections DB', - ]); - $this->assertEquals(201, $database['headers']['status-code']); - $databaseId = $database['body']['$id']; - - // Create two collections - $col1 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test 1', - 'collectionId' => ID::custom('first'), - 'permissions' => [ - Permission::read(Role::any()), - Permission::create(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'documentSecurity' => true, - 'dimension' => 3, - ]); - $this->assertEquals(201, $col1['headers']['status-code']); - // Validate collection response model on create - $this->assertArrayHasKey('$id', $col1['body']); - $this->assertArrayHasKey('$createdAt', $col1['body']); - $this->assertArrayHasKey('$updatedAt', $col1['body']); - $this->assertArrayHasKey('enabled', $col1['body']); - $this->assertArrayHasKey('documentSecurity', $col1['body']); - $this->assertArrayHasKey('dimension', $col1['body']); - - $col2 = $this->client->call(Client::METHOD_POST, '/vectorsdb/' . $databaseId . '/collections', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test 2', - 'collectionId' => ID::custom('second'), - 'permissions' => [ - Permission::read(Role::any()), - Permission::create(Role::any()), - Permission::update(Role::any()), - Permission::delete(Role::any()), - ], - 'documentSecurity' => true, - 'dimension' => 3, - ]); - $this->assertEquals(201, $col2['headers']['status-code']); - $this->assertArrayHasKey('$id', $col2['body']); - $this->assertArrayHasKey('$createdAt', $col2['body']); - $this->assertArrayHasKey('$updatedAt', $col2['body']); - - // List collections - $list = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $list['headers']['status-code']); - $this->assertIsInt($list['body']['total']); - $this->assertGreaterThanOrEqual(2, $list['body']['total']); - $this->assertIsArray($list['body']['collections']); - $this->assertArrayHasKey('$id', $list['body']['collections'][0]); - $this->assertArrayHasKey('name', $list['body']['collections'][0]); - $this->assertArrayHasKey('dimension', $list['body']['collections'][0]); - - // Get collection - $get = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $col1['body']['$id'], [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertEquals($col1['body']['$id'], $get['body']['$id']); - $this->assertEquals('Test 1', $get['body']['name']); - $this->assertEquals(3, $get['body']['dimension']); - - // Update collection (name only) - $upd = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $col1['body']['$id'], [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test 1 Updated', - ]); - $this->assertEquals(200, $upd['headers']['status-code']); - $this->assertEquals('Test 1 Updated', $upd['body']['name']); - $this->assertArrayHasKey('$updatedAt', $upd['body']); - - // Delete collection - $del = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId . '/collections/' . $col2['body']['$id'], [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(204, $del['headers']['status-code']); - $this->assertEquals("", $del['body']); - - return [ - 'databaseId' => $databaseId, - 'collectionId' => $col1['body']['$id'], - ]; - } - - #[Depends('testCollectionsCRUD')] - public function testUpdateCollectionMore(array $data): array - { - $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; - - // Update collection name and dimensions - $upd = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $collectionId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test 1 Renamed', - 'dimension' => 4, - ]); - $this->assertEquals(200, $upd['headers']['status-code']); - $this->assertEquals('Test 1 Renamed', $upd['body']['name']); - $this->assertEquals(4, $upd['body']['dimension']); - - // Read back to confirm - $get = $this->client->call(Client::METHOD_GET, '/vectorsdb/' . $databaseId . '/collections/' . $collectionId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertEquals('Test 1 Renamed', $get['body']['name']); - $this->assertEquals(4, $get['body']['dimension']); - - return $data; - } - - #[Depends('testCollectionsCRUD')] - public function testUpdateCollectionEnabledFlag(array $data): array - { - $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; - - // Disable collection - $disable = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $collectionId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Updated', - 'enabled' => false, - ]); - $this->assertEquals(200, $disable['headers']['status-code']); - $this->assertFalse($disable['body']['enabled']); - - // Re-enable collection - $enable = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId . '/collections/' . $collectionId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Updated', - 'enabled' => true, - ]); - $this->assertEquals(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - return $data; - } - - public function testUpdateDatabaseNameAndEnabled(): void - { - // Create isolated database for this test to avoid ordering conflicts - $create = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::unique(), - 'name' => 'Update DB', - ]); - $this->assertEquals(201, $create['headers']['status-code']); - $databaseId = $create['body']['$id']; - - // Update name - $rename = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test DB Renamed', - ]); - $this->assertEquals(200, $rename['headers']['status-code']); - $this->assertEquals('Test DB Renamed', $rename['body']['name']); - - // Toggle enabled off then on - $disable = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test DB Renamed', - 'enabled' => false, - ]); - $this->assertEquals(200, $disable['headers']['status-code']); - $this->assertFalse($disable['body']['enabled']); - - $enable = $this->client->call(Client::METHOD_PUT, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'name' => 'Test DB Renamed', - 'enabled' => true, - ]); - $this->assertEquals(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $del = $this->client->call(Client::METHOD_DELETE, '/vectorsdb/' . $databaseId, [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(204, $del['headers']['status-code']); - } - - #[Depends('testCollectionsCRUD')] - public function testRecreateIndex(array $data): void - { - $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; - - // Create a new index variant - $create = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'key' => 'embedding_euclidean_v2', - 'type' => Database::INDEX_HNSW_EUCLIDEAN, - 'attributes' => ['embeddings'] - ]); - $this->assertEquals(202, $create['headers']['status-code']); - - // Ensure it exists - $get = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes/embedding_euclidean_v2", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertEquals('embedding_euclidean_v2', $get['body']['key']); - - // Delete it - $del = $this->client->call(Client::METHOD_DELETE, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes/embedding_euclidean_v2", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(204, $del['headers']['status-code']); - } - - #[Depends('testCollectionsCRUD')] - public function testIndexesCRUD(array $data): void - { - $databaseId = $data['databaseId']; - $collectionId = $data['collectionId']; - - // Create indexes - $eu = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'key' => 'embedding_euclidean', - 'type' => Database::INDEX_HNSW_EUCLIDEAN, - 'attributes' => ['embeddings'] - ]); - $this->assertEquals(202, $eu['headers']['status-code']); - - $dot = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'key' => 'embedding_dot', - 'type' => Database::INDEX_HNSW_DOT, - 'attributes' => ['embeddings'] - ]); - $this->assertEquals(202, $dot['headers']['status-code']); - - $cos = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'key' => 'embedding_cosine', - 'type' => Database::INDEX_HNSW_COSINE, - 'attributes' => ['embeddings'] - ]); - $this->assertEquals(202, $cos['headers']['status-code']); - - // List indexes - $list = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $list['headers']['status-code']); - $this->assertIsArray($list['body']['indexes']); - $keys = array_map(fn ($i) => $i['key'], $list['body']['indexes']); - $this->assertContains('embedding_euclidean', $keys); - $this->assertContains('embedding_dot', $keys); - $this->assertContains('embedding_cosine', $keys); - - // Get index by key - $get = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes/embedding_euclidean", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertEquals('embedding_euclidean', $get['body']['key']); - $this->assertEquals(Database::INDEX_HNSW_EUCLIDEAN, $get['body']['type']); - - // Delete index - $del = $this->client->call(Client::METHOD_DELETE, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes/embedding_dot", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(204, $del['headers']['status-code']); - sleep(4); - // Ensure it's gone - $getMissing = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/indexes/embedding_dot", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(404, $getMissing['headers']['status-code']); - } - - public function testBulkCreate(): array - { - // Setup: create isolated database and collection - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::unique(), - 'name' => 'BulkDBCreate' - ]); - $this->assertEquals(201, $db['headers']['status-code']); - $databaseId = $db['body']['$id']; - - $col = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'collectionId' => ID::unique(), - 'name' => 'BulkColCreate', - 'documentSecurity' => true, - 'dimension' => 3, - 'permissions' => [Permission::read(Role::any())] - ]); - $this->assertEquals(201, $col['headers']['status-code']); - $collectionId = $col['body']['$id']; - - $docs = [ - [ - 'embeddings' => [1.0, 0.0, 0.0], - 'metadata' => ['group' => 'bulkA'], - '$permissions' => [Permission::read(Role::any())] - ], - [ - 'embeddings' => [0.0, 1.0, 0.0], - 'metadata' => ['group' => 'bulkB'], - '$permissions' => [Permission::read(Role::any())] - ], - ]; - - $res = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'documents' => $docs - ]); - - $this->assertEquals(201, $res['headers']['status-code']); - $this->assertIsInt($res['body']['total'] ?? 0); - $this->assertGreaterThanOrEqual(2, $res['body']['total']); - $this->assertIsArray($res['body']['documents']); - $this->assertCount(2, $res['body']['documents']); - - $ids = array_map(fn ($d) => $d['$id'], $res['body']['documents']); - $this->assertNotEmpty($ids[0]); - $this->assertNotEmpty($ids[1]); - - // Fetch and validate persisted data via GET - foreach ($ids as $i => $id) { - $get = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$id}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertEquals($id, $get['body']['$id']); - $this->assertIsArray($get['body']['embeddings']); - $this->assertCount(3, $get['body']['embeddings']); - $this->assertArrayHasKey('group', $get['body']['metadata']); - } - - return [ 'databaseId' => $databaseId, 'collectionId' => $collectionId, 'bulkIds' => $ids ]; - } - - public function testCreateTextEmbeddingsSuccessAndErrors(): void - { - // Setup new database and collection - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::unique(), - 'name' => 'EmbedDB', - ]); - $this->assertEquals(201, $db['headers']['status-code']); - $databaseId = $db['body']['$id']; - - $col = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'collectionId' => ID::unique(), - 'name' => 'EmbedCol', - 'documentSecurity' => true, - 'dimension' => 3, - 'permissions' => [Permission::read(Role::any())] - ]); - $this->assertEquals(201, $col['headers']['status-code']); - $collectionId = $col['body']['$id']; - - // Success: two embeddings - $this->assertEventually(function () { - $ok = $this->client->call(Client::METHOD_POST, "/vectorsdb/embeddings/text", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'model' => 'nomic-embed-text', - 'texts' => [ - 'hello world', - 'second sentence', - ], - ]); - $this->assertEquals(200, $ok['headers']['status-code']); - $this->assertIsInt($ok['body']['total'] ?? 0); - $this->assertEquals(2, $ok['body']['total']); - $this->assertIsArray($ok['body']['embeddings']); - $this->assertCount(2, $ok['body']['embeddings']); - foreach ($ok['body']['embeddings'] as $embed) { - $this->assertIsString($embed['model']); - $this->assertIsInt($embed['dimension']); - $this->assertIsArray($embed['embedding']); - $this->assertGreaterThan(0, count($embed['embedding'])); - $this->assertArrayHasKey('error', $embed); - } - }, 3000, 100); - - // Error: missing texts payload - $missingTexts = $this->client->call(Client::METHOD_POST, "/vectorsdb/embeddings/text", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], []); - $this->assertEquals(400, $missingTexts['headers']['status-code']); - - // Error: invalid texts item type (must be strings) - $invalidItem = $this->client->call(Client::METHOD_POST, "/vectorsdb/embeddings/text", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'model' => 'nomic-embed-text', - 'texts' => [ - 'valid text', - 123, // invalid, not a string - ], - ]); - $this->assertEquals(400, $invalidItem['headers']['status-code']); - - // Error: unknown embedding model - $unknownModel = $this->client->call(Client::METHOD_POST, "/vectorsdb/embeddings/text", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'model' => 'nonexistent-model', - 'texts' => ['hello'], - ]); - $this->assertEquals(400, $unknownModel['headers']['status-code']); - } - - public function testBulkUpsert(): void - { - // Setup fresh db/collection - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ 'databaseId' => ID::unique(), 'name' => 'BulkDBUpsert' ]); - $this->assertEquals(201, $db['headers']['status-code']); - $databaseId = $db['body']['$id']; - - $col = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'collectionId' => ID::unique(), - 'name' => 'BulkColUpsert', - 'documentSecurity' => true, - 'dimension' => 3, - 'permissions' => [Permission::read(Role::any())] - ]); - $this->assertEquals(201, $col['headers']['status-code']); - $collectionId = $col['body']['$id']; - - $docs = [ - [ - 'embeddings' => [0.5, 0.5, 0.0], - 'metadata' => ['group' => 'bulkA', 'updated' => true], - '$permissions' => [Permission::read(Role::any())] - ], - [ - 'embeddings' => [0.2, 0.8, 0.0], - 'metadata' => ['group' => 'bulkB', 'updated' => true], - '$permissions' => [Permission::read(Role::any())] - ], - ]; - - $res = $this->client->call(Client::METHOD_PUT, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'documents' => $docs - ]); - - $this->assertEquals(200, $res['headers']['status-code']); - $this->assertIsArray($res['body']['documents']); - $this->assertCount(2, $res['body']['documents']); - $this->assertTrue($res['body']['documents'][0]['metadata']['updated']); - $this->assertTrue($res['body']['documents'][1]['metadata']['updated']); - - // Fetch and validate updated content - $ids = array_map(fn ($d) => $d['$id'], $res['body']['documents']); - foreach ($ids as $id) { - $get = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$id}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['metadata']['updated']); - } - - // Perform another bulk upsert to mutate the same documents - $docs2 = [ - [ 'embeddings' => [0.6, 0.4, 0.0], 'metadata' => ['updatedAgain' => true] ], - [ 'embeddings' => [0.3, 0.7, 0.0], 'metadata' => ['updatedAgain' => true] ], - ]; - $res2 = $this->client->call(Client::METHOD_PUT, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'documents' => $docs2 - ]); - $this->assertEquals(200, $res2['headers']['status-code']); - $this->assertIsArray($res2['body']['documents']); - $this->assertCount(2, $res2['body']['documents']); - - // Fetch again and assert second update persisted - $ids2 = array_map(fn ($d) => $d['$id'], $res2['body']['documents']); - foreach ($ids2 as $id) { - $get2 = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$id}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get2['headers']['status-code']); - $this->assertTrue($get2['body']['metadata']['updatedAgain']); - } - } - - public function testBulkUpdate(): void - { - // Setup: create db/collection and two docs - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ 'databaseId' => ID::unique(), 'name' => 'BulkDBUpdate' ]); - $this->assertEquals(201, $db['headers']['status-code']); - $databaseId = $db['body']['$id']; - - $col = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'collectionId' => ID::unique(), - 'name' => 'BulkColUpdate', - 'documentSecurity' => true, - 'dimension' => 3, - 'permissions' => [Permission::read(Role::any())] - ]); - $this->assertEquals(201, $col['headers']['status-code']); - $collectionId = $col['body']['$id']; - - $seed = $this->client->call(Client::METHOD_PUT, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'documents' => [ - ['embeddings' => [1.0,0.0,0.0], 'metadata' => ['seed' => 1], '$permissions' => [Permission::read(Role::any())]], - ['embeddings' => [0.0,1.0,0.0], 'metadata' => ['seed' => 2], '$permissions' => [Permission::read(Role::any())]] - ] - ]); - $this->assertEquals(200, $seed['headers']['status-code']); - $ids = array_map(fn ($d) => $d['$id'], $seed['body']['documents']); - - $res = $this->client->call(Client::METHOD_PATCH, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'data' => [ 'metadata' => ['bulkUpdated' => true] ], - 'queries' => [ - \Utopia\Database\Query::equal('$id', $ids)->toString() - ] - ]); - - $this->assertEquals(200, $res['headers']['status-code']); - $this->assertIsArray($res['body']['documents']); - $this->assertCount(2, $res['body']['documents']); - foreach ($res['body']['documents'] as $doc) { - $this->assertTrue($doc['metadata']['bulkUpdated']); - } - - // Fetch by IDs and assert update persisted - foreach ($ids as $id) { - $get = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$id}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['metadata']['bulkUpdated']); - } - } - - public function testBulkDelete(): void - { - // Setup: create db/collection and two docs - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ 'databaseId' => ID::unique(), 'name' => 'BulkDBDelete' ]); - $this->assertEquals(201, $db['headers']['status-code']); - $databaseId = $db['body']['$id']; - - $col = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'collectionId' => ID::unique(), - 'name' => 'BulkColDelete', - 'documentSecurity' => true, - 'dimension' => 3, - 'permissions' => [Permission::read(Role::any())] - ]); - $this->assertEquals(201, $col['headers']['status-code']); - $collectionId = $col['body']['$id']; - - $seed = $this->client->call(Client::METHOD_PUT, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'documents' => [ - ['embeddings' => [1.0,0.0,0.0], 'metadata' => ['seed' => 1], '$permissions' => [Permission::read(Role::any())]], - ['embeddings' => [0.0,1.0,0.0], 'metadata' => ['seed' => 2], '$permissions' => [Permission::read(Role::any())]] - ] - ]); - $this->assertEquals(200, $seed['headers']['status-code']); - $ids = array_map(fn ($d) => $d['$id'], $seed['body']['documents']); - - $res = $this->client->call(Client::METHOD_DELETE, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'queries' => [ - \Utopia\Database\Query::equal('$id', $ids)->toString() - ] - ]); - $this->assertEquals(200, $res['headers']['status-code']); - $this->assertIsInt($res['body']['total'] ?? 0); - $this->assertGreaterThanOrEqual(2, $res['body']['total']); - - // Ensure they are deleted - foreach ($ids as $id) { - $get = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$id}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - $this->assertEquals(404, $get['headers']['status-code']); - } - } - - public function testCustomTimestamps(): void - { - // Setup: create database and collection - $db = $this->client->call(Client::METHOD_POST, '/vectorsdb', [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'databaseId' => ID::unique(), - 'name' => 'TimestampTestDB' - ]); - $this->assertEquals(201, $db['headers']['status-code']); - $databaseId = $db['body']['$id']; - - $col = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'collectionId' => ID::unique(), - 'name' => 'TimestampTestCollection', - 'documentSecurity' => true, - 'dimension' => 1536, - 'permissions' => [Permission::read(Role::any())] - ]); - $this->assertEquals(201, $col['headers']['status-code']); - $collectionId = $col['body']['$id']; - - // Test: Create document with custom timestamps using PUT (upsert) - $customCreatedAt = '1970-01-01T00:00:00.000+00:00'; - $customUpdatedAt = '1970-01-01T00:00:00.000+00:00'; - $vector = array_fill(0, 1536, 0.0); - $vector[0] = 1.0; - $documentId = ID::unique(); - - $doc = $this->client->call(Client::METHOD_POST, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'documentId' => $documentId, - 'data' => [ - '$createdAt' => $customCreatedAt, - '$updatedAt' => $customUpdatedAt, - 'embeddings' => $vector, - 'metadata' => ['test' => 'custom_timestamps'] - ] - ]); - - $this->assertEquals(201, $doc['headers']['status-code']); - $documentId = $doc['body']['$id']; - $this->assertNotEmpty($documentId); - - // Verify timestamps were set correctly - $this->assertEquals($customCreatedAt, $doc['body']['$createdAt'], 'CreatedAt should match custom timestamp'); - $this->assertEquals($customUpdatedAt, $doc['body']['$updatedAt'], 'UpdatedAt should match custom timestamp'); - - // Fetch document and verify timestamps persist - $fetched = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$documentId}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - - $this->assertEquals(200, $fetched['headers']['status-code']); - $this->assertEquals($customCreatedAt, $fetched['body']['$createdAt'], 'CreatedAt should persist after fetch'); - $this->assertEquals($customUpdatedAt, $fetched['body']['$updatedAt'], 'UpdatedAt should persist after fetch'); - - // Test: Update document with new custom timestamps - $newCustomUpdatedAt = '2000-01-01T12:00:00.000+00:00'; - $vector2 = array_fill(0, 1536, 0.0); - $vector2[1] = 1.0; - - $updated = $this->client->call(Client::METHOD_PUT, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$documentId}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ], [ - 'data' => [ - '$createdAt' => $customCreatedAt, // Keep original createdAt - '$updatedAt' => $newCustomUpdatedAt, // Update updatedAt - 'embeddings' => $vector2, - 'metadata' => ['test' => 'updated_timestamps'] - ] - ]); - - $this->assertEquals(200, $updated['headers']['status-code']); - $this->assertEquals($customCreatedAt, $updated['body']['$createdAt'], 'CreatedAt should remain unchanged'); - $this->assertEquals($newCustomUpdatedAt, $updated['body']['$updatedAt'], 'UpdatedAt should be updated to new custom timestamp'); - - // Final verification - $final = $this->client->call(Client::METHOD_GET, "/vectorsdb/{$databaseId}/collections/{$collectionId}/documents/{$documentId}", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - - $this->assertEquals(200, $final['headers']['status-code']); - $this->assertEquals($customCreatedAt, $final['body']['$createdAt'], 'CreatedAt should persist through updates'); - $this->assertEquals($newCustomUpdatedAt, $final['body']['$updatedAt'], 'UpdatedAt should reflect the latest custom timestamp'); - } - -} diff --git a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php index 5d501486fd..5dacd87b3f 100644 --- a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php @@ -1,5 +1,7 @@ '24h' ]); $this->assertEquals(200, $usage['headers']['status-code']); - $this->assertEquals(24, count($usage['body'])); + $this->assertCount(24, $usage['body']); $this->assertEquals('24h', $usage['body']['range']); $this->assertIsNumeric($usage['body']['deploymentsTotal']); $this->assertIsNumeric($usage['body']['deploymentsStorageTotal']); @@ -316,7 +318,7 @@ class FunctionsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(2, sizeof($response['body']['variables'])); + $this->assertCount(2, $response['body']['variables']); $this->assertEquals(2, $response['body']['total']); $this->assertEquals("APP_TEST", $response['body']['variables'][0]['key']); $this->assertEquals("TESTINGVALUE", $response['body']['variables'][0]['value']); @@ -850,7 +852,7 @@ class FunctionsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(0, sizeof($response['body']['variables'])); + $this->assertCount(0, $response['body']['variables']); $this->assertEquals(0, $response['body']['total']); /** @@ -950,7 +952,7 @@ class FunctionsConsoleClientTest extends Scope $buildMd5 = \md5($response['body']); - $this->assertNotEquals($deploymentMd5, $buildMd5); + $this->assertNotSame($deploymentMd5, $buildMd5); $this->cleanupFunction($functionId); } diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 1208121077..c04631bf60 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -1,5 +1,7 @@ assertIsArray($templatesWithIncludeTotalFalse['body']); $this->assertIsArray($templatesWithIncludeTotalFalse['body']['templates']); $this->assertIsInt($templatesWithIncludeTotalFalse['body']['total']); - $this->assertEquals(0, $templatesWithIncludeTotalFalse['body']['total']); + $this->assertSame(0, $templatesWithIncludeTotalFalse['body']['total']); $this->assertGreaterThan(0, count($templatesWithIncludeTotalFalse['body']['templates'])); foreach ($templates['body']['templates'] as $template) { @@ -605,7 +607,7 @@ class FunctionsCustomClientTest extends Scope $lastExecution = $executions['body']['executions'][0]; $this->assertEquals('completed', $lastExecution['status']); $this->assertEquals(204, $lastExecution['responseStatusCode']); - $this->assertStringContainsString($documentId, $lastExecution['logs']); + $this->assertStringContainsString($documentId, (string) $lastExecution['logs']); }, 20000, 500); $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId, [ diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 44d5d274da..1aba466944 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1,5 +1,7 @@ $data['functionId'] ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); $this->assertCount(1, $functions['body']['functions']); - $this->assertEquals($functions['body']['functions'][0]['name'], 'Test'); + $this->assertEquals('Test', $functions['body']['functions'][0]['name']); // Test pagination limit $functions = $this->listFunctions([ @@ -325,7 +327,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); $this->assertCount(1, $functions['body']['functions']); // Test pagination offset - combined with limit to verify offset works @@ -337,7 +339,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); // In parallel mode, other tests may create functions, so just verify offset works $this->assertIsArray($functions['body']['functions']); @@ -348,7 +350,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); // In parallel mode, other tests may create enabled functions $this->assertGreaterThanOrEqual(1, count($functions['body']['functions'])); @@ -359,7 +361,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); // In parallel mode, other tests may create disabled functions $this->assertIsArray($functions['body']['functions']); @@ -368,7 +370,7 @@ class FunctionsCustomServerTest extends Scope 'search' => 'Test' ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); // In parallel mode, other tests may create functions with 'Test' in the name $this->assertGreaterThanOrEqual(1, count($functions['body']['functions'])); // Verify our function is in the results @@ -380,7 +382,7 @@ class FunctionsCustomServerTest extends Scope 'search' => 'node-22' ]); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); // In parallel mode, other tests may create functions with node-22 runtime $this->assertGreaterThanOrEqual(1, count($functions['body']['functions'])); // Verify our function is in the results @@ -404,7 +406,7 @@ class FunctionsCustomServerTest extends Scope $functions = $this->listFunctions(); - $this->assertEquals($functions['headers']['status-code'], 200); + $this->assertEquals(200, $functions['headers']['status-code']); // In parallel mode, there may be more functions created by other tests $this->assertGreaterThanOrEqual(2, $functions['body']['total']); $this->assertIsArray($functions['body']['functions']); @@ -426,7 +428,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($functions1['headers']['status-code'], 200); + $this->assertEquals(200, $functions1['headers']['status-code']); // Should have at least Test 2 after Test (may have more from parallel tests) $this->assertGreaterThanOrEqual(1, count($functions1['body']['functions'])); $functionNames1 = array_column($functions1['body']['functions'], 'name'); @@ -438,7 +440,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($functions2['headers']['status-code'], 200); + $this->assertEquals(200, $functions2['headers']['status-code']); // Should have at least Test before Test 2 $this->assertGreaterThanOrEqual(1, count($functions2['body']['functions'])); $functionNames2 = array_column($functions2['body']['functions'], 'name'); @@ -452,7 +454,7 @@ class FunctionsCustomServerTest extends Scope Query::cursorAfter(new Document(['$id' => 'unknown']))->toString(), ], ]); - $this->assertEquals($functions['headers']['status-code'], 400); + $this->assertEquals(400, $functions['headers']['status-code']); } public function testGetFunction(): void @@ -464,15 +466,15 @@ class FunctionsCustomServerTest extends Scope */ $function = $this->getFunction($data['functionId']); - $this->assertEquals($function['headers']['status-code'], 200); - $this->assertEquals($function['body']['name'], 'Test'); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals('Test', $function['body']['name']); /** * Test for FAILURE */ $function = $this->getFunction('x'); - $this->assertEquals($function['headers']['status-code'], 404); + $this->assertEquals(404, $function['headers']['status-code']); } public function testUpdateFunction(): void @@ -695,7 +697,7 @@ class FunctionsCustomServerTest extends Scope $this->assertIsArray($deploymentsWithIncludeTotalFalse['body']); $this->assertIsArray($deploymentsWithIncludeTotalFalse['body']['deployments']); $this->assertIsInt($deploymentsWithIncludeTotalFalse['body']['total']); - $this->assertEquals(0, $deploymentsWithIncludeTotalFalse['body']['total']); + $this->assertSame(0, $deploymentsWithIncludeTotalFalse['body']['total']); $this->assertGreaterThan(0, count($deploymentsWithIncludeTotalFalse['body']['deployments'])); $lastDeployment = $deployments['body']['deployments'][0]; @@ -731,7 +733,7 @@ class FunctionsCustomServerTest extends Scope $totalUsers = $users['body']['total']; - $this->assertStringContainsString("Total users: " . $totalUsers, $execution['body']['logs']); + $this->assertStringContainsString("Total users: " . $totalUsers, (string) $execution['body']['logs']); // Execute function again but async $execution = $this->createExecution($functionId, [ @@ -753,7 +755,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEmpty($execution['body']['responseBody']); $this->assertEmpty($execution['body']['errors']); - $this->assertStringContainsString("Total users: " . $totalUsers, $execution['body']['logs']); + $this->assertStringContainsString("Total users: " . $totalUsers, (string) $execution['body']['logs']); }, 10000, 500); $deployment = $this->getDeployment($functionId, $deployment['body']['$id']); @@ -1018,7 +1020,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEventually(function () use ($functionId, $deploymentId) { $deployment = $this->getDeployment($functionId, $deploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('Build has been canceled.', $deployment['body']['buildLogs']); + $this->assertStringContainsString('Build has been canceled.', (string) $deployment['body']['buildLogs']); }); $deployment = $this->getDeployment($functionId, $deploymentId); @@ -1368,7 +1370,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $data['functionId']; $deployments = $this->listDeployments($functionId); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertGreaterThanOrEqual(1, $deployments['body']['total']); $this->assertIsArray($deployments['body']['deployments']); $this->assertGreaterThanOrEqual(1, count($deployments['body']['deployments'])); @@ -1381,7 +1383,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertCount(1, $deployments['body']['deployments']); $deployments = $this->listDeployments($functionId, [ @@ -1390,7 +1392,7 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertGreaterThanOrEqual(1, count($deployments['body']['deployments'])); // Check all deployments have correct attributes from select query foreach ($deployments['body']['deployments'] as $deployment) { @@ -1404,7 +1406,7 @@ class FunctionsCustomServerTest extends Scope Query::select(['buildLogs'])->toString(), ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertGreaterThanOrEqual(1, count($deployments['body']['deployments'])); // Check all deployments have correct attributes from select query foreach ($deployments['body']['deployments'] as $deployment) { @@ -1436,7 +1438,7 @@ class FunctionsCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); // At least 1 manual deployment should exist $this->assertGreaterThanOrEqual(1, $deployments['body']['total']); @@ -1449,7 +1451,7 @@ class FunctionsCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(0, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1461,7 +1463,7 @@ class FunctionsCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(0, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1473,7 +1475,7 @@ class FunctionsCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); // At least 1 deployment with sourceSize > 0 should exist $this->assertGreaterThanOrEqual(1, $deployments['body']['total']); @@ -1485,7 +1487,7 @@ class FunctionsCustomServerTest extends Scope ], ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); // At least 1 deployment with sourceSize > -100 should exist $this->assertGreaterThanOrEqual(1, $deployments['body']['total']); @@ -1554,7 +1556,7 @@ class FunctionsCustomServerTest extends Scope */ $deployment = $this->getDeployment($data['functionId'], 'x'); - $this->assertEquals($deployment['headers']['status-code'], 404); + $this->assertEquals(404, $deployment['headers']['status-code']); } public function testCreateExecution(): void @@ -1588,13 +1590,13 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals($data['functionId'], $execution['body']['functionId']); $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['responseStatusCode']); - $this->assertStringContainsString($execution['body']['functionId'], $execution['body']['responseBody']); - $this->assertStringContainsString($data['deploymentId'], $execution['body']['responseBody']); - $this->assertStringContainsString('Test1', $execution['body']['responseBody']); - $this->assertStringContainsString('http', $execution['body']['responseBody']); - $this->assertStringContainsString('Node.js', $execution['body']['responseBody']); - $this->assertStringContainsString('22', $execution['body']['responseBody']); - $this->assertStringContainsString('Global Variable Value', $execution['body']['responseBody']); + $this->assertStringContainsString($execution['body']['functionId'], (string) $execution['body']['responseBody']); + $this->assertStringContainsString($data['deploymentId'], (string) $execution['body']['responseBody']); + $this->assertStringContainsString('Test1', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('http', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('Node.js', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('22', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('Global Variable Value', (string) $execution['body']['responseBody']); // $this->assertStringContainsString('êä', $execution['body']['responseBody']); // tests unknown utf-8 chars $this->assertNotEmpty($execution['body']['errors']); $this->assertNotEmpty($execution['body']['logs']); @@ -1663,7 +1665,7 @@ class FunctionsCustomServerTest extends Scope $this->assertIsArray($executionsWithIncludeTotalFalse['body']); $this->assertIsArray($executionsWithIncludeTotalFalse['body']['executions']); $this->assertIsInt($executionsWithIncludeTotalFalse['body']['total']); - $this->assertEquals(0, $executionsWithIncludeTotalFalse['body']['total']); + $this->assertSame(0, $executionsWithIncludeTotalFalse['body']['total']); $this->assertGreaterThan(0, count($executionsWithIncludeTotalFalse['body']['executions'])); $executions = $this->listExecutions($data['functionId'], [ @@ -1757,10 +1759,10 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $execution['headers']['status-code']); $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['responseStatusCode']); - $this->assertStringContainsString('Test1', $execution['body']['responseBody']); - $this->assertStringContainsString('http', $execution['body']['responseBody']); - $this->assertStringContainsString('Node.js', $execution['body']['responseBody']); - $this->assertStringContainsString('22', $execution['body']['responseBody']); + $this->assertStringContainsString('Test1', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('http', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('Node.js', (string) $execution['body']['responseBody']); + $this->assertStringContainsString('22', (string) $execution['body']['responseBody']); // $this->assertStringContainsString('êä', $execution['body']['response']); // tests unknown utf-8 chars $this->assertLessThan(1.500, $execution['body']['duration']); } @@ -1783,7 +1785,7 @@ class FunctionsCustomServerTest extends Scope */ $function = $this->getExecution($data['functionId'], 'x'); - $this->assertEquals($function['headers']['status-code'], 404); + $this->assertEquals(404, $function['headers']['status-code']); } @@ -1816,7 +1818,7 @@ class FunctionsCustomServerTest extends Scope ], $this->getHeaders())); $this->assertEquals(404, $execution['headers']['status-code']); - $this->assertStringContainsString('Execution with the requested ID could not be found', $execution['body']['message']); + $this->assertStringContainsString('Execution with the requested ID could not be found', (string) $execution['body']['message']); /** * Test for FAILURE @@ -1838,8 +1840,8 @@ class FunctionsCustomServerTest extends Scope ], $this->getHeaders())); $this->assertEquals(400, $execution['headers']['status-code']); - $this->assertStringContainsString('execution_in_progress', $execution['body']['type']); - $this->assertStringContainsString('Can\'t delete ongoing execution.', $execution['body']['message']); + $this->assertStringContainsString('execution_in_progress', (string) $execution['body']['type']); + $this->assertStringContainsString('Can\'t delete ongoing execution.', (string) $execution['body']['message']); } @@ -2124,24 +2126,18 @@ class FunctionsCustomServerTest extends Scope $this->assertLessThan(20, $execution['body']['duration']); $this->assertEquals('', $execution['body']['responseBody']); $this->assertEquals('', $execution['body']['logs']); - $this->assertStringContainsString('timed out', $execution['body']['errors']); + $this->assertStringContainsString('timed out', (string) $execution['body']['errors']); }, 10000, 500); $this->cleanupFunction($functionId); } - public static function provideCustomExecutions(): array + public static function provideCustomExecutions(): \Iterator { // Most disabled to keep tests fast // Using positional arrays to avoid PHPUnit 11 named argument conflicts with @depends - return [ - // ['php-fn', 'php-8.0', 'index.php', 'PHP', '8.0'], - ['node', 'node-22', 'index.js', 'Node.js', '22'], - // ['python', 'python-3.9', 'main.py', 'Python', '3.9'], - // ['ruby', 'ruby-3.1', 'main.rb', 'Ruby', '3.1'], - // ['dart', 'dart-2.15', 'main.dart', 'Dart', '2.15'], - // ['swift', 'swift-5.5', 'index.swift', 'Swift', '5.5'], - ]; + // ['php-fn', 'php-8.0', 'index.php', 'PHP', '8.0'], + yield ['node', 'node-22', 'index.js', 'Node.js', '22']; } #[DataProvider('provideCustomExecutions')] @@ -2185,12 +2181,12 @@ class FunctionsCustomServerTest extends Scope $executions = $this->listExecutions($functionId); - $this->assertEquals($executions['headers']['status-code'], 200); - $this->assertEquals($executions['body']['total'], 1); + $this->assertEquals(200, $executions['headers']['status-code']); + $this->assertEquals(1, $executions['body']['total']); $this->assertIsArray($executions['body']['executions']); $this->assertCount(1, $executions['body']['executions']); $this->assertEquals($executions['body']['executions'][0]['$id'], $executionId); - $this->assertEquals($executions['body']['executions'][0]['trigger'], 'http'); + $this->assertEquals('http', $executions['body']['executions'][0]['trigger']); $this->assertEquals(200, $executions['body']['executions'][0]['responseStatusCode']); $this->assertEmpty($executions['body']['executions'][0]['responseBody']); @@ -2220,7 +2216,7 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(201, $execution['headers']['status-code']); - $this->assertStringContainsString('multipart/form-data', $execution['headers']['content-type']); + $this->assertStringContainsString('multipart/form-data', (string) $execution['headers']['content-type']); $contentType = explode(';', $execution['headers']['content-type']); $this->assertStringContainsString('boundary=----', $contentType[1]); $bytes = unpack('C*byte', $execution['body']['responseBody']); @@ -2240,7 +2236,7 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(400, $execution['headers']['status-code']); - $this->assertStringContainsString('Failed to parse response', $execution['body']['message']); + $this->assertStringContainsString('Failed to parse response', (string) $execution['body']['message']); $this->cleanupFunction($functionId); } @@ -2357,8 +2353,8 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('completed', $lastExecution['status']); $this->assertEquals(204, $lastExecution['responseStatusCode']); - $this->assertStringContainsString($userId, $lastExecution['logs']); - $this->assertStringContainsString('Event User', $lastExecution['logs']); + $this->assertStringContainsString($userId, (string) $lastExecution['logs']); + $this->assertStringContainsString('Event User', (string) $lastExecution['logs']); $this->assertNotEmpty($lastExecution['$id']); $headers = array_column($lastExecution['requestHeaders'] ?? [], 'value', 'name'); $this->assertEmpty($headers['x-appwrite-client-ip'] ?? ''); @@ -2408,7 +2404,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $execution['body']['responseStatusCode']); $this->assertGreaterThan(0, $execution['body']['duration']); $this->assertNotEmpty($execution['body']['responseBody']); - $this->assertStringContainsString("total", $execution['body']['responseBody']); + $this->assertStringContainsString("total", (string) $execution['body']['responseBody']); $execution = $this->createExecution($functionId, [ 'async' => true, @@ -2427,7 +2423,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $execution['body']['responseStatusCode']); $this->assertGreaterThan(0, $execution['body']['duration']); $this->assertNotEmpty($execution['body']['logs']); - $this->assertStringContainsString("total", $execution['body']['logs']); + $this->assertStringContainsString("total", (string) $execution['body']['logs']); }, 10000, 500); $this->cleanupFunction($functionId); @@ -2517,7 +2513,7 @@ class FunctionsCustomServerTest extends Scope ], $this->getHeaders()), []); $this->assertEquals(200, $executions['headers']['status-code']); - $this->assertEquals(1, count($executions['body']['executions'])); + $this->assertCount(1, $executions['body']['executions']); }); $this->assertEventually(function () use ($functionId) { @@ -2526,7 +2522,7 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(24, count($response['body'])); + $this->assertCount(24, $response['body']); $this->assertEquals('24h', $response['body']['range']); $this->assertEquals(1, $response['body']['executionsTotal']); }, 25000, 500); @@ -2822,7 +2818,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEventually(function () use ($functionId, $deploymentId) { $deployment = $this->getDeployment($functionId, $deploymentId); - $this->assertTrue(str_contains($deployment['body']['buildLogs'], '2048:2')); + $this->assertStringContainsString('2048:2', (string) $deployment['body']['buildLogs']); }, 10000, 500); // Check if the function specifications are correctly set in executions @@ -2857,7 +2853,7 @@ class FunctionsCustomServerTest extends Scope $execution = $this->createExecution($functionId); $this->assertEquals(201, $execution['headers']['status-code']); - $this->assertStringContainsString('APPWRITE_FUNCTION_ID', $execution['body']['responseBody']); + $this->assertStringContainsString('APPWRITE_FUNCTION_ID', (string) $execution['body']['responseBody']); $function = $this->updateFunction($functionId, [ 'runtime' => 'node-22', @@ -2866,7 +2862,7 @@ class FunctionsCustomServerTest extends Scope 'commands' => 'rm index.js && mv maintenance.js index.js' ]); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertStringContainsString('maintenance.js', $function['body']['commands']); + $this->assertStringContainsString('maintenance.js', (string) $function['body']['commands']); $deployment = $this->createDuplicateDeployment($functionId, $deploymentId1); $this->assertEquals(202, $deployment['headers']['status-code']); @@ -2887,7 +2883,7 @@ class FunctionsCustomServerTest extends Scope $execution = $this->createExecution($functionId); $this->assertEquals(201, $execution['headers']['status-code']); - $this->assertStringContainsString('Maintenance', $execution['body']['responseBody']); + $this->assertStringContainsString('Maintenance', (string) $execution['body']['responseBody']); $deployment = $this->getDeployment($functionId, $deploymentId2); $this->assertEquals(200, $deployment['headers']['status-code']); @@ -2935,7 +2931,7 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(201, $execution['headers']['status-code']); $this->assertNotEmpty($execution['body']['$id']); - $this->assertStringContainsString('cookieValue', $execution['body']['responseBody']); + $this->assertStringContainsString('cookieValue', (string) $execution['body']['responseBody']); $deploymentId2 = $this->setupDeployment($functionId, [ 'code' => $this->packageFunction('basic'), @@ -2951,7 +2947,7 @@ class FunctionsCustomServerTest extends Scope $execution = $this->createExecution($functionId); $this->assertEquals(201, $execution['headers']['status-code']); $this->assertNotEmpty($execution['body']['$id']); - $this->assertStringContainsString('UNICODE_TEST', $execution['body']['responseBody']); + $this->assertStringContainsString('UNICODE_TEST', (string) $execution['body']['responseBody']); $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); @@ -2974,7 +2970,7 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(201, $execution['headers']['status-code']); $this->assertNotEmpty($execution['body']['$id']); - $this->assertStringContainsString('cookieValue', $execution['body']['responseBody']); + $this->assertStringContainsString('cookieValue', (string) $execution['body']['responseBody']); $deployment = $this->deleteDeployment($functionId, $deploymentId2); $this->assertEquals(204, $deployment['headers']['status-code']); @@ -2999,8 +2995,8 @@ class FunctionsCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString('Nothing is here yet', $response['body']); - $this->assertStringContainsString('Start with this domain', $response['body']); + $this->assertStringContainsString('Nothing is here yet', (string) $response['body']); + $this->assertStringContainsString('Start with this domain', (string) $response['body']); // failed deployment $functionId = $this->setupFunction([ @@ -3029,8 +3025,8 @@ class FunctionsCustomServerTest extends Scope ])); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString('No active deployments', $response['body']); - $this->assertStringContainsString('View deployments', $response['body']); + $this->assertStringContainsString('No active deployments', (string) $response['body']); + $this->assertStringContainsString('View deployments', (string) $response['body']); // canceled deployment $deployment = $this->createDeployment($functionId, [ @@ -3051,8 +3047,8 @@ class FunctionsCustomServerTest extends Scope ])); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString('No active deployments', $response['body']); - $this->assertStringContainsString('View deployments', $response['body']); + $this->assertStringContainsString('No active deployments', (string) $response['body']); + $this->assertStringContainsString('View deployments', (string) $response['body']); $this->cleanupFunction($functionId); } @@ -3085,8 +3081,8 @@ class FunctionsCustomServerTest extends Scope ])); $this->assertEquals(401, $response['headers']['status-code']); - $this->assertStringContainsString('Execution not permitted', $response['body']); - $this->assertStringContainsString('View settings', $response['body']); + $this->assertStringContainsString('Execution not permitted', (string) $response['body']); + $this->assertStringContainsString('View settings', (string) $response['body']); $this->cleanupFunction($functionId); } @@ -3118,46 +3114,46 @@ class FunctionsCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'] ])); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString('Error 404', $response['body']); - $this->assertStringContainsString('does not exist', $response['body']); + $this->assertStringContainsString('Error 404', (string) $response['body']); + $this->assertStringContainsString('does not exist', (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=504', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ])); $this->assertEquals(504, $response['headers']['status-code']); - $this->assertStringContainsString('Error 504', $response['body']); - $this->assertStringContainsString('respond in time', $response['body']); + $this->assertStringContainsString('Error 504', (string) $response['body']); + $this->assertStringContainsString('respond in time', (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=400', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ])); $this->assertEquals(400, $response['headers']['status-code']); - $this->assertStringContainsString('Error 400', $response['body']); - $this->assertStringContainsString('unexpected client error', $response['body']); + $this->assertStringContainsString('Error 400', (string) $response['body']); + $this->assertStringContainsString('unexpected client error', (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=500', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ])); $this->assertEquals(500, $response['headers']['status-code']); - $this->assertStringContainsString('Error 500', $response['body']); - $this->assertStringContainsString('unexpected server error', $response['body']); + $this->assertStringContainsString('Error 500', (string) $response['body']); + $this->assertStringContainsString('unexpected server error', (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=400&body=CustomError400', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ])); $this->assertEquals(400, $response['headers']['status-code']); - $this->assertStringContainsString('CustomError400', $response['body']); + $this->assertStringContainsString('CustomError400', (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=500&body=CustomError500', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ])); $this->assertEquals(500, $response['headers']['status-code']); - $this->assertStringContainsString('CustomError500', $response['body']); + $this->assertStringContainsString('CustomError500', (string) $response['body']); $this->cleanupFunction($functionId); } @@ -3189,14 +3185,14 @@ class FunctionsCustomServerTest extends Scope $this->assertLessThanOrEqual(APP_FUNCTION_LOG_LENGTH_LIMIT, strlen($logs)); $this->assertStringStartsWith('[WARNING] Logs truncated', $logs); - $this->assertStringContainsString('a', $logs); + $this->assertStringContainsString('a', (string) $logs); // Verify errors are truncated and warning message is present at the beginning $errors = $execution['body']['errors']; $this->assertLessThanOrEqual(APP_FUNCTION_ERROR_LENGTH_LIMIT, strlen($errors)); $this->assertStringStartsWith('[WARNING] Errors truncated', $errors); - $this->assertStringContainsString('a', $errors); + $this->assertStringContainsString('a', (string) $errors); $this->cleanupFunction($functionId); } @@ -3315,4 +3311,5 @@ class FunctionsCustomServerTest extends Scope $this->cleanupFunction($functionId); } } + } diff --git a/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php b/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php index f4a70b5a9e..946f4069aa 100644 --- a/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php +++ b/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php @@ -1,5 +1,7 @@ add(new \DateInterval('PT2M')); // 2 minutes in the future - $futureTime->setTime($futureTime->format('H'), $futureTime->format('i'), 0, 0); + $futureTime->setTime((int) $futureTime->format('H'), (int) $futureTime->format('i'), 0, 0); $execution = $this->client->call( @@ -132,12 +134,12 @@ class FunctionsScheduleTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals('/custom-path', $execution['body']['requestPath']); $this->assertEquals('PATCH', $execution['body']['requestMethod']); - $this->assertStringContainsString('body-is-custom-body', $execution['body']['logs']); - $this->assertStringContainsString('custom-header-is-custom-value', $execution['body']['logs']); - $this->assertStringContainsString('method-is-patch', $execution['body']['logs']); - $this->assertStringContainsString('path-is-/custom-path', $execution['body']['logs']); - $this->assertStringContainsString('user-is-' . $this->getUser()['$id'], $execution['body']['logs']); - $this->assertStringContainsString('jwt-is-valid', $execution['body']['logs']); + $this->assertStringContainsString('body-is-custom-body', (string) $execution['body']['logs']); + $this->assertStringContainsString('custom-header-is-custom-value', (string) $execution['body']['logs']); + $this->assertStringContainsString('method-is-patch', (string) $execution['body']['logs']); + $this->assertStringContainsString('path-is-/custom-path', (string) $execution['body']['logs']); + $this->assertStringContainsString('user-is-' . $this->getUser()['$id'], (string) $execution['body']['logs']); + $this->assertStringContainsString('jwt-is-valid', (string) $execution['body']['logs']); $this->assertGreaterThan(0, $execution['body']['duration']); }, 120000, 500); @@ -191,7 +193,7 @@ class FunctionsScheduleTest extends Scope ]); $futureTime = (new \DateTime())->add(new \DateInterval('PT10H')); - $futureTime->setTime($futureTime->format('H'), $futureTime->format('i'), 0, 0); + $futureTime->setTime((int) $futureTime->format('H'), (int) $futureTime->format('i'), 0, 0); $execution = $this->createExecution($functionId, [ 'async' => true, diff --git a/tests/e2e/Services/GraphQL/AccountTest.php b/tests/e2e/Services/GraphQL/AccountTest.php index 76f98ce02f..4a7339a2d8 100644 --- a/tests/e2e/Services/GraphQL/AccountTest.php +++ b/tests/e2e/Services/GraphQL/AccountTest.php @@ -1,5 +1,7 @@ assertEquals(200, $creditCardIcon['headers']['status-code']); $this->assertNotEmpty($creditCardIcon['body']); - $this->assertStringContainsString('image/', $creditCardIcon['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $creditCardIcon['headers']['content-type']); return $creditCardIcon['body']; } @@ -54,7 +56,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $browserIcon['headers']['status-code']); $this->assertNotEmpty($browserIcon['body']); - $this->assertStringContainsString('image/', $browserIcon['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $browserIcon['headers']['content-type']); return $browserIcon['body']; } @@ -77,7 +79,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $countryFlag['headers']['status-code']); $this->assertNotEmpty($countryFlag['body']); - $this->assertStringContainsString('image/', $countryFlag['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $countryFlag['headers']['content-type']); return $countryFlag['body']; } @@ -100,7 +102,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $image['headers']['status-code']); $this->assertNotEmpty($image['body']); - $this->assertStringContainsString('image/', $image['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $image['headers']['content-type']); return $image['body']; } @@ -123,7 +125,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $favicon['headers']['status-code']); $this->assertNotEmpty($favicon['body']); - $this->assertStringContainsString('image/', $favicon['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $favicon['headers']['content-type']); return $favicon['body']; } @@ -146,7 +148,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $qrCode['headers']['status-code']); $this->assertNotEmpty($qrCode['body']); - $this->assertStringContainsString('image/', $qrCode['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $qrCode['headers']['content-type']); return $qrCode['body']; } @@ -169,7 +171,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $initials['headers']['status-code']); $this->assertNotEmpty($initials['body']); - $this->assertStringContainsString('image/', $initials['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $initials['headers']['content-type']); return $initials['body']; } @@ -201,7 +203,7 @@ class AvatarsTest extends Scope echo "Response body: " . print_r($screenshot['body'], true) . "\n"; } - $this->assertStringContainsString('image/', $screenshot['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $screenshot['headers']['content-type']); return $screenshot['body']; } @@ -232,7 +234,7 @@ class AvatarsTest extends Scope echo "Response body: " . print_r($screenshot['body'], true) . "\n"; } - $this->assertStringContainsString('image/', $screenshot['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $screenshot['headers']['content-type']); return $screenshot['body']; } @@ -284,7 +286,7 @@ class AvatarsTest extends Scope echo "Response body: " . print_r($screenshot['body'], true) . "\n"; } - $this->assertStringContainsString('image/', $screenshot['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $screenshot['headers']['content-type']); return $screenshot['body']; } @@ -311,7 +313,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $screenshot['headers']['status-code']); $this->assertNotEmpty($screenshot['body']); - $this->assertStringContainsString('image/', $screenshot['headers']['content-type']); + $this->assertStringContainsString('image/', (string) $screenshot['headers']['content-type']); return $screenshot['body']; } @@ -350,7 +352,7 @@ class AvatarsTest extends Scope } // If not an image, verify it's a known error (avatar_remote_url_failed) - $this->assertStringContainsString('application/json', $screenshot['headers']['content-type']); + $this->assertStringContainsString('application/json', (string) $screenshot['headers']['content-type']); return ''; } @@ -381,7 +383,7 @@ class AvatarsTest extends Scope $this->assertEquals(200, $screenshot['headers']['status-code']); $this->assertArrayHasKey('errors', $screenshot['body']); $this->assertNotEmpty($screenshot['body']['errors']); - $this->assertStringContainsString('Invalid `permissions` param', $screenshot['body']['errors'][0]['message']); + $this->assertStringContainsString('Invalid `permissions` param', (string) $screenshot['body']['errors'][0]['message']); return $screenshot['body']; } diff --git a/tests/e2e/Services/GraphQL/BatchTest.php b/tests/e2e/Services/GraphQL/BatchTest.php index 550568a896..78863d2495 100644 --- a/tests/e2e/Services/GraphQL/BatchTest.php +++ b/tests/e2e/Services/GraphQL/BatchTest.php @@ -1,5 +1,7 @@ setupFunction(); @@ -343,7 +345,7 @@ class FunctionsServerTest extends Scope * @return array * @throws \Exception */ - public function testGetDeployment() + public function testGetDeployment(): array { $deployment = $this->setupDeployment(); diff --git a/tests/e2e/Services/GraphQL/HealthTest.php b/tests/e2e/Services/GraphQL/HealthTest.php index 732f7b5b1a..8b00bc42ef 100644 --- a/tests/e2e/Services/GraphQL/HealthTest.php +++ b/tests/e2e/Services/GraphQL/HealthTest.php @@ -1,5 +1,7 @@ getProject()['$id']; $query = $this->getQuery(self::GET_HTTP_HEALTH); @@ -34,7 +36,7 @@ class HealthTest extends Scope return $httpHealth; } - public function testGetDBHealth() + public function testGetDBHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_DB_HEALTH); @@ -57,7 +59,7 @@ class HealthTest extends Scope return $dbHealth; } - public function testGetCacheHealth() + public function testGetCacheHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_CACHE_HEALTH); @@ -80,7 +82,7 @@ class HealthTest extends Scope return $cacheHealth; } - public function testGetTimeHealth() + public function testGetTimeHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_TIME_HEALTH); @@ -101,7 +103,7 @@ class HealthTest extends Scope return $timeHealth; } - public function testGetWebhooksQueueHealth() + public function testGetWebhooksQueueHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_WEBHOOKS_QUEUE_HEALTH); @@ -122,7 +124,7 @@ class HealthTest extends Scope return $webhooksQueueHealth; } - public function testGetLogsQueueHealth() + public function testGetLogsQueueHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_LOGS_QUEUE_HEALTH); @@ -143,7 +145,7 @@ class HealthTest extends Scope return $logsQueueHealth; } - public function testGetCertificatesQueueHealth() + public function testGetCertificatesQueueHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_CERTIFICATES_QUEUE_HEALTH); @@ -164,7 +166,7 @@ class HealthTest extends Scope return $certificatesQueueHealth; } - public function testGetFunctionsQueueHealth() + public function testGetFunctionsQueueHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_FUNCTION_QUEUE_HEALTH); @@ -185,7 +187,7 @@ class HealthTest extends Scope return $functionsQueueHealth; } - public function testGetLocalStorageHealth() + public function testGetLocalStorageHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_LOCAL_STORAGE_HEALTH); @@ -206,7 +208,7 @@ class HealthTest extends Scope return $localStorageHealth; } - public function testGetAntiVirusHealth() + public function testGetAntiVirusHealth(): array { $projectId = $this->getProject()['$id']; $query = $this->getQuery(self::GET_ANITVIRUS_HEALTH); diff --git a/tests/e2e/Services/GraphQL/Legacy/AbuseTest.php b/tests/e2e/Services/GraphQL/Legacy/AbuseTest.php index 39939fdc0e..767187e808 100644 --- a/tests/e2e/Services/GraphQL/Legacy/AbuseTest.php +++ b/tests/e2e/Services/GraphQL/Legacy/AbuseTest.php @@ -1,5 +1,7 @@ $projectId, ], $this->getHeaders(false)), $graphQLPayload); - $max = System::getEnv('_APP_GRAPHQL_MAX_QUERY_COMPLEXITY', 250); + $max = System::getEnv('_APP_GRAPHQL_MAX_QUERY_COMPLEXITY', '250'); $this->assertEquals('Max query complexity should be ' . $max . ' but got 259.', $response['body']['errors'][0]['message']); } @@ -99,7 +101,7 @@ class AbuseTest extends Scope public function testTooManyQueriesBlocked() { $projectId = $this->getProject()['$id']; - $maxQueries = System::getEnv('_APP_GRAPHQL_MAX_QUERIES', 10); + $maxQueries = System::getEnv('_APP_GRAPHQL_MAX_QUERIES', '10'); $query = []; for ($i = 0; $i <= ((int) $maxQueries) + 1; $i++) { diff --git a/tests/e2e/Services/GraphQL/Legacy/AuthTest.php b/tests/e2e/Services/GraphQL/Legacy/AuthTest.php index d3c6d01ffa..22fdb3c0d1 100644 --- a/tests/e2e/Services/GraphQL/Legacy/AuthTest.php +++ b/tests/e2e/Services/GraphQL/Legacy/AuthTest.php @@ -1,5 +1,7 @@ assertStringContainsString('already', $attribute['body']['errors'][0]['message']); + $this->assertStringContainsString('already', (string) $attribute['body']['errors'][0]['message']); } else { $this->assertIsArray($attribute['body']['data']); $this->assertIsArray($attribute['body']['data']['databasesCreateStringAttribute']); @@ -519,7 +521,7 @@ class DatabaseClientTest extends Scope // Attribute may already exist from setupAttributes, so we check for either success or already exists error if (isset($attribute['body']['errors'])) { - $this->assertStringContainsString('already', $attribute['body']['errors'][0]['message']); + $this->assertStringContainsString('already', (string) $attribute['body']['errors'][0]['message']); } else { $this->assertIsArray($attribute['body']['data']); $this->assertIsArray($attribute['body']['data']['databasesCreateIntegerAttribute']); @@ -618,7 +620,7 @@ class DatabaseClientTest extends Scope $document = $document['body']['data']['databasesUpdateDocument']; $this->assertIsArray($document); - $this->assertStringContainsString('New Document Name', $document['data']); + $this->assertStringContainsString('New Document Name', (string) $document['data']); } /** diff --git a/tests/e2e/Services/GraphQL/Legacy/DatabaseServerTest.php b/tests/e2e/Services/GraphQL/Legacy/DatabaseServerTest.php index 77c70dc83c..c148a1b0e0 100644 --- a/tests/e2e/Services/GraphQL/Legacy/DatabaseServerTest.php +++ b/tests/e2e/Services/GraphQL/Legacy/DatabaseServerTest.php @@ -1,5 +1,7 @@ assertIsArray($attribute['body']['data']); $this->assertIsArray($attribute['body']['data']['databasesUpdateFloatAttribute']); $this->assertFalse($attribute['body']['data']['databasesUpdateFloatAttribute']['required']); - $this->assertEquals(100.0, $attribute['body']['data']['databasesUpdateFloatAttribute']['min']); - $this->assertEquals(1000000.0, $attribute['body']['data']['databasesUpdateFloatAttribute']['max']); - $this->assertEquals(2500.0, $attribute['body']['data']['databasesUpdateFloatAttribute']['default']); + $this->assertEqualsWithDelta(100.0, $attribute['body']['data']['databasesUpdateFloatAttribute']['min'], PHP_FLOAT_EPSILON); + $this->assertEqualsWithDelta(1000000.0, $attribute['body']['data']['databasesUpdateFloatAttribute']['max'], PHP_FLOAT_EPSILON); + $this->assertEqualsWithDelta(2500.0, $attribute['body']['data']['databasesUpdateFloatAttribute']['default'], PHP_FLOAT_EPSILON); $this->assertEquals(200, $attribute['headers']['status-code']); } @@ -2207,7 +2209,7 @@ class DatabaseServerTest extends Scope $this->assertIsArray($document['body']['data']); $document = $document['body']['data']['databasesUpdateDocument']; $this->assertIsArray($document); - $this->assertStringContainsString('New Document Name', $document['data']); + $this->assertStringContainsString('New Document Name', (string) $document['data']); } // /** diff --git a/tests/e2e/Services/GraphQL/LocalizationTest.php b/tests/e2e/Services/GraphQL/LocalizationTest.php index 182cdaabae..c67da2eaeb 100644 --- a/tests/e2e/Services/GraphQL/LocalizationTest.php +++ b/tests/e2e/Services/GraphQL/LocalizationTest.php @@ -1,5 +1,7 @@ assertEquals(200, $message['headers']['status-code']); $this->assertEquals(1, $message['body']['data']['messagingGetMessage']['deliveredTotal']); - $this->assertEquals(0, \count($message['body']['data']['messagingGetMessage']['deliveryErrors'])); + $this->assertCount(0, $message['body']['data']['messagingGetMessage']['deliveryErrors']); self::$cachedEmail[$key] = $message['body']['data']['messagingGetMessage']; return self::$cachedEmail[$key]; @@ -707,7 +709,7 @@ class MessagingTest extends Scope $this->assertEquals(200, $message['headers']['status-code']); $this->assertEquals(1, $message['body']['data']['messagingGetMessage']['deliveredTotal']); - $this->assertEquals(0, \count($message['body']['data']['messagingGetMessage']['deliveryErrors'])); + $this->assertCount(0, $message['body']['data']['messagingGetMessage']['deliveryErrors']); self::$cachedSms[$key] = $message['body']['data']['messagingGetMessage']; return self::$cachedSms[$key]; @@ -868,7 +870,7 @@ class MessagingTest extends Scope $this->assertEquals(200, $message['headers']['status-code']); $this->assertEquals(1, $message['body']['data']['messagingGetMessage']['deliveredTotal']); - $this->assertEquals(0, \count($message['body']['data']['messagingGetMessage']['deliveryErrors'])); + $this->assertCount(0, $message['body']['data']['messagingGetMessage']['deliveryErrors']); self::$cachedPush[$key] = $message['body']['data']['messagingGetMessage']; return self::$cachedPush[$key]; @@ -900,7 +902,7 @@ class MessagingTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'], ], $graphQLPayload); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(\count($providers), \count($response['body']['data']['messagingListProviders']['providers'])); + $this->assertCount(\count($providers), $response['body']['data']['messagingListProviders']['providers']); } public function testGetProvider() @@ -976,7 +978,7 @@ class MessagingTest extends Scope ]), $graphQLPayload); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(1, \count($response['body']['data']['messagingListTopics']['topics'])); + $this->assertCount(1, $response['body']['data']['messagingListTopics']['topics']); } public function testGetTopic() @@ -1027,7 +1029,7 @@ class MessagingTest extends Scope $this->assertEquals($subscriber['topicId'], $response['body']['data']['messagingListSubscribers']['subscribers'][0]['topicId']); $this->assertEquals($subscriber['targetId'], $response['body']['data']['messagingListSubscribers']['subscribers'][0]['targetId']); $this->assertEquals($subscriber['target']['userId'], $response['body']['data']['messagingListSubscribers']['subscribers'][0]['target']['userId']); - $this->assertEquals(1, \count($response['body']['data']['messagingListSubscribers']['subscribers'])); + $this->assertCount(1, $response['body']['data']['messagingListSubscribers']['subscribers']); } public function testGetSubscriber() @@ -1179,7 +1181,7 @@ class MessagingTest extends Scope $this->assertEquals(200, $message['headers']['status-code']); $this->assertEquals(1, $message['body']['data']['messagingGetMessage']['deliveredTotal']); - $this->assertEquals(0, \count($message['body']['data']['messagingGetMessage']['deliveryErrors'])); + $this->assertCount(0, $message['body']['data']['messagingGetMessage']['deliveryErrors']); } public function testSendSMS(): void @@ -1251,7 +1253,7 @@ class MessagingTest extends Scope $this->assertEquals(200, $message['headers']['status-code']); $this->assertEquals(1, $message['body']['data']['messagingGetMessage']['deliveredTotal']); - $this->assertEquals(0, \count($message['body']['data']['messagingGetMessage']['deliveryErrors'])); + $this->assertCount(0, $message['body']['data']['messagingGetMessage']['deliveryErrors']); } public function testSendPushNotification(): void @@ -1324,6 +1326,6 @@ class MessagingTest extends Scope $this->assertEquals(200, $message['headers']['status-code']); $this->assertEquals(1, $message['body']['data']['messagingGetMessage']['deliveredTotal']); - $this->assertEquals(0, \count($message['body']['data']['messagingGetMessage']['deliveryErrors'])); + $this->assertCount(0, $message['body']['data']['messagingGetMessage']['deliveryErrors']); } } diff --git a/tests/e2e/Services/GraphQL/PresenceTest.php b/tests/e2e/Services/GraphQL/PresenceTest.php index b0329e1c97..141de11441 100644 --- a/tests/e2e/Services/GraphQL/PresenceTest.php +++ b/tests/e2e/Services/GraphQL/PresenceTest.php @@ -1,5 +1,7 @@ setupFile(); @@ -209,7 +211,7 @@ class StorageClientTest extends Scope * @return array * @throws \Exception */ - public function testGetFileDownload() + public function testGetFileDownload(): array { $file = $this->setupFile(); @@ -228,7 +230,7 @@ class StorageClientTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $gqlPayload); - $this->assertEquals(47218, \strlen($file['body'])); + $this->assertSame(47218, \strlen($file['body'])); return $file; } @@ -255,7 +257,7 @@ class StorageClientTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $gqlPayload); - $this->assertEquals(47218, \strlen($file['body'])); + $this->assertSame(47218, \strlen($file['body'])); } /** diff --git a/tests/e2e/Services/GraphQL/StorageServerTest.php b/tests/e2e/Services/GraphQL/StorageServerTest.php index 7808c50be6..91d9f24dab 100644 --- a/tests/e2e/Services/GraphQL/StorageServerTest.php +++ b/tests/e2e/Services/GraphQL/StorageServerTest.php @@ -1,5 +1,7 @@ setupFile(); @@ -271,7 +273,7 @@ class StorageServerTest extends Scope * @return array * @throws \Exception */ - public function testGetFileDownload() + public function testGetFileDownload(): array { $file = $this->setupFile(); @@ -290,7 +292,7 @@ class StorageServerTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $gqlPayload); - $this->assertEquals(47218, \strlen($file['body'])); + $this->assertSame(47218, \strlen($file['body'])); return $file; } @@ -317,7 +319,7 @@ class StorageServerTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $gqlPayload); - $this->assertEquals(47218, \strlen($file['body'])); + $this->assertSame(47218, \strlen($file['body'])); } /** diff --git a/tests/e2e/Services/GraphQL/TablesDB/AbuseTest.php b/tests/e2e/Services/GraphQL/TablesDB/AbuseTest.php index c358882b8b..38370f4a05 100644 --- a/tests/e2e/Services/GraphQL/TablesDB/AbuseTest.php +++ b/tests/e2e/Services/GraphQL/TablesDB/AbuseTest.php @@ -1,5 +1,7 @@ $projectId, ], $this->getHeaders()), $graphQLPayload); - $max = System::getEnv('_APP_GRAPHQL_MAX_QUERY_COMPLEXITY', 250); + $max = System::getEnv('_APP_GRAPHQL_MAX_QUERY_COMPLEXITY', '250'); $this->assertEquals('Max query complexity should be ' . $max . ' but got 259.', $response['body']['errors'][0]['message']); } @@ -99,7 +101,7 @@ class AbuseTest extends Scope public function testTooManyQueriesBlocked() { $projectId = $this->getProject()['$id']; - $maxQueries = System::getEnv('_APP_GRAPHQL_MAX_QUERIES', 10); + $maxQueries = System::getEnv('_APP_GRAPHQL_MAX_QUERIES', '10'); $query = []; for ($i = 0; $i <= ((int) $maxQueries) + 1; $i++) { diff --git a/tests/e2e/Services/GraphQL/TablesDB/AuthTest.php b/tests/e2e/Services/GraphQL/TablesDB/AuthTest.php index 13f083f0eb..7f71f78374 100644 --- a/tests/e2e/Services/GraphQL/TablesDB/AuthTest.php +++ b/tests/e2e/Services/GraphQL/TablesDB/AuthTest.php @@ -1,5 +1,7 @@ assertIsArray($row); - $this->assertStringContainsString('New Row Name', $row['data']); + $this->assertStringContainsString('New Row Name', (string) $row['data']); } /** diff --git a/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php b/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php index f0b4e4b75c..12910be6c0 100644 --- a/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php +++ b/tests/e2e/Services/GraphQL/TablesDB/DatabaseServerTest.php @@ -1,5 +1,7 @@ assertIsArray($column['body']['data']); $this->assertIsArray($column['body']['data']['tablesDBUpdateFloatColumn']); $this->assertFalse($column['body']['data']['tablesDBUpdateFloatColumn']['required']); - $this->assertEquals(100.0, $column['body']['data']['tablesDBUpdateFloatColumn']['min']); - $this->assertEquals(1000000.0, $column['body']['data']['tablesDBUpdateFloatColumn']['max']); - $this->assertEquals(2500.0, $column['body']['data']['tablesDBUpdateFloatColumn']['default']); + $this->assertEqualsWithDelta(100.0, $column['body']['data']['tablesDBUpdateFloatColumn']['min'], PHP_FLOAT_EPSILON); + $this->assertEqualsWithDelta(1000000.0, $column['body']['data']['tablesDBUpdateFloatColumn']['max'], PHP_FLOAT_EPSILON); + $this->assertEqualsWithDelta(2500.0, $column['body']['data']['tablesDBUpdateFloatColumn']['default'], PHP_FLOAT_EPSILON); $this->assertEquals(200, $column['headers']['status-code']); } @@ -2390,7 +2392,7 @@ class DatabaseServerTest extends Scope $this->assertIsArray($row['body']['data']); $row = $row['body']['data']['tablesDBUpdateRow']; $this->assertIsArray($row); - $this->assertStringContainsString('New Row Name', $row['data']); + $this->assertStringContainsString('New Row Name', (string) $row['data']); } // /** diff --git a/tests/e2e/Services/GraphQL/TeamsClientTest.php b/tests/e2e/Services/GraphQL/TeamsClientTest.php index e6c27f44f8..fac138fe89 100644 --- a/tests/e2e/Services/GraphQL/TeamsClientTest.php +++ b/tests/e2e/Services/GraphQL/TeamsClientTest.php @@ -1,5 +1,7 @@ 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + + // Create with full credentials but no fromEmail, so the provider stays disabled. + $response = $this->client->call(Client::METHOD_POST, '/messaging/providers/ses', $headers, [ + 'providerId' => ID::unique(), + 'name' => 'SES1', + 'accessKey' => 'my-access-key', + 'secretKey' => 'my-secret-key', + 'region' => 'us-east-1', + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertEquals('SES1', $response['body']['name']); + $this->assertEquals('ses', $response['body']['provider']); + $this->assertEquals('email', $response['body']['type']); + $this->assertEquals(false, $response['body']['enabled']); + $this->assertEquals('my-access-key', $response['body']['credentials']['accessKey']); + $this->assertEquals('my-secret-key', $response['body']['credentials']['secretKey']); + $this->assertEquals('us-east-1', $response['body']['credentials']['region']); + $this->assertArrayHasKey('fromEmail', $response['body']['options']); + $this->assertArrayNotHasKey('accessKey', $response['body']['options']); + + $providerId = $response['body']['$id']; + + // Create enabled: all credentials plus fromEmail present. + $enabledResponse = $this->client->call(Client::METHOD_POST, '/messaging/providers/ses', $headers, [ + 'providerId' => ID::unique(), + 'name' => 'SES-enabled', + 'accessKey' => 'my-access-key', + 'secretKey' => 'my-secret-key', + 'region' => 'us-east-1', + 'fromName' => 'Sender Name', + 'fromEmail' => 'sender-email@my-domain.com', + 'enabled' => true, + ]); + + $this->assertEquals(201, $enabledResponse['headers']['status-code']); + $this->assertEquals(true, $enabledResponse['body']['enabled']); + $this->assertEquals('sender-email@my-domain.com', $enabledResponse['body']['options']['fromEmail']); + + // Sparse update: change only the region, credentials must be preserved. + $updateResponse = $this->client->call(Client::METHOD_PATCH, '/messaging/providers/ses/' . $providerId, $headers, [ + 'name' => 'SES2', + 'region' => 'eu-west-1', + ]); + + $this->assertEquals(200, $updateResponse['headers']['status-code']); + $this->assertEquals('SES2', $updateResponse['body']['name']); + $this->assertEquals('eu-west-1', $updateResponse['body']['credentials']['region']); + $this->assertEquals('my-access-key', $updateResponse['body']['credentials']['accessKey']); + $this->assertEquals('my-secret-key', $updateResponse['body']['credentials']['secretKey']); + + // Regression: enabling while fromEmail is still empty must be rejected, not silently enabled. + $enableWithoutFromEmail = $this->client->call(Client::METHOD_PATCH, '/messaging/providers/ses/' . $providerId, $headers, [ + 'enabled' => true, + ]); + + $this->assertEquals(400, $enableWithoutFromEmail['headers']['status-code']); + $this->assertEquals('provider_missing_credentials', $enableWithoutFromEmail['body']['type']); + + // Enable the first provider once fromEmail is supplied. + $enableResponse = $this->client->call(Client::METHOD_PATCH, '/messaging/providers/ses/' . $providerId, $headers, [ + 'fromEmail' => 'sender-email@my-domain.com', + 'enabled' => true, + ]); + + $this->assertEquals(200, $enableResponse['headers']['status-code']); + $this->assertEquals(true, $enableResponse['body']['enabled']); + + // Updating an SES provider through a different provider route is rejected. + $wrongTypeResponse = $this->client->call(Client::METHOD_PATCH, '/messaging/providers/sendgrid/' . $providerId, $headers, [ + 'name' => 'Wrong', + ]); + + $this->assertEquals(400, $wrongTypeResponse['headers']['status-code']); + + $deleteResponse = $this->client->call(Client::METHOD_DELETE, '/messaging/providers/' . $providerId, $headers); + $this->assertEquals(204, $deleteResponse['headers']['status-code']); + + $deleteEnabledResponse = $this->client->call(Client::METHOD_DELETE, '/messaging/providers/' . $enabledResponse['body']['$id'], $headers); + $this->assertEquals(204, $deleteEnabledResponse['headers']['status-code']); + } + public function testCreateTopic(): void { $response1 = $this->client->call(Client::METHOD_POST, '/messaging/topics', [ diff --git a/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php b/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php index 0e91671b71..b2b960dfbe 100644 --- a/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php +++ b/tests/e2e/Services/Messaging/MessagingConsoleClientTest.php @@ -1,5 +1,7 @@ $this->getProject()['$id'], ], $this->getHeaders())); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -62,7 +64,7 @@ class MessagingConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); $this->assertCount(2, $logs['body']['logs']); @@ -77,7 +79,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertLessThanOrEqual(1, count($logs['body']['logs'])); $this->assertIsNumeric($logs['body']['total']); @@ -91,7 +93,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -105,7 +107,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertLessThanOrEqual(1, count($logs['body']['logs'])); $this->assertIsNumeric($logs['body']['total']); @@ -122,7 +124,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/providers/' . $provider['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -133,7 +135,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/providers/' . $provider['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -144,7 +146,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/providers/' . $provider['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -155,7 +157,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/providers/' . $provider['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -166,7 +168,7 @@ class MessagingConsoleClientTest extends Scope ] ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); } public function testGetTopicLogs(): void @@ -180,7 +182,7 @@ class MessagingConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -208,7 +210,7 @@ class MessagingConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertCount(2, $logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -223,7 +225,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertLessThanOrEqual(1, count($logs['body']['logs'])); $this->assertIsNumeric($logs['body']['total']); @@ -237,7 +239,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -251,7 +253,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertLessThanOrEqual(1, count($logs['body']['logs'])); $this->assertIsNumeric($logs['body']['total']); @@ -268,7 +270,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $topic['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -279,7 +281,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $topic['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -290,7 +292,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $topic['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -301,7 +303,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $topic['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -312,7 +314,7 @@ class MessagingConsoleClientTest extends Scope ] ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); } public function testGetMessageLogs(): void @@ -334,7 +336,7 @@ class MessagingConsoleClientTest extends Scope 'x-appwrite-key' => $this->getProject()['apiKey'], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -365,7 +367,7 @@ class MessagingConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); $this->assertCount(2, $logs['body']['logs']); @@ -379,7 +381,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertLessThanOrEqual(1, count($logs['body']['logs'])); $this->assertIsNumeric($logs['body']['total']); @@ -393,7 +395,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertIsNumeric($logs['body']['total']); @@ -407,7 +409,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($logs['headers']['status-code'], 200); + $this->assertEquals(200, $logs['headers']['status-code']); $this->assertIsArray($logs['body']['logs']); $this->assertLessThanOrEqual(1, count($logs['body']['logs'])); $this->assertIsNumeric($logs['body']['total']); @@ -424,7 +426,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $email['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -435,7 +437,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $email['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -446,7 +448,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $email['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -457,7 +459,7 @@ class MessagingConsoleClientTest extends Scope ], ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_GET, '/messaging/messages/' . $email['body']['$id'] . '/logs', \array_merge([ 'content-type' => 'application/json', @@ -468,6 +470,6 @@ class MessagingConsoleClientTest extends Scope ] ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); } } diff --git a/tests/e2e/Services/Messaging/MessagingCustomClientTest.php b/tests/e2e/Services/Messaging/MessagingCustomClientTest.php index ee7d0c2ad9..5395d3fe8a 100644 --- a/tests/e2e/Services/Messaging/MessagingCustomClientTest.php +++ b/tests/e2e/Services/Messaging/MessagingCustomClientTest.php @@ -1,12 +1,14 @@ assertEquals(Appwrite::getSupportedResources(), $response['resources']); $this->assertEquals('Appwrite', $response['source']); $this->assertEquals('Appwrite', $response['destination']); - $this->assertEmpty($response['statusCounters']); + + // ProjectCustom provisions an api-key and a webhook on each project, so both show up + // here. Other resources stay empty and getStatusCounters strips them. + // Webhook is name-deduped on the destination — source ProjectCustom's 'Webhook Test' + // collides with destination ProjectCustom's, so it lands in 'skip', not 'success'. + $this->assertArrayHasKey(Resource::TYPE_API_KEY, $response['statusCounters']); + $this->assertArrayHasKey(Resource::TYPE_WEBHOOK, $response['statusCounters']); + + $apiKeyCounts = $response['statusCounters'][Resource::TYPE_API_KEY]; + $this->assertEquals(0, $apiKeyCounts['error']); + $this->assertGreaterThan(0, $apiKeyCounts['success']); + + $webhookCounts = $response['statusCounters'][Resource::TYPE_WEBHOOK]; + $this->assertEquals(0, $webhookCounts['error']); } /** @@ -2540,6 +2554,955 @@ trait MigrationsBase $this->client->call(Client::METHOD_DELETE, '/project/platforms/' . $platform['$id'], $sourceHeaders); } + public function testAppwriteMigrationApiKey(): void + { + $sourceHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + + $destinationHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getDestinationProject()['$id'], + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Create API key on source project + $response = $this->client->call(Client::METHOD_POST, '/project/keys', $sourceHeaders, [ + 'keyId' => ID::unique(), + 'name' => 'Test API Key', + 'scopes' => ['databases.read', 'databases.write'], + 'expire' => null, + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertNotEmpty($response['body']['$id']); + + $apiKey = $response['body']; + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_API_KEY, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $this->getProject()['$id'], + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_API_KEY], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_API_KEY, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_API_KEY]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_API_KEY]['pending']); + $this->assertGreaterThanOrEqual(1, $result['statusCounters'][Resource::TYPE_API_KEY]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_API_KEY]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_API_KEY]['warning']); + + // Verify API key on destination project using the project's API key + $response = $this->client->call(Client::METHOD_GET, '/project/keys', $destinationHeaders); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']); + $this->assertGreaterThan(0, $response['body']['total']); + + $foundKey = null; + + foreach ($response['body']['keys'] as $k) { + if ($k['name'] === 'Test API Key') { + $foundKey = $k; + + break; + } + } + + $this->assertNotNull($foundKey); + $this->assertEquals('Test API Key', $foundKey['name']); + $this->assertEqualsCanonicalizing(['databases.read', 'databases.write'], $foundKey['scopes']); + $this->assertEmpty($foundKey['expire']); + $this->assertNotEquals($apiKey['secret'], $foundKey['secret']); + + // Cleanup migrated keys on destination — delete anything that isn't the destination's own auth key, + // otherwise later tests inherit duplicated apiKeys and fail on conflict. + $destinationAuthSecret = $this->getDestinationProject()['apiKey']; + foreach ($response['body']['keys'] as $k) { + if ($k['secret'] === $destinationAuthSecret) { + continue; + } + $this->client->call(Client::METHOD_DELETE, '/project/keys/' . $k['$id'], $destinationHeaders); + } + + // Cleanup on source + $this->client->call(Client::METHOD_DELETE, '/project/keys/' . $apiKey['$id'], $sourceHeaders); + } + + public function testAppwriteMigrationWebhook(): void + { + $sourceHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + + $destinationHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getDestinationProject()['$id'], + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Unique name so re-runs and parallel suites can't match the wrong webhook + // on the destination list. + $webhookName = 'Test Webhook ' . ID::unique(); + + $createResp = $this->client->call(Client::METHOD_POST, '/webhooks', $sourceHeaders, [ + 'webhookId' => ID::unique(), + 'url' => 'https://appwrite.io/hook', + 'name' => $webhookName, + 'events' => ['users.*.create', 'users.*.delete'], + 'enabled' => true, + 'tls' => true, + 'authUsername' => 'hook-user', + 'authPassword' => 'hook-pass', + ]); + $this->assertEquals(201, $createResp['headers']['status-code']); + $sourceWebhook = $createResp['body']; + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_WEBHOOK, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $this->getProject()['$id'], + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_WEBHOOK], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_WEBHOOK, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_WEBHOOK]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_WEBHOOK]['pending']); + $this->assertGreaterThanOrEqual(1, $result['statusCounters'][Resource::TYPE_WEBHOOK]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_WEBHOOK]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_WEBHOOK]['warning']); + + $listResp = $this->client->call(Client::METHOD_GET, '/webhooks', $destinationHeaders); + $this->assertEquals(200, $listResp['headers']['status-code']); + + $foundWebhook = null; + foreach ($listResp['body']['webhooks'] as $w) { + if ($w['name'] === $webhookName) { + $foundWebhook = $w; + break; + } + } + + $this->assertNotNull($foundWebhook, 'Migrated webhook not found on destination'); + $this->assertEquals($webhookName, $foundWebhook['name']); + $this->assertEquals('https://appwrite.io/hook', $foundWebhook['url']); + $this->assertEqualsCanonicalizing(['users.*.create', 'users.*.delete'], $foundWebhook['events']); + $this->assertTrue($foundWebhook['enabled']); + $this->assertTrue($foundWebhook['tls']); + $this->assertEquals('hook-user', $foundWebhook['authUsername']); + $this->assertEquals('hook-pass', $foundWebhook['authPassword']); + // secret is regenerated on the destination because the SDK strips it from list + // responses on read — same caveat as api keys. + if (!empty($sourceWebhook['secret'])) { + $this->assertNotEquals($sourceWebhook['secret'], $foundWebhook['secret'] ?? ''); + } + + // Cleanup on destination + $this->client->call(Client::METHOD_DELETE, '/webhooks/' . $foundWebhook['$id'], $destinationHeaders); + + // Cleanup on source + $this->client->call(Client::METHOD_DELETE, '/webhooks/' . $sourceWebhook['$id'], $sourceHeaders); + } + + public function testAppwriteMigrationProjectVariable(): void + { + $sourceHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + + $destinationHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getDestinationProject()['$id'], + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + $listDestinationVariables = function () use ($destinationHeaders): array { + $variables = []; + $cursorId = null; + + do { + $queries = [ + Query::limit(100)->toString(), + ]; + + if ($cursorId !== null) { + $queries[] = Query::cursorAfter(new Document(['$id' => $cursorId]))->toString(); + } + + $response = $this->client->call(Client::METHOD_GET, '/project/variables', $destinationHeaders, [ + 'queries' => $queries, + 'total' => false, + ]); + $this->assertEquals(200, $response['headers']['status-code']); + + $batch = $response['body']['variables']; + array_push($variables, ...$batch); + $cursorId = !empty($batch) ? $batch[array_key_last($batch)]['$id'] : null; + } while (\count($batch) === 100); + + return $variables; + }; + + $existingDestinationVariableIds = \array_flip(\array_column($listDestinationVariables(), '$id')); + + // Source-side variable IDs and keys are uniquified so re-runs and parallel suites + // can't trip the source-side findOne('variables', [key=...]) skip path. + $plainKey = 'TEST_PLAIN_' . \strtoupper(ID::unique()); + $secretKey = 'TEST_SECRET_' . \strtoupper(ID::unique()); + + // Non-secret variable: value should round-trip exactly. + $plainResp = $this->client->call(Client::METHOD_POST, '/project/variables', $sourceHeaders, [ + 'variableId' => ID::unique(), + 'key' => $plainKey, + 'value' => 'plain-value', + 'secret' => false, + ]); + $this->assertEquals(201, $plainResp['headers']['status-code']); + $plainVariable = $plainResp['body']; + + // Secret variable: SDK strips `value` on subsequent reads, so the migration + // source sees empty and the destination writes empty. Test asserts that. + $secretResp = $this->client->call(Client::METHOD_POST, '/project/variables', $sourceHeaders, [ + 'variableId' => ID::unique(), + 'key' => $secretKey, + 'value' => 'real-secret-value', + 'secret' => true, + ]); + $this->assertEquals(201, $secretResp['headers']['status-code']); + $secretVariable = $secretResp['body']; + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_PROJECT_VARIABLE, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $this->getProject()['$id'], + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_PROJECT_VARIABLE], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_PROJECT_VARIABLE, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_VARIABLE]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_VARIABLE]['pending']); + $this->assertGreaterThanOrEqual(2, $result['statusCounters'][Resource::TYPE_PROJECT_VARIABLE]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_VARIABLE]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_VARIABLE]['warning']); + + $destinationVariables = $listDestinationVariables(); + + $foundPlain = null; + $foundSecret = null; + foreach ($destinationVariables as $v) { + if ($v['key'] === $plainKey) { + $foundPlain = $v; + } elseif ($v['key'] === $secretKey) { + $foundSecret = $v; + } + } + + $this->assertNotNull($foundPlain, 'Plain variable not found on destination'); + $this->assertEquals($plainKey, $foundPlain['key']); + $this->assertEquals('plain-value', $foundPlain['value']); + $this->assertFalse($foundPlain['secret']); + + $this->assertNotNull($foundSecret, 'Secret variable not found on destination'); + $this->assertEquals($secretKey, $foundSecret['key']); + // Secret variables: source SDK never returned the real value, so the destination + // also stores empty. The original 'real-secret-value' must not have leaked. + $this->assertEmpty($foundSecret['value']); + $this->assertTrue($foundSecret['secret']); + + // Cleanup every destination variable this migration added, including any + // unrelated source variables copied by the resource-level migration. + foreach ($destinationVariables as $variable) { + if (!isset($existingDestinationVariableIds[$variable['$id']])) { + $this->client->call(Client::METHOD_DELETE, '/project/variables/' . $variable['$id'], $destinationHeaders); + } + } + + // Cleanup on source + $this->client->call(Client::METHOD_DELETE, '/project/variables/' . $plainVariable['$id'], $sourceHeaders); + $this->client->call(Client::METHOD_DELETE, '/project/variables/' . $secretVariable['$id'], $sourceHeaders); + } + + public function testAppwriteMigrationAuthMethods(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Flip a couple of auth methods on the source so the round-trip is + // observable. Settling on email-password OFF and JWT OFF — the + // remaining flags stay on their server defaults. + $this->client->call(Client::METHOD_PATCH, '/project/auth-methods/email-password', $sourceKeyHeaders, [ + 'enabled' => false, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/auth-methods/jwt', $sourceKeyHeaders, [ + 'enabled' => false, + ]); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_AUTH_METHODS, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_AUTH_METHODS], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_AUTH_METHODS, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_AUTH_METHODS]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_AUTH_METHODS]['pending']); + $this->assertEquals(1, $result['statusCounters'][Resource::TYPE_AUTH_METHODS]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_AUTH_METHODS]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_AUTH_METHODS]['warning']); + + $response = $this->client->call(Client::METHOD_GET, '/project', $destinationKeyHeaders); + + $this->assertEquals(200, $response['headers']['status-code']); + $authMethods = \array_column($response['body']['authMethods'] ?? [], 'enabled', '$id'); + $this->assertFalse($authMethods['email-password'] ?? null, 'email-password auth method should be migrated as false'); + $this->assertFalse($authMethods['jwt'] ?? null, 'jwt auth method should be migrated as false'); + + // Restore source so the test is idempotent. + $this->client->call(Client::METHOD_PATCH, '/project/auth-methods/email-password', $sourceKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/auth-methods/jwt', $sourceKeyHeaders, ['enabled' => true]); + // Restore destination too. + $this->client->call(Client::METHOD_PATCH, '/project/auth-methods/email-password', $destinationKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/auth-methods/jwt', $destinationKeyHeaders, ['enabled' => true]); + } + + public function testAppwriteMigrationProtocols(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Flip graphql + websocket off on source to make the round-trip observable. + $this->client->call(Client::METHOD_PATCH, '/project/protocols/graphql', $sourceKeyHeaders, [ + 'enabled' => false, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/protocols/websocket', $sourceKeyHeaders, [ + 'enabled' => false, + ]); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_PROJECT_PROTOCOLS, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_PROJECT_PROTOCOLS], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_PROJECT_PROTOCOLS, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_PROTOCOLS]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_PROTOCOLS]['pending']); + $this->assertEquals(1, $result['statusCounters'][Resource::TYPE_PROJECT_PROTOCOLS]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_PROTOCOLS]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_PROTOCOLS]['warning']); + + $response = $this->client->call(Client::METHOD_GET, '/project', $destinationKeyHeaders); + + $this->assertEquals(200, $response['headers']['status-code']); + $protocols = \array_column($response['body']['protocols'] ?? [], 'enabled', '$id'); + $this->assertFalse($protocols['graphql'] ?? null, 'GraphQL protocol should be migrated as disabled'); + $this->assertFalse($protocols['websocket'] ?? null, 'WebSocket protocol should be migrated as disabled'); + + // Restore both projects so the test is idempotent. + $this->client->call(Client::METHOD_PATCH, '/project/protocols/graphql', $sourceKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/protocols/websocket', $sourceKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/protocols/graphql', $destinationKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/protocols/websocket', $destinationKeyHeaders, ['enabled' => true]); + } + + public function testAppwriteMigrationLabels(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + $labels = ['vip' . \substr(ID::unique(), 0, 8), 'beta' . \substr(ID::unique(), 0, 8)]; + + // Set labels on source. The labels endpoint is PUT /project/labels — the + // generic project update endpoint doesn't accept a labels param. + $this->client->call(Client::METHOD_PUT, '/project/labels', $sourceKeyHeaders, [ + 'labels' => $labels, + ]); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_PROJECT_LABELS, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_PROJECT_LABELS], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_PROJECT_LABELS, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_LABELS]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_LABELS]['pending']); + $this->assertEquals(1, $result['statusCounters'][Resource::TYPE_PROJECT_LABELS]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_LABELS]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_LABELS]['warning']); + + $response = $this->client->call(Client::METHOD_GET, '/project', $destinationKeyHeaders); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEqualsCanonicalizing($labels, $response['body']['labels']); + + // Restore both projects. + $this->client->call(Client::METHOD_PUT, '/project/labels', $sourceKeyHeaders, ['labels' => []]); + $this->client->call(Client::METHOD_PUT, '/project/labels', $destinationKeyHeaders, ['labels' => []]); + } + + public function testAppwriteMigrationServices(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Disable functions + graphql on source as observable changes. + $this->client->call(Client::METHOD_PATCH, '/project/services/functions', $sourceKeyHeaders, ['enabled' => false]); + $this->client->call(Client::METHOD_PATCH, '/project/services/graphql', $sourceKeyHeaders, ['enabled' => false]); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_PROJECT_SERVICES, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_PROJECT_SERVICES], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_PROJECT_SERVICES, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_SERVICES]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_SERVICES]['pending']); + $this->assertEquals(1, $result['statusCounters'][Resource::TYPE_PROJECT_SERVICES]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_SERVICES]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_SERVICES]['warning']); + + $response = $this->client->call(Client::METHOD_GET, '/project', $destinationKeyHeaders); + $this->assertEquals(200, $response['headers']['status-code']); + $services = \array_column($response['body']['services'] ?? [], 'enabled', '$id'); + $this->assertFalse($services['functions'] ?? null, 'Functions service should be migrated as disabled'); + $this->assertFalse($services['graphql'] ?? null, 'GraphQL service should be migrated as disabled'); + + // Restore both projects. + $this->client->call(Client::METHOD_PATCH, '/project/services/functions', $sourceKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/services/graphql', $sourceKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/services/functions', $destinationKeyHeaders, ['enabled' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/services/graphql', $destinationKeyHeaders, ['enabled' => true]); + } + + public function testAppwriteMigrationPolicies(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + // Policies have no /projects/:projectId admin route — they're only + // reachable via project-scoped /v1/project/policies/* with an API key. + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Pick three policies that span the field types: int, bool, and + // bundled membership-privacy. + $this->client->call(Client::METHOD_PATCH, '/project/policies/password-history', $sourceKeyHeaders, [ + 'total' => 5, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/session-alert', $sourceKeyHeaders, [ + 'enabled' => true, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/membership-privacy', $sourceKeyHeaders, [ + 'userEmail' => false, + ]); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_POLICIES, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_POLICIES], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_POLICIES, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_POLICIES]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_POLICIES]['pending']); + $this->assertEquals(1, $result['statusCounters'][Resource::TYPE_POLICIES]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_POLICIES]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_POLICIES]['warning']); + + $passwordHistory = $this->client->call(Client::METHOD_GET, '/project/policies/password-history', $destinationKeyHeaders); + $this->assertSame(200, $passwordHistory['headers']['status-code']); + $this->assertSame(5, $passwordHistory['body']['total'], 'passwordHistory should be migrated as 5'); + + $sessionAlert = $this->client->call(Client::METHOD_GET, '/project/policies/session-alert', $destinationKeyHeaders); + $this->assertSame(200, $sessionAlert['headers']['status-code']); + $this->assertTrue($sessionAlert['body']['enabled'], 'session-alert policy should be migrated as enabled'); + + $membershipPrivacy = $this->client->call(Client::METHOD_GET, '/project/policies/membership-privacy', $destinationKeyHeaders); + $this->assertSame(200, $membershipPrivacy['headers']['status-code']); + $this->assertFalse($membershipPrivacy['body']['userEmail'], 'membership-privacy userEmail should be migrated as false'); + + // Restore both projects to defaults. + $this->client->call(Client::METHOD_PATCH, '/project/policies/password-history', $sourceKeyHeaders, ['total' => 0]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/session-alert', $sourceKeyHeaders, ['enabled' => false]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/membership-privacy', $sourceKeyHeaders, ['userEmail' => true]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/password-history', $destinationKeyHeaders, ['total' => 0]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/session-alert', $destinationKeyHeaders, ['enabled' => false]); + $this->client->call(Client::METHOD_PATCH, '/project/policies/membership-privacy', $destinationKeyHeaders, ['userEmail' => true]); + } + + public function testAppwriteMigrationSMTP(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Point at the in-cluster maildev container so the endpoint's SMTP + // connection validation passes. Password is not migrated — source + // API never exposes it. + $sourceSmtpUpdate = $this->client->call(Client::METHOD_PATCH, '/project/smtp', $sourceKeyHeaders, [ + 'enabled' => true, + 'senderName' => 'Migration Sender', + 'senderEmail' => 'sender@appwrite.io', + 'replyToName' => 'Migration Reply', + 'replyToEmail' => 'reply@appwrite.io', + 'host' => 'maildev', + 'port' => 1025, + ]); + $this->assertEquals(200, $sourceSmtpUpdate['headers']['status-code']); + + // Cross-check the PATCH actually landed on the SOURCE project, not on + // a sibling scope. If this fails we've targeted the wrong project. + $sourceProjectAfter = $this->client->call(Client::METHOD_GET, '/project', $sourceKeyHeaders); + $this->assertSame('Migration Sender', $sourceProjectAfter['body']['smtpSenderName']); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_SMTP, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_SMTP], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_SMTP, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_SMTP]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_SMTP]['pending']); + $this->assertEquals(1, $result['statusCounters'][Resource::TYPE_SMTP]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_SMTP]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_SMTP]['warning']); + + $response = $this->client->call(Client::METHOD_GET, '/project', $destinationKeyHeaders); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertTrue($response['body']['smtpEnabled'], 'smtpEnabled should be migrated as true'); + $this->assertSame('Migration Sender', $response['body']['smtpSenderName']); + $this->assertSame('sender@appwrite.io', $response['body']['smtpSenderEmail']); + $this->assertSame('Migration Reply', $response['body']['smtpReplyToName']); + $this->assertSame('reply@appwrite.io', $response['body']['smtpReplyToEmail']); + $this->assertSame('maildev', $response['body']['smtpHost']); + $this->assertSame(1025, $response['body']['smtpPort']); + $this->assertSame('', $response['body']['smtpSecure']); + + // Reset both projects so the test is idempotent. + $this->client->call(Client::METHOD_PATCH, '/project/smtp', $sourceKeyHeaders, ['enabled' => false]); + $this->client->call(Client::METHOD_PATCH, '/project/smtp', $destinationKeyHeaders, ['enabled' => false]); + } + + public function testAppwriteMigrationCustomDomains(): void + { + $sourceHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + + $destinationHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getDestinationProject()['$id'], + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // Domains are globally unique across projects; orphans from prior failed runs + // poison both source list+report (returns extra rules) and destination create + // (409 conflict). Sweep both before creating the new rule. + foreach ([$sourceHeaders, $destinationHeaders] as $headers) { + $existing = $this->client->call(Client::METHOD_GET, '/proxy/rules', $headers); + if ($existing['headers']['status-code'] === 200) { + foreach ($existing['body']['rules'] ?? [] as $r) { + if (\str_ends_with($r['domain'] ?? '', '-migration-api.myapp.com')) { + $this->client->call(Client::METHOD_DELETE, '/proxy/rules/' . $r['$id'], $headers); + } + } + } + } + + // Unique domain so re-runs and parallel suites can't collide on the + // global domain uniqueness check. + $domain = \uniqid() . '-migration-api.myapp.com'; + + $createResp = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $sourceHeaders, [ + 'domain' => $domain, + ]); + $this->assertEquals(201, $createResp['headers']['status-code']); + $sourceRule = $createResp['body']; + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_RULE, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $this->getProject()['$id'], + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_RULE], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_RULE, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_RULE]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_RULE]['pending']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_RULE]['processing']); + // Domain uniqueness is enforced globally across projects. In this single-server + // E2E setup the source project still owns the domain when the migration runs, + // so the destination create hits the cross-project 409 — the destination must + // surface a WARNING, not a hard error, so the rest of the migration continues. + // (In a real self-hosted-to-cloud migration the source domain is on a separate + // server, so this conflict does not occur and we'd see `success` instead.) + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_RULE]['success']); + $this->assertGreaterThanOrEqual(1, $result['statusCounters'][Resource::TYPE_RULE]['warning']); + + // Cleanup on source + $this->client->call(Client::METHOD_DELETE, '/proxy/rules/' . $sourceRule['$id'], $sourceHeaders); + } + + public function testAppwriteMigrationEmailTemplate(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + // The source SDK path requires custom SMTP enabled before a template can be + // saved — and the enable call validates the SMTP connection. `maildev` is the + // dev mailcatcher in the test cluster's docker-compose; it accepts unauthenticated + // connections on port 1025, so it's the only host that lets us pass validation. + $smtpUpdate = $this->client->call(Client::METHOD_PATCH, '/project/smtp', $sourceKeyHeaders, [ + 'enabled' => true, + 'senderName' => 'Test Sender', + 'senderEmail' => 'sender@example.com', + 'host' => 'maildev', + 'port' => 1025, + ]); + $this->assertEquals(200, $smtpUpdate['headers']['status-code'], 'SMTP enable on source failed: ' . \json_encode($smtpUpdate['body'])); + + $templateId = 'verification'; + $locale = 'en'; + $subject = 'Verify your account ' . ID::unique(); + $message = '

Hello {{user}}, verify your account at {{redirect}}

'; + + $update = $this->client->call( + Client::METHOD_PATCH, + '/project/templates/email', + $sourceKeyHeaders, + [ + 'templateId' => $templateId, + 'locale' => $locale, + 'subject' => $subject, + 'message' => $message, + 'senderName' => 'Template Sender', + 'senderEmail' => 'tpl-sender@example.com', + 'replyToEmail' => 'reply@example.com', + 'replyToName' => 'Reply Team', + ] + ); + $this->assertEquals(200, $update['headers']['status-code']); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_PROJECT_EMAIL_TEMPLATE, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_PROJECT_EMAIL_TEMPLATE], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_PROJECT_EMAIL_TEMPLATE, $result['statusCounters']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_EMAIL_TEMPLATE]['error']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_EMAIL_TEMPLATE]['pending']); + $this->assertGreaterThanOrEqual(1, $result['statusCounters'][Resource::TYPE_PROJECT_EMAIL_TEMPLATE]['success']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_EMAIL_TEMPLATE]['processing']); + $this->assertEquals(0, $result['statusCounters'][Resource::TYPE_PROJECT_EMAIL_TEMPLATE]['warning']); + + // Read-back via the SDK requires the destination to have SMTP enabled too. + $this->client->call(Client::METHOD_PATCH, '/project/smtp', $destinationKeyHeaders, [ + 'enabled' => true, + 'senderName' => 'Dest Sender', + 'senderEmail' => 'dest@example.com', + 'host' => 'maildev', + 'port' => 1025, + ]); + + $fetched = $this->client->call( + Client::METHOD_GET, + '/project/templates/email/' . $templateId, + $destinationKeyHeaders, + ['locale' => $locale] + ); + $this->assertEquals(200, $fetched['headers']['status-code']); + $this->assertSame($subject, $fetched['body']['subject']); + $this->assertSame($message, $fetched['body']['message']); + $this->assertSame('Template Sender', $fetched['body']['senderName']); + $this->assertSame('tpl-sender@example.com', $fetched['body']['senderEmail']); + $this->assertSame('reply@example.com', $fetched['body']['replyToEmail']); + $this->assertSame('Reply Team', $fetched['body']['replyToName']); + + // Reset both projects so the test is idempotent. + $this->client->call(Client::METHOD_PATCH, '/project/smtp', $sourceKeyHeaders, ['enabled' => false]); + $this->client->call(Client::METHOD_PATCH, '/project/smtp', $destinationKeyHeaders, ['enabled' => false]); + } + + public function testAppwriteMigrationOAuth(): void + { + $sourceProjectId = $this->getProject()['$id']; + $destinationProjectId = $this->getDestinationProject()['$id']; + + $sourceKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $sourceProjectId, + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]; + $destinationKeyHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $destinationProjectId, + 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], + ]; + + $clientId = 'gh-client-' . ID::unique(); + $configure = $this->client->call(Client::METHOD_PATCH, '/project/oauth2/github', $sourceKeyHeaders, [ + 'clientId' => $clientId, + 'clientSecret' => 'gh-secret-not-migrated', + 'enabled' => false, + ]); + $this->assertEquals(200, $configure['headers']['status-code']); + $this->assertSame($clientId, $configure['body']['clientId']); + + $keycloak = $this->client->call(Client::METHOD_PATCH, '/project/oauth2/keycloak', $sourceKeyHeaders, [ + 'clientId' => 'keycloak-client-' . ID::unique(), + 'clientSecret' => 'keycloak-secret-not-migrated', + 'endpoint' => 'keycloak.example.com', + 'realmName' => 'appwrite', + 'enabled' => false, + ]); + $this->assertEquals(200, $keycloak['headers']['status-code']); + + $oidc = $this->client->call(Client::METHOD_PATCH, '/project/oauth2/oidc', $sourceKeyHeaders, [ + 'clientId' => 'oidc-client-' . ID::unique(), + 'clientSecret' => 'oidc-secret-not-migrated', + 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', + 'authorizationURL' => 'https://idp.example.com/oauth2/authorize', + 'tokenURL' => 'https://idp.example.com/oauth2/token', + 'userInfoURL' => 'https://idp.example.com/oauth2/userinfo', + 'enabled' => false, + ]); + $this->assertEquals(200, $oidc['headers']['status-code']); + + $okta = $this->client->call(Client::METHOD_PATCH, '/project/oauth2/okta', $sourceKeyHeaders, [ + 'clientId' => 'okta-client-' . ID::unique(), + 'clientSecret' => 'okta-secret-not-migrated', + 'domain' => 'trial-6400025.okta.com', + 'authorizationServerId' => 'aus000000000000000h7z', + 'enabled' => false, + ]); + $this->assertEquals(200, $okta['headers']['status-code']); + + $result = $this->performMigrationSync([ + 'resources' => [ + Resource::TYPE_OAUTH2_PROVIDER, + ], + 'endpoint' => $this->webEndpoint, + 'projectId' => $sourceProjectId, + 'apiKey' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals('completed', $result['status']); + $this->assertEquals([Resource::TYPE_OAUTH2_PROVIDER], $result['resources']); + $this->assertArrayHasKey(Resource::TYPE_OAUTH2_PROVIDER, $result['statusCounters']); + $oauthCounters = $result['statusCounters'][Resource::TYPE_OAUTH2_PROVIDER]; + $this->assertEquals(0, $oauthCounters['error']); + $this->assertEquals(0, $oauthCounters['pending']); + $this->assertEquals(0, $oauthCounters['processing']); + $this->assertEquals(0, $oauthCounters['warning']); + $this->assertEquals(4, $oauthCounters['success']); + + $fetched = $this->client->call(Client::METHOD_GET, '/project/oauth2/github', $destinationKeyHeaders); + $this->assertEquals(200, $fetched['headers']['status-code']); + $this->assertSame($clientId, $fetched['body']['clientId']); + $this->assertFalse($fetched['body']['enabled']); + $this->assertSame('', $fetched['body']['clientSecret']); + + $fetched = $this->client->call(Client::METHOD_GET, '/project/oauth2/keycloak', $destinationKeyHeaders); + $this->assertEquals(200, $fetched['headers']['status-code']); + $this->assertSame($keycloak['body']['clientId'], $fetched['body']['clientId']); + $this->assertSame('keycloak.example.com', $fetched['body']['endpoint']); + $this->assertSame('appwrite', $fetched['body']['realmName']); + $this->assertFalse($fetched['body']['enabled']); + $this->assertSame('', $fetched['body']['clientSecret']); + + $fetched = $this->client->call(Client::METHOD_GET, '/project/oauth2/oidc', $destinationKeyHeaders); + $this->assertEquals(200, $fetched['headers']['status-code']); + $this->assertSame($oidc['body']['clientId'], $fetched['body']['clientId']); + $this->assertSame('https://idp.example.com/.well-known/openid-configuration', $fetched['body']['wellKnownURL']); + $this->assertSame('https://idp.example.com/oauth2/authorize', $fetched['body']['authorizationURL']); + $this->assertSame('https://idp.example.com/oauth2/token', $fetched['body']['tokenURL']); + $this->assertSame('https://idp.example.com/oauth2/userinfo', $fetched['body']['userInfoURL']); + $this->assertFalse($fetched['body']['enabled']); + $this->assertSame('', $fetched['body']['clientSecret']); + + $fetched = $this->client->call(Client::METHOD_GET, '/project/oauth2/okta', $destinationKeyHeaders); + $this->assertEquals(200, $fetched['headers']['status-code']); + $this->assertSame($okta['body']['clientId'], $fetched['body']['clientId']); + $this->assertSame('trial-6400025.okta.com', $fetched['body']['domain']); + $this->assertSame('aus000000000000000h7z', $fetched['body']['authorizationServerId']); + $this->assertFalse($fetched['body']['enabled']); + $this->assertSame('', $fetched['body']['clientSecret']); + + $this->client->call(Client::METHOD_PATCH, '/project/oauth2/github', $sourceKeyHeaders, [ + 'clientId' => '', + 'clientSecret' => '', + 'enabled' => false, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/oauth2/github', $destinationKeyHeaders, [ + 'clientId' => '', + 'clientSecret' => '', + 'enabled' => false, + ]); + foreach ([$sourceKeyHeaders, $destinationKeyHeaders] as $headers) { + $this->client->call(Client::METHOD_PATCH, '/project/oauth2/keycloak', $headers, [ + 'clientId' => '', + 'clientSecret' => '', + 'endpoint' => '', + 'realmName' => '', + 'enabled' => false, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/oauth2/oidc', $headers, [ + 'clientId' => '', + 'clientSecret' => '', + 'wellKnownURL' => '', + 'authorizationURL' => '', + 'tokenURL' => '', + 'userInfoURL' => '', + 'enabled' => false, + ]); + $this->client->call(Client::METHOD_PATCH, '/project/oauth2/okta', $headers, [ + 'clientId' => '', + 'clientSecret' => '', + 'domain' => '', + 'authorizationServerId' => '', + 'enabled' => false, + ]); + } + } + /** * Import documents from a CSV file. */ diff --git a/tests/e2e/Services/Migrations/MigrationsConsoleClientTest.php b/tests/e2e/Services/Migrations/MigrationsConsoleClientTest.php index 2167ef9338..ad82374f7a 100644 --- a/tests/e2e/Services/Migrations/MigrationsConsoleClientTest.php +++ b/tests/e2e/Services/Migrations/MigrationsConsoleClientTest.php @@ -1,11 +1,13 @@ assertEquals(200, $expireServer['headers']['status-code']); - $this->assertEquals( + $this->assertSame( (new \DateTime($expiresAt))->getTimestamp(), (new \DateTime($expireServer['body']['expiresAt']))->getTimestamp() ); diff --git a/tests/e2e/Services/Presences/PresenceRealtimeClientTest.php b/tests/e2e/Services/Presences/PresenceRealtimeClientTest.php index d824412a51..0d2a6b0970 100644 --- a/tests/e2e/Services/Presences/PresenceRealtimeClientTest.php +++ b/tests/e2e/Services/Presences/PresenceRealtimeClientTest.php @@ -1,5 +1,7 @@ receiveErrorMessage($client); - $this->assertStringContainsString('Payload is not valid. Status is required', $missingStatus['data']['message'] ?? ''); + $this->assertStringContainsString('Payload is not valid. Status is required', (string) ($missingStatus['data']['message'] ?? '')); $this->assertQuietFor( $client, fn (array $frame): bool => ($frame['type'] ?? null) === 'event' @@ -401,7 +403,7 @@ class PresenceRealtimeClientTest extends Scope ], ])); $invalidPermissions = $this->receiveErrorMessage($client); - $this->assertStringContainsString('permissions: Permissions must be an array of strings', $invalidPermissions['data']['message'] ?? ''); + $this->assertStringContainsString('permissions: Permissions must be an array of strings', (string) ($invalidPermissions['data']['message'] ?? '')); $this->assertQuietFor( $client, fn (array $frame): bool => ($frame['type'] ?? null) === 'event' diff --git a/tests/e2e/Services/Project/AuthMethodsConsoleClientTest.php b/tests/e2e/Services/Project/AuthMethodsConsoleClientTest.php index e1ae5de357..4a760b172e 100644 --- a/tests/e2e/Services/Project/AuthMethodsConsoleClientTest.php +++ b/tests/e2e/Services/Project/AuthMethodsConsoleClientTest.php @@ -1,12 +1,14 @@ updateOAuth2('amazon', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); + $providers = [ + 'amazon' => ['clientId' => '', 'clientSecret' => '', 'enabled' => false], + 'github' => ['clientId' => '', 'clientSecret' => '', 'enabled' => false], + 'apple' => ['serviceId' => '', 'keyId' => '', 'teamId' => '', 'p8File' => '', 'enabled' => false], + 'oidc' => ['clientId' => '', 'clientSecret' => '', 'wellKnownURL' => '', 'authorizationURL' => '', 'tokenURL' => '', 'userInfoURL' => '', 'enabled' => false], + 'okta' => ['clientId' => '', 'clientSecret' => '', 'domain' => '', 'authorizationServerId' => '', 'enabled' => false], + 'google' => ['clientId' => '', 'clientSecret' => '', 'prompt' => ['consent'], 'enabled' => false], + 'dropbox' => ['appKey' => '', 'appSecret' => '', 'enabled' => false], + ]; - $this->assertSame( - 200, - $response['headers']['status-code'], - 'OAuth2 reset failed — downstream tests will be unreliable. Body: ' . \json_encode($response['body'] ?? null), - ); + foreach ($providers as $provider => $payload) { + $response = $this->updateOAuth2($provider, $payload); + $this->assertSame( + 200, + $response['headers']['status-code'], + "OAuth2 reset failed for {$provider}. Body: " . \json_encode($response['body'] ?? null), + ); + } } - // ========================================================================= - // List OAuth2 providers - // ========================================================================= - public function testListOAuth2Providers(): void { $response = $this->listOAuth2Providers(); @@ -47,120 +44,11 @@ trait OAuth2Base $this->assertArrayHasKey('providers', $response['body']); $this->assertGreaterThan(0, $response['body']['total']); $this->assertSame($response['body']['total'], \count($response['body']['providers'])); - } - - public function testListOAuth2ProvidersIncludesKnownProviders(): void - { - $response = $this->listOAuth2Providers(); - - $this->assertSame(200, $response['headers']['status-code']); $ids = \array_column($response['body']['providers'], '$id'); - - // Spot-check a representative cross-section of providers across all - // provider shapes (plain, multi-field, sandboxed, custom param names). - $expected = [ - 'github', - 'amazon', - 'apple', - 'auth0', - 'authentik', - 'fusionauth', - 'gitlab', - 'keycloak', - 'oidc', - 'okta', - 'microsoft', - 'dropbox', - 'paypalSandbox', - 'kick', - ]; - - foreach ($expected as $providerId) { - $this->assertContains($providerId, $ids, "Missing provider {$providerId} in listOAuth2Providers response"); - } - } - - public function testListOAuth2ProvidersSortedAlphabetically(): void - { - $response = $this->listOAuth2Providers(); - - $this->assertSame(200, $response['headers']['status-code']); - - $ids = \array_column($response['body']['providers'], '$id'); - $sorted = $ids; - \sort($sorted); - - $this->assertSame($sorted, $ids); - } - - /** - * Pin the exact set of registered providers — adding or removing a - * provider must be a deliberate change to this assertion. Catches - * registration drift (e.g. forgetting to wire a new provider into - * `Base::getProviderActions()`). - */ - public function testListOAuth2ProvidersExposesEntireRegistry(): void - { - $response = $this->listOAuth2Providers(); - $this->assertSame(200, $response['headers']['status-code']); - - $ids = \array_column($response['body']['providers'], '$id'); - \sort($ids); - - $expected = [ - 'amazon', 'apple', 'auth0', 'authentik', 'autodesk', 'bitbucket', - 'bitly', 'box', 'dailymotion', 'discord', 'disqus', 'dropbox', - 'etsy', 'facebook', 'figma', 'fusionauth', 'github', 'gitlab', - 'google', 'keycloak', 'kick', 'linkedin', 'microsoft', 'notion', - 'oidc', 'okta', 'paypal', 'paypalSandbox', 'podio', 'salesforce', - 'slack', 'spotify', 'stripe', 'tradeshift', 'tradeshiftBox', - 'twitch', 'wordpress', 'x', 'yahoo', 'yandex', 'zoho', 'zoom', - ]; - \sort($expected); - - $this->assertSame($expected, $ids, 'Registry drift — listed providers do not match the expected set.'); - } - - public function testListOAuth2ProvidersResponseShape(): void - { - $response = $this->listOAuth2Providers(); - - $this->assertSame(200, $response['headers']['status-code']); - - foreach ($response['body']['providers'] as $provider) { - $this->assertArrayHasKey('$id', $provider); - $this->assertArrayHasKey('enabled', $provider); - $this->assertIsString($provider['$id']); - $this->assertIsBool($provider['enabled']); - } - } - - public function testListOAuth2ProvidersClientSecretsNotExposed(): void - { - // Seed credentials so the list cannot trivially return empty values. - $this->updateOAuth2('amazon', [ - 'clientId' => 'amzn1.application-oa2-client.testListSeed', - 'clientSecret' => 'super-secret-must-not-leak', - 'enabled' => false, - ]); - - $response = $this->listOAuth2Providers(); - - $this->assertSame(200, $response['headers']['status-code']); - - $matched = false; - foreach ($response['body']['providers'] as $provider) { - if ($provider['$id'] !== 'amazon') { - continue; - } - - $matched = true; - $this->assertSame('amzn1.application-oa2-client.testListSeed', $provider['clientId']); - $this->assertSame('', $provider['clientSecret']); - } - - $this->assertTrue($matched, 'List did not include the seeded provider.'); + $this->assertContains('github', $ids); + $this->assertContains('apple', $ids); + $this->assertContains('oidc', $ids); } public function testListOAuth2ProvidersWithoutAuthentication(): void @@ -170,22 +58,6 @@ trait OAuth2Base $this->assertSame(401, $response['headers']['status-code']); } - public function testListOAuth2ProvidersExcludesUnregisteredConfigEntries(): void - { - // `mock` and `mock-unverified` exist in oAuthProviders config (enabled: true) - // but are intentionally absent from Base::getProviderActions() — they're - // internal Mock OAuth2 adapters used by other test suites, not public - // providers. XList iterates the action registry, so they must never be - // included even though config marks them enabled. - $response = $this->listOAuth2Providers(); - - $this->assertSame(200, $response['headers']['status-code']); - - $ids = \array_column($response['body']['providers'], '$id'); - $this->assertNotContains('mock', $ids); - $this->assertNotContains('mock-unverified', $ids); - } - public function testListOAuth2ProvidersTotalFalse(): void { $response = $this->listOAuth2Providers(total: false); @@ -195,35 +67,26 @@ trait OAuth2Base $this->assertGreaterThan(0, \count($response['body']['providers'])); } - public function testListOAuth2ProvidersWithLimit(): void - { - $response = $this->listOAuth2Providers([ - Query::limit(1)->toString(), - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertCount(1, $response['body']['providers']); - $this->assertGreaterThan(1, $response['body']['total']); - } - - public function testListOAuth2ProvidersWithOffset(): void + public function testListOAuth2ProvidersWithLimitAndOffset(): void { $listAll = $this->listOAuth2Providers(); $this->assertSame(200, $listAll['headers']['status-code']); - $listOffset = $this->listOAuth2Providers([ + $limited = $this->listOAuth2Providers([ + Query::limit(1)->toString(), + ]); + $this->assertSame(200, $limited['headers']['status-code']); + $this->assertCount(1, $limited['body']['providers']); + $this->assertSame($listAll['body']['total'], $limited['body']['total']); + + $offset = $this->listOAuth2Providers([ Query::offset(1)->toString(), ]); - - $this->assertSame(200, $listOffset['headers']['status-code']); - $this->assertCount(\count($listAll['body']['providers']) - 1, $listOffset['body']['providers']); - $this->assertSame($listAll['body']['total'], $listOffset['body']['total']); + $this->assertSame(200, $offset['headers']['status-code']); + $this->assertCount(\count($listAll['body']['providers']) - 1, $offset['body']['providers']); + $this->assertSame($listAll['body']['total'], $offset['body']['total']); } - // ========================================================================= - // Get OAuth2 provider - // ========================================================================= - public function testGetOAuth2Provider(): void { $response = $this->getOAuth2Provider('github'); @@ -232,22 +95,17 @@ trait OAuth2Base $this->assertSame('github', $response['body']['$id']); $this->assertArrayHasKey('enabled', $response['body']); $this->assertArrayHasKey('clientId', $response['body']); - $this->assertArrayHasKey('clientSecret', $response['body']); $this->assertSame('', $response['body']['clientSecret']); } public function testGetOAuth2ProviderWithAlias(): void { - // The action declares the canonical param name as `providerId` and - // registers `provider` as an alias so that older SDK versions that - // send the provider in the query string continue to work. $headers = [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]; $headers = \array_merge($headers, $this->getHeaders()); - // Call with `provider` in query string (legacy behaviour) $response = $this->client->call( Client::METHOD_GET, '/project/oauth2/github?provider=github', @@ -258,43 +116,8 @@ trait OAuth2Base $this->assertSame('github', $response['body']['$id']); } - public function testGetOAuth2ProviderClientSecretWriteOnly(): void - { - $this->updateOAuth2('amazon', [ - 'clientId' => 'amzn1.application-oa2-client.getSecretCheck', - 'clientSecret' => 'must-never-be-returned', - 'enabled' => false, - ]); - - $response = $this->getOAuth2Provider('amazon'); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('amzn1.application-oa2-client.getSecretCheck', $response['body']['clientId']); - $this->assertSame('', $response['body']['clientSecret']); - } - - public function testGetOAuth2ProviderMatchesListEntry(): void - { - $list = $this->listOAuth2Providers(); - $this->assertSame(200, $list['headers']['status-code']); - - // Drive the loop directly off the LIST result so any provider added - // to the registry is automatically checked for List/Get parity. - foreach ($list['body']['providers'] as $listEntry) { - $providerId = $listEntry['$id']; - $get = $this->getOAuth2Provider($providerId); - - $this->assertSame(200, $get['headers']['status-code'], "GET failed for {$providerId}"); - $this->assertSame($listEntry, $get['body'], "List/Get drift on {$providerId}"); - } - } - public function testGetOAuth2ProviderUnsupported(): void { - // The `providerId` param is validated by a WhiteList of registered - // OAuth2 provider keys, so an unknown value is rejected at validation - // time — before the action runs — and surfaces as a generic argument - // error rather than `project_provider_unsupported`. $response = $this->getOAuth2Provider('not-a-real-provider'); $this->assertSame(400, $response['headers']['status-code']); @@ -303,11 +126,6 @@ trait OAuth2Base public function testGetOAuth2ProviderRegisteredInConfigButNoUpdateClass(): void { - // `mock` is present in oAuthProviders config (enabled: true) but is - // NOT registered in Base::getProviderActions(). It passes the - // WhiteList validator (which only checks config membership) and - // reaches the action body, where the action-registry check throws - // `project_provider_unsupported`. $response = $this->getOAuth2Provider('mock'); $this->assertSame(400, $response['headers']['status-code']); @@ -321,132 +139,24 @@ trait OAuth2Base $this->assertSame(401, $response['headers']['status-code']); } - // ========================================================================= - // Update plain provider (Amazon — clientId + clientSecret, no extra fields) - // ========================================================================= - - public function testUpdateOAuth2Plain(): void + public function testUpdateOAuth2PlainProviderRoundTrip(): void { - $response = $this->updateOAuth2('amazon', [ - 'clientId' => 'amzn1.application-oa2-client.test01', - 'clientSecret' => 'test-secret-01', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('amazon', $response['body']['$id']); - $this->assertSame('amzn1.application-oa2-client.test01', $response['body']['clientId']); - $this->assertSame(false, $response['body']['enabled']); - } - - public function testUpdateOAuth2PlainEnable(): void - { - // Amazon has no verifyCredentials() hook, so enabling with arbitrary - // credentials succeeds without making a real network call. - $response = $this->updateOAuth2('amazon', [ - 'clientId' => 'amzn1.application-oa2-client.test02', - 'clientSecret' => 'test-secret-02', + $update = $this->updateOAuth2('amazon', [ + 'clientId' => 'amzn1.application-oa2-client.smoke', + 'clientSecret' => 'smoke-secret', 'enabled' => true, ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame(true, $response['body']['enabled']); - } + $this->assertSame(200, $update['headers']['status-code']); + $this->assertSame('amazon', $update['body']['$id']); + $this->assertSame('amzn1.application-oa2-client.smoke', $update['body']['clientId']); + $this->assertTrue($update['body']['enabled']); - public function testUpdateOAuth2PlainDisable(): void - { - $this->updateOAuth2('amazon', [ - 'clientId' => 'amzn1.application-oa2-client.test03', - 'clientSecret' => 'test-secret-03', - 'enabled' => true, - ]); - - $response = $this->updateOAuth2('amazon', [ - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame(false, $response['body']['enabled']); - // Credentials persist across an enabled toggle. - $this->assertSame('amzn1.application-oa2-client.test03', $response['body']['clientId']); - } - - public function testUpdateOAuth2PlainPartial(): void - { - // Seed both credentials. - $this->updateOAuth2('amazon', [ - 'clientId' => 'seed-client-id', - 'clientSecret' => 'seed-secret', - 'enabled' => false, - ]); - - // Patch only clientId. - $response = $this->updateOAuth2('amazon', [ - 'clientId' => 'updated-client-id', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('updated-client-id', $response['body']['clientId']); - - // Read back through GET to confirm the secret is still set internally - // (write-only, so we cannot inspect the value, but enabling should still - // succeed because the secret remains non-empty). - $enable = $this->updateOAuth2('amazon', [ - 'enabled' => true, - ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertSame(true, $enable['body']['enabled']); - } - - public function testUpdateOAuth2PlainEnableRequiresCredentials(): void - { - // Start from a clean state with no credentials. - $this->updateOAuth2('amazon', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('amazon', [ - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2PlainEnabledOmittedDoesNotThrow(): void - { - // With enabled omitted (null) and no credentials, the silent-validation - // branch must not surface as an error. - $this->updateOAuth2('amazon', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('amazon', [ - 'clientId' => 'partial-only', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame(false, $response['body']['enabled']); - $this->assertSame('partial-only', $response['body']['clientId']); - } - - public function testUpdateOAuth2PlainResponseModel(): void - { - $response = $this->updateOAuth2('amazon', [ - 'clientId' => 'amzn1.application-oa2-client.modelCheck', - 'clientSecret' => 'model-check-secret', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertArrayHasKey('$id', $response['body']); - $this->assertArrayHasKey('enabled', $response['body']); - $this->assertArrayHasKey('clientId', $response['body']); - $this->assertArrayHasKey('clientSecret', $response['body']); + $get = $this->getOAuth2Provider('amazon'); + $this->assertSame(200, $get['headers']['status-code']); + $this->assertSame('amzn1.application-oa2-client.smoke', $get['body']['clientId']); + $this->assertSame('', $get['body']['clientSecret']); + $this->assertTrue($get['body']['enabled']); } public function testUpdateOAuth2WithoutAuthentication(): void @@ -462,8 +172,6 @@ trait OAuth2Base public function testUpdateOAuth2UnknownProvider(): void { - // Each Update endpoint is registered at a fixed `/oauth2/{providerId}` - // path, so an unknown provider does not match any route → 404. $response = $this->updateOAuth2('not-a-real-provider', [ 'clientId' => 'whatever', 'clientSecret' => 'whatever', @@ -483,21 +191,18 @@ trait OAuth2Base $this->assertSame('general_argument_invalid', $response['body']['type']); } - // ========================================================================= - // Update GitHub (verifyCredentials makes a real call to GitHub on enable) - // - // Only failure paths and the silent-on-disable branch are tested here. - // Happy-path enable would require real GitHub OAuth2 credentials, which - // CI doesn't have. Wiring, validation, and the non-enabling branch are - // sufficient to surface most regressions; success-path issues are caught - // by integration / staging environments instead. - // ========================================================================= + public function testUpdateOAuth2PlainEnableRequiresCredentials(): void + { + $response = $this->updateOAuth2('amazon', [ + 'enabled' => true, + ]); + + $this->assertSame(400, $response['headers']['status-code']); + $this->assertSame('general_argument_invalid', $response['body']['type']); + } public function testUpdateOAuth2GitHubInvalidCredentialsRejected(): void { - // GitHub is the only provider with a real verifyCredentials() hook. - // Enabling with bogus credentials must surface a 400 from the wrapping - // exception, not silently succeed. $response = $this->updateOAuth2('github', [ 'clientId' => 'fake-client-id-' . \uniqid(), 'clientSecret' => 'fake-client-secret', @@ -506,2368 +211,131 @@ trait OAuth2Base $this->assertSame(400, $response['headers']['status-code']); $this->assertSame('general_argument_invalid', $response['body']['type']); - - // Cleanup: ensure it's left disabled. - $this->updateOAuth2('github', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); } public function testUpdateOAuth2GitHubInvalidCredentialsSilentWhenNotEnabling(): void { - // When `enabled` is omitted, verifyCredentials() failure is swallowed. - // The provider remains disabled but the request succeeds. $response = $this->updateOAuth2('github', [ 'clientId' => 'still-fake-' . \uniqid(), 'clientSecret' => 'still-fake-secret', ]); $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame(false, $response['body']['enabled']); - - // Cleanup - $this->updateOAuth2('github', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); + $this->assertFalse($response['body']['enabled']); } - // ========================================================================= - // Update Apple (serviceId + keyId + teamId + p8File) - // ========================================================================= - - public function testUpdateOAuth2Apple(): void + public function testUpdateOAuth2AppleRoundTrip(): void { - $response = $this->updateOAuth2('apple', [ + $update = $this->updateOAuth2('apple', [ 'serviceId' => 'ip.appwrite.app.web', 'keyId' => 'P4000000N8', 'teamId' => 'D4000000R6', 'p8File' => '-----BEGIN PRIVATE KEY-----TEST-----END PRIVATE KEY-----', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('apple', $response['body']['$id']); - $this->assertSame('ip.appwrite.app.web', $response['body']['serviceId']); - $this->assertSame('P4000000N8', $response['body']['keyId']); - $this->assertSame('D4000000R6', $response['body']['teamId']); - $this->assertSame('', $response['body']['p8File']); - $this->assertSame(false, $response['body']['enabled']); - - // Cleanup - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2ApplePartial(): void - { - // Seed all four fields. - $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.seed', - 'keyId' => 'KEYSEED01', - 'teamId' => 'TEAMSEED01', - 'p8File' => '-----BEGIN PRIVATE KEY-----SEED-----END PRIVATE KEY-----', - 'enabled' => false, - ]); - - // Patch only `keyId` — others must be preserved. - $response = $this->updateOAuth2('apple', [ - 'keyId' => 'KEYUPDATED', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('ip.appwrite.app.seed', $response['body']['serviceId']); - $this->assertSame('KEYUPDATED', $response['body']['keyId']); - $this->assertSame('TEAMSEED01', $response['body']['teamId']); - $this->assertSame('', $response['body']['p8File']); - - // Cleanup - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2ApplePartialPreservesEachField(): void - { - // Seed all four fields, then patch each one individually and confirm - // the others survive across the chain. testUpdateOAuth2ApplePartial - // only covers `keyId`; this exercises serviceId/teamId/p8File too. - $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.merge', - 'keyId' => 'KEYMERGE01', - 'teamId' => 'TEAMMERGE', - 'p8File' => '-----BEGIN PRIVATE KEY-----MERGE-----END PRIVATE KEY-----', - 'enabled' => false, - ]); - - // Patch only `teamId`. - $teamOnly = $this->updateOAuth2('apple', [ - 'teamId' => 'TEAMROTATED', - ]); - $this->assertSame(200, $teamOnly['headers']['status-code']); - $this->assertSame('TEAMROTATED', $teamOnly['body']['teamId']); - $this->assertSame('KEYMERGE01', $teamOnly['body']['keyId']); - $this->assertSame('', $teamOnly['body']['p8File']); - $this->assertSame('ip.appwrite.app.merge', $teamOnly['body']['serviceId']); - - // Patch only `serviceId` — keyId/teamId/p8File live in the JSON blob - // and must survive a top-level (non-blob) field update. - $serviceOnly = $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.rotated', - ]); - $this->assertSame(200, $serviceOnly['headers']['status-code']); - $this->assertSame('ip.appwrite.app.rotated', $serviceOnly['body']['serviceId']); - - // Patch only `p8File`. keyId/teamId/serviceId must still be set - // internally — confirm by enabling. Apple has no verifyCredentials() - // hook, so persistCredentials only checks for non-empty serviceId and - // non-empty stored secret blob. - $p8Only = $this->updateOAuth2('apple', [ - 'p8File' => '-----BEGIN PRIVATE KEY-----ROTATED-----END PRIVATE KEY-----', - ]); - $this->assertSame(200, $p8Only['headers']['status-code']); - - $enable = $this->updateOAuth2('apple', ['enabled' => true]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2AppleClearAllFieldsBlocksEnable(): void - { - // Seed all four Apple fields. - $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.clearAll', - 'keyId' => 'KEYCLEARALL', - 'teamId' => 'TEAMCLEARALL', - 'p8File' => '-----BEGIN PRIVATE KEY-----CLEARALL-----END PRIVATE KEY-----', - 'enabled' => false, - ]); - - // Clear all credentials with empty strings. With `enabled` omitted, the - // silent-validation branch swallows the empty-credentials throw, so the - // call still succeeds — see testUpdateOAuth2PlainEnabledOmittedDoesNotThrow. - $clear = $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - ]); - $this->assertSame(200, $clear['headers']['status-code']); - $this->assertSame('', $clear['body']['serviceId']); - - // A subsequent `enabled => true` must now 400. Empty serviceId trips - // persistCredentials' empty(appId) guard before any provider hook runs, - // proving that the clear actually took effect on stored state. - $enable = $this->updateOAuth2('apple', [ - 'enabled' => true, - ]); - $this->assertSame(400, $enable['headers']['status-code']); - $this->assertSame('general_argument_invalid', $enable['body']['type']); - - // Cleanup (already cleared; included for reset symmetry). - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2AppleResponseModel(): void - { - $response = $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.shape', - 'keyId' => 'SHAPEKEY01', - 'teamId' => 'SHAPETEAM', - 'p8File' => '-----BEGIN PRIVATE KEY-----SHAPE-----END PRIVATE KEY-----', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertArrayHasKey('$id', $response['body']); - $this->assertArrayHasKey('enabled', $response['body']); - $this->assertArrayHasKey('serviceId', $response['body']); - $this->assertArrayHasKey('keyId', $response['body']); - $this->assertArrayHasKey('teamId', $response['body']); - $this->assertArrayHasKey('p8File', $response['body']); - // Apple has no clientId/clientSecret in the response model. - $this->assertArrayNotHasKey('clientId', $response['body']); - $this->assertArrayNotHasKey('clientSecret', $response['body']); - - // Cleanup - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); - } - - public function testGetOAuth2AppleSecretsWriteOnly(): void - { - $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.read', - 'keyId' => 'KEYREAD', - 'teamId' => 'TEAMREAD', - 'p8File' => '-----BEGIN PRIVATE KEY-----READ-----END PRIVATE KEY-----', - 'enabled' => false, - ]); - - $response = $this->getOAuth2Provider('apple'); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('ip.appwrite.app.read', $response['body']['serviceId']); - $this->assertSame('KEYREAD', $response['body']['keyId']); - $this->assertSame('TEAMREAD', $response['body']['teamId']); - $this->assertSame('', $response['body']['p8File']); - - // Cleanup - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2AppleEnableAndReadBack(): void - { - // Apple has no verifyCredentials() hook, so enabling with arbitrary - // (well-formed) values succeeds without any real Apple network call. - $update = $this->updateOAuth2('apple', [ - 'serviceId' => 'ip.appwrite.app.enable', - 'keyId' => 'ENABLEKEY', - 'teamId' => 'ENABLETEAM', - 'p8File' => '-----BEGIN PRIVATE KEY-----ENABLE-----END PRIVATE KEY-----', 'enabled' => true, ]); $this->assertSame(200, $update['headers']['status-code']); + $this->assertSame('apple', $update['body']['$id']); + $this->assertSame('ip.appwrite.app.web', $update['body']['serviceId']); + $this->assertSame('P4000000N8', $update['body']['keyId']); + $this->assertSame('D4000000R6', $update['body']['teamId']); + $this->assertSame('', $update['body']['p8File']); $this->assertTrue($update['body']['enabled']); - // GET must hide p8File while keeping the non-secret fields. $get = $this->getOAuth2Provider('apple'); $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('ip.appwrite.app.enable', $get['body']['serviceId']); - $this->assertSame('ENABLEKEY', $get['body']['keyId']); - $this->assertSame('ENABLETEAM', $get['body']['teamId']); + $this->assertSame('ip.appwrite.app.web', $get['body']['serviceId']); $this->assertSame('', $get['body']['p8File']); - - // Cleanup - $this->updateOAuth2('apple', [ - 'serviceId' => '', - 'keyId' => '', - 'teamId' => '', - 'p8File' => '', - 'enabled' => false, - ]); } - // ========================================================================= - // Update Auth0 (clientId + clientSecret + optional endpoint) - // ========================================================================= - - public function testUpdateOAuth2Auth0(): void + public function testUpdateOAuth2OidcRoundTrip(): void { - $response = $this->updateOAuth2('auth0', [ - 'clientId' => 'OaOkIA000000000000000000005KLSYq', - 'clientSecret' => 'auth0-test-secret', - 'endpoint' => 'example.us.auth0.com', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('auth0', $response['body']['$id']); - $this->assertSame('OaOkIA000000000000000000005KLSYq', $response['body']['clientId']); - $this->assertSame('example.us.auth0.com', $response['body']['endpoint']); - - // Cleanup - $this->updateOAuth2('auth0', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2Auth0PartialEndpoint(): void - { - // Seed clientSecret + endpoint. - $this->updateOAuth2('auth0', [ - 'clientId' => 'auth0-seed-client', - 'clientSecret' => 'auth0-seed-secret', - 'endpoint' => 'seed.us.auth0.com', - 'enabled' => false, - ]); - - // Update only endpoint. - $response = $this->updateOAuth2('auth0', [ - 'endpoint' => 'updated.us.auth0.com', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('updated.us.auth0.com', $response['body']['endpoint']); - // clientId is unchanged on top-level provider state. - $this->assertSame('auth0-seed-client', $response['body']['clientId']); - - // Cleanup - $this->updateOAuth2('auth0', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2Auth0PartialPreservesEachField(): void - { - // testUpdateOAuth2Auth0PartialEndpoint only patches `endpoint`. Cover - // patching `clientSecret` alone (must not wipe endpoint) and `clientId` - // alone (must not wipe the JSON-blob fields). - $this->updateOAuth2('auth0', [ - 'clientId' => 'auth0-merge-client', - 'clientSecret' => 'auth0-merge-secret', - 'endpoint' => 'merge.us.auth0.com', - 'enabled' => false, - ]); - - // Patch only clientSecret — clientId and endpoint must survive. - $secretOnly = $this->updateOAuth2('auth0', [ - 'clientSecret' => 'auth0-rotated-secret', - ]); - $this->assertSame(200, $secretOnly['headers']['status-code']); - $this->assertSame('auth0-merge-client', $secretOnly['body']['clientId']); - $this->assertSame('merge.us.auth0.com', $secretOnly['body']['endpoint']); - - // Patch only clientId — endpoint must survive. - $idOnly = $this->updateOAuth2('auth0', [ - 'clientId' => 'auth0-rotated-client', - ]); - $this->assertSame(200, $idOnly['headers']['status-code']); - $this->assertSame('auth0-rotated-client', $idOnly['body']['clientId']); - $this->assertSame('merge.us.auth0.com', $idOnly['body']['endpoint']); - - // Confirm the rotated clientSecret survived the chain by enabling. - // Auth0 has no verifyCredentials() hook; non-empty secret is enough. - $enable = $this->updateOAuth2('auth0', ['enabled' => true]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('auth0', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2Auth0EndpointAcceptsEmpty(): void - { - // Auth0's `endpoint` validator is `Nullable(Text(256, 0))`. Passing - // `''` must clear the stored value rather than leave it untouched - // (would happen if the merge fell back to existing on empty-string). - $this->updateOAuth2('auth0', [ - 'clientId' => 'auth0-clear-client', - 'clientSecret' => 'auth0-clear-secret', - 'endpoint' => 'before.us.auth0.com', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('auth0', [ - 'endpoint' => '', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['endpoint']); - $this->assertSame('auth0-clear-client', $response['body']['clientId']); - - // Cleanup - $this->updateOAuth2('auth0', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2Auth0EnableAndReadBack(): void - { - $update = $this->updateOAuth2('auth0', [ - 'clientId' => 'auth0-enable-client', - 'clientSecret' => 'auth0-enable-secret', - 'endpoint' => 'enable.us.auth0.com', + $update = $this->updateOAuth2('oidc', [ + 'clientId' => 'oidc-client', + 'clientSecret' => 'oidc-secret', + 'wellKnownURL' => 'https://idp.example/.well-known/openid-configuration', 'enabled' => true, ]); $this->assertSame(200, $update['headers']['status-code']); + $this->assertSame('oidc', $update['body']['$id']); + $this->assertSame('oidc-client', $update['body']['clientId']); + $this->assertSame('', $update['body']['clientSecret']); + $this->assertSame('https://idp.example/.well-known/openid-configuration', $update['body']['wellKnownURL']); $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId and endpoint. - $get = $this->getOAuth2Provider('auth0'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('auth0-enable-client', $get['body']['clientId']); - $this->assertSame('enable.us.auth0.com', $get['body']['endpoint']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('auth0', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); } - // ========================================================================= - // Update Authentik (clientId + clientSecret + optional endpoint) - // ========================================================================= - - public function testUpdateOAuth2AuthentikAllowsOmittedEndpointWhenDisabled(): void - { - $response = $this->updateOAuth2('authentik', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('authentik', $response['body']['$id']); - - // Cleanup - $this->updateOAuth2('authentik', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2AuthentikEmptyEndpointRejectedWhenEnabling(): void - { - $response = $this->updateOAuth2('authentik', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'endpoint' => '', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2Authentik(): void - { - $response = $this->updateOAuth2('authentik', [ - 'clientId' => 'dTKOPa0000000000000000000000000000e7G8hv', - 'clientSecret' => 'authentik-secret', - 'endpoint' => 'example.authentik.com', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('authentik', $response['body']['$id']); - $this->assertSame('dTKOPa0000000000000000000000000000e7G8hv', $response['body']['clientId']); - $this->assertSame('example.authentik.com', $response['body']['endpoint']); - - // Cleanup - $this->updateOAuth2('authentik', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2AuthentikPartialPreservesSecret(): void - { - // The `clientSecret` and `endpoint` live in the JSON blob and must - // survive when omitted on a subsequent call that only changes clientId. - $this->updateOAuth2('authentik', [ - 'clientId' => 'authentik-merge-client', - 'clientSecret' => 'authentik-merge-secret', - 'endpoint' => 'merge.authentik.com', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('authentik', [ - 'clientId' => 'authentik-rotated-client', - ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('authentik-rotated-client', $response['body']['clientId']); - $this->assertSame('merge.authentik.com', $response['body']['endpoint']); - - // Confirm clientSecret survived the omitted-field merge by enabling - // without re-sending endpoint. - $enable = $this->updateOAuth2('authentik', [ - 'enabled' => true, - ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('authentik', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2AuthentikEnableAndReadBack(): void - { - $update = $this->updateOAuth2('authentik', [ - 'clientId' => 'authentik-enable-client', - 'clientSecret' => 'authentik-enable-secret', - 'endpoint' => 'enable.authentik.com', - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId and endpoint. - $get = $this->getOAuth2Provider('authentik'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('authentik-enable-client', $get['body']['clientId']); - $this->assertSame('enable.authentik.com', $get['body']['endpoint']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('authentik', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update FusionAuth (clientId + clientSecret + optional endpoint) - // ========================================================================= - - public function testUpdateOAuth2FusionAuthAllowsOmittedEndpointWhenDisabled(): void - { - $response = $this->updateOAuth2('fusionauth', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('fusionauth', $response['body']['$id']); - - // Cleanup - $this->updateOAuth2('fusionauth', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2FusionAuthEmptyEndpointRejectedWhenEnabling(): void - { - $response = $this->updateOAuth2('fusionauth', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'endpoint' => '', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2FusionAuth(): void - { - $response = $this->updateOAuth2('fusionauth', [ - 'clientId' => 'b2222c00-0000-0000-0000-000000862097', - 'clientSecret' => 'fusionauth-secret', - 'endpoint' => 'example.fusionauth.io', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('fusionauth', $response['body']['$id']); - $this->assertSame('b2222c00-0000-0000-0000-000000862097', $response['body']['clientId']); - $this->assertSame('example.fusionauth.io', $response['body']['endpoint']); - - // Cleanup - $this->updateOAuth2('fusionauth', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2FusionAuthPartialPreservesSecret(): void - { - // The `clientSecret` and `endpoint` live in the JSON blob and must - // survive when omitted on a subsequent call that only changes clientId. - $this->updateOAuth2('fusionauth', [ - 'clientId' => 'fusionauth-merge-client', - 'clientSecret' => 'fusionauth-merge-secret', - 'endpoint' => 'merge.fusionauth.io', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('fusionauth', [ - 'clientId' => 'fusionauth-rotated-client', - ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('fusionauth-rotated-client', $response['body']['clientId']); - $this->assertSame('merge.fusionauth.io', $response['body']['endpoint']); - - // Confirm clientSecret survived the omitted-field merge by enabling - // without re-sending endpoint. - $enable = $this->updateOAuth2('fusionauth', [ - 'enabled' => true, - ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('fusionauth', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2FusionAuthEnableAndReadBack(): void - { - $update = $this->updateOAuth2('fusionauth', [ - 'clientId' => 'fusionauth-enable-client', - 'clientSecret' => 'fusionauth-enable-secret', - 'endpoint' => 'enable.fusionauth.io', - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId and endpoint. - $get = $this->getOAuth2Provider('fusionauth'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('fusionauth-enable-client', $get['body']['clientId']); - $this->assertSame('enable.fusionauth.io', $get['body']['endpoint']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('fusionauth', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Keycloak (clientId + clientSecret + optional endpoint + optional realmName) - // ========================================================================= - - public function testUpdateOAuth2KeycloakAllowsOmittedEndpointWhenDisabled(): void - { - $response = $this->updateOAuth2('keycloak', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'realmName' => 'appwrite-realm', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('keycloak', $response['body']['$id']); - - // Cleanup - $this->updateOAuth2('keycloak', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'realmName' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2KeycloakEmptyEndpointRejectedWhenEnabling(): void - { - $response = $this->updateOAuth2('keycloak', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'endpoint' => '', - 'realmName' => 'appwrite-realm', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2KeycloakAllowsOmittedRealmNameWhenDisabled(): void - { - $response = $this->updateOAuth2('keycloak', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'endpoint' => 'keycloak.example.com', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('keycloak', $response['body']['$id']); - - // Cleanup - $this->updateOAuth2('keycloak', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'realmName' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2KeycloakEmptyRealmNameRejectedWhenEnabling(): void - { - $response = $this->updateOAuth2('keycloak', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'endpoint' => 'keycloak.example.com', - 'realmName' => '', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2Keycloak(): void - { - $response = $this->updateOAuth2('keycloak', [ - 'clientId' => 'appwrite-o0000000st-app', - 'clientSecret' => 'keycloak-secret', - 'endpoint' => 'keycloak.example.com', - 'realmName' => 'appwrite-realm', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('keycloak', $response['body']['$id']); - $this->assertSame('appwrite-o0000000st-app', $response['body']['clientId']); - $this->assertSame('keycloak.example.com', $response['body']['endpoint']); - $this->assertSame('appwrite-realm', $response['body']['realmName']); - - // Cleanup - $this->updateOAuth2('keycloak', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'realmName' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2KeycloakPartialPreservesSecret(): void - { - // The `clientSecret`, `endpoint`, and `realmName` live in the JSON - // blob and must survive when omitted on a subsequent call that only - // changes clientId. - $this->updateOAuth2('keycloak', [ - 'clientId' => 'keycloak-merge-client', - 'clientSecret' => 'keycloak-merge-secret', - 'endpoint' => 'merge.keycloak.com', - 'realmName' => 'merge-realm', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('keycloak', [ - 'clientId' => 'keycloak-rotated-client', - ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('keycloak-rotated-client', $response['body']['clientId']); - $this->assertSame('merge.keycloak.com', $response['body']['endpoint']); - $this->assertSame('merge-realm', $response['body']['realmName']); - - // Confirm clientSecret survived the omitted-field merge by enabling - // without re-sending endpoint or realmName. - $enable = $this->updateOAuth2('keycloak', [ - 'enabled' => true, - ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('keycloak', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'realmName' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2KeycloakEnableAndReadBack(): void - { - $update = $this->updateOAuth2('keycloak', [ - 'clientId' => 'keycloak-enable-client', - 'clientSecret' => 'keycloak-enable-secret', - 'endpoint' => 'enable.keycloak.com', - 'realmName' => 'enable-realm', - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId, endpoint, realmName. - $get = $this->getOAuth2Provider('keycloak'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('keycloak-enable-client', $get['body']['clientId']); - $this->assertSame('enable.keycloak.com', $get['body']['endpoint']); - $this->assertSame('enable-realm', $get['body']['realmName']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('keycloak', [ - 'clientId' => '', - 'clientSecret' => '', - 'endpoint' => '', - 'realmName' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Microsoft (applicationId + applicationSecret + optional tenant) - // ========================================================================= - - public function testUpdateOAuth2MicrosoftAllowsOmittedTenantWhenDisabled(): void - { - $response = $this->updateOAuth2('microsoft', [ - 'applicationId' => 'whatever', - 'applicationSecret' => 'whatever', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('microsoft', $response['body']['$id']); - - // Cleanup - $this->updateOAuth2('microsoft', [ - 'applicationId' => '', - 'applicationSecret' => '', - 'tenant' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2MicrosoftEmptyTenantRejectedWhenEnabling(): void - { - $response = $this->updateOAuth2('microsoft', [ - 'applicationId' => 'whatever', - 'applicationSecret' => 'whatever', - 'tenant' => '', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2Microsoft(): void - { - $response = $this->updateOAuth2('microsoft', [ - 'applicationId' => '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret' => 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant' => 'common', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('microsoft', $response['body']['$id']); - $this->assertSame('00001111-aaaa-2222-bbbb-3333cccc4444', $response['body']['applicationId']); - $this->assertSame('common', $response['body']['tenant']); - // Custom param names: applicationId/applicationSecret, not clientId/clientSecret. - $this->assertArrayNotHasKey('clientId', $response['body']); - $this->assertArrayNotHasKey('clientSecret', $response['body']); - - // Cleanup - $this->updateOAuth2('microsoft', [ - 'applicationId' => '', - 'applicationSecret' => '', - 'tenant' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2MicrosoftPartialPreservesSecret(): void - { - // Seed full credentials. - $this->updateOAuth2('microsoft', [ - 'applicationId' => 'seed-app-id', - 'applicationSecret' => 'seed-app-secret', - 'tenant' => 'common', - 'enabled' => false, - ]); - - // Patch with only a new applicationId, leaving applicationSecret and - // tenant omitted. The stored JSON values must not be wiped. - $response = $this->updateOAuth2('microsoft', [ - 'applicationId' => 'updated-app-id', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('updated-app-id', $response['body']['applicationId']); - $this->assertSame('common', $response['body']['tenant']); - - // Cleanup - $this->updateOAuth2('microsoft', [ - 'applicationId' => '', - 'applicationSecret' => '', - 'tenant' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2MicrosoftEnableAndReadBack(): void - { - $update = $this->updateOAuth2('microsoft', [ - 'applicationId' => 'microsoft-enable-app', - 'applicationSecret' => 'microsoft-enable-secret', - 'tenant' => 'common', - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide applicationSecret while keeping applicationId/tenant. - $get = $this->getOAuth2Provider('microsoft'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('microsoft-enable-app', $get['body']['applicationId']); - $this->assertSame('common', $get['body']['tenant']); - $this->assertSame('', $get['body']['applicationSecret']); - - // Cleanup - $this->updateOAuth2('microsoft', [ - 'applicationId' => '', - 'applicationSecret' => '', - 'tenant' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Gitlab (applicationId + secret + optional endpoint, custom names) - // ========================================================================= - - public function testUpdateOAuth2Gitlab(): void - { - $response = $this->updateOAuth2('gitlab', [ - 'applicationId' => 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - 'secret' => 'gloas-838cfa00', - 'endpoint' => 'https://gitlab.example.com', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('gitlab', $response['body']['$id']); - $this->assertSame('d41ffe0000000000000000000000000000000000000000000000000000d5e252', $response['body']['applicationId']); - $this->assertSame('https://gitlab.example.com', $response['body']['endpoint']); - // Custom names — the response model exposes `applicationId`/`secret`. - $this->assertArrayNotHasKey('clientId', $response['body']); - $this->assertArrayNotHasKey('clientSecret', $response['body']); - - // Cleanup - $this->updateOAuth2('gitlab', [ - 'applicationId' => '', - 'secret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GitlabInvalidEndpoint(): void - { - $response = $this->updateOAuth2('gitlab', [ - 'applicationId' => 'whatever', - 'secret' => 'whatever', - 'endpoint' => 'not a url', - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2GitlabPartialEndpoint(): void - { - $this->updateOAuth2('gitlab', [ - 'applicationId' => 'gitlab-seed-app', - 'secret' => 'gitlab-seed-secret', - 'endpoint' => 'https://seed.gitlab.com', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('gitlab', [ - 'endpoint' => 'https://updated.gitlab.com', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('https://updated.gitlab.com', $response['body']['endpoint']); - $this->assertSame('gitlab-seed-app', $response['body']['applicationId']); - - // Cleanup - $this->updateOAuth2('gitlab', [ - 'applicationId' => '', - 'secret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GitlabPartialPreservesEachField(): void - { - // testUpdateOAuth2GitlabPartialEndpoint covers patching only `endpoint`. - // Cover patching `secret` alone (must not wipe applicationId/endpoint) - // and `applicationId` alone (must not wipe the JSON-blob endpoint). - $this->updateOAuth2('gitlab', [ - 'applicationId' => 'gitlab-merge-app', - 'secret' => 'gitlab-merge-secret', - 'endpoint' => 'https://merge.gitlab.com', - 'enabled' => false, - ]); - - // Patch only `secret`. - $secretOnly = $this->updateOAuth2('gitlab', [ - 'secret' => 'gitlab-rotated-secret', - ]); - $this->assertSame(200, $secretOnly['headers']['status-code']); - $this->assertSame('gitlab-merge-app', $secretOnly['body']['applicationId']); - $this->assertSame('https://merge.gitlab.com', $secretOnly['body']['endpoint']); - - // Patch only `applicationId`. - $idOnly = $this->updateOAuth2('gitlab', [ - 'applicationId' => 'gitlab-rotated-app', - ]); - $this->assertSame(200, $idOnly['headers']['status-code']); - $this->assertSame('gitlab-rotated-app', $idOnly['body']['applicationId']); - $this->assertSame('https://merge.gitlab.com', $idOnly['body']['endpoint']); - - // Cleanup - $this->updateOAuth2('gitlab', [ - 'applicationId' => '', - 'secret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GitlabEnableAndReadBack(): void - { - $update = $this->updateOAuth2('gitlab', [ - 'applicationId' => 'gitlab-enable-app', - 'secret' => 'gitlab-enable-secret', - 'endpoint' => 'https://enable.gitlab.com', - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide `secret` while keeping applicationId and endpoint. - $get = $this->getOAuth2Provider('gitlab'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('gitlab-enable-app', $get['body']['applicationId']); - $this->assertSame('https://enable.gitlab.com', $get['body']['endpoint']); - $this->assertSame('', $get['body']['secret']); - - // Cleanup - $this->updateOAuth2('gitlab', [ - 'applicationId' => '', - 'secret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GitlabEndpointAcceptsEmpty(): void - { - // The `endpoint` validator is `Nullable(URL(allowEmpty: true))`. Passing - // `''` must clear the stored value rather than 400 on URL validation. - $this->updateOAuth2('gitlab', [ - 'applicationId' => 'gitlab-clear-app', - 'secret' => 'gitlab-clear-secret', - 'endpoint' => 'https://before.gitlab.com', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('gitlab', [ - 'endpoint' => '', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['endpoint']); - - // Cleanup - $this->updateOAuth2('gitlab', [ - 'applicationId' => '', - 'secret' => '', - 'endpoint' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update OIDC (clientId + secret + wellKnownURL or 3 discovery URLs) - // ========================================================================= - - public function testUpdateOAuth2OidcWithWellKnown(): void + public function testUpdateOAuth2OidcRejectsIncompleteDiscoveryConfig(): void { $response = $this->updateOAuth2('oidc', [ 'clientId' => 'oidc-client', 'clientSecret' => 'oidc-secret', - 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('https://idp.example.com/.well-known/openid-configuration', $response['body']['wellKnownURL']); - $this->assertArrayHasKey('authorizationURL', $response['body']); - $this->assertArrayHasKey('tokenURL', $response['body']); - $this->assertArrayHasKey('userInfoURL', $response['body']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcWithDiscoveryURLs(): void - { - $response = $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-discovery', - 'clientSecret' => 'oidc-discovery-secret', - 'authorizationURL' => 'https://idp.example.com/oauth2/authorize', - 'tokenURL' => 'https://idp.example.com/oauth2/token', - 'userInfoURL' => 'https://idp.example.com/oauth2/userinfo', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('https://idp.example.com/oauth2/authorize', $response['body']['authorizationURL']); - $this->assertSame('https://idp.example.com/oauth2/token', $response['body']['tokenURL']); - $this->assertSame('https://idp.example.com/oauth2/userinfo', $response['body']['userInfoURL']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcEnableMissingURLs(): void - { - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-no-urls', - 'clientSecret' => 'oidc-no-urls', + 'authorizationURL' => 'https://idp.example/oauth2/authorize', + 'userInfoURL' => 'https://idp.example/oauth2/userinfo', 'enabled' => true, ]); $this->assertSame(400, $response['headers']['status-code']); $this->assertSame('general_argument_invalid', $response['body']['type']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); } - public function testUpdateOAuth2OidcEnablePartialDiscoveryFails(): void + public function testUpdateOAuth2OktaRoundTrip(): void { - // Only authorization+token, missing userInfo — must fail to enable. - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-partial', - 'clientSecret' => 'oidc-partial-secret', - 'authorizationURL' => 'https://idp.example.com/oauth2/authorize', - 'tokenURL' => 'https://idp.example.com/oauth2/token', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcEnableSucceedsWithWellKnown(): void - { - $update = $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-enable-client', - 'clientSecret' => 'oidc-enable-secret', - 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId and the URL. - $get = $this->getOAuth2Provider('oidc'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('oidc-enable-client', $get['body']['clientId']); - $this->assertSame('https://idp.example.com/.well-known/openid-configuration', $get['body']['wellKnownURL']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcEnableInSeparateRequestWithWellKnown(): void - { - // Configure URLs first with `enabled: false`. Then enable in a SECOND - // request that omits all URL fields. The merge-on-enable logic in - // Oidc::handle() must see the previously-stored wellKnownEndpoint and - // allow the toggle. This is the headline feature of the merge logic. - $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-split-wk-client', - 'clientSecret' => 'oidc-split-wk-secret', - 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', - 'enabled' => false, - ]); - - $enable = $this->updateOAuth2('oidc', [ - 'enabled' => true, - ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcEnableAcrossRequestsWithDiscoveryURLs(): void - { - // Reset to clean state — earlier tests in this section may have left - // partial URL state when running in any order. - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - - // Request 1: configure two of the three discovery URLs. - $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-split-discovery', - 'clientSecret' => 'oidc-split-discovery-secret', - 'authorizationURL' => 'https://idp.example.com/oauth2/authorize', - 'tokenURL' => 'https://idp.example.com/oauth2/token', - 'enabled' => false, - ]); - - // Request 2: send only the third URL plus enable=true. The merged - // state must include the two stored URLs + the new one to satisfy - // the all-three-discovery-URLs branch of the enable check. - $enable = $this->updateOAuth2('oidc', [ - 'userInfoURL' => 'https://idp.example.com/oauth2/userinfo', - 'enabled' => true, - ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Confirm all three URLs ended up persisted (merge wrote the new - // userInfoURL while preserving the previously stored two). - $get = $this->getOAuth2Provider('oidc'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertSame('https://idp.example.com/oauth2/authorize', $get['body']['authorizationURL']); - $this->assertSame('https://idp.example.com/oauth2/token', $get['body']['tokenURL']); - $this->assertSame('https://idp.example.com/oauth2/userinfo', $get['body']['userInfoURL']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcEnableFailsAfterClearingWellKnown(): void - { - // Seed wellKnownURL only (no discovery URLs). - $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-clear-then-enable', - 'clientSecret' => 'oidc-clear-then-enable-secret', - 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - - // Clear wellKnownURL and try to enable in the same request. Merge - // sees `wellKnown=''` (the cleared empty wins over the stored value - // because the new value is non-null) and no discovery URLs → 400. - // This is the inverse of testUpdateOAuth2OidcEnableInSeparateRequestWithWellKnown: - // confirms the merge correctly *replaces* with empty rather than - // falling back to the stored non-empty value. - $response = $this->updateOAuth2('oidc', [ - 'wellKnownURL' => '', - 'enabled' => true, - ]); - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcSwitchModesWellKnownToDiscovery(): void - { - // Configure with wellKnownURL, then switch to the three-discovery-URL - // mode in a single request: clear wellKnown, set the three URLs, - // enable. Merge sees wellKnown='' AND all three discovery URLs set → - // hasAllDiscovery branch passes. - $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-switch-client', - 'clientSecret' => 'oidc-switch-secret', - 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', - 'enabled' => false, - ]); - - $switch = $this->updateOAuth2('oidc', [ - 'wellKnownURL' => '', - 'authorizationURL' => 'https://idp.example.com/oauth2/authorize', - 'tokenURL' => 'https://idp.example.com/oauth2/token', - 'userInfoURL' => 'https://idp.example.com/oauth2/userinfo', - 'enabled' => true, - ]); - $this->assertSame(200, $switch['headers']['status-code']); - $this->assertTrue($switch['body']['enabled']); - $this->assertSame('', $switch['body']['wellKnownURL']); - $this->assertSame('https://idp.example.com/oauth2/authorize', $switch['body']['authorizationURL']); - $this->assertSame('https://idp.example.com/oauth2/token', $switch['body']['tokenURL']); - $this->assertSame('https://idp.example.com/oauth2/userinfo', $switch['body']['userInfoURL']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcURLsAcceptEmpty(): void - { - // All four URL fields use `Nullable(URL(allowEmpty: true))`. Passing `''` - // for each must clear them rather than 400 on URL validation. - $this->updateOAuth2('oidc', [ - 'clientId' => 'oidc-clear-client', - 'clientSecret' => 'oidc-clear-secret', - 'wellKnownURL' => 'https://idp.example.com/.well-known/openid-configuration', - 'authorizationURL' => 'https://idp.example.com/oauth2/authorize', - 'tokenURL' => 'https://idp.example.com/oauth2/token', - 'userInfoURL' => 'https://idp.example.com/oauth2/userinfo', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('oidc', [ - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['wellKnownURL']); - $this->assertSame('', $response['body']['authorizationURL']); - $this->assertSame('', $response['body']['tokenURL']); - $this->assertSame('', $response['body']['userInfoURL']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OidcBackwardCompatibleResponseFormat(): void - { - // Reset to clean state - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'wellKnownURL' => '', - 'authorizationURL' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - - $headers = [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-response-format' => '1.9.3', - ]; - $headers = \array_merge($headers, $this->getHeaders()); - - // Update using OLD param names (aliases must still work) - $response = $this->client->call( - Client::METHOD_PATCH, - '/project/oauth2/oidc', - $headers, - [ - 'clientId' => 'oidc-compat-client', - 'clientSecret' => 'oidc-compat-secret', - 'tokenUrl' => 'https://idp.example.com/oauth2/token', - 'userInfoUrl' => 'https://idp.example.com/oauth2/userinfo', - 'enabled' => false, - ], - ); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertArrayHasKey('tokenUrl', $response['body']); - $this->assertArrayHasKey('userInfoUrl', $response['body']); - $this->assertArrayNotHasKey('tokenURL', $response['body']); - $this->assertArrayNotHasKey('userInfoURL', $response['body']); - $this->assertSame('https://idp.example.com/oauth2/token', $response['body']['tokenUrl']); - $this->assertSame('https://idp.example.com/oauth2/userinfo', $response['body']['userInfoUrl']); - - // GET with 1.9.3 format must also return old param names - $get = $this->client->call( - Client::METHOD_GET, - '/project/oauth2/oidc', - $headers, - ); - - $this->assertSame(200, $get['headers']['status-code']); - $this->assertArrayHasKey('tokenUrl', $get['body']); - $this->assertArrayHasKey('userInfoUrl', $get['body']); - $this->assertArrayNotHasKey('tokenURL', $get['body']); - $this->assertArrayNotHasKey('userInfoURL', $get['body']); - $this->assertSame('https://idp.example.com/oauth2/token', $get['body']['tokenUrl']); - $this->assertSame('https://idp.example.com/oauth2/userinfo', $get['body']['userInfoUrl']); - - // LIST with 1.9.3 format must also return old param names for OIDC - $list = $this->client->call( - Client::METHOD_GET, - '/project/oauth2', - $headers, - ); - - $this->assertSame(200, $list['headers']['status-code']); - $oidcEntry = null; - foreach ($list['body']['providers'] as $provider) { - if ($provider['$id'] === 'oidc') { - $oidcEntry = $provider; - break; - } - } - $this->assertNotNull($oidcEntry, 'OIDC provider missing from listOAuth2Providers response'); - $this->assertArrayHasKey('tokenUrl', $oidcEntry); - $this->assertArrayHasKey('userInfoUrl', $oidcEntry); - $this->assertArrayNotHasKey('tokenURL', $oidcEntry); - $this->assertArrayNotHasKey('userInfoURL', $oidcEntry); - $this->assertSame('https://idp.example.com/oauth2/token', $oidcEntry['tokenUrl']); - $this->assertSame('https://idp.example.com/oauth2/userinfo', $oidcEntry['userInfoUrl']); - - // Cleanup - $this->updateOAuth2('oidc', [ - 'clientId' => '', - 'clientSecret' => '', - 'tokenURL' => '', - 'userInfoURL' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Okta (clientId + clientSecret + optional domain/authServer) - // ========================================================================= - - public function testUpdateOAuth2Okta(): void - { - $response = $this->updateOAuth2('okta', [ + $update = $this->updateOAuth2('okta', [ 'clientId' => '0oa00000000000000698', 'clientSecret' => 'okta-secret', 'domain' => 'trial-6400025.okta.com', 'authorizationServerId' => 'aus000000000000000h7z', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('okta', $response['body']['$id']); - $this->assertSame('0oa00000000000000698', $response['body']['clientId']); - $this->assertSame('trial-6400025.okta.com', $response['body']['domain']); - $this->assertSame('aus000000000000000h7z', $response['body']['authorizationServerId']); - - // Cleanup - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'domain' => '', - 'authorizationServerId' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OktaInvalidDomain(): void - { - $response = $this->updateOAuth2('okta', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'domain' => 'https://trial-6400025.okta.com/', - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2OktaEnableRequiresDomain(): void - { - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'domain' => '', - 'authorizationServerId' => '', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('okta', [ - 'clientId' => 'okta-no-domain', - 'clientSecret' => 'okta-no-domain-secret', - 'enabled' => true, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - - // Cleanup - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OktaEnableSucceedsWithDomain(): void - { - $update = $this->updateOAuth2('okta', [ - 'clientId' => 'okta-enable-client', - 'clientSecret' => 'okta-enable-secret', - 'domain' => 'enable.okta.com', - 'authorizationServerId' => 'aus000000000000000h7z', 'enabled' => true, ]); $this->assertSame(200, $update['headers']['status-code']); + $this->assertSame('okta', $update['body']['$id']); + $this->assertSame('0oa00000000000000698', $update['body']['clientId']); + $this->assertSame('trial-6400025.okta.com', $update['body']['domain']); + $this->assertSame('aus000000000000000h7z', $update['body']['authorizationServerId']); + $this->assertSame('', $update['body']['clientSecret']); $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId, domain and authServerId. - $get = $this->getOAuth2Provider('okta'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('okta-enable-client', $get['body']['clientId']); - $this->assertSame('enable.okta.com', $get['body']['domain']); - $this->assertSame('aus000000000000000h7z', $get['body']['authorizationServerId']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'domain' => '', - 'authorizationServerId' => '', - 'enabled' => false, - ]); } - public function testUpdateOAuth2OktaPartialPreservesEachField(): void + public function testUpdateOAuth2GoogleRoundTrip(): void { - // Okta has no field-by-field partial test in the existing suite. Cover - // each of `domain`, `authorizationServerId`, and `clientSecret` being - // patched alone — all three live in the same JSON blob. - $this->updateOAuth2('okta', [ - 'clientId' => 'okta-merge-client', - 'clientSecret' => 'okta-merge-secret', - 'domain' => 'merge.okta.com', - 'authorizationServerId' => 'aus000000000000merge', - 'enabled' => false, - ]); - - // Patch only `domain` — others must survive. - $domainOnly = $this->updateOAuth2('okta', [ - 'domain' => 'rotated.okta.com', - ]); - $this->assertSame(200, $domainOnly['headers']['status-code']); - $this->assertSame('rotated.okta.com', $domainOnly['body']['domain']); - $this->assertSame('okta-merge-client', $domainOnly['body']['clientId']); - $this->assertSame('aus000000000000merge', $domainOnly['body']['authorizationServerId']); - - // Patch only `authorizationServerId`. - $authServerOnly = $this->updateOAuth2('okta', [ - 'authorizationServerId' => 'aus000000000rotated00', - ]); - $this->assertSame(200, $authServerOnly['headers']['status-code']); - $this->assertSame('rotated.okta.com', $authServerOnly['body']['domain']); - $this->assertSame('aus000000000rotated00', $authServerOnly['body']['authorizationServerId']); - - // Patch only `clientSecret` — domain and authServerId in the JSON blob - // must survive. Confirm the rotated secret persisted by enabling. - $secretOnly = $this->updateOAuth2('okta', [ - 'clientSecret' => 'okta-rotated-secret', - ]); - $this->assertSame(200, $secretOnly['headers']['status-code']); - $this->assertSame('rotated.okta.com', $secretOnly['body']['domain']); - $this->assertSame('aus000000000rotated00', $secretOnly['body']['authorizationServerId']); - - $enable = $this->updateOAuth2('okta', ['enabled' => true]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertTrue($enable['body']['enabled']); - - // Cleanup - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'domain' => '', - 'authorizationServerId' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OktaAuthServerIdAcceptsEmpty(): void - { - // `authorizationServerId` is `Nullable(Text(256, 0))`. Passing `''` - // must clear the stored value while leaving the rest of the JSON blob - // (clientSecret, oktaDomain) untouched. - $this->updateOAuth2('okta', [ - 'clientId' => 'okta-clear-auth-server', - 'clientSecret' => 'okta-clear-auth-server-secret', - 'domain' => 'authserver.okta.com', - 'authorizationServerId' => 'aus0000000000beforeauth', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('okta', [ - 'authorizationServerId' => '', - ]); - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['authorizationServerId']); - // domain (also stored in the JSON blob) must NOT have been wiped. - $this->assertSame('authserver.okta.com', $response['body']['domain']); - - // Cleanup - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'domain' => '', - 'authorizationServerId' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2OktaDomainAcceptsEmpty(): void - { - // The `domain` validator is `Nullable(Domain(allowEmpty: true))`. Passing - // `''` must clear the stored value rather than 400 on Domain validation. - $this->updateOAuth2('okta', [ - 'clientId' => 'okta-clear-client', - 'clientSecret' => 'okta-clear-secret', - 'domain' => 'before.okta.com', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('okta', [ - 'domain' => '', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('', $response['body']['domain']); - - // Cleanup - $this->updateOAuth2('okta', [ - 'clientId' => '', - 'clientSecret' => '', - 'domain' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Dropbox (custom param names: appKey + appSecret) - // ========================================================================= - - public function testUpdateOAuth2DropboxFieldNames(): void - { - $response = $this->updateOAuth2('dropbox', [ - 'appKey' => 'jl000000000009t', - 'appSecret' => 'g200000000000vw', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('dropbox', $response['body']['$id']); - $this->assertSame('jl000000000009t', $response['body']['appKey']); - $this->assertArrayHasKey('appSecret', $response['body']); - $this->assertArrayNotHasKey('clientId', $response['body']); - $this->assertArrayNotHasKey('clientSecret', $response['body']); - - // GET enforces write-only on the secret regardless of the custom name. - $get = $this->getOAuth2Provider('dropbox'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertSame('jl000000000009t', $get['body']['appKey']); - $this->assertSame('', $get['body']['appSecret']); - - // Cleanup - $this->updateOAuth2('dropbox', [ - 'appKey' => '', - 'appSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2DropboxPartial(): void - { - // Seed both fields, then patch only `appKey` and verify `appSecret` - // persists by enabling — Dropbox has no verifyCredentials() hook, so - // enabling succeeds purely from local state. - $this->updateOAuth2('dropbox', [ - 'appKey' => 'dropbox-seed-key', - 'appSecret' => 'dropbox-seed-secret', - 'enabled' => false, - ]); - - $response = $this->updateOAuth2('dropbox', [ - 'appKey' => 'dropbox-updated-key', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('dropbox-updated-key', $response['body']['appKey']); - - $enable = $this->updateOAuth2('dropbox', [ + $update = $this->updateOAuth2('google', [ + 'clientId' => 'google-client', + 'clientSecret' => 'google-secret', + 'prompt' => ['select_account'], 'enabled' => true, ]); - $this->assertSame(200, $enable['headers']['status-code']); - $this->assertSame(true, $enable['body']['enabled']); - // Cleanup - $this->updateOAuth2('dropbox', [ - 'appKey' => '', - 'appSecret' => '', - 'enabled' => false, - ]); + $this->assertSame(200, $update['headers']['status-code']); + $this->assertSame('google', $update['body']['$id']); + $this->assertSame('google-client', $update['body']['clientId']); + $this->assertSame(['select_account'], $update['body']['prompt']); + $this->assertSame('', $update['body']['clientSecret']); + $this->assertTrue($update['body']['enabled']); } - public function testUpdateOAuth2DropboxEnableAndReadBack(): void + public function testUpdateOAuth2DropboxCustomFieldRoundTrip(): void { $update = $this->updateOAuth2('dropbox', [ - 'appKey' => 'dropbox-enable-key', - 'appSecret' => 'dropbox-enable-secret', - 'enabled' => true, + 'appKey' => 'dropbox-app-key', + 'appSecret' => 'dropbox-app-secret', + 'enabled' => false, ]); $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide `appSecret` while keeping `appKey`. - $get = $this->getOAuth2Provider('dropbox'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('dropbox-enable-key', $get['body']['appKey']); - $this->assertSame('', $get['body']['appSecret']); - - // Cleanup - $this->updateOAuth2('dropbox', [ - 'appKey' => '', - 'appSecret' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Paypal Sandbox (inherits from Paypal — independent provider ID) - // ========================================================================= - - public function testUpdateOAuth2PaypalSandbox(): void - { - $response = $this->updateOAuth2('paypalSandbox', [ - 'clientId' => 'paypal-sandbox-client', - 'clientSecret' => 'paypal-sandbox-secret', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('paypalSandbox', $response['body']['$id']); - $this->assertSame('paypal-sandbox-client', $response['body']['clientId']); - - // Sandbox is independent of the regular paypal entry. - $regular = $this->getOAuth2Provider('paypal'); - $this->assertSame(200, $regular['headers']['status-code']); - $this->assertSame('paypal', $regular['body']['$id']); - $this->assertNotSame('paypal-sandbox-client', $regular['body']['clientId']); - - // Cleanup - $this->updateOAuth2('paypalSandbox', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2PaypalSandboxResponseModel(): void - { - // PaypalSandbox inherits from Paypal: param/response field is - // `secretKey` instead of `clientSecret`. A regression that adds the - // default `clientSecret` to the response model would leak the - // unwritten field; pin its absence on both PATCH and GET. - $update = $this->updateOAuth2('paypalSandbox', [ - 'clientId' => 'paypal-sandbox-shape', - 'secretKey' => 'paypal-sandbox-shape-secret', - 'enabled' => false, - ]); - $this->assertSame(200, $update['headers']['status-code']); - $this->assertArrayHasKey('secretKey', $update['body']); - $this->assertArrayNotHasKey('clientSecret', $update['body']); - - $get = $this->getOAuth2Provider('paypalSandbox'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertArrayHasKey('secretKey', $get['body']); - $this->assertArrayNotHasKey('clientSecret', $get['body']); - - // Cleanup - $this->updateOAuth2('paypalSandbox', [ - 'clientId' => '', - 'secretKey' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2PaypalDoesNotAffectSandbox(): void - { - // Reverse direction: writing to regular paypal must leave sandbox state intact. - $this->updateOAuth2('paypalSandbox', [ - 'clientId' => 'sandbox-untouched', - 'clientSecret' => 'sandbox-secret', - 'enabled' => false, - ]); - - $this->updateOAuth2('paypal', [ - 'clientId' => 'paypal-prod', - 'secretKey' => 'paypal-prod-secret', - 'enabled' => false, - ]); - - $sandbox = $this->getOAuth2Provider('paypalSandbox'); - $this->assertSame(200, $sandbox['headers']['status-code']); - $this->assertSame('sandbox-untouched', $sandbox['body']['clientId']); - - // Cleanup both - $this->updateOAuth2('paypal', [ - 'clientId' => '', - 'secretKey' => '', - 'enabled' => false, - ]); - $this->updateOAuth2('paypalSandbox', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Tradeshift Sandbox (inherits from Tradeshift — independent provider ID) - // ========================================================================= - - public function testUpdateOAuth2TradeshiftBox(): void - { - $response = $this->updateOAuth2('tradeshiftBox', [ - 'oauth2ClientId' => 'tradeshift-sandbox-client', - 'oauth2ClientSecret' => 'tradeshift-sandbox-secret', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('tradeshiftBox', $response['body']['$id']); - $this->assertSame('tradeshift-sandbox-client', $response['body']['oauth2ClientId']); - - // Sandbox is independent of the regular tradeshift entry. - $regular = $this->getOAuth2Provider('tradeshift'); - $this->assertSame(200, $regular['headers']['status-code']); - $this->assertSame('tradeshift', $regular['body']['$id']); - $this->assertNotSame('tradeshift-sandbox-client', $regular['body']['oauth2ClientId']); - - // Cleanup - $this->updateOAuth2('tradeshiftBox', [ - 'oauth2ClientId' => '', - 'oauth2ClientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2TradeshiftBoxResponseModel(): void - { - // TradeshiftSandbox inherits from Tradeshift: both clientId AND - // clientSecret are renamed (oauth2ClientId / oauth2ClientSecret). - // Pin that the default field names are absent from PATCH and GET - // responses so a stray addition to the response model is caught. - $update = $this->updateOAuth2('tradeshiftBox', [ - 'oauth2ClientId' => 'tradeshift-box-shape', - 'oauth2ClientSecret' => 'tradeshift-box-shape-secret', - 'enabled' => false, - ]); - $this->assertSame(200, $update['headers']['status-code']); - $this->assertArrayHasKey('oauth2ClientId', $update['body']); - $this->assertArrayHasKey('oauth2ClientSecret', $update['body']); + $this->assertSame('dropbox', $update['body']['$id']); + $this->assertSame('dropbox-app-key', $update['body']['appKey']); + $this->assertSame('', $update['body']['appSecret']); $this->assertArrayNotHasKey('clientId', $update['body']); $this->assertArrayNotHasKey('clientSecret', $update['body']); - $get = $this->getOAuth2Provider('tradeshiftBox'); + $get = $this->getOAuth2Provider('dropbox'); $this->assertSame(200, $get['headers']['status-code']); - $this->assertArrayHasKey('oauth2ClientId', $get['body']); - $this->assertArrayHasKey('oauth2ClientSecret', $get['body']); - $this->assertArrayNotHasKey('clientId', $get['body']); - $this->assertArrayNotHasKey('clientSecret', $get['body']); - - // Cleanup - $this->updateOAuth2('tradeshiftBox', [ - 'oauth2ClientId' => '', - 'oauth2ClientSecret' => '', - 'enabled' => false, - ]); + $this->assertSame('dropbox-app-key', $get['body']['appKey']); + $this->assertSame('', $get['body']['appSecret']); } - public function testUpdateOAuth2TradeshiftDoesNotAffectSandbox(): void - { - // Reverse direction: writing to regular tradeshift must not touch sandbox state. - $this->updateOAuth2('tradeshiftBox', [ - 'oauth2ClientId' => 'tradeshift-sandbox-untouched', - 'oauth2ClientSecret' => 'tradeshift-sandbox-secret', - 'enabled' => false, - ]); - - $this->updateOAuth2('tradeshift', [ - 'oauth2ClientId' => 'tradeshift-prod', - 'oauth2ClientSecret' => 'tradeshift-prod-secret', - 'enabled' => false, - ]); - - $sandbox = $this->getOAuth2Provider('tradeshiftBox'); - $this->assertSame(200, $sandbox['headers']['status-code']); - $this->assertSame('tradeshift-sandbox-untouched', $sandbox['body']['oauth2ClientId']); - - // Cleanup both - $this->updateOAuth2('tradeshift', [ - 'oauth2ClientId' => '', - 'oauth2ClientSecret' => '', - 'enabled' => false, - ]); - $this->updateOAuth2('tradeshiftBox', [ - 'oauth2ClientId' => '', - 'oauth2ClientSecret' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Update Google (clientId + clientSecret + optional prompt) - // ========================================================================= - - /** - * Default prompt MUST run before any other Google test that sets a custom - * prompt value. The global resetProjectOAuth2() only clears Amazon state, - * so Google state leaks across tests in the same class. Running this first - * guarantees the stored JSON blob has no pre-existing "prompt" key. - */ - public function testUpdateOAuth2GoogleDefaultPrompt(): void - { - // When prompt is omitted and nothing is stored, the default is ['consent']. - $response = $this->updateOAuth2('google', [ - 'clientId' => 'google-default-client', - 'clientSecret' => 'google-default-secret', - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame(['consent'], $response['body']['prompt']); - - // Cleanup - $this->updateOAuth2('google', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2Google(): void - { - $response = $this->updateOAuth2('google', [ - 'clientId' => '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', - 'clientSecret' => 'GOCSPX-2k8gsR0000000000000000VNahJj', - 'prompt' => ['select_account'], - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('google', $response['body']['$id']); - $this->assertSame('120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', $response['body']['clientId']); - $this->assertSame(['select_account'], $response['body']['prompt']); - - // Cleanup - $this->updateOAuth2('google', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GooglePartialPreservesPrompt(): void - { - // Seed clientSecret + prompt. - $this->updateOAuth2('google', [ - 'clientId' => 'google-seed-client', - 'clientSecret' => 'google-seed-secret', - 'prompt' => ['consent', 'select_account'], - 'enabled' => false, - ]); - - // Update only clientId. - $response = $this->updateOAuth2('google', [ - 'clientId' => 'google-rotated-client', - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame('google-rotated-client', $response['body']['clientId']); - $this->assertSame(['consent', 'select_account'], $response['body']['prompt']); - - // Cleanup - $this->updateOAuth2('google', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GooglePromptNoneAloneRejected(): void - { - $response = $this->updateOAuth2('google', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'prompt' => ['none', 'consent'], - 'enabled' => false, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2GooglePromptEmptyArrayRejected(): void - { - $response = $this->updateOAuth2('google', [ - 'clientId' => 'whatever', - 'clientSecret' => 'whatever', - 'prompt' => [], - 'enabled' => false, - ]); - - $this->assertSame(400, $response['headers']['status-code']); - $this->assertSame('general_argument_invalid', $response['body']['type']); - } - - public function testUpdateOAuth2GooglePromptNoneAloneAccepted(): void - { - $response = $this->updateOAuth2('google', [ - 'clientId' => '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', - 'clientSecret' => 'GOCSPX-2k8gsR0000000000000000VNahJj', - 'prompt' => ['none'], - 'enabled' => false, - ]); - - $this->assertSame(200, $response['headers']['status-code']); - $this->assertSame(['none'], $response['body']['prompt']); - - // Cleanup - $this->updateOAuth2('google', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - public function testUpdateOAuth2GoogleEnableAndReadBack(): void - { - $update = $this->updateOAuth2('google', [ - 'clientId' => 'google-enable-client', - 'clientSecret' => 'google-enable-secret', - 'prompt' => ['select_account'], - 'enabled' => true, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertTrue($update['body']['enabled']); - - // GET must hide clientSecret while keeping clientId and prompt. - $get = $this->getOAuth2Provider('google'); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertTrue($get['body']['enabled']); - $this->assertSame('google-enable-client', $get['body']['clientId']); - $this->assertSame(['select_account'], $get['body']['prompt']); - $this->assertSame('', $get['body']['clientSecret']); - - // Cleanup - $this->updateOAuth2('google', [ - 'clientId' => '', - 'clientSecret' => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Smoke test: every plain (clientId + clientSecret) provider - // - // Ensures each provider's Update endpoint is wired up correctly: routing, - // provider class, response model and `$id`. Custom-shaped providers - // (apple, auth0, authentik, fusionauth, gitlab, keycloak, microsoft, oidc, - // okta, dropbox) and sandboxes (paypalSandbox, tradeshiftSandbox) have - // dedicated tests above. - // Github is excluded because its `verifyCredentials()` hook is exercised - // separately. - // ========================================================================= - - /** - * Provider, ID-field, secret-field. Many providers rename one or both of - * the two credential params (`clientId`/`clientSecret`) to match the - * upstream provider's terminology, so the smoke test parameterises both. - * - * @return array> - */ - public static function plainProviders(): array - { - return [ - 'discord' => ['discord', 'clientId', 'clientSecret'], - 'figma' => ['figma', 'clientId', 'clientSecret'], - 'dailymotion' => ['dailymotion', 'apiKey', 'apiSecret'], - 'bitbucket' => ['bitbucket', 'key', 'secret'], - 'bitly' => ['bitly', 'clientId', 'clientSecret'], - 'box' => ['box', 'clientId', 'clientSecret'], - 'autodesk' => ['autodesk', 'clientId', 'clientSecret'], - 'google' => ['google', 'clientId', 'clientSecret'], - 'zoom' => ['zoom', 'clientId', 'clientSecret'], - 'zoho' => ['zoho', 'clientId', 'clientSecret'], - 'yandex' => ['yandex', 'clientId', 'clientSecret'], - 'x' => ['x', 'customerKey', 'secretKey'], - 'wordpress' => ['wordpress', 'clientId', 'clientSecret'], - 'twitch' => ['twitch', 'clientId', 'clientSecret'], - 'stripe' => ['stripe', 'clientId', 'apiSecretKey'], - 'spotify' => ['spotify', 'clientId', 'clientSecret'], - 'slack' => ['slack', 'clientId', 'clientSecret'], - 'podio' => ['podio', 'clientId', 'clientSecret'], - 'notion' => ['notion', 'oauthClientId', 'oauthClientSecret'], - 'salesforce' => ['salesforce', 'customerKey', 'customerSecret'], - 'yahoo' => ['yahoo', 'clientId', 'clientSecret'], - 'linkedin' => ['linkedin', 'clientId', 'primaryClientSecret'], - 'disqus' => ['disqus', 'publicKey', 'secretKey'], - 'etsy' => ['etsy', 'keyString', 'sharedSecret'], - 'facebook' => ['facebook', 'appId', 'appSecret'], - 'tradeshift' => ['tradeshift', 'oauth2ClientId', 'oauth2ClientSecret'], - 'paypal' => ['paypal', 'clientId', 'secretKey'], - 'kick' => ['kick', 'clientId', 'clientSecret'], - ]; - } - - #[DataProvider('plainProviders')] - public function testUpdateOAuth2PlainProvider(string $providerId, string $idField, string $secretField): void - { - $clientId = $providerId . '-smoke-client'; - $clientSecret = $providerId . '-smoke-secret'; - - $update = $this->updateOAuth2($providerId, [ - $idField => $clientId, - $secretField => $clientSecret, - 'enabled' => false, - ]); - - $this->assertSame(200, $update['headers']['status-code']); - $this->assertSame($providerId, $update['body']['$id']); - $this->assertSame($clientId, $update['body'][$idField]); - $this->assertFalse($update['body']['enabled']); - - // GET round-trip — confirms the value actually persisted (catches a - // PATCH that only echoes input without writing) and that the secret - // is hidden on read. - $get = $this->getOAuth2Provider($providerId); - $this->assertSame(200, $get['headers']['status-code']); - $this->assertSame($providerId, $get['body']['$id']); - $this->assertSame($clientId, $get['body'][$idField]); - $this->assertSame('', $get['body'][$secretField]); - $this->assertFalse($get['body']['enabled']); - - // Cleanup - $this->updateOAuth2($providerId, [ - $idField => '', - $secretField => '', - 'enabled' => false, - ]); - } - - /** - * For providers that rename `clientId` / `clientSecret` to a custom field - * (e.g. `apiKey`/`apiSecret`, `customerKey`/`secretKey`, `oauthClientId`), - * the renamed field replaces the default — the response model must NOT - * also expose the default name. Catches a regression where adding a - * custom param name forgets to remove the default from the response. - */ - #[DataProvider('plainProviders')] - public function testUpdateOAuth2PlainProviderResponseDoesNotLeakDefaultNames(string $providerId, string $idField, string $secretField): void - { - if ($idField === 'clientId' && $secretField === 'clientSecret') { - // Default-named provider — nothing to leak. Avoids a no-op assertion. - $this->markTestSkipped("{$providerId} uses default field names."); - } - - $update = $this->updateOAuth2($providerId, [ - $idField => $providerId . '-leak-check-id', - $secretField => $providerId . '-leak-check-secret', - 'enabled' => false, - ]); - $this->assertSame(200, $update['headers']['status-code']); - - if ($idField !== 'clientId') { - $this->assertArrayNotHasKey('clientId', $update['body'], "PATCH response for {$providerId} leaks default `clientId` despite using `{$idField}`."); - } - if ($secretField !== 'clientSecret') { - $this->assertArrayNotHasKey('clientSecret', $update['body'], "PATCH response for {$providerId} leaks default `clientSecret` despite using `{$secretField}`."); - } - - $get = $this->getOAuth2Provider($providerId); - $this->assertSame(200, $get['headers']['status-code']); - if ($idField !== 'clientId') { - $this->assertArrayNotHasKey('clientId', $get['body'], "GET response for {$providerId} leaks default `clientId` despite using `{$idField}`."); - } - if ($secretField !== 'clientSecret') { - $this->assertArrayNotHasKey('clientSecret', $get['body'], "GET response for {$providerId} leaks default `clientSecret` despite using `{$secretField}`."); - } - - // Cleanup - $this->updateOAuth2($providerId, [ - $idField => '', - $secretField => '', - 'enabled' => false, - ]); - } - - // ========================================================================= - // Helpers - // ========================================================================= - /** * @param array $params */ diff --git a/tests/e2e/Services/Project/OAuth2ConsoleClientTest.php b/tests/e2e/Services/Project/OAuth2ConsoleClientTest.php index b5654ffe4b..e73d70d76b 100644 --- a/tests/e2e/Services/Project/OAuth2ConsoleClientTest.php +++ b/tests/e2e/Services/Project/OAuth2ConsoleClientTest.php @@ -1,12 +1,14 @@ assertSame(301, $oauthInit['headers']['status-code']); $this->assertArrayHasKey('location', $oauthInit['headers']); $this->assertStringStartsWith('https://github.com/login/oauth/authorize', $oauthInit['headers']['location']); - $this->assertStringContainsString('client_id=' . \urlencode($clientId), $oauthInit['headers']['location']); - $this->assertStringContainsString('redirect_uri=', $oauthInit['headers']['location']); + $this->assertStringContainsString('client_id=' . \urlencode($clientId), (string) $oauthInit['headers']['location']); + $this->assertStringContainsString('redirect_uri=', (string) $oauthInit['headers']['location']); // Follow the redirect to GitHub's authorization endpoint. With a real user agent, GitHub // would prompt for login + app approval, then redirect back to Appwrite's callback with a diff --git a/tests/e2e/Services/Project/PlatformsConsoleClientTest.php b/tests/e2e/Services/Project/PlatformsConsoleClientTest.php index 9e6b841b00..cb0f475a94 100644 --- a/tests/e2e/Services/Project/PlatformsConsoleClientTest.php +++ b/tests/e2e/Services/Project/PlatformsConsoleClientTest.php @@ -1,12 +1,14 @@ ['enabled'], 'password-history' => ['total'], + 'password-strength' => ['min', 'uppercase', 'lowercase', 'number', 'symbols'], 'password-personal-data' => ['enabled'], 'session-alert' => ['enabled'], 'session-duration' => ['duration'], @@ -66,6 +67,13 @@ trait PoliciesBase { $this->updatePasswordDictionaryPolicy(true); $this->updatePasswordHistoryPolicy(5); + $this->updatePasswordStrengthPolicy([ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); $this->updateSessionDurationPolicy(3600); $this->updateMembershipPrivacyPolicy([ 'userId' => true, @@ -77,6 +85,7 @@ trait PoliciesBase $passwordDictionary = $this->getPolicy('password-dictionary'); $passwordHistory = $this->getPolicy('password-history'); + $passwordStrength = $this->getPolicy('password-strength'); $sessionDuration = $this->getPolicy('session-duration'); $membershipPrivacy = $this->getPolicy('membership-privacy'); @@ -86,6 +95,13 @@ trait PoliciesBase $this->assertSame(200, $passwordHistory['headers']['status-code']); $this->assertSame(5, $passwordHistory['body']['total']); + $this->assertSame(200, $passwordStrength['headers']['status-code']); + $this->assertSame(12, $passwordStrength['body']['min']); + $this->assertSame(true, $passwordStrength['body']['uppercase']); + $this->assertSame(true, $passwordStrength['body']['lowercase']); + $this->assertSame(true, $passwordStrength['body']['number']); + $this->assertSame(true, $passwordStrength['body']['symbols']); + $this->assertSame(200, $sessionDuration['headers']['status-code']); $this->assertSame(3600, $sessionDuration['body']['duration']); @@ -99,6 +115,7 @@ trait PoliciesBase // Cleanup $this->updatePasswordDictionaryPolicy(false); $this->updatePasswordHistoryPolicy(null); + $this->resetPasswordStrengthPolicy(); $this->updateSessionDurationPolicy(31536000); $this->updateMembershipPrivacyPolicy([ 'userId' => false, @@ -180,6 +197,13 @@ trait PoliciesBase { $this->updatePasswordDictionaryPolicy(true); $this->updatePasswordHistoryPolicy(5); + $this->updatePasswordStrengthPolicy([ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); $this->updateSessionDurationPolicy(3600); $this->updateMembershipPrivacyPolicy([ 'userId' => true, @@ -200,6 +224,11 @@ trait PoliciesBase $this->assertSame(true, $byId['password-dictionary']['enabled']); $this->assertSame(5, $byId['password-history']['total']); + $this->assertSame(12, $byId['password-strength']['min']); + $this->assertSame(true, $byId['password-strength']['uppercase']); + $this->assertSame(true, $byId['password-strength']['lowercase']); + $this->assertSame(true, $byId['password-strength']['number']); + $this->assertSame(true, $byId['password-strength']['symbols']); $this->assertSame(3600, $byId['session-duration']['duration']); $this->assertSame(true, $byId['membership-privacy']['userId']); $this->assertSame(true, $byId['membership-privacy']['userEmail']); @@ -210,6 +239,7 @@ trait PoliciesBase // Cleanup $this->updatePasswordDictionaryPolicy(false); $this->updatePasswordHistoryPolicy(null); + $this->resetPasswordStrengthPolicy(); $this->updateSessionDurationPolicy(31536000); $this->updateMembershipPrivacyPolicy([ 'userId' => false, @@ -435,6 +465,112 @@ trait PoliciesBase $this->assertSame(401, $response['headers']['status-code']); } + // ========================================================================= + // Password Strength + // ========================================================================= + + public function testUpdatePasswordStrengthPolicy(): void + { + $response = $this->updatePasswordStrengthPolicy([ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); + + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame('password-strength', $response['body']['$id']); + $this->assertSame(12, $response['body']['min']); + $this->assertSame(true, $response['body']['uppercase']); + $this->assertSame(true, $response['body']['lowercase']); + $this->assertSame(true, $response['body']['number']); + $this->assertSame(true, $response['body']['symbols']); + + $policy = $this->getPolicy('password-strength'); + $this->assertSame(200, $policy['headers']['status-code']); + $this->assertSame(12, $policy['body']['min']); + $this->assertSame(true, $policy['body']['uppercase']); + $this->assertSame(true, $policy['body']['lowercase']); + $this->assertSame(true, $policy['body']['number']); + $this->assertSame(true, $policy['body']['symbols']); + + // Cleanup + $this->resetPasswordStrengthPolicy(); + } + + public function testUpdatePasswordStrengthPolicyOptionPreservesOtherOptions(): void + { + $response = $this->updatePasswordStrengthPolicy([ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); + + $this->assertSame(200, $response['headers']['status-code']); + + $response = $this->updatePasswordStrengthPolicy([ + 'lowercase' => false, + ]); + + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame(12, $response['body']['min']); + $this->assertSame(true, $response['body']['uppercase']); + $this->assertSame(false, $response['body']['lowercase']); + $this->assertSame(true, $response['body']['number']); + $this->assertSame(true, $response['body']['symbols']); + + // Cleanup + $this->resetPasswordStrengthPolicy(); + } + + public function testUpdatePasswordStrengthPolicyMin(): void + { + $response = $this->updatePasswordStrengthPolicy([ + 'min' => 8, + ]); + + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame(8, $response['body']['min']); + + // Cleanup + $this->resetPasswordStrengthPolicy(); + } + + public function testUpdatePasswordStrengthPolicyBelowMin(): void + { + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', $this->buildHeaders(), [ + 'min' => 7, + ]); + + $this->assertSame(400, $response['headers']['status-code']); + } + + public function testUpdatePasswordStrengthPolicyEmptyBody(): void + { + $this->resetPasswordStrengthPolicy(); + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', $this->buildHeaders(), []); + + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame(8, $response['body']['min']); + $this->assertSame(false, $response['body']['uppercase']); + $this->assertSame(false, $response['body']['lowercase']); + $this->assertSame(false, $response['body']['number']); + $this->assertSame(false, $response['body']['symbols']); + } + + public function testUpdatePasswordStrengthPolicyWithoutAuth(): void + { + $response = $this->updatePasswordStrengthPolicy([ + 'min' => 12, + ], false); + + $this->assertSame(401, $response['headers']['status-code']); + } + // ========================================================================= // Password Personal Data Policy // ========================================================================= @@ -987,7 +1123,7 @@ trait PoliciesBase if ($otherParam === $param) { continue; } - $this->assertSame(true, $response['body'][$otherAttribute], $otherAttribute . ' should be untouched while only ' . $param . ' was updated'); + $this->assertSame(true, $response['body'][$otherAttribute], $otherAttribute.' should be untouched while only '.$param.' was updated'); } // Restore the field before the next iteration @@ -1102,10 +1238,10 @@ trait PoliciesBase protected function getProjectDocument(): array { - return $this->client->call(Client::METHOD_GET, '/projects/' . $this->getProject()['$id'], [ + return $this->client->call(Client::METHOD_GET, '/projects/'.$this->getProject()['$id'], [ 'content-type' => 'application/json', 'x-appwrite-project' => 'console', - 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'cookie' => 'a_session_console='.$this->getRoot()['session'], 'x-appwrite-response-format' => '1.9.4', ]); } @@ -1127,7 +1263,7 @@ trait PoliciesBase protected function getPolicy(string $policyId, bool $authenticated = true): mixed { - return $this->client->call(Client::METHOD_GET, '/project/policies/' . $policyId, $this->buildHeaders($authenticated)); + return $this->client->call(Client::METHOD_GET, '/project/policies/'.$policyId, $this->buildHeaders($authenticated)); } protected function updatePasswordDictionaryPolicy(bool $enabled, bool $authenticated = true): mixed @@ -1144,6 +1280,25 @@ trait PoliciesBase ]); } + /** + * @param array $params + */ + protected function updatePasswordStrengthPolicy(array $params, bool $authenticated = true): mixed + { + return $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', $this->buildHeaders($authenticated), $params); + } + + protected function resetPasswordStrengthPolicy(): void + { + $this->updatePasswordStrengthPolicy([ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ]); + } + protected function updatePasswordPersonalDataPolicy(bool $enabled, bool $authenticated = true): mixed { return $this->client->call(Client::METHOD_PATCH, '/project/policies/password-personal-data', $this->buildHeaders($authenticated), [ @@ -1187,7 +1342,7 @@ trait PoliciesBase } /** - * @param array $params + * @param array $params */ protected function updateMembershipPrivacyPolicy(array $params, bool $authenticated = true): mixed { diff --git a/tests/e2e/Services/Project/PoliciesConsoleClientTest.php b/tests/e2e/Services/Project/PoliciesConsoleClientTest.php index 2db8e57a35..cecf7714cf 100644 --- a/tests/e2e/Services/Project/PoliciesConsoleClientTest.php +++ b/tests/e2e/Services/Project/PoliciesConsoleClientTest.php @@ -1,12 +1,14 @@ false, 'userName' => false, 'userMFA' => false, + 'userAccessedAt' => false, ]); $this->assertSame(200, $response['headers']['status-code']); @@ -40,6 +43,7 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope $this->assertFalse($response['body']['authMembershipsUserPhone']); $this->assertFalse($response['body']['authMembershipsUserName']); $this->assertFalse($response['body']['authMembershipsMfa']); + $this->assertFalse($response['body']['authMembershipsUserAccessedAt']); // Step 2: Setup two users $user1Email = 'user1_' . uniqid() . '@localhost.test'; @@ -121,6 +125,28 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope 'cookie' => 'a_session_' . $projectId . '=' . $user1Session, ]; + // Also sign in as user2 and make a request so accessedAt is populated before privacy is enabled + $session2 = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => $user2Email, + 'password' => $password, + ]); + $this->assertSame(201, $session2['headers']['status-code']); + $user2Session = $session2['cookies']['a_session_' . $projectId]; + + $client2Headers = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'cookie' => 'a_session_' . $projectId . '=' . $user2Session, + ]; + + // Make a request as user2 to ensure accessedAt is updated + $this->client->call(Client::METHOD_GET, '/account', $client2Headers); + $response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamId . '/memberships', $clientHeaders); $this->assertSame(200, $response['headers']['status-code']); $this->assertSame(2, $response['body']['total']); @@ -132,6 +158,7 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope $this->assertSame('', $membership['userPhone']); $this->assertSame('', $membership['userId']); $this->assertFalse($membership['mfa']); + $this->assertSame('', $membership['userAccessedAt']); } // Step 5: Update privacy to true @@ -141,6 +168,7 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope 'userPhone' => true, 'userName' => true, 'userMFA' => true, + 'userAccessedAt' => true, ]); $this->assertSame(200, $response['headers']['status-code']); $this->assertTrue($response['body']['authMembershipsUserId']); @@ -148,6 +176,7 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope $this->assertTrue($response['body']['authMembershipsUserPhone']); $this->assertTrue($response['body']['authMembershipsUserName']); $this->assertTrue($response['body']['authMembershipsMfa']); + $this->assertTrue($response['body']['authMembershipsUserAccessedAt']); // Step 6: List memberships with privacy enabled - user details exposed $response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamId . '/memberships', $clientHeaders); @@ -166,6 +195,7 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope $this->assertSame($user1Email, $membershipsByUser[$user1Id]['userEmail']); $this->assertSame($user1Phone, $membershipsByUser[$user1Id]['userPhone']); $this->assertFalse($membershipsByUser[$user1Id]['mfa']); + $this->assertNotEmpty($membershipsByUser[$user1Id]['userAccessedAt']); $this->assertArrayHasKey($user2Id, $membershipsByUser); $this->assertSame($user2Id, $membershipsByUser[$user2Id]['userId']); @@ -173,5 +203,6 @@ class PoliciesMembershipPrivacyIntegrationTest extends Scope $this->assertSame($user2Email, $membershipsByUser[$user2Id]['userEmail']); $this->assertSame($user2Phone, $membershipsByUser[$user2Id]['userPhone']); $this->assertFalse($membershipsByUser[$user2Id]['mfa']); + $this->assertNotEmpty($membershipsByUser[$user2Id]['userAccessedAt']); } } diff --git a/tests/e2e/Services/Project/PoliciesPasswordDictionaryIntegrationTest.php b/tests/e2e/Services/Project/PoliciesPasswordDictionaryIntegrationTest.php index 0da64eb50b..f5489f66cc 100644 --- a/tests/e2e/Services/Project/PoliciesPasswordDictionaryIntegrationTest.php +++ b/tests/e2e/Services/Project/PoliciesPasswordDictionaryIntegrationTest.php @@ -1,5 +1,7 @@ getProject()['$id']; + $apiKey = $this->getProject()['apiKey']; + + $serverHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apiKey, + 'x-appwrite-response-format' => '1.9.4', + ]; + + $signupHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ]; + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', $serverHeaders, [ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); + + $this->assertSame(200, $response['headers']['status-code']); + $this->assertSame(12, $response['body']['min']); + $this->assertTrue($response['body']['uppercase']); + $this->assertTrue($response['body']['lowercase']); + $this->assertTrue($response['body']['number']); + $this->assertTrue($response['body']['symbols']); + + $weak = $this->client->call(Client::METHOD_POST, '/account', $signupHeaders, [ + 'userId' => ID::unique(), + 'email' => 'strength_weak_' . uniqid() . '@localhost.test', + 'password' => 'password123!', + 'name' => 'Weak Password User', + ]); + + $this->assertSame(400, $weak['headers']['status-code']); + + $valid = $this->client->call(Client::METHOD_POST, '/account', $signupHeaders, [ + 'userId' => ID::unique(), + 'email' => 'strength_valid_' . uniqid() . '@localhost.test', + 'password' => 'Password123!', + 'name' => 'Valid Password User', + ]); + + $this->assertSame(201, $valid['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', $serverHeaders, [ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ]); + + $this->assertSame(200, $response['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Project/PoliciesSessionAlertIntegrationTest.php b/tests/e2e/Services/Project/PoliciesSessionAlertIntegrationTest.php index 3e847b9ddb..49a327d5b3 100644 --- a/tests/e2e/Services/Project/PoliciesSessionAlertIntegrationTest.php +++ b/tests/e2e/Services/Project/PoliciesSessionAlertIntegrationTest.php @@ -1,5 +1,7 @@ assertArrayNotHasKey('authLimit', $response['body']); $this->assertArrayNotHasKey('authSessionsLimit', $response['body']); $this->assertArrayNotHasKey('authPasswordHistory', $response['body']); + $this->assertArrayNotHasKey('authPasswordStrengthMin', $response['body']); + $this->assertArrayNotHasKey('authPasswordStrengthRequireUppercase', $response['body']); + $this->assertArrayNotHasKey('authPasswordStrengthRequireLowercase', $response['body']); + $this->assertArrayNotHasKey('authPasswordStrengthRequireNumber', $response['body']); + $this->assertArrayNotHasKey('authPasswordStrengthRequireSpecialChar', $response['body']); $this->assertArrayNotHasKey('authPasswordDictionary', $response['body']); $this->assertArrayNotHasKey('authPersonalDataCheck', $response['body']); $this->assertArrayNotHasKey('authDisposableEmails', $response['body']); diff --git a/tests/e2e/Services/Project/ProjectCustomServerTest.php b/tests/e2e/Services/Project/ProjectCustomServerTest.php index a719d4b372..8e95bf72b5 100644 --- a/tests/e2e/Services/Project/ProjectCustomServerTest.php +++ b/tests/e2e/Services/Project/ProjectCustomServerTest.php @@ -1,12 +1,14 @@ assertEquals(200, $deployment['headers']['status-code']); $this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body'])); - }, 120000, 500); + + $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId, $function['body']['deploymentId'] ?? '', \json_encode($function['body'])); + }, 240000, 500); } /** diff --git a/tests/e2e/Services/ProjectWebhooks/WebhooksCustomClientTest.php b/tests/e2e/Services/ProjectWebhooks/WebhooksCustomClientTest.php index a6bda320a4..7ed5edfad1 100644 --- a/tests/e2e/Services/ProjectWebhooks/WebhooksCustomClientTest.php +++ b/tests/e2e/Services/ProjectWebhooks/WebhooksCustomClientTest.php @@ -1,5 +1,7 @@ assertEquals($account['headers']['status-code'], 201); + $this->assertEquals(201, $account['headers']['status-code']); $this->assertNotEmpty($account['body']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.create")); @@ -95,13 +97,13 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); @@ -109,9 +111,9 @@ class WebhooksCustomClientTest extends Scope $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); $this->assertEquals(true, (new DatetimeValidator())->isValid($webhook['data']['registration'])); - $this->assertEquals($webhook['data']['status'], true); + $this->assertEquals(true, $webhook['data']['status']); $this->assertEquals($webhook['data']['email'], $email); - $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals(false, $webhook['data']['emailVerification']); $this->assertEquals($webhook['data']['prefs'], []); } @@ -144,7 +146,7 @@ class WebhooksCustomClientTest extends Scope 'password' => $password, ]); - $this->assertEquals($accountSession['headers']['status-code'], 201); + $this->assertEquals(201, $accountSession['headers']['status-code']); $id = $account['body']['$id']; $session = $accountSession['cookies']['a_session_' . $this->getProject()['$id']]; @@ -156,7 +158,7 @@ class WebhooksCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, ])); - $this->assertEquals($account['headers']['status-code'], 200); + $this->assertEquals(200, $account['headers']['status-code']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.update.status")); $signatureKey = $this->getProject()['signatureKey']; @@ -164,23 +166,23 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.status', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.status", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.status', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.status", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); $this->assertEquals(true, (new DatetimeValidator())->isValid($webhook['data']['registration'])); - $this->assertEquals($webhook['data']['status'], false); + $this->assertEquals(false, $webhook['data']['status']); $this->assertEquals($webhook['data']['email'], $email); - $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals(false, $webhook['data']['emailVerification']); $this->assertEquals($webhook['data']['prefs'], []); } @@ -229,19 +231,19 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.sessions.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.sessions.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.sessions.{$sessionId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.sessions.{$sessionId}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.*.create", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.sessions.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.sessions.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.sessions.{$sessionId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.sessions.{$sessionId}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.*.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); @@ -255,9 +257,9 @@ class WebhooksCustomClientTest extends Scope $this->assertIsString($webhook['data']['osName']); $this->assertNotEmpty($webhook['data']['osVersion']); $this->assertIsString($webhook['data']['osVersion']); - $this->assertEquals($webhook['data']['clientType'], 'browser'); - $this->assertEquals($webhook['data']['clientCode'], 'CH'); - $this->assertEquals($webhook['data']['clientName'], 'Chrome'); + $this->assertEquals('browser', $webhook['data']['clientType']); + $this->assertEquals('CH', $webhook['data']['clientCode']); + $this->assertEquals('Chrome', $webhook['data']['clientName']); $this->assertNotEmpty($webhook['data']['clientVersion']); $this->assertIsString($webhook['data']['clientVersion']); $this->assertNotEmpty($webhook['data']['clientEngine']); @@ -268,7 +270,7 @@ class WebhooksCustomClientTest extends Scope $this->assertIsString($webhook['data']['deviceModel']); $this->assertIsString($webhook['data']['countryCode']); $this->assertIsString($webhook['data']['countryName']); - $this->assertEquals($webhook['data']['current'], true); + $this->assertEquals(true, $webhook['data']['current']); } public function testDeleteAccountSession(): void @@ -294,7 +296,7 @@ class WebhooksCustomClientTest extends Scope $sessionId = $accountSession['body']['$id']; $session = $accountSession['cookies']['a_session_' . $this->getProject()['$id']]; - $this->assertEquals($accountSession['headers']['status-code'], 201); + $this->assertEquals(201, $accountSession['headers']['status-code']); $accountSession = $this->client->call(Client::METHOD_DELETE, '/account/sessions/' . $sessionId, array_merge([ 'origin' => 'http://localhost', @@ -303,7 +305,7 @@ class WebhooksCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, ])); - $this->assertEquals($accountSession['headers']['status-code'], 204); + $this->assertEquals(204, $accountSession['headers']['status-code']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.sessions.{$sessionId}.delete")); $signatureKey = $this->getProject()['signatureKey']; @@ -311,23 +313,23 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.sessions.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.sessions.*.delete', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.sessions.{$sessionId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.sessions.{$sessionId}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.*.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.sessions.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.sessions.*.delete', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.sessions.{$sessionId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.sessions.{$sessionId}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.*.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertIsString($webhook['data']['expire']); @@ -337,9 +339,9 @@ class WebhooksCustomClientTest extends Scope $this->assertIsString($webhook['data']['osName']); $this->assertNotEmpty($webhook['data']['osVersion']); $this->assertIsString($webhook['data']['osVersion']); - $this->assertEquals($webhook['data']['clientType'], 'browser'); - $this->assertEquals($webhook['data']['clientCode'], 'CH'); - $this->assertEquals($webhook['data']['clientName'], 'Chrome'); + $this->assertEquals('browser', $webhook['data']['clientType']); + $this->assertEquals('CH', $webhook['data']['clientCode']); + $this->assertEquals('Chrome', $webhook['data']['clientName']); $this->assertNotEmpty($webhook['data']['clientVersion']); $this->assertIsString($webhook['data']['clientVersion']); $this->assertNotEmpty($webhook['data']['clientEngine']); @@ -350,7 +352,7 @@ class WebhooksCustomClientTest extends Scope $this->assertIsString($webhook['data']['deviceModel']); $this->assertIsString($webhook['data']['countryCode']); $this->assertIsString($webhook['data']['countryName']); - $this->assertEquals($webhook['data']['current'], true); + $this->assertEquals(true, $webhook['data']['current']); } public function testDeleteAccountSessions(): void @@ -376,7 +378,7 @@ class WebhooksCustomClientTest extends Scope $sessionId = $accountSession['body']['$id']; $session = $accountSession['cookies']['a_session_' . $this->getProject()['$id']]; - $this->assertEquals($accountSession['headers']['status-code'], 201); + $this->assertEquals(201, $accountSession['headers']['status-code']); $accountSession = $this->client->call(Client::METHOD_DELETE, '/account/sessions', array_merge([ 'origin' => 'http://localhost', @@ -385,7 +387,7 @@ class WebhooksCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, ])); - $this->assertEquals($accountSession['headers']['status-code'], 204); + $this->assertEquals(204, $accountSession['headers']['status-code']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.sessions.{$sessionId}.delete")); $signatureKey = $this->getProject()['signatureKey']; @@ -393,23 +395,23 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.sessions.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.sessions.*.delete', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.sessions.{$sessionId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.sessions.{$sessionId}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.*.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.sessions.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.sessions.*.delete', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.sessions.{$sessionId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.sessions.{$sessionId}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.*.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.sessions.{$sessionId}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertEquals(true, (new DatetimeValidator())->isValid($webhook['data']['expire'])); @@ -419,9 +421,9 @@ class WebhooksCustomClientTest extends Scope $this->assertIsString($webhook['data']['osName']); $this->assertNotEmpty($webhook['data']['osVersion']); $this->assertIsString($webhook['data']['osVersion']); - $this->assertEquals($webhook['data']['clientType'], 'browser'); - $this->assertEquals($webhook['data']['clientCode'], 'CH'); - $this->assertEquals($webhook['data']['clientName'], 'Chrome'); + $this->assertEquals('browser', $webhook['data']['clientType']); + $this->assertEquals('CH', $webhook['data']['clientCode']); + $this->assertEquals('Chrome', $webhook['data']['clientName']); $this->assertNotEmpty($webhook['data']['clientVersion']); $this->assertIsString($webhook['data']['clientVersion']); $this->assertNotEmpty($webhook['data']['clientEngine']); @@ -432,7 +434,7 @@ class WebhooksCustomClientTest extends Scope $this->assertIsString($webhook['data']['deviceModel']); $this->assertIsString($webhook['data']['countryCode']); $this->assertIsString($webhook['data']['countryName']); - $this->assertEquals($webhook['data']['current'], true); + $this->assertEquals(true, $webhook['data']['current']); } #[Retry(count: 1)] @@ -454,7 +456,7 @@ class WebhooksCustomClientTest extends Scope 'name' => $newName ]); - $this->assertEquals($account['headers']['status-code'], 200); + $this->assertEquals(200, $account['headers']['status-code']); $this->assertIsArray($account['body']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.update.name")); @@ -464,25 +466,25 @@ class WebhooksCustomClientTest extends Scope $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.name', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.name", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.name', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.name", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $newName); $this->assertIsString($webhook['data']['registration']); - $this->assertEquals($webhook['data']['status'], true); + $this->assertEquals(true, $webhook['data']['status']); $this->assertEquals($webhook['data']['email'], $email); - $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals(false, $webhook['data']['emailVerification']); $this->assertEquals($webhook['data']['prefs'], []); } @@ -516,7 +518,7 @@ class WebhooksCustomClientTest extends Scope 'oldPassword' => $password, ]); - $this->assertEquals($account['headers']['status-code'], 200); + $this->assertEquals(200, $account['headers']['status-code']); $this->assertIsArray($account['body']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.update.password")); @@ -525,25 +527,25 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.password', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.password", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.password', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.password", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); - $this->assertEquals($webhook['data']['name'], 'New Name'); + $this->assertEquals('New Name', $webhook['data']['name']); $this->assertIsString($webhook['data']['registration']); - $this->assertEquals($webhook['data']['status'], true); + $this->assertEquals(true, $webhook['data']['status']); $this->assertEquals($webhook['data']['email'], $email); - $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals(false, $webhook['data']['emailVerification']); $this->assertEquals($webhook['data']['prefs'], []); } @@ -578,7 +580,7 @@ class WebhooksCustomClientTest extends Scope 'password' => $password, ]); - $this->assertEquals($account['headers']['status-code'], 200); + $this->assertEquals(200, $account['headers']['status-code']); $this->assertIsArray($account['body']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.update.email")); @@ -587,25 +589,25 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.email', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.email", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.email', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.email", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); - $this->assertEquals($webhook['data']['name'], 'New Name'); + $this->assertEquals('New Name', $webhook['data']['name']); $this->assertIsString($webhook['data']['registration']); - $this->assertEquals($webhook['data']['status'], true); + $this->assertEquals(true, $webhook['data']['status']); $this->assertEquals($webhook['data']['email'], $newEmail); - $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals(false, $webhook['data']['emailVerification']); $this->assertEquals($webhook['data']['prefs'], []); } @@ -640,7 +642,7 @@ class WebhooksCustomClientTest extends Scope ] ]); - $this->assertEquals($account['headers']['status-code'], 200); + $this->assertEquals(200, $account['headers']['status-code']); $this->assertIsArray($account['body']); $webhook = $this->getLastRequest($this->webhookEventProbe("users.{$id}.update.prefs")); @@ -649,25 +651,25 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.prefs', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.prefs", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.prefs', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.prefs", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); - $this->assertEquals($webhook['data']['name'], 'New Name'); + $this->assertEquals('New Name', $webhook['data']['name']); $this->assertIsString($webhook['data']['registration']); - $this->assertEquals($webhook['data']['status'], true); + $this->assertEquals(true, $webhook['data']['status']); $this->assertEquals($webhook['data']['email'], $email); - $this->assertEquals($webhook['data']['emailVerification'], false); + $this->assertEquals(false, $webhook['data']['emailVerification']); $this->assertEquals($webhook['data']['prefs'], [ 'prefKey1' => 'prefValue1', 'prefKey2' => 'prefValue2', @@ -702,23 +704,23 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.verification.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.verification.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.verification.{$verificationId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.verification.{$verificationId}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.*.create", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.{$verificationId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.{$verificationId}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.verification.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.verification.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.verification.{$verificationId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.verification.{$verificationId}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.*.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.{$verificationId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.{$verificationId}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); @@ -768,23 +770,23 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.verification.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.verification.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.verification.{$verificationId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.verification.{$verificationId}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.*.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.{$verificationId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.verification.{$verificationId}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.verification.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.verification.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.verification.{$verificationId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.verification.{$verificationId}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.*.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.{$verificationId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.verification.{$verificationId}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertNotEmpty($webhook['data']['userId']); $this->assertNotEmpty($webhook['data']['secret']); @@ -818,19 +820,19 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.recovery.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.recovery.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.recovery.{$recoveryId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.recovery.{$recoveryId}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.*.create", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.recovery.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.recovery.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.recovery.{$recoveryId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.recovery.{$recoveryId}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.*.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); @@ -885,19 +887,19 @@ class WebhooksCustomClientTest extends Scope $url = $webhook['url']; $signatureExpected = base64_encode(hash_hmac('sha1', $url . $payload, $signatureKey, true)); - $this->assertEquals($webhook['method'], 'POST'); - $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); - $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.recovery.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.recovery.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.recovery.{$recoveryId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.*.recovery.{$recoveryId}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.*.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertEquals('POST', $webhook['method']); + $this->assertEquals('application/json', $webhook['headers']['Content-Type']); + $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.recovery.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.recovery.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.recovery.{$recoveryId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.*.recovery.{$recoveryId}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.*.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.recovery.{$recoveryId}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); @@ -942,20 +944,20 @@ class WebhooksCustomClientTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('teams.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('teams.*.memberships.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('teams.*.memberships.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('teams.*.memberships.*.update.status', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.*.memberships.{$membershipUid}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.*.memberships.{$membershipUid}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.*.memberships.{$membershipUid}.update.status", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}.memberships.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}.memberships.*.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}.memberships.*.update.status", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}.memberships.{$membershipUid}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}.memberships.{$membershipUid}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("teams.{$teamUid}.memberships.{$membershipUid}.update.status", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('teams.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('teams.*.memberships.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('teams.*.memberships.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('teams.*.memberships.*.update.status', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.*.memberships.{$membershipUid}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.*.memberships.{$membershipUid}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.*.memberships.{$membershipUid}.update.status", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}.memberships.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}.memberships.*.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}.memberships.*.update.status", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}.memberships.{$membershipUid}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}.memberships.{$membershipUid}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("teams.{$teamUid}.memberships.{$membershipUid}.update.status", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); diff --git a/tests/e2e/Services/ProjectWebhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/ProjectWebhooks/WebhooksCustomServerTest.php index eb08da56f2..04e541ea76 100644 --- a/tests/e2e/Services/ProjectWebhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/ProjectWebhooks/WebhooksCustomServerTest.php @@ -1,5 +1,7 @@ assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertTrue(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? '')); + $this->assertEmpty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals('Actors1', $webhook['data']['name']); $this->assertIsArray($webhook['data']['$permissions']); @@ -187,16 +189,16 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertTrue(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? '')); + $this->assertEmpty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''); }, 10000, 500); // Remove index @@ -213,16 +215,16 @@ class WebhooksCustomServerTest extends Scope // $this->assertEquals($webhook['method'], 'DELETE'); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*.update", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.indexes.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$actorsId}.indexes.*.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertTrue(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? '')); + $this->assertEmpty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''); } public function testDeleteCollection(): void @@ -279,14 +281,14 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.delete', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.collections.*.delete', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.collections.{$id}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertTrue(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? '')); + $this->assertEmpty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals('Demo', $webhook['data']['name']); $this->assertIsArray($webhook['data']['$permissions']); @@ -322,10 +324,10 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); @@ -365,16 +367,16 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertTrue(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? '')); + $this->assertEmpty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''); }, 10000, 500); // Remove index @@ -391,16 +393,16 @@ class WebhooksCustomServerTest extends Scope // $this->assertEquals($webhook['method'], 'DELETE'); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*.update", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.indexes.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$actorsId}.indexes.*.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertTrue(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? '')); + $this->assertEmpty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''); } public function testDeleteTable(): void @@ -457,10 +459,10 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.delete', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('databases.' . $databaseId . '.tables.*.delete', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("databases.{$databaseId}.tables.{$id}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); @@ -501,14 +503,14 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.create', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.create", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $name); $this->assertTrue((new DatetimeValidator())->isValid($webhook['data']['registration'])); @@ -543,16 +545,16 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.prefs', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.prefs", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.prefs', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.prefs", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertEquals('b', $webhook['data']['a']); } @@ -581,16 +583,16 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.update.status', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.update.status", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.update.status', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.update.status", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $data['name']); $this->assertTrue((new DatetimeValidator())->isValid($webhook['data']['registration'])); @@ -621,14 +623,14 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals('POST', $webhook['method']); $this->assertEquals('application/json', $webhook['headers']['Content-Type']); $this->assertEquals('Appwrite-Server vdev. Please report abuse at security@appwrite.io', $webhook['headers']['User-Agent']); - $this->assertStringContainsString('users.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString('users.*.delete', $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - $this->assertStringContainsString("users.{$id}.delete", $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString('users.*.delete', (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); + $this->assertStringContainsString("users.{$id}.delete", (string) $webhook['headers']['X-Appwrite-Webhook-Events']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - $this->assertEquals(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); + $this->assertSame(empty($webhook['headers']['X-Appwrite-Webhook-User-Id'] ?? ''), ('server' === $this->getSide())); $this->assertNotEmpty($webhook['data']['$id']); $this->assertEquals($webhook['data']['name'], $data['name']); $this->assertTrue((new DatetimeValidator())->isValid($webhook['data']['registration'])); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 7b44b0485d..696fce63cc 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -1,5 +1,7 @@ 'Project Test' ])); - $this->assertEquals($response['headers']['status-code'], 200); + $this->assertEquals(200, $response['headers']['status-code']); $this->assertGreaterThan(0, $response['body']['total']); $this->assertIsArray($response['body']['projects']); @@ -2040,7 +2042,7 @@ class ProjectsConsoleClientTest extends Scope }); $this->assertEquals('Fallback sign-in alert', $lastEmail['subject']); $this->assertEquals('Fallback Mailer', $lastEmail['from'][0]['name']); - $this->assertStringContainsString('Fallback sign-in alert body', $lastEmail['html']); + $this->assertStringContainsString('Fallback sign-in alert body', (string) $lastEmail['html']); /** Create a new session with German locale — expect fallback (en) template */ $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ @@ -2060,7 +2062,7 @@ class ProjectsConsoleClientTest extends Scope }); $this->assertEquals('Fallback sign-in alert', $lastEmail['subject']); $this->assertEquals('Fallback Mailer', $lastEmail['from'][0]['name']); - $this->assertStringContainsString('Fallback sign-in alert body', $lastEmail['html']); + $this->assertStringContainsString('Fallback sign-in alert body', (string) $lastEmail['html']); /** Create a new session with Slovak locale — expect Slovak template */ $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ @@ -2080,7 +2082,7 @@ class ProjectsConsoleClientTest extends Scope }); $this->assertEquals('Slovak sign-in alert', $lastEmail['subject']); $this->assertEquals('Slovak Mailer', $lastEmail['from'][0]['name']); - $this->assertStringContainsString('Slovak sign-in alert body', $lastEmail['html']); + $this->assertStringContainsString('Slovak sign-in alert body', (string) $lastEmail['html']); /** Cleanup — delete the project */ $response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId, array_merge([ @@ -2536,7 +2538,7 @@ class ProjectsConsoleClientTest extends Scope 'name' => $name, ]); - $this->assertEquals($response['headers']['status-code'], 501); + $this->assertEquals(501, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ 'content-type' => 'application/json', @@ -2562,7 +2564,7 @@ class ProjectsConsoleClientTest extends Scope 'url' => 'http://localhost:5000/join-us#title' ]); - $this->assertEquals($response['headers']['status-code'], 501); + $this->assertEquals(501, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/account/jwt', array_merge([ 'content-type' => 'application/json', @@ -2570,7 +2572,7 @@ class ProjectsConsoleClientTest extends Scope 'cookie' => 'a_session_' . $id . '=' . $session, ])); - $this->assertEquals($response['headers']['status-code'], 501); + $this->assertEquals(501, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ 'origin' => 'http://localhost', @@ -2581,7 +2583,7 @@ class ProjectsConsoleClientTest extends Scope 'password' => $originalPassword, ]); - $this->assertEquals($response['headers']['status-code'], 501); + $this->assertEquals(501, $response['headers']['status-code']); $response = $this->client->call(Client::METHOD_POST, '/account/sessions/anonymous', array_merge([ 'origin' => 'http://localhost', @@ -2589,7 +2591,7 @@ class ProjectsConsoleClientTest extends Scope 'x-appwrite-project' => $id, ])); - $this->assertEquals($response['headers']['status-code'], 501); + $this->assertEquals(501, $response['headers']['status-code']); // Cleanup @@ -2715,7 +2717,7 @@ class ProjectsConsoleClientTest extends Scope 'name' => $name, ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code']); } public function testUpdateProjectAuthSessionsLimit(): void @@ -2906,6 +2908,177 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(0, $response['body']['authPasswordHistory']); } + public function testUpdateProjectAuthPasswordStrength(): void + { + $data = $this->setupProjectData(); + $id = $data['projectId']; + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'min' => 7, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'min' => 12, + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(12, $response['body']['min']); + $this->assertEquals(true, $response['body']['uppercase']); + $this->assertEquals(true, $response['body']['lowercase']); + $this->assertEquals(true, $response['body']['number']); + $this->assertEquals(true, $response['body']['symbols']); + + $weakPassword = 'password123!'; + $validPassword = 'Password123!'; + $email = uniqid() . 'user@localhost.test'; + + $response = $this->client->call(Client::METHOD_POST, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ]), [ + 'userId' => ID::unique(), + 'email' => uniqid() . 'weak-account@localhost.test', + 'password' => $weakPassword, + 'name' => 'Weak Account', + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_POST, '/users', array_merge($this->getHeaders(), [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + 'x-appwrite-mode' => 'admin', + ]), [ + 'userId' => ID::unique(), + 'email' => uniqid() . 'weak-user@localhost.test', + 'password' => $weakPassword, + 'name' => 'Weak User', + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_POST, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ]), [ + 'userId' => ID::unique(), + 'email' => $email, + 'password' => $validPassword, + 'name' => 'Password Strength User', + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $userId = $response['body']['$id']; + + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ], [ + 'email' => $email, + 'password' => $validPassword, + ]); + + $this->assertEquals(201, $session['headers']['status-code']); + $session = $session['cookies']['a_session_' . $id]; + + $response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + 'cookie' => 'a_session_' . $id . '=' . $session, + ]), [ + 'oldPassword' => $validPassword, + 'password' => $weakPassword, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_POST, '/account/recovery', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ]), [ + 'email' => $email, + 'url' => 'http://localhost/recovery', + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + + $lastEmail = $this->getLastEmailByAddress($email, function ($email) { + $this->assertStringContainsString('Password Reset', (string) $email['subject']); + }); + $tokens = $this->extractQueryParamsFromEmailLink($lastEmail['html']); + + $response = $this->client->call(Client::METHOD_PUT, '/account/recovery', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ]), [ + 'userId' => $userId, + 'secret' => $tokens['secret'], + 'password' => $weakPassword, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $headers = array_merge($this->getHeaders(), [ + 'x-appwrite-mode' => 'admin', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ]); + + $response = $this->client->call(Client::METHOD_PATCH, '/users/' . $userId . '/password', $headers, [ + 'password' => $weakPassword, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_PATCH, '/project/policies/password-strength', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'min' => 8, + 'uppercase' => false, + 'lowercase' => false, + 'number' => false, + 'symbols' => false, + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(8, $response['body']['min']); + $this->assertEquals(false, $response['body']['uppercase']); + $this->assertEquals(false, $response['body']['lowercase']); + $this->assertEquals(false, $response['body']['number']); + $this->assertEquals(false, $response['body']['symbols']); + } + #[Group('smtpAndTemplates')] #[Group('projectsCRUD')] public function testUpdateMockNumbers(): void @@ -3059,7 +3232,7 @@ class ProjectsConsoleClientTest extends Scope ]); $this->assertEquals(400, $response['headers']['status-code']); - $this->assertStringContainsString('Value must a valid array no longer than 10 items', $response['body']['message']); + $this->assertStringContainsString('Value must a valid array no longer than 10 items', (string) $response['body']['message']); /** * Test for success @@ -6552,7 +6725,7 @@ class ProjectsConsoleClientTest extends Scope 'error_description' => '', ], followRedirects: false); $this->assertEquals(400, $response['headers']['status-code']); - $this->assertStringContainsString('project_invalid_success_url', $response['body']); + $this->assertStringContainsString('project_invalid_success_url', (string) $response['body']); // Ensure rule's domain can be redirect URL $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider, [ @@ -6582,7 +6755,7 @@ class ProjectsConsoleClientTest extends Scope 'error_deescription' => '', ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - $this->assertStringContainsString('https://' . $domain, $response['headers']['location']); + $this->assertStringContainsString('https://' . $domain, (string) $response['headers']['location']); // Ensure unknown domain cannot be redirect URL $response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', [ @@ -6657,7 +6830,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(301, $response['headers']['status-code']); $this->assertStringStartsWith($scheme . '://', $response['headers']['location']); - $this->assertStringContainsString('error=', $response['headers']['location']); + $this->assertStringContainsString('error=', (string) $response['headers']['location']); } #[Group('abuseEnabled')] @@ -7233,29 +7406,13 @@ class ProjectsConsoleClientTest extends Scope 'roles' => ["owner"], 'successProjectIds' => [$projectIdA, $projectIdB], ], - [ - 'roles' => ["developer"], - 'successProjectIds' => [$projectIdA, $projectIdB], - ], [ 'roles' => ["project-$projectIdA-owner"], 'successProjectIds' => [$projectIdA], ], - [ - 'roles' => ["project-$projectIdB-owner"], - 'successProjectIds' => [$projectIdB], - ], - [ - 'roles' => ["project-$projectIdA-developer"], - 'successProjectIds' => [$projectIdA], - ], [ 'roles' => ["project-$projectIdB-developer"], 'successProjectIds' => [$projectIdB], - ], - [ - 'roles' => ["developer", "project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA, $projectIdB], ] ]; @@ -7321,35 +7478,15 @@ class ProjectsConsoleClientTest extends Scope 'successProjectIds' => [$projectIdA, $projectIdB], 'failureProjectIds' => [], ], - [ - 'roles' => ["developer"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], - ], [ 'roles' => ["project-$projectIdA-owner"], 'successProjectIds' => [$projectIdA], 'failureProjectIds' => [$projectIdB], ], - [ - 'roles' => ["project-$projectIdB-owner"], - 'successProjectIds' => [$projectIdB], - 'failureProjectIds' => [$projectIdA], - ], - [ - 'roles' => ["project-$projectIdA-developer"], - 'successProjectIds' => [$projectIdA], - 'failureProjectIds' => [$projectIdB], - ], [ 'roles' => ["project-$projectIdB-developer"], 'successProjectIds' => [$projectIdB], 'failureProjectIds' => [$projectIdA], - ], - [ - 'roles' => ["developer", "project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], ] ]; @@ -7452,11 +7589,6 @@ class ProjectsConsoleClientTest extends Scope 'successProjectIds' => [$projectIdD], 'failureProjectIds' => [$projectIdE], ], - [ - 'roles' => ["project-$projectIdE-owner"], - 'successProjectIds' => [$projectIdE], - 'failureProjectIds' => [], - ], ]; // Setup session @@ -7529,21 +7661,6 @@ class ProjectsConsoleClientTest extends Scope 'successProjectIds' => [$projectIdA, $projectIdB], 'failureProjectIds' => [], ], - [ - 'roles' => ["developer"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], - ], - [ - 'roles' => ["project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA], - 'failureProjectIds' => [$projectIdB], - ], - [ - 'roles' => ["project-$projectIdB-owner"], - 'successProjectIds' => [$projectIdB], - 'failureProjectIds' => [$projectIdA], - ], [ 'roles' => ["project-$projectIdA-developer"], 'successProjectIds' => [$projectIdA], @@ -7553,11 +7670,6 @@ class ProjectsConsoleClientTest extends Scope 'roles' => ["project-$projectIdB-developer"], 'successProjectIds' => [$projectIdB], 'failureProjectIds' => [$projectIdA], - ], - [ - 'roles' => ["developer", "project-$projectIdA-owner"], - 'successProjectIds' => [$projectIdA, $projectIdB], - 'failureProjectIds' => [], ] ]; @@ -7647,14 +7759,14 @@ class ProjectsConsoleClientTest extends Scope $userEmail = $this->getUser()['email']; $lastEmail = $this->getLastEmailByAddress($userEmail, function ($email) use ($url) { - $this->assertStringContainsString($url, $email['html'] ?? ''); + $this->assertStringContainsString($url, (string) ($email['html'] ?? '')); }); $this->assertEquals('Password Reset for ' . $this->getProject()['name'], $lastEmail['subject']); $expectedUrl = $url . "&userId=" . $userId . "&secret="; - $this->assertStringContainsString($expectedUrl, $lastEmail['html']); + $this->assertStringContainsString($expectedUrl, (string) $lastEmail['html']); // With search params, with mobile backlink $url = 'appwriteio://signin?id=abcd1234&tenant=efgh5678&domain=example.com&referred=0'; @@ -7679,14 +7791,14 @@ class ProjectsConsoleClientTest extends Scope $userId = $response['body']['userId']; $lastEmail = $this->getLastEmailByAddress($userEmail, function ($email) use ($url) { - $this->assertStringContainsString($url, $email['html'] ?? ''); + $this->assertStringContainsString($url, (string) ($email['html'] ?? '')); }); $this->assertEquals('Password Reset for ' . $this->getProject()['name'], $lastEmail['subject']); $expectedUrl = $url . "&userId=" . $userId . "&secret="; - $this->assertStringContainsString($expectedUrl, $lastEmail['html']); + $this->assertStringContainsString($expectedUrl, (string) $lastEmail['html']); // Without search params $url = 'http://localhost/auth/signin'; @@ -7711,14 +7823,14 @@ class ProjectsConsoleClientTest extends Scope $userId = $response['body']['userId']; $lastEmail = $this->getLastEmailByAddress($userEmail, function ($email) use ($url, $userId) { - $this->assertStringContainsString($url . '?userId=' . $userId, $email['html'] ?? ''); + $this->assertStringContainsString($url . '?userId=' . $userId, (string) ($email['html'] ?? '')); }); $this->assertEquals('Password Reset for ' . $this->getProject()['name'], $lastEmail['subject']); $expectedUrl = $url . "?userId=" . $userId . "&secret="; - $this->assertStringContainsString($expectedUrl, $lastEmail['html']); + $this->assertStringContainsString($expectedUrl, (string) $lastEmail['html']); // Without search params, with mobile backlink $url = 'appwriteio://signin'; @@ -7743,14 +7855,14 @@ class ProjectsConsoleClientTest extends Scope $userId = $response['body']['userId']; $lastEmail = $this->getLastEmailByAddress($userEmail, function ($email) use ($url, $userId) { - $this->assertStringContainsString($url . '?userId=' . $userId, $email['html'] ?? ''); + $this->assertStringContainsString($url . '?userId=' . $userId, (string) ($email['html'] ?? '')); }); $this->assertEquals('Password Reset for ' . $this->getProject()['name'], $lastEmail['subject']); $expectedUrl = $url . "?userId=" . $userId . "&secret="; - $this->assertStringContainsString($expectedUrl, $lastEmail['html']); + $this->assertStringContainsString($expectedUrl, (string) $lastEmail['html']); // With injection (allowed, meant to be protected client-side) $url = 'http://localhost/auth/signin\">

INJECTED

'; @@ -7775,19 +7887,19 @@ class ProjectsConsoleClientTest extends Scope $userId = $response['body']['userId']; $lastEmail = $this->getLastEmailByAddress($userEmail, function ($email) { - $this->assertStringContainsString('INJECTED', $email['html'] ?? ''); + $this->assertStringContainsString('INJECTED', (string) ($email['html'] ?? '')); }); $this->assertEquals('Password Reset for ' . $this->getProject()['name'], $lastEmail['subject']); - $this->assertStringContainsString('INJECTED', $lastEmail['html']); - $this->assertStringContainsString('

', $lastEmail['html']); - $this->assertStringContainsString('

', $lastEmail['html']); - $this->assertStringContainsString('">', $lastEmail['html']); - $this->assertStringContainsString('', $lastEmail['html']); + $this->assertStringContainsString('INJECTED', (string) $lastEmail['html']); + $this->assertStringContainsString('

', (string) $lastEmail['html']); + $this->assertStringContainsString('

', (string) $lastEmail['html']); + $this->assertStringContainsString('">', (string) $lastEmail['html']); + $this->assertStringContainsString('', (string) $lastEmail['html']); $expectedUrl = $url . "?userId=" . $userId . "&secret="; - $this->assertStringContainsString($expectedUrl, $lastEmail['html']); + $this->assertStringContainsString($expectedUrl, (string) $lastEmail['html']); } } diff --git a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php index d87c2cbf78..90c8e296ad 100644 --- a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php +++ b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php @@ -1,5 +1,7 @@ getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], $projectId); + ], $projectId, null, 10); $response = json_decode($client->receive(), true); @@ -913,7 +915,7 @@ class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], $projectId); + ], $projectId, null, 10); $response = json_decode($client->receive(), true); @@ -981,7 +983,7 @@ class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], 'console'); + ], 'console', null, 10); $response = json_decode($client->receive(), true); @@ -1042,7 +1044,7 @@ class RealtimeConsoleClientTest extends Scope $client = $this->getWebsocket(['console'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_console=' . $this->getRoot()['session'], - ], $projectId); + ], $projectId, null, 30); $response = json_decode($client->receive(), true); diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php index ff5e981de2..1664a01370 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTest.php @@ -1,5 +1,7 @@ receive(), true); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('contains', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('contains', (string) $response['data']['message']); // Test 2: Invalid query method in nested AND query $client = $this->getWebsocket(['documents'], [ @@ -52,8 +54,8 @@ class RealtimeCustomClientQueryTest extends Scope $response = json_decode($client->receive(), true); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('search', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('search', (string) $response['data']['message']); // Test 3: Invalid query method in nested OR query $client = $this->getWebsocket(['documents'], [ @@ -68,8 +70,8 @@ class RealtimeCustomClientQueryTest extends Scope $response = json_decode($client->receive(), true); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('between', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('between', (string) $response['data']['message']); // Test 4: Deeply nested invalid query (AND -> OR -> invalid) $client = $this->getWebsocket(['documents'], [ @@ -87,8 +89,8 @@ class RealtimeCustomClientQueryTest extends Scope $response = json_decode($client->receive(), true); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('startsWith', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('startsWith', (string) $response['data']['message']); // Test 5: Multiple invalid 'queries' in nested structure $client = $this->getWebsocket(['documents'], [ @@ -106,7 +108,7 @@ class RealtimeCustomClientQueryTest extends Scope $response = json_decode($client->receive(), true); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); // Should catch the first invalid method encountered $this->assertTrue( str_contains($response['data']['message'], 'contains') || diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php index 4d37a8944b..13a7d549dc 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientQueryTestWithMessage.php @@ -1,5 +1,7 @@ sendUnsubscribeMessage($client, [['subscriptionId' => 123]]); $this->assertEquals('error', $errNonString['type']); - $this->assertStringContainsString('subscriptionId', $errNonString['data']['message']); + $this->assertStringContainsString('subscriptionId', (string) $errNonString['data']['message']); $errEmpty = $this->sendUnsubscribeMessage($client, [['subscriptionId' => '']]); $this->assertEquals('error', $errEmpty['type']); @@ -598,8 +600,8 @@ class RealtimeCustomClientQueryTestWithMessage extends Scope Query::contains('status', ['active'])->toString(), ]); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('contains', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('contains', (string) $response['data']['message']); // Test 2: Invalid query method in nested AND query $response = $this->receiveSubscribeMessageResponse(['documents'], $headers, [ @@ -609,8 +611,8 @@ class RealtimeCustomClientQueryTestWithMessage extends Scope ])->toString(), ]); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('search', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('search', (string) $response['data']['message']); // Test 3: Invalid query method in nested OR query $response = $this->receiveSubscribeMessageResponse(['documents'], $headers, [ @@ -620,8 +622,8 @@ class RealtimeCustomClientQueryTestWithMessage extends Scope ])->toString(), ]); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('between', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('between', (string) $response['data']['message']); // Test 4: Deeply nested invalid query (AND -> OR -> invalid) $response = $this->receiveSubscribeMessageResponse(['documents'], $headers, [ @@ -634,8 +636,8 @@ class RealtimeCustomClientQueryTestWithMessage extends Scope ])->toString(), ]); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); - $this->assertStringContainsString('startsWith', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); + $this->assertStringContainsString('startsWith', (string) $response['data']['message']); // Test 5: Multiple invalid 'queries' in nested structure $response = $this->receiveSubscribeMessageResponse(['documents'], $headers, [ @@ -648,7 +650,7 @@ class RealtimeCustomClientQueryTestWithMessage extends Scope ])->toString(), ]); $this->assertEquals('error', $response['type']); - $this->assertStringContainsString('not supported in Realtime queries', $response['data']['message']); + $this->assertStringContainsString('not supported in Realtime queries', (string) $response['data']['message']); $this->assertTrue( \str_contains($response['data']['message'], 'contains') || \str_contains($response['data']['message'], 'endsWith') diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index 7fccd6839f..c623bdfd90 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -1,5 +1,7 @@ assertContains("users.*", $response['data']['events']); $lastEmail = $this->getLastEmailByAddress('torsten@appwrite.io', function ($email) use ($userId) { - $this->assertStringContainsString($userId, $email['html']); + $this->assertStringContainsString($userId, (string) $email['html']); }); $tokens = $this->extractQueryParamsFromEmailLink($lastEmail['html']); $verificationSecret = $tokens['secret']; @@ -674,8 +676,8 @@ class RealtimeCustomClientTest extends Scope $response = json_decode($client->receive(), true); $lastEmail = $this->getLastEmailByAddress('torsten@appwrite.io', function ($email) use ($userId) { - $this->assertStringContainsString($userId, $email['html']); - $this->assertStringContainsString('recovery', $email['html']); + $this->assertStringContainsString($userId, (string) $email['html']); + $this->assertStringContainsString('recovery', (string) $email['html']); }); $tokens = $this->extractQueryParamsFromEmailLink($lastEmail['html']); $recoverySecret = $tokens['secret']; @@ -741,6 +743,30 @@ class RealtimeCustomClientTest extends Scope $this->assertNotEmpty($response['data']['payload']); $client->close(); + + /** + * The password change and password-recovery completion above invalidate + * every existing session of this user, including the one cached in + * self::$user. Re-authenticate the SAME account (its email is now + * torsten@appwrite.io and its password 'test-recovery' after the flow + * above) and refresh only the cached session, so later tests in this + * process keep the same user $id but connect with a valid session + * instead of falling back to a guest connection. + */ + $refreshedSession = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => 'torsten@appwrite.io', + 'password' => 'test-recovery', + ]); + + $this->assertEquals(201, $refreshedSession['headers']['status-code']); + + self::$user[$projectId]['email'] = 'torsten@appwrite.io'; + self::$user[$projectId]['session'] = $refreshedSession['cookies']['a_session_' . $projectId]; + self::$user[$projectId]['sessionId'] = $refreshedSession['body']['$id']; } public function testChannelDatabase() @@ -3139,7 +3165,7 @@ class RealtimeCustomClientTest extends Scope $client = $this->getWebsocket(['documents'], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session - ]); + ], null, null, 10); $response = json_decode($client->receive(), true); @@ -3406,7 +3432,7 @@ class RealtimeCustomClientTest extends Scope ], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, - ]); + ], null, null, 10); $connected = json_decode($legacyClient->receive(), true); $this->assertEquals('connected', $connected['type']); @@ -3500,7 +3526,7 @@ class RealtimeCustomClientTest extends Scope ], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, - ]); + ], null, null, 10); $connected = json_decode($tablesClient->receive(), true); $this->assertEquals('connected', $connected['type']); @@ -3574,7 +3600,7 @@ class RealtimeCustomClientTest extends Scope ], [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $projectId . '=' . $session, - ]); + ], null, null, 10); $connected = json_decode($documentsClient->receive(), true); $this->assertEquals('connected', $connected['type']); diff --git a/tests/e2e/Services/Realtime/RealtimeQueryBase.php b/tests/e2e/Services/Realtime/RealtimeQueryBase.php index 5ab5c26253..233103b963 100644 --- a/tests/e2e/Services/Realtime/RealtimeQueryBase.php +++ b/tests/e2e/Services/Realtime/RealtimeQueryBase.php @@ -165,7 +165,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::equal('$id', [$targetDocumentId])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -263,7 +263,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::notEqual('$id', [$excludedDocumentId])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -358,7 +358,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::greaterThan('score', 50)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -452,7 +452,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::lessThan('age', 18)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -546,7 +546,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::greaterThanEqual('priority', 5)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -658,7 +658,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::lessThanEqual('level', 10)->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -771,7 +771,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::isNull('description')->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -865,7 +865,7 @@ trait RealtimeQueryBase 'cookie' => 'a_session_' . $projectId . '=' . $session, ], null, [ Query::isNotNull('email')->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -976,7 +976,7 @@ trait RealtimeQueryBase Query::equal('status', ['active']), Query::greaterThan('priority', 5) ])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -1099,7 +1099,7 @@ trait RealtimeQueryBase Query::equal('type', ['urgent']), Query::equal('type', ['critical']) ])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); @@ -1233,7 +1233,7 @@ trait RealtimeQueryBase ]), Query::greaterThanEqual('score', 80) ])->toString(), - ]); + ], 10); $this->assertConnectionStatusIfSupported($client); diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 7b9c5e86b0..54344f649a 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -34,6 +34,20 @@ trait SitesBase } protected function setupDeployment(string $siteId, mixed $params): string + { + $deploymentId = $this->createDeploymentAccepted($siteId, $params); + + $this->waitDeploymentReady($siteId, $deploymentId); + + // Not === so multipart/form-data works fine too + if (($params['activate'] ?? false) == true) { + $this->waitDeploymentActivated($siteId, $deploymentId); + } + + return $deploymentId; + } + + protected function createDeploymentAccepted(string $siteId, mixed $params): string { $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', array_merge([ 'content-type' => 'multipart/form-data', @@ -41,8 +55,12 @@ trait SitesBase 'x-appwrite-key' => $this->getProject()['apiKey'], ]), $params); $this->assertEquals($deployment['headers']['status-code'], 202, 'Setup deployment failed with status code: ' . $deployment['headers']['status-code'] . ' and response: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $deploymentId = $deployment['body']['$id'] ?? ''; + return $deployment['body']['$id'] ?? ''; + } + + protected function waitDeploymentReady(string $siteId, string $deploymentId): void + { $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ 'content-type' => 'application/json', @@ -54,11 +72,11 @@ trait SitesBase throw new Critical('Deployment failed: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); } - Console::execute("docker inspect openruntimes-executor --format='{{.State.ExitCode}}'", '', $this->stdout, $this->stderr); - if (\trim($this->stdout) !== '0') { + $code = Console::execute("docker inspect exc1 --format='{{.State.ExitCode}}'", '', $this->stdout, $this->stderr); + if ($code === 0 && \trim($this->stdout) !== '' && \trim($this->stdout) !== '0') { $msg = 'Executor has a problem: ' . $this->stderr . ' (' . $this->stdout . '), current status: '; - Console::execute("docker compose logs openruntimes-executor", '', $this->stdout, $this->stderr); + Console::execute("docker logs exc1", '', $this->stdout, $this->stderr); $msg .= $this->stdout . ' (' . $this->stderr . ')'; throw new Critical($msg . json_encode($deployment['body'], JSON_PRETTY_PRINT)); @@ -66,20 +84,18 @@ trait SitesBase $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); }, 120000, 500); + } - // Not === so multipart/form-data works fine too - if (($params['activate'] ?? false) == true) { - $this->assertEventually(function () use ($siteId, $deploymentId) { - $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'], - ])); - $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); - }, 120000, 500); - } - - return $deploymentId; + protected function waitDeploymentActivated(string $siteId, string $deploymentId): void + { + $this->assertEventually(function () use ($siteId, $deploymentId) { + $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + }, 120000, 500); } protected function cleanupSite(string $siteId): void diff --git a/tests/e2e/Services/Sites/SitesConsoleClientTest.php b/tests/e2e/Services/Sites/SitesConsoleClientTest.php index 2e0e1a892d..1bd5aa3233 100644 --- a/tests/e2e/Services/Sites/SitesConsoleClientTest.php +++ b/tests/e2e/Services/Sites/SitesConsoleClientTest.php @@ -1,5 +1,7 @@ call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Themed website", $response['body']); - $this->assertStringContainsString("@media (prefers-color-scheme: dark)", $response['body']); + $this->assertStringContainsString("Themed website", (string) $response['body']); + $this->assertStringContainsString("@media (prefers-color-scheme: dark)", (string) $response['body']); $deployment = null; $site = null; @@ -136,7 +138,7 @@ class SitesConsoleClientTest extends Scope $screenshotDarkHash = \md5($file['body']); $this->assertNotEmpty($screenshotDarkHash); - $this->assertNotEquals($screenshotDarkHash, $screenshotHash); + $this->assertNotSame($screenshotDarkHash, $screenshotHash); $screenshotId = $deployment['body']['screenshotLight']; $file = $this->client->call(Client::METHOD_GET, "/storage/buckets/screenshots/files/$screenshotId/preview?project=console"); diff --git a/tests/e2e/Services/Sites/SitesCustomClientTest.php b/tests/e2e/Services/Sites/SitesCustomClientTest.php index d576062c8f..b87faec691 100644 --- a/tests/e2e/Services/Sites/SitesCustomClientTest.php +++ b/tests/e2e/Services/Sites/SitesCustomClientTest.php @@ -1,5 +1,7 @@ assertEquals('github', $template['body']['vcsProvider']); $this->assertEquals('Simple React application integrated with Appwrite SDK.', $template['body']['tagline']); $this->assertIsArray($template['body']['frameworks']); - $this->assertStringContainsString('/images/sites/templates/starter-for-react-dark.png', $template['body']['screenshotDark']); - $this->assertStringContainsString('/images/sites/templates/starter-for-react-light.png', $template['body']['screenshotLight']); + $this->assertStringContainsString('/images/sites/templates/starter-for-react-dark.png', (string) $template['body']['screenshotDark']); + $this->assertStringContainsString('/images/sites/templates/starter-for-react-light.png', (string) $template['body']['screenshotLight']); /** * Test for FAILURE diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 914390c354..c2d69f8cc6 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1,5 +1,7 @@ call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Env variable is Appwrite", $response['body']); - $this->assertStringNotContainsString("Variable not found", $response['body']); + $this->assertStringContainsString("Env variable is Appwrite", (string) $response['body']); + $this->assertStringNotContainsString("Variable not found", (string) $response['body']); $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); @@ -713,253 +715,6 @@ class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testAdapterDetectionAstroSSR(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro SSR site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertEmpty($site['body']['adapter']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($siteId, &$site) { - $site = $this->getSite($siteId); - $this->assertEquals('ssr', $site['body']['adapter']); - }); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - - $this->cleanupSite($siteId); - } - - #[Retry(count: 3)] - public function testAdapterDetectionAstroStatic(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro static site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertEmpty($site['body']['adapter']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro-static'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - - $this->cleanupSite($siteId); - } - - public function testAdapterDetectionStatic(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Static site', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => '', - 'buildCommand' => '', - 'installCommand' => '', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertEmpty($site['body']['adapter']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - - $this->cleanupSite($siteId); - } - - public function testAdapterDetectionStaticSPA(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Static site', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => '', - 'buildCommand' => '', - 'installCommand' => '', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertArrayHasKey('adapter', $site['body']); - $this->assertArrayHasKey('fallbackFile', $site['body']); - $this->assertEmpty($site['body']['adapter']); - $this->assertEmpty($site['body']['fallbackFile']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - $this->assertEquals('main.html', $site['body']['fallbackFile']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Main page', $response['body']); - $response = $proxyClient->call(Client::METHOD_GET, '/something'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Main page', $response['body']); - - $this->cleanupSite($siteId); - } - - public function testSettingsForRollback(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Static site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEmpty($site['body']['adapter']); - $this->assertEmpty($site['body']['fallbackFile']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deploymentId1 = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro-static'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId1); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('static', $site['body']['adapter']); - $this->assertEquals('index.html', $site['body']['fallbackFile']); - - $site = $this->updateSite([ - 'name' => 'SSR site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'adapter' => 'ssr', - 'fallbackFile' => '', - '$id' => $siteId, - ]); - - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('ssr', $site['body']['adapter']); - $this->assertEmpty($site['body']['fallbackFile']); - - $deploymentId2 = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - $this->assertNotEmpty($deploymentId2); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - $this->assertEquals('ssr', $site['body']['adapter']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro SSR", $response['body']); - $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); - $this->assertEquals(404, $response['headers']['status-code']); - - $response = $this->updateSiteDeployment($siteId, $deploymentId1); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']['$id']); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro static", $response['body']); - $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro static", $response['body']); - - $this->cleanupSite($siteId); - } - public function testListSites(): void { /** @@ -980,9 +735,9 @@ class SitesCustomServerTest extends Scope 'search' => 'Test List Sites', ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(1, $sites['body']['sites']); - $this->assertEquals($sites['body']['sites'][0]['name'], 'Test List Sites'); + $this->assertEquals('Test List Sites', $sites['body']['sites'][0]['name']); // Test pagination limit $sites = $this->listSites([ @@ -991,7 +746,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(1, $sites['body']['sites']); // Test pagination offset with search filter (to only count our test site) @@ -1002,7 +757,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(0, $sites['body']['sites']); // Test filter enabled (with search to isolate our test site) @@ -1013,7 +768,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(1, $sites['body']['sites']); // Test filter disabled (with search to isolate our test site) @@ -1024,7 +779,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(0, $sites['body']['sites']); // Test search name @@ -1032,7 +787,7 @@ class SitesCustomServerTest extends Scope 'search' => 'Test List Sites' ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(1, $sites['body']['sites']); $this->assertEquals($sites['body']['sites'][0]['$id'], $siteId); @@ -1041,7 +796,7 @@ class SitesCustomServerTest extends Scope 'search' => 'analog' ]); - $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals(200, $sites['headers']['status-code']); $this->assertCount(1, $sites['body']['sites']); $this->assertEquals($sites['body']['sites'][0]['$id'], $siteId); @@ -1063,12 +818,12 @@ class SitesCustomServerTest extends Scope 'search' => 'Test List Sites', ]); - $this->assertEquals($sites['headers']['status-code'], 200); - $this->assertEquals($sites['body']['total'], 2); + $this->assertEquals(200, $sites['headers']['status-code']); + $this->assertEquals(2, $sites['body']['total']); $this->assertIsArray($sites['body']['sites']); $this->assertCount(2, $sites['body']['sites']); - $this->assertEquals($sites['body']['sites'][0]['name'], 'Test List Sites'); - $this->assertEquals($sites['body']['sites'][1]['name'], 'Test List Sites 2'); + $this->assertEquals('Test List Sites', $sites['body']['sites'][0]['name']); + $this->assertEquals('Test List Sites 2', $sites['body']['sites'][1]['name']); $sites1 = $this->listSites([ 'search' => 'Test List Sites', @@ -1077,9 +832,9 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($sites1['headers']['status-code'], 200); + $this->assertEquals(200, $sites1['headers']['status-code']); $this->assertCount(1, $sites1['body']['sites']); - $this->assertEquals($sites1['body']['sites'][0]['name'], 'Test List Sites 2'); + $this->assertEquals('Test List Sites 2', $sites1['body']['sites'][0]['name']); $sites2 = $this->listSites([ 'search' => 'Test List Sites', @@ -1088,9 +843,9 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($sites2['headers']['status-code'], 200); + $this->assertEquals(200, $sites2['headers']['status-code']); $this->assertCount(1, $sites2['body']['sites']); - $this->assertEquals($sites2['body']['sites'][0]['name'], 'Test List Sites'); + $this->assertEquals('Test List Sites', $sites2['body']['sites'][0]['name']); /** * Test for FAILURE @@ -1100,7 +855,7 @@ class SitesCustomServerTest extends Scope Query::cursorAfter(new Document(['$id' => 'unknown']))->toString(), ], ]); - $this->assertEquals($sites['headers']['status-code'], 400); + $this->assertEquals(400, $sites['headers']['status-code']); $this->cleanupSite($siteId); $this->cleanupSite($siteId2); @@ -1124,15 +879,15 @@ class SitesCustomServerTest extends Scope */ $site = $this->getSite($siteId); - $this->assertEquals($site['headers']['status-code'], 200); - $this->assertEquals($site['body']['name'], 'Test Site'); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals('Test Site', $site['body']['name']); /** * Test for FAILURE */ $site = $this->getSite('x'); - $this->assertEquals($site['headers']['status-code'], 404); + $this->assertEquals(404, $site['headers']['status-code']); $this->cleanupSite($siteId); } @@ -1589,7 +1344,7 @@ class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('Build has been canceled.', $deployment['body']['buildLogs']); + $this->assertStringContainsString('Build has been canceled.', (string) $deployment['body']['buildLogs']); }); $deployment = $this->getDeployment($siteId, $deploymentId); @@ -1677,8 +1432,8 @@ class SitesCustomServerTest extends Scope $deployments = $this->listDeployments($siteId); - $this->assertEquals($deployments['headers']['status-code'], 200); - $this->assertEquals($deployments['body']['total'], 2); + $this->assertEquals(200, $deployments['headers']['status-code']); + $this->assertEquals(2, $deployments['body']['total']); $this->assertIsArray($deployments['body']['deployments']); $this->assertCount(2, $deployments['body']['deployments']); $this->assertArrayHasKey('sourceSize', $deployments['body']['deployments'][0]); @@ -1690,7 +1445,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertCount(1, $deployments['body']['deployments']); $deployments = $this->listDeployments($siteId, [ @@ -1699,7 +1454,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertArrayHasKey('status', $deployments['body']['deployments'][0]); $this->assertArrayHasKey('status', $deployments['body']['deployments'][1]); $this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][0]); @@ -1711,7 +1466,7 @@ class SitesCustomServerTest extends Scope Query::select(['buildLogs'])->toString(), ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertArrayHasKey('buildLogs', $deployments['body']['deployments'][0]); $this->assertArrayHasKey('buildLogs', $deployments['body']['deployments'][1]); $this->assertArrayNotHasKey('sourceSize', $deployments['body']['deployments'][0]); @@ -1723,7 +1478,7 @@ class SitesCustomServerTest extends Scope ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertCount(1, $deployments['body']['deployments']); $deployments = $this->listDeployments( @@ -1735,7 +1490,7 @@ class SitesCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(2, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1747,7 +1502,7 @@ class SitesCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(0, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1759,7 +1514,7 @@ class SitesCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(0, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1771,7 +1526,7 @@ class SitesCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(0, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1783,7 +1538,7 @@ class SitesCustomServerTest extends Scope ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(2, $deployments['body']['total']); $deployments = $this->listDeployments( @@ -1794,7 +1549,7 @@ class SitesCustomServerTest extends Scope ], ] ); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertEquals(2, $deployments['body']['total']); /** @@ -1888,7 +1643,7 @@ class SitesCustomServerTest extends Scope */ $deployment = $this->getDeployment($siteId, 'x'); - $this->assertEquals($deployment['headers']['status-code'], 404); + $this->assertEquals(404, $deployment['headers']['status-code']); $this->cleanupDeployment($siteId, $deploymentId); $this->cleanupSite($siteId); @@ -2005,6 +1760,11 @@ class SitesCustomServerTest extends Scope $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals('ready', $deployment['body']['status']); + $this->assertTrue( + \str_contains((string) $deployment['body']['buildLogs'], 'Screenshot capturing finished.') + || \str_contains((string) $deployment['body']['buildLogs'], 'Screenshot capturing failed.'), + 'Screenshot worker did not finish: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT) + ); }, 120000, 500); /** @@ -2168,7 +1928,7 @@ class SitesCustomServerTest extends Scope ])); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Index page", $response['body']); + $this->assertStringContainsString("Index page", (string) $response['body']); $this->assertArrayHasKey('x-appwrite-log-id', $response['headers']); $this->assertNotEmpty($response['headers']['x-appwrite-log-id']); @@ -2179,7 +1939,7 @@ class SitesCustomServerTest extends Scope ])); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", $response['body']); + $this->assertStringContainsString("Contact page", (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/non-existing', array_merge([ 'content-type' => 'application/json', @@ -2187,65 +1947,9 @@ class SitesCustomServerTest extends Scope ])); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString("Page not found", $response['body']); // Title - $this->assertStringContainsString("Go to homepage", $response['body']); // Button - $this->assertStringNotContainsString("Powered by", $response['body']); // Brand - - $this->cleanupSite($siteId); - } - - public function testSiteStaticSPA(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'SPA site', - 'framework' => 'other', - 'adapter' => 'static', - 'buildRuntime' => 'static-1', - 'outputDirectory' => './', - 'buildCommand' => '', - 'installCommand' => '', - 'fallbackFile' => '404.html', - ]); - - $this->assertNotEmpty($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-spa'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->setupSiteDomain($siteId); - - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Index page", $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/contact', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/non-existing', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ])); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Customized 404 page", $response['body']); - $this->assertStringNotContainsString("Powered by", $response['body']); //brand + $this->assertStringContainsString("Page not found", (string) $response['body']); // Title + $this->assertStringContainsString("Go to homepage", (string) $response['body']); // Button + $this->assertStringNotContainsString("Powered by", (string) $response['body']); // Brand $this->cleanupSite($siteId); } @@ -2302,14 +2006,14 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", $response['body']); - $this->assertStringContainsString("Hello, Astronaut!", $response['body']); + $this->assertStringContainsString("Astro Blog", (string) $response['body']); + $this->assertStringContainsString("Hello, Astronaut!", (string) $response['body']); $response = $proxyClient->call(Client::METHOD_GET, '/about'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", $response['body']); - $this->assertStringContainsString("About Me", $response['body']); + $this->assertStringContainsString("Astro Blog", (string) $response['body']); + $this->assertStringContainsString("About Me", (string) $response['body']); $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); $this->assertEquals(200, $deployment['headers']['status-code']); @@ -2321,154 +2025,9 @@ class SitesCustomServerTest extends Scope $this->cleanupSite($siteId); } - public function testCreateSiteFromTemplateBranch() - { - $template = $this->getTemplate('playground-for-astro'); - $this->assertEquals(200, $template['headers']['status-code']); - $template = $template['body']; - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro Blog - Branch Test', - 'framework' => $template['frameworks'][0]['key'], - 'adapter' => $template['frameworks'][0]['adapter'], - 'buildRuntime' => $template['frameworks'][0]['buildRuntime'], - 'outputDirectory' => $template['frameworks'][0]['outputDirectory'], - 'buildCommand' => $template['frameworks'][0]['buildCommand'], - 'installCommand' => $template['frameworks'][0]['installCommand'], - 'fallbackFile' => $template['frameworks'][0]['fallbackFile'], - ]); - $this->assertNotEmpty($siteId); - - // Deploy using branch - $deployment = $this->createTemplateDeployment($siteId, [ - 'repository' => $template['providerRepositoryId'], - 'owner' => $template['providerOwner'], - 'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'], - 'type' => 'branch', - 'reference' => 'main', - 'activate' => true - ]); - - $this->assertEquals(202, $deployment['headers']['status-code']); - $this->assertNotEmpty($deployment['body']['$id']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertEquals(0, $deployment['body']['sourceSize']); - $this->assertEquals(0, $deployment['body']['buildSize']); - $this->assertEquals(0, $deployment['body']['totalSize']); - - $this->assertEventually(function () use ($siteId) { - $site = $this->getSite($siteId); - $this->assertNotEmpty($site['body']['deploymentId']); - }, 120000, 500); - - $domain = $this->setupSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", $response['body']); - $this->assertStringContainsString("Hello, Astronaut!", $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/about'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", $response['body']); - $this->assertStringContainsString("About Me", $response['body']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertGreaterThan(0, $deployment['body']['sourceSize']); - $this->assertGreaterThan(0, $deployment['body']['buildSize']); - $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; - $this->assertEquals($totalSize, $deployment['body']['totalSize']); - - $this->cleanupSite($siteId); - } - - public function testCreateSiteFromTemplateCommit() - { - $template = $this->getTemplate('playground-for-astro'); - $this->assertEquals(200, $template['headers']['status-code']); - - // Get latest commit using helper function - $latestCommit = $this->helperGetLatestCommit( - $template['body']['providerOwner'], - $template['body']['providerRepositoryId'] - ); - $this->assertNotNull($latestCommit); - - $template = $template['body']; - - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro Blog - Commit Test', - 'framework' => $template['frameworks'][0]['key'], - 'adapter' => $template['frameworks'][0]['adapter'], - 'buildRuntime' => $template['frameworks'][0]['buildRuntime'], - 'outputDirectory' => $template['frameworks'][0]['outputDirectory'], - 'buildCommand' => $template['frameworks'][0]['buildCommand'], - 'installCommand' => $template['frameworks'][0]['installCommand'], - 'fallbackFile' => $template['frameworks'][0]['fallbackFile'], - ]); - - $this->assertNotEmpty($siteId); - - // Deploy using commit - $deployment = $this->createTemplateDeployment($siteId, [ - 'repository' => $template['providerRepositoryId'], - 'owner' => $template['providerOwner'], - 'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'], - 'type' => 'commit', - 'reference' => $latestCommit, - 'activate' => true - ]); - - $this->assertEquals(202, $deployment['headers']['status-code']); - $this->assertNotEmpty($deployment['body']['$id']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertEquals(0, $deployment['body']['sourceSize']); - $this->assertEquals(0, $deployment['body']['buildSize']); - $this->assertEquals(0, $deployment['body']['totalSize']); - - $this->assertEventually(function () use ($siteId) { - $site = $this->getSite($siteId); - $this->assertNotEmpty($site['body']['deploymentId']); - }, 120000, 500); - - $domain = $this->setupSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", $response['body']); - $this->assertStringContainsString("Hello, Astronaut!", $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/about'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Astro Blog", $response['body']); - $this->assertStringContainsString("About Me", $response['body']); - - $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertGreaterThan(0, $deployment['body']['sourceSize']); - $this->assertGreaterThan(0, $deployment['body']['buildSize']); - $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; - $this->assertEquals($totalSize, $deployment['body']['totalSize']); - - $this->cleanupSite($siteId); - } public function testSiteDomainReclaiming(): void { @@ -2503,7 +2062,7 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringNotContainsString("This domain is not connected to any Appwrite resource yet", $response['body']); + $this->assertStringNotContainsString("This domain is not connected to any Appwrite resource yet", (string) $response['body']); $site2 = $this->createSite([ 'siteId' => ID::unique(), @@ -2549,7 +2108,7 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString("This page is empty, but you can make it yours.", $response['body']); + $this->assertStringContainsString("This page is empty, but you can make it yours.", (string) $response['body']); $site = $this->createSite([ 'siteId' => ID::unique(), @@ -2607,15 +2166,15 @@ class SitesCustomServerTest extends Scope $proxyClient->setEndpoint('http://' . $siteDomain); $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Hello Appwrite", $response['body']); - $this->assertStringNotContainsString("Preview by", $response['body']); + $this->assertStringContainsString("Hello Appwrite", (string) $response['body']); + $this->assertStringNotContainsString("Preview by", (string) $response['body']); $contentLength = $response['headers']['content-length']; $proxyClient = new Client(); $proxyClient->setEndpoint('http://' . $deploymentDomain); $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + $this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']); $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); $apiKey = $jwtObj->encode([ @@ -2626,16 +2185,16 @@ class SitesCustomServerTest extends Scope 'x-appwrite-key' => API_KEY_EPHEMERAL . '_' . $apiKey, ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Hello Appwrite", $response['body']); - $this->assertStringContainsString("Preview by", $response['body']); + $this->assertStringContainsString("Hello Appwrite", (string) $response['body']); + $this->assertStringContainsString("Preview by", (string) $response['body']); $this->assertGreaterThan($contentLength, $response['headers']['content-length']); $response = $proxyClient->call(Client::METHOD_GET, '/non-existing-path', followRedirects: false, headers: [ 'x-appwrite-key' => API_KEY_EPHEMERAL . '_' . $apiKey, ]); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString("Page not found", $response['body']); - $this->assertStringNotContainsString("Preview by", $response['body']); + $this->assertStringContainsString("Page not found", (string) $response['body']); + $this->assertStringNotContainsString("Preview by", (string) $response['body']); $this->assertGreaterThan($contentLength, $response['headers']['content-length']); $this->cleanupSite($siteId); @@ -2733,206 +2292,12 @@ class SitesCustomServerTest extends Scope $buildMd5 = \md5($response['body']); - $this->assertNotEquals($deploymentMd5, $buildMd5); + $this->assertNotSame($deploymentMd5, $buildMd5); $this->cleanupSite($siteId); } - public function testSSRLogs(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'SSR site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - $this->assertNotEmpty($siteId); - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->getSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Inline logs printed.", $response['body']); - - // Poll for execution logs to be written (async) - // Filter by requestPath to avoid picking up screenshot worker executions - // Wait for both the execution entry AND its logs field to be populated - $logs = null; - $timeout = 120; - $start = \time(); - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-inline'])->toString(), - Query::limit(1)->toString(), - ]); - if (!empty($logs['body']['executions']) && !empty($logs['body']['executions'][0]['logs'])) { - break; - } - \usleep(500000); - } - $this->assertNotEmpty($logs['body']['executions'], 'Execution logs were not available within timeout'); - $this->assertNotNull($logs['body']['executions'][0]['logs'], 'Execution logs content was not populated within timeout'); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertStringContainsString($deploymentId, $logs['body']['executions'][0]['deploymentId']); - $this->assertStringContainsString("GET", $logs['body']['executions'][0]['requestMethod']); - $this->assertStringContainsString("/logs-inline", $logs['body']['executions'][0]['requestPath']); - $this->assertStringContainsString("Log1", $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Log2", $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Error1", $logs['body']['executions'][0]['errors']); - $this->assertStringContainsString("Error2", $logs['body']['executions'][0]['errors']); - $log1Id = $logs['body']['executions'][0]['$id']; - $this->assertNotEmpty($log1Id); - - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::limit(1)->toString(), - Query::equal('deploymentId', [$deploymentId])->toString() - ]); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertGreaterThanOrEqual(1, $logs['body']['total']); - $this->assertCount(1, $logs['body']['executions']); - - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::limit(1)->toString(), - Query::equal('deploymentId', ['some-random-id'])->toString() - ]); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertEquals(0, $logs['body']['total']); - $this->assertCount(0, $logs['body']['executions']); - - $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Action logs printed.", $response['body']); - - $logs = null; - $start = \time(); - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-action'])->toString(), - Query::limit(1)->toString(), - ]); - if (!empty($logs['body']['executions']) && !empty($logs['body']['executions'][0]['logs'])) { - break; - } - \usleep(500000); - } - $this->assertNotEmpty($logs['body']['executions'], 'Action execution logs were not available within timeout'); - $this->assertNotNull($logs['body']['executions'][0]['logs'], 'Action execution logs content was not populated within timeout'); - $this->assertEquals(200, $logs['headers']['status-code']); - $this->assertStringContainsString($deploymentId, $logs['body']['executions'][0]['deploymentId']); - $this->assertStringContainsString("GET", $logs['body']['executions'][0]['requestMethod']); - $this->assertStringContainsString("/logs-action", $logs['body']['executions'][0]['requestPath']); - $this->assertStringContainsString("Log1", $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Log2", $logs['body']['executions'][0]['logs']); - $this->assertStringContainsString("Error1", $logs['body']['executions'][0]['errors']); - $this->assertStringContainsString("Error2", $logs['body']['executions'][0]['errors']); - $log2Id = $logs['body']['executions'][0]['$id']; - $this->assertNotEmpty($log2Id); - - $this->assertNotEquals($log1Id, $log2Id); - - $site = $this->updateSite( - [ - '$id' => $siteId, - 'name' => 'SSR site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - 'logging' => false // set logging to false - ] - ); - $this->assertEquals(200, $site['headers']['status-code']); - - // Wait for the logging config change to propagate to the site runtime - $this->assertEventually(function () use ($proxyClient) { - $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Inline logs printed.", $response['body']); - }, 15_000, 500); - - // Poll for the NEW log entry (after logging was disabled) to appear - $timeout = 30; - $start = \time(); - $newLog = null; - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-inline'])->toString(), - Query::limit(1)->toString(), - ]); - if ( - !empty($logs['body']['executions']) && - $logs['body']['executions'][0]['$id'] !== $log1Id - ) { - $newLog = $logs['body']['executions'][0]; - break; - } - \usleep(500000); - } - $this->assertNotNull($newLog, 'New log entry should appear after logging-disabled request'); - $this->assertEquals("GET", $newLog['requestMethod']); - $this->assertEquals("/logs-inline", $newLog['requestPath']); - $this->assertEmpty($newLog['logs']); - $this->assertEmpty($newLog['errors']); - $log1Id = $newLog['$id']; - $this->assertNotEmpty($log1Id); - - $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Action logs printed.", $response['body']); - - // Poll for the NEW log entry for /logs-action - $start = \time(); - $newLog = null; - while (\time() - $start < $timeout) { - $logs = $this->listLogs($siteId, [ - Query::orderDesc('$createdAt')->toString(), - Query::equal('requestPath', ['/logs-action'])->toString(), - Query::limit(1)->toString(), - ]); - if ( - !empty($logs['body']['executions']) && - $logs['body']['executions'][0]['$id'] !== $log2Id - ) { - $newLog = $logs['body']['executions'][0]; - break; - } - \usleep(500000); - } - $this->assertNotNull($newLog, 'New log entry should appear after logging-disabled /logs-action request'); - $this->assertEquals("GET", $newLog['requestMethod']); - $this->assertEquals("/logs-action", $newLog['requestPath']); - $this->assertEmpty($newLog['logs']); - $this->assertEmpty($newLog['errors']); - $log2Id = $logs['body']['executions'][0]['$id']; - $this->assertNotEmpty($log2Id); - - $this->cleanupSite($siteId); - } public function testDuplicateDeployment(): void { @@ -2958,7 +2323,7 @@ class SitesCustomServerTest extends Scope $this->assertNotEmpty($deploymentId1); $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); - $this->assertStringContainsString("Customized 404 page", $response['body']); + $this->assertStringContainsString("Customized 404 page", (string) $response['body']); $site = $this->updateSite([ '$id' => $siteId, @@ -2981,16 +2346,19 @@ class SitesCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); - $deploymentId2 = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId2); + $cliDeploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($cliDeploymentId); - $deployment = $this->getDeployment($siteId, $deploymentId2); + $deployment = $this->getDeployment($siteId, $cliDeploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertGreaterThan(0, $deployment['body']['sourceSize']); $this->assertEquals(0, $deployment['body']['buildSize']); $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); $this->assertEquals('cli', $deployment['body']['type']); + $this->waitDeploymentReady($siteId, $cliDeploymentId); + $this->waitDeploymentActivated($siteId, $cliDeploymentId); + // create another duplicate deployment with manual trigger $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/duplicate', array_merge([ 'content-type' => 'multipart/form-data', @@ -3001,25 +2369,23 @@ class SitesCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); - $deploymentId2 = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId2); + $manualDeploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($manualDeploymentId); - $deployment = $this->getDeployment($siteId, $deploymentId2); + $deployment = $this->getDeployment($siteId, $manualDeploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertGreaterThan(0, $deployment['body']['sourceSize']); $this->assertEquals(0, $deployment['body']['buildSize']); $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); $this->assertEquals('manual', $deployment['body']['type']); - $this->assertEventually(function () use ($siteId, $deploymentId2) { - $site = $this->getSite($siteId); - $this->assertEquals($deploymentId2, $site['body']['deploymentId']); - }, 120000, 500); + $this->waitDeploymentReady($siteId, $manualDeploymentId); + $this->waitDeploymentActivated($siteId, $manualDeploymentId); $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); - $this->assertStringContainsString("Index page", $response['body']); + $this->assertStringContainsString("Index page", (string) $response['body']); - $deployment = $this->getDeployment($siteId, $deploymentId2); + $deployment = $this->getDeployment($siteId, $manualDeploymentId); $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertGreaterThan(0, $deployment['body']['sourceSize']); $this->assertGreaterThan(0, $deployment['body']['buildSize']); @@ -3067,7 +2433,7 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Hello Appwrite', $response['body']); + $this->assertStringContainsString('Hello Appwrite', (string) $response['body']); $deploymentId2 = $this->setupDeployment($siteId, [ 'code' => $this->packageSite('static-spa'), @@ -3082,7 +2448,7 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Index page', $response['body']); + $this->assertStringContainsString('Index page', (string) $response['body']); $site = $this->getSite($siteId); $this->assertEquals(200, $site['headers']['status-code']); @@ -3102,7 +2468,7 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Hello Appwrite', $response['body']); + $this->assertStringContainsString('Hello Appwrite', (string) $response['body']); $deployment = $this->deleteDeployment($siteId, $deploymentId2); $this->assertEquals(204, $deployment['headers']['status-code']); @@ -3140,10 +2506,10 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/contact', followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); - $this->assertStringContainsString('projectId=' . $this->getProject()['$id'], $response['headers']['location']); - $this->assertStringContainsString('origin=', $response['headers']['location']); - $this->assertStringContainsString('path=%2Fcontact', $response['headers']['location']); + $this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']); + $this->assertStringContainsString('projectId=' . $this->getProject()['$id'], (string) $response['headers']['location']); + $this->assertStringContainsString('origin=', (string) $response['headers']['location']); + $this->assertStringContainsString('path=%2Fcontact', (string) $response['headers']['location']); $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ 'origin' => 'http://localhost', @@ -3173,20 +2539,22 @@ class SitesCustomServerTest extends Scope ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); $this->assertArrayHasKey('set-cookie', $response['headers']); - $this->assertStringContainsString('a_jwt_console=', $response['headers']['set-cookie']); + $this->assertStringContainsString('a_jwt_console=', (string) $response['headers']['set-cookie']); // due to swoole update; no more httponly - $this->assertStringContainsString('HttpOnly', $response['headers']['set-cookie']); - $this->assertStringContainsString('domain=' . $domain, $response['headers']['set-cookie']); - $this->assertStringContainsString('path=/', $response['headers']['set-cookie']); + $this->assertStringContainsString('HttpOnly', (string) $response['headers']['set-cookie']); + $this->assertStringContainsString('domain=' . $domain, (string) $response['headers']['set-cookie']); + $this->assertStringContainsString('path=/', (string) $response['headers']['set-cookie']); $this->assertNotEmpty($response['cookies']['a_jwt_console']); $this->assertEquals($jwt['body']['jwt'], $response['cookies']['a_jwt_console']); - $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ - 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] - ], followRedirects: false); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", $response['body']); - $this->assertStringContainsString("Preview by", $response['body']); + $this->assertEventually(function () use ($proxyClient, $jwt) { + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", (string) $response['body']); + $this->assertStringContainsString("Preview by", (string) $response['body']); + }); // Failure: Session missing (old bad, new ok) $session = $this->client->call(Client::METHOD_DELETE, '/account/sessions/current', array_merge([ @@ -3201,7 +2569,7 @@ class SitesCustomServerTest extends Scope 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + $this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']); // Failure: User missing $cookie = 'a_session_console=' .$this->getRoot()['session']; @@ -3214,12 +2582,14 @@ class SitesCustomServerTest extends Scope $this->assertEquals(201, $jwt['headers']['status-code']); $this->assertNotEmpty($jwt['body']['jwt']); - $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ - 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] - ], followRedirects: false); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Contact page", $response['body']); - $this->assertStringContainsString("Preview by", $response['body']); + $this->assertEventually(function () use ($proxyClient, $jwt) { + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", (string) $response['body']); + $this->assertStringContainsString("Preview by", (string) $response['body']); + }); $user = $this->client->call(Client::METHOD_PATCH, '/account/status', array_merge([ 'origin' => 'http://localhost', @@ -3234,7 +2604,7 @@ class SitesCustomServerTest extends Scope 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + $this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']); // Failure: Membership missing $email = \uniqid() . 'newuser@appwrite.io'; @@ -3274,7 +2644,7 @@ class SitesCustomServerTest extends Scope 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] ], followRedirects: false); $this->assertEquals(301, $response['headers']['status-code']); - $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + $this->assertStringContainsString('/console/auth/preview', (string) $response['headers']['location']); $this->cleanupSite($siteId); } @@ -3348,7 +2718,7 @@ class SitesCustomServerTest extends Scope }, 100000, 500); $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertStringContainsString('This page is empty, activate a deployment to make it live.', $response['body']); + $this->assertStringContainsString('This page is empty, activate a deployment to make it live.', (string) $response['body']); $this->cleanupSite($siteId); } @@ -3379,49 +2749,18 @@ class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($proxyClient) { $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString('Sub-directory index', $response['body']); + $this->assertStringContainsString('Sub-directory index', (string) $response['body']); }, 30000, 500); $this->assertEventually(function () use ($proxyClient) { $response1 = $proxyClient->call(Client::METHOD_GET, '/project1'); $this->assertEquals(200, $response1['headers']['status-code']); - $this->assertStringContainsString('Sub-directory project1', $response1['body']); + $this->assertStringContainsString('Sub-directory project1', (string) $response1['body']); }, 30000, 500); $response2 = $proxyClient->call(Client::METHOD_GET, '/project1/'); $this->assertEquals(200, $response2['headers']['status-code']); - $this->assertStringContainsString('Sub-directory project1', $response2['body']); - $this->cleanupSite($siteId); - } - - public function testDeploymentCommandEscaping(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'A site', - 'framework' => 'other', - 'adapter' => 'static', - 'buildRuntime' => 'static-1', - 'outputDirectory' => './', - 'buildCommand' => "echo 'Hello two'", - 'installCommand' => 'echo "Hello one"', - 'fallbackFile' => '', - ]); - - $this->assertNotEmpty($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('Hello one', $deployment['body']['buildLogs']); - $this->assertStringContainsString('Hello two', $deployment['body']['buildLogs']); - + $this->assertStringContainsString('Sub-directory project1', (string) $response2['body']); $this->cleanupSite($siteId); } @@ -3436,8 +2775,8 @@ class SitesCustomServerTest extends Scope $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString('Nothing is here yet', $response['body']); - $this->assertStringContainsString('Start with this domain', $response['body']); + $this->assertStringContainsString('Nothing is here yet', (string) $response['body']); + $this->assertStringContainsString('Start with this domain', (string) $response['body']); $siteId = $this->setupSite([ 'siteId' => ID::unique(), @@ -3489,20 +2828,20 @@ class SitesCustomServerTest extends Scope 'canceled' => 'Deployment build canceled', default => 'Deployment is still building', }; - $this->assertStringContainsString($expectedMessage, $response['body']); + $this->assertStringContainsString($expectedMessage, (string) $response['body']); $expectedCta = match ($status) { 'failed' => 'View logs', 'canceled' => 'View deployments', default => 'Reload', }; - $this->assertStringContainsString($expectedCta, $response['body']); + $this->assertStringContainsString($expectedCta, (string) $response['body']); // check site domain for no active deployments $proxyClient->setEndpoint('http://' . $domain); $response = $proxyClient->call(Client::METHOD_GET, '/'); $this->assertEquals(404, $response['headers']['status-code']); - $this->assertStringContainsString('No active deployments', $response['body']); - $this->assertStringContainsString('View deployments', $response['body']); + $this->assertStringContainsString('No active deployments', (string) $response['body']); + $this->assertStringContainsString('View deployments', (string) $response['body']); $deployment = $this->createDeployment($siteId, [ 'code' => $this->packageSite('static-single-file'), @@ -3524,9 +2863,9 @@ class SitesCustomServerTest extends Scope 'x-appwrite-key' => API_KEY_EPHEMERAL . '_' . $apiKey, ]); $this->assertEquals(400, $response['headers']['status-code']); - $this->assertStringContainsString("Deployment is still building", $response['body']); - $this->assertStringContainsString("View logs", $response['body']); - $this->assertStringContainsString("Reload", $response['body']); + $this->assertStringContainsString("Deployment is still building", (string) $response['body']); + $this->assertStringContainsString("View logs", (string) $response['body']); + $this->assertStringContainsString("Reload", (string) $response['body']); $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->getDeployment($siteId, $deploymentId); @@ -3539,8 +2878,8 @@ class SitesCustomServerTest extends Scope 'x-appwrite-key' => API_KEY_EPHEMERAL . '_' . $apiKey, ]); $this->assertEquals(400, $response['headers']['status-code']); - $this->assertStringContainsString("Deployment build failed", $response['body']); - $this->assertStringContainsString("View logs", $response['body']); + $this->assertStringContainsString("Deployment build failed", (string) $response['body']); + $this->assertStringContainsString("View logs", (string) $response['body']); $this->cleanupSite($siteId); } @@ -3575,264 +2914,12 @@ class SitesCustomServerTest extends Scope $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $this->assertStringContainsString('Error:', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $this->assertStringContainsString('Error:', (string) $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); }, 100000, 500); $this->cleanupSite($siteId); } - public function testOutputDirectoryEmpty(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Empty output directory', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './empty-directory', - 'buildCommand' => 'mkdir -p ./empty-directory' - ]); - $this->assertNotEmpty($siteId); - - $deployment = $this->createDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => true - ]); - $this->assertEquals(202, $deployment['headers']['status-code']); - - $deploymentId = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $this->assertStringContainsString('Error:', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $this->cleanupSite($siteId); - } - - public function testOutputDirectoryMissing(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Missing output directory', - 'framework' => 'other', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './non-existing-directory', - ]); - $this->assertNotEmpty($siteId); - - $deployment = $this->createDeployment($siteId, [ - 'code' => $this->packageSite('static-single-file'), - 'activate' => true - ]); - $this->assertEquals(202, $deployment['headers']['status-code']); - - $deploymentId = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - $this->assertStringContainsString('No such file or directory', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $this->cleanupSite($siteId); - } - - public function testBuildErrorLogs(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro SSR site', - 'framework' => 'astro', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'echo "custom error" && npm ci', - 'adapter' => 'ssr', - ]); - $this->assertNotEmpty($siteId); - - $site = $this->getSite($siteId); - $this->assertEquals('200', $site['headers']['status-code']); - - $domain = $this->setupSiteDomain($siteId); - $this->assertNotEmpty($domain); - - $deployment = $this->createDeployment($siteId, [ - 'code' => $this->packageSite('astro-static'), - 'activate' => true - ]); - $this->assertEquals(202, $deployment['headers']['status-code']); - - $deploymentId = $deployment['body']['$id']; - $this->assertNotEmpty($deploymentId); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status is failed, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); - - $deployment = $this->getDeployment($siteId, $deploymentId); - $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertStringContainsString('custom error', $deployment['body']['buildLogs']); - $this->assertStringContainsString('Adapter mismatch', $deployment['body']['buildLogs']); - - $this->cleanupSite($siteId); - } - - public function testCookieHeader() - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - - $this->assertNotEmpty($siteId); - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->getSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/cookies', [ - 'cookie' => 'custom-session-id=abcd123; custom-user-id=efgh456' - ]); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals("abcd123;efgh456", $response['body']); - $this->assertEquals("value-one", $response['cookies']['my-cookie-one']); - $this->assertEquals("value-two", $response['cookies']['my-cookie-two']); - - $this->cleanupSite($siteId); - } - - public function testSiteCustomStartCommand(): void - { - $siteId = $this->setupSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'startCommand' => 'node custom-server.js', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - ]); - - $this->assertNotEmpty($siteId); - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro-custom-start-command'), - 'activate' => 'true' - ]); - - $this->assertNotEmpty($deploymentId); - - $domain = $this->getSiteDomain($siteId); - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Homepage OK", $response['body']); - - $response = $proxyClient->call(Client::METHOD_GET, '/ssr'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("SSR OK", $response['body']); - $originalBody = $response['body']; - $response = $proxyClient->call(Client::METHOD_GET, '/ssr'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("SSR OK", $response['body']); - $this->assertNotEquals($originalBody, $response['body']); // Includes Date.now() - - $response = $proxyClient->call(Client::METHOD_GET, '/ssr-custom'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Custom SSR OK", $response['body']); - $originalBody = $response['body']; - $response = $proxyClient->call(Client::METHOD_GET, '/ssr-custom'); - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertStringContainsString("Custom SSR OK", $response['body']); - $this->assertNotEquals($originalBody, $response['body']); // Includes Date.now() - - $response = $proxyClient->call(Client::METHOD_GET, '/non-existing'); - $this->assertEquals(500, $response['headers']['status-code']); - $this->assertStringContainsString("Custom error", $response['body']); - - $this->cleanupSite($siteId); - } - - public function testSiteSpecifications() - { - // Check if the site specifications are correctly set in builds - $site = $this->createSite([ - 'siteId' => ID::unique(), - 'name' => 'Astro site', - 'framework' => 'astro', - 'adapter' => 'ssr', - 'buildRuntime' => 'node-22', - 'outputDirectory' => './dist', - 'buildCommand' => 'npm run build && echo $APPWRITE_SITE_MEMORY:$APPWRITE_SITE_CPUS', - 'installCommand' => 'npm ci', - 'fallbackFile' => '', - 'buildSpecification' => Specification::S_1VCPU_1GB, - 'runtimeSpecification' => Specification::S_05VCPU_512MB, - ]); - - $this->assertEquals(201, $site['headers']['status-code']); - $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['buildSpecification']); - $this->assertEquals(Specification::S_05VCPU_512MB, $site['body']['runtimeSpecification']); - $this->assertNotEmpty($site['body']['$id']); - - $siteId = $site['body']['$id'] ?? ''; - - $domain = $this->setupSiteDomain($siteId); - - $deploymentId = $this->setupDeployment($siteId, [ - 'code' => $this->packageSite('astro'), - 'activate' => true - ]); - - $this->assertEventually(function () use ($siteId, $deploymentId) { - $deployment = $this->getDeployment($siteId, $deploymentId); - // TODO: This assertion is not testing what we set in create function, because build worker currently overrides to minimal build specs - $this->assertStringContainsString('2048:1', $deployment['body']['buildLogs']); - }, 10000, 500); - - // Check if the sites specifications are correctly set in executions - $proxyClient = new Client(); - $proxyClient->setEndpoint('http://' . $domain); - - $response = $proxyClient->call(Client::METHOD_GET, '/specs'); - - $this->assertEquals(200, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']); - $this->assertEquals('512', $response['body']['APPWRITE_SITE_MEMORY']); - $this->assertEquals('0.5', $response['body']['APPWRITE_SITE_CPUS']); - - $this->cleanupSite($siteId); - } - public function testSiteDeploymentRetention(): void { $siteIds = []; diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index 375e526fcf..3f823c38e9 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -24,6 +24,38 @@ trait StorageBase */ private static array $cachedZstdBucket = []; + /** + * Valid signatures for a chunk-uploaded file: the content MD5 on local + * devices, or the composite multipart ETag (md5 of part MD5s suffixed + * with the part count) on S3 devices. + */ + protected function getChunkedFileSignatures(string $path, int $chunkSize = 5 * 1024 * 1024): array + { + $signatures = [\md5_file($path)]; + + $handle = \fopen($path, 'rb'); + if ($handle === false) { + return $signatures; + } + $binary = ''; + $parts = 0; + while (!\feof($handle)) { + $chunk = \fread($handle, $chunkSize); + if ($chunk === '' || $chunk === false) { + break; + } + $binary .= \md5($chunk, true); + $parts++; + } + \fclose($handle); + + if ($parts > 1) { + $signatures[] = \md5($binary) . '-' . $parts; + } + + return $signatures; + } + /** * Helper method to set up bucket and file data for tests. * Uses static caching to avoid recreating resources. @@ -287,7 +319,7 @@ trait StorageBase $this->assertEquals('large-file.mp4', $largeFile['body']['name']); $this->assertEquals('video/mp4', $largeFile['body']['mimeType']); $this->assertEquals($totalSize, $largeFile['body']['sizeOriginal']); - $this->assertEquals(md5_file(realpath(__DIR__ . '/../../../resources/disk-a/large-file.mp4')), $largeFile['body']['signature']); // should validate that the file is not encrypted + $this->assertContains($largeFile['body']['signature'], $this->getChunkedFileSignatures(realpath(__DIR__ . '/../../../resources/disk-a/large-file.mp4'))); // should validate that the file is not encrypted /** * Failure @@ -1016,7 +1048,20 @@ trait StorageBase $this->assertEquals(200, $cachedPreview['headers']['status-code']); $this->assertEquals('image/png', $cachedPreview['headers']['content-type']); $this->assertStringStartsWith('private, max-age=', $cachedPreview['headers']['cache-control']); - $this->assertEquals($preview['body'], $cachedPreview['body']); + $this->assertNotEmpty($cachedPreview['body']); + + $cachedPreviewAgain = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', + $headers, + $params + ); + + $this->assertEquals(200, $cachedPreviewAgain['headers']['status-code']); + $this->assertEquals('image/png', $cachedPreviewAgain['headers']['content-type']); + $this->assertStringStartsWith('private, max-age=', $cachedPreviewAgain['headers']['cache-control']); + $this->assertEquals('hit', $cachedPreviewAgain['headers']['x-appwrite-cache']); + $this->assertEquals($cachedPreview['body'], $cachedPreviewAgain['body']); } public function testFilePreviewZstdCompression(): void @@ -1289,6 +1334,100 @@ trait StorageBase $this->assertEquals(204, $deleteBucketResponse['headers']['status-code']); } + public function testCreateBucketFileChunkedUploadWithoutReadPermission(): void + { + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket Chunked Upload No Read Permission', + 'fileSecurity' => true, + 'permissions' => [ + Permission::create(Role::any()), + ], + ]); + + $this->assertEquals(201, $bucket['headers']['status-code']); + + $bucketId = $bucket['body']['$id']; + $source = __DIR__ . "/../../../resources/disk-a/large-file.mp4"; + $totalSize = \filesize($source); + $chunkSize = 5 * 1024 * 1024; + $mimeType = mime_content_type($source); + $fileId = ID::unique(); + $uploadedFileId = null; + $chunksTotal = (int) ceil($totalSize / $chunkSize); + + $this->assertGreaterThan($chunkSize, $totalSize, 'Test file must span at least 2 chunks'); + + try { + $handle = fopen($source, 'rb'); + $this->assertNotFalse($handle, "Could not open test resource: $source"); + + $permissions = [ + Permission::delete(Role::user($this->getUser()['$id'])), + ]; + $upload = null; + + for ($chunk = 0; $chunk < $chunksTotal; $chunk++) { + $start = $chunk * $chunkSize; + $chunkData = fread($handle, min($chunkSize, $totalSize - $start)); + $end = $start + strlen($chunkData) - 1; + + $headers = [ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-range' => 'bytes ' . $start . '-' . $end . '/' . $totalSize, + ]; + + if (!empty($uploadedFileId)) { + $headers['x-appwrite-id'] = $uploadedFileId; + } + + $upload = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge($headers, $this->getHeaders()), [ + 'fileId' => $fileId, + 'file' => new CURLFile('data://' . $mimeType . ';base64,' . base64_encode($chunkData), $mimeType, 'large-file.mp4'), + 'permissions' => $permissions, + ]); + + $this->assertEquals(201, $upload['headers']['status-code'], $upload['body']['message'] ?? ''); + $this->assertEquals($chunk + 1, $upload['body']['chunksUploaded']); + + $uploadedFileId ??= $upload['body']['$id']; + } + + fclose($handle); + + if ($upload === null) { + $this->fail('Expected at least one chunk upload response.'); + } + + $this->assertNotContains(Permission::read(Role::user($this->getUser()['$id'])), $upload['body']['$permissions']); + $this->assertEquals($chunksTotal, $upload['body']['chunksTotal']); + $this->assertEquals($chunksTotal, $upload['body']['chunksUploaded']); + } finally { + if (isset($handle) && \is_resource($handle)) { + fclose($handle); + } + + if (!empty($uploadedFileId)) { + $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $uploadedFileId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + } + + $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + } + } + public function testCreateBucketFileOutOfOrder(): void { // Create a bucket for this test diff --git a/tests/e2e/Services/Storage/StorageConsoleClientTest.php b/tests/e2e/Services/Storage/StorageConsoleClientTest.php index 2c39a12f09..aca2717170 100644 --- a/tests/e2e/Services/Storage/StorageConsoleClientTest.php +++ b/tests/e2e/Services/Storage/StorageConsoleClientTest.php @@ -1,5 +1,7 @@ '32h' ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); /** * Test for SUCCESS @@ -40,7 +44,7 @@ class StorageConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(7, count($response['body'])); + $this->assertCount(7, $response['body']); $this->assertEquals('24h', $response['body']['range']); $this->assertIsNumeric($response['body']['bucketsTotal']); $this->assertIsNumeric($response['body']['filesTotal']); @@ -99,7 +103,7 @@ class StorageConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(7, count($response['body'])); + $this->assertCount(7, $response['body']); $this->assertEquals('24h', $response['body']['range']); $this->assertIsNumeric($response['body']['filesTotal']); $this->assertIsNumeric($response['body']['filesStorageTotal']); @@ -196,4 +200,82 @@ class StorageConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(204, $response['headers']['status-code']); } + + public function testFilePreviewWithImpersonation(): void + { + $projectId = $this->getProject()['$id']; + $adminHeaders = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $targetId = ID::unique(); + $target = $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $targetId, + 'email' => 'impersonation-storage-target-' . $targetId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $actorId = ID::unique(); + $this->client->call(Client::METHOD_POST, '/users', $adminHeaders, [ + 'userId' => $actorId, + 'email' => 'impersonation-storage-actor-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Storage Actor', + ]); + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $adminHeaders, [ + 'impersonator' => true, + ]); + + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', $adminHeaders, [ + 'bucketId' => ID::unique(), + 'name' => 'Impersonation Test Bucket', + 'fileSecurity' => true, + 'permissions' => [ + Permission::read(Role::user($targetId)), + Permission::create(Role::any()), + ], + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge( + $adminHeaders, + ['content-type' => 'multipart/form-data'] + ), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::user($targetId)), + ], + ]); + $this->assertEquals(201, $file['headers']['status-code']); + $fileId = $file['body']['$id']; + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $adminHeaders); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $denied = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders); + $this->assertEquals(404, $denied['headers']['status-code']); + + $preview = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $preview['headers']['status-code']); + $this->assertEquals('image/png', $preview['headers']['content-type']); + $this->assertNotEmpty($preview['body']); + + $view = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $view['headers']['status-code']); + } } diff --git a/tests/e2e/Services/Storage/StorageCustomClientTest.php b/tests/e2e/Services/Storage/StorageCustomClientTest.php index 5d677021f1..7f188241b4 100644 --- a/tests/e2e/Services/Storage/StorageCustomClientTest.php +++ b/tests/e2e/Services/Storage/StorageCustomClientTest.php @@ -1,5 +1,7 @@ assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); @@ -200,7 +202,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file['body']['$id']; - $this->assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); @@ -286,7 +288,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file['body']['$id']; - $this->assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); @@ -338,7 +340,7 @@ class StorageCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', [ 'content-type' => 'multipart/form-data', @@ -348,7 +350,7 @@ class StorageCustomClientTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', @@ -357,14 +359,14 @@ class StorageCustomClientTest extends Scope 'permissions' => [], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); /** * Test for SUCCESS @@ -411,7 +413,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file['body']['$id']; - $this->assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); @@ -482,14 +484,14 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $email = ID::unique() . '@localhost.test'; $password = 'password'; @@ -501,7 +503,7 @@ class StorageCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $user2['session'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', [ 'content-type' => 'multipart/form-data', @@ -512,7 +514,7 @@ class StorageCustomClientTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', @@ -522,7 +524,7 @@ class StorageCustomClientTest extends Scope 'permissions' => [], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', @@ -530,7 +532,7 @@ class StorageCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $user2['session'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); /** * Test for SUCCESS @@ -589,7 +591,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file['body']['$id']; - $this->assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); @@ -682,7 +684,7 @@ class StorageCustomClientTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); // Team 2 update failure $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ @@ -693,7 +695,7 @@ class StorageCustomClientTest extends Scope 'permissions' => [], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); // Team 2 delete failure $file = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ @@ -702,7 +704,7 @@ class StorageCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $user2['session'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); /** * Test for SUCCESS @@ -751,7 +753,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file1['body']['$id']; - $this->assertEquals($file1['headers']['status-code'], 201); + $this->assertEquals(201, $file1['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file1['body']['$createdAt'])); $this->assertEquals('permissions.png', $file1['body']['name']); @@ -840,7 +842,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file1['body']['$id']; - $this->assertEquals($file1['headers']['status-code'], 201); + $this->assertEquals(201, $file1['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file1['body']['$createdAt'])); $this->assertEquals('permissions.png', $file1['body']['name']); @@ -929,7 +931,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file1['body']['$id']; - $this->assertEquals($file1['headers']['status-code'], 201); + $this->assertEquals(201, $file1['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file1['body']['$createdAt'])); $this->assertEquals('permissions.png', $file1['body']['name']); @@ -992,7 +994,7 @@ class StorageCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $user2['session'], ]); - $this->assertEquals($file['headers']['status-code'], 404); + $this->assertEquals(404, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', [ 'content-type' => 'multipart/form-data', @@ -1003,7 +1005,7 @@ class StorageCustomClientTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', @@ -1013,7 +1015,7 @@ class StorageCustomClientTest extends Scope 'permissions' => [], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); $file = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ 'content-type' => 'application/json', @@ -1021,7 +1023,7 @@ class StorageCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $user2['session'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); } public function testFileTeamPermissions(): void @@ -1068,7 +1070,7 @@ class StorageCustomClientTest extends Scope ]); $fileId = $file['body']['$id']; - $this->assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($fileId); $this->assertEquals(true, (new DatetimeValidator())->isValid($file['body']['$createdAt'])); $this->assertEquals('permissions.png', $file['body']['name']); @@ -1171,7 +1173,7 @@ class StorageCustomClientTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); // Team 2 update failure $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ @@ -1182,7 +1184,7 @@ class StorageCustomClientTest extends Scope 'permissions' => [], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); // Team 2 delete failure $file = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucketId . '/files/' . $fileId, [ @@ -1191,7 +1193,7 @@ class StorageCustomClientTest extends Scope 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $user2['session'], ]); - $this->assertEquals($file['headers']['status-code'], 401); + $this->assertEquals(401, $file['headers']['status-code']); /** * Test for SUCCESS @@ -1300,7 +1302,7 @@ class StorageCustomClientTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'), ]); - $this->assertEquals($file['headers']['status-code'], 201); + $this->assertEquals(201, $file['headers']['status-code']); $this->assertNotEmpty($file['body']['$id']); $this->assertContains(Permission::read(Role::user($this->getUser()['$id'])), $file['body']['$permissions']); $this->assertContains(Permission::update(Role::user($this->getUser()['$id'])), $file['body']['$permissions']); @@ -1332,9 +1334,9 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); $this->assertStringStartsWith('Permissions must be one of:', $file['body']['message']); - $this->assertStringContainsString('any', $file['body']['message']); - $this->assertStringContainsString('users', $file['body']['message']); - $this->assertStringContainsString('user:' . $this->getUser()['$id'], $file['body']['message']); + $this->assertStringContainsString('any', (string) $file['body']['message']); + $this->assertStringContainsString('users', (string) $file['body']['message']); + $this->assertStringContainsString('user:' . $this->getUser()['$id'], (string) $file['body']['message']); $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $data['bucketId'] . '/files', array_merge([ 'content-type' => 'multipart/form-data', @@ -1351,9 +1353,9 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); $this->assertStringStartsWith('Permissions must be one of:', $file['body']['message']); - $this->assertStringContainsString('any', $file['body']['message']); - $this->assertStringContainsString('users', $file['body']['message']); - $this->assertStringContainsString('user:' . $this->getUser()['$id'], $file['body']['message']); + $this->assertStringContainsString('any', (string) $file['body']['message']); + $this->assertStringContainsString('users', (string) $file['body']['message']); + $this->assertStringContainsString('user:' . $this->getUser()['$id'], (string) $file['body']['message']); $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $data['bucketId'] . '/files', array_merge([ 'content-type' => 'multipart/form-data', @@ -1371,9 +1373,9 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); $this->assertStringStartsWith('Permissions must be one of:', $file['body']['message']); - $this->assertStringContainsString('any', $file['body']['message']); - $this->assertStringContainsString('users', $file['body']['message']); - $this->assertStringContainsString('user:' . $this->getUser()['$id'], $file['body']['message']); + $this->assertStringContainsString('any', (string) $file['body']['message']); + $this->assertStringContainsString('users', (string) $file['body']['message']); + $this->assertStringContainsString('user:' . $this->getUser()['$id'], (string) $file['body']['message']); } public function testUpdateFileAbusePermissions(): void @@ -1393,9 +1395,9 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); $this->assertStringStartsWith('Permissions must be one of:', $file['body']['message']); - $this->assertStringContainsString('any', $file['body']['message']); - $this->assertStringContainsString('users', $file['body']['message']); - $this->assertStringContainsString('user:' . $this->getUser()['$id'], $file['body']['message']); + $this->assertStringContainsString('any', (string) $file['body']['message']); + $this->assertStringContainsString('users', (string) $file['body']['message']); + $this->assertStringContainsString('user:' . $this->getUser()['$id'], (string) $file['body']['message']); $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $data['bucketId'] . '/files/' . $data['fileId'], array_merge([ 'content-type' => 'application/json', @@ -1409,9 +1411,9 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); $this->assertStringStartsWith('Permissions must be one of:', $file['body']['message']); - $this->assertStringContainsString('any', $file['body']['message']); - $this->assertStringContainsString('users', $file['body']['message']); - $this->assertStringContainsString('user:' . $this->getUser()['$id'], $file['body']['message']); + $this->assertStringContainsString('any', (string) $file['body']['message']); + $this->assertStringContainsString('users', (string) $file['body']['message']); + $this->assertStringContainsString('user:' . $this->getUser()['$id'], (string) $file['body']['message']); $file = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $data['bucketId'] . '/files/' . $data['fileId'], array_merge([ 'content-type' => 'application/json', @@ -1426,9 +1428,9 @@ class StorageCustomClientTest extends Scope $this->assertEquals(401, $file['headers']['status-code']); $this->assertStringStartsWith('Permissions must be one of:', $file['body']['message']); - $this->assertStringContainsString('any', $file['body']['message']); - $this->assertStringContainsString('users', $file['body']['message']); - $this->assertStringContainsString('user:' . $this->getUser()['$id'], $file['body']['message']); + $this->assertStringContainsString('any', (string) $file['body']['message']); + $this->assertStringContainsString('users', (string) $file['body']['message']); + $this->assertStringContainsString('user:' . $this->getUser()['$id'], (string) $file['body']['message']); } public function testCreateBucketTransformationsDisabled(): void @@ -1481,7 +1483,7 @@ class StorageCustomClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ]); $this->assertEquals(403, $preview['headers']['status-code']); - $this->assertStringContainsString('Image transformations are disabled for the requested bucket.', $preview['body']['message']); + $this->assertStringContainsString('Image transformations are disabled for the requested bucket.', (string) $preview['body']['message']); // Delete the bucket $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucket['body']['$id'], [ @@ -1521,7 +1523,7 @@ class StorageCustomClientTest extends Scope ]); $this->assertSame(201, $file['headers']['status-code']); $this->assertSame('gzip', $file['body']['compression']); - $this->assertSame(true, $file['body']['encryption']); + $this->assertTrue($file['body']['encryption']); // Get file $file = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files/' . $file['body']['$id'], [ @@ -1530,7 +1532,7 @@ class StorageCustomClientTest extends Scope ]); $this->assertSame(200, $file['headers']['status-code']); $this->assertSame('gzip', $file['body']['compression']); - $this->assertSame(true, $file['body']['encryption']); + $this->assertTrue($file['body']['encryption']); // List files $files = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ @@ -1540,7 +1542,7 @@ class StorageCustomClientTest extends Scope $this->assertSame(200, $files['headers']['status-code']); $this->assertSame(1, $files['body']['total']); $this->assertSame('gzip', $files['body']['files'][0]['compression']); - $this->assertSame(true, $files['body']['files'][0]['encryption']); + $this->assertTrue($files['body']['files'][0]['encryption']); // Update the bucket $bucket = $this->client->call(Client::METHOD_PUT, '/storage/buckets/' . $bucket['body']['$id'], [ @@ -1560,7 +1562,7 @@ class StorageCustomClientTest extends Scope ]); $this->assertSame(200, $file['headers']['status-code']); $this->assertSame('gzip', $file['body']['compression']); - $this->assertSame(true, $file['body']['encryption']); + $this->assertTrue($file['body']['encryption']); // Create 2nd file $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ @@ -1573,7 +1575,7 @@ class StorageCustomClientTest extends Scope ]); $this->assertSame(201, $file['headers']['status-code']); $this->assertSame('none', $file['body']['compression']); - $this->assertSame(false, $file['body']['encryption']); + $this->assertFalse($file['body']['encryption']); // Get file $file = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files/' . $file['body']['$id'], [ @@ -1582,7 +1584,7 @@ class StorageCustomClientTest extends Scope ]); $this->assertSame(200, $file['headers']['status-code']); $this->assertSame('none', $file['body']['compression']); - $this->assertSame(false, $file['body']['encryption']); + $this->assertFalse($file['body']['encryption']); // List files $files = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucket['body']['$id'] . '/files', [ @@ -1592,9 +1594,9 @@ class StorageCustomClientTest extends Scope $this->assertSame(200, $files['headers']['status-code']); $this->assertSame(2, $files['body']['total']); $this->assertSame('none', $files['body']['files'][1]['compression']); - $this->assertSame(false, $files['body']['files'][1]['encryption']); + $this->assertFalse($files['body']['files'][1]['encryption']); $this->assertSame('gzip', $files['body']['files'][0]['compression']); - $this->assertSame(true, $files['body']['files'][0]['encryption']); + $this->assertTrue($files['body']['files'][0]['encryption']); // Delete the bucket $response = $this->client->call(Client::METHOD_DELETE, '/storage/buckets/' . $bucket['body']['$id'], [ diff --git a/tests/e2e/Services/Storage/StorageCustomServerTest.php b/tests/e2e/Services/Storage/StorageCustomServerTest.php index 4d3e2668f2..a779dce169 100644 --- a/tests/e2e/Services/Storage/StorageCustomServerTest.php +++ b/tests/e2e/Services/Storage/StorageCustomServerTest.php @@ -1,5 +1,7 @@

INJECTED

'; - $this->assertStringContainsString('

INJECTED

', $lastEmail['html']); - $this->assertStringContainsString($encoded, $lastEmail['html']); + $this->assertStringContainsString('

INJECTED

', (string) $lastEmail['html']); + $this->assertStringContainsString($encoded, (string) $lastEmail['html']); $response = $this->client->call(Client::METHOD_DELETE, '/teams/' . $teamUid . '/memberships/'.$response['body']['$id'], array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Teams/TeamsCustomServerTest.php b/tests/e2e/Services/Teams/TeamsCustomServerTest.php index 52f480c524..a9280703bb 100644 --- a/tests/e2e/Services/Teams/TeamsCustomServerTest.php +++ b/tests/e2e/Services/Teams/TeamsCustomServerTest.php @@ -1,5 +1,7 @@ '2022-11-02', ]); $this->assertEquals(400, $token['headers']['status-code']); - $this->assertStringContainsString('Value must be valid date in the future', $token['body']['message']); + $this->assertStringContainsString('Value must be valid date in the future', (string) $token['body']['message']); // Success cases: With & without expiry $expireList = [null, date('Y-m-d', strtotime("tomorrow"))]; @@ -183,7 +185,7 @@ class TokensConsoleClientTest extends Scope 'expire' => '2022-11-02', ]); $this->assertEquals(400, $token['headers']['status-code']); - $this->assertStringContainsString('Value must be valid date in the future', $token['body']['message']); + $this->assertStringContainsString('Value must be valid date in the future', (string) $token['body']['message']); // Finite expiry $expiry = date('Y-m-d', strtotime("tomorrow")); diff --git a/tests/e2e/Services/Tokens/TokensCustomClientTest.php b/tests/e2e/Services/Tokens/TokensCustomClientTest.php index a7a1fa48a5..2a8691ea62 100644 --- a/tests/e2e/Services/Tokens/TokensCustomClientTest.php +++ b/tests/e2e/Services/Tokens/TokensCustomClientTest.php @@ -1,12 +1,14 @@ '2022-11-02', ]); $this->assertEquals(400, $token['headers']['status-code']); - $this->assertStringContainsString('Value must be valid date in the future', $token['body']['message']); + $this->assertStringContainsString('Value must be valid date in the future', (string) $token['body']['message']); // Success case: No expire date $token = $this->client->call(Client::METHOD_POST, '/tokens/buckets/' . $bucketId . '/files/' . $fileId, array_merge([ @@ -151,7 +153,7 @@ class TokensCustomServerTest extends Scope 'expire' => '2022-11-02', ]); $this->assertEquals(400, $token['headers']['status-code']); - $this->assertStringContainsString('Value must be valid date in the future', $token['body']['message']); + $this->assertStringContainsString('Value must be valid date in the future', (string) $token['body']['message']); // Success case: Finite expiry $expiry = date('Y-m-d', strtotime("tomorrow")); diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index b06e2d88e1..eeadbfa925 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -337,6 +337,11 @@ trait UsersBase $this->assertEquals($body['status'], true); $this->assertGreaterThan('2000-01-01 00:00:00', $body['registration']); $this->assertEquals($body['labels'], []); + $this->assertEquals('cristiano.ronaldo@manchester-united.co.uk', $body['emailCanonical']); + $this->assertEquals(false, $body['emailIsFree']); + $this->assertEquals(false, $body['emailIsDisposable']); + $this->assertEquals(true, $body['emailIsCorporate']); + $this->assertEquals(true, $body['emailIsCanonical']); /** * Test Create with Custom ID for SUCCESS @@ -751,6 +756,11 @@ trait UsersBase } } $this->assertNotNull($user1, 'user1 should exist in user list'); + $this->assertArrayHasKey('emailCanonical', $user1); + $this->assertArrayHasKey('emailIsFree', $user1); + $this->assertArrayHasKey('emailIsDisposable', $user1); + $this->assertArrayHasKey('emailIsCorporate', $user1); + $this->assertArrayHasKey('emailIsCanonical', $user1); // This test ensures that by default, endpoints dont support select queries // If we add select query to this endpoint, you will need to remove this test @@ -1092,6 +1102,11 @@ trait UsersBase $this->assertNotEmpty($user['body']['email']); $this->assertEquals($user['body']['status'], true); $this->assertGreaterThan('2000-01-01 00:00:00', $user['body']['registration']); + $this->assertArrayHasKey('emailCanonical', $user['body']); + $this->assertArrayHasKey('emailIsFree', $user['body']); + $this->assertArrayHasKey('emailIsDisposable', $user['body']); + $this->assertArrayHasKey('emailIsCorporate', $user['body']); + $this->assertArrayHasKey('emailIsCanonical', $user['body']); $sessions = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/sessions', array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Users/UsersConsoleClientTest.php b/tests/e2e/Services/Users/UsersConsoleClientTest.php index 24e0f6868b..373b941fb4 100644 --- a/tests/e2e/Services/Users/UsersConsoleClientTest.php +++ b/tests/e2e/Services/Users/UsersConsoleClientTest.php @@ -1,5 +1,7 @@ '32h', ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); /** * Test for SUCCESS @@ -39,7 +41,7 @@ class UsersConsoleClientTest extends Scope ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(5, count($response['body'])); + $this->assertCount(5, $response['body']); $this->assertEquals('24h', $response['body']['range']); $this->assertIsNumeric($response['body']['usersTotal']); $this->assertIsNumeric($response['body']['sessionsTotal']); @@ -81,4 +83,87 @@ class UsersConsoleClientTest extends Scope $this->assertEquals($userId, $set['body']['$id']); $this->assertNotEmpty($set['body']['password']); } + + public function testImpersonateQueryParams(): void + { + $projectId = $this->getProject()['$id']; + $headers = array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()); + + $actorId = ID::unique(); + $actor = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $actorId, + 'email' => 'impersonator-queryparam-' . $actorId . '@example.com', + 'password' => 'password123', + 'name' => 'Impersonator', + ]); + $this->assertEquals(201, $actor['headers']['status-code']); + + $targetId = ID::unique(); + $targetEmail = 'target-queryparam-' . $targetId . '@example.com'; + $targetPhone = '+1' . rand(2000000000, 2999999999); + + $target = $this->client->call(Client::METHOD_POST, '/users', $headers, [ + 'userId' => $targetId, + 'email' => $targetEmail, + 'password' => 'password123', + 'name' => 'Target', + ]); + $this->assertEquals(201, $target['headers']['status-code']); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $targetId . '/phone', $headers, [ + 'number' => $targetPhone, + ]); + + $this->client->call(Client::METHOD_PATCH, '/users/' . $actorId . '/impersonator', $headers, [ + 'impersonator' => true, + ]); + + $session = $this->client->call(Client::METHOD_POST, '/users/' . $actorId . '/sessions', $headers); + $this->assertEquals(201, $session['headers']['status-code']); + + $sessionHeaders = [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-session' => $session['body']['secret'], + ]; + + $byHeader = $this->client->call(Client::METHOD_GET, '/account', array_merge($sessionHeaders, [ + 'x-appwrite-impersonate-user-id' => $targetId, + ])); + $this->assertEquals(200, $byHeader['headers']['status-code']); + $this->assertEquals($targetId, $byHeader['body']['$id']); + $this->assertEquals($actorId, $byHeader['body']['impersonatorUserId']); + + $byUserId = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateuserid' => $targetId, + ]); + $this->assertEquals(200, $byUserId['headers']['status-code']); + $this->assertEquals($targetId, $byUserId['body']['$id']); + + $byEmail = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonateemail' => $targetEmail, + ]); + $this->assertEquals(200, $byEmail['headers']['status-code']); + $this->assertEquals($targetId, $byEmail['body']['$id']); + + $byPhone = $this->client->call(Client::METHOD_GET, '/account', $sessionHeaders, [ + 'impersonatephone' => $targetPhone, + ]); + $this->assertEquals(200, $byPhone['headers']['status-code']); + $this->assertEquals($targetId, $byPhone['body']['$id']); + + // header takes priority over query param + $priority = $this->client->call( + Client::METHOD_GET, + '/account', + array_merge($sessionHeaders, ['x-appwrite-impersonate-user-id' => $targetId]), + ['impersonateuserid' => $actorId] + ); + $this->assertEquals(200, $priority['headers']['status-code']); + $this->assertEquals($targetId, $priority['body']['$id']); + } } diff --git a/tests/e2e/Services/Users/UsersCustomServerTest.php b/tests/e2e/Services/Users/UsersCustomServerTest.php index 2442f1bf7d..0762bbef5c 100644 --- a/tests/e2e/Services/Users/UsersCustomServerTest.php +++ b/tests/e2e/Services/Users/UsersCustomServerTest.php @@ -1,12 +1,14 @@ assertEquals(200, $runtime['headers']['status-code']); - $this->assertEquals($runtime['body']['runtime'], 'ruby-3.3'); - $this->assertEquals($runtime['body']['commands'], 'bundle install && bundle exec rake build'); - $this->assertEquals($runtime['body']['entrypoint'], 'main.rb'); + $this->assertEquals('ruby-3.3', $runtime['body']['runtime']); + $this->assertEquals('bundle install && bundle exec rake build', $runtime['body']['commands']); + $this->assertEquals('main.rb', $runtime['body']['entrypoint']); /** * Test for FAILURE @@ -179,10 +181,10 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $framework['headers']['status-code']); - $this->assertEquals($framework['body']['framework'], 'sveltekit'); - $this->assertEquals($framework['body']['installCommand'], 'npm install'); - $this->assertEquals($framework['body']['buildCommand'], 'npm run build'); - $this->assertEquals($framework['body']['outputDirectory'], './build'); + $this->assertEquals('sveltekit', $framework['body']['framework']); + $this->assertEquals('npm install', $framework['body']['installCommand']); + $this->assertEquals('npm run build', $framework['body']['buildCommand']); + $this->assertEquals('./build', $framework['body']['outputDirectory']); $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -194,10 +196,10 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $framework['headers']['status-code']); - $this->assertEquals($framework['body']['framework'], 'astro'); - $this->assertEquals($framework['body']['installCommand'], 'npm install'); - $this->assertEquals($framework['body']['buildCommand'], 'npm run build'); - $this->assertEquals($framework['body']['outputDirectory'], './dist'); + $this->assertEquals('astro', $framework['body']['framework']); + $this->assertEquals('npm install', $framework['body']['installCommand']); + $this->assertEquals('npm run build', $framework['body']['buildCommand']); + $this->assertEquals('./dist', $framework['body']['outputDirectory']); $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -209,10 +211,10 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $framework['headers']['status-code']); - $this->assertEquals($framework['body']['framework'], 'remix'); - $this->assertEquals($framework['body']['installCommand'], 'npm install'); - $this->assertEquals($framework['body']['buildCommand'], 'npm run build'); - $this->assertEquals($framework['body']['outputDirectory'], './build'); + $this->assertEquals('remix', $framework['body']['framework']); + $this->assertEquals('npm install', $framework['body']['installCommand']); + $this->assertEquals('npm run build', $framework['body']['buildCommand']); + $this->assertEquals('./build', $framework['body']['outputDirectory']); /** * Test for FAILURE @@ -315,11 +317,11 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositories['headers']['status-code']); - $this->assertEquals($repositories['body']['total'], 4); - $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['name'], 'starter-for-svelte'); - $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['organization'], 'appwrite-test'); - $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['provider'], 'github'); - $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['runtime'], 'node-22'); + $this->assertEquals(4, $repositories['body']['total']); + $this->assertEquals('starter-for-svelte', $repositories['body']['runtimeProviderRepositories'][0]['name']); + $this->assertEquals('appwrite-test', $repositories['body']['runtimeProviderRepositories'][0]['organization']); + $this->assertEquals('github', $repositories['body']['runtimeProviderRepositories'][0]['provider']); + $this->assertEquals('node-22', $repositories['body']['runtimeProviderRepositories'][0]['runtime']); $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -328,9 +330,9 @@ class VCSConsoleClientTest extends Scope 'type' => 'runtime' ]); $this->assertEquals(200, $searchedRepositories['headers']['status-code']); - $this->assertEquals($searchedRepositories['body']['total'], 1); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'function1.4'); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'node-2'); + $this->assertEquals(1, $searchedRepositories['body']['total']); + $this->assertEquals('function1.4', $searchedRepositories['body']['runtimeProviderRepositories'][0]['name']); + $this->assertEquals('node-2', $searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime']); $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -339,9 +341,9 @@ class VCSConsoleClientTest extends Scope 'type' => 'runtime' ]); $this->assertEquals(200, $searchedRepositories['headers']['status-code']); - $this->assertEquals($searchedRepositories['body']['total'], 1); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'appwrite'); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'php-8.3'); + $this->assertEquals(1, $searchedRepositories['body']['total']); + $this->assertEquals('appwrite', $searchedRepositories['body']['runtimeProviderRepositories'][0]['name']); + $this->assertEquals('php-8.3', $searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime']); $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -350,9 +352,9 @@ class VCSConsoleClientTest extends Scope 'type' => 'runtime' ]); $this->assertEquals(200, $searchedRepositories['headers']['status-code']); - $this->assertEquals($searchedRepositories['body']['total'], 1); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'ruby-starter'); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'ruby-3.3'); + $this->assertEquals(1, $searchedRepositories['body']['total']); + $this->assertEquals('ruby-starter', $searchedRepositories['body']['runtimeProviderRepositories'][0]['name']); + $this->assertEquals('ruby-3.3', $searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime']); $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -361,11 +363,11 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositories['headers']['status-code']); - $this->assertEquals($repositories['body']['total'], 4); - $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['name'], 'starter-for-svelte'); - $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['organization'], 'appwrite-test'); - $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['provider'], 'github'); - $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['framework'], 'sveltekit'); + $this->assertEquals(4, $repositories['body']['total']); + $this->assertEquals('starter-for-svelte', $repositories['body']['frameworkProviderRepositories'][0]['name']); + $this->assertEquals('appwrite-test', $repositories['body']['frameworkProviderRepositories'][0]['organization']); + $this->assertEquals('github', $repositories['body']['frameworkProviderRepositories'][0]['provider']); + $this->assertEquals('sveltekit', $repositories['body']['frameworkProviderRepositories'][0]['framework']); $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -374,9 +376,9 @@ class VCSConsoleClientTest extends Scope 'type' => 'runtime' ]); $this->assertEquals(200, $searchedRepositories['headers']['status-code']); - $this->assertEquals($searchedRepositories['body']['total'], 1); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'appwrite'); - $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'other'); + $this->assertEquals(1, $searchedRepositories['body']['total']); + $this->assertEquals('appwrite', $searchedRepositories['body']['runtimeProviderRepositories'][0]['name']); + $this->assertEquals('other', $searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime']); // with limit and offset $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ @@ -456,7 +458,7 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositories['headers']['status-code']); - $this->assertEquals($repositories['body']['total'], 0); + $this->assertEquals(0, $repositories['body']['total']); } public function testGetRepository(): void @@ -472,18 +474,18 @@ class VCSConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $repository['headers']['status-code']); - $this->assertEquals($repository['body']['name'], 'ruby-starter'); - $this->assertEquals($repository['body']['organization'], 'appwrite-test'); - $this->assertEquals($repository['body']['private'], false); + $this->assertEquals('ruby-starter', $repository['body']['name']); + $this->assertEquals('appwrite-test', $repository['body']['organization']); + $this->assertEquals(false, $repository['body']['private']); $repository = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId2, array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); $this->assertEquals(200, $repository['headers']['status-code']); - $this->assertEquals($repository['body']['name'], 'function1.4'); - $this->assertEquals($repository['body']['organization'], 'appwrite-test'); - $this->assertEquals($repository['body']['private'], true); + $this->assertEquals('function1.4', $repository['body']['name']); + $this->assertEquals('appwrite-test', $repository['body']['organization']); + $this->assertEquals(true, $repository['body']['private']); /** * Test for FAILURE @@ -509,9 +511,9 @@ class VCSConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $repositoryBranches['headers']['status-code']); - $this->assertEquals($repositoryBranches['body']['total'], 2); - $this->assertEquals($repositoryBranches['body']['branches'][0]['name'], 'main'); - $this->assertEquals($repositoryBranches['body']['branches'][1]['name'], 'test'); + $this->assertEquals(2, $repositoryBranches['body']['total']); + $this->assertEquals('main', $repositoryBranches['body']['branches'][0]['name']); + $this->assertEquals('test', $repositoryBranches['body']['branches'][1]['name']); $repositoryBranches = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/branches', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -520,9 +522,9 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositoryBranches['headers']['status-code']); - $this->assertEquals($repositoryBranches['body']['total'], 1); + $this->assertEquals(1, $repositoryBranches['body']['total']); $this->assertCount(1, $repositoryBranches['body']['branches']); - $this->assertEquals($repositoryBranches['body']['branches'][0]['name'], 'test'); + $this->assertEquals('test', $repositoryBranches['body']['branches'][0]['name']); $repositoryBranches = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/branches', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -534,9 +536,9 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositoryBranches['headers']['status-code']); - $this->assertEquals($repositoryBranches['body']['total'], 2); + $this->assertEquals(2, $repositoryBranches['body']['total']); $this->assertCount(1, $repositoryBranches['body']['branches']); - $this->assertEquals($repositoryBranches['body']['branches'][0]['name'], 'test'); + $this->assertEquals('test', $repositoryBranches['body']['branches'][0]['name']); $repositoryBranches = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/branches', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -548,9 +550,9 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositoryBranches['headers']['status-code']); - $this->assertEquals($repositoryBranches['body']['total'], 2); + $this->assertEquals(2, $repositoryBranches['body']['total']); $this->assertCount(1, $repositoryBranches['body']['branches']); - $this->assertEquals($repositoryBranches['body']['branches'][0]['name'], 'test'); + $this->assertEquals('test', $repositoryBranches['body']['branches'][0]['name']); $repositoryBranches = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/branches', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], @@ -562,9 +564,9 @@ class VCSConsoleClientTest extends Scope ]); $this->assertEquals(200, $repositoryBranches['headers']['status-code']); - $this->assertEquals($repositoryBranches['body']['total'], 2); + $this->assertEquals(2, $repositoryBranches['body']['total']); $this->assertCount(1, $repositoryBranches['body']['branches']); - $this->assertEquals($repositoryBranches['body']['branches'][0]['name'], 'main'); + $this->assertEquals('main', $repositoryBranches['body']['branches'][0]['name']); /** * Test for FAILURE @@ -651,6 +653,68 @@ class VCSConsoleClientTest extends Scope $this->assertEquals('main', $function['body']['providerBranch']); } + public function testUpdateFunctionOmitProviderRepositoryIdPreservesVcs(): void + { + $data = $this->setupFunctionUsingVCS(); + + // Omit providerRepositoryId entirely — should preserve VCS connection, not clear it + $function = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Test', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'timeout' => 10, + ]); + + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertNotEmpty($function['body']['providerRepositoryId']); + $this->assertNotEmpty($function['body']['installationId']); + $this->assertNotEmpty($function['body']['providerBranch']); + } + + public function testUpdateSiteOmitProviderRepositoryIdPreservesVcs(): void + { + $installationId = $this->setupInstallation(); + + $site = $this->client->call(Client::METHOD_POST, '/sites', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'siteId' => ID::unique(), + 'name' => 'Test Site VCS', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'installationId' => $installationId, + 'providerRepositoryId' => $this->providerRepositoryId3, + 'providerBranch' => 'main', + ]); + + $this->assertEquals(201, $site['headers']['status-code']); + $siteId = $site['body']['$id']; + + // Omit providerRepositoryId — should preserve VCS connection, not clear it + $updated = $this->client->call(Client::METHOD_PUT, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Test Site VCS', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + ]); + + $this->assertEquals(200, $updated['headers']['status-code']); + $this->assertNotEmpty($updated['body']['providerRepositoryId']); + $this->assertNotEmpty($updated['body']['installationId']); + $this->assertNotEmpty($updated['body']['providerBranch']); + + $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + } + public function testCreateRepository(): void { $installationId = $this->setupInstallation(); @@ -696,6 +760,6 @@ class VCSConsoleClientTest extends Scope */ $result = $github->deleteRepository('appwrite-test', 'test-repo-1'); - $this->assertEquals($result, true); + $this->assertTrue($result); } } diff --git a/tests/e2e/Services/VCS/VCSCustomClientTest.php b/tests/e2e/Services/VCS/VCSCustomClientTest.php index 26ccc45990..3cab589b36 100644 --- a/tests/e2e/Services/VCS/VCSCustomClientTest.php +++ b/tests/e2e/Services/VCS/VCSCustomClientTest.php @@ -1,5 +1,7 @@ =22.0.0" + "node": ">=22.12.0" } }, "node_modules/@astrojs/telemetry": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", - "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz", + "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==", "license": "MIT", "dependencies": { - "ci-info": "^4.2.0", - "debug": "^4.4.0", - "dlv": "^1.1.3", + "ci-info": "^4.4.0", "dset": "^3.1.4", - "is-docker": "^3.0.0", - "is-wsl": "^3.1.0", + "is-docker": "^4.0.0", + "is-wsl": "^3.1.1", "which-pm-runs": "^1.1.0" }, "engines": { @@ -99,30 +103,30 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", - "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.28.5" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -132,13 +136,13 @@ } }, "node_modules/@babel/types": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", - "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -156,10 +160,38 @@ "node": ">=18" } }, + "node_modules/@clack/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.1.tgz", + "integrity": "sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==", + "license": "MIT", + "dependencies": { + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, + "node_modules/@clack/prompts": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.5.1.tgz", + "integrity": "sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==", + "license": "MIT", + "dependencies": { + "@clack/core": "1.4.1", + "fast-string-width": "^3.0.2", + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, "node_modules/@emnapi/runtime": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", - "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.0.tgz", + "integrity": "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg==", "license": "MIT", "optional": true, "dependencies": { @@ -167,9 +199,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -183,9 +215,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -199,9 +231,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -215,9 +247,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -231,9 +263,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -247,9 +279,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -263,9 +295,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -279,9 +311,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -295,9 +327,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -311,9 +343,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -327,9 +359,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -343,9 +375,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -359,9 +391,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -375,9 +407,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -391,9 +423,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -407,9 +439,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -423,9 +455,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -439,9 +471,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -455,9 +487,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -471,9 +503,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -487,9 +519,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -503,9 +535,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -519,9 +551,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -535,9 +567,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -551,9 +583,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -567,9 +599,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -583,9 +615,9 @@ } }, "node_modules/@img/colour": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.0.0.tgz", - "integrity": "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", "license": "MIT", "optional": true, "engines": { @@ -675,6 +707,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -691,6 +726,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -707,6 +745,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -723,6 +764,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -739,6 +783,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -755,6 +802,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -771,6 +821,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -787,6 +840,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -803,6 +859,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -825,6 +884,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -847,6 +909,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -869,6 +934,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -891,6 +959,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -913,6 +984,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -935,6 +1009,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -957,6 +1034,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1061,9 +1141,9 @@ "license": "MIT" }, "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", @@ -1082,16 +1162,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1102,9 +1176,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1115,9 +1189,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1128,9 +1202,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1141,9 +1215,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1154,9 +1228,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1167,12 +1241,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1180,12 +1257,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1193,12 +1273,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1206,12 +1289,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1219,12 +1305,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1232,12 +1321,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1245,12 +1337,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1258,12 +1353,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1271,12 +1369,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1284,12 +1385,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1297,12 +1401,15 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1310,12 +1417,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1323,12 +1433,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1336,9 +1449,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1349,9 +1462,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1362,9 +1475,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1375,9 +1488,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1388,9 +1501,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1401,9 +1514,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1414,64 +1527,97 @@ ] }, "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz", + "integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/primitive": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz", + "integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz", + "integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz", + "integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz", + "integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.2.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz", + "integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz", + "integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/vscode-textmate": { @@ -1481,18 +1627,18 @@ "license": "MIT" }, "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, "node_modules/@types/hast": { @@ -1535,97 +1681,11 @@ "license": "MIT" }, "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", "license": "ISC" }, - "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "license": "ISC", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1640,9 +1700,9 @@ } }, "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -1677,80 +1737,72 @@ } }, "node_modules/astro": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.18.0.tgz", - "integrity": "sha512-CHiohwJIS4L0G6/IzE1Fx3dgWqXBCXus/od0eGUfxrZJD2um2pE7ehclMmgL/fXqbU7NfE1Ze2pq34h2QaA6iQ==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-6.4.4.tgz", + "integrity": "sha512-hVe8tq3lqt/Dr0UyB//yUmQSlHMTU8scTiF/vQddQVahLE4TTaSdH5H0nb7OvRcwo0UmlAO8DWYar4jNaS7H+A==", "license": "MIT", "dependencies": { - "@astrojs/compiler": "^2.13.0", - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/markdown-remark": "6.3.10", - "@astrojs/telemetry": "3.3.0", + "@astrojs/compiler": "^4.0.0", + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/markdown-remark": "7.2.0", + "@astrojs/telemetry": "3.3.2", "@capsizecss/unpack": "^4.0.0", + "@clack/prompts": "^1.1.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", - "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", - "boxen": "8.0.1", - "ci-info": "^4.3.1", + "ci-info": "^4.4.0", "clsx": "^2.1.1", - "common-ancestor-path": "^1.0.1", + "common-ancestor-path": "^2.0.0", "cookie": "^1.1.1", - "cssesc": "^3.0.0", - "debug": "^4.4.3", - "deterministic-object-hash": "^2.0.2", - "devalue": "^5.6.2", + "devalue": "^5.8.1", "diff": "^8.0.3", - "dlv": "^1.1.3", "dset": "^3.1.4", - "es-module-lexer": "^1.7.0", + "es-module-lexer": "^2.0.0", "esbuild": "^0.27.3", - "estree-walker": "^3.0.3", "flattie": "^1.1.1", - "fontace": "~0.4.0", + "fontace": "~0.4.1", + "get-tsconfig": "5.0.0-beta.4", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", + "jsonc-parser": "^3.3.1", "magic-string": "^0.30.21", - "magicast": "^0.5.1", + "magicast": "^0.5.2", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", - "p-limit": "^6.2.0", - "p-queue": "^8.1.1", + "obug": "^2.1.1", + "p-limit": "^7.3.0", + "p-queue": "^9.1.0", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.3", - "prompts": "^2.4.2", + "picomatch": "^4.0.4", "rehype": "^13.0.2", - "semver": "^7.7.3", - "shiki": "^3.21.0", + "semver": "^7.7.4", + "shiki": "^4.0.2", "smol-toml": "^1.6.0", - "svgo": "^4.0.0", - "tinyexec": "^1.0.2", + "svgo": "^4.0.1", + "tinyclip": "^0.1.12", + "tinyexec": "^1.0.4", "tinyglobby": "^0.2.15", - "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.7.3", - "unist-util-visit": "^5.0.0", - "unstorage": "^1.17.4", + "unifont": "~0.7.4", + "unist-util-visit": "^5.1.0", + "unstorage": "^1.17.5", "vfile": "^6.0.3", - "vite": "^6.4.1", - "vitefu": "^1.1.1", + "vite": "^7.3.2", + "vitefu": "^1.1.2", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.2.3", - "zod": "^3.25.76", - "zod-to-json-schema": "^3.25.1", - "zod-to-ts": "^1.2.0" + "yargs-parser": "^22.0.0", + "zod": "^4.3.6" }, "bin": { - "astro": "astro.js" + "astro": "bin/astro.mjs" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "node": ">=22.12.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -1762,463 +1814,6 @@ "sharp": "^0.34.0" } }, - "node_modules/astro/node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/astro/node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" - } - }, "node_modules/axobject-query": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", @@ -2238,52 +1833,12 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, - "node_modules/boxen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", - "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", - "license": "MIT", - "dependencies": { - "ansi-align": "^3.0.1", - "camelcase": "^8.0.0", - "chalk": "^5.3.0", - "cli-boxes": "^3.0.0", - "string-width": "^7.2.0", - "type-fest": "^4.21.0", - "widest-line": "^5.0.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", - "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -2294,18 +1849,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -2352,9 +1895,9 @@ } }, "node_modules/ci-info": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.3.1.tgz", - "integrity": "sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz", + "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==", "funding": [ { "type": "github", @@ -2366,18 +1909,6 @@ "node": ">=8" } }, - "node_modules/cli-boxes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", - "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -2407,10 +1938,13 @@ } }, "node_modules/common-ancestor-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", - "license": "ISC" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">= 18" + } }, "node_modules/cookie": { "version": "1.1.1", @@ -2426,9 +1960,9 @@ } }, "node_modules/cookie-es": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", - "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", + "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", "license": "MIT" }, "node_modules/crossws": { @@ -2457,13 +1991,13 @@ } }, "node_modules/css-tree": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.1.0.tgz", - "integrity": "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", "license": "MIT", "dependencies": { - "mdn-data": "2.12.2", - "source-map-js": "^1.0.1" + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" @@ -2481,18 +2015,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csso": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", @@ -2544,9 +2066,9 @@ } }, "node_modules/decode-named-character-reference": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", - "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", "license": "MIT", "dependencies": { "character-entities": "^2.0.0" @@ -2557,9 +2079,9 @@ } }, "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "license": "MIT" }, "node_modules/depd": { @@ -2596,22 +2118,10 @@ "node": ">=8" } }, - "node_modules/deterministic-object-hash": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", - "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", - "license": "MIT", - "dependencies": { - "base-64": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/devlop": { @@ -2628,20 +2138,14 @@ } }, "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "license": "MIT" - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -2724,12 +2228,6 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, - "node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "license": "MIT" - }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -2752,15 +2250,15 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "license": "MIT" }, "node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2770,32 +2268,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escape-html": { @@ -2817,13 +2315,10 @@ } }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", @@ -2835,9 +2330,9 @@ } }, "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", "license": "MIT" }, "node_modules/extend": { @@ -2846,6 +2341,30 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2916,16 +2435,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-east-asian-width": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", - "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", + "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "engines": { - "node": ">=18" + "node": ">=20.20.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/github-slugger": { @@ -2935,14 +2457,14 @@ "license": "ISC" }, "node_modules/h3": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.6.tgz", - "integrity": "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", + "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", "license": "MIT", "dependencies": { - "cookie-es": "^1.2.2", + "cookie-es": "^1.2.3", "crossws": "^0.3.5", - "defu": "^6.1.4", + "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", @@ -3170,16 +2692,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/import-meta-resolve": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", - "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -3196,29 +2708,20 @@ } }, "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", + "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -3237,6 +2740,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -3250,9 +2768,9 @@ } }, "node_modules/is-wsl": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", - "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz", + "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==", "license": "MIT", "dependencies": { "is-inside-container": "^1.0.0" @@ -3265,9 +2783,19 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -3276,14 +2804,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "license": "MIT" }, "node_modules/longest-streak": { "version": "3.1.0", @@ -3296,9 +2821,9 @@ } }, "node_modules/lru-cache": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", - "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -3314,13 +2839,13 @@ } }, "node_modules/magicast": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.1.tgz", - "integrity": "sha512-xrHS24IxaLrvuo613F719wvOIv9xPHFWQHuvGUBmPnCA/3MQxKI3b+r7n1jAoDHmsbC5bRhTZYR77invLAxVnw==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.28.5", - "@babel/types": "^7.28.5", + "@babel/parser": "^7.29.3", + "@babel/types": "^7.29.0", "source-map-js": "^1.2.1" } }, @@ -3366,9 +2891,9 @@ } }, "node_modules/mdast-util-from-markdown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", - "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.3.tgz", + "integrity": "sha512-W4mAWTvSlKvf8L6J+VN9yLSqQ9AOAAvHuoDAmPkz4dHf553m5gVj2ejadHJhoJmcmxEnOv6Pa8XJhpxE93kb8Q==", "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", @@ -3560,9 +3085,9 @@ } }, "node_modules/mdn-data": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.12.2.tgz", - "integrity": "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==", + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", "license": "CC0-1.0" }, "node_modules/micromark": { @@ -4169,9 +3694,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "funding": [ { "type": "github", @@ -4241,6 +3766,19 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/ofetch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", @@ -4271,60 +3809,60 @@ } }, "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "node_modules/p-limit": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", - "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", + "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.1.1" + "yocto-queue": "^1.2.1" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-queue": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", - "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz", + "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==", "license": "MIT", "dependencies": { - "eventemitter3": "^5.0.1", - "p-timeout": "^6.1.2" + "eventemitter3": "^5.0.4", + "p-timeout": "^7.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-timeout": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", - "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", + "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", "license": "MIT", "engines": { - "node": ">=14.16" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4379,9 +3917,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" @@ -4391,9 +3929,9 @@ } }, "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "funding": [ { "type": "opencollective", @@ -4410,7 +3948,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -4427,23 +3965,10 @@ "node": ">=6" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", "license": "MIT", "funding": { "type": "github", @@ -4644,6 +4169,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/retext": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", @@ -4706,12 +4240,12 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4721,47 +4255,47 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, "node_modules/sax": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", - "integrity": "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" } }, "node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.3.tgz", + "integrity": "sha512-wnilbGyMxzbY7dNOl7jpKbLSjcfeweJWU5j4+u5qW+6/wuGD9KzIGOyZnQVSBM9E7DtWaaH3CyHkppYrKYoxwg==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4854,19 +4388,22 @@ } }, "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz", + "integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==", "license": "MIT", "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", + "@shikijs/core": "4.2.0", + "@shikijs/engine-javascript": "4.2.0", + "@shikijs/engine-oniguruma": "4.2.0", + "@shikijs/langs": "4.2.0", + "@shikijs/themes": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/sisteransi": { @@ -4876,9 +4413,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.0.tgz", - "integrity": "sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz", + "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -4915,23 +4452,6 @@ "node": ">= 0.8" } }, - "node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4946,21 +4466,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", @@ -4992,23 +4497,32 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "license": "MIT" }, + "node_modules/tinyclip": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.14.tgz", + "integrity": "sha512-F1oWdz8tjT17qe1d5JgDK6z03WGOhYYAN0lK3/D/fzNiy93xswLLEw7pk+3g05onhAy6Bsc6PLNUGhdgVjemMQ==", + "license": "MIT", + "engines": { + "node": "^16.14.0 || >= 17.3.0" + } + }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -5046,26 +4560,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -5073,36 +4567,10 @@ "license": "0BSD", "optional": true }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/ultrahtml": { @@ -5229,9 +4697,9 @@ } }, "node_modules/unist-util-visit": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", - "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.1.0.tgz", + "integrity": "sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==", "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", @@ -5271,16 +4739,16 @@ } }, "node_modules/unstorage": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.4.tgz", - "integrity": "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", + "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.5", - "lru-cache": "^11.2.0", + "h3": "^1.15.10", + "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" @@ -5409,23 +4877,23 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -5434,14 +4902,14 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", - "less": "*", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -5483,9 +4951,9 @@ } }, "node_modules/vitefu": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.1.tgz", - "integrity": "sha512-B/Fegf3i8zh0yFbpzZ21amWzHmuNlLlmJT6n7bu5e+pCHUKQIfXSYokrqOBGEMMe9UG2sostKQF9mml/vYaWJQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", "license": "MIT", "workspaces": [ "tests/deps/*", @@ -5493,7 +4961,7 @@ "tests/projects/workspace/packages/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "vite": { @@ -5520,38 +4988,6 @@ "node": ">=4" } }, - "node_modules/widest-line": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", - "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", - "license": "MIT", - "dependencies": { - "string-width": "^7.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/xxhash-wasm": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", @@ -5559,12 +4995,12 @@ "license": "MIT" }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yocto-queue": { @@ -5579,60 +5015,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yocto-spinner": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", - "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", - "license": "MIT", - "dependencies": { - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18.19" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yoctocolors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz", - "integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - }, - "node_modules/zod-to-ts": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", - "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", - "peerDependencies": { - "typescript": "^4.9.4 || ^5.0.2", - "zod": "^3" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tests/resources/sites/astro-custom-start-command/package.json b/tests/resources/sites/astro-custom-start-command/package.json index bf2475ef57..6520326b72 100644 --- a/tests/resources/sites/astro-custom-start-command/package.json +++ b/tests/resources/sites/astro-custom-start-command/package.json @@ -9,8 +9,8 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^9.5.4", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" }, "devDependencies": { }, diff --git a/tests/resources/sites/astro-static/package-lock.json b/tests/resources/sites/astro-static/package-lock.json index b71881fc00..66a799852f 100644 --- a/tests/resources/sites/astro-static/package-lock.json +++ b/tests/resources/sites/astro-static/package-lock.json @@ -8,34 +8,42 @@ "name": "my-astro-app", "version": "0.0.1", "dependencies": { - "astro": "^5.2.5" + "astro": "^6.4.4" } }, "node_modules/@astrojs/compiler": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.13.1.tgz", - "integrity": "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-4.0.0.tgz", + "integrity": "sha512-eouss7G8ygdZqHuke033VMcVw5HTZUu+PXd/h06DGDUg/jt5btPYPqh66ENWw/mU78rBrf/oeC4oqoBwMtDMNA==", "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.6.tgz", - "integrity": "sha512-GOle7smBWKfMSP8osUIGOlB5kaHdQLV3foCsf+5Q9Wsuu+C6Fs3Ez/ttXmhjZ1HkSgsogcM1RXSjjOVieHq16Q==", - "license": "MIT" - }, - "node_modules/@astrojs/markdown-remark": { - "version": "6.3.11", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.11.tgz", - "integrity": "sha512-hcaxX/5aC6lQgHeGh1i+aauvSwIT6cfyFjKWvExYSxUhZZBBdvCliOtu06gbQyhbe0pGJNoNmqNlQZ5zYUuIyQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.0.tgz", + "integrity": "sha512-Ry2R3VPeIN4uPCSA4xQc+e+vsJXkalKpEbDc07hV+a/o5Bs2N/s/uDcPJH/05L19DKh9tAy7e6JM3YZ6Cxfezw==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.6", - "@astrojs/prism": "3.3.0", + "@types/hast": "^3.0.4", + "@types/mdast": "^4.0.4", + "js-yaml": "^4.1.1", + "picomatch": "^4.0.4", + "retext-smartypants": "^6.2.0", + "shiki": "^4.0.2", + "smol-toml": "^1.6.0", + "unified": "^11.0.5" + } + }, + "node_modules/@astrojs/markdown-remark": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.2.0.tgz", + "integrity": "sha512-+YxmVQu1Bd+MFfSzjq1rOJvD9+nIOJzz5YIIhdIH01RrxRkKbyKoEgyIqP3yv51MhzMDgd79QaPv+kCVPT8vHw==", + "license": "MIT", + "dependencies": { + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", - "import-meta-resolve": "^4.2.0", - "js-yaml": "^4.1.1", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", @@ -43,39 +51,35 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", - "shiki": "^3.21.0", - "smol-toml": "^1.6.0", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", - "unist-util-visit": "^5.0.0", + "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "node_modules/@astrojs/prism": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.3.0.tgz", - "integrity": "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", + "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", "license": "MIT", "dependencies": { "prismjs": "^1.30.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.12.0" } }, "node_modules/@astrojs/telemetry": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", - "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz", + "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==", "license": "MIT", "dependencies": { - "ci-info": "^4.2.0", - "debug": "^4.4.0", - "dlv": "^1.1.3", + "ci-info": "^4.4.0", "dset": "^3.1.4", - "is-docker": "^3.0.0", - "is-wsl": "^3.1.0", + "is-docker": "^4.0.0", + "is-wsl": "^3.1.1", "which-pm-runs": "^1.1.0" }, "engines": { @@ -83,30 +87,30 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", - "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.29.0" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -116,13 +120,13 @@ } }, "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -140,10 +144,38 @@ "node": ">=18" } }, + "node_modules/@clack/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.1.tgz", + "integrity": "sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==", + "license": "MIT", + "dependencies": { + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, + "node_modules/@clack/prompts": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.5.1.tgz", + "integrity": "sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==", + "license": "MIT", + "dependencies": { + "@clack/core": "1.4.1", + "fast-string-width": "^3.0.2", + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, "node_modules/@emnapi/runtime": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.0.tgz", - "integrity": "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.0.tgz", + "integrity": "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg==", "license": "MIT", "optional": true, "dependencies": { @@ -151,9 +183,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz", - "integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -167,9 +199,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz", - "integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -183,9 +215,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz", - "integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -199,9 +231,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz", - "integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -215,9 +247,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz", - "integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -231,9 +263,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz", - "integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -247,9 +279,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz", - "integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -263,9 +295,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz", - "integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -279,9 +311,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz", - "integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -295,9 +327,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz", - "integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -311,9 +343,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz", - "integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -327,9 +359,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz", - "integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -343,9 +375,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz", - "integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -359,9 +391,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz", - "integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -375,9 +407,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz", - "integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -391,9 +423,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz", - "integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -407,9 +439,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz", - "integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -423,9 +455,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz", - "integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -439,9 +471,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz", - "integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -455,9 +487,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz", - "integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -471,9 +503,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz", - "integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -487,9 +519,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz", - "integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -503,9 +535,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz", - "integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -519,9 +551,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz", - "integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -535,9 +567,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz", - "integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -551,9 +583,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz", - "integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -659,6 +691,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -675,6 +710,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -691,6 +729,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -707,6 +748,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -723,6 +767,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -739,6 +786,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -755,6 +805,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -771,6 +824,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -787,6 +843,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -809,6 +868,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -831,6 +893,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -853,6 +918,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -875,6 +943,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -897,6 +968,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -919,6 +993,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -941,6 +1018,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1045,9 +1125,9 @@ "license": "MIT" }, "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", @@ -1066,16 +1146,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1086,9 +1160,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1099,9 +1173,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1112,9 +1186,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1125,9 +1199,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1138,9 +1212,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1151,12 +1225,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1164,12 +1241,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1177,12 +1257,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1190,12 +1273,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1203,12 +1289,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1216,12 +1305,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1229,12 +1321,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1242,12 +1337,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1255,12 +1353,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1268,12 +1369,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1281,12 +1385,15 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1294,12 +1401,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1307,12 +1417,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1320,9 +1433,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1333,9 +1446,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1346,9 +1459,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1359,9 +1472,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1372,9 +1485,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1385,9 +1498,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1398,64 +1511,97 @@ ] }, "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz", + "integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/primitive": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz", + "integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz", + "integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz", + "integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz", + "integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.2.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz", + "integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz", + "integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/vscode-textmate": { @@ -1465,18 +1611,18 @@ "license": "MIT" }, "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, "node_modules/@types/hast": { @@ -1519,97 +1665,11 @@ "license": "MIT" }, "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", "license": "ISC" }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "license": "ISC", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1624,9 +1684,9 @@ } }, "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -1661,80 +1721,72 @@ } }, "node_modules/astro": { - "version": "5.18.1", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.18.1.tgz", - "integrity": "sha512-m4VWilWZ+Xt6NPoYzC4CgGZim/zQUO7WFL0RHCH0AiEavF1153iC3+me2atDvXpf/yX4PyGUeD8wZLq1cirT3g==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-6.4.4.tgz", + "integrity": "sha512-hVe8tq3lqt/Dr0UyB//yUmQSlHMTU8scTiF/vQddQVahLE4TTaSdH5H0nb7OvRcwo0UmlAO8DWYar4jNaS7H+A==", "license": "MIT", "dependencies": { - "@astrojs/compiler": "^2.13.0", - "@astrojs/internal-helpers": "0.7.6", - "@astrojs/markdown-remark": "6.3.11", - "@astrojs/telemetry": "3.3.0", + "@astrojs/compiler": "^4.0.0", + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/markdown-remark": "7.2.0", + "@astrojs/telemetry": "3.3.2", "@capsizecss/unpack": "^4.0.0", + "@clack/prompts": "^1.1.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", - "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", - "boxen": "8.0.1", - "ci-info": "^4.3.1", + "ci-info": "^4.4.0", "clsx": "^2.1.1", - "common-ancestor-path": "^1.0.1", + "common-ancestor-path": "^2.0.0", "cookie": "^1.1.1", - "cssesc": "^3.0.0", - "debug": "^4.4.3", - "deterministic-object-hash": "^2.0.2", - "devalue": "^5.6.2", + "devalue": "^5.8.1", "diff": "^8.0.3", - "dlv": "^1.1.3", "dset": "^3.1.4", - "es-module-lexer": "^1.7.0", + "es-module-lexer": "^2.0.0", "esbuild": "^0.27.3", - "estree-walker": "^3.0.3", "flattie": "^1.1.1", - "fontace": "~0.4.0", + "fontace": "~0.4.1", + "get-tsconfig": "5.0.0-beta.4", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", + "jsonc-parser": "^3.3.1", "magic-string": "^0.30.21", - "magicast": "^0.5.1", + "magicast": "^0.5.2", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", - "p-limit": "^6.2.0", - "p-queue": "^8.1.1", + "obug": "^2.1.1", + "p-limit": "^7.3.0", + "p-queue": "^9.1.0", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.3", - "prompts": "^2.4.2", + "picomatch": "^4.0.4", "rehype": "^13.0.2", - "semver": "^7.7.3", - "shiki": "^3.21.0", + "semver": "^7.7.4", + "shiki": "^4.0.2", "smol-toml": "^1.6.0", - "svgo": "^4.0.0", - "tinyexec": "^1.0.2", + "svgo": "^4.0.1", + "tinyclip": "^0.1.12", + "tinyexec": "^1.0.4", "tinyglobby": "^0.2.15", - "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.7.3", - "unist-util-visit": "^5.0.0", - "unstorage": "^1.17.4", + "unifont": "~0.7.4", + "unist-util-visit": "^5.1.0", + "unstorage": "^1.17.5", "vfile": "^6.0.3", - "vite": "^6.4.1", - "vitefu": "^1.1.1", + "vite": "^7.3.2", + "vitefu": "^1.1.2", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.2.3", - "zod": "^3.25.76", - "zod-to-json-schema": "^3.25.1", - "zod-to-ts": "^1.2.0" + "yargs-parser": "^22.0.0", + "zod": "^4.3.6" }, "bin": { - "astro": "astro.js" + "astro": "bin/astro.mjs" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "node": ">=22.12.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -1765,52 +1817,12 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, - "node_modules/boxen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", - "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", - "license": "MIT", - "dependencies": { - "ansi-align": "^3.0.1", - "camelcase": "^8.0.0", - "chalk": "^5.3.0", - "cli-boxes": "^3.0.0", - "string-width": "^7.2.0", - "type-fest": "^4.21.0", - "widest-line": "^5.0.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", - "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -1821,18 +1833,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -1893,18 +1893,6 @@ "node": ">=8" } }, - "node_modules/cli-boxes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", - "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -1934,10 +1922,13 @@ } }, "node_modules/common-ancestor-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", - "license": "ISC" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">= 18" + } }, "node_modules/cookie": { "version": "1.1.1", @@ -1953,9 +1944,9 @@ } }, "node_modules/cookie-es": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", - "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", + "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", "license": "MIT" }, "node_modules/crossws": { @@ -2008,18 +1999,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csso": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", @@ -2084,9 +2063,9 @@ } }, "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "license": "MIT" }, "node_modules/dequal": { @@ -2114,22 +2093,10 @@ "node": ">=8" } }, - "node_modules/deterministic-object-hash": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", - "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", - "license": "MIT", - "dependencies": { - "base-64": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/devlop": { @@ -2146,20 +2113,14 @@ } }, "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "license": "MIT" - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -2236,12 +2197,6 @@ "node": ">=4" } }, - "node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "license": "MIT" - }, "node_modules/entities": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", @@ -2255,15 +2210,15 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "license": "MIT" }, "node_modules/esbuild": { - "version": "0.27.4", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz", - "integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2273,32 +2228,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.4", - "@esbuild/android-arm": "0.27.4", - "@esbuild/android-arm64": "0.27.4", - "@esbuild/android-x64": "0.27.4", - "@esbuild/darwin-arm64": "0.27.4", - "@esbuild/darwin-x64": "0.27.4", - "@esbuild/freebsd-arm64": "0.27.4", - "@esbuild/freebsd-x64": "0.27.4", - "@esbuild/linux-arm": "0.27.4", - "@esbuild/linux-arm64": "0.27.4", - "@esbuild/linux-ia32": "0.27.4", - "@esbuild/linux-loong64": "0.27.4", - "@esbuild/linux-mips64el": "0.27.4", - "@esbuild/linux-ppc64": "0.27.4", - "@esbuild/linux-riscv64": "0.27.4", - "@esbuild/linux-s390x": "0.27.4", - "@esbuild/linux-x64": "0.27.4", - "@esbuild/netbsd-arm64": "0.27.4", - "@esbuild/netbsd-x64": "0.27.4", - "@esbuild/openbsd-arm64": "0.27.4", - "@esbuild/openbsd-x64": "0.27.4", - "@esbuild/openharmony-arm64": "0.27.4", - "@esbuild/sunos-x64": "0.27.4", - "@esbuild/win32-arm64": "0.27.4", - "@esbuild/win32-ia32": "0.27.4", - "@esbuild/win32-x64": "0.27.4" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escape-string-regexp": { @@ -2314,13 +2269,10 @@ } }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, "node_modules/eventemitter3": { "version": "5.0.4", @@ -2334,6 +2286,30 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2395,16 +2371,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-east-asian-width": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz", - "integrity": "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==", + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", + "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "engines": { - "node": ">=18" + "node": ">=20.20.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/github-slugger": { @@ -2414,14 +2393,14 @@ "license": "ISC" }, "node_modules/h3": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.6.tgz", - "integrity": "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", + "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", "license": "MIT", "dependencies": { - "cookie-es": "^1.2.2", + "cookie-es": "^1.2.3", "crossws": "^0.3.5", - "defu": "^6.1.4", + "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", @@ -2629,16 +2608,6 @@ "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", "license": "BSD-2-Clause" }, - "node_modules/import-meta-resolve": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", - "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/iron-webcrypto": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.2.1.tgz", @@ -2649,29 +2618,20 @@ } }, "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", + "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -2690,6 +2650,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -2718,9 +2693,19 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2729,14 +2714,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "license": "MIT" }, "node_modules/longest-streak": { "version": "3.1.0", @@ -2749,9 +2731,9 @@ } }, "node_modules/lru-cache": { - "version": "11.2.7", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.7.tgz", - "integrity": "sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA==", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -2767,12 +2749,12 @@ } }, "node_modules/magicast": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.2.tgz", - "integrity": "sha512-E3ZJh4J3S9KfwdjZhe2afj6R9lGIN5Pher1pF39UGrXRqq/VDaGVIGN13BjHd2u8B61hArAGOnso7nBOouW3TQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.0", + "@babel/parser": "^7.29.3", "@babel/types": "^7.29.0", "source-map-js": "^1.2.1" } @@ -3597,9 +3579,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "funding": [ { "type": "github", @@ -3669,6 +3651,19 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/ofetch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", @@ -3687,60 +3682,60 @@ "license": "MIT" }, "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "node_modules/p-limit": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", - "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", + "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.1.1" + "yocto-queue": "^1.2.1" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-queue": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", - "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz", + "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==", "license": "MIT", "dependencies": { - "eventemitter3": "^5.0.1", - "p-timeout": "^6.1.2" + "eventemitter3": "^5.0.4", + "p-timeout": "^7.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-timeout": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", - "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", + "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", "license": "MIT", "engines": { - "node": ">=14.16" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3795,9 +3790,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" @@ -3807,9 +3802,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "funding": [ { "type": "opencollective", @@ -3826,7 +3821,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3843,23 +3838,10 @@ "node": ">=6" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", "license": "MIT", "funding": { "type": "github", @@ -4051,6 +4033,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/retext": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", @@ -4113,12 +4104,12 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4128,47 +4119,47 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, "node_modules/sax": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", - "integrity": "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" } }, "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.3.tgz", + "integrity": "sha512-wnilbGyMxzbY7dNOl7jpKbLSjcfeweJWU5j4+u5qW+6/wuGD9KzIGOyZnQVSBM9E7DtWaaH3CyHkppYrKYoxwg==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4223,19 +4214,22 @@ } }, "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz", + "integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==", "license": "MIT", "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", + "@shikijs/core": "4.2.0", + "@shikijs/engine-javascript": "4.2.0", + "@shikijs/engine-oniguruma": "4.2.0", + "@shikijs/langs": "4.2.0", + "@shikijs/themes": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/sisteransi": { @@ -4245,9 +4239,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.0.tgz", - "integrity": "sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz", + "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -4275,23 +4269,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4306,21 +4283,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.2.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", @@ -4352,23 +4314,32 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "license": "MIT" }, + "node_modules/tinyclip": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.14.tgz", + "integrity": "sha512-F1oWdz8tjT17qe1d5JgDK6z03WGOhYYAN0lK3/D/fzNiy93xswLLEw7pk+3g05onhAy6Bsc6PLNUGhdgVjemMQ==", + "license": "MIT", + "engines": { + "node": "^16.14.0 || >= 17.3.0" + } + }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -4397,26 +4368,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -4424,36 +4375,10 @@ "license": "0BSD", "optional": true }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/ultrahtml": { @@ -4622,16 +4547,16 @@ } }, "node_modules/unstorage": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.4.tgz", - "integrity": "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", + "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.5", - "lru-cache": "^11.2.0", + "h3": "^1.15.10", + "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" @@ -4760,23 +4685,23 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -4785,14 +4710,14 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", - "less": "*", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -4833,467 +4758,10 @@ } } }, - "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, "node_modules/vitefu": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.2.tgz", - "integrity": "sha512-zpKATdUbzbsycPFBN71nS2uzBUQiVnFoOrr2rvqv34S1lcAgMKKkjWleLGeiJlZ8lwCXvtWaRn7R3ZC16SYRuw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", "license": "MIT", "workspaces": [ "tests/deps/*", @@ -5301,7 +4769,7 @@ "tests/projects/workspace/packages/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "vite": { @@ -5328,38 +4796,6 @@ "node": ">=4" } }, - "node_modules/widest-line": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", - "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", - "license": "MIT", - "dependencies": { - "string-width": "^7.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/xxhash-wasm": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", @@ -5367,12 +4803,12 @@ "license": "MIT" }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yocto-queue": { @@ -5387,60 +4823,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yocto-spinner": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", - "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", - "license": "MIT", - "dependencies": { - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18.19" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yoctocolors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz", - "integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - }, - "node_modules/zod-to-ts": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", - "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", - "peerDependencies": { - "typescript": "^4.9.4 || ^5.0.2", - "zod": "^3" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tests/resources/sites/astro-static/package.json b/tests/resources/sites/astro-static/package.json index 147dcf1f07..2b2932ec67 100644 --- a/tests/resources/sites/astro-static/package.json +++ b/tests/resources/sites/astro-static/package.json @@ -9,6 +9,6 @@ "astro": "astro" }, "dependencies": { - "astro": "^5.2.5" + "astro": "^6.4.4" } } diff --git a/tests/resources/sites/astro/package-lock.json b/tests/resources/sites/astro/package-lock.json index becadd9b82..9fc14680a8 100644 --- a/tests/resources/sites/astro/package-lock.json +++ b/tests/resources/sites/astro/package-lock.json @@ -8,35 +8,43 @@ "name": "my-astro-app", "version": "0.0.1", "dependencies": { - "@astrojs/node": "^9.0.2", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" } }, "node_modules/@astrojs/compiler": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-2.13.1.tgz", - "integrity": "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-4.0.0.tgz", + "integrity": "sha512-eouss7G8ygdZqHuke033VMcVw5HTZUu+PXd/h06DGDUg/jt5btPYPqh66ENWw/mU78rBrf/oeC4oqoBwMtDMNA==", "license": "MIT" }, "node_modules/@astrojs/internal-helpers": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.7.5.tgz", - "integrity": "sha512-vreGnYSSKhAjFJCWAwe/CNhONvoc5lokxtRoZims+0wa3KbHBdPHSSthJsKxPd8d/aic6lWKpRTYGY/hsgK6EA==", - "license": "MIT" - }, - "node_modules/@astrojs/markdown-remark": { - "version": "6.3.10", - "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-6.3.10.tgz", - "integrity": "sha512-kk4HeYR6AcnzC4QV8iSlOfh+N8TZ3MEStxPyenyCtemqn8IpEATBFMTJcfrNW32dgpt6MY3oCkMM/Tv3/I4G3A==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@astrojs/internal-helpers/-/internal-helpers-0.10.0.tgz", + "integrity": "sha512-Ry2R3VPeIN4uPCSA4xQc+e+vsJXkalKpEbDc07hV+a/o5Bs2N/s/uDcPJH/05L19DKh9tAy7e6JM3YZ6Cxfezw==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/prism": "3.3.0", + "@types/hast": "^3.0.4", + "@types/mdast": "^4.0.4", + "js-yaml": "^4.1.1", + "picomatch": "^4.0.4", + "retext-smartypants": "^6.2.0", + "shiki": "^4.0.2", + "smol-toml": "^1.6.0", + "unified": "^11.0.5" + } + }, + "node_modules/@astrojs/markdown-remark": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@astrojs/markdown-remark/-/markdown-remark-7.2.0.tgz", + "integrity": "sha512-+YxmVQu1Bd+MFfSzjq1rOJvD9+nIOJzz5YIIhdIH01RrxRkKbyKoEgyIqP3yv51MhzMDgd79QaPv+kCVPT8vHw==", + "license": "MIT", + "dependencies": { + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/prism": "4.0.2", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", - "import-meta-resolve": "^4.2.0", - "js-yaml": "^4.1.1", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", @@ -44,53 +52,49 @@ "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", - "shiki": "^3.19.0", - "smol-toml": "^1.5.2", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", - "unist-util-visit": "^5.0.0", + "unist-util-visit": "^5.1.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "node_modules/@astrojs/node": { - "version": "9.5.4", - "resolved": "https://registry.npmjs.org/@astrojs/node/-/node-9.5.4.tgz", - "integrity": "sha512-AbPSZsMGu8hXPR2XxV79RaKy8h6wijhtoqZGeUf4OXg2w1mxXlx4VnIc1D+QvtsgauSz7P5PLhmvf6w/J41GJg==", + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/@astrojs/node/-/node-10.1.3.tgz", + "integrity": "sha512-NybvdqXFwUbTkaJ8OhDmkrXK+cdpXR+KhyiaBduVVqzAopT70J9QVah8Iz2vt24+wF6PqH1oxElnQlU4OwcBLA==", "license": "MIT", "dependencies": { - "@astrojs/internal-helpers": "0.7.5", + "@astrojs/internal-helpers": "0.10.0", "send": "^1.2.1", "server-destroy": "^1.0.1" }, "peerDependencies": { - "astro": "^5.17.3" + "astro": "^6.3.0" } }, "node_modules/@astrojs/prism": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.3.0.tgz", - "integrity": "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-4.0.2.tgz", + "integrity": "sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==", "license": "MIT", "dependencies": { "prismjs": "^1.30.0" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0" + "node": ">=22.12.0" } }, "node_modules/@astrojs/telemetry": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.0.tgz", - "integrity": "sha512-UFBgfeldP06qu6khs/yY+q1cDAaArM2/7AEIqQ9Cuvf7B1hNLq0xDrZkct+QoIGyjq56y8IaE2I3CTvG99mlhQ==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@astrojs/telemetry/-/telemetry-3.3.2.tgz", + "integrity": "sha512-j8DNruA8ors99Al39RYZPJK4DC1bKkoNm93mAMuBhY9TCNC4R8n1q7ovFnJ5qhGh5Lsh7pa1gpQVpYpsJPeTHQ==", "license": "MIT", "dependencies": { - "ci-info": "^4.2.0", - "debug": "^4.4.0", - "dlv": "^1.1.3", + "ci-info": "^4.4.0", "dset": "^3.1.4", - "is-docker": "^3.0.0", - "is-wsl": "^3.1.0", + "is-docker": "^4.0.0", + "is-wsl": "^3.1.1", "which-pm-runs": "^1.1.0" }, "engines": { @@ -98,30 +102,30 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", - "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", "license": "MIT", "dependencies": { - "@babel/types": "^7.29.0" + "@babel/types": "^7.29.7" }, "bin": { "parser": "bin/babel-parser.js" @@ -131,13 +135,13 @@ } }, "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { "node": ">=6.9.0" @@ -155,10 +159,38 @@ "node": ">=18" } }, + "node_modules/@clack/core": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@clack/core/-/core-1.4.1.tgz", + "integrity": "sha512-FILJa1gGKEFTGZAJE9RpVhrjKz3c3h4ar60dSv6cGuDqufQ84YEIS3GAGvZiN+H6yaLbbvTFNejjCC4tXpZEuw==", + "license": "MIT", + "dependencies": { + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, + "node_modules/@clack/prompts": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.5.1.tgz", + "integrity": "sha512-zccHj2z2oCCO4yrDiRSlFOxWerGqRiysP7a5jPK6uoI9URKAquwY42Dd/iUP8JWHxEzdRe4TlbvZCo8z1/mhrw==", + "license": "MIT", + "dependencies": { + "@clack/core": "1.4.1", + "fast-string-width": "^3.0.2", + "fast-wrap-ansi": "^0.2.0", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 20.12.0" + } + }, "node_modules/@emnapi/runtime": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", - "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.0.tgz", + "integrity": "sha512-55coeOFKHv1ywEcUXJtWU5f+Jr/W5tZDvZig8DLKSwUN1JpROQ4rk/SNOQiFWmaR/VKF4zuFyW1B8JduOSv6Pg==", "license": "MIT", "optional": true, "dependencies": { @@ -166,9 +198,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", "cpu": [ "ppc64" ], @@ -182,9 +214,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", "cpu": [ "arm" ], @@ -198,9 +230,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", "cpu": [ "arm64" ], @@ -214,9 +246,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", "cpu": [ "x64" ], @@ -230,9 +262,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", "cpu": [ "arm64" ], @@ -246,9 +278,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", "cpu": [ "x64" ], @@ -262,9 +294,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", "cpu": [ "arm64" ], @@ -278,9 +310,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", "cpu": [ "x64" ], @@ -294,9 +326,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", "cpu": [ "arm" ], @@ -310,9 +342,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", "cpu": [ "arm64" ], @@ -326,9 +358,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", "cpu": [ "ia32" ], @@ -342,9 +374,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", "cpu": [ "loong64" ], @@ -358,9 +390,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", "cpu": [ "mips64el" ], @@ -374,9 +406,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", "cpu": [ "ppc64" ], @@ -390,9 +422,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", "cpu": [ "riscv64" ], @@ -406,9 +438,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", "cpu": [ "s390x" ], @@ -422,9 +454,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", "cpu": [ "x64" ], @@ -438,9 +470,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", "cpu": [ "arm64" ], @@ -454,9 +486,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", "cpu": [ "x64" ], @@ -470,9 +502,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", "cpu": [ "arm64" ], @@ -486,9 +518,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", "cpu": [ "x64" ], @@ -502,9 +534,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", "cpu": [ "arm64" ], @@ -518,9 +550,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", "cpu": [ "x64" ], @@ -534,9 +566,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", "cpu": [ "arm64" ], @@ -550,9 +582,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", "cpu": [ "ia32" ], @@ -566,9 +598,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", "cpu": [ "x64" ], @@ -674,6 +706,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -690,6 +725,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -706,6 +744,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -722,6 +763,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -738,6 +782,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -754,6 +801,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -770,6 +820,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -786,6 +839,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -802,6 +858,9 @@ "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -824,6 +883,9 @@ "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -846,6 +908,9 @@ "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -868,6 +933,9 @@ "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -890,6 +958,9 @@ "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -912,6 +983,9 @@ "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -934,6 +1008,9 @@ "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -956,6 +1033,9 @@ "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1060,9 +1140,9 @@ "license": "MIT" }, "node_modules/@rollup/pluginutils": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", - "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", @@ -1081,16 +1161,10 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "license": "MIT" - }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", "cpu": [ "arm" ], @@ -1101,9 +1175,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", "cpu": [ "arm64" ], @@ -1114,9 +1188,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", "cpu": [ "arm64" ], @@ -1127,9 +1201,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", "cpu": [ "x64" ], @@ -1140,9 +1214,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", "cpu": [ "arm64" ], @@ -1153,9 +1227,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", "cpu": [ "x64" ], @@ -1166,12 +1240,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", "cpu": [ "arm" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1179,12 +1256,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", "cpu": [ "arm" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1192,12 +1272,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1205,12 +1288,15 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1218,12 +1304,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", "cpu": [ "loong64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1231,12 +1320,15 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", "cpu": [ "loong64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1244,12 +1336,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", "cpu": [ "ppc64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1257,12 +1352,15 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", "cpu": [ "ppc64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1270,12 +1368,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", "cpu": [ "riscv64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1283,12 +1384,15 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", "cpu": [ "riscv64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1296,12 +1400,15 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", "cpu": [ "s390x" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1309,12 +1416,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1322,12 +1432,15 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1335,9 +1448,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", "cpu": [ "x64" ], @@ -1348,9 +1461,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", "cpu": [ "arm64" ], @@ -1361,9 +1474,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", "cpu": [ "arm64" ], @@ -1374,9 +1487,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", "cpu": [ "ia32" ], @@ -1387,9 +1500,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", "cpu": [ "x64" ], @@ -1400,9 +1513,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", "cpu": [ "x64" ], @@ -1413,64 +1526,97 @@ ] }, "node_modules/@shikijs/core": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.23.0.tgz", - "integrity": "sha512-NSWQz0riNb67xthdm5br6lAkvpDJRTgB36fxlo37ZzM2yq0PQFFzbd8psqC2XMPgCzo1fW6cVi18+ArJ44wqgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-4.2.0.tgz", + "integrity": "sha512-Hc87Ab1Ld/vEbZRCbwx344I5v+4RU8CVToUTRkqXL1+TjbuOp9U5Xa0M23V4GEWHxVn+yO5otb+HkQVm3ptWQQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/primitive": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-javascript": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.23.0.tgz", - "integrity": "sha512-aHt9eiGFobmWR5uqJUViySI1bHMqrAgamWE1TYSUoftkAeCCAiGawPMwM+VCadylQtF4V3VNOZ5LmfItH5f3yA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-4.2.0.tgz", + "integrity": "sha512-fjETeq1k5ffyXqRgS6+3hpvqseLalp1kjNfRbXpUgWR8FpZ1CmQfiNHovc5lncYjt/Vg5JK/WJEmLahjwMa0og==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", - "oniguruma-to-es": "^4.3.4" + "oniguruma-to-es": "^4.3.6" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.23.0.tgz", - "integrity": "sha512-1nWINwKXxKKLqPibT5f4pAFLej9oZzQTsby8942OTlsJzOBZ0MWKiwzMsd+jhzu8YPCHAswGnnN1YtQfirL35g==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-4.2.0.tgz", + "integrity": "sha512-hTorK1dffPkpbMUk6Z+828PgRo7d07HbnizoP0hNPFjhxMHctj0Px/qoHeGMYafc6ju+u9iMldN4JbVzNQM++g==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/langs": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.23.0.tgz", - "integrity": "sha512-2Ep4W3Re5aB1/62RSYQInK9mM3HsLeB91cHqznAJMuylqjzNVAVCMnNWRHFtcNHXsoNRayP9z1qj4Sq3nMqYXg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-4.2.0.tgz", + "integrity": "sha512-bwrVRlJ0wUhZxAbVdvBbv2TTC9yLsh4C/IO5Ofz0T8MQntgDvyVnkbjw9vi50r1kx7RCIJdnJnjZAwmAsXFLZQ==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@shikijs/primitive": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/primitive/-/primitive-4.2.0.tgz", + "integrity": "sha512-NOq+DtUkVBJtZMVXL5A0vI0Xk8nvDYaXetFHSJFlOqjDZIVhIPRYFdGkSoElDqNuegikcc3A76SNUa8dTqtAYA==", + "license": "MIT", + "dependencies": { + "@shikijs/types": "4.2.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/themes": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.23.0.tgz", - "integrity": "sha512-5qySYa1ZgAT18HR/ypENL9cUSGOeI2x+4IvYJu4JgVJdizn6kG4ia5Q1jDEOi7gTbN4RbuYtmHh0W3eccOrjMA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-4.2.0.tgz", + "integrity": "sha512-RX8IHYeLv8Cu2W6ruc3RxUqWn0IYCqSrMBzi/uRGAmfyDNOnNO5BF/Px7o97n4XTpmFTo5GbRaazuOWj+2ak2w==", "license": "MIT", "dependencies": { - "@shikijs/types": "3.23.0" + "@shikijs/types": "4.2.0" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.23.0.tgz", - "integrity": "sha512-3JZ5HXOZfYjsYSk0yPwBrkupyYSLpAE26Qc0HLghhZNGTZg/SKxXIIgoxOpmmeQP0RRSDJTk1/vPfw9tbw+jSQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-4.2.0.tgz", + "integrity": "sha512-VT/MKtlpOhEPZloSH3Pb9WCZEBDoQVMa9jedp5UAwmJOar1DVc9DRODAxmYPW9M93IK4ryuqRejFfmlvlVDemw==", "license": "MIT", "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/@shikijs/vscode-textmate": { @@ -1480,18 +1626,18 @@ "license": "MIT" }, "node_modules/@types/debug": { - "version": "4.1.12", - "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", - "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", "license": "MIT", "dependencies": { "@types/ms": "*" } }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "license": "MIT" }, "node_modules/@types/hast": { @@ -1534,97 +1680,11 @@ "license": "MIT" }, "node_modules/@ungap/structured-clone": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", - "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.1.tgz", + "integrity": "sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==", "license": "ISC" }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "license": "ISC", - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1639,9 +1699,9 @@ } }, "node_modules/anymatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", "license": "MIT", "engines": { "node": ">=8.6" @@ -1676,80 +1736,72 @@ } }, "node_modules/astro": { - "version": "5.18.0", - "resolved": "https://registry.npmjs.org/astro/-/astro-5.18.0.tgz", - "integrity": "sha512-CHiohwJIS4L0G6/IzE1Fx3dgWqXBCXus/od0eGUfxrZJD2um2pE7ehclMmgL/fXqbU7NfE1Ze2pq34h2QaA6iQ==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/astro/-/astro-6.4.4.tgz", + "integrity": "sha512-hVe8tq3lqt/Dr0UyB//yUmQSlHMTU8scTiF/vQddQVahLE4TTaSdH5H0nb7OvRcwo0UmlAO8DWYar4jNaS7H+A==", "license": "MIT", "dependencies": { - "@astrojs/compiler": "^2.13.0", - "@astrojs/internal-helpers": "0.7.5", - "@astrojs/markdown-remark": "6.3.10", - "@astrojs/telemetry": "3.3.0", + "@astrojs/compiler": "^4.0.0", + "@astrojs/internal-helpers": "0.10.0", + "@astrojs/markdown-remark": "7.2.0", + "@astrojs/telemetry": "3.3.2", "@capsizecss/unpack": "^4.0.0", + "@clack/prompts": "^1.1.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", - "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", - "boxen": "8.0.1", - "ci-info": "^4.3.1", + "ci-info": "^4.4.0", "clsx": "^2.1.1", - "common-ancestor-path": "^1.0.1", + "common-ancestor-path": "^2.0.0", "cookie": "^1.1.1", - "cssesc": "^3.0.0", - "debug": "^4.4.3", - "deterministic-object-hash": "^2.0.2", - "devalue": "^5.6.2", + "devalue": "^5.8.1", "diff": "^8.0.3", - "dlv": "^1.1.3", "dset": "^3.1.4", - "es-module-lexer": "^1.7.0", + "es-module-lexer": "^2.0.0", "esbuild": "^0.27.3", - "estree-walker": "^3.0.3", "flattie": "^1.1.1", - "fontace": "~0.4.0", + "fontace": "~0.4.1", + "get-tsconfig": "5.0.0-beta.4", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", - "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", + "jsonc-parser": "^3.3.1", "magic-string": "^0.30.21", - "magicast": "^0.5.1", + "magicast": "^0.5.2", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", - "p-limit": "^6.2.0", - "p-queue": "^8.1.1", + "obug": "^2.1.1", + "p-limit": "^7.3.0", + "p-queue": "^9.1.0", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", - "picomatch": "^4.0.3", - "prompts": "^2.4.2", + "picomatch": "^4.0.4", "rehype": "^13.0.2", - "semver": "^7.7.3", - "shiki": "^3.21.0", + "semver": "^7.7.4", + "shiki": "^4.0.2", "smol-toml": "^1.6.0", - "svgo": "^4.0.0", - "tinyexec": "^1.0.2", + "svgo": "^4.0.1", + "tinyclip": "^0.1.12", + "tinyexec": "^1.0.4", "tinyglobby": "^0.2.15", - "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", - "unifont": "~0.7.3", - "unist-util-visit": "^5.0.0", - "unstorage": "^1.17.4", + "unifont": "~0.7.4", + "unist-util-visit": "^5.1.0", + "unstorage": "^1.17.5", "vfile": "^6.0.3", - "vite": "^6.4.1", - "vitefu": "^1.1.1", + "vite": "^7.3.2", + "vitefu": "^1.1.2", "xxhash-wasm": "^1.1.0", - "yargs-parser": "^21.1.1", - "yocto-spinner": "^0.2.3", - "zod": "^3.25.76", - "zod-to-json-schema": "^3.25.1", - "zod-to-ts": "^1.2.0" + "yargs-parser": "^22.0.0", + "zod": "^4.3.6" }, "bin": { - "astro": "astro.js" + "astro": "bin/astro.mjs" }, "engines": { - "node": "18.20.8 || ^20.3.0 || >=22.0.0", + "node": ">=22.12.0", "npm": ">=9.6.5", "pnpm": ">=7.1.0" }, @@ -1780,52 +1832,12 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "license": "ISC" }, - "node_modules/boxen": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz", - "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==", - "license": "MIT", - "dependencies": { - "ansi-align": "^3.0.1", - "camelcase": "^8.0.0", - "chalk": "^5.3.0", - "cli-boxes": "^3.0.0", - "string-width": "^7.2.0", - "type-fest": "^4.21.0", - "widest-line": "^5.0.0", - "wrap-ansi": "^9.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz", - "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==", - "license": "MIT", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -1836,18 +1848,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/character-entities": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", @@ -1908,18 +1908,6 @@ "node": ">=8" } }, - "node_modules/cli-boxes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", - "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -1949,10 +1937,13 @@ } }, "node_modules/common-ancestor-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz", - "integrity": "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==", - "license": "ISC" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-2.0.0.tgz", + "integrity": "sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">= 18" + } }, "node_modules/cookie": { "version": "1.1.1", @@ -1968,9 +1959,9 @@ } }, "node_modules/cookie-es": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz", - "integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.3.tgz", + "integrity": "sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==", "license": "MIT" }, "node_modules/crossws": { @@ -2023,18 +2014,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csso": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/csso/-/csso-5.0.5.tgz", @@ -2099,9 +2078,9 @@ } }, "node_modules/defu": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", - "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "version": "6.1.7", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz", + "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==", "license": "MIT" }, "node_modules/depd": { @@ -2138,22 +2117,10 @@ "node": ">=8" } }, - "node_modules/deterministic-object-hash": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deterministic-object-hash/-/deterministic-object-hash-2.0.2.tgz", - "integrity": "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ==", - "license": "MIT", - "dependencies": { - "base-64": "^1.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.8.1.tgz", + "integrity": "sha512-4CXDYRBGqN+57wVJkuXBYmpAVUSg3L6JAQa/DFqm238G73E1wuyc/JhGQJzN7vUf/CMphYau2zXbfWzDR5aTEw==", "license": "MIT" }, "node_modules/devlop": { @@ -2170,20 +2137,14 @@ } }, "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.4.tgz", + "integrity": "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==", "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } }, - "node_modules/dlv": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", - "license": "MIT" - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -2266,12 +2227,6 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, - "node_modules/emoji-regex": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", - "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", - "license": "MIT" - }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -2294,15 +2249,15 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "license": "MIT" }, "node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", "hasInstallScript": true, "license": "MIT", "bin": { @@ -2312,32 +2267,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" } }, "node_modules/escape-html": { @@ -2359,13 +2314,10 @@ } }, "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", @@ -2388,6 +2340,30 @@ "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-string-truncated-width": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-string-truncated-width/-/fast-string-truncated-width-3.0.3.tgz", + "integrity": "sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==", + "license": "MIT" + }, + "node_modules/fast-string-width": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-string-width/-/fast-string-width-3.0.2.tgz", + "integrity": "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==", + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-wrap-ansi": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/fast-wrap-ansi/-/fast-wrap-ansi-0.2.2.tgz", + "integrity": "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==", + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2458,16 +2434,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-east-asian-width": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz", - "integrity": "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==", + "node_modules/get-tsconfig": { + "version": "5.0.0-beta.4", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-5.0.0-beta.4.tgz", + "integrity": "sha512-7nF7C9fIPFEMHgEMEfgIlO9wDdZ8CyHw27rWciFZfHvHDReIiPhsYuzPRXsfvBCqFy1l8RRyyWV7QLM+ZhUJsQ==", "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "engines": { - "node": ">=18" + "node": ">=20.20.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, "node_modules/github-slugger": { @@ -2477,14 +2456,14 @@ "license": "ISC" }, "node_modules/h3": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.6.tgz", - "integrity": "sha512-oi15ESLW5LRthZ+qPCi5GNasY/gvynSKUQxgiovrY63bPAtG59wtM+LSrlcwvOHAXzGrXVLnI97brbkdPF9WoQ==", + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.11.tgz", + "integrity": "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==", "license": "MIT", "dependencies": { - "cookie-es": "^1.2.2", + "cookie-es": "^1.2.3", "crossws": "^0.3.5", - "defu": "^6.1.4", + "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", @@ -2712,16 +2691,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/import-meta-resolve": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", - "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2738,29 +2707,20 @@ } }, "node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-4.0.0.tgz", + "integrity": "sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==", "license": "MIT", "bin": { "is-docker": "cli.js" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/is-inside-container": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", @@ -2779,6 +2739,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -2807,9 +2782,19 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2818,14 +2803,11 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "license": "MIT" }, "node_modules/longest-streak": { "version": "3.1.0", @@ -2838,9 +2820,9 @@ } }, "node_modules/lru-cache": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.6.tgz", - "integrity": "sha512-ESL2CrkS/2wTPfuend7Zhkzo2u0daGJ/A2VucJOgQ/C48S/zB8MMeMHSGKYpXhIjbPxfuezITkaBH1wqv00DDQ==", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" @@ -2856,12 +2838,12 @@ } }, "node_modules/magicast": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.2.tgz", - "integrity": "sha512-E3ZJh4J3S9KfwdjZhe2afj6R9lGIN5Pher1pF39UGrXRqq/VDaGVIGN13BjHd2u8B61hArAGOnso7nBOouW3TQ==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.3.tgz", + "integrity": "sha512-pVKE4UdSQ7DvHzivsCIFx2BJn1mHG6KsyrFcaxFx6tONdneEuThrDx0Cj3AMg58KyN4pzYT+LHOotxDQDjNvkw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.0", + "@babel/parser": "^7.29.3", "@babel/types": "^7.29.0", "source-map-js": "^1.2.1" } @@ -3711,9 +3693,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", "funding": [ { "type": "github", @@ -3783,6 +3765,19 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/obug": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.2.tgz", + "integrity": "sha512-AWGB9WFcRXOQs48Z/udjI5ZcZMHXwX8XPByNpOydgcGsDLIzjGizhoMWJyKAWze7AVW/2W1i+/gPX4YtKe5cyg==", + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/ofetch": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz", @@ -3813,60 +3808,60 @@ } }, "node_modules/oniguruma-parser": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", - "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.2.tgz", + "integrity": "sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==", "license": "MIT" }, "node_modules/oniguruma-to-es": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.4.tgz", - "integrity": "sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.6.tgz", + "integrity": "sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==", "license": "MIT", "dependencies": { - "oniguruma-parser": "^0.12.1", - "regex": "^6.0.1", + "oniguruma-parser": "^0.12.2", + "regex": "^6.1.0", "regex-recursion": "^6.0.2" } }, "node_modules/p-limit": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.2.0.tgz", - "integrity": "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-7.3.0.tgz", + "integrity": "sha512-7cIXg/Z0M5WZRblrsOla88S4wAK+zOQQWeBYfV3qJuJXMr+LnbYjaadrFaS0JILfEDPVqHyKnZ1Z/1d6J9VVUw==", "license": "MIT", "dependencies": { - "yocto-queue": "^1.1.1" + "yocto-queue": "^1.2.1" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-queue": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.1.1.tgz", - "integrity": "sha512-aNZ+VfjobsWryoiPnEApGGmf5WmNsCo9xu8dfaYamG5qaLP7ClhLN6NgsFe6SwJ2UbLEBK5dv9x8Mn5+RVhMWQ==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.3.0.tgz", + "integrity": "sha512-7NED7xhQ74Ngp4JP/2e0VZHp7vSWfJfqeiR92jPgxsz6m0Se4P03YoTKa9dDXyZ3r6P616gUXttrB6nnHYKang==", "license": "MIT", "dependencies": { - "eventemitter3": "^5.0.1", - "p-timeout": "^6.1.2" + "eventemitter3": "^5.0.4", + "p-timeout": "^7.0.0" }, "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-timeout": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", - "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz", + "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==", "license": "MIT", "engines": { - "node": ">=14.16" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3921,9 +3916,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" @@ -3933,9 +3928,9 @@ } }, "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", "funding": [ { "type": "opencollective", @@ -3952,7 +3947,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.11", + "nanoid": "^3.3.12", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3969,23 +3964,10 @@ "node": ">=6" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/property-information": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", - "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.2.0.tgz", + "integrity": "sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==", "license": "MIT", "funding": { "type": "github", @@ -4186,6 +4168,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/retext": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/retext/-/retext-9.0.0.tgz", @@ -4248,12 +4239,12 @@ } }, "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "version": "4.61.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", "license": "MIT", "dependencies": { - "@types/estree": "1.0.8" + "@types/estree": "1.0.9" }, "bin": { "rollup": "dist/bin/rollup" @@ -4263,47 +4254,47 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", "fsevents": "~2.3.2" } }, "node_modules/sax": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", - "integrity": "sha512-21IYA3Q5cQf089Z6tgaUTr7lDAyzoTPx5HRtbhsME8Udispad8dC/+sziTNugOEx54ilvatQ9YCzl4KQLPcRHA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", + "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==", "license": "BlueOak-1.0.0", "engines": { "node": ">=11.0.0" } }, "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.3.tgz", + "integrity": "sha512-wnilbGyMxzbY7dNOl7jpKbLSjcfeweJWU5j4+u5qW+6/wuGD9KzIGOyZnQVSBM9E7DtWaaH3CyHkppYrKYoxwg==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -4396,19 +4387,22 @@ } }, "node_modules/shiki": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.23.0.tgz", - "integrity": "sha512-55Dj73uq9ZXL5zyeRPzHQsK7Nbyt6Y10k5s7OjuFZGMhpp4r/rsLBH0o/0fstIzX1Lep9VxefWljK/SKCzygIA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-4.2.0.tgz", + "integrity": "sha512-hjNax6o/ylDy9lefQEaSDtzaT3iVNtZ3WmpQnbuQNoG4xvnSKf2kSKbihZVO4JRG1TTMejs7CmNRYlWgAL66pQ==", "license": "MIT", "dependencies": { - "@shikijs/core": "3.23.0", - "@shikijs/engine-javascript": "3.23.0", - "@shikijs/engine-oniguruma": "3.23.0", - "@shikijs/langs": "3.23.0", - "@shikijs/themes": "3.23.0", - "@shikijs/types": "3.23.0", + "@shikijs/core": "4.2.0", + "@shikijs/engine-javascript": "4.2.0", + "@shikijs/engine-oniguruma": "4.2.0", + "@shikijs/langs": "4.2.0", + "@shikijs/themes": "4.2.0", + "@shikijs/types": "4.2.0", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" + }, + "engines": { + "node": ">=20" } }, "node_modules/sisteransi": { @@ -4418,9 +4412,9 @@ "license": "MIT" }, "node_modules/smol-toml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.0.tgz", - "integrity": "sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/smol-toml/-/smol-toml-1.6.1.tgz", + "integrity": "sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==", "license": "BSD-3-Clause", "engines": { "node": ">= 18" @@ -4457,23 +4451,6 @@ "node": ">= 0.8" } }, - "node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stringify-entities": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", @@ -4488,21 +4465,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/strip-ansi": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.2.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", @@ -4534,23 +4496,32 @@ "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", "license": "MIT" }, + "node_modules/tinyclip": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/tinyclip/-/tinyclip-0.1.14.tgz", + "integrity": "sha512-F1oWdz8tjT17qe1d5JgDK6z03WGOhYYAN0lK3/D/fzNiy93xswLLEw7pk+3g05onhAy6Bsc6PLNUGhdgVjemMQ==", + "license": "MIT", + "engines": { + "node": "^16.14.0 || >= 17.3.0" + } + }, "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz", + "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==", "license": "MIT", "engines": { "node": ">=18" } }, "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "license": "MIT", "dependencies": { "fdir": "^6.5.0", - "picomatch": "^4.0.3" + "picomatch": "^4.0.4" }, "engines": { "node": ">=12.0.0" @@ -4588,26 +4559,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/tsconfck": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", - "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", - "license": "MIT", - "bin": { - "tsconfck": "bin/tsconfck.js" - }, - "engines": { - "node": "^18 || >=20" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -4615,36 +4566,10 @@ "license": "0BSD", "optional": true }, - "node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "license": "Apache-2.0", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz", + "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==", "license": "MIT" }, "node_modules/ultrahtml": { @@ -4813,16 +4738,16 @@ } }, "node_modules/unstorage": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.4.tgz", - "integrity": "sha512-fHK0yNg38tBiJKp/Vgsq4j0JEsCmgqH58HAn707S7zGkArbZsVr/CwINoi+nh3h98BRCwKvx1K3Xg9u3VV83sw==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.17.5.tgz", + "integrity": "sha512-0i3iqvRfx29hkNntHyQvJTpf5W9dQ9ZadSoRU8+xVlhVtT7jAX57fazYO9EHvcRCfBCyi5YRya7XCDOsbTgkPg==", "license": "MIT", "dependencies": { "anymatch": "^3.1.3", "chokidar": "^5.0.0", "destr": "^2.0.5", - "h3": "^1.15.5", - "lru-cache": "^11.2.0", + "h3": "^1.15.10", + "lru-cache": "^11.2.7", "node-fetch-native": "^1.6.7", "ofetch": "^1.5.1", "ufo": "^1.6.3" @@ -4951,23 +4876,23 @@ } }, "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz", + "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==", "license": "MIT", "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^20.19.0 || >=22.12.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -4976,14 +4901,14 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@types/node": "^20.19.0 || >=22.12.0", "jiti": ">=1.21.0", - "less": "*", + "less": "^4.0.0", "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" @@ -5024,467 +4949,10 @@ } } }, - "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", - "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", - "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", - "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", - "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", - "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", - "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", - "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", - "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", - "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", - "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", - "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", - "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", - "cpu": [ - "loong64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", - "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", - "cpu": [ - "mips64el" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", - "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", - "cpu": [ - "ppc64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", - "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", - "cpu": [ - "riscv64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", - "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", - "cpu": [ - "s390x" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", - "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", - "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", - "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", - "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", - "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/openharmony-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", - "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", - "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", - "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", - "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, "node_modules/vitefu": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.2.tgz", - "integrity": "sha512-zpKATdUbzbsycPFBN71nS2uzBUQiVnFoOrr2rvqv34S1lcAgMKKkjWleLGeiJlZ8lwCXvtWaRn7R3ZC16SYRuw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.3.tgz", + "integrity": "sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==", "license": "MIT", "workspaces": [ "tests/deps/*", @@ -5492,7 +4960,7 @@ "tests/projects/workspace/packages/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "vite": { @@ -5519,38 +4987,6 @@ "node": ">=4" } }, - "node_modules/widest-line": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz", - "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==", - "license": "MIT", - "dependencies": { - "string-width": "^7.0.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", - "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/xxhash-wasm": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", @@ -5558,12 +4994,12 @@ "license": "MIT" }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yocto-queue": { @@ -5578,60 +5014,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/yocto-spinner": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.2.3.tgz", - "integrity": "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ==", - "license": "MIT", - "dependencies": { - "yoctocolors": "^2.1.1" - }, - "engines": { - "node": ">=18.19" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yoctocolors": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz", - "integrity": "sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { - "version": "3.25.76", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", + "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } }, - "node_modules/zod-to-json-schema": { - "version": "3.25.1", - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.1.tgz", - "integrity": "sha512-pM/SU9d3YAggzi6MtR4h7ruuQlqKtad8e9S0fmxcMi+ueAK5Korys/aWcV9LIIHTVbj01NdzxcnXSN+O74ZIVA==", - "license": "ISC", - "peerDependencies": { - "zod": "^3.25 || ^4" - } - }, - "node_modules/zod-to-ts": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/zod-to-ts/-/zod-to-ts-1.2.0.tgz", - "integrity": "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA==", - "peerDependencies": { - "typescript": "^4.9.4 || ^5.0.2", - "zod": "^3" - } - }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/tests/resources/sites/astro/package.json b/tests/resources/sites/astro/package.json index 8cbcb910f5..2fa27562a6 100644 --- a/tests/resources/sites/astro/package.json +++ b/tests/resources/sites/astro/package.json @@ -9,7 +9,7 @@ "astro": "astro" }, "dependencies": { - "@astrojs/node": "^9.0.2", - "astro": "^5.2.5" + "@astrojs/node": "^10.1.3", + "astro": "^6.4.4" } } diff --git a/tests/unit/Advisor/AuthTest.php b/tests/unit/Advisor/AuthTest.php index c2d4a93755..dd89651a83 100644 --- a/tests/unit/Advisor/AuthTest.php +++ b/tests/unit/Advisor/AuthTest.php @@ -1,5 +1,7 @@ assertSame([AuthType::ADMIN, AuthType::KEY], $method->getAuth()); } - public static function advisorActionsProvider(): array + public static function advisorActionsProvider(): \Iterator { - return [ - 'get report' => [new GetReport()], - 'list reports' => [new ListReports()], - 'delete report' => [new DeleteReport()], - 'get insight' => [new GetInsight()], - 'list insights' => [new ListInsights()], - ]; + yield 'get report' => [new GetReport()]; + yield 'list reports' => [new ListReports()]; + yield 'delete report' => [new DeleteReport()]; + yield 'get insight' => [new GetInsight()]; + yield 'list insights' => [new ListInsights()]; } } diff --git a/tests/unit/Advisor/Validator/CTAsTest.php b/tests/unit/Advisor/Validator/CTAsTest.php index 5511910072..e0949999d5 100644 --- a/tests/unit/Advisor/Validator/CTAsTest.php +++ b/tests/unit/Advisor/Validator/CTAsTest.php @@ -1,11 +1,13 @@ assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_EPHEMERAL, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_EPHEMERAL, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); $this->assertEquals(\array_merge($scopes, $roleScopes), $decoded->getScopes()); - $this->assertEquals('Ephemeral Key', $decoded->getName()); + $this->assertSame('Ephemeral Key', $decoded->getName()); // Decode ephemeral key with extras $extra = [ @@ -57,14 +59,14 @@ class KeyTest extends TestCase user: new Document(), key: $key, ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_EPHEMERAL, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_EPHEMERAL, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); $this->assertEquals(\array_merge($scopes, $roleScopes), $decoded->getScopes()); - $this->assertEquals('Ephemeral Key', $decoded->getName()); - $this->assertEquals(['metric123'], $decoded->getDisabledMetrics()); + $this->assertSame('Ephemeral Key', $decoded->getName()); + $this->assertSame(['metric123'], $decoded->getDisabledMetrics()); $this->assertEquals(true, $decoded->getHostnameOverride()); $this->assertEquals(true, $decoded->isBannerDisabled()); $this->assertEquals(true, $decoded->isProjectCheckDisabled()); @@ -79,13 +81,13 @@ class KeyTest extends TestCase user: new Document(), key: $invalidKey, ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_EPHEMERAL, $decoded->getType()); - $this->assertEquals(User::ROLE_GUESTS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_EPHEMERAL, $decoded->getType()); + $this->assertSame(User::ROLE_GUESTS, $decoded->getRole()); $this->assertEquals($guestRoleScopes, $decoded->getScopes()); - $this->assertEquals('UNKNOWN', $decoded->getName()); + $this->assertSame('UNKNOWN', $decoded->getName()); // Decode expired ephemeral key $expiredKey = self::generateKey($projectId, $usage, $scopes, maxAge: 1, timestamp: time() - 60); @@ -96,13 +98,13 @@ class KeyTest extends TestCase user: new Document(), key: $expiredKey, ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_EPHEMERAL, $decoded->getType()); - $this->assertEquals(User::ROLE_GUESTS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_EPHEMERAL, $decoded->getType()); + $this->assertSame(User::ROLE_GUESTS, $decoded->getRole()); $this->assertEquals($guestRoleScopes, $decoded->getScopes()); - $this->assertEquals('UNKNOWN', $decoded->getName()); + $this->assertSame('UNKNOWN', $decoded->getName()); // Decode standard key $scopes = ['custom.write']; @@ -119,13 +121,13 @@ class KeyTest extends TestCase user: new Document(), key: 'standard_abcd1234', ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_STANDARD, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_STANDARD, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); $this->assertEquals(\array_merge($scopes, $roleScopes), $decoded->getScopes()); - $this->assertEquals('Standard key', $decoded->getName()); + $this->assertSame('Standard key', $decoded->getName()); // Decode deprecated standard key $scopes = ['custom.write']; @@ -142,13 +144,13 @@ class KeyTest extends TestCase user: new Document(), key: 'abcd1234', ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_STANDARD, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_STANDARD, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); $this->assertEquals(\array_merge($scopes, $roleScopes), $decoded->getScopes()); - $this->assertEquals('Standard key', $decoded->getName()); + $this->assertSame('Standard key', $decoded->getName()); // Decode invalid standard key $scopes = ['custom.write']; @@ -165,13 +167,13 @@ class KeyTest extends TestCase user: new Document(), key: 'standard_efgh5678', ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_STANDARD, $decoded->getType()); - $this->assertEquals(User::ROLE_GUESTS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_STANDARD, $decoded->getType()); + $this->assertSame(User::ROLE_GUESTS, $decoded->getRole()); $this->assertEquals($guestRoleScopes, $decoded->getScopes()); - $this->assertEquals('UNKNOWN', $decoded->getName()); + $this->assertSame('UNKNOWN', $decoded->getName()); // Decode expired standard key $scopes = ['custom.write']; @@ -190,13 +192,13 @@ class KeyTest extends TestCase key: 'standard_abcd1234', ); $this->assertEquals(true, $decoded->isExpired()); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_STANDARD, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_STANDARD, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); $this->assertEquals(\array_merge($scopes, $roleScopes), $decoded->getScopes()); - $this->assertEquals('Standard key', $decoded->getName()); + $this->assertSame('Standard key', $decoded->getName()); // Decode account key $userId = 'user123'; @@ -214,13 +216,13 @@ class KeyTest extends TestCase ]]), key: 'account_abcd1234', ); - $this->assertEquals('', $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals($userId, $decoded->getUserId()); - $this->assertEquals(API_KEY_ACCOUNT, $decoded->getType()); - $this->assertEquals(User::ROLE_USERS, $decoded->getRole()); - $this->assertEquals($scopes, $decoded->getScopes()); - $this->assertEquals('Account key', $decoded->getName()); + $this->assertSame('', $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame($userId, $decoded->getUserId()); + $this->assertSame(API_KEY_ACCOUNT, $decoded->getType()); + $this->assertSame(User::ROLE_USERS, $decoded->getRole()); + $this->assertSame($scopes, $decoded->getScopes()); + $this->assertSame('Account key', $decoded->getName()); // Decode invalid account key $scopes = ['teams.write']; @@ -237,13 +239,13 @@ class KeyTest extends TestCase ]]), key: 'account_efgh5678', ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_ACCOUNT, $decoded->getType()); - $this->assertEquals(User::ROLE_GUESTS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_ACCOUNT, $decoded->getType()); + $this->assertSame(User::ROLE_GUESTS, $decoded->getRole()); $this->assertEquals($guestRoleScopes, $decoded->getScopes()); - $this->assertEquals('UNKNOWN', $decoded->getName()); + $this->assertSame('UNKNOWN', $decoded->getName()); // Decode expired account key $scopes = ['teams.write']; @@ -261,13 +263,13 @@ class KeyTest extends TestCase key: 'account_abcd1234', ); $this->assertEquals(true, $decoded->isExpired()); - $this->assertEquals('', $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals($userId, $decoded->getUserId()); - $this->assertEquals(API_KEY_ACCOUNT, $decoded->getType()); - $this->assertEquals(User::ROLE_USERS, $decoded->getRole()); - $this->assertEquals($scopes, $decoded->getScopes()); - $this->assertEquals('Account key', $decoded->getName()); + $this->assertSame('', $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame($userId, $decoded->getUserId()); + $this->assertSame(API_KEY_ACCOUNT, $decoded->getType()); + $this->assertSame(User::ROLE_USERS, $decoded->getRole()); + $this->assertSame($scopes, $decoded->getScopes()); + $this->assertSame('Account key', $decoded->getName()); // Decode organization key $teamId = 'team123'; @@ -285,13 +287,13 @@ class KeyTest extends TestCase user: new Document(), key: 'organization_abcd1234', ); - $this->assertEquals('', $decoded->getProjectId()); - $this->assertEquals($teamId, $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_ORGANIZATION, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); - $this->assertEquals($scopes, $decoded->getScopes()); - $this->assertEquals('Organization key', $decoded->getName()); + $this->assertSame('', $decoded->getProjectId()); + $this->assertSame($teamId, $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_ORGANIZATION, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($scopes, $decoded->getScopes()); + $this->assertSame('Organization key', $decoded->getName()); // Decode invalid organization key $scopes = ['projects.write']; @@ -308,13 +310,13 @@ class KeyTest extends TestCase user: new Document(), key: 'organization_efgh5678', ); - $this->assertEquals($projectId, $decoded->getProjectId()); - $this->assertEquals('', $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_ORGANIZATION, $decoded->getType()); - $this->assertEquals(User::ROLE_GUESTS, $decoded->getRole()); + $this->assertSame($projectId, $decoded->getProjectId()); + $this->assertSame('', $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_ORGANIZATION, $decoded->getType()); + $this->assertSame(User::ROLE_GUESTS, $decoded->getRole()); $this->assertEquals($guestRoleScopes, $decoded->getScopes()); - $this->assertEquals('UNKNOWN', $decoded->getName()); + $this->assertSame('UNKNOWN', $decoded->getName()); // Decode expired organization key $scopes = ['projects.write']; @@ -332,13 +334,13 @@ class KeyTest extends TestCase key: 'organization_abcd1234', ); $this->assertEquals(true, $decoded->isExpired()); - $this->assertEquals('', $decoded->getProjectId()); - $this->assertEquals($teamId, $decoded->getTeamId()); - $this->assertEquals('', $decoded->getUserId()); - $this->assertEquals(API_KEY_ORGANIZATION, $decoded->getType()); - $this->assertEquals(User::ROLE_KEYS, $decoded->getRole()); - $this->assertEquals($scopes, $decoded->getScopes()); - $this->assertEquals('Organization key', $decoded->getName()); + $this->assertSame('', $decoded->getProjectId()); + $this->assertSame($teamId, $decoded->getTeamId()); + $this->assertSame('', $decoded->getUserId()); + $this->assertSame(API_KEY_ORGANIZATION, $decoded->getType()); + $this->assertSame(User::ROLE_KEYS, $decoded->getRole()); + $this->assertSame($scopes, $decoded->getScopes()); + $this->assertSame('Organization key', $decoded->getName()); } private static function generateKey( diff --git a/tests/unit/Auth/Validator/PasswordDictionaryTest.php b/tests/unit/Auth/Validator/PasswordDictionaryTest.php index 60b5ca7ae3..7de5d83496 100644 --- a/tests/unit/Auth/Validator/PasswordDictionaryTest.php +++ b/tests/unit/Auth/Validator/PasswordDictionaryTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->isValid('1'), false); // to check parent is being called - $this->assertEquals($this->object->isValid('123456'), false); - $this->assertEquals($this->object->isValid('password'), false); - $this->assertEquals($this->object->isValid('myPasswordIsRight'), true); + $this->assertFalse($this->object->isValid('1')); // to check parent is being called + $this->assertFalse($this->object->isValid('123456')); + $this->assertFalse($this->object->isValid('password')); + $this->assertTrue($this->object->isValid('myPasswordIsRight')); $pass = ''; // 256 chars for ($i = 0; $i < 256; $i++) { $pass .= 'p'; } - $this->assertEquals($this->object->isValid($pass), true); + $this->assertTrue($this->object->isValid($pass)); $pass .= 'p'; // 257 chars - $this->assertEquals($this->object->isValid($pass), false); + $this->assertFalse($this->object->isValid($pass)); } } diff --git a/tests/unit/Auth/Validator/PasswordStrengthTest.php b/tests/unit/Auth/Validator/PasswordStrengthTest.php new file mode 100644 index 0000000000..46f75e8145 --- /dev/null +++ b/tests/unit/Auth/Validator/PasswordStrengthTest.php @@ -0,0 +1,61 @@ +assertFalse($validator->isValid('1234567')); + $this->assertTrue($validator->isValid('password')); + } + + public function testConfiguredPolicy(): void + { + $validator = new PasswordStrength([ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ]); + + $this->assertFalse($validator->isValid('Password1!')); + $this->assertFalse($validator->isValid('password123!')); + $this->assertFalse($validator->isValid('PASSWORD123!')); + $this->assertFalse($validator->isValid('PasswordOnly!')); + $this->assertFalse($validator->isValid('Password1234')); + $this->assertTrue($validator->isValid('Password123!')); + $this->assertTrue($validator->isValid('Password123€')); + } + + public function testMinimumCanBeEight(): void + { + $validator = new PasswordStrength([ + 'min' => 8, + ]); + + $this->assertFalse($validator->isValid('1234567')); + $this->assertTrue($validator->isValid('12345678')); + } + + public function testAllowEmpty(): void + { + $validator = new PasswordStrength([ + 'min' => 12, + 'uppercase' => true, + 'lowercase' => true, + 'number' => true, + 'symbols' => true, + ], true); + + $this->assertTrue($validator->isValid('')); + } +} diff --git a/tests/unit/Auth/Validator/PasswordTest.php b/tests/unit/Auth/Validator/PasswordTest.php index 0d84ff3573..5f7c900b0c 100644 --- a/tests/unit/Auth/Validator/PasswordTest.php +++ b/tests/unit/Auth/Validator/PasswordTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->isValid(false), false); - $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid(''), false); - $this->assertEquals($this->object->isValid('1'), false); - $this->assertEquals($this->object->isValid('12'), false); - $this->assertEquals($this->object->isValid('123'), false); - $this->assertEquals($this->object->isValid('1234'), false); - $this->assertEquals($this->object->isValid('12345'), false); - $this->assertEquals($this->object->isValid('123456'), false); - $this->assertEquals($this->object->isValid('1234567'), false); - $this->assertEquals($this->object->isValid('WUnOZcn0piQMN8Mh31xw4KQPF0gcNGVA'), true); + $this->assertFalse($this->object->isValid(false)); + $this->assertFalse($this->object->isValid(null)); + $this->assertFalse($this->object->isValid('')); + $this->assertFalse($this->object->isValid('1')); + $this->assertFalse($this->object->isValid('12')); + $this->assertFalse($this->object->isValid('123')); + $this->assertFalse($this->object->isValid('1234')); + $this->assertFalse($this->object->isValid('12345')); + $this->assertFalse($this->object->isValid('123456')); + $this->assertFalse($this->object->isValid('1234567')); + $this->assertTrue($this->object->isValid('WUnOZcn0piQMN8Mh31xw4KQPF0gcNGVA')); } } diff --git a/tests/unit/Auth/Validator/PersonalDataTest.php b/tests/unit/Auth/Validator/PersonalDataTest.php index 1da5c458c0..7b495dd311 100644 --- a/tests/unit/Auth/Validator/PersonalDataTest.php +++ b/tests/unit/Auth/Validator/PersonalDataTest.php @@ -1,11 +1,13 @@ object = new PersonalData('userId', 'email@example.com', 'name', '+129492323', true); - $this->assertEquals($this->object->isValid('userId'), false); - $this->assertEquals($this->object->isValid('something.userId'), false); - $this->assertEquals($this->object->isValid('userId.something'), false); - $this->assertEquals($this->object->isValid('something.userId.something'), false); + $this->assertFalse($this->object->isValid('userId')); + $this->assertFalse($this->object->isValid('something.userId')); + $this->assertFalse($this->object->isValid('userId.something')); + $this->assertFalse($this->object->isValid('something.userId.something')); - $this->assertEquals($this->object->isValid('email@example.com'), false); - $this->assertEquals($this->object->isValid('something.email@example.com'), false); - $this->assertEquals($this->object->isValid('email@example.com.something'), false); - $this->assertEquals($this->object->isValid('something.email@example.com.something'), false); + $this->assertFalse($this->object->isValid('email@example.com')); + $this->assertFalse($this->object->isValid('something.email@example.com')); + $this->assertFalse($this->object->isValid('email@example.com.something')); + $this->assertFalse($this->object->isValid('something.email@example.com.something')); - $this->assertEquals($this->object->isValid('name'), false); - $this->assertEquals($this->object->isValid('something.name'), false); - $this->assertEquals($this->object->isValid('name.something'), false); - $this->assertEquals($this->object->isValid('something.name.something'), false); + $this->assertFalse($this->object->isValid('name')); + $this->assertFalse($this->object->isValid('something.name')); + $this->assertFalse($this->object->isValid('name.something')); + $this->assertFalse($this->object->isValid('something.name.something')); - $this->assertEquals($this->object->isValid('+129492323'), false); - $this->assertEquals($this->object->isValid('something.+129492323'), false); - $this->assertEquals($this->object->isValid('+129492323.something'), false); - $this->assertEquals($this->object->isValid('something.+129492323.something'), false); + $this->assertFalse($this->object->isValid('+129492323')); + $this->assertFalse($this->object->isValid('something.+129492323')); + $this->assertFalse($this->object->isValid('+129492323.something')); + $this->assertFalse($this->object->isValid('something.+129492323.something')); - $this->assertEquals($this->object->isValid('129492323'), false); - $this->assertEquals($this->object->isValid('something.129492323'), false); - $this->assertEquals($this->object->isValid('129492323.something'), false); - $this->assertEquals($this->object->isValid('something.129492323.something'), false); + $this->assertFalse($this->object->isValid('129492323')); + $this->assertFalse($this->object->isValid('something.129492323')); + $this->assertFalse($this->object->isValid('129492323.something')); + $this->assertFalse($this->object->isValid('something.129492323.something')); - $this->assertEquals($this->object->isValid('email'), false); - $this->assertEquals($this->object->isValid('something.email'), false); - $this->assertEquals($this->object->isValid('email.something'), false); - $this->assertEquals($this->object->isValid('something.email.something'), false); + $this->assertFalse($this->object->isValid('email')); + $this->assertFalse($this->object->isValid('something.email')); + $this->assertFalse($this->object->isValid('email.something')); + $this->assertFalse($this->object->isValid('something.email.something')); /** Test for success */ - $this->assertEquals($this->object->isValid('893pu5egerfsv3rgersvd'), true); + $this->assertTrue($this->object->isValid('893pu5egerfsv3rgersvd')); } public function testNotStrict(): void { $this->object = new PersonalData('userId', 'email@example.com', 'name', '+129492323', false); - $this->assertEquals($this->object->isValid('userId'), false); - $this->assertEquals($this->object->isValid('USERID'), false); - $this->assertEquals($this->object->isValid('something.USERID'), false); - $this->assertEquals($this->object->isValid('USERID.something'), false); - $this->assertEquals($this->object->isValid('something.USERID.something'), false); + $this->assertFalse($this->object->isValid('userId')); + $this->assertFalse($this->object->isValid('USERID')); + $this->assertFalse($this->object->isValid('something.USERID')); + $this->assertFalse($this->object->isValid('USERID.something')); + $this->assertFalse($this->object->isValid('something.USERID.something')); - $this->assertEquals($this->object->isValid('email@example.com'), false); - $this->assertEquals($this->object->isValid('EMAIL@EXAMPLE.COM'), false); - $this->assertEquals($this->object->isValid('something.EMAIL@EXAMPLE.COM'), false); - $this->assertEquals($this->object->isValid('EMAIL@EXAMPLE.COM.something'), false); - $this->assertEquals($this->object->isValid('something.EMAIL@EXAMPLE.COM.something'), false); + $this->assertFalse($this->object->isValid('email@example.com')); + $this->assertFalse($this->object->isValid('EMAIL@EXAMPLE.COM')); + $this->assertFalse($this->object->isValid('something.EMAIL@EXAMPLE.COM')); + $this->assertFalse($this->object->isValid('EMAIL@EXAMPLE.COM.something')); + $this->assertFalse($this->object->isValid('something.EMAIL@EXAMPLE.COM.something')); - $this->assertEquals($this->object->isValid('name'), false); - $this->assertEquals($this->object->isValid('NAME'), false); - $this->assertEquals($this->object->isValid('something.NAME'), false); - $this->assertEquals($this->object->isValid('NAME.something'), false); - $this->assertEquals($this->object->isValid('something.NAME.something'), false); + $this->assertFalse($this->object->isValid('name')); + $this->assertFalse($this->object->isValid('NAME')); + $this->assertFalse($this->object->isValid('something.NAME')); + $this->assertFalse($this->object->isValid('NAME.something')); + $this->assertFalse($this->object->isValid('something.NAME.something')); - $this->assertEquals($this->object->isValid('+129492323'), false); - $this->assertEquals($this->object->isValid('129492323'), false); + $this->assertFalse($this->object->isValid('+129492323')); + $this->assertFalse($this->object->isValid('129492323')); - $this->assertEquals($this->object->isValid('email'), false); - $this->assertEquals($this->object->isValid('EMAIL'), false); - $this->assertEquals($this->object->isValid('something.EMAIL'), false); - $this->assertEquals($this->object->isValid('EMAIL.something'), false); - $this->assertEquals($this->object->isValid('something.EMAIL.something'), false); + $this->assertFalse($this->object->isValid('email')); + $this->assertFalse($this->object->isValid('EMAIL')); + $this->assertFalse($this->object->isValid('something.EMAIL')); + $this->assertFalse($this->object->isValid('EMAIL.something')); + $this->assertFalse($this->object->isValid('something.EMAIL.something')); } } diff --git a/tests/unit/Auth/Validator/PhoneTest.php b/tests/unit/Auth/Validator/PhoneTest.php index b7730641c3..4392d960e6 100644 --- a/tests/unit/Auth/Validator/PhoneTest.php +++ b/tests/unit/Auth/Validator/PhoneTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->isValid(false), false); - $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid(''), false); - $this->assertEquals($this->object->isValid('+1'), false); - $this->assertEquals($this->object->isValid('+14'), false); - $this->assertEquals($this->object->isValid('+141'), false); - $this->assertEquals($this->object->isValid('+1415'), false); - $this->assertEquals($this->object->isValid('+14155'), false); - $this->assertEquals($this->object->isValid('+141555'), false); - $this->assertEquals($this->object->isValid('8989829304'), false); - $this->assertEquals($this->object->isValid('786-307-3615'), false); - $this->assertEquals($this->object->isValid('+16308A520397'), false); - $this->assertEquals($this->object->isValid('+0415553452342'), false); - $this->assertEquals($this->object->isValid('+14 155 5524564'), false); - $this->assertEquals($this->object->isValid('+1415555245634543'), false); - $this->assertEquals($this->object->isValid('+8020000000'), false); // when country code is not present - $this->assertEquals($this->object->isValid(+14155552456), false); + $this->assertFalse($this->object->isValid(false)); + $this->assertFalse($this->object->isValid(null)); + $this->assertFalse($this->object->isValid('')); + $this->assertFalse($this->object->isValid('+1')); + $this->assertFalse($this->object->isValid('+14')); + $this->assertFalse($this->object->isValid('+141')); + $this->assertFalse($this->object->isValid('+1415')); + $this->assertFalse($this->object->isValid('+14155')); + $this->assertFalse($this->object->isValid('+141555')); + $this->assertFalse($this->object->isValid('8989829304')); + $this->assertFalse($this->object->isValid('786-307-3615')); + $this->assertFalse($this->object->isValid('+16308A520397')); + $this->assertFalse($this->object->isValid('+0415553452342')); + $this->assertFalse($this->object->isValid('+14 155 5524564')); + $this->assertFalse($this->object->isValid('+1415555245634543')); + $this->assertFalse($this->object->isValid('+8020000000')); // when country code is not present + $this->assertFalse($this->object->isValid(+14155552456)); - $this->assertEquals($this->object->isValid('+1415555'), true); - $this->assertEquals($this->object->isValid('+14155552'), true); - $this->assertEquals($this->object->isValid('+141555526'), true); - $this->assertEquals($this->object->isValid('+16308520394'), true); - $this->assertEquals($this->object->isValid('+163085205339'), true); - $this->assertEquals($this->object->isValid('+5511552563253'), true); - $this->assertEquals($this->object->isValid('+55115525632534'), true); - $this->assertEquals($this->object->isValid('+919367788755111'), true); + $this->assertTrue($this->object->isValid('+1415555')); + $this->assertTrue($this->object->isValid('+14155552')); + $this->assertTrue($this->object->isValid('+141555526')); + $this->assertTrue($this->object->isValid('+16308520394')); + $this->assertTrue($this->object->isValid('+163085205339')); + $this->assertTrue($this->object->isValid('+5511552563253')); + $this->assertTrue($this->object->isValid('+55115525632534')); + $this->assertTrue($this->object->isValid('+919367788755111')); } } diff --git a/tests/unit/Detector/DetectorTest.php b/tests/unit/Detector/DetectorTest.php index 12a803de8c..7d7383ba5a 100644 --- a/tests/unit/Detector/DetectorTest.php +++ b/tests/unit/Detector/DetectorTest.php @@ -1,11 +1,13 @@ assertCount(16, $this->object->getServices()); - $this->assertEquals('appwrite', $this->object->getService('appwrite')->getContainerName()); - $this->assertEquals('', $this->object->getService('appwrite')->getImageVersion()); + $this->assertSame('appwrite', $this->object->getService('appwrite')->getContainerName()); + $this->assertSame('', $this->object->getService('appwrite')->getImageVersion()); $this->assertEquals('3.6', $this->object->getService('traefik')->getImageVersion()); - $this->assertEquals(['2080' => '80', '2443' => '443', '8080' => '8080'], $this->object->getService('traefik')->getPorts()); + $this->assertSame(['2080' => '80', '2443' => '443', '8080' => '8080'], $this->object->getService('traefik')->getPorts()); } public function testNetworks(): void diff --git a/tests/unit/Docker/EnvTest.php b/tests/unit/Docker/EnvTest.php index e6c9b8cadf..4f11d31947 100644 --- a/tests/unit/Docker/EnvTest.php +++ b/tests/unit/Docker/EnvTest.php @@ -1,12 +1,14 @@ object->setVar('_APP_TEST', 'value4'); - $this->assertEquals('value1', $this->object->getVar('_APP_X')); - $this->assertEquals('value2', $this->object->getVar('_APP_Y')); - $this->assertEquals('value3', $this->object->getVar('_APP_Z')); - $this->assertEquals('value5=', $this->object->getVar('_APP_W')); - $this->assertEquals('value4', $this->object->getVar('_APP_TEST')); + $this->assertSame('value1', $this->object->getVar('_APP_X')); + $this->assertSame('value2', $this->object->getVar('_APP_Y')); + $this->assertSame('value3', $this->object->getVar('_APP_Z')); + $this->assertSame('value5=', $this->object->getVar('_APP_W')); + $this->assertSame('value4', $this->object->getVar('_APP_TEST')); } public function testExport(): void { - $this->assertEquals("_APP_X=value1 + $this->assertSame("_APP_X=value1 _APP_Y=value2 _APP_Z=value3 _APP_W=value5= diff --git a/tests/unit/Event/EventTest.php b/tests/unit/Event/EventTest.php index 471dd5ad08..6f15c80b9a 100644 --- a/tests/unit/Event/EventTest.php +++ b/tests/unit/Event/EventTest.php @@ -1,5 +1,7 @@ assertEquals($this->queue, $this->object->getQueue()); + $this->assertSame($this->queue, $this->object->getQueue()); $this->object->setQueue('demo'); - $this->assertEquals('demo', $this->object->getQueue()); + $this->assertSame('demo', $this->object->getQueue()); $this->object->setQueue($this->queue); } public function testClass(): void { - $this->assertEquals('TestsV1', $this->object->getClass()); + $this->assertSame('TestsV1', $this->object->getClass()); $this->object->setClass('TestsV2'); - $this->assertEquals('TestsV2', $this->object->getClass()); + $this->assertSame('TestsV2', $this->object->getClass()); $this->object->setClass('TestsV1'); } diff --git a/tests/unit/Event/Validator/EventValidatorTest.php b/tests/unit/Event/Validator/EventValidatorTest.php index 6885d20bfb..32f4ab22a7 100644 --- a/tests/unit/Event/Validator/EventValidatorTest.php +++ b/tests/unit/Event/Validator/EventValidatorTest.php @@ -1,11 +1,13 @@ 'proj456', 'sitesDomain' => 'appwrite.network' ]); - $this->assertStringNotContainsString('/', $domain); + $this->assertStringNotContainsString('/', (string) $domain); $this->assertStringStartsWith('branch-feature-test-', $domain); $this->assertStringEndsWith('.appwrite.network', $domain); diff --git a/tests/unit/Functions/BuildsTest.php b/tests/unit/Functions/BuildsTest.php new file mode 100644 index 0000000000..b757856c83 --- /dev/null +++ b/tests/unit/Functions/BuildsTest.php @@ -0,0 +1,94 @@ +builds = new Builds(); + } + + public function testSiteCommandIncludesFrameworkAndDeploymentCommands(): void + { + Config::setParam('frameworks', [ + 'astro' => [ + 'envCommand' => 'cp .env.example .env', + 'bundleCommand' => 'npm run bundle', + ], + ]); + + $resource = new Document([ + '$collection' => 'sites', + 'framework' => 'astro', + ]); + $deployment = new Document([ + 'buildCommands' => 'npm run build', + ]); + + $this->assertSame( + 'cp .env.example .env && npm run build && npm run bundle', + $this->callBuilds('getCommand', $resource, $deployment) + ); + } + + public function testSiteBuildCommandAppendsDetectionFileListing(): void + { + $command = $this->callBuilds('prepareSiteBuildCommand', 'npm run build', './dist folder'); + + $this->assertStringStartsWith('npm run build && echo "{APPWRITE_DETECTION_SEPARATOR_START}"', $command); + $this->assertStringContainsString('cd /usr/local/build && cd \'./dist folder\'', (string) $command); + $this->assertStringContainsString('find . -name \'node_modules\' -prune -o -type f -print', (string) $command); + $this->assertStringEndsWith('echo "{APPWRITE_DETECTION_SEPARATOR_END}"', $command); + } + + public function testSiteBuildCommandCanBeOnlyDetectionFileListing(): void + { + $command = $this->callBuilds('prepareSiteBuildCommand', '', ''); + + $this->assertStringStartsWith('echo "{APPWRITE_DETECTION_SEPARATOR_START}"', $command); + $this->assertStringContainsString('cd /usr/local/build && find .', (string) $command); + } + + public function testSplitSiteDetectionLogsRemovesDetectionBlock(): void + { + $result = $this->callBuilds( + 'splitSiteDetectionLogs', + "before\n{APPWRITE_DETECTION_SEPARATOR_START}\n./index.html\n./server/entry.mjs\n{APPWRITE_DETECTION_SEPARATOR_END}\nafter\n" + ); + + $this->assertSame("before\n\nafter\n", $result['logs']); + $this->assertSame("\n./index.html\n./server/entry.mjs\n", $result['detectionLogs']); + } + + public function testDetectSiteRenderingFindsStaticFallbackFile(): void + { + $detection = $this->callBuilds('detectSiteRendering', 'other', "./main.html\n"); + + $this->assertSame('static', $detection->getName()); + $this->assertSame('main.html', $detection->getFallbackFile()); + } + + public function testDetectSiteRenderingFindsAstroSSR(): void + { + $detection = $this->callBuilds('detectSiteRendering', 'astro', "./client/index.html\n./server/entry.mjs\n"); + + $this->assertSame('ssr', $detection->getName()); + $this->assertNull($detection->getFallbackFile()); + } + + private function callBuilds(string $method, mixed ...$arguments): mixed + { + return (new ReflectionMethod($this->builds, $method))->invoke($this->builds, ...$arguments); + } +} diff --git a/tests/unit/Functions/Validator/HeadersTest.php b/tests/unit/Functions/Validator/HeadersTest.php index 563131d480..9cc48c9bb3 100644 --- a/tests/unit/Functions/Validator/HeadersTest.php +++ b/tests/unit/Functions/Validator/HeadersTest.php @@ -1,11 +1,13 @@ 'headerValue', ]; - $this->assertEquals($this->object->isValid($headers), true); + $this->assertTrue($this->object->isValid($headers)); $headers = [ 'headerKey' => 'headerValue', 'x-appwrite-key' => 'headerValue', ]; - $this->assertEquals($this->object->isValid($headers), false); + $this->assertFalse($this->object->isValid($headers)); $headers = [ 'headerKey' => 'headerValue', 'headerKey2' => 'headerValue2', ]; - $this->assertEquals($this->object->isValid($headers), true); + $this->assertTrue($this->object->isValid($headers)); $headers = [ 'headerKey' => 'headerValue', 'x-appwrite-project' => 'headerValue', 'headerKey2' => 'headerValue2', ]; - $this->assertEquals($this->object->isValid($headers), false); + $this->assertFalse($this->object->isValid($headers)); $headers = [ 'header/////Key' => 'headerValue', ]; - $this->assertEquals($this->object->isValid($headers), false); + $this->assertFalse($this->object->isValid($headers)); $headers = [ 'Content-Type' => 'application/json', 'X-Custom-Header' => 'value' ]; - $this->assertEquals($this->object->isValid($headers), true); + $this->assertTrue($this->object->isValid($headers)); $headers = [ 'X-Custom-Header_With-Hyphens_and_Underscores' => 'value' diff --git a/tests/unit/General/CollectionsTest.php b/tests/unit/General/CollectionsTest.php index 73a9ccd0c2..d90905abda 100644 --- a/tests/unit/General/CollectionsTest.php +++ b/tests/unit/General/CollectionsTest.php @@ -1,10 +1,12 @@ assertEquals(1, $occurrences); + $this->assertSame(1, $occurrences); } } } diff --git a/tests/unit/General/ExtensionsTest.php b/tests/unit/General/ExtensionsTest.php index f415816e56..e78e13a169 100644 --- a/tests/unit/General/ExtensionsTest.php +++ b/tests/unit/General/ExtensionsTest.php @@ -1,10 +1,12 @@ response->getModel(Response::MODEL_TABLE); $type = Mapper::model(\ucfirst($model->getType())); $this->assertInstanceOf(NamedType::class, $type); - $this->assertEquals('Table', $type->name()); + $this->assertSame('Table', $type->name()); } } diff --git a/tests/unit/Messaging/MessagingChannelsTest.php b/tests/unit/Messaging/MessagingChannelsTest.php index af6592ef92..c2769226e2 100644 --- a/tests/unit/Messaging/MessagingChannelsTest.php +++ b/tests/unit/Messaging/MessagingChannelsTest.php @@ -1,5 +1,7 @@ assertStringEndsWith($index, $receiverId); + $this->assertStringEndsWith((string) $index, (string) $receiverId); } } } @@ -238,7 +240,7 @@ class MessagingChannelsTest extends TestCase /** * Making sure the right clients receive the event. */ - $this->assertStringEndsWith($index, $receiverId); + $this->assertStringEndsWith((string) $index, (string) $receiverId); } } } @@ -272,7 +274,7 @@ class MessagingChannelsTest extends TestCase /** * Making sure the right clients receive the event. */ - $this->assertStringEndsWith($index, $receiver); + $this->assertStringEndsWith((string) $index, (string) $receiver); } } } @@ -307,7 +309,7 @@ class MessagingChannelsTest extends TestCase /** * Making sure the right clients receive the event. */ - $this->assertStringEndsWith($index, $receiver); + $this->assertStringEndsWith((string) $index, (string) $receiver); } $role = empty($index % 2) @@ -340,7 +342,7 @@ class MessagingChannelsTest extends TestCase /** * Making sure the right clients receive the event. */ - $this->assertStringEndsWith($index, $receiver); + $this->assertStringEndsWith((string) $index, (string) $receiver); } } } diff --git a/tests/unit/Messaging/MessagingFanoutTest.php b/tests/unit/Messaging/MessagingFanoutTest.php new file mode 100644 index 0000000000..78172a5a0e --- /dev/null +++ b/tests/unit/Messaging/MessagingFanoutTest.php @@ -0,0 +1,810 @@ + 'provider1', + '$sequence' => '1', + 'enabled' => true, + 'type' => MESSAGE_TYPE_EMAIL, + 'provider' => 'mock', + 'name' => 'Mock Email', + 'credentials' => [], + 'options' => [ + 'fromName' => 'Appwrite', + 'fromEmail' => 'noreply@example.com', + ], + ]); + } + + private function message(): Document + { + return new Document([ + '$id' => 'message1', + '$sequence' => '1', + 'providerType' => MESSAGE_TYPE_EMAIL, + 'topics' => ['topic1'], + 'targets' => [], + 'users' => [], + 'data' => [ + 'subject' => 'Hello', + 'content' => 'World', + 'html' => false, + ], + ]); + } + + /** + * Invoke the worker's private {@see Messaging::retrySend()} for an email batch. + * + * @param array $batch + * @return array{delivered: int, errors: array} + */ + private function retrySend(array $batch, EmailAdapter $adapter, Database $database): array + { + $worker = new TestableMessaging(); + $method = new \ReflectionMethod(Messaging::class, 'retrySend'); + + $device = new Local(\sys_get_temp_dir()); + $project = new Document(['$id' => 'project1', '$sequence' => '1']); + + /** @var array{delivered: int, errors: array} $result */ + $result = $method->invoke( + $worker, + $batch, + $this->message(), + $this->provider(), + MESSAGE_TYPE_EMAIL, + $adapter, + $database, + $device, + $project + ); + + return $result; + } + + public function testIsRetryableErrorMatchesTransientFailures(): void + { + $worker = new TestableMessaging(); + $method = new \ReflectionMethod(Messaging::class, 'isRetryableError'); + + $retryable = [ + 'Throttling', + 'rate exceeded', + 'Rate limit reached', + 'Too Many Requests', + '429 Too Many Requests', + 'quota exceeded', + 'Service Unavailable', + '503 Service Unavailable', + 'Connection timed out', + 'Request timeout', + 'Service temporarily unavailable', + ]; + + foreach ($retryable as $error) { + $this->assertTrue( + $method->invoke($worker, $error), + "Expected '{$error}' to be classified as retryable" + ); + } + + $permanent = [ + 'invalid recipient', + 'Mailbox does not exist', + 'Authentication failed', + 'Expired device token', + ]; + + foreach ($permanent as $error) { + $this->assertFalse( + $method->invoke($worker, $error), + "Expected '{$error}' to be classified as permanent" + ); + } + + $this->assertFalse($method->invoke($worker, null), 'A null error must never be retryable'); + $this->assertFalse($method->invoke($worker, ''), 'An empty error must never be retryable'); + } + + public function testThrottledBatchIsRetriedThenFullyDelivered(): void + { + $batch = ['user1@example.com', 'user2@example.com', 'user3@example.com', 'user4@example.com', 'user5@example.com']; + + // First attempt throttles every recipient; the script then runs out so the second attempt succeeds. + $adapter = new ScriptedEmailAdapter([ + static fn (string $recipient): string => 'Rate limit exceeded, please retry', + ]); + + $result = $this->retrySend($batch, $adapter, new InMemoryDatabase()); + + // Retried exactly once, then everyone delivered with no double-counting and no terminal errors. + $this->assertSame(2, $adapter->sendCalls, 'Throttled batch must be retried once'); + $this->assertSame(\count($batch), $result['delivered']); + $this->assertEmpty($result['errors']); + + // Both attempts targeted the full recipient set (none had succeeded on the first attempt). + $this->assertSame($batch, $adapter->recipientsPerCall[0]); + $this->assertSame($batch, $adapter->recipientsPerCall[1]); + } + + public function testRetryTargetsOnlyThrottledRecipients(): void + { + $batch = ['user1@example.com', 'user2@example.com', 'user3@example.com', 'user4@example.com', 'user5@example.com']; + + // user2@ and user4@ throttle on the first attempt; everyone else succeeds. The second attempt has no + // script step, so the two retried recipients then succeed. + $throttled = ['user2@example.com', 'user4@example.com']; + $adapter = new ScriptedEmailAdapter([ + static fn (string $recipient): ?string => \in_array($recipient, $throttled, true) + ? 'Too Many Requests' + : null, + ]); + + $result = $this->retrySend($batch, $adapter, new InMemoryDatabase()); + + $this->assertSame(2, $adapter->sendCalls, 'A partially throttled batch must be retried once'); + + // The retry must re-send to EXACTLY the throttled recipients — never the ones already delivered. + $this->assertSame($throttled, $adapter->recipientsPerCall[1]); + + // Every recipient is ultimately delivered and counted exactly once. + $this->assertSame(\count($batch), $result['delivered']); + $this->assertEmpty($result['errors']); + } + + public function testNonRetryableFailureIsNotRetried(): void + { + $batch = ['user1@example.com', 'user2@example.com', 'user3@example.com']; + + // user1@ permanently fails with a non-retryable error; the rest succeed. + $adapter = new ScriptedEmailAdapter([ + static fn (string $recipient): ?string => $recipient === 'user1@example.com' + ? 'Invalid recipient address' + : null, + ]); + + $result = $this->retrySend($batch, $adapter, new InMemoryDatabase()); + + // A permanent failure is recorded immediately, never retried. + $this->assertSame(1, $adapter->sendCalls, 'Non-retryable failures must not trigger a retry'); + $this->assertSame(\count($batch) - 1, $result['delivered']); + $this->assertCount(1, $result['errors']); + $this->assertStringContainsString('user1@example.com', $result['errors'][0]); + $this->assertStringContainsString('Invalid recipient address', $result['errors'][0]); + } + + public function testExhaustedRetriesRecordTerminalFailure(): void + { + $batch = ['user1@example.com', 'user2@example.com']; + + // Every attempt throttles, for more steps than MESSAGE_SEND_MAX_RETRIES, so retries are exhausted. + $script = \array_fill( + 0, + MESSAGE_SEND_MAX_RETRIES + 2, + static fn (string $recipient): string => 'Service unavailable, throttled' + ); + $adapter = new ScriptedEmailAdapter($script); + + $result = $this->retrySend($batch, $adapter, new InMemoryDatabase()); + + // The batch is attempted exactly MESSAGE_SEND_MAX_RETRIES times, then the still-throttled recipients + // become terminal failures with nothing delivered. + $this->assertSame(MESSAGE_SEND_MAX_RETRIES, $adapter->sendCalls, 'Attempts must be capped at MESSAGE_SEND_MAX_RETRIES'); + $this->assertSame(0, $result['delivered']); + $this->assertCount(\count($batch), $result['errors']); + } + + public function testDeliveryErrorsAreCappedWhileDeliveredCountIsExact(): void + { + // More failing recipients than the retained-error cap, plus a known number of successes, so the + // delivered tally stays exact even though the error list is truncated. + $failingCount = MESSAGE_DELIVERY_ERRORS_LIMIT + 20; + $succeedingCount = 100; + + $batch = []; + for ($i = 1; $i <= $failingCount; $i++) { + $batch[] = "fail{$i}@example.com"; + } + for ($i = 1; $i <= $succeedingCount; $i++) { + $batch[] = "ok{$i}@example.com"; + } + + // Permanent (non-retryable) failure for every "fail*" recipient; everyone else is delivered. + $adapter = new ScriptedEmailAdapter([ + static fn (string $recipient): ?string => \str_starts_with($recipient, 'fail') + ? 'Invalid recipient address' + : null, + ]); + + $result = $this->retrySend($batch, $adapter, new InMemoryDatabase()); + + // Errors are capped, but the delivered count reflects every success exactly. + $this->assertCount(MESSAGE_DELIVERY_ERRORS_LIMIT, $result['errors'], 'Delivery errors must be capped'); + $this->assertSame($succeedingCount, $result['delivered'], 'Delivered count stays exact despite the error cap'); + $this->assertSame(1, $adapter->sendCalls, 'Non-retryable failures must not trigger a retry'); + } + + public function testExpiredTokenCleanupFailureDoesNotCorruptAccounting(): void + { + $batch = ['user1@example.com', 'user2@example.com', 'user3@example.com']; + + // The cleanup path always throws, but the worker must isolate it: the send result is what's accounted. + $database = new ExpiredTokenCleanupFailingDatabase(); + + // user1@ comes back with an expired device token (triggering cleanup, which then throws); the other + // two recipients are delivered. The expired-token error is terminal, never retryable. + $adapter = new ScriptedEmailAdapter([ + static fn (string $recipient): ?string => $recipient === 'user1@example.com' + ? 'Expired device token' + : null, + ]); + + $result = $this->retrySend($batch, $adapter, $database); + + // The worker reached the cleanup (so the isolation is genuinely exercised) and it threw. + $this->assertGreaterThan(0, $database->targetUpdateAttempts, 'Expired-token cleanup must have been attempted'); + + // The send was attempted exactly once: a thrown cleanup must not look like a transient send failure + // and must not trigger a retry. + $this->assertSame(1, $adapter->sendCalls, 'Cleanup failure must not trigger a send retry'); + + // Accounting reflects the send result, not the cleanup throw: two delivered, one terminal failure. + $this->assertSame(\count($batch) - 1, $result['delivered']); + + // The recorded error is the provider's expired-token failure for the real recipient — proving the + // database exception was swallowed rather than misattributed as the send error. + $this->assertCount(1, $result['errors']); + $this->assertStringContainsString('user1@example.com', $result['errors'][0]); + $this->assertStringContainsString('Expired device token', $result['errors'][0]); + $this->assertStringNotContainsString('Transient database error', $result['errors'][0]); + } + + public function testRecipientsArePaginatedWithoutSubqueryFilter(): void + { + // Always span several pages regardless of the configured page size, so cursor pagination is exercised. + $count = MESSAGE_RECIPIENTS_PAGE_SIZE * 2 + 500; + $data = $this->topicDataset($count); + $database = new RecordingDatabase($data['subscribers'], $data['targets']); + + $identifiers = $this->collectStream($database, topicIds: ['topic1']); + + $topicReads = \array_values(\array_filter($database->findCalls, fn ($call) => $call['collection'] === 'topics')); + $subscriberReads = \array_values(\array_filter($database->findCalls, fn ($call) => $call['collection'] === 'subscribers')); + + // The topic's `targets` attribute (the subQueryTopicTargets filter) is never materialized: topics are + // only read with a $sequence projection, and recipients come from the subscribers collection instead. + $this->assertNotEmpty($topicReads); + foreach ($topicReads as $call) { + $this->assertNotContains('targets', $this->selectFields($call['queries']), 'Topic read must not select the targets subquery attribute'); + } + + // Subscribers are walked in bounded pages via cursorAfter; no query ever requests a runaway page size. + $expectedPages = (int) \ceil($count / MESSAGE_RECIPIENTS_PAGE_SIZE); + $this->assertCount($expectedPages, $subscriberReads); + + foreach ($subscriberReads as $index => $call) { + $this->assertSame(MESSAGE_RECIPIENTS_PAGE_SIZE, $this->limitOf($call['queries'])); + $this->assertSame('100', $this->topicInternalIdOf($call['queries']), 'Subscribers must be filtered by the topic internal id'); + + if ($index === 0) { + $this->assertFalse($this->hasCursor($call['queries']), 'First page must not carry a cursor'); + } else { + $this->assertTrue($this->hasCursor($call['queries']), 'Subsequent pages must paginate with cursorAfter'); + } + } + + // No query in the whole stream issues a runaway (>= 1,000,000) limit. + foreach ($database->findCalls as $call) { + $this->assertLessThan(1_000_000, $this->limitOf($call['queries']), 'No query may request a million-row page'); + } + + // The duplicate identifier collapses: one row per distinct subscriber identifier resolved. + $this->assertCount($count, $identifiers); + for ($i = 1; $i <= $count; $i++) { + $this->assertArrayHasKey("user{$i}@example.com", $identifiers); + } + } + + public function testStreamDeduplicatesIdentifiersWithinPage(): void + { + // Two subscribers in a single page resolve to targets sharing one identifier; the page must collapse + // them to a single recipient entry. + $subscribers = [ + new Document(['$id' => 'sub1', '$sequence' => '1', 'topicInternalId' => '100', 'targetInternalId' => '1', 'providerType' => MESSAGE_TYPE_EMAIL]), + new Document(['$id' => 'sub2', '$sequence' => '2', 'topicInternalId' => '100', 'targetInternalId' => '2', 'providerType' => MESSAGE_TYPE_EMAIL]), + ]; + $targets = [ + '1' => new Document(['$id' => 'target1', '$sequence' => '1', 'providerId' => null, 'identifier' => 'dup@example.com', 'providerType' => MESSAGE_TYPE_EMAIL]), + '2' => new Document(['$id' => 'target2', '$sequence' => '2', 'providerId' => null, 'identifier' => 'dup@example.com', 'providerType' => MESSAGE_TYPE_EMAIL]), + ]; + $database = new RecordingDatabase($subscribers, $targets); + + $pages = $this->collectPages($database, topicIds: ['topic1']); + + $this->assertCount(1, $pages, 'A single subscriber page yields a single grouped result'); + $providerId = $this->provider()->getId(); + $this->assertArrayHasKey($providerId, $pages[0]); + $this->assertSame(['dup@example.com'], \array_keys($pages[0][$providerId]), 'Duplicate identifiers must collapse to one'); + } + + public function testStreamResolvesUsersAndDirectTargets(): void + { + $userTargets = [ + new Document(['$id' => 'utarget1', '$sequence' => '10', 'providerId' => null, 'identifier' => 'byuser@example.com', 'providerType' => MESSAGE_TYPE_EMAIL]), + ]; + $directTargets = [ + new Document(['$id' => 'dtarget1', '$sequence' => '20', 'providerId' => null, 'identifier' => 'bytarget@example.com', 'providerType' => MESSAGE_TYPE_EMAIL]), + ]; + $database = new RecordingDatabase([], [], $userTargets, $directTargets); + + $identifiers = $this->collectStream($database, userIds: ['user-a'], targetIds: ['target-b']); + + // No topics in play: only the user and direct-target queries run, and both identifiers resolve. + $this->assertSame([], \array_values(\array_filter($database->findCalls, fn ($call) => $call['collection'] === 'topics'))); + $this->assertArrayHasKey('byuser@example.com', $identifiers); + $this->assertArrayHasKey('bytarget@example.com', $identifiers); + $this->assertCount(2, $identifiers); + } + + /** + * Build a topic-backed dataset: $count subscribers, each pointing at one email target. A single identifier + * is duplicated so per-page dedup is exercised when the dataset fits in one page. + * + * @return array{subscribers: array, targets: array} + */ + private function topicDataset(int $count): array + { + $subscribers = []; + $targets = []; + + for ($i = 1; $i <= $count; $i++) { + $sequence = (string) $i; + $subscribers[] = new Document([ + '$id' => 'sub' . $i, + '$sequence' => $sequence, + 'topicInternalId' => '100', + 'targetInternalId' => $sequence, + 'providerType' => MESSAGE_TYPE_EMAIL, + ]); + $targets[$sequence] = new Document([ + '$id' => 'target' . $i, + '$sequence' => $sequence, + 'providerId' => null, + 'identifier' => "user{$i}@example.com", + 'providerType' => MESSAGE_TYPE_EMAIL, + ]); + } + + return ['subscribers' => $subscribers, 'targets' => $targets]; + } + + /** + * Drive {@see Messaging::streamRecipients()} and merge every yielded page into a single identifier map. + * + * @param array $topicIds + * @param array $userIds + * @param array $targetIds + * @return array + */ + private function collectStream( + RecordingDatabase $database, + array $topicIds = [], + array $userIds = [], + array $targetIds = [] + ): array { + $identifiers = []; + + foreach ($this->collectPages($database, $topicIds, $userIds, $targetIds) as $page) { + foreach ($page as $perProvider) { + foreach ($perProvider as $identifier => $_) { + $identifiers[$identifier] = null; + } + } + } + + return $identifiers; + } + + /** + * @param array $topicIds + * @param array $userIds + * @param array $targetIds + * @return array>> + */ + private function collectPages( + RecordingDatabase $database, + array $topicIds = [], + array $userIds = [], + array $targetIds = [] + ): array { + $method = new \ReflectionMethod(Messaging::class, 'streamRecipients'); + $worker = new TestableMessaging(); + + /** @var \Generator>> $generator */ + $generator = $method->invoke( + $worker, + $database, + $topicIds, + $userIds, + $targetIds, + MESSAGE_TYPE_EMAIL, + $this->provider() + ); + + return \iterator_to_array($generator, false); + } + + /** + * @param array $queries + * @return array + */ + private function selectFields(array $queries): array + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_SELECT) { + return $query->getValues(); + } + } + + return []; + } + + /** + * @param array $queries + */ + private function limitOf(array $queries): int + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_LIMIT) { + return (int) ($query->getValues()[0] ?? 0); + } + } + + return 0; + } + + /** + * @param array $queries + */ + private function hasCursor(array $queries): bool + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_CURSOR_AFTER) { + return true; + } + } + + return false; + } + + /** + * @param array $queries + */ + private function topicInternalIdOf(array $queries): ?string + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_EQUAL && $query->getAttribute() === 'topicInternalId') { + return (string) ($query->getValues()[0] ?? null); + } + } + + return null; + } +} + +/** + * Worker subclass that zeroes the retry backoff so the throttle/retry tests stay instant. The worker already + * skips a non-positive delay, so no coroutine sleep is ever reached. + */ +class TestableMessaging extends Messaging +{ + protected function retryDelay(): float + { + return 0.0; + } +} + +/** + * Email adapter double whose per-attempt outcome is scripted. Each {@see process()} call records the exact + * `to` recipients it received and consults the next scripted step, which either throws (simulating a + * connection-level provider error) or returns a per-recipient success/failure verdict. When the script runs + * out, every recipient succeeds — modelling a provider that has stopped throttling. + */ +class ScriptedEmailAdapter extends EmailAdapter +{ + public int $sendCalls = 0; + + /** + * @var array> Recipient email lists captured per {@see process()} call, in call order. + */ + public array $recipientsPerCall = []; + + /** + * @param array<\Throwable|(callable(string): ?string)> $script One step per attempt. A Throwable is thrown + * for that attempt; a callable returns an error string for a failing recipient or null for success. + */ + public function __construct(private readonly array $script = []) + { + } + + public function getName(): string + { + return 'ScriptedEmail'; + } + + public function getMaxMessagesPerRequest(): int + { + return 1000; + } + + /** + * @param EmailMessage $message + * @return array{deliveredTo: int, type: string, results: array>} + */ + protected function process(EmailMessage $message): array + { + $recipients = \array_map(static fn (array $entry): string => $entry['email'], $message->getTo()); + $this->recipientsPerCall[] = $recipients; + + $step = $this->script[$this->sendCalls] ?? null; + $this->sendCalls++; + + if ($step instanceof \Throwable) { + throw $step; + } + + $response = new Response($this->getType()); + $delivered = 0; + + foreach ($recipients as $recipient) { + $error = \is_callable($step) ? $step($recipient) : null; + + if ($error === null) { + $delivered++; + $response->addResult($recipient); + } else { + $response->addResult($recipient, $error); + } + } + + $response->setDeliveredTo($delivered); + + return $response->toArray(); + } +} + +/** + * Minimal in-memory {@see Database} double for the retry tests, which only build email messages with no + * attachments and never touch the expired-token cleanup path. Every read resolves empty. + */ +class InMemoryDatabase extends Database +{ + private readonly Authorization $authorization; + + public function __construct() + { + $this->authorization = new Authorization(); + } + + public function getAuthorization(): Authorization + { + return $this->authorization; + } + + public function skipValidation(callable $callback): mixed + { + return $callback(); + } + + public function findOne(string $collection, array $queries = []): Document + { + return new Document(); + } + + public function getDocument(string $collection, string $id, array $queries = [], bool $forUpdate = false): Document + { + return new Document(); + } + + public function updateDocument(string $collection, string $id, Document $document): Document + { + return $document; + } + + public function find(string $collection, array $queries = [], string $forPermission = Database::PERMISSION_READ): array + { + return []; + } +} + +/** + * {@see InMemoryDatabase} variant whose expired-device-token cleanup always fails: `findOne('targets')` + * resolves to a real target so the worker attempts the update, and `updateDocument('targets')` throws a + * transient error. Used to prove that a DB hiccup during best-effort cleanup never leaks into delivery + * accounting or the retry decision. + */ +class ExpiredTokenCleanupFailingDatabase extends InMemoryDatabase +{ + public int $targetUpdateAttempts = 0; + + public function findOne(string $collection, array $queries = []): Document + { + if ($collection === 'targets') { + return new Document(['$id' => 'target-expired', '$sequence' => '1']); + } + + return parent::findOne($collection, $queries); + } + + public function updateDocument(string $collection, string $id, Document $document): Document + { + if ($collection === 'targets') { + $this->targetUpdateAttempts++; + + throw new \RuntimeException('Transient database error during target cleanup'); + } + + return parent::updateDocument($collection, $id, $document); + } +} + +/** + * In-memory {@see Database} double for the streaming tests. Serves subscribers/targets through cursor + * pagination and records every query issued so the test can assert the streaming contract (cursorAfter + + * bounded page size, topic reads never selecting the 1M-row `targets` subquery, no runaway limits). + */ +class RecordingDatabase extends Database +{ + /** + * @var array}> + */ + public array $findCalls = []; + + private readonly Authorization $authorization; + + /** + * @param array $subscribers Subscriber rows (carry $sequence + targetInternalId + providerType). + * @param array $targets Target rows keyed by $sequence (resolved from a subscriber page). + * @param array $userTargets Targets addressed by userId. + * @param array $directTargets Targets addressed directly by id. + */ + public function __construct( + private readonly array $subscribers = [], + private readonly array $targets = [], + private readonly array $userTargets = [], + private readonly array $directTargets = [] + ) { + $this->authorization = new Authorization(); + } + + public function getAuthorization(): Authorization + { + return $this->authorization; + } + + public function skipValidation(callable $callback): mixed + { + return $callback(); + } + + public function find(string $collection, array $queries = [], string $forPermission = Database::PERMISSION_READ): array + { + $this->findCalls[] = ['collection' => $collection, 'queries' => $queries]; + + return match ($collection) { + 'topics' => [new Document(['$id' => 'topic1', '$sequence' => '100'])], + 'subscribers' => $this->paginate($this->subscribers, $queries), + 'targets' => $this->resolveTargets($queries), + default => [], + }; + } + + /** + * @param array $rows + * @param array $queries + * @return array + */ + private function paginate(array $rows, array $queries): array + { + $limit = $this->limitOf($queries); + $cursor = $this->cursorOf($queries); + + if ($cursor !== null) { + $rows = \array_values(\array_filter( + $rows, + fn (Document $row) => $row->getSequence() > $cursor->getSequence() + )); + } + + return \array_slice($rows, 0, $limit); + } + + /** + * Either resolve a subscriber page's targets by $sequence, or paginate user/direct targets. + * + * @param array $queries + * @return array + */ + private function resolveTargets(array $queries): array + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_EQUAL && $query->getAttribute() === '$sequence') { + $sequences = $query->getValues(); + + return \array_values(\array_map( + fn ($sequence) => $this->targets[$sequence], + \array_filter($sequences, fn ($sequence) => isset($this->targets[$sequence])) + )); + } + + if ($query->getMethod() === Query::TYPE_EQUAL && $query->getAttribute() === 'userId') { + return $this->paginate($this->userTargets, $queries); + } + } + + return $this->paginate($this->directTargets, $queries); + } + + /** + * @param array $queries + */ + private function limitOf(array $queries): int + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_LIMIT) { + return (int) ($query->getValues()[0] ?? 0); + } + } + + return 0; + } + + /** + * @param array $queries + */ + private function cursorOf(array $queries): ?Document + { + foreach ($queries as $query) { + if ($query->getMethod() === Query::TYPE_CURSOR_AFTER) { + $value = $query->getValues()[0] ?? null; + + return $value instanceof Document ? $value : null; + } + } + + return null; + } +} diff --git a/tests/unit/Messaging/MessagingGuestTest.php b/tests/unit/Messaging/MessagingGuestTest.php index 068f9de819..f59b253b34 100644 --- a/tests/unit/Messaging/MessagingGuestTest.php +++ b/tests/unit/Messaging/MessagingGuestTest.php @@ -1,5 +1,7 @@ getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::guests()->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::users()->toString()]; @@ -111,7 +113,7 @@ class MessagingGuestTest extends TestCase $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['project'] = '2'; diff --git a/tests/unit/Messaging/MessagingTest.php b/tests/unit/Messaging/MessagingTest.php index 12c99a83ef..f9075adea2 100644 --- a/tests/unit/Messaging/MessagingTest.php +++ b/tests/unit/Messaging/MessagingTest.php @@ -1,5 +1,7 @@ getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::users()->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::user(ID::custom('123'))->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::team(ID::custom('abc'))->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::team(ID::custom('abc'), 'administrator')->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::team(ID::custom('abc'), 'moderator')->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::team(ID::custom('def'))->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::team(ID::custom('def'), 'guest')->toString()]; $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['roles'] = [Role::user(ID::custom('456'))->toString()]; @@ -128,7 +130,7 @@ class MessagingTest extends TestCase $receivers = array_keys($realtime->getSubscribers($event)); $this->assertCount(1, $receivers); - $this->assertEquals(1, $receivers[0]); + $this->assertSame(1, $receivers[0]); $event['project'] = '2'; @@ -217,7 +219,7 @@ class MessagingTest extends TestCase ], ]; $receivers = array_keys($realtime->getSubscribers($event)); - $this->assertEquals([1], $receivers); + $this->assertSame([1], $receivers); // Channels recomputed: sub-a's channel is gone $this->assertSame(['files'], $realtime->connections[1]['channels']); @@ -250,7 +252,7 @@ class MessagingTest extends TestCase 'channels' => ['documents'], ], ]; - $this->assertEquals([1], array_keys($realtime->getSubscribers($event))); + $this->assertSame([1], array_keys($realtime->getSubscribers($event))); } public function testUnsubscribeSubscriptionKeepsConnectionWhenLastSubRemoved(): void @@ -301,7 +303,7 @@ class MessagingTest extends TestCase 'channels' => ['files'], ], ]; - $this->assertEquals([1], array_keys($realtime->getSubscribers($event))); + $this->assertSame([1], array_keys($realtime->getSubscribers($event))); } public function testSubscribeAfterOnOpenEmptySentinelPreservesUnion(): void diff --git a/tests/unit/Migration/MigrationVersionsTest.php b/tests/unit/Migration/MigrationVersionsTest.php index 3c8bae7222..a97a582bd9 100644 --- a/tests/unit/Migration/MigrationVersionsTest.php +++ b/tests/unit/Migration/MigrationVersionsTest.php @@ -1,11 +1,13 @@ ['http://127.0.0.1/iam', 'private or reserved'], - 'loopback v6' => ['http://[::1]/iam', 'private or reserved'], - 'link-local imds' => ['http://169.254.169.254/latest/', 'private or reserved'], - 'private rfc1918 a' => ['http://10.0.0.5/secret', 'private or reserved'], - 'private rfc1918 b' => ['http://192.168.1.1/admin', 'private or reserved'], - 'private rfc1918 c' => ['http://172.16.0.1/x', 'private or reserved'], - 'cgnat' => ['http://100.64.0.1/x', 'private or reserved'], - 'ipv4-mapped loopback' => ['http://[::ffff:127.0.0.1]/x', 'private or reserved'], - '6to4 imds' => ['http://[2002:a9fe:a9fe::]/x', 'private or reserved'], - 'file scheme' => ['file:///etc/passwd', "Scheme 'file' is not allowed"], - 'gopher scheme' => ['gopher://attacker/x', "Scheme 'gopher' is not allowed"], - 'ftp scheme' => ['ftp://internal/file', "Scheme 'ftp' is not allowed"], - 'no scheme' => ['example.com/path', "Scheme '' is not allowed"], - 'malformed no host' => ['http:///path', 'Malformed URL'], - 'unknown psl' => ['http://not-a-real-tld.notreal/x', 'not a known public domain'], - ]; + yield 'loopback v4' => ['http://127.0.0.1/iam', 'private or reserved']; + yield 'loopback v6' => ['http://[::1]/iam', 'private or reserved']; + yield 'link-local imds' => ['http://169.254.169.254/latest/', 'private or reserved']; + yield 'private rfc1918 a' => ['http://10.0.0.5/secret', 'private or reserved']; + yield 'private rfc1918 b' => ['http://192.168.1.1/admin', 'private or reserved']; + yield 'private rfc1918 c' => ['http://172.16.0.1/x', 'private or reserved']; + yield 'cgnat' => ['http://100.64.0.1/x', 'private or reserved']; + yield 'ipv4-mapped loopback' => ['http://[::ffff:127.0.0.1]/x', 'private or reserved']; + yield '6to4 imds' => ['http://[2002:a9fe:a9fe::]/x', 'private or reserved']; + yield 'file scheme' => ['file:///etc/passwd', "Scheme 'file' is not allowed"]; + yield 'gopher scheme' => ['gopher://attacker/x', "Scheme 'gopher' is not allowed"]; + yield 'ftp scheme' => ['ftp://internal/file', "Scheme 'ftp' is not allowed"]; + yield 'no scheme' => ['example.com/path', "Scheme '' is not allowed"]; + yield 'malformed no host' => ['http:///path', 'Malformed URL']; + yield 'unknown psl' => ['http://not-a-real-tld.notreal/x', 'not a known public domain']; } public function testFetchFollowsPublicRedirect(): void diff --git a/tests/unit/Network/Validators/DNSTest.php b/tests/unit/Network/Validators/DNSTest.php index 845d01e723..45e11d7029 100644 --- a/tests/unit/Network/Validators/DNSTest.php +++ b/tests/unit/Network/Validators/DNSTest.php @@ -1,12 +1,14 @@ assertEquals(false, $validator->isValid('')); $this->assertEquals(false, $validator->isValid(null)); - $this->assertEquals('string', $validator->getType()); + $this->assertSame('string', $validator->getType()); } public function testMultipleDNSServers(): void @@ -23,7 +25,7 @@ class DNSTest extends TestCase $this->assertEquals(false, $validator->isValid('')); $this->assertEquals(false, $validator->isValid(null)); - $this->assertEquals('string', $validator->getType()); + $this->assertSame('string', $validator->getType()); } public function testValidationFailure(): void diff --git a/tests/unit/Network/Validators/OriginTest.php b/tests/unit/Network/Validators/OriginTest.php index 64ce71951b..6c5d7a878c 100644 --- a/tests/unit/Network/Validators/OriginTest.php +++ b/tests/unit/Network/Validators/OriginTest.php @@ -1,11 +1,13 @@ assertEquals(false, $validator->isValid('appwrite-callback-456://')); $this->assertEquals(false, $validator->isValid('appwrite-ios://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new iOS platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new iOS platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('appwrite-android://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Android platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Android platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('appwrite-macos://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new macOS platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new macOS platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('appwrite-linux://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Linux platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Linux platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('appwrite-windows://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Windows platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('chrome-extension://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Chrome Extension) platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Web (Chrome Extension) platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('moz-extension://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Firefox Extension) platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Web (Firefox Extension) platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('safari-web-extension://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Safari Extension) platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Web (Safari Extension) platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('ms-browser-extension://com.company.appname')); - $this->assertEquals('Invalid Origin. Register your new client (com.company.appname) as a new Web (Edge Extension) platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (com.company.appname) as a new Web (Edge Extension) platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(true, $validator->isValid('tauri://localhost')); $this->assertEquals(false, $validator->isValid('tauri://example.com')); - $this->assertEquals('Invalid Origin. Register your new client (example.com) as a new Web (Tauri) platform on your project console dashboard', $validator->getDescription()); + $this->assertSame('Invalid Origin. Register your new client (example.com) as a new Web (Tauri) platform on your project console dashboard', $validator->getDescription()); $this->assertEquals(false, $validator->isValid('random-scheme://localhost')); - $this->assertEquals('Invalid Scheme. The scheme used (random-scheme) in the Origin (random-scheme://localhost) is not supported. If you are using a custom scheme, please change it to `appwrite-callback-`', $validator->getDescription()); + $this->assertSame('Invalid Scheme. The scheme used (random-scheme) in the Origin (random-scheme://localhost) is not supported. If you are using a custom scheme, please change it to `appwrite-callback-`', $validator->getDescription()); } public function testGetAllowedHostnames(): void @@ -88,7 +90,7 @@ class OriginTest extends TestCase allowedSchemes: ['exp'] ); - $this->assertEquals(['appwrite.io', 'localhost'], $validator->getAllowedHostnames()); + $this->assertSame(['appwrite.io', 'localhost'], $validator->getAllowedHostnames()); } public function testGetAllowedSchemes(): void @@ -98,7 +100,7 @@ class OriginTest extends TestCase allowedSchemes: ['exp', 'appwrite-callback-123'] ); - $this->assertEquals(['exp', 'appwrite-callback-123'], $validator->getAllowedSchemes()); + $this->assertSame(['exp', 'appwrite-callback-123'], $validator->getAllowedSchemes()); } public function testSetAllowedHostnames(): void @@ -114,7 +116,7 @@ class OriginTest extends TestCase $result = $validator->setAllowedHostnames(['example.com']); $this->assertSame($validator, $result); - $this->assertEquals(['example.com'], $validator->getAllowedHostnames()); + $this->assertSame(['example.com'], $validator->getAllowedHostnames()); $this->assertEquals(true, $validator->isValid('https://example.com')); $this->assertEquals(false, $validator->isValid('https://appwrite.io')); } @@ -132,7 +134,7 @@ class OriginTest extends TestCase $result = $validator->setAllowedSchemes(['appwrite-callback-456']); $this->assertSame($validator, $result); - $this->assertEquals(['appwrite-callback-456'], $validator->getAllowedSchemes()); + $this->assertSame(['appwrite-callback-456'], $validator->getAllowedSchemes()); $this->assertEquals(true, $validator->isValid('appwrite-callback-456://')); $this->assertEquals(false, $validator->isValid('exp://')); } diff --git a/tests/unit/Network/Validators/PublicHostnameTest.php b/tests/unit/Network/Validators/PublicHostnameTest.php index 81c5708769..f5ca1c966d 100644 --- a/tests/unit/Network/Validators/PublicHostnameTest.php +++ b/tests/unit/Network/Validators/PublicHostnameTest.php @@ -1,12 +1,14 @@ assertFalse(PublicHostname::isPublicIp($ip)); } - public static function privateIpv4Addresses(): array + public static function privateIpv4Addresses(): \Iterator { - return [ - 'unspecified' => ['0.0.0.0'], - 'private 10/8' => ['10.0.0.1'], - 'private 172.16/12' => ['172.16.5.10'], - 'private 192.168/16' => ['192.168.1.1'], - 'cgnat' => ['100.64.0.1'], - 'loopback' => ['127.0.0.1'], - 'link-local imds' => ['169.254.169.254'], - 'gcp metadata' => ['169.254.169.254'], - 'multicast' => ['224.0.0.1'], - 'reserved 240/4' => ['240.0.0.1'], - 'broadcast' => ['255.255.255.255'], - 'test-net-1' => ['192.0.2.1'], - 'test-net-2' => ['198.51.100.1'], - 'test-net-3' => ['203.0.113.1'], - 'benchmark' => ['198.18.0.1'], - ]; + yield 'unspecified' => ['0.0.0.0']; + yield 'private 10/8' => ['10.0.0.1']; + yield 'private 172.16/12' => ['172.16.5.10']; + yield 'private 192.168/16' => ['192.168.1.1']; + yield 'cgnat' => ['100.64.0.1']; + yield 'loopback' => ['127.0.0.1']; + yield 'link-local imds' => ['169.254.169.254']; + yield 'gcp metadata' => ['169.254.169.254']; + yield 'multicast' => ['224.0.0.1']; + yield 'reserved 240/4' => ['240.0.0.1']; + yield 'broadcast' => ['255.255.255.255']; + yield 'test-net-1' => ['192.0.2.1']; + yield 'test-net-2' => ['198.51.100.1']; + yield 'test-net-3' => ['203.0.113.1']; + yield 'benchmark' => ['198.18.0.1']; } #[DataProvider('privateIpv6Addresses')] @@ -63,23 +63,21 @@ class PublicHostnameTest extends TestCase $this->assertFalse(PublicHostname::isPublicIp($ip)); } - public static function privateIpv6Addresses(): array + public static function privateIpv6Addresses(): \Iterator { - return [ - 'loopback' => ['::1'], - 'unspecified' => ['::'], - 'link-local' => ['fe80::1'], - 'unique-local' => ['fc00::1'], - 'unique-local fd' => ['fd12:3456:789a::1'], - 'multicast' => ['ff02::1'], - 'ipv4-mapped loopback' => ['::ffff:127.0.0.1'], - 'ipv4-mapped private' => ['::ffff:10.0.0.1'], - 'ipv4-mapped imds' => ['::ffff:169.254.169.254'], - '6to4 loopback' => ['2002:7f00:1::'], - '6to4 imds' => ['2002:a9fe:a9fe::'], - 'teredo' => ['2001:0:1::1'], - 'documentation' => ['2001:db8::1'], - ]; + yield 'loopback' => ['::1']; + yield 'unspecified' => ['::']; + yield 'link-local' => ['fe80::1']; + yield 'unique-local' => ['fc00::1']; + yield 'unique-local fd' => ['fd12:3456:789a::1']; + yield 'multicast' => ['ff02::1']; + yield 'ipv4-mapped loopback' => ['::ffff:127.0.0.1']; + yield 'ipv4-mapped private' => ['::ffff:10.0.0.1']; + yield 'ipv4-mapped imds' => ['::ffff:169.254.169.254']; + yield '6to4 loopback' => ['2002:7f00:1::']; + yield '6to4 imds' => ['2002:a9fe:a9fe::']; + yield 'teredo' => ['2001:0:1::1']; + yield 'documentation' => ['2001:db8::1']; } #[DataProvider('publicIpAddresses')] @@ -94,14 +92,12 @@ class PublicHostnameTest extends TestCase $this->assertTrue(PublicHostname::isPublicIp($ip)); } - public static function publicIpAddresses(): array + public static function publicIpAddresses(): \Iterator { - return [ - 'google dns' => ['8.8.8.8'], - 'cloudflare' => ['1.1.1.1'], - 'opendns' => ['208.67.222.222'], - 'public ipv6' => ['2606:4700:4700::1111'], - ]; + yield 'google dns' => ['8.8.8.8']; + yield 'cloudflare' => ['1.1.1.1']; + yield 'opendns' => ['208.67.222.222']; + yield 'public ipv6' => ['2606:4700:4700::1111']; } public function testRejectsMalformedInput(): void diff --git a/tests/unit/OpenSSL/OpenSSLTest.php b/tests/unit/OpenSSL/OpenSSLTest.php index 82386aaae0..d6a5b521d3 100644 --- a/tests/unit/OpenSSL/OpenSSLTest.php +++ b/tests/unit/OpenSSL/OpenSSLTest.php @@ -1,11 +1,13 @@ getAction('installerView'); - $this->assertEquals('installerView', View::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_GET, $action->getHttpMethod()); - $this->assertEquals('/', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerView', View::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_GET, $action->getHttpMethod()); + $this->assertSame('/', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionParams($action, ['step', 'partial']); $this->assertActionInjects($action, ['request', 'response', 'installerConfig', 'installerPaths']); } @@ -69,10 +71,10 @@ class ModuleTest extends TestCase { $action = $this->getAction('installerStatus'); - $this->assertEquals('installerStatus', Status::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_GET, $action->getHttpMethod()); - $this->assertEquals('/install/status', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerStatus', Status::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_GET, $action->getHttpMethod()); + $this->assertSame('/install/status', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionParams($action, ['installId']); $this->assertActionInjects($action, ['response', 'installerState']); } @@ -81,10 +83,10 @@ class ModuleTest extends TestCase { $action = $this->getAction('installerValidate'); - $this->assertEquals('installerValidate', Validate::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); - $this->assertEquals('/install/validate', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerValidate', Validate::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); + $this->assertSame('/install/validate', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionInjects($action, ['request', 'response']); } @@ -92,10 +94,10 @@ class ModuleTest extends TestCase { $action = $this->getAction('installerComplete'); - $this->assertEquals('installerComplete', Complete::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); - $this->assertEquals('/install/complete', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerComplete', Complete::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); + $this->assertSame('/install/complete', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionParams($action, ['installId', 'sessionId', 'sessionSecret', 'sessionExpire']); $this->assertActionInjects($action, ['request', 'response', 'installerState']); } @@ -104,10 +106,10 @@ class ModuleTest extends TestCase { $action = $this->getAction('installerShutdown'); - $this->assertEquals('installerShutdown', Shutdown::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); - $this->assertEquals('/install/shutdown', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerShutdown', Shutdown::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); + $this->assertSame('/install/shutdown', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionInjects($action, ['request', 'response', 'swooleServer']); } @@ -115,10 +117,10 @@ class ModuleTest extends TestCase { $action = $this->getAction('installerReset'); - $this->assertEquals('installerReset', Reset::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); - $this->assertEquals('/install/reset', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerReset', Reset::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); + $this->assertSame('/install/reset', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionParams($action, ['installId', 'hard']); $this->assertActionInjects($action, ['request', 'response', 'installerState', 'installerConfig']); } @@ -127,10 +129,10 @@ class ModuleTest extends TestCase { $action = $this->getAction('installerInstall'); - $this->assertEquals('installerInstall', Install::getName()); - $this->assertEquals(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); - $this->assertEquals('/install', $action->getHttpPath()); - $this->assertEquals(Action::TYPE_DEFAULT, $action->getType()); + $this->assertSame('installerInstall', Install::getName()); + $this->assertSame(Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod()); + $this->assertSame('/install', $action->getHttpPath()); + $this->assertSame(Action::TYPE_DEFAULT, $action->getType()); $this->assertActionParams($action, [ 'appDomain', 'httpPort', 'httpsPort', 'emailCertificates', 'opensslKey', 'assistantOpenAIKey', 'accountEmail', 'accountPassword', 'database', @@ -143,8 +145,8 @@ class ModuleTest extends TestCase { $error = new Error(); - $this->assertEquals('installerError', Error::getName()); - $this->assertEquals(Action::TYPE_ERROR, $error->getType()); + $this->assertSame('installerError', Error::getName()); + $this->assertSame(Action::TYPE_ERROR, $error->getType()); $this->assertIsCallable($error->getCallback()); } @@ -216,14 +218,14 @@ class ModuleTest extends TestCase public function testStaticGetNameValues(): void { - $this->assertEquals('installerView', View::getName()); - $this->assertEquals('installerStatus', Status::getName()); - $this->assertEquals('installerValidate', Validate::getName()); - $this->assertEquals('installerComplete', Complete::getName()); - $this->assertEquals('installerShutdown', Shutdown::getName()); - $this->assertEquals('installerReset', Reset::getName()); - $this->assertEquals('installerInstall', Install::getName()); - $this->assertEquals('installerError', Error::getName()); + $this->assertSame('installerView', View::getName()); + $this->assertSame('installerStatus', Status::getName()); + $this->assertSame('installerValidate', Validate::getName()); + $this->assertSame('installerComplete', Complete::getName()); + $this->assertSame('installerShutdown', Shutdown::getName()); + $this->assertSame('installerReset', Reset::getName()); + $this->assertSame('installerInstall', Install::getName()); + $this->assertSame('installerError', Error::getName()); } public function testActionInstanceTypes(): void @@ -246,7 +248,7 @@ class ModuleTest extends TestCase $getActions = ['installerView', 'installerStatus']; foreach ($getActions as $name) { $action = $this->getAction($name); - $this->assertEquals( + $this->assertSame( Action::HTTP_REQUEST_METHOD_GET, $action->getHttpMethod(), "Action '$name' should use GET method" @@ -259,7 +261,7 @@ class ModuleTest extends TestCase $postActions = ['installerValidate', 'installerComplete', 'installerShutdown', 'installerReset', 'installerInstall']; foreach ($postActions as $name) { $action = $this->getAction($name); - $this->assertEquals( + $this->assertSame( Action::HTTP_REQUEST_METHOD_POST, $action->getHttpMethod(), "Action '$name' should use POST method" diff --git a/tests/unit/Platform/Modules/Installer/Runtime/ConfigTest.php b/tests/unit/Platform/Modules/Installer/Runtime/ConfigTest.php index 113bce5277..7f0faafcbc 100644 --- a/tests/unit/Platform/Modules/Installer/Runtime/ConfigTest.php +++ b/tests/unit/Platform/Modules/Installer/Runtime/ConfigTest.php @@ -1,11 +1,13 @@ assertEquals('80', $config->getDefaultHttpPort()); $this->assertEquals('443', $config->getDefaultHttpsPort()); - $this->assertEquals('appwrite', $config->getOrganization()); - $this->assertEquals('appwrite', $config->getImage()); + $this->assertSame('appwrite', $config->getOrganization()); + $this->assertSame('appwrite', $config->getImage()); $this->assertFalse($config->getNoStart()); $this->assertFalse($config->isUpgrade()); $this->assertFalse($config->isLocal()); $this->assertNull($config->getHostPath()); $this->assertNull($config->getLockedDatabase()); - $this->assertEquals(['mongodb', 'mariadb'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'mariadb'], $config->getEnabledDatabases()); $this->assertEmpty($config->getVars()); } @@ -34,7 +36,7 @@ class ConfigTest extends TestCase $this->assertEquals('8080', $config->getDefaultHttpPort()); $this->assertTrue($config->isUpgrade()); - $this->assertEquals('myorg', $config->getOrganization()); + $this->assertSame('myorg', $config->getOrganization()); } public function testConstructorWithUnknownKeysTreatsAsVars(): void @@ -45,7 +47,7 @@ class ConfigTest extends TestCase ]; $config = new Config($vars); - $this->assertEquals($vars, $config->getVars()); + $this->assertSame($vars, $config->getVars()); // Defaults should remain $this->assertEquals('80', $config->getDefaultHttpPort()); } @@ -68,13 +70,13 @@ class ConfigTest extends TestCase $this->assertEquals('3000', $config->getDefaultHttpPort()); $this->assertEquals('3443', $config->getDefaultHttpsPort()); - $this->assertEquals('testorg', $config->getOrganization()); - $this->assertEquals('testimage', $config->getImage()); + $this->assertSame('testorg', $config->getOrganization()); + $this->assertSame('testimage', $config->getImage()); $this->assertTrue($config->getNoStart()); $this->assertTrue($config->isUpgrade()); $this->assertTrue($config->isLocal()); - $this->assertEquals('/home/user', $config->getHostPath()); - $this->assertEquals('mariadb', $config->getLockedDatabase()); + $this->assertSame('/home/user', $config->getHostPath()); + $this->assertSame('mariadb', $config->getLockedDatabase()); $this->assertCount(1, $config->getVars()); } @@ -93,7 +95,7 @@ class ConfigTest extends TestCase { $config = new Config(); $config->setHostPath('/some/path'); - $this->assertEquals('/some/path', $config->getHostPath()); + $this->assertSame('/some/path', $config->getHostPath()); $config->apply(['hostPath' => null]); $this->assertNull($config->getHostPath()); @@ -111,7 +113,7 @@ class ConfigTest extends TestCase $this->assertEquals('8080', $config->getDefaultHttpPort()); $this->assertEquals('8443', $config->getDefaultHttpsPort()); - $this->assertEquals('updated', $config->getOrganization()); + $this->assertSame('updated', $config->getOrganization()); } public function testToArrayRoundTrip(): void @@ -154,8 +156,8 @@ class ConfigTest extends TestCase $rebuilt = new Config($original->toArray()); - $this->assertEquals($original->getDefaultHttpPort(), $rebuilt->getDefaultHttpPort()); - $this->assertEquals($original->isLocal(), $rebuilt->isLocal()); + $this->assertSame($original->getDefaultHttpPort(), $rebuilt->getDefaultHttpPort()); + $this->assertSame($original->isLocal(), $rebuilt->isLocal()); $this->assertEquals($original->getLockedDatabase(), $rebuilt->getLockedDatabase()); $this->assertEquals($original->toArray(), $rebuilt->toArray()); } @@ -178,14 +180,14 @@ class ConfigTest extends TestCase { $config = new Config(); $config->setOrganization('myorg'); - $this->assertEquals('myorg', $config->getOrganization()); + $this->assertSame('myorg', $config->getOrganization()); } public function testSetAndGetImage(): void { $config = new Config(); $config->setImage('myimage'); - $this->assertEquals('myimage', $config->getImage()); + $this->assertSame('myimage', $config->getImage()); } public function testSetAndGetNoStart(): void @@ -219,7 +221,7 @@ class ConfigTest extends TestCase { $config = new Config(); $config->setHostPath('/some/path'); - $this->assertEquals('/some/path', $config->getHostPath()); + $this->assertSame('/some/path', $config->getHostPath()); $config->setHostPath(null); $this->assertNull($config->getHostPath()); } @@ -228,7 +230,7 @@ class ConfigTest extends TestCase { $config = new Config(); $config->setLockedDatabase('mariadb'); - $this->assertEquals('mariadb', $config->getLockedDatabase()); + $this->assertSame('mariadb', $config->getLockedDatabase()); $config->setLockedDatabase(null); $this->assertNull($config->getLockedDatabase()); } @@ -241,7 +243,7 @@ class ConfigTest extends TestCase ['name' => '_APP_DOMAIN', 'default' => 'localhost'], ]; $config->setVars($vars); - $this->assertEquals($vars, $config->getVars()); + $this->assertSame($vars, $config->getVars()); } public function testJsonRoundTrip(): void @@ -376,7 +378,7 @@ class ConfigTest extends TestCase $config->apply(['lockedDatabase' => '']); // hasValidStringValue returns false for empty string - $this->assertEquals('mariadb', $config->getLockedDatabase()); + $this->assertSame('mariadb', $config->getLockedDatabase()); } public function testApplyLockedDatabaseIgnoresNull(): void @@ -386,7 +388,7 @@ class ConfigTest extends TestCase $config->apply(['lockedDatabase' => null]); // hasValidStringValue returns false for null - $this->assertEquals('mongodb', $config->getLockedDatabase()); + $this->assertSame('mongodb', $config->getLockedDatabase()); } public function testApplyPortWithIntegerValue(): void @@ -451,7 +453,7 @@ class ConfigTest extends TestCase $this->assertEquals('1111', $config->getDefaultHttpPort()); $this->assertEquals('2222', $config->getDefaultHttpsPort()); - $this->assertEquals('org', $config->getOrganization()); + $this->assertSame('org', $config->getOrganization()); $this->assertTrue($config->isLocal()); } @@ -492,7 +494,7 @@ class ConfigTest extends TestCase public function testDefaultEnabledDatabases(): void { $config = new Config(); - $this->assertEquals(['mongodb', 'mariadb'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'mariadb'], $config->getEnabledDatabases()); $this->assertTrue($config->isDatabaseEnabled('mongodb')); $this->assertTrue($config->isDatabaseEnabled('mariadb')); $this->assertFalse($config->isDatabaseEnabled('postgresql')); @@ -502,7 +504,7 @@ class ConfigTest extends TestCase { $config = new Config(); $config->setEnabledDatabases(['mongodb', 'mariadb', 'postgresql']); - $this->assertEquals(['mongodb', 'mariadb', 'postgresql'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'mariadb', 'postgresql'], $config->getEnabledDatabases()); $this->assertTrue($config->isDatabaseEnabled('postgresql')); } @@ -510,7 +512,7 @@ class ConfigTest extends TestCase { $config = new Config(); $config->setEnabledDatabases(['mongodb', '', null, 42, 'mariadb']); - $this->assertEquals(['mongodb', 'mariadb'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'mariadb'], $config->getEnabledDatabases()); } public function testSetEnabledDatabasesEmptyArrayPreservesExisting(): void @@ -518,14 +520,14 @@ class ConfigTest extends TestCase $config = new Config(); $config->setEnabledDatabases(['mongodb', 'postgresql']); $config->setEnabledDatabases([]); - $this->assertEquals(['mongodb', 'postgresql'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'postgresql'], $config->getEnabledDatabases()); } public function testApplyEnabledDatabases(): void { $config = new Config(); $config->apply(['enabledDatabases' => ['mongodb', 'mariadb', 'postgresql']]); - $this->assertEquals(['mongodb', 'mariadb', 'postgresql'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'mariadb', 'postgresql'], $config->getEnabledDatabases()); $this->assertTrue($config->isDatabaseEnabled('postgresql')); } @@ -533,7 +535,7 @@ class ConfigTest extends TestCase { $config = new Config(); $config->apply(['enabledDatabases' => 'mongodb']); - $this->assertEquals(['mongodb', 'mariadb'], $config->getEnabledDatabases()); + $this->assertSame(['mongodb', 'mariadb'], $config->getEnabledDatabases()); } public function testEnabledDatabasesInToArray(): void @@ -549,6 +551,6 @@ class ConfigTest extends TestCase $config = new Config(); $config->setEnabledDatabases(['mongodb', 'postgresql']); $rebuilt = new Config($config->toArray()); - $this->assertEquals(['mongodb', 'postgresql'], $rebuilt->getEnabledDatabases()); + $this->assertSame(['mongodb', 'postgresql'], $rebuilt->getEnabledDatabases()); } } diff --git a/tests/unit/Platform/Modules/Installer/Runtime/StateTest.php b/tests/unit/Platform/Modules/Installer/Runtime/StateTest.php index c8cfd6d884..a76e6c38d9 100644 --- a/tests/unit/Platform/Modules/Installer/Runtime/StateTest.php +++ b/tests/unit/Platform/Modules/Installer/Runtime/StateTest.php @@ -1,5 +1,7 @@ assertEquals('abc123', $this->state->sanitizeInstallId('abc123')); + $this->assertSame('abc123', $this->state->sanitizeInstallId('abc123')); } public function testSanitizeInstallIdWithSpecialChars(): void { - $this->assertEquals('abc123', $this->state->sanitizeInstallId('abc!@#123')); + $this->assertSame('abc123', $this->state->sanitizeInstallId('abc!@#123')); } public function testSanitizeInstallIdWithHyphensAndUnderscores(): void { - $this->assertEquals('abc-123_def', $this->state->sanitizeInstallId('abc-123_def')); + $this->assertSame('abc-123_def', $this->state->sanitizeInstallId('abc-123_def')); } public function testSanitizeInstallIdTruncatesTo64Chars(): void { $long = str_repeat('a', 100); - $this->assertEquals(64, strlen($this->state->sanitizeInstallId($long))); + $this->assertSame(64, strlen($this->state->sanitizeInstallId($long))); } public function testSanitizeInstallIdWithEmptyString(): void { - $this->assertEquals('', $this->state->sanitizeInstallId('')); + $this->assertSame('', $this->state->sanitizeInstallId('')); } public function testSanitizeInstallIdWithNonString(): void { - $this->assertEquals('', $this->state->sanitizeInstallId(123)); - $this->assertEquals('', $this->state->sanitizeInstallId(null)); + $this->assertSame('', $this->state->sanitizeInstallId(123)); + $this->assertSame('', $this->state->sanitizeInstallId(null)); } public function testHashSensitiveValueProducesConsistentHash(): void { $hash1 = $this->state->hashSensitiveValue('secret'); $hash2 = $this->state->hashSensitiveValue('secret'); - $this->assertEquals($hash1, $hash2); + $this->assertSame($hash1, $hash2); } public function testHashSensitiveValueDifferentInputsDifferentHashes(): void { $hash1 = $this->state->hashSensitiveValue('secret1'); $hash2 = $this->state->hashSensitiveValue('secret2'); - $this->assertNotEquals($hash1, $hash2); + $this->assertNotSame($hash1, $hash2); } public function testHashSensitiveValueTrimsWhitespace(): void { $hash1 = $this->state->hashSensitiveValue('secret'); $hash2 = $this->state->hashSensitiveValue(' secret '); - $this->assertEquals($hash1, $hash2); + $this->assertSame($hash1, $hash2); } public function testHashSensitiveValueEmptyStringReturnsEmpty(): void { - $this->assertEquals('', $this->state->hashSensitiveValue('')); - $this->assertEquals('', $this->state->hashSensitiveValue(' ')); + $this->assertSame('', $this->state->hashSensitiveValue('')); + $this->assertSame('', $this->state->hashSensitiveValue(' ')); } public function testHashSensitiveValueReturnsSha256(): void { $hash = $this->state->hashSensitiveValue('test'); - $this->assertEquals(64, strlen($hash)); // SHA-256 produces 64 hex chars + $this->assertSame(64, strlen($hash)); // SHA-256 produces 64 hex chars $this->assertMatchesRegularExpression('/^[a-f0-9]{64}$/', $hash); } @@ -433,37 +435,37 @@ class StateTest extends TestCase public function testSanitizeInstallIdWithOnlySpecialChars(): void { - $this->assertEquals('', $this->state->sanitizeInstallId('!@#$%^&*()')); + $this->assertSame('', $this->state->sanitizeInstallId('!@#$%^&*()')); } public function testSanitizeInstallIdWithUnicode(): void { // Unicode letters are stripped byte-by-byte, only ASCII alphanum + hyphen + underscore kept // 'é' is 2 bytes (0xC3 0xA9), both stripped => 'héllo' becomes 'hllo' - $this->assertEquals('hllo', $this->state->sanitizeInstallId('héllo')); + $this->assertSame('hllo', $this->state->sanitizeInstallId('héllo')); } public function testSanitizeInstallIdWithExactly64Chars(): void { $exact = str_repeat('b', 64); - $this->assertEquals($exact, $this->state->sanitizeInstallId($exact)); - $this->assertEquals(64, strlen($this->state->sanitizeInstallId($exact))); + $this->assertSame($exact, $this->state->sanitizeInstallId($exact)); + $this->assertSame(64, strlen($this->state->sanitizeInstallId($exact))); } public function testSanitizeInstallIdWithBooleanInput(): void { - $this->assertEquals('', $this->state->sanitizeInstallId(true)); - $this->assertEquals('', $this->state->sanitizeInstallId(false)); + $this->assertSame('', $this->state->sanitizeInstallId(true)); + $this->assertSame('', $this->state->sanitizeInstallId(false)); } public function testSanitizeInstallIdWithArrayInput(): void { - $this->assertEquals('', $this->state->sanitizeInstallId([])); + $this->assertSame('', $this->state->sanitizeInstallId([])); } public function testSanitizeInstallIdPreservesCase(): void { - $this->assertEquals('AbCdEf', $this->state->sanitizeInstallId('AbCdEf')); + $this->assertSame('AbCdEf', $this->state->sanitizeInstallId('AbCdEf')); } public function testIsValidPortBoundaryValues(): void @@ -748,7 +750,7 @@ class StateTest extends TestCase @unlink(Server::INSTALLER_LOCK_FILE); $installId = 'lock-test-' . uniqid(); $result = $this->state->reserveGlobalLock($installId); - $this->assertEquals('ok', $result); + $this->assertSame('ok', $result); } public function testReserveGlobalLockSameIdCanRelock(): void @@ -757,11 +759,11 @@ class StateTest extends TestCase $installId = 'lock-relock-' . uniqid(); $result1 = $this->state->reserveGlobalLock($installId); - $this->assertEquals('ok', $result1); + $this->assertSame('ok', $result1); // Same ID can re-reserve $result2 = $this->state->reserveGlobalLock($installId); - $this->assertEquals('ok', $result2); + $this->assertSame('ok', $result2); } public function testReserveGlobalLockDifferentIdBlocked(): void @@ -771,11 +773,11 @@ class StateTest extends TestCase $installId2 = 'lock-id2-' . uniqid(); $result1 = $this->state->reserveGlobalLock($installId1); - $this->assertEquals('ok', $result1); + $this->assertSame('ok', $result1); // Different ID should be blocked $result2 = $this->state->reserveGlobalLock($installId2); - $this->assertEquals('locked', $result2); + $this->assertSame('locked', $result2); } public function testReserveGlobalLockAfterCompleted(): void @@ -789,7 +791,7 @@ class StateTest extends TestCase // After completion, a new install should be able to lock $result = $this->state->reserveGlobalLock($installId2); - $this->assertEquals('ok', $result); + $this->assertSame('ok', $result); } public function testReserveGlobalLockAfterError(): void @@ -803,7 +805,7 @@ class StateTest extends TestCase // After error, a new install should be able to lock $result = $this->state->reserveGlobalLock($installId2); - $this->assertEquals('ok', $result); + $this->assertSame('ok', $result); } public function testReserveGlobalLockExpiredLockAllowsNew(): void @@ -820,7 +822,7 @@ class StateTest extends TestCase $newId = 'lock-after-expired-' . uniqid(); $result = $this->state->reserveGlobalLock($newId); - $this->assertEquals('ok', $result); + $this->assertSame('ok', $result); } public function testUpdateGlobalLockUpdatesOwnLock(): void @@ -988,7 +990,7 @@ class StateTest extends TestCase // Newlines are not stripped by trim but surrounding whitespace is $hash1 = $this->state->hashSensitiveValue("line1\nline2"); $hash2 = $this->state->hashSensitiveValue("line1\nline2"); - $this->assertEquals($hash1, $hash2); + $this->assertSame($hash1, $hash2); $this->assertNotEmpty($hash1); } @@ -996,7 +998,7 @@ class StateTest extends TestCase { // A newline is not whitespace that trim() removes? Actually trim() removes \n // "\n" trimmed becomes "" => should return '' - $this->assertEquals('', $this->state->hashSensitiveValue("\n")); + $this->assertSame('', $this->state->hashSensitiveValue("\n")); } public function testIsValidEmailAddressWithUnicodeLocal(): void @@ -1098,7 +1100,7 @@ class StateTest extends TestCase // 1. Reserve lock $lockResult = $this->state->reserveGlobalLock($installId); - $this->assertEquals('ok', $lockResult); + $this->assertSame('ok', $lockResult); // 2. Write progress through multiple steps $this->state->writeProgressFile($installId, [ @@ -1143,6 +1145,6 @@ class StateTest extends TestCase $newId = 'lifecycle-new-' . uniqid(); $this->trackProgressFile($newId); $newResult = $this->state->reserveGlobalLock($newId); - $this->assertEquals('ok', $newResult); + $this->assertSame('ok', $newResult); } } diff --git a/tests/unit/Platform/Modules/Installer/Validator/AppDomainTest.php b/tests/unit/Platform/Modules/Installer/Validator/AppDomainTest.php index 0a360783ac..14c57f9ce9 100644 --- a/tests/unit/Platform/Modules/Installer/Validator/AppDomainTest.php +++ b/tests/unit/Platform/Modules/Installer/Validator/AppDomainTest.php @@ -1,11 +1,13 @@ assertEquals($this->validator::TYPE_STRING, $this->validator->getType()); + $this->assertSame($this->validator::TYPE_STRING, $this->validator->getType()); } public function testRejectsNonStringTypes(): void diff --git a/tests/unit/Platform/Modules/Project/OAuth2/OAuth2ProviderTest.php b/tests/unit/Platform/Modules/Project/OAuth2/OAuth2ProviderTest.php new file mode 100644 index 0000000000..b8eb48f748 --- /dev/null +++ b/tests/unit/Platform/Modules/Project/OAuth2/OAuth2ProviderTest.php @@ -0,0 +1,593 @@ +assertSame($expected, $ids); + $this->assertArrayNotHasKey('mock', $actions); + $this->assertArrayNotHasKey('mock-unverified', $actions); + $this->assertSame(PaypalSandboxUpdate::class, $actions['paypalSandbox']); + $this->assertSame(TradeshiftSandboxUpdate::class, $actions['tradeshiftBox']); + + foreach ($actions as $providerId => $actionClass) { + $this->assertSame($providerId, $actionClass::getProviderId()); + } + } + + /** + * @param class-string $actionClass + * @param array $expectedIds + */ + #[DataProvider('providerParameters')] + public function testProviderParameterMetadata(string $actionClass, array $expectedIds): void + { + $parameters = $actionClass::getParameters(); + $ids = \array_column($parameters, '$id'); + + $this->assertSame($expectedIds, $ids); + + foreach ($parameters as $parameter) { + $this->assertArrayHasKey('$id', $parameter); + $this->assertArrayHasKey('name', $parameter); + $this->assertArrayHasKey('example', $parameter); + $this->assertArrayHasKey('hint', $parameter); + $this->assertNotSame('', $parameter['$id']); + $this->assertNotSame('', $parameter['name']); + } + } + + public static function providerParameters(): \Iterator + { + yield 'default provider' => [Base::getProviderActions()['amazon'], ['clientId', 'clientSecret']]; + yield 'custom id and secret names' => [DropboxUpdate::class, ['appKey', 'appSecret']]; + yield 'apple' => [AppleUpdate::class, ['serviceId', 'keyId', 'teamId', 'p8File']]; + yield 'auth0' => [Auth0Update::class, ['clientId', 'clientSecret', 'endpoint']]; + yield 'authentik' => [AuthentikUpdate::class, ['clientId', 'clientSecret', 'endpoint']]; + yield 'fusionauth' => [FusionAuthUpdate::class, ['clientId', 'clientSecret', 'endpoint']]; + yield 'gitlab' => [GitlabUpdate::class, ['applicationId', 'secret', 'endpoint']]; + yield 'google' => [GoogleUpdate::class, ['clientId', 'clientSecret', 'prompt']]; + yield 'keycloak' => [KeycloakUpdate::class, ['clientId', 'clientSecret', 'endpoint', 'realmName']]; + yield 'microsoft' => [MicrosoftUpdate::class, ['applicationId', 'applicationSecret', 'tenant']]; + yield 'oidc' => [OidcUpdate::class, ['clientId', 'clientSecret', 'wellKnownURL', 'authorizationURL', 'tokenURL', 'userInfoURL']]; + yield 'okta' => [OktaUpdate::class, ['clientId', 'clientSecret', 'domain', 'authorizationServerId']]; + } + + /** + * @param class-string $actionClass + */ + #[DataProvider('plainProviders')] + public function testPlainProviderReadResponsesUseProviderSpecificFieldNames( + string $providerId, + string $actionClass, + string $idField, + string $secretField + ): void { + $action = new $actionClass(); + $response = $action->buildReadResponse($this->project([ + $providerId . 'Enabled' => true, + $providerId . 'Appid' => 'stored-id', + $providerId . 'Secret' => 'stored-secret', + ])); + + $this->assertSame($providerId, $response->getAttribute('$id')); + $this->assertTrue($response->getAttribute('enabled')); + $this->assertSame('stored-id', $response->getAttribute($idField)); + $this->assertSame('', $response->getAttribute($secretField)); + + if ($idField !== 'clientId') { + $this->assertFalse($response->offsetExists('clientId')); + } + if ($secretField !== 'clientSecret') { + $this->assertFalse($response->offsetExists('clientSecret')); + } + } + + public static function plainProviders(): \Iterator + { + $actions = Base::getProviderActions(); + yield 'amazon' => ['amazon', $actions['amazon'], 'clientId', 'clientSecret']; + yield 'dailymotion' => ['dailymotion', $actions['dailymotion'], 'apiKey', 'apiSecret']; + yield 'bitbucket' => ['bitbucket', $actions['bitbucket'], 'key', 'secret']; + yield 'dropbox' => ['dropbox', DropboxUpdate::class, 'appKey', 'appSecret']; + yield 'etsy' => ['etsy', $actions['etsy'], 'keyString', 'sharedSecret']; + yield 'facebook' => ['facebook', $actions['facebook'], 'appId', 'appSecret']; + yield 'notion' => ['notion', $actions['notion'], 'oauthClientId', 'oauthClientSecret']; + yield 'paypal' => ['paypal', $actions['paypal'], 'clientId', 'secretKey']; + yield 'salesforce' => ['salesforce', $actions['salesforce'], 'customerKey', 'customerSecret']; + yield 'stripe' => ['stripe', $actions['stripe'], 'clientId', 'apiSecretKey']; + yield 'tradeshift' => ['tradeshift', $actions['tradeshift'], 'oauth2ClientId', 'oauth2ClientSecret']; + yield 'x' => ['x', $actions['x'], 'customerKey', 'secretKey']; + } + + public function testAppleReadResponseHidesP8FileAndExposesNonSecretFields(): void + { + $response = (new AppleUpdate())->buildReadResponse($this->project([ + 'appleEnabled' => true, + 'appleAppid' => 'ip.appwrite.app.web', + 'appleSecret' => \json_encode([ + 'p8' => 'private-key', + 'keyID' => 'KEY123', + 'teamID' => 'TEAM123', + ]), + ])); + + $this->assertSame('apple', $response->getAttribute('$id')); + $this->assertTrue($response->getAttribute('enabled')); + $this->assertSame('ip.appwrite.app.web', $response->getAttribute('serviceId')); + $this->assertSame('KEY123', $response->getAttribute('keyId')); + $this->assertSame('TEAM123', $response->getAttribute('teamId')); + $this->assertSame('', $response->getAttribute('p8File')); + $this->assertFalse($response->offsetExists('clientId')); + $this->assertFalse($response->offsetExists('clientSecret')); + } + + /** + * @param class-string $actionClass + * @param array $storedSecret + * @param array $expected + */ + #[DataProvider('jsonBackedReadResponses')] + public function testJsonBackedReadResponsesExposeOnlyNonSecretExtras( + string $providerId, + string $actionClass, + array $storedSecret, + array $expected + ): void { + $response = (new $actionClass())->buildReadResponse($this->project([ + $providerId . 'Enabled' => true, + $providerId . 'Appid' => 'stored-id', + $providerId . 'Secret' => \json_encode($storedSecret), + ])); + + $this->assertSame($providerId, $response->getAttribute('$id')); + $this->assertSame('stored-id', $response->getAttribute($actionClass::getClientIdParamName())); + $this->assertSame('', $response->getAttribute($actionClass::getClientSecretParamName())); + + foreach ($expected as $key => $value) { + $this->assertSame($value, $response->getAttribute($key)); + } + } + + public static function jsonBackedReadResponses(): \Iterator + { + yield 'auth0' => ['auth0', Auth0Update::class, ['clientSecret' => 'secret', 'auth0Domain' => 'example.us.auth0.com'], ['endpoint' => 'example.us.auth0.com']]; + yield 'authentik' => ['authentik', AuthentikUpdate::class, ['clientSecret' => 'secret', 'authentikDomain' => 'example.authentik.com'], ['endpoint' => 'example.authentik.com']]; + yield 'fusionauth' => ['fusionauth', FusionAuthUpdate::class, ['clientSecret' => 'secret', 'fusionAuthDomain' => 'example.fusionauth.io'], ['endpoint' => 'example.fusionauth.io']]; + yield 'gitlab' => ['gitlab', GitlabUpdate::class, ['clientSecret' => 'secret', 'endpoint' => 'https://gitlab.example.com'], ['endpoint' => 'https://gitlab.example.com']]; + yield 'google' => ['google', GoogleUpdate::class, ['clientSecret' => 'secret', 'prompt' => ['select_account']], ['prompt' => ['select_account']]]; + yield 'keycloak' => ['keycloak', KeycloakUpdate::class, ['clientSecret' => 'secret', 'keycloakDomain' => 'keycloak.example.com', 'keycloakRealm' => 'appwrite-realm'], ['endpoint' => 'keycloak.example.com', 'realmName' => 'appwrite-realm']]; + yield 'microsoft' => ['microsoft', MicrosoftUpdate::class, ['clientSecret' => 'secret', 'tenantID' => 'common'], ['tenant' => 'common']]; + yield 'oidc' => ['oidc', OidcUpdate::class, ['clientSecret' => 'secret', 'wellKnownEndpoint' => 'https://idp.example/.well-known/openid-configuration', 'authorizationEndpoint' => '', 'tokenEndpoint' => '', 'userInfoEndpoint' => ''], ['wellKnownURL' => 'https://idp.example/.well-known/openid-configuration', 'authorizationURL' => '', 'tokenURL' => '', 'userInfoURL' => '']]; + yield 'okta' => ['okta', OktaUpdate::class, ['clientSecret' => 'secret', 'oktaDomain' => 'trial-6400025.okta.com', 'authorizationServerId' => 'aus123'], ['domain' => 'trial-6400025.okta.com', 'authorizationServerId' => 'aus123']]; + } + + public function testInvalidStoredJsonReturnsEmptyExtras(): void + { + $response = (new Auth0Update())->buildReadResponse($this->project([ + 'auth0Enabled' => false, + 'auth0Appid' => 'stored-id', + 'auth0Secret' => '{not-json', + ])); + + $this->assertSame('stored-id', $response->getAttribute('clientId')); + $this->assertSame('', $response->getAttribute('clientSecret')); + $this->assertSame('', $response->getAttribute('endpoint')); + } + + public function testApplePartialUpdatesMergeStoredSecretFields(): void + { + $result = $this->runHandle( + new AppleUpdate(), + $this->project([ + 'appleEnabled' => false, + 'appleAppid' => 'ip.appwrite.app.seed', + 'appleSecret' => \json_encode([ + 'p8' => 'old-p8', + 'keyID' => 'OLDKEY', + 'teamID' => 'OLDTEAM', + ]), + ]), + [null, 'NEWKEY', null, null, false], + ); + + $stored = \json_decode($result['updatedProject']->getAttribute('oAuthProviders')['appleSecret'], true); + $this->assertSame('ip.appwrite.app.seed', $result['updatedProject']->getAttribute('oAuthProviders')['appleAppid']); + $this->assertSame('old-p8', $stored['p8']); + $this->assertSame('NEWKEY', $stored['keyID']); + $this->assertSame('OLDTEAM', $stored['teamID']); + $this->assertSame('NEWKEY', $result['response']->getAttribute('keyId')); + $this->assertSame('', $result['response']->getAttribute('p8File')); + } + + /** + * @param class-string $actionClass + * @param array $initialSecret + * @param array $args + * @param array $expectedSecret + * @param array $expectedResponse + */ + #[DataProvider('partialJsonMergeScenarios')] + public function testPartialJsonBackedUpdatesPreserveExistingFields( + string $providerId, + string $actionClass, + array $initialSecret, + array $args, + array $expectedSecret, + array $expectedResponse + ): void { + $result = $this->runHandle( + new $actionClass(), + $this->project([ + $providerId . 'Enabled' => false, + $providerId . 'Appid' => 'seed-id', + $providerId . 'Secret' => \json_encode($initialSecret), + ]), + $args, + ); + + $stored = \json_decode($result['updatedProject']->getAttribute('oAuthProviders')[$providerId . 'Secret'], true); + foreach ($expectedSecret as $key => $value) { + $this->assertSame($value, $stored[$key]); + } + + foreach ($expectedResponse as $key => $value) { + $this->assertSame($value, $result['response']->getAttribute($key)); + } + } + + public static function partialJsonMergeScenarios(): \Iterator + { + yield 'auth0 endpoint only' => [ + 'auth0', + Auth0Update::class, + ['clientSecret' => 'old-secret', 'auth0Domain' => 'old.us.auth0.com'], + [null, null, 'new.us.auth0.com', false], + ['clientSecret' => 'old-secret', 'auth0Domain' => 'new.us.auth0.com'], + ['clientId' => 'seed-id', 'clientSecret' => '', 'endpoint' => 'new.us.auth0.com'], + ]; + yield 'authentik client only' => [ + 'authentik', + AuthentikUpdate::class, + ['clientSecret' => 'old-secret', 'authentikDomain' => 'old.authentik.com'], + ['rotated-id', null, null, false], + ['clientSecret' => 'old-secret', 'authentikDomain' => 'old.authentik.com'], + ['clientId' => 'rotated-id', 'endpoint' => 'old.authentik.com'], + ]; + yield 'fusionauth secret only' => [ + 'fusionauth', + FusionAuthUpdate::class, + ['clientSecret' => 'old-secret', 'fusionAuthDomain' => 'old.fusionauth.io'], + [null, 'new-secret', null, false], + ['clientSecret' => 'new-secret', 'fusionAuthDomain' => 'old.fusionauth.io'], + ['clientId' => 'seed-id', 'endpoint' => 'old.fusionauth.io'], + ]; + yield 'gitlab endpoint only' => [ + 'gitlab', + GitlabUpdate::class, + ['clientSecret' => 'old-secret', 'endpoint' => 'https://old.gitlab.example'], + [null, null, 'https://new.gitlab.example', false], + ['clientSecret' => 'old-secret', 'endpoint' => 'https://new.gitlab.example'], + ['applicationId' => 'seed-id', 'endpoint' => 'https://new.gitlab.example'], + ]; + yield 'keycloak realm only' => [ + 'keycloak', + KeycloakUpdate::class, + ['clientSecret' => 'old-secret', 'keycloakDomain' => 'keycloak.example.com', 'keycloakRealm' => 'old-realm'], + [null, null, null, 'new-realm', false], + ['clientSecret' => 'old-secret', 'keycloakDomain' => 'keycloak.example.com', 'keycloakRealm' => 'new-realm'], + ['clientId' => 'seed-id', 'endpoint' => 'keycloak.example.com', 'realmName' => 'new-realm'], + ]; + yield 'microsoft tenant only' => [ + 'microsoft', + MicrosoftUpdate::class, + ['clientSecret' => 'old-secret', 'tenantID' => 'organizations'], + [null, null, 'common', false], + ['clientSecret' => 'old-secret', 'tenantID' => 'common'], + ['applicationId' => 'seed-id', 'tenant' => 'common'], + ]; + yield 'okta authorization server only' => [ + 'okta', + OktaUpdate::class, + ['clientSecret' => 'old-secret', 'oktaDomain' => 'trial-6400025.okta.com', 'authorizationServerId' => 'old-server'], + [null, null, null, 'new-server', false], + ['clientSecret' => 'old-secret', 'oktaDomain' => 'trial-6400025.okta.com', 'authorizationServerId' => 'new-server'], + ['clientId' => 'seed-id', 'domain' => 'trial-6400025.okta.com', 'authorizationServerId' => 'new-server'], + ]; + } + + public function testOidcAcceptsWellKnownMode(): void + { + $result = $this->runHandle(new OidcUpdate(), $this->project(), [ + 'oidc-client', + 'oidc-secret', + 'https://idp.example/.well-known/openid-configuration', + null, + null, + null, + true, + ]); + + $stored = \json_decode($result['updatedProject']->getAttribute('oAuthProviders')['oidcSecret'], true); + $this->assertSame('https://idp.example/.well-known/openid-configuration', $stored['wellKnownEndpoint']); + $this->assertTrue($result['response']->getAttribute('enabled')); + $this->assertSame('https://idp.example/.well-known/openid-configuration', $result['response']->getAttribute('wellKnownURL')); + } + + public function testOidcAcceptsDiscoveryUrlMode(): void + { + $result = $this->runHandle(new OidcUpdate(), $this->project(), [ + 'oidc-client', + 'oidc-secret', + null, + 'https://idp.example/oauth2/authorize', + 'https://idp.example/oauth2/token', + 'https://idp.example/oauth2/userinfo', + true, + ]); + + $stored = \json_decode($result['updatedProject']->getAttribute('oAuthProviders')['oidcSecret'], true); + $this->assertSame('https://idp.example/oauth2/authorize', $stored['authorizationEndpoint']); + $this->assertSame('https://idp.example/oauth2/token', $stored['tokenEndpoint']); + $this->assertSame('https://idp.example/oauth2/userinfo', $stored['userInfoEndpoint']); + $this->assertTrue($result['response']->getAttribute('enabled')); + } + + public function testOidcRejectsEnableWithIncompleteDiscoveryConfig(): void + { + $this->expectException(Exception::class); + + $this->runHandle( + new OidcUpdate(), + $this->project(), + [ + 'oidc-client', + 'oidc-secret', + null, + 'https://idp.example/oauth2/authorize', + null, + 'https://idp.example/oauth2/userinfo', + true, + ], + assertQueueParam: false, + ); + } + + public function testOidcCanSwitchFromWellKnownToDiscoveryMode(): void + { + $result = $this->runHandle( + new OidcUpdate(), + $this->project([ + 'oidcEnabled' => false, + 'oidcAppid' => 'oidc-client', + 'oidcSecret' => \json_encode([ + 'clientSecret' => 'oidc-secret', + 'wellKnownEndpoint' => 'https://old.example/.well-known/openid-configuration', + 'authorizationEndpoint' => '', + 'tokenEndpoint' => '', + 'userInfoEndpoint' => '', + ]), + ]), + [ + null, + null, + '', + 'https://idp.example/oauth2/authorize', + 'https://idp.example/oauth2/token', + 'https://idp.example/oauth2/userinfo', + true, + ], + ); + + $stored = \json_decode($result['updatedProject']->getAttribute('oAuthProviders')['oidcSecret'], true); + $this->assertSame('', $stored['wellKnownEndpoint']); + $this->assertSame('https://idp.example/oauth2/authorize', $stored['authorizationEndpoint']); + $this->assertTrue($result['response']->getAttribute('enabled')); + } + + public function testGooglePromptRulesAndBackwardCompatibleSecretStorage(): void + { + $result = $this->runHandle( + new GoogleUpdate(), + $this->project([ + 'googleEnabled' => false, + 'googleAppid' => 'google-client', + 'googleSecret' => 'legacy-plain-secret', + ]), + [null, null, ['none'], false], + ); + + $stored = \json_decode($result['updatedProject']->getAttribute('oAuthProviders')['googleSecret'], true); + $this->assertSame('legacy-plain-secret', $stored['clientSecret']); + $this->assertSame(['none'], $stored['prompt']); + $this->assertSame(['none'], $result['response']->getAttribute('prompt')); + } + + public function testGoogleRejectsEmptyPrompt(): void + { + $this->expectException(Exception::class); + + $this->runHandle( + new GoogleUpdate(), + $this->project(), + [ + 'google-client', + 'google-secret', + [], + false, + ], + assertQueueParam: false, + ); + } + + public function testGoogleRejectsNoneWithOtherPrompts(): void + { + $this->expectException(Exception::class); + + $this->runHandle( + new GoogleUpdate(), + $this->project(), + [ + 'google-client', + 'google-secret', + ['none', 'consent'], + false, + ], + assertQueueParam: false, + ); + } + + public function testOktaRequiresDomainWhenEnabling(): void + { + $this->expectException(Exception::class); + + $this->runHandle( + new OktaUpdate(), + $this->project(), + [ + 'okta-client', + 'okta-secret', + '', + null, + true, + ], + assertQueueParam: false, + ); + } + + public function testOktaCanEnableWithStoredDomain(): void + { + $result = $this->runHandle( + new OktaUpdate(), + $this->project([ + 'oktaEnabled' => false, + 'oktaAppid' => 'okta-client', + 'oktaSecret' => \json_encode([ + 'clientSecret' => 'okta-secret', + 'oktaDomain' => 'trial-6400025.okta.com', + 'authorizationServerId' => '', + ]), + ]), + [null, null, null, null, true], + ); + + $this->assertTrue($result['response']->getAttribute('enabled')); + $this->assertSame('trial-6400025.okta.com', $result['response']->getAttribute('domain')); + } + + /** + * @param array $oAuthProviders + */ + private function project(array $oAuthProviders = []): Document + { + return new Document([ + '$id' => 'project-test', + 'oAuthProviders' => $oAuthProviders, + ]); + } + + /** + * @param array $args + * @return array{updatedProject: Document, response: Document} + */ + private function runHandle(Base $action, Document $project, array $args, bool $assertQueueParam = true): array + { + $updatedProject = null; + $responseDocument = null; + + $dbForPlatform = $this->createStub(Database::class); + $dbForPlatform + ->method('updateDocument') + ->willReturnCallback(function (string $collection, string $id, Document $updates) use ($project, &$updatedProject): Document { + $this->assertSame('projects', $collection); + $this->assertSame('project-test', $id); + + $updatedProject = new Document($project->getArrayCopy()); + $updatedProject->setAttribute('oAuthProviders', $updates->getAttribute('oAuthProviders', [])); + + return $updatedProject; + }); + + $authorization = $this->createStub(Authorization::class); + $authorization + ->method('skip') + ->willReturnCallback(fn (callable $callback): mixed => $callback()); + + $response = $this->createStub(Response::class); + $response + ->method('dynamic') + ->willReturnCallback(function (Document $document) use (&$responseDocument): void { + $responseDocument = $document; + }); + + $queueForEvents = $this->getMockBuilder(QueueEvent::class) + ->disableOriginalConstructor() + ->onlyMethods(['setParam']) + ->getMock(); + $queueForEvents + ->expects($assertQueueParam ? $this->once() : $this->atMost(1)) + ->method('setParam') + ->with('providerId', $action::getProviderId()); + + $handle = [$action, 'handle']; + $this->assertIsCallable($handle); + $handle(...[ + ...$args, + $response, + $dbForPlatform, + $project, + $authorization, + $queueForEvents, + ]); + + $this->assertInstanceOf(Document::class, $updatedProject); + $this->assertInstanceOf(Document::class, $responseDocument); + + return [ + 'updatedProject' => $updatedProject, + 'response' => $responseDocument, + ]; + } +} diff --git a/tests/unit/Platform/PermissionTest.php b/tests/unit/Platform/PermissionTest.php new file mode 100644 index 0000000000..8e52488d5c --- /dev/null +++ b/tests/unit/Platform/PermissionTest.php @@ -0,0 +1,49 @@ +subject()->getPermissions('team1', 'project1'); + + $this->assertSame([ + DbPermission::read(Role::team('team1', 'owner')), + DbPermission::read(Role::team('team1', 'developer')), + DbPermission::update(Role::team('team1', 'owner')), + DbPermission::update(Role::team('team1', 'developer')), + DbPermission::delete(Role::team('team1', 'owner')), + DbPermission::delete(Role::team('team1', 'developer')), + DbPermission::read(Role::team('team1', 'project-project1-owner')), + DbPermission::read(Role::team('team1', 'project-project1-developer')), + DbPermission::update(Role::team('team1', 'project-project1-owner')), + DbPermission::update(Role::team('team1', 'project-project1-developer')), + DbPermission::delete(Role::team('team1', 'project-project1-owner')), + DbPermission::delete(Role::team('team1', 'project-project1-developer')), + ], $permissions); + } + + public function testGetPermissionsDoesNotGrantUnrelatedProjectRoles(): void + { + $permissions = $this->subject()->getPermissions('team1', 'project1'); + + $this->assertNotContains(DbPermission::read(Role::team('team1', 'project-project2-owner')), $permissions); + $this->assertNotContains(DbPermission::update(Role::team('team1', 'project-project2-developer')), $permissions); + $this->assertNotContains(DbPermission::delete(Role::team('team2', 'project-project1-owner')), $permissions); + } + + private function subject(): object + { + return new class () { + use Permission; + }; + } +} diff --git a/tests/unit/SDK/Specification/FormatTest.php b/tests/unit/SDK/Specification/FormatTest.php index ea9ed3bd43..0b9a472be3 100644 --- a/tests/unit/SDK/Specification/FormatTest.php +++ b/tests/unit/SDK/Specification/FormatTest.php @@ -2,16 +2,44 @@ namespace Tests\Unit\SDK\Specification; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; use Appwrite\SDK\Specification\Format; +use Appwrite\SDK\Specification\Format\OpenAPI3; +use Appwrite\SDK\Specification\Validator\PasswordFormat; +use Appwrite\Utopia\Database\Validator\CustomId; +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model\AlgoArgon2; +use Appwrite\Utopia\Response\Model\AlgoBcrypt; +use Appwrite\Utopia\Response\Model\AlgoMd5; +use Appwrite\Utopia\Response\Model\AlgoPhpass; +use Appwrite\Utopia\Response\Model\AlgoScrypt; +use Appwrite\Utopia\Response\Model\AlgoScryptModified; +use Appwrite\Utopia\Response\Model\AlgoSha; +use Appwrite\Utopia\Response\Model\AttributeLine; +use Appwrite\Utopia\Response\Model\Error as ErrorModel; use Appwrite\Utopia\Response\Model\HealthStatus; +use Appwrite\Utopia\Response\Model\None as NoneModel; use Appwrite\Utopia\Response\Model\PlatformAndroid; use Appwrite\Utopia\Response\Model\PlatformApple; use Appwrite\Utopia\Response\Model\PlatformLinux; use Appwrite\Utopia\Response\Model\PlatformList; use Appwrite\Utopia\Response\Model\PlatformWeb; use Appwrite\Utopia\Response\Model\PlatformWindows; +use Appwrite\Utopia\Response\Model\Preferences; +use Appwrite\Utopia\Response\Model\Provider; +use Appwrite\Utopia\Response\Model\Team; +use Appwrite\Utopia\Response\Model\User; +use Appwrite\Utopia\Response\Model\Webhook; use PHPUnit\Framework\TestCase; +use Utopia\Database\Database; +use Utopia\Database\Validator\Spatial; use Utopia\DI\Container; +use Utopia\Http\Route; +use Utopia\Validator\JSON; +use Utopia\Validator\Nullable; +use Utopia\Validator\Text; class TestFormat extends Format { @@ -29,9 +57,14 @@ class TestFormat extends Format { return $this->getRequestParameterConfig($optional, $nullable, $default, $methodName, $paramName); } + + public function arrayItemsSchema(mixed $example): array + { + return $this->getArrayItemsSchema($example); + } } -class FormatTest extends TestCase +final class FormatTest extends TestCase { private TestFormat $format; @@ -76,4 +109,383 @@ class FormatTest extends TestCase { $this->assertSame('HealthCheckStatus', (new HealthStatus())->getRules()['status']['enumSDKName']); } + + public function testOpenApiCustomIdBodyFieldIncludesIdGeneratorMetadata(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('POST', '/v1/tests')) + ->desc('Create test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'createTest', + description: 'Create test.', + auth: [], + responses: [], + )) + ->param('userId', '', new CustomId(), 'User ID.'); + + $spec = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + + $this->assertSame( + ['idGenerator' => 'ID.unique'], + $spec['paths']['/tests']['post']['requestBody']['content']['application/json']['schema']['properties']['userId']['x-appwrite'] + ); + } + + public function testDeleteRouteOptionalParamsAreQueryParams(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('DELETE', '/v1/tests/:testId')) + ->desc('Delete test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'deleteTest', + description: 'Delete test.', + auth: [], + responses: [], + )) + ->param('testId', '', new Text(256), 'Test ID.') + ->param('transactionId', null, new Nullable(new Text(256)), 'Transaction ID.', true); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + + $this->assertArrayNotHasKey('requestBody', $openApi['paths']['/tests/{testId}']['delete']); + $this->assertCount(2, $openApi['paths']['/tests/{testId}']['delete']['parameters']); + $this->assertSame('path', $openApi['paths']['/tests/{testId}']['delete']['parameters'][0]['in']); + $this->assertSame('transactionId', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['name']); + $this->assertSame('query', $openApi['paths']['/tests/{testId}']['delete']['parameters'][1]['in']); + + } + + public function testModelReferencesDoNotEmitItemsOnObjectProperties(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/team')) + ->desc('Get test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getTeamTest', + description: 'Get test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_TEAM, + ), + ], + )); + + $models = [ + new Team(), + new Preferences(), + new ErrorModel(), + ]; + + $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + + $openApiPrefs = $openApi['components']['schemas']['team']['properties']['prefs']; + + $this->assertArrayNotHasKey('items', $openApiPrefs); + $this->assertArrayNotHasKey('error', $openApi['components']['schemas']); + $this->assertSame('object', $openApiPrefs['type']); + $this->assertSame([['$ref' => '#/components/schemas/preferences']], $openApiPrefs['allOf']); + + } + + public function testArrayItemsSchemaInfersTypesFromJsonStringExamples(): void + { + $this->assertSame( + [ + 'type' => 'array', + 'items' => [ + 'type' => 'number', + 'format' => 'double', + ], + ], + $this->format->arrayItemsSchema('[[1,2],[3,4]]') + ); + + $this->assertSame( + [ + 'type' => 'object', + 'additionalProperties' => true, + ], + $this->format->arrayItemsSchema('[{"resource":"Database","id":"public"}]') + ); + + $this->assertSame( + ['type' => 'string'], + $this->format->arrayItemsSchema('["topt", "email"]') + ); + + $this->assertSame( + ['type' => 'object'], + $this->format->arrayItemsSchema('[SHARED_SECRET]') + ); + } + + public function testMultiTypePropertiesWrapOneOfInAllOf(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/user')) + ->desc('Get test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getUserTest', + description: 'Get test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_USER, + ), + ], + )); + + $models = [ + new User(), + new AlgoArgon2(), + new AlgoScrypt(), + new AlgoScryptModified(), + new AlgoBcrypt(), + new AlgoPhpass(), + new AlgoSha(), + new AlgoMd5(), + ]; + + $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + + $openApiHashOptions = $openApi['components']['schemas']['user']['properties']['hashOptions']; + + $this->assertSame('object', $openApiHashOptions['type']); + $this->assertArrayNotHasKey('items', $openApiHashOptions); + $this->assertArrayNotHasKey('oneOf', $openApiHashOptions); + $this->assertCount(1, $openApiHashOptions['allOf']); + $this->assertCount(7, $openApiHashOptions['allOf'][0]['oneOf']); + $this->assertSame(['$ref' => '#/components/schemas/algoArgon2'], $openApiHashOptions['allOf'][0]['oneOf'][0]); + + } + + public function testArraySchemasEmitItems(): void + { + Method::$processed = []; + Method::$errors = []; + + $requestRoute = (new Route('POST', '/v1/tests/spatial')) + ->desc('Create spatial test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'createSpatialTest', + description: 'Create spatial test.', + auth: [], + responses: [], + )) + ->param('default', null, new Nullable(new Spatial(Database::VAR_LINESTRING)), 'Default value.', true); + + $modelRoute = (new Route('GET', '/v1/tests/spatial-model')) + ->desc('Get spatial test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getSpatialTest', + description: 'Get spatial test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_ATTRIBUTE_LINE, + ), + ], + )); + + $openApi = (new OpenAPI3(new Container(), [], [$requestRoute, $modelRoute], [new AttributeLine()], [], 0, 'console'))->parse(); + + $openApiRequestDefault = $openApi['paths']['/tests/spatial']['post']['requestBody']['content']['application/json']['schema']['properties']['default']; + $openApiModelDefault = $openApi['components']['schemas']['attributeLine']['properties']['default']; + + foreach ([$openApiRequestDefault, $openApiModelDefault] as $default) { + $this->assertSame('array', $default['type']); + $this->assertSame('array', $default['items']['type']); + $this->assertSame('number', $default['items']['items']['type']); + $this->assertSame('double', $default['items']['items']['format']); + } + } + + public function testPasswordFormatMarksOnlyExplicitPasswordFields(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('POST', '/v1/tests')) + ->desc('Create test') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'createTest', + description: 'Create test.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_WEBHOOK, + ), + ], + )) + ->param('password', '', new PasswordFormat(new Text(256)), 'Password.') + ->param('nullablePassword', null, new Nullable(new PasswordFormat(new Text(256, 0))), 'Nullable password.', true) + ->param('name', '', new Text(256), 'Name.'); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [new Webhook()], [], 0, 'console'))->parse(); + + $openApiProperties = $openApi['paths']['/tests']['post']['requestBody']['content']['application/json']['schema']['properties']; + + $this->assertSame('password', $openApiProperties['password']['format']); + $this->assertSame('password', $openApiProperties['nullablePassword']['format']); + $this->assertTrue($openApiProperties['nullablePassword']['x-nullable']); + $this->assertArrayNotHasKey('format', $openApiProperties['name']); + $this->assertSame('password', $openApi['components']['schemas']['webhook']['properties']['authPassword']['format']); + + } + + public function testNoContentMethodsKeepProducesMetadata(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('DELETE', '/v1/tests/:testId')) + ->desc('Delete test') + ->label('scope', 'tests.write') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'deleteTest', + description: 'Delete test.', + auth: [], + responses: [ + new SDKResponse( + code: 204, + model: Response::MODEL_NONE, + ), + ], + )) + ->param('testId', '', new Text(256), 'Test ID.'); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); + + $openApiMethod = $openApi['paths']['/tests/{testId}']['delete']; + + $this->assertArrayNotHasKey('content', $openApiMethod['responses']['204']); + $this->assertSame(['application/json'], $openApiMethod['x-appwrite']['produces']); + } + + public function testBinaryResponsesEmitResponseContent(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/icon')) + ->desc('Get test icon') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getTestIcon', + description: 'Get test icon.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_NONE, + ), + ], + contentType: ContentType::IMAGE_PNG, + )); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [new NoneModel()], [], 0, 'console'))->parse(); + + $openApiMethod = $openApi['paths']['/tests/icon']['get']; + + $this->assertSame( + ['type' => 'string', 'format' => 'binary'], + $openApiMethod['responses']['200']['content']['image/png']['schema'] + ); + $this->assertArrayNotHasKey('produces', $openApiMethod['x-appwrite']); + } + + public function testAdditionalParametersAreIncludedInRequestBody(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('POST', '/v1/tests/graphql')) + ->desc('GraphQL test endpoint') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'queryTest', + description: 'GraphQL test endpoint.', + auth: [], + responses: [], + additionalParameters: [ + 'query' => [ + 'default' => [], + 'validator' => new JSON(), + 'description' => 'The query or queries to execute.', + 'optional' => false, + ], + ], + )); + + $openApi = (new OpenAPI3(new Container(), [], [$route], [], [], 0, 'console'))->parse(); + + $openApiQuery = $openApi['paths']['/tests/graphql']['post']['requestBody']['content']['application/json']['schema']['properties']['query']; + + $this->assertSame('object', $openApiQuery['type']); + } + + public function testJsonModelRulesKeepAdditionalPropertiesAndSkipNullable(): void + { + Method::$processed = []; + Method::$errors = []; + + $route = (new Route('GET', '/v1/tests/provider')) + ->desc('Get test provider') + ->label('sdk', new Method( + namespace: 'test', + group: null, + name: 'getTestProvider', + description: 'Get test provider.', + auth: [], + responses: [ + new SDKResponse( + code: 200, + model: Response::MODEL_PROVIDER, + ), + ], + )); + + $models = [ + new Provider(), + new ErrorModel(), + ]; + + $openApi = (new OpenAPI3(new Container(), [], [$route], $models, [], 0, 'console'))->parse(); + + $openApiOptions = $openApi['components']['schemas']['provider']['properties']['options']; + + $this->assertTrue($openApiOptions['additionalProperties']); + $this->assertArrayNotHasKey('nullable', $openApiOptions); + } } diff --git a/tests/unit/Task/Validator/CronTest.php b/tests/unit/Task/Validator/CronTest.php index 3809c825b5..94d71f352b 100644 --- a/tests/unit/Task/Validator/CronTest.php +++ b/tests/unit/Task/Validator/CronTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->isValid('0 2 * * *'), true); // execute at 2am daily - $this->assertEquals($this->object->isValid('0 5,17 * * *'), true); // execute twice a day - $this->assertEquals($this->object->isValid('* * * * *'), true); // execute on every minutes + $this->assertEquals(true, $this->object->isValid('0 2 * * *')); // execute at 2am daily + $this->assertEquals(true, $this->object->isValid('0 5,17 * * *')); // execute twice a day + $this->assertEquals(true, $this->object->isValid('* * * * *')); // execute on every minutes // $this->assertEquals($this->object->isValid('0 17 * * sun'), true); // execute on every Sunday at 5 PM - $this->assertEquals($this->object->isValid('*/10 * * * *'), true); // execute on every 10 minutes - $this->assertEquals($this->object->isValid('*/5 22-23,0-3 * * *'), true); // execute every 5 minutes from 10pm to 3am + $this->assertEquals(true, $this->object->isValid('*/10 * * * *')); // execute on every 10 minutes + $this->assertEquals(true, $this->object->isValid('*/5 22-23,0-3 * * *')); // execute every 5 minutes from 10pm to 3am // $this->assertEquals($this->object->isValid('* * * jan,may,aug *'), true); // execute on selected months // $this->assertEquals($this->object->isValid('0 17 * * sun,fri'), true); // execute on selected days // $this->assertEquals($this->object->isValid('0 2 * * sun'), true); // execute on first sunday of every month - $this->assertEquals($this->object->isValid('0 */4 * * *'), true); // execute on every four hours + $this->assertEquals(true, $this->object->isValid('0 */4 * * *')); // execute on every four hours // $this->assertEquals($this->object->isValid('0 4,17 * * sun,mon'), true); // execute twice on every Sunday and Monday - $this->assertEquals($this->object->isValid('bad expression'), false); - $this->assertEquals($this->object->isValid('*/5 22-3 * * *'), false); - $this->assertEquals(null, false); - $this->assertEquals('', false); + $this->assertFalse($this->object->isValid('bad expression')); + $this->assertFalse($this->object->isValid('*/5 22-3 * * *')); } } diff --git a/tests/unit/Template/TemplateTest.php b/tests/unit/Template/TemplateTest.php index 1ca1595ca3..7dee6ca078 100644 --- a/tests/unit/Template/TemplateTest.php +++ b/tests/unit/Template/TemplateTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->render(), 'Hello WORLD'); + $this->assertEquals('Hello WORLD', $this->object->render()); } public function testParseURL(): void { $url = $this->object->parseURL('https://appwrite.io/demo'); - $this->assertEquals($url['scheme'], 'https'); - $this->assertEquals($url['host'], 'appwrite.io'); - $this->assertEquals($url['path'], '/demo'); + $this->assertEquals('https', $url['scheme']); + $this->assertEquals('appwrite.io', $url['host']); + $this->assertEquals('/demo', $url['path']); } public function testUnParseURL(): void @@ -46,23 +48,23 @@ class TemplateTest extends TestCase $url['host'] = 'example.com'; $url['path'] = '/new'; - $this->assertEquals($this->object->unParseURL($url), 'http://example.com/new'); + $this->assertEquals('http://example.com/new', $this->object->unParseURL($url)); } public function testMergeQuery(): void { - $this->assertEquals($this->object->mergeQuery('key1=value1&key2=value2', ['key1' => 'value3', 'key4' => 'value4']), 'key1=value3&key2=value2&key4=value4'); + $this->assertEquals('key1=value3&key2=value2&key4=value4', $this->object->mergeQuery('key1=value1&key2=value2', ['key1' => 'value3', 'key4' => 'value4'])); } public function testFromCamelCaseToSnake(): void { - $this->assertEquals('app_write', Template::fromCamelCaseToSnake('appWrite')); - $this->assertEquals('app_write', Template::fromCamelCaseToSnake('App Write')); + $this->assertSame('app_write', Template::fromCamelCaseToSnake('appWrite')); + $this->assertSame('app_write', Template::fromCamelCaseToSnake('App Write')); } public function testFromCamelCaseToDash(): void { - $this->assertEquals('app-write', Template::fromCamelCaseToDash('appWrite')); - $this->assertEquals('app-write', Template::fromCamelCaseToDash('App Write')); + $this->assertSame('app-write', Template::fromCamelCaseToDash('appWrite')); + $this->assertSame('app-write', Template::fromCamelCaseToDash('App Write')); } } diff --git a/tests/unit/Transformation/TransformationTest.php b/tests/unit/Transformation/TransformationTest.php index a3169026a3..2b7cb568c3 100644 --- a/tests/unit/Transformation/TransformationTest.php +++ b/tests/unit/Transformation/TransformationTest.php @@ -1,5 +1,7 @@ setTraits(['mock' => true, 'content-type' => 'text/plain, text/html; charset=utf-8']); $this->assertTrue($transformer->transform()); - $this->assertStringContainsString("Hello world", $transformer->getOutput()); - $this->assertStringContainsString("Preview by", $transformer->getOutput()); - $this->assertStringContainsString("Mock:", $transformer->getOutput()); + $this->assertStringContainsString("Hello world", (string) $transformer->getOutput()); + $this->assertStringContainsString("Preview by", (string) $transformer->getOutput()); + $this->assertStringContainsString("Mock:", (string) $transformer->getOutput()); } } diff --git a/tests/unit/URL/URLTest.php b/tests/unit/URL/URLTest.php index 6558acc66c..169770811e 100644 --- a/tests/unit/URL/URLTest.php +++ b/tests/unit/URL/URLTest.php @@ -1,11 +1,13 @@ 'query=string¶m=value', ]); - $this->assertEquals('https://appwrite.io:8080/path?query=string¶m=value', $url); + $this->assertSame('https://appwrite.io:8080/path?query=string¶m=value', $url); $url = URL::unparse([ 'scheme' => 'https', @@ -54,7 +56,7 @@ class URLTest extends TestCase 'query' => 'query=string¶m=value', ]); - $this->assertEquals('https://appwrite.io/path?query=string¶m=value', $url); + $this->assertSame('https://appwrite.io/path?query=string¶m=value', $url); $url = URL::unparse([ 'scheme' => 'https', @@ -64,7 +66,7 @@ class URLTest extends TestCase 'query' => '', ]); - $this->assertEquals('https://appwrite.io/', $url); + $this->assertSame('https://appwrite.io/', $url); $url = URL::unparse([ 'scheme' => 'https', @@ -74,7 +76,7 @@ class URLTest extends TestCase 'fragment' => 'bottom', ]); - $this->assertEquals('https://appwrite.io/#bottom', $url); + $this->assertSame('https://appwrite.io/#bottom', $url); $url = URL::unparse([ 'scheme' => 'https', @@ -86,7 +88,7 @@ class URLTest extends TestCase 'fragment' => 'bottom', ]); - $this->assertEquals('https://eldad:fux@appwrite.io/#bottom', $url); + $this->assertSame('https://eldad:fux@appwrite.io/#bottom', $url); $url = URL::unparse([ 'scheme' => 'https', @@ -98,21 +100,21 @@ class URLTest extends TestCase 'fragment' => '', ]); - $this->assertEquals('https://appwrite.io/#', $url); + $this->assertSame('https://appwrite.io/#', $url); } public function testParseQuery(): void { $result = URL::parseQuery('param1=value1¶m2=value2'); - $this->assertEquals(['param1' => 'value1', 'param2' => 'value2'], $result); + $this->assertSame(['param1' => 'value1', 'param2' => 'value2'], $result); } public function testUnParseQuery(): void { $result = URL::unparseQuery(['param1' => 'value1', 'param2' => 'value2']); - $this->assertEquals('param1=value1¶m2=value2', $result); + $this->assertSame('param1=value1¶m2=value2', $result); } /** diff --git a/tests/unit/Utopia/Database/Documents/UserTest.php b/tests/unit/Utopia/Database/Documents/UserTest.php index 5bd73db132..c21c5f6272 100644 --- a/tests/unit/Utopia/Database/Documents/UserTest.php +++ b/tests/unit/Utopia/Database/Documents/UserTest.php @@ -1,5 +1,7 @@ assertEquals('token1', $user1->sessionVerify($secret, $proofForToken)); - $this->assertEquals($user1->sessionVerify('false-secret', $proofForToken), false); - $this->assertEquals($user2->sessionVerify($secret, $proofForToken), false); - $this->assertEquals($user2->sessionVerify('false-secret', $proofForToken), false); + $this->assertEquals(false, $user1->sessionVerify('false-secret', $proofForToken)); + $this->assertEquals(false, $user2->sessionVerify($secret, $proofForToken)); + $this->assertEquals(false, $user2->sessionVerify('false-secret', $proofForToken)); } public function testTokenVerify(): void @@ -162,11 +164,11 @@ class UserTest extends TestCase $this->assertEquals($user1->tokenVerify(TOKEN_TYPE_RECOVERY, $secret, $proofForToken), $tokens1[0]); $this->assertEquals($user1->tokenVerify(null, $secret, $proofForToken), $tokens1[0]); - $this->assertEquals($user1->tokenVerify(TOKEN_TYPE_RECOVERY, 'false-secret', $proofForToken), false); - $this->assertEquals($user2->tokenVerify(TOKEN_TYPE_RECOVERY, $secret, $proofForToken), false); - $this->assertEquals($user2->tokenVerify(TOKEN_TYPE_RECOVERY, 'false-secret', $proofForToken), false); - $this->assertEquals($user3->tokenVerify(TOKEN_TYPE_RECOVERY, $secret, $proofForToken), false); - $this->assertEquals($user3->tokenVerify(TOKEN_TYPE_RECOVERY, 'false-secret', $proofForToken), false); + $this->assertEquals(false, $user1->tokenVerify(TOKEN_TYPE_RECOVERY, 'false-secret', $proofForToken)); + $this->assertEquals(false, $user2->tokenVerify(TOKEN_TYPE_RECOVERY, $secret, $proofForToken)); + $this->assertEquals(false, $user2->tokenVerify(TOKEN_TYPE_RECOVERY, 'false-secret', $proofForToken)); + $this->assertEquals(false, $user3->tokenVerify(TOKEN_TYPE_RECOVERY, $secret, $proofForToken)); + $this->assertEquals(false, $user3->tokenVerify(TOKEN_TYPE_RECOVERY, 'false-secret', $proofForToken)); } public function testIsPrivilegedUser(): void diff --git a/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php b/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php index d5507327be..fd4da9bbfc 100644 --- a/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php +++ b/tests/unit/Utopia/Database/Query/RuntimeQueryTest.php @@ -1,12 +1,14 @@ 'John', 'age' => 30]; $result = $this->compileAndFilter([], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testFilterWithNoMatchingQuery(): void @@ -45,7 +47,7 @@ class RuntimeQueryTest extends TestCase $queries = [Query::equal('name', ['John'])]; $payload = ['name' => 'John', 'age' => 30]; $result = $this->compileAndFilter($queries, $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_EQUAL tests @@ -54,7 +56,7 @@ class RuntimeQueryTest extends TestCase $query = Query::equal('name', ['John']); $payload = ['name' => 'John']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testEqualNoMatch(): void @@ -70,7 +72,7 @@ class RuntimeQueryTest extends TestCase $query = Query::equal('status', ['active', 'pending', 'approved']); $payload = ['status' => 'active']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testEqualMultipleValuesNoMatch(): void @@ -86,7 +88,7 @@ class RuntimeQueryTest extends TestCase $query = Query::equal('age', [30, 25, 35]); $payload = ['age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testEqualBooleanValues(): void @@ -111,7 +113,7 @@ class RuntimeQueryTest extends TestCase $query = Query::notEqual('name', ['Jane']); $payload = ['name' => 'John']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testNotEqualNoMatch(): void @@ -129,7 +131,7 @@ class RuntimeQueryTest extends TestCase $query = Query::notEqual('status', ['rejected', 'cancelled']); $payload = ['status' => 'active']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); $query = Query::notEqual('status', ['active', 'pending']); $payload = ['status' => 'active']; @@ -143,7 +145,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThan('age', 30); $payload = ['age' => 25]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testLesserNoMatch(): void @@ -169,7 +171,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThan('age', 30); $payload = ['age' => 25]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testLesserStringComparison(): void @@ -177,7 +179,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThan('name', 'M'); $payload = ['name' => 'A']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_LESSER_EQUAL tests @@ -186,7 +188,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThanEqual('age', 30); $payload = ['age' => 25]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testLesserEqualExactMatch(): void @@ -194,7 +196,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThanEqual('age', 30); $payload = ['age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testLesserEqualNoMatch(): void @@ -211,7 +213,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThanEqual('age', 30); $payload = ['age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_GREATER tests @@ -220,7 +222,7 @@ class RuntimeQueryTest extends TestCase $query = Query::greaterThan('age', 30); $payload = ['age' => 35]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testGreaterNoMatch(): void @@ -245,7 +247,7 @@ class RuntimeQueryTest extends TestCase $query = Query::greaterThan('age', 20); $payload = ['age' => 35]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_GREATER_EQUAL tests @@ -254,7 +256,7 @@ class RuntimeQueryTest extends TestCase $query = Query::greaterThanEqual('age', 30); $payload = ['age' => 35]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testGreaterEqualExactMatch(): void @@ -262,7 +264,7 @@ class RuntimeQueryTest extends TestCase $query = Query::greaterThanEqual('age', 30); $payload = ['age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testGreaterEqualNoMatch(): void @@ -279,7 +281,7 @@ class RuntimeQueryTest extends TestCase $query = Query::greaterThanEqual('age', 20); $payload = ['age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_IS_NULL tests @@ -313,7 +315,7 @@ class RuntimeQueryTest extends TestCase $query = Query::isNotNull('description'); $payload = ['description' => 'Some text']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testIsNotNullNoMatch(): void @@ -341,7 +343,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['name' => 'John', 'age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testAndOneFails(): void @@ -375,7 +377,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['status' => 'active', 'age' => 25, 'email' => 'test@example.com']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testAndNestedAnd(): void @@ -389,7 +391,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['name' => 'John', 'age' => 30, 'status' => 'active']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_OR tests @@ -401,7 +403,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['name' => 'John']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrAllMatch(): void @@ -412,7 +414,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['status' => 'active']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrAllFail(): void @@ -435,7 +437,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['status' => 'pending']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrNestedOr(): void @@ -449,7 +451,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['name' => 'Bob']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrWithDifferentAttributes(): void @@ -460,7 +462,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['name' => 'Jane', 'email' => 'john@example.com']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrWithMissingAttributeInOneBranch(): void @@ -473,7 +475,7 @@ class RuntimeQueryTest extends TestCase // Payload only has email, not name - should still match via email branch $payload = ['email' => 'john@example.com']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrWithMissingAttributeNoMatch(): void @@ -501,7 +503,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['type' => 'user', 'status' => 'active']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testOrAndCombination(): void @@ -518,7 +520,7 @@ class RuntimeQueryTest extends TestCase ]); $payload = ['name' => 'John', 'age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // Edge cases @@ -530,7 +532,7 @@ class RuntimeQueryTest extends TestCase ]; $payload = ['name' => 'John', 'age' => 30]; $result = $this->compileAndFilter($queries, $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testMultipleQueriesFirstMatches(): void @@ -582,7 +584,7 @@ class RuntimeQueryTest extends TestCase $payload = ['name' => 'John']; $result = $this->compileAndFilter([$query], $payload); // Empty AND should return true (all conditions pass vacuously) - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testEmptyOrQuery(): void @@ -600,7 +602,7 @@ class RuntimeQueryTest extends TestCase $query = Query::equal('count', [0]); $payload = ['count' => 0]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testEqualWithEmptyString(): void @@ -608,7 +610,7 @@ class RuntimeQueryTest extends TestCase $query = Query::equal('name', ['']); $payload = ['name' => '']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testEqualWithFalse(): void @@ -624,7 +626,7 @@ class RuntimeQueryTest extends TestCase $query = Query::greaterThan('score', 8.5); $payload = ['score' => 9.2]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testComparisonWithStringNumbers(): void @@ -632,7 +634,7 @@ class RuntimeQueryTest extends TestCase $query = Query::lessThan('version', '10'); $payload = ['version' => '9']; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } // TYPE_SELECT tests - select("*") means "listen to all events" @@ -703,7 +705,7 @@ class RuntimeQueryTest extends TestCase $query = Query::select(['*']); $payload = ['name' => 'John', 'age' => 30]; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testFilterWithSelectAllAndOtherQueriesReturnsPayload(): void @@ -716,7 +718,7 @@ class RuntimeQueryTest extends TestCase $payload = ['name' => 'John', 'age' => 30]; $result = $this->compileAndFilter($queries, $payload); // select("*") takes precedence - returns payload - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } public function testFilterWithSelectAllOnEmptyPayload(): void @@ -724,6 +726,6 @@ class RuntimeQueryTest extends TestCase $query = Query::select(['*']); $payload = []; $result = $this->compileAndFilter([$query], $payload); - $this->assertEquals($payload, $result); + $this->assertSame($payload, $result); } } diff --git a/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php b/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php index b443cf590b..3547d511a5 100644 --- a/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php +++ b/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->isValid('123:456'), true); - $this->assertEquals($this->object->isValid('123'), false); - $this->assertEquals($this->object->isValid('123:_456'), false); - $this->assertEquals($this->object->isValid('dasda asdasd'), false); - $this->assertEquals($this->object->isValid('dasda:asdasd'), true); - $this->assertEquals($this->object->isValid('_asdas:dasdas'), false); - $this->assertEquals($this->object->isValid('as$$5da:sdasdas'), false); - $this->assertEquals($this->object->isValid(false), false); - $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRestSubscribers:12345'), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRSubscriber:12345'), false); - $this->assertEquals($this->object->isValid('socialAccount:ForYoutubeSubscribe'), true); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscribe:socialAccountForYoutubeSubscribe'), true); + $this->assertTrue($this->object->isValid('123:456')); + $this->assertFalse($this->object->isValid('123')); + $this->assertFalse($this->object->isValid('123:_456')); + $this->assertFalse($this->object->isValid('dasda asdasd')); + $this->assertTrue($this->object->isValid('dasda:asdasd')); + $this->assertFalse($this->object->isValid('_asdas:dasdas')); + $this->assertFalse($this->object->isValid('as$$5da:sdasdas')); + $this->assertFalse($this->object->isValid(false)); + $this->assertFalse($this->object->isValid(null)); + $this->assertFalse($this->object->isValid('socialAccountForYoutubeAndRestSubscribers:12345')); + $this->assertFalse($this->object->isValid('socialAccountForYoutubeAndRSubscriber:12345')); + $this->assertTrue($this->object->isValid('socialAccount:ForYoutubeSubscribe')); + $this->assertTrue($this->object->isValid('socialAccountForYoutubeSubscribe:socialAccountForYoutubeSubscribe')); } } diff --git a/tests/unit/Utopia/Database/Validator/CustomIdTest.php b/tests/unit/Utopia/Database/Validator/CustomIdTest.php index e8c37a3f72..fea3ea49f6 100644 --- a/tests/unit/Utopia/Database/Validator/CustomIdTest.php +++ b/tests/unit/Utopia/Database/Validator/CustomIdTest.php @@ -1,11 +1,13 @@ assertEquals($this->object->isValid('unique()'), true); - $this->assertEquals($this->object->isValid('unique)'), false); - $this->assertEquals($this->object->isValid('else()'), false); - $this->assertEquals($this->object->isValid('dasda asdasd'), false); - $this->assertEquals($this->object->isValid('dasda_asdasd'), true); - $this->assertEquals($this->object->isValid('asdasdasdas'), true); - $this->assertEquals($this->object->isValid('_asdasdasdas'), false); - $this->assertEquals($this->object->isValid('as$$5dasdasdas'), false); - $this->assertEquals($this->object->isValid(false), false); - $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRestSubscribers'), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRSubscriber'), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscribe'), true); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscrib'), true); + $this->assertTrue($this->object->isValid('unique()')); + $this->assertFalse($this->object->isValid('unique)')); + $this->assertFalse($this->object->isValid('else()')); + $this->assertFalse($this->object->isValid('dasda asdasd')); + $this->assertTrue($this->object->isValid('dasda_asdasd')); + $this->assertTrue($this->object->isValid('asdasdasdas')); + $this->assertFalse($this->object->isValid('_asdasdasdas')); + $this->assertFalse($this->object->isValid('as$$5dasdasdas')); + $this->assertFalse($this->object->isValid(false)); + $this->assertFalse($this->object->isValid(null)); + $this->assertFalse($this->object->isValid('socialAccountForYoutubeAndRestSubscribers')); + $this->assertFalse($this->object->isValid('socialAccountForYoutubeAndRSubscriber')); + $this->assertTrue($this->object->isValid('socialAccountForYoutubeSubscribe')); + $this->assertTrue($this->object->isValid('socialAccountForYoutubeSubscrib')); } } diff --git a/tests/unit/Utopia/Database/Validator/ProjectIdTest.php b/tests/unit/Utopia/Database/Validator/ProjectIdTest.php index 02a30ab346..12eb544afd 100644 --- a/tests/unit/Utopia/Database/Validator/ProjectIdTest.php +++ b/tests/unit/Utopia/Database/Validator/ProjectIdTest.php @@ -1,12 +1,14 @@ ['unique()', true], - 'dashes' => ['as12-df34', true], - '36 chars' => [\str_repeat('a', 36), true], - 'uppercase' => ['ABC', false], - 'underscore' => ['under_score', false], - 'leading dash' => ['-dash', false], - 'too long' => [\str_repeat('a', 37), false], - ]; + yield 'unique()' => ['unique()', true]; + yield 'dashes' => ['as12-df34', true]; + yield '36 chars' => [\str_repeat('a', 36), true]; + yield 'uppercase' => ['ABC', false]; + yield 'underscore' => ['under_score', false]; + yield 'leading dash' => ['-dash', false]; + yield 'too long' => [\str_repeat('a', 37), false]; } #[DataProvider('provideTest')] public function testValues(string $input, bool $expected): void { - $this->assertEquals($this->object->isValid($input), $expected); + $this->assertSame($this->object->isValid($input), $expected); } public function testCustomMaxLength(): void diff --git a/tests/unit/Utopia/Database/Validator/Queries/CollectionTest.php b/tests/unit/Utopia/Database/Validator/Queries/CollectionTest.php index cdeccef1bd..14331ff853 100644 --- a/tests/unit/Utopia/Database/Validator/Queries/CollectionTest.php +++ b/tests/unit/Utopia/Database/Validator/Queries/CollectionTest.php @@ -1,5 +1,7 @@ assertEquals($validator->isValid([]), true); + $this->assertTrue($validator->isValid([])); } public function testValid(): void diff --git a/tests/unit/Utopia/Database/Validator/Queries/UsersTest.php b/tests/unit/Utopia/Database/Validator/Queries/UsersTest.php index 327ae185cb..4ae58fbbcd 100644 --- a/tests/unit/Utopia/Database/Validator/Queries/UsersTest.php +++ b/tests/unit/Utopia/Database/Validator/Queries/UsersTest.php @@ -1,12 +1,14 @@ [ - [ - 'data' => 'Lorem ipsum' - ], - [ - 'body' => 'Lorem ipsum' - ], + yield 'data' => [ + [ + 'data' => 'Lorem ipsum' ], - 'no data' => [ - [], - [ - 'body' => '' - ], + [ + 'body' => 'Lorem ipsum' + ], + ]; + yield 'no data' => [ + [], + [ + 'body' => '' ], ]; } diff --git a/tests/unit/Utopia/Request/Filters/V17Test.php b/tests/unit/Utopia/Request/Filters/V17Test.php index afc363c582..b026e1f04b 100644 --- a/tests/unit/Utopia/Request/Filters/V17Test.php +++ b/tests/unit/Utopia/Request/Filters/V17Test.php @@ -1,5 +1,7 @@ [ - [ - 'userId' => 'test', - 'secret' => 'test', - 'password' => '123456', - 'passwordAgain' => '123456' - ], - [ - 'userId' => 'test', - 'secret' => 'test', - 'password' => '123456', - ] + yield 'remove passwordAgain' => [ + [ + 'userId' => 'test', + 'secret' => 'test', + 'password' => '123456', + 'passwordAgain' => '123456' + ], + [ + 'userId' => 'test', + 'secret' => 'test', + 'password' => '123456', ] ]; } @@ -52,25 +52,23 @@ class V17Test extends TestCase $this->assertEquals($expected, $result); } - public static function createQueryProvider(): array + public static function createQueryProvider(): \Iterator { - return [ - 'convert queries' => [ - [ - 'queries' => [ - 'cursorAfter("exampleId")', - 'search("name", ["example"])', - 'isNotNull("name")' - ] - ], - [ - 'queries' => [ - '{"method":"cursorAfter","values":["exampleId"]}', - '{"method":"search","attribute":"name","values":["example"]}', - '{"method":"isNotNull","attribute":"name"}' - ] - ], - ] + yield 'convert queries' => [ + [ + 'queries' => [ + 'cursorAfter("exampleId")', + 'search("name", ["example"])', + 'isNotNull("name")' + ] + ], + [ + 'queries' => [ + '{"method":"cursorAfter","values":["exampleId"]}', + '{"method":"search","attribute":"name","values":["example"]}', + '{"method":"isNotNull","attribute":"name"}' + ] + ], ]; } diff --git a/tests/unit/Utopia/Request/Filters/V18Test.php b/tests/unit/Utopia/Request/Filters/V18Test.php index e4f3f0043b..aefe9607f8 100644 --- a/tests/unit/Utopia/Request/Filters/V18Test.php +++ b/tests/unit/Utopia/Request/Filters/V18Test.php @@ -1,5 +1,7 @@ [ - [ - 'type' => 'totp', - 'otp' => 1230 - ], - [ - 'type' => 'totp' - ] + yield 'remove otp' => [ + [ + 'type' => 'totp', + 'otp' => 1230 + ], + [ + 'type' => 'totp' ] ]; } diff --git a/tests/unit/Utopia/Request/Filters/V19Test.php b/tests/unit/Utopia/Request/Filters/V19Test.php index b302ee6a5f..60d2083f7d 100644 --- a/tests/unit/Utopia/Request/Filters/V19Test.php +++ b/tests/unit/Utopia/Request/Filters/V19Test.php @@ -1,5 +1,7 @@ [ - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - 'templateRepository' => 'github.com/appwrite/templates', - 'templateOwner' => 'appwrite', - 'templateRootDirectory' => 'functions/node', - 'templateVersion' => '1.0.0' - ], - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0' - ] + yield 'remove template fields' => [ + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + 'templateRepository' => 'github.com/appwrite/templates', + 'templateOwner' => 'appwrite', + 'templateRootDirectory' => 'functions/node', + 'templateVersion' => '1.0.0' + ], + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0' ] ]; } - public static function functionsListExecutionsProvider(): array + public static function functionsListExecutionsProvider(): \Iterator { - return [ - 'remove search field' => [ - [ - 'functionId' => 'test-function', - 'search' => 'test query', - 'limit' => 10 - ], - [ - 'functionId' => 'test-function', - 'limit' => 10 - ] + yield 'remove search field' => [ + [ + 'functionId' => 'test-function', + 'search' => 'test query', + 'limit' => 10 + ], + [ + 'functionId' => 'test-function', + 'limit' => 10 ] ]; } diff --git a/tests/unit/Utopia/Request/Filters/V21Test.php b/tests/unit/Utopia/Request/Filters/V21Test.php index f514de71ee..fc766a383d 100644 --- a/tests/unit/Utopia/Request/Filters/V21Test.php +++ b/tests/unit/Utopia/Request/Filters/V21Test.php @@ -1,5 +1,7 @@ [ - [ - 'templateId' => 'template123', - 'version' => '1.0.0', - ], - [ - 'templateId' => 'template123', - 'type' => 'tag', - 'reference' => '1.0.0', - ] + yield 'convert version to type and reference' => [ + [ + 'templateId' => 'template123', + 'version' => '1.0.0', ], - 'handle version with semver string' => [ - [ - 'version' => 'v2.3.1', - 'templateId' => 'template456', - ], - [ - 'type' => 'tag', - 'reference' => 'v2.3.1', - 'templateId' => 'template456', - ] + [ + 'templateId' => 'template123', + 'type' => 'tag', + 'reference' => '1.0.0', + ] + ]; + yield 'handle version with semver string' => [ + [ + 'version' => 'v2.3.1', + 'templateId' => 'template456', ], - 'skip conversion when version is empty string' => [ - [ - 'templateId' => 'template123', - 'version' => '', - ], - [ - 'templateId' => 'template123', - 'version' => '', - ] + [ + 'type' => 'tag', + 'reference' => 'v2.3.1', + 'templateId' => 'template456', + ] + ]; + yield 'skip conversion when version is empty string' => [ + [ + 'templateId' => 'template123', + 'version' => '', ], - 'skip conversion when version is missing' => [ - [ - 'templateId' => 'template123', - ], - [ - 'templateId' => 'template123', - ] + [ + 'templateId' => 'template123', + 'version' => '', + ] + ]; + yield 'skip conversion when version is missing' => [ + [ + 'templateId' => 'template123', ], - 'preserve other fields when converting version' => [ - [ - 'templateId' => 'template123', - 'version' => '3.0.0', - 'activate' => true, - 'buildCommand' => 'npm run build', - ], - [ - 'templateId' => 'template123', - 'type' => 'tag', - 'reference' => '3.0.0', - 'activate' => true, - 'buildCommand' => 'npm run build', - ] + [ + 'templateId' => 'template123', + ] + ]; + yield 'preserve other fields when converting version' => [ + [ + 'templateId' => 'template123', + 'version' => '3.0.0', + 'activate' => true, + 'buildCommand' => 'npm run build', ], + [ + 'templateId' => 'template123', + 'type' => 'tag', + 'reference' => '3.0.0', + 'activate' => true, + 'buildCommand' => 'npm run build', + ] ]; } @@ -94,38 +94,36 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function sitesCreateTemplateDeploymentProvider(): array + public static function sitesCreateTemplateDeploymentProvider(): \Iterator { - return [ - 'convert version to type and reference' => [ - [ - 'templateId' => 'site-template123', - 'version' => '2.0.0', - ], - [ - 'templateId' => 'site-template123', - 'type' => 'tag', - 'reference' => '2.0.0', - ] + yield 'convert version to type and reference' => [ + [ + 'templateId' => 'site-template123', + 'version' => '2.0.0', ], - 'skip conversion when version is empty' => [ - [ - 'templateId' => 'site-template123', - 'version' => '', - ], - [ - 'templateId' => 'site-template123', - 'version' => '', - ] + [ + 'templateId' => 'site-template123', + 'type' => 'tag', + 'reference' => '2.0.0', + ] + ]; + yield 'skip conversion when version is empty' => [ + [ + 'templateId' => 'site-template123', + 'version' => '', ], - 'skip conversion when version is missing' => [ - [ - 'templateId' => 'site-template123', - ], - [ - 'templateId' => 'site-template123', - ] + [ + 'templateId' => 'site-template123', + 'version' => '', + ] + ]; + yield 'skip conversion when version is missing' => [ + [ + 'templateId' => 'site-template123', ], + [ + 'templateId' => 'site-template123', + ] ]; } @@ -139,59 +137,57 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function functionsCreateProvider(): array + public static function functionsCreateProvider(): \Iterator { - return [ - 'convert specification to buildSpecification and runtimeSpecification' => [ - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - 'specification' => 's-1vcpu-512mb', - ], - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-512mb', - ] + yield 'convert specification to buildSpecification and runtimeSpecification' => [ + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + 'specification' => 's-1vcpu-512mb', ], - 'skip conversion when specification is empty' => [ - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - 'specification' => '', - ], - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - 'specification' => '', - ] + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-512mb', + ] + ]; + yield 'skip conversion when specification is empty' => [ + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + 'specification' => '', ], - 'skip conversion when specification is missing' => [ - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - ], - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - ] + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + 'specification' => '', + ] + ]; + yield 'skip conversion when specification is missing' => [ + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', ], - 'preserve other fields when converting specification' => [ - [ - 'name' => 'test-function', - 'specification' => 's-2vcpu-1gb', - 'timeout' => 30, - 'enabled' => true, - ], - [ - 'name' => 'test-function', - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-2vcpu-1gb', - 'timeout' => 30, - 'enabled' => true, - ] + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + ] + ]; + yield 'preserve other fields when converting specification' => [ + [ + 'name' => 'test-function', + 'specification' => 's-2vcpu-1gb', + 'timeout' => 30, + 'enabled' => true, ], + [ + 'name' => 'test-function', + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-2vcpu-1gb', + 'timeout' => 30, + 'enabled' => true, + ] ]; } @@ -205,40 +201,38 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function sitesCreateProvider(): array + public static function sitesCreateProvider(): \Iterator { - return [ - 'convert specification to buildSpecification and runtimeSpecification' => [ - [ - 'name' => 'test-site', - 'framework' => 'nextjs', - 'specification' => 's-1vcpu-512mb', - ], - [ - 'name' => 'test-site', - 'framework' => 'nextjs', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-512mb', - ] + yield 'convert specification to buildSpecification and runtimeSpecification' => [ + [ + 'name' => 'test-site', + 'framework' => 'nextjs', + 'specification' => 's-1vcpu-512mb', ], - 'skip conversion when specification is empty' => [ - [ - 'name' => 'test-site', - 'specification' => '', - ], - [ - 'name' => 'test-site', - 'specification' => '', - ] + [ + 'name' => 'test-site', + 'framework' => 'nextjs', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-512mb', + ] + ]; + yield 'skip conversion when specification is empty' => [ + [ + 'name' => 'test-site', + 'specification' => '', ], - 'skip conversion when specification is missing' => [ - [ - 'name' => 'test-site', - ], - [ - 'name' => 'test-site', - ] + [ + 'name' => 'test-site', + 'specification' => '', + ] + ]; + yield 'skip conversion when specification is missing' => [ + [ + 'name' => 'test-site', ], + [ + 'name' => 'test-site', + ] ]; } @@ -252,28 +246,26 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function functionsUpdateProvider(): array + public static function functionsUpdateProvider(): \Iterator { - return [ - 'convert specification to buildSpecification and runtimeSpecification' => [ - [ - 'name' => 'updated-function', - 'specification' => 's-2vcpu-1gb', - ], - [ - 'name' => 'updated-function', - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-2vcpu-1gb', - ] + yield 'convert specification to buildSpecification and runtimeSpecification' => [ + [ + 'name' => 'updated-function', + 'specification' => 's-2vcpu-1gb', ], - 'skip conversion when specification is missing' => [ - [ - 'name' => 'updated-function', - ], - [ - 'name' => 'updated-function', - ] + [ + 'name' => 'updated-function', + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-2vcpu-1gb', + ] + ]; + yield 'skip conversion when specification is missing' => [ + [ + 'name' => 'updated-function', ], + [ + 'name' => 'updated-function', + ] ]; } @@ -287,28 +279,26 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function sitesUpdateProvider(): array + public static function sitesUpdateProvider(): \Iterator { - return [ - 'convert specification to buildSpecification and runtimeSpecification' => [ - [ - 'name' => 'updated-site', - 'specification' => 's-2vcpu-1gb', - ], - [ - 'name' => 'updated-site', - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-2vcpu-1gb', - ] + yield 'convert specification to buildSpecification and runtimeSpecification' => [ + [ + 'name' => 'updated-site', + 'specification' => 's-2vcpu-1gb', ], - 'skip conversion when specification is missing' => [ - [ - 'name' => 'updated-site', - ], - [ - 'name' => 'updated-site', - ] + [ + 'name' => 'updated-site', + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-2vcpu-1gb', + ] + ]; + yield 'skip conversion when specification is missing' => [ + [ + 'name' => 'updated-site', ], + [ + 'name' => 'updated-site', + ] ]; } @@ -322,47 +312,45 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function unmatchedModelProvider(): array + public static function unmatchedModelProvider(): \Iterator { - return [ - 'unmatched model passes through unchanged' => [ - 'databases.create', - [ - 'name' => 'test-database', - 'databaseId' => 'db123', - ], - [ - 'name' => 'test-database', - 'databaseId' => 'db123', - ] + yield 'unmatched model passes through unchanged' => [ + 'databases.create', + [ + 'name' => 'test-database', + 'databaseId' => 'db123', ], - 'empty content for unmatched model' => [ - 'users.list', - [], - [] + [ + 'name' => 'test-database', + 'databaseId' => 'db123', + ] + ]; + yield 'empty content for unmatched model' => [ + 'users.list', + [], + [] + ]; + yield 'content with specification for unmatched model is not converted' => [ + 'deployments.create', + [ + 'specification' => 's-1vcpu-512mb', + 'name' => 'test', ], - 'content with specification for unmatched model is not converted' => [ - 'deployments.create', - [ - 'specification' => 's-1vcpu-512mb', - 'name' => 'test', - ], - [ - 'specification' => 's-1vcpu-512mb', - 'name' => 'test', - ] - ], - 'content with version for unmatched model is not converted' => [ - 'databases.createDocument', - [ - 'version' => '1.0.0', - 'data' => 'test', - ], - [ - 'version' => '1.0.0', - 'data' => 'test', - ] + [ + 'specification' => 's-1vcpu-512mb', + 'name' => 'test', + ] + ]; + yield 'content with version for unmatched model is not converted' => [ + 'databases.createDocument', + [ + 'version' => '1.0.0', + 'data' => 'test', ], + [ + 'version' => '1.0.0', + 'data' => 'test', + ] ]; } diff --git a/tests/unit/Utopia/RequestTest.php b/tests/unit/Utopia/RequestTest.php index 2247ff71f1..476c5e232f 100644 --- a/tests/unit/Utopia/RequestTest.php +++ b/tests/unit/Utopia/RequestTest.php @@ -1,5 +1,7 @@ assertSame($secondRoute, $secondRequest->getRoute()); } - public function testGetHeaderReturnsStringValue(): void + public function testGetHeaderLineReturnsStringValue(): void { $this->request->addHeader('referer', 'https://example.com'); - $this->assertSame('https://example.com', $this->request->getHeader('referer')); + $this->assertSame('https://example.com', $this->request->getHeaderLine('referer')); } - public function testGetHeaderReturnsDefaultWhenMissing(): void + public function testGetHeaderLineReturnsDefaultWhenMissing(): void { - $this->assertSame('', $this->request->getHeader('referer')); - $this->assertSame('fallback', $this->request->getHeader('referer', 'fallback')); + $this->assertSame('', $this->request->getHeaderLine('referer')); + $this->assertSame('fallback', $this->request->getHeaderLine('referer', 'fallback')); } - public function testGetHeaderCoercesArrayToFirstElement(): void + public function testGetHeaderLineJoinsMultipleValues(): void { $swoole = new SwooleRequest(); $swoole->header = ['referer' => ['https://a.example', 'https://b.example']]; $request = new Request($swoole); - $this->assertSame('https://a.example', $request->getHeader('referer')); + $this->assertSame('https://a.example, https://b.example', $request->getHeaderLine('referer')); } - public function testGetHeaderReturnsDefaultWhenValueNotString(): void + public function testGetHeadersSynthesizesCookieHeaderFromCookieJar(): void { + // Swoole parses the Cookie header into its cookie jar, so getHeaders() + // must rebuild it for consumers that forward request headers onward + // (e.g. function/site executions). $swoole = new SwooleRequest(); - $swoole->header = ['referer' => 123]; + $swoole->header = ['host' => 'example.com']; + $swoole->cookie = ['custom-session-id' => 'abcd123', 'custom-user-id' => 'efgh456']; $request = new Request($swoole); - $this->assertSame('fallback', $request->getHeader('referer', 'fallback')); + $headers = $request->getHeaders(); + + $this->assertSame(['custom-session-id=abcd123; custom-user-id=efgh456'], $headers['cookie']); + } + + public function testGetHeadersOmitsCookieHeaderWhenNoCookies(): void + { + $swoole = new SwooleRequest(); + $swoole->header = ['host' => 'example.com']; + $request = new Request($swoole); + + $this->assertArrayNotHasKey('cookie', $request->getHeaders()); } public function testGetParamsCachesRawParamsWhenFilterThrows4xx(): void diff --git a/tests/unit/Utopia/Response/Filters/V16Test.php b/tests/unit/Utopia/Response/Filters/V16Test.php index 2ba60d35e9..f71b7ad51e 100644 --- a/tests/unit/Utopia/Response/Filters/V16Test.php +++ b/tests/unit/Utopia/Response/Filters/V16Test.php @@ -1,5 +1,7 @@ [ - [ - 'buildLogs' => 'Compiling source files...', - ], - [ - 'buildStdout' => 'Compiling source files...', - 'buildStderr' => '', - ], + yield 'buildStdout and buildStderr' => [ + [ + 'buildLogs' => 'Compiling source files...', ], - 'size and buildSize' => [ - [ - 'size' => 20, - 'buildSize' => 40 - ], - [ - 'size' => 60 - ], + [ + 'buildStdout' => 'Compiling source files...', + 'buildStderr' => '', ], - - 'size and buildSize missing' => [ - [ - 'size' => 20 - ], - [ - 'size' => 20 - ], + ]; + yield 'size and buildSize' => [ + [ + 'size' => 20, + 'buildSize' => 40 ], - - 'empty no errors' => [ - [ - ], - [ - ], + [ + 'size' => 60 + ], + ]; + yield 'size and buildSize missing' => [ + [ + 'size' => 20 + ], + [ + 'size' => 20 + ], + ]; + yield 'empty no errors' => [ + [ + ], + [ ], ]; } @@ -73,40 +71,38 @@ class V16Test extends TestCase $this->assertEquals($expected, $result); } - public static function executionProvider(): array + public static function executionProvider(): \Iterator { - return [ - 'statusCode' => [ - [ - 'responseStatusCode' => 200, - ], - [ - 'statusCode' => 200, - ], + yield 'statusCode' => [ + [ + 'responseStatusCode' => 200, ], - 'response' => [ - [ - 'responseBody' => 'Sample response.', - ], - [ - 'response' => 'Sample response.', - ], + [ + 'statusCode' => 200, ], - 'stdout' => [ - [ - 'logs' => 'Sample log.', - ], - [ - 'stdout' => 'Sample log.', - ], + ]; + yield 'response' => [ + [ + 'responseBody' => 'Sample response.', ], - 'stderr' => [ - [ - 'errors' => 'Sample error.', - ], - [ - 'stderr' => 'Sample error.', - ], + [ + 'response' => 'Sample response.', + ], + ]; + yield 'stdout' => [ + [ + 'logs' => 'Sample log.', + ], + [ + 'stdout' => 'Sample log.', + ], + ]; + yield 'stderr' => [ + [ + 'errors' => 'Sample error.', + ], + [ + 'stderr' => 'Sample error.', ], ]; } @@ -121,18 +117,16 @@ class V16Test extends TestCase $this->assertEquals($expected, $result); } - public static function functionProvider(): array + public static function functionProvider(): \Iterator { - return [ - 'empty schedule' => [ - [ - 'schedule' => '', - ], - [ - 'schedule' => '', - 'schedulePrevious' => '', - 'scheduleNext' => '', - ], + yield 'empty schedule' => [ + [ + 'schedule' => '', + ], + [ + 'schedule' => '', + 'schedulePrevious' => '', + 'scheduleNext' => '', ], ]; } @@ -168,39 +162,37 @@ class V16Test extends TestCase $this->assertEquals($expected, $result); } - public static function projectProvider(): array + public static function projectProvider(): \Iterator { - return [ - 'oAuthProviders' => [ - [ - 'oAuthProviders' => [ - [ - 'key' => 'github', - 'name' => 'GitHub', - 'appId' => 'client_id', - 'secret' => 'client_secret', - 'enabled' => true, - ], + yield 'oAuthProviders' => [ + [ + 'oAuthProviders' => [ + [ + 'key' => 'github', + 'name' => 'GitHub', + 'appId' => 'client_id', + 'secret' => 'client_secret', + 'enabled' => true, ], ], - [ - 'oAuthProviders' => [ - [ - 'name' => 'Github', - 'appId' => 'client_id', - 'secret' => 'client_secret', - 'enabled' => true, - ], - ], - 'domains' => [], - ], ], - 'domains' => [ - [ - ], - [ - 'domains' => [], + [ + 'oAuthProviders' => [ + [ + 'name' => 'Github', + 'appId' => 'client_id', + 'secret' => 'client_secret', + 'enabled' => true, + ], ], + 'domains' => [], + ], + ]; + yield 'domains' => [ + [ + ], + [ + 'domains' => [], ], ]; } @@ -215,16 +207,14 @@ class V16Test extends TestCase $this->assertEquals($expected, $result); } - public static function variableProvider(): array + public static function variableProvider(): \Iterator { - return [ - 'functionId' => [ - [ - 'resourceId' => '5e5ea5c16897e', - ], - [ - 'functionId' => '5e5ea5c16897e', - ], + yield 'functionId' => [ + [ + 'resourceId' => '5e5ea5c16897e', + ], + [ + 'functionId' => '5e5ea5c16897e', ], ]; } diff --git a/tests/unit/Utopia/Response/Filters/V17Test.php b/tests/unit/Utopia/Response/Filters/V17Test.php index 0bdc4de53e..ffc4bcdf14 100644 --- a/tests/unit/Utopia/Response/Filters/V17Test.php +++ b/tests/unit/Utopia/Response/Filters/V17Test.php @@ -1,5 +1,7 @@ [ - [ - 'oAuthProviders' => [ - [ - 'key' => 'github', - 'name' => 'GitHub', - 'appId' => 'client_id', - 'secret' => 'client_secret', - 'enabled' => true, - ], + yield 'rename providers' => [ + [ + 'oAuthProviders' => [ + [ + 'key' => 'github', + 'name' => 'GitHub', + 'appId' => 'client_id', + 'secret' => 'client_secret', + 'enabled' => true, ], ], - [ - 'providers' => [ - [ - 'key' => 'github', - 'name' => 'GitHub', - 'appId' => 'client_id', - 'secret' => 'client_secret', - 'enabled' => true, - ], + ], + [ + 'providers' => [ + [ + 'key' => 'github', + 'name' => 'GitHub', + 'appId' => 'client_id', + 'secret' => 'client_secret', + 'enabled' => true, ], ], ], @@ -61,16 +61,14 @@ class V17Test extends TestCase $this->assertEquals($expected, $result); } - public static function userProvider(): array + public static function userProvider(): \Iterator { - return [ - 'remove targets' => [ - [ - 'targets' => 'test', - 'mfa' => 'test', - ], - [ - ], + yield 'remove targets' => [ + [ + 'targets' => 'test', + 'mfa' => 'test', + ], + [ ], ]; } @@ -85,15 +83,13 @@ class V17Test extends TestCase $this->assertEquals($expected, $result); } - public static function tokenProvider(): array + public static function tokenProvider(): \Iterator { - return [ - 'remove securityPhrase' => [ - [ - 'phrase' => 'Lorum Ipsum', - ], - [ - ], + yield 'remove securityPhrase' => [ + [ + 'phrase' => 'Lorum Ipsum', + ], + [ ], ]; } @@ -108,15 +104,13 @@ class V17Test extends TestCase $this->assertEquals($expected, $result); } - public static function membershipProvider(): array + public static function membershipProvider(): \Iterator { - return [ - 'remove mfa' => [ - [ - 'mfa' => 'test', - ], - [ - ], + yield 'remove mfa' => [ + [ + 'mfa' => 'test', + ], + [ ], ]; } @@ -131,17 +125,15 @@ class V17Test extends TestCase $this->assertEquals($expected, $result); } - public static function sessionProvider(): array + public static function sessionProvider(): \Iterator { - return [ - 'remove factors and secrets' => [ - [ - 'factors' => 'test', - 'secret' => 'test', - ], - [ - ], - ] + yield 'remove factors and secrets' => [ + [ + 'factors' => 'test', + 'secret' => 'test', + ], + [ + ], ]; } diff --git a/tests/unit/Utopia/Response/Filters/V18Test.php b/tests/unit/Utopia/Response/Filters/V18Test.php index 2e09b34515..fdef9c592a 100644 --- a/tests/unit/Utopia/Response/Filters/V18Test.php +++ b/tests/unit/Utopia/Response/Filters/V18Test.php @@ -1,5 +1,7 @@ [ - [ - 'scopes' => [ - 'example_scope', - 'example_scope2', - ], + yield 'remove scopes' => [ + [ + 'scopes' => [ + 'example_scope', + 'example_scope2', ], - [ - ] ], + [ + ] ]; } @@ -48,55 +48,53 @@ class V18Test extends TestCase } - public static function executionProvider(): array + public static function executionProvider(): \Iterator { - return [ - 'remove scheduledAt' => [ - [ - 'scheduledAt' => '2024-07-13T09:00:00.000Z', - ], - [ - ] + yield 'remove scheduledAt' => [ + [ + 'scheduledAt' => '2024-07-13T09:00:00.000Z', ], - 'update 404 status' => [ - [ - 'statusCode' => '404', - 'status' => 'completed' - ], - [ - 'statusCode' => '404', - 'status' => 'failed' - ] + [ + ] + ]; + yield 'update 404 status' => [ + [ + 'statusCode' => '404', + 'status' => 'completed' ], - 'update 400 status' => [ - [ - 'statusCode' => '400', - 'status' => 'completed' - ], - [ - 'statusCode' => '400', - 'status' => 'failed' - ] + [ + 'statusCode' => '404', + 'status' => 'failed' + ] + ]; + yield 'update 400 status' => [ + [ + 'statusCode' => '400', + 'status' => 'completed' ], - 'dont update 200 status' => [ - [ - 'statusCode' => '200', - 'status' => 'completed' - ], - [ - 'statusCode' => '200', - 'status' => 'completed' - ] + [ + 'statusCode' => '400', + 'status' => 'failed' + ] + ]; + yield 'dont update 200 status' => [ + [ + 'statusCode' => '200', + 'status' => 'completed' ], - 'dont update 500 status' => [ - [ - 'statusCode' => '500', - 'status' => 'failed' - ], - [ - 'statusCode' => '500', - 'status' => 'failed' - ] + [ + 'statusCode' => '200', + 'status' => 'completed' + ] + ]; + yield 'dont update 500 status' => [ + [ + 'statusCode' => '500', + 'status' => 'failed' + ], + [ + 'statusCode' => '500', + 'status' => 'failed' ] ]; } @@ -111,22 +109,20 @@ class V18Test extends TestCase $this->assertEquals($expected, $result); } - public static function projectProvider(): array + public static function projectProvider(): \Iterator { - return [ - 'remove authMockNumbers and authSessionAlerts' => [ - [ - 'authMockNumbers' => [ - 'example_mock_number', - 'example_mock_number2', - ], - 'authSessionAlerts' => [ - 'example_alert', - 'example_alert2', - ], + yield 'remove authMockNumbers and authSessionAlerts' => [ + [ + 'authMockNumbers' => [ + 'example_mock_number', + 'example_mock_number2', ], - [ - ] + 'authSessionAlerts' => [ + 'example_alert', + 'example_alert2', + ], + ], + [ ] ]; } @@ -141,15 +137,13 @@ class V18Test extends TestCase $this->assertEquals($expected, $result); } - public static function runtimeProvider(): array + public static function runtimeProvider(): \Iterator { - return [ - 'remove key' => [ - [ - 'key' => 'example_key', - ], - [ - ] + yield 'remove key' => [ + [ + 'key' => 'example_key', + ], + [ ] ]; } diff --git a/tests/unit/Utopia/Response/Filters/V19Test.php b/tests/unit/Utopia/Response/Filters/V19Test.php index a53dbfe355..830fa3d0c1 100644 --- a/tests/unit/Utopia/Response/Filters/V19Test.php +++ b/tests/unit/Utopia/Response/Filters/V19Test.php @@ -1,5 +1,7 @@ [ - [ - 'deploymentId' => 'deployment123', - ], - [ - 'deployment' => 'deployment123', - ] + yield 'change deploymentId to deployment' => [ + [ + 'deploymentId' => 'deployment123', ], - 'handle empty deploymentId' => [ - [ - 'name' => 'test-function', - ], - [ - 'deployment' => '', - 'name' => 'test-function', - ] + [ + 'deployment' => 'deployment123', + ] + ]; + yield 'handle empty deploymentId' => [ + [ + 'name' => 'test-function', ], + [ + 'deployment' => '', + 'name' => 'test-function', + ] ]; } @@ -54,47 +54,45 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function functionListProvider(): array + public static function functionListProvider(): \Iterator { - return [ - 'convert list of functions' => [ - [ - 'total' => 2, - 'functions' => [ - [ - 'deploymentId' => 'deployment123', - 'name' => 'function-1', - ], - [ - 'deploymentId' => 'deployment456', - 'name' => 'function-2', - ], + yield 'convert list of functions' => [ + [ + 'total' => 2, + 'functions' => [ + [ + 'deploymentId' => 'deployment123', + 'name' => 'function-1', + ], + [ + 'deploymentId' => 'deployment456', + 'name' => 'function-2', ], ], - [ - 'total' => 2, - 'functions' => [ - [ - 'deployment' => 'deployment123', - 'name' => 'function-1', - ], - [ - 'deployment' => 'deployment456', - 'name' => 'function-2', - ], + ], + [ + 'total' => 2, + 'functions' => [ + [ + 'deployment' => 'deployment123', + 'name' => 'function-1', + ], + [ + 'deployment' => 'deployment456', + 'name' => 'function-2', ], - ] - ], - 'handle empty function list' => [ - [ - 'total' => 0, - 'functions' => [], ], - [ - 'total' => 0, - 'functions' => [], - ] + ] + ]; + yield 'handle empty function list' => [ + [ + 'total' => 0, + 'functions' => [], ], + [ + 'total' => 0, + 'functions' => [], + ] ]; } @@ -108,31 +106,29 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function deploymentProvider(): array + public static function deploymentProvider(): \Iterator { - return [ - 'rename sourceSize to size and buildDuration to buildTime' => [ - [ - 'sourceSize' => 1024, - 'buildDuration' => 60, - 'id' => 'deployment123', - ], - [ - 'size' => 1024, - 'buildTime' => 60, - 'id' => 'deployment123', - ] + yield 'rename sourceSize to size and buildDuration to buildTime' => [ + [ + 'sourceSize' => 1024, + 'buildDuration' => 60, + 'id' => 'deployment123', ], - 'handle missing sourceSize and buildDuration' => [ - [ - 'id' => 'deployment123', - ], - [ - 'size' => '', - 'buildTime' => '', - 'id' => 'deployment123', - ] + [ + 'size' => 1024, + 'buildTime' => 60, + 'id' => 'deployment123', + ] + ]; + yield 'handle missing sourceSize and buildDuration' => [ + [ + 'id' => 'deployment123', ], + [ + 'size' => '', + 'buildTime' => '', + 'id' => 'deployment123', + ] ]; } @@ -146,31 +142,29 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function proxyRuleProvider(): array + public static function proxyRuleProvider(): \Iterator { - return [ - 'rename deployment resource fields' => [ - [ - 'deploymentResourceType' => 'function', - 'deploymentResourceId' => 'func123', - 'domain' => 'example.com', - ], - [ - 'resourceType' => 'function', - 'resourceId' => 'func123', - 'domain' => 'example.com', - ] + yield 'rename deployment resource fields' => [ + [ + 'deploymentResourceType' => 'function', + 'deploymentResourceId' => 'func123', + 'domain' => 'example.com', ], - 'handle missing deployment resource fields' => [ - [ - 'domain' => 'example.com', - ], - [ - 'resourceType' => '', - 'resourceId' => '', - 'domain' => 'example.com', - ] + [ + 'resourceType' => 'function', + 'resourceId' => 'func123', + 'domain' => 'example.com', + ] + ]; + yield 'handle missing deployment resource fields' => [ + [ + 'domain' => 'example.com', ], + [ + 'resourceType' => '', + 'resourceId' => '', + 'domain' => 'example.com', + ] ]; } @@ -184,26 +178,24 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function migrationProvider(): array + public static function migrationProvider(): \Iterator { - return [ - 'remove resourceId field' => [ - [ - 'resourceId' => 'resource123', - 'status' => 'completed', - ], - [ - 'status' => 'completed', - ] + yield 'remove resourceId field' => [ + [ + 'resourceId' => 'resource123', + 'status' => 'completed', ], - 'handle content without resourceId' => [ - [ - 'status' => 'completed', - ], - [ - 'status' => 'completed', - ] + [ + 'status' => 'completed', + ] + ]; + yield 'handle content without resourceId' => [ + [ + 'status' => 'completed', ], + [ + 'status' => 'completed', + ] ]; } @@ -217,26 +209,24 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function projectProvider(): array + public static function projectProvider(): \Iterator { - return [ - 'remove devKeys field' => [ - [ - 'devKeys' => ['key1', 'key2'], - 'name' => 'test-project', - ], - [ - 'name' => 'test-project', - ] + yield 'remove devKeys field' => [ + [ + 'devKeys' => ['key1', 'key2'], + 'name' => 'test-project', ], - 'handle content without devKeys' => [ - [ - 'name' => 'test-project', - ], - [ - 'name' => 'test-project', - ] + [ + 'name' => 'test-project', + ] + ]; + yield 'handle content without devKeys' => [ + [ + 'name' => 'test-project', ], + [ + 'name' => 'test-project', + ] ]; } @@ -250,26 +240,24 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function providerRepositoryProvider(): array + public static function providerRepositoryProvider(): \Iterator { - return [ - 'remove runtime field' => [ - [ - 'runtime' => 'nodejs', - 'name' => 'test-repo', - ], - [ - 'name' => 'test-repo', - ] + yield 'remove runtime field' => [ + [ + 'runtime' => 'nodejs', + 'name' => 'test-repo', ], - 'handle content without runtime' => [ - [ - 'name' => 'test-repo', - ], - [ - 'name' => 'test-repo', - ] + [ + 'name' => 'test-repo', + ] + ]; + yield 'handle content without runtime' => [ + [ + 'name' => 'test-repo', ], + [ + 'name' => 'test-repo', + ] ]; } @@ -283,26 +271,24 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function templateVariableProvider(): array + public static function templateVariableProvider(): \Iterator { - return [ - 'remove secret field' => [ - [ - 'secret' => 'secret-value', - 'name' => 'test-variable', - ], - [ - 'name' => 'test-variable', - ] + yield 'remove secret field' => [ + [ + 'secret' => 'secret-value', + 'name' => 'test-variable', ], - 'handle content without secret' => [ - [ - 'name' => 'test-variable', - ], - [ - 'name' => 'test-variable', - ] + [ + 'name' => 'test-variable', + ] + ]; + yield 'handle content without secret' => [ + [ + 'name' => 'test-variable', ], + [ + 'name' => 'test-variable', + ] ]; } @@ -316,30 +302,28 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function usageFunctionProvider(): array + public static function usageFunctionProvider(): \Iterator { - return [ - 'remove build-related fields' => [ - [ - 'buildsSuccessTotal' => 10, - 'buildsFailedTotal' => 2, - 'buildsTimeAverage' => 30, - 'buildsSuccess' => 5, - 'buildsFailed' => 1, - 'executions' => 100, - ], - [ - 'executions' => 100, - ] + yield 'remove build-related fields' => [ + [ + 'buildsSuccessTotal' => 10, + 'buildsFailedTotal' => 2, + 'buildsTimeAverage' => 30, + 'buildsSuccess' => 5, + 'buildsFailed' => 1, + 'executions' => 100, ], - 'handle content without build fields' => [ - [ - 'executions' => 100, - ], - [ - 'executions' => 100, - ] + [ + 'executions' => 100, + ] + ]; + yield 'handle content without build fields' => [ + [ + 'executions' => 100, ], + [ + 'executions' => 100, + ] ]; } @@ -353,29 +337,27 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function usageFunctionsProvider(): array + public static function usageFunctionsProvider(): \Iterator { - return [ - 'remove build-related fields' => [ - [ - 'buildsSuccessTotal' => 20, - 'buildsFailedTotal' => 4, - 'buildsSuccess' => 10, - 'buildsFailed' => 2, - 'executions' => 200, - ], - [ - 'executions' => 200, - ] + yield 'remove build-related fields' => [ + [ + 'buildsSuccessTotal' => 20, + 'buildsFailedTotal' => 4, + 'buildsSuccess' => 10, + 'buildsFailed' => 2, + 'executions' => 200, ], - 'handle content without build fields' => [ - [ - 'executions' => 200, - ], - [ - 'executions' => 200, - ] + [ + 'executions' => 200, + ] + ]; + yield 'handle content without build fields' => [ + [ + 'executions' => 200, ], + [ + 'executions' => 200, + ] ]; } @@ -389,26 +371,24 @@ class V19Test extends TestCase $this->assertEquals($expected, $result); } - public static function variableProvider(): array + public static function variableProvider(): \Iterator { - return [ - 'remove secret field' => [ - [ - 'secret' => 'secret-value', - 'name' => 'test-variable', - ], - [ - 'name' => 'test-variable', - ] + yield 'remove secret field' => [ + [ + 'secret' => 'secret-value', + 'name' => 'test-variable', ], - 'handle content without secret' => [ - [ - 'name' => 'test-variable', - ], - [ - 'name' => 'test-variable', - ] + [ + 'name' => 'test-variable', + ] + ]; + yield 'handle content without secret' => [ + [ + 'name' => 'test-variable', ], + [ + 'name' => 'test-variable', + ] ]; } diff --git a/tests/unit/Utopia/Response/Filters/V21Test.php b/tests/unit/Utopia/Response/Filters/V21Test.php index a049b70d84..6c7aacab58 100644 --- a/tests/unit/Utopia/Response/Filters/V21Test.php +++ b/tests/unit/Utopia/Response/Filters/V21Test.php @@ -1,5 +1,7 @@ [ - [ - 'name' => 'test-function', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - 'runtime' => 'node-18.0', - ], - [ - 'name' => 'test-function', - 'specification' => 's-1vcpu-512mb', - 'runtime' => 'node-18.0', - ] + yield 'merge buildSpecification and runtimeSpecification into specification' => [ + [ + 'name' => 'test-function', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + 'runtime' => 'node-18.0', ], - 'use buildSpecification when present' => [ - [ - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-1vcpu-512mb', - ], - [ - 'specification' => 's-2vcpu-1gb', - ] + [ + 'name' => 'test-function', + 'specification' => 's-1vcpu-512mb', + 'runtime' => 'node-18.0', + ] + ]; + yield 'use buildSpecification when present' => [ + [ + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-1vcpu-512mb', ], - 'fallback to specification when buildSpecification is missing' => [ - [ - 'specification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'specification' => 's-1vcpu-512mb', - ] + [ + 'specification' => 's-2vcpu-1gb', + ] + ]; + yield 'fallback to specification when buildSpecification is missing' => [ + [ + 'specification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', ], - 'handle missing both buildSpecification and specification' => [ - [ - 'name' => 'test-function', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'name' => 'test-function', - 'specification' => null, - ] + [ + 'specification' => 's-1vcpu-512mb', + ] + ]; + yield 'handle missing both buildSpecification and specification' => [ + [ + 'name' => 'test-function', + 'runtimeSpecification' => 's-1vcpu-256mb', ], - 'handle no spec fields at all' => [ - [ - 'name' => 'test-function', - 'runtime' => 'node-18.0', - ], - [ - 'name' => 'test-function', - 'specification' => null, - 'runtime' => 'node-18.0', - ] + [ + 'name' => 'test-function', + 'specification' => null, + ] + ]; + yield 'handle no spec fields at all' => [ + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', ], - 'handle empty buildSpecification string' => [ - [ - 'buildSpecification' => '', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'specification' => '', - ] + [ + 'name' => 'test-function', + 'specification' => null, + 'runtime' => 'node-18.0', + ] + ]; + yield 'handle empty buildSpecification string' => [ + [ + 'buildSpecification' => '', + 'runtimeSpecification' => 's-1vcpu-256mb', ], + [ + 'specification' => '', + ] ]; } @@ -97,68 +97,66 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function functionListProvider(): array + public static function functionListProvider(): \Iterator { - return [ - 'convert list of functions' => [ - [ - 'total' => 2, - 'functions' => [ - [ - 'name' => 'function-1', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'name' => 'function-2', - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-1vcpu-512mb', - ], + yield 'convert list of functions' => [ + [ + 'total' => 2, + 'functions' => [ + [ + 'name' => 'function-1', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + ], + [ + 'name' => 'function-2', + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-1vcpu-512mb', ], ], - [ - 'total' => 2, - 'functions' => [ - [ - 'name' => 'function-1', - 'specification' => 's-1vcpu-512mb', - ], - [ - 'name' => 'function-2', - 'specification' => 's-2vcpu-1gb', - ], + ], + [ + 'total' => 2, + 'functions' => [ + [ + 'name' => 'function-1', + 'specification' => 's-1vcpu-512mb', ], - ] - ], - 'handle empty function list' => [ - [ - 'total' => 0, - 'functions' => [], - ], - [ - 'total' => 0, - 'functions' => [], - ] - ], - 'handle single function in list' => [ - [ - 'total' => 1, - 'functions' => [ - [ - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], + [ + 'name' => 'function-2', + 'specification' => 's-2vcpu-1gb', ], ], - [ - 'total' => 1, - 'functions' => [ - [ - 'specification' => 's-1vcpu-512mb', - ], - ], - ] + ] + ]; + yield 'handle empty function list' => [ + [ + 'total' => 0, + 'functions' => [], ], + [ + 'total' => 0, + 'functions' => [], + ] + ]; + yield 'handle single function in list' => [ + [ + 'total' => 1, + 'functions' => [ + [ + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + ], + ], + ], + [ + 'total' => 1, + 'functions' => [ + [ + 'specification' => 's-1vcpu-512mb', + ], + ], + ] ]; } @@ -172,61 +170,59 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function siteProvider(): array + public static function siteProvider(): \Iterator { - return [ - 'merge buildSpecification and runtimeSpecification into specification' => [ - [ - 'name' => 'test-site', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - 'framework' => 'nextjs', - ], - [ - 'name' => 'test-site', - 'specification' => 's-1vcpu-512mb', - 'framework' => 'nextjs', - ] + yield 'merge buildSpecification and runtimeSpecification into specification' => [ + [ + 'name' => 'test-site', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + 'framework' => 'nextjs', ], - 'use buildSpecification when present' => [ - [ - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-1vcpu-512mb', - ], - [ - 'specification' => 's-2vcpu-1gb', - ] + [ + 'name' => 'test-site', + 'specification' => 's-1vcpu-512mb', + 'framework' => 'nextjs', + ] + ]; + yield 'use buildSpecification when present' => [ + [ + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-1vcpu-512mb', ], - 'fallback to specification when buildSpecification is missing' => [ - [ - 'specification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'specification' => 's-1vcpu-512mb', - ] + [ + 'specification' => 's-2vcpu-1gb', + ] + ]; + yield 'fallback to specification when buildSpecification is missing' => [ + [ + 'specification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', ], - 'handle missing both buildSpecification and specification' => [ - [ - 'name' => 'test-site', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'name' => 'test-site', - 'specification' => null, - ] + [ + 'specification' => 's-1vcpu-512mb', + ] + ]; + yield 'handle missing both buildSpecification and specification' => [ + [ + 'name' => 'test-site', + 'runtimeSpecification' => 's-1vcpu-256mb', ], - 'handle no spec fields at all' => [ - [ - 'name' => 'test-site', - 'framework' => 'react', - ], - [ - 'name' => 'test-site', - 'specification' => null, - 'framework' => 'react', - ] + [ + 'name' => 'test-site', + 'specification' => null, + ] + ]; + yield 'handle no spec fields at all' => [ + [ + 'name' => 'test-site', + 'framework' => 'react', ], + [ + 'name' => 'test-site', + 'specification' => null, + 'framework' => 'react', + ] ]; } @@ -240,70 +236,68 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function siteListProvider(): array + public static function siteListProvider(): \Iterator { - return [ - 'convert list of sites' => [ - [ - 'total' => 2, - 'sites' => [ - [ - 'name' => 'site-1', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'name' => 'site-2', - 'buildSpecification' => 's-2vcpu-1gb', - 'runtimeSpecification' => 's-1vcpu-512mb', - ], + yield 'convert list of sites' => [ + [ + 'total' => 2, + 'sites' => [ + [ + 'name' => 'site-1', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + ], + [ + 'name' => 'site-2', + 'buildSpecification' => 's-2vcpu-1gb', + 'runtimeSpecification' => 's-1vcpu-512mb', ], ], - [ - 'total' => 2, - 'sites' => [ - [ - 'name' => 'site-1', - 'specification' => 's-1vcpu-512mb', - ], - [ - 'name' => 'site-2', - 'specification' => 's-2vcpu-1gb', - ], + ], + [ + 'total' => 2, + 'sites' => [ + [ + 'name' => 'site-1', + 'specification' => 's-1vcpu-512mb', ], - ] - ], - 'handle empty site list' => [ - [ - 'total' => 0, - 'sites' => [], - ], - [ - 'total' => 0, - 'sites' => [], - ] - ], - 'handle single site in list' => [ - [ - 'total' => 1, - 'sites' => [ - [ - 'name' => 'my-site', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], + [ + 'name' => 'site-2', + 'specification' => 's-2vcpu-1gb', ], ], - [ - 'total' => 1, - 'sites' => [ - [ - 'name' => 'my-site', - 'specification' => 's-1vcpu-512mb', - ], - ], - ] + ] + ]; + yield 'handle empty site list' => [ + [ + 'total' => 0, + 'sites' => [], ], + [ + 'total' => 0, + 'sites' => [], + ] + ]; + yield 'handle single site in list' => [ + [ + 'total' => 1, + 'sites' => [ + [ + 'name' => 'my-site', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + ], + ], + ], + [ + 'total' => 1, + 'sites' => [ + [ + 'name' => 'my-site', + 'specification' => 's-1vcpu-512mb', + ], + ], + ] ]; } @@ -317,111 +311,109 @@ class V21Test extends TestCase $this->assertEquals($expected, $result); } - public static function documentProvider(): array + public static function documentProvider(): \Iterator { - return [ - 'cast $sequence to int' => [ - [ - '$id' => 'doc1', - '$sequence' => '123', - 'name' => 'test', - ], - [ - '$id' => 'doc1', - '$sequence' => 123, - 'name' => 'test', - ] + yield 'cast $sequence to int' => [ + [ + '$id' => 'doc1', + '$sequence' => '123', + 'name' => 'test', ], - 'non-numeric $sequence becomes 0' => [ - [ - '$id' => 'doc1', - '$sequence' => 'abc', - ], - [ - '$id' => 'doc1', - '$sequence' => 0, - ] + [ + '$id' => 'doc1', + '$sequence' => 123, + 'name' => 'test', + ] + ]; + yield 'non-numeric $sequence becomes 0' => [ + [ + '$id' => 'doc1', + '$sequence' => 'abc', ], - 'nested relationship document' => [ - [ - '$id' => 'doc1', - '$sequence' => '1', - 'author' => [ + [ + '$id' => 'doc1', + '$sequence' => 0, + ] + ]; + yield 'nested relationship document' => [ + [ + '$id' => 'doc1', + '$sequence' => '1', + 'author' => [ + '$id' => 'doc2', + '$sequence' => '2', + 'name' => 'John', + ], + ], + [ + '$id' => 'doc1', + '$sequence' => 1, + 'author' => [ + '$id' => 'doc2', + '$sequence' => 2, + 'name' => 'John', + ], + ] + ]; + yield 'nested array of relationship documents' => [ + [ + '$id' => 'doc1', + '$sequence' => '1', + 'comments' => [ + [ '$id' => 'doc2', '$sequence' => '2', - 'name' => 'John', + 'text' => 'hello', + ], + [ + '$id' => 'doc3', + '$sequence' => '3', + 'text' => 'world', ], ], - [ - '$id' => 'doc1', - '$sequence' => 1, - 'author' => [ + ], + [ + '$id' => 'doc1', + '$sequence' => 1, + 'comments' => [ + [ '$id' => 'doc2', '$sequence' => 2, - 'name' => 'John', + 'text' => 'hello', ], - ] - ], - 'nested array of relationship documents' => [ - [ - '$id' => 'doc1', - '$sequence' => '1', - 'comments' => [ - [ - '$id' => 'doc2', - '$sequence' => '2', - 'text' => 'hello', - ], - [ - '$id' => 'doc3', - '$sequence' => '3', - 'text' => 'world', - ], + [ + '$id' => 'doc3', + '$sequence' => 3, + 'text' => 'world', ], ], - [ - '$id' => 'doc1', - '$sequence' => 1, - 'comments' => [ - [ - '$id' => 'doc2', - '$sequence' => 2, - 'text' => 'hello', - ], - [ - '$id' => 'doc3', - '$sequence' => 3, - 'text' => 'world', - ], - ], - ] - ], - 'deeply nested relationships' => [ - [ - '$id' => 'doc1', - '$sequence' => '1', - 'author' => [ - '$id' => 'doc2', - '$sequence' => '2', - 'profile' => [ - '$id' => 'doc3', - '$sequence' => '3', - ], + ] + ]; + yield 'deeply nested relationships' => [ + [ + '$id' => 'doc1', + '$sequence' => '1', + 'author' => [ + '$id' => 'doc2', + '$sequence' => '2', + 'profile' => [ + '$id' => 'doc3', + '$sequence' => '3', ], ], - [ - '$id' => 'doc1', - '$sequence' => 1, - 'author' => [ - '$id' => 'doc2', - '$sequence' => 2, - 'profile' => [ - '$id' => 'doc3', - '$sequence' => 3, - ], - ], - ] ], + [ + '$id' => 'doc1', + '$sequence' => 1, + 'author' => [ + '$id' => 'doc2', + '$sequence' => 2, + 'profile' => [ + '$id' => 'doc3', + '$sequence' => 3, + ], + ], + ] ]; } @@ -441,51 +433,49 @@ class V21Test extends TestCase $this->assertSame($expected, $result); } - public static function documentListProvider(): array + public static function documentListProvider(): \Iterator { - return [ - 'cast $sequence in document list' => [ - [ - 'total' => 2, - 'documents' => [ - [ - '$id' => 'doc1', - '$sequence' => '10', - 'name' => 'first', - ], - [ - '$id' => 'doc2', - '$sequence' => '20', - 'name' => 'second', - ], + yield 'cast $sequence in document list' => [ + [ + 'total' => 2, + 'documents' => [ + [ + '$id' => 'doc1', + '$sequence' => '10', + 'name' => 'first', + ], + [ + '$id' => 'doc2', + '$sequence' => '20', + 'name' => 'second', ], ], - [ - 'total' => 2, - 'documents' => [ - [ - '$id' => 'doc1', - '$sequence' => 10, - 'name' => 'first', - ], - [ - '$id' => 'doc2', - '$sequence' => 20, - 'name' => 'second', - ], + ], + [ + 'total' => 2, + 'documents' => [ + [ + '$id' => 'doc1', + '$sequence' => 10, + 'name' => 'first', + ], + [ + '$id' => 'doc2', + '$sequence' => 20, + 'name' => 'second', ], - ] - ], - 'handle empty document list' => [ - [ - 'total' => 0, - 'documents' => [], ], - [ - 'total' => 0, - 'documents' => [], - ] + ] + ]; + yield 'handle empty document list' => [ + [ + 'total' => 0, + 'documents' => [], ], + [ + 'total' => 0, + 'documents' => [], + ] ]; } @@ -510,40 +500,38 @@ class V21Test extends TestCase $this->assertSame($expected, $result); } - public static function defaultPassthroughProvider(): array + public static function defaultPassthroughProvider(): \Iterator { - return [ - 'unmatched model passes through unchanged' => [ - Response::MODEL_DOCUMENT, - [ - 'name' => 'test-doc', - '$id' => 'doc123', - 'data' => 'some-value', - ], - [ - 'name' => 'test-doc', - '$id' => 'doc123', - 'data' => 'some-value', - ] + yield 'unmatched model passes through unchanged' => [ + Response::MODEL_DOCUMENT, + [ + 'name' => 'test-doc', + '$id' => 'doc123', + 'data' => 'some-value', ], - 'empty content passes through unchanged' => [ - Response::MODEL_DOCUMENT, - [], - [] - ], - 'deployment model passes through unchanged' => [ - Response::MODEL_DEPLOYMENT, - [ - 'id' => 'deployment123', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ], - [ - 'id' => 'deployment123', - 'buildSpecification' => 's-1vcpu-512mb', - 'runtimeSpecification' => 's-1vcpu-256mb', - ] + [ + 'name' => 'test-doc', + '$id' => 'doc123', + 'data' => 'some-value', + ] + ]; + yield 'empty content passes through unchanged' => [ + Response::MODEL_DOCUMENT, + [], + [] + ]; + yield 'deployment model passes through unchanged' => [ + Response::MODEL_DEPLOYMENT, + [ + 'id' => 'deployment123', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', ], + [ + 'id' => 'deployment123', + 'buildSpecification' => 's-1vcpu-512mb', + 'runtimeSpecification' => 's-1vcpu-256mb', + ] ]; } diff --git a/tests/unit/Utopia/ResponseTest.php b/tests/unit/Utopia/ResponseTest.php index 74c68303f4..80c59ee2f8 100644 --- a/tests/unit/Utopia/ResponseTest.php +++ b/tests/unit/Utopia/ResponseTest.php @@ -1,5 +1,7 @@ generateComment(); $secondTip = $this->extractTip($second); - $this->assertEquals($firstTip, $secondTip); + $this->assertSame($firstTip, $secondTip); } public function testTipIsRestoredFromParsedComment(): void @@ -94,7 +96,7 @@ class CommentTest extends TestCase $newTip = $this->extractTip($new); $this->assertNotNull($newTip); - $this->assertNotEquals('Old tip that should be ignored', $newTip); + $this->assertNotSame('Old tip that should be ignored', $newTip); $this->assertContains($newTip, $this->getTips()); } @@ -132,7 +134,7 @@ class CommentTest extends TestCase $second = $comment->generateComment(); $secondTip = $this->extractTip($second); - $this->assertEquals($firstTip, $secondTip); + $this->assertSame($firstTip, $secondTip); } private function extractTip(string $comment): ?string