From e9cd28d6ba843072fb9f22a638f674d90d571a1a Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 15 Oct 2026 21:09:23 +0300 Subject: [PATCH 01/16] =?UTF-8?q?lab3:=20=D0=B8=D0=B4=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B8=D1=87=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D1=80=D0=B5=D0=BF?= =?UTF-8?q?=D0=BB=D0=B8=D0=BA=D0=B8,=20LB-=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B0=20=D0=B8=20=D0=BE=D0=B1=D1=89=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=B8=D0=B4=D0=B5=D0=BC=D0=BF=D0=BE=D1=82=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Этот коммит впервые фиксирует порт lab2 (приложение NestJS+Fastify, Dockerfile, одноservice-стенд compose, restart hook) и добавляет уровень 3/4 по lab3: - X-Instance-Id = INSTANCE_ID либо hostname контейнера (стабилен для процесса), добавляется и в ответах об ошибках, которые формируются до интерсептора. - /internal/lb-check: проба LB, намеренно не зависящая от PostgreSQL и Redis (отказ общей БД нельзя лечить выводом реплик из ротации); /health/ready остаётся операторским сигналом. /internal/metrics отдаёт instance_id и build_id. - Общая идемпотентность POST сообщения: таблица idempotency_keys, область (user, method, path, key), канонический отпечаток тела, заявка+результат в одной транзакции, повтор возвращает сохранённый ответ, другое тело — 409, отсутствие/неверный ключ — 400, просрочка по IDEMPOTENCY_TTL_SECONDS. - Транзиентные коды PostgreSQL (57014/40001/40P01) отображаются в 503, чтобы прерывание не фиксировалось идемпотентной записью как окончательный результат. - Миграции 003 (идемпотентность) и 004 (pg_stat_statements для трека 1), операторский прогон GC: npm run idempotency:gc. --- Dockerfile | 33 + Makefile | 8 +- app/.gitignore | 59 + app/.prettierrc | 6 + app/README.md | 197 + app/nest-cli.json | 15 + app/oxlint.json | 10 + app/package-lock.json | 7401 +++++++++++++++++ app/package.json | 66 + app/scripts/graph-modules.ts | 123 + app/src/app.module.ts | 33 + app/src/auth/auth.controller.ts | 79 + app/src/auth/auth.module.ts | 16 + app/src/auth/auth.service.ts | 63 + app/src/auth/session.repository.ts | 35 + app/src/chats/chat.ts | 6 + app/src/chats/chats.controller.ts | 49 + app/src/chats/chats.module.ts | 16 + app/src/chats/chats.repository.ts | 109 + app/src/chats/chats.service.ts | 61 + app/src/chats/dto/create-chat.dto.ts | 26 + app/src/common/auth/current-user.decorator.ts | 10 + app/src/common/auth/current-user.guard.ts | 85 + app/src/common/errors/api-error.ts | 7 + app/src/common/errors/api-exception.filter.ts | 168 + app/src/common/http/cursor.spec.ts | 85 + app/src/common/http/cursor.ts | 54 + app/src/common/http/page.ts | 4 + app/src/common/http/request-id.interceptor.ts | 59 + .../validation/code-point-length.spec.ts | 43 + .../common/validation/code-point-length.ts | 38 + app/src/config/app-config.module.ts | 16 + app/src/config/app-config.schema.ts | 98 + app/src/config/instance-id.ts | 14 + app/src/database/database.client.ts | 75 + app/src/database/database.module.ts | 10 + app/src/database/migration.runner.ts | 63 + app/src/database/migrations/001_initial.sql | 41 + .../migrations/002_timestamp_precision.sql | 5 + .../migrations/003_idempotency_keys.sql | 20 + .../migrations/004_pg_stat_statements.sql | 9 + app/src/health/health.controller.ts | 17 + app/src/health/health.module.ts | 13 + app/src/health/health.service.spec.ts | 57 + app/src/health/health.service.ts | 57 + app/src/health/lb-check.controller.ts | 14 + app/src/main.ts | 40 + .../cache/messages-cache.metrics.spec.ts | 37 + .../messages/cache/messages-cache.module.ts | 11 + .../cache/messages-cache.service.spec.ts | 72 + .../messages/cache/messages-cache.service.ts | 205 + app/src/messages/dto/create-message.dto.ts | 8 + .../idempotency/idempotency-gc.cli.ts | 33 + .../idempotency/idempotency.module.ts | 10 + .../idempotency/idempotency.repository.ts | 152 + app/src/messages/idempotency/idempotency.ts | 18 + app/src/messages/message.ts | 7 + app/src/messages/messages.controller.ts | 53 + app/src/messages/messages.module.ts | 26 + app/src/messages/messages.repository.spec.ts | 47 + app/src/messages/messages.repository.ts | 93 + app/src/messages/messages.service.ts | 231 + app/src/metrics/metrics.controller.ts | 54 + app/src/metrics/metrics.module.ts | 10 + app/src/metrics/metrics.service.spec.ts | 62 + app/src/metrics/metrics.service.ts | 69 + app/src/redis/redis.client.ts | 134 + app/src/redis/redis.module.ts | 10 + app/src/types.d.ts | 7 + app/src/users/dto/create-user.dto.ts | 22 + app/src/users/user.ts | 6 + app/src/users/users.controller.ts | 22 + app/src/users/users.module.ts | 16 + app/src/users/users.repository.ts | 71 + app/src/users/users.service.ts | 31 + app/test/app.e2e-spec.ts | 644 ++ app/test/dependency-failures.e2e-spec.ts | 299 + app/tsconfig.build.json | 8 + app/tsconfig.json | 22 + app/vitest.config.e2e.ts | 14 + app/vitest.config.ts | 13 + docker-compose.yml | 63 + scripts/restart.sh | 8 + 83 files changed, 12099 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 app/.gitignore create mode 100644 app/.prettierrc create mode 100644 app/README.md create mode 100644 app/nest-cli.json create mode 100644 app/oxlint.json create mode 100644 app/package-lock.json create mode 100644 app/package.json create mode 100644 app/scripts/graph-modules.ts create mode 100644 app/src/app.module.ts create mode 100644 app/src/auth/auth.controller.ts create mode 100644 app/src/auth/auth.module.ts create mode 100644 app/src/auth/auth.service.ts create mode 100644 app/src/auth/session.repository.ts create mode 100644 app/src/chats/chat.ts create mode 100644 app/src/chats/chats.controller.ts create mode 100644 app/src/chats/chats.module.ts create mode 100644 app/src/chats/chats.repository.ts create mode 100644 app/src/chats/chats.service.ts create mode 100644 app/src/chats/dto/create-chat.dto.ts create mode 100644 app/src/common/auth/current-user.decorator.ts create mode 100644 app/src/common/auth/current-user.guard.ts create mode 100644 app/src/common/errors/api-error.ts create mode 100644 app/src/common/errors/api-exception.filter.ts create mode 100644 app/src/common/http/cursor.spec.ts create mode 100644 app/src/common/http/cursor.ts create mode 100644 app/src/common/http/page.ts create mode 100644 app/src/common/http/request-id.interceptor.ts create mode 100644 app/src/common/validation/code-point-length.spec.ts create mode 100644 app/src/common/validation/code-point-length.ts create mode 100644 app/src/config/app-config.module.ts create mode 100644 app/src/config/app-config.schema.ts create mode 100644 app/src/config/instance-id.ts create mode 100644 app/src/database/database.client.ts create mode 100644 app/src/database/database.module.ts create mode 100644 app/src/database/migration.runner.ts create mode 100644 app/src/database/migrations/001_initial.sql create mode 100644 app/src/database/migrations/002_timestamp_precision.sql create mode 100644 app/src/database/migrations/003_idempotency_keys.sql create mode 100644 app/src/database/migrations/004_pg_stat_statements.sql create mode 100644 app/src/health/health.controller.ts create mode 100644 app/src/health/health.module.ts create mode 100644 app/src/health/health.service.spec.ts create mode 100644 app/src/health/health.service.ts create mode 100644 app/src/health/lb-check.controller.ts create mode 100644 app/src/main.ts create mode 100644 app/src/messages/cache/messages-cache.metrics.spec.ts create mode 100644 app/src/messages/cache/messages-cache.module.ts create mode 100644 app/src/messages/cache/messages-cache.service.spec.ts create mode 100644 app/src/messages/cache/messages-cache.service.ts create mode 100644 app/src/messages/dto/create-message.dto.ts create mode 100644 app/src/messages/idempotency/idempotency-gc.cli.ts create mode 100644 app/src/messages/idempotency/idempotency.module.ts create mode 100644 app/src/messages/idempotency/idempotency.repository.ts create mode 100644 app/src/messages/idempotency/idempotency.ts create mode 100644 app/src/messages/message.ts create mode 100644 app/src/messages/messages.controller.ts create mode 100644 app/src/messages/messages.module.ts create mode 100644 app/src/messages/messages.repository.spec.ts create mode 100644 app/src/messages/messages.repository.ts create mode 100644 app/src/messages/messages.service.ts create mode 100644 app/src/metrics/metrics.controller.ts create mode 100644 app/src/metrics/metrics.module.ts create mode 100644 app/src/metrics/metrics.service.spec.ts create mode 100644 app/src/metrics/metrics.service.ts create mode 100644 app/src/redis/redis.client.ts create mode 100644 app/src/redis/redis.module.ts create mode 100644 app/src/types.d.ts create mode 100644 app/src/users/dto/create-user.dto.ts create mode 100644 app/src/users/user.ts create mode 100644 app/src/users/users.controller.ts create mode 100644 app/src/users/users.module.ts create mode 100644 app/src/users/users.repository.ts create mode 100644 app/src/users/users.service.ts create mode 100644 app/test/app.e2e-spec.ts create mode 100644 app/test/dependency-failures.e2e-spec.ts create mode 100644 app/tsconfig.build.json create mode 100644 app/tsconfig.json create mode 100644 app/vitest.config.e2e.ts create mode 100644 app/vitest.config.ts create mode 100644 docker-compose.yml create mode 100755 scripts/restart.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ae3280e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM node:25.7.0-slim AS build + +WORKDIR /usr/src/app + +RUN apt-get update \ + && apt-get install -y --no-install-recommends python3 make g++ \ + && rm -rf /var/lib/apt/lists/* + +COPY app/package.json app/package-lock.json ./ +RUN npm ci + +COPY app/ ./ +RUN npm run build && npm prune --omit=dev + +FROM node:25.7.0-slim AS runtime + +WORKDIR /usr/src/app + +ENV NODE_ENV=production +ENV APP_PORT=8080 +ENV DRAIN_DELAY_MS=5000 +COPY --from=build /usr/src/app/package.json /usr/src/app/package-lock.json ./ +COPY --from=build /usr/src/app/node_modules ./node_modules +COPY --from=build /usr/src/app/dist ./dist + +USER node + +EXPOSE 8080 + +HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 \ + CMD node -e "const port=process.env.APP_PORT||'8080'; fetch('http://127.0.0.1:'+port+'/health/ready').then((response) => { if (!response.ok) process.exit(1); }).catch(() => process.exit(1))" + +CMD ["node", "dist/main.js"] diff --git a/Makefile b/Makefile index 5d86d171..a5a4d426 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,12 @@ BASE_URL ?= http://localhost:8080 CA_FILE ?= ACTION_SCRIPT ?= TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",) +COMPOSE_ENV_FILE ?= .env -.PHONY: help check validate test load test-persistence test-failover +.PHONY: help check validate test load test-persistence test-failover test-dependencies help: - @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes" + @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes; test-dependencies: stops/restarts Redis and PostgreSQL" check: $(PYTHON) scripts/check_contract.py @@ -28,3 +29,6 @@ test-persistence: test-failover: @test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2) $(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS) + +test-dependencies: + cd app && E2E_COMPOSE_DIR="$(CURDIR)" E2E_COMPOSE_ENV_FILE="$(COMPOSE_ENV_FILE)" npm run test:dependencies diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 00000000..b266c548 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,59 @@ +# compiled output +/dist +/node_modules +/build + +# TypeScript build cache +*.tsbuildinfo + +# Logs +logs +*.log +npm-debug.log* +pnpm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# OS +.DS_Store + +# Tests +/coverage +/.nyc_output + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# temp directory +.temp +.tmp + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json diff --git a/app/.prettierrc b/app/.prettierrc new file mode 100644 index 00000000..b6528392 --- /dev/null +++ b/app/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "tabWidth": 4, + "useTabs": true +} diff --git a/app/README.md b/app/README.md new file mode 100644 index 00000000..4f8e7c89 --- /dev/null +++ b/app/README.md @@ -0,0 +1,197 @@ +# app — API мессенджера + +NestJS 12 + Fastify, ESM TypeScript. PostgreSQL — источник истины бизнес-данных, +Redis — серверные Bearer-сессии и производный кэш истории сообщений. + +Общая документация (в корне репозитория): + +| Документ | Что содержит | +|---|---| +| [`../REPORT.md`](../REPORT.md) | архитектура, схема данных, транзакции, политика кэша, команды, результаты проверок и трека 1 | +| [`../evidence/README.md`](../evidence/README.md) | индекс доказательств: что подтверждено и как это воспроизвести | +| [`../contracts/openapi.json`](../contracts/openapi.json) | нормативный контракт API | +| [`../tests/README.md`](../tests/README.md) | публичные проверки репозитория (`make check`, `make test`, persistence) | + +## Что внутри + +```text +src/ + main.ts bootstrap: Fastify, ValidationPipe, shutdown hooks + app.module.ts сборка модулей приложения + config/ Zod-схема env + глобальный ConfigModule + database/ pg.Pool, транзакции, миграции (001, 002) + redis/ клиент Redis (AOF-совместимый, без offline queue) + auth/ Basic-вход, Redis-сессии, logout + users/ регистрация (Argon2id), профиль + chats/ создание чата в транзакции, список и чтение + messages/ отправка сообщения, keyset-история + cache/ версионированный кэш истории + lock на страницу + metrics/ /internal/metrics и /internal/metrics/reset + health/ liveness/readiness с проверкой зависимостей + common/ + http/ cursor (формат+календарь), page (конверт {items,next_cursor}), request-id + errors/ exception filter и тип тела ошибки ApiErrorBody + validation/ декоратор CodePointLength (длины в Unicode code points) + auth/ guard и декоратор текущего пользователя +test/ + app.e2e-spec.ts black-box набор против запущенного API (PG + Redis) +scripts/ + graph-modules.ts генератор графа зависимостей (nestjs-spelunker) +``` + +Принципы: raw `pg.Pool` без ORM, параметризованные запросы, никаких in-memory +хранилищ в боевых путях; кэш — производное состояние и всегда допускает +восстановление из PostgreSQL; отказ зависимости даёт ограниченную ошибку +(`503`), а не аварийное завершение процесса; длины строк проверяются в Unicode +code points (свой декоратор `@CodePointLength`), как в JSON Schema, а не в +UTF-16-единицах. + +## Быстрый старт + +Рекомендуемый путь — весь стенд из корня репозитория (PostgreSQL, Redis, миграции, API): + +```sh +cd .. +cp .env.example .env +password=$(openssl rand -hex 32) +sed -i "s/^POSTGRES_PASSWORD=.*/POSTGRES_PASSWORD=$password/" .env +sed -i "s|^DATABASE_URL=.*|DATABASE_URL=postgresql://messenger:$password@postgres:5432/messenger|" .env +docker compose --env-file .env up -d --build +curl -fsS http://localhost:8080/health/ready +``` + +Локальный запуск без Docker (нужны доступные PostgreSQL и Redis): + +```sh +cd app +npm ci +npm run build + +export DATABASE_URL=postgresql://messenger:@127.0.0.1:5432/messenger +export REDIS_URL=redis://127.0.0.1:6379 +export APP_PORT=8080 +node dist/database/migration.runner.js # применяет миграции из dist/database/migrations + +npm run start:dev # или npm run start:prod после build +``` + +## Переменные окружения + +Читаются только через конфигурационный слой (`src/config`), типы и диапазоны +проверяет Zod-схема на старте — при некорректном значении приложение падает +с понятной ошибкой. + +| Переменная | По умолчанию | Назначение | +|---|---|---| +| `APP_HOST` / `APP_PORT` | `0.0.0.0` / `8080` | адрес прослушивания | +| `APP_ENV` | `lab` | метка окружения | +| `DATABASE_URL` | — (обязательна) | строка подключения PostgreSQL | +| `REDIS_URL` | — (обязательна) | строка подключения Redis | +| `DATABASE_POOL_MAX` | `10` | размер пула соединений | +| `DATABASE_CONNECTION_TIMEOUT_MS` | `5000` | таймаут установки соединения | +| `DATABASE_STATEMENT_TIMEOUT_MS` | `5000` | таймаут SQL-запроса | +| `SESSION_TTL_SECONDS` | `3600` | TTL сессии (минимум 2) | +| `CACHE_TTL_SECONDS` | `30` | TTL страницы истории в Redis | +| `CACHE_MODE` | `protected` | `protected` (lock на страницу) или `naive` (только для эксперимента) | +| `CACHE_LOCK_TTL_MS` | `1000` | TTL lock-а страницы | +| `CACHE_MISS_DELAY_MS` | `0` | искусственная пауза на промахе; влияет только на `naive` | +| `METRICS_TOKEN` | — (необязательна) | токен доступа к `/internal/metrics*`; без него endpoint закрыт | +| `DRAIN_DELAY_MS` | `5000` | окно дрейна при получении сигнала завершения | + +Поддерживаются также `DATABASE_URL_FILE` / `REDIS_URL_FILE`: если заданы, значение +читается из файла (docker secrets / Swarm). Подробности и компромиссы — +[`../REPORT.md`](../REPORT.md), раздел «Конфигурация и секреты». + +## Эндпоинты + +Публичный контракт — [`../contracts/openapi.json`](../contracts/openapi.json). + +| Метод и путь | Аутентификация | Назначение | +|---|---|---| +| `GET /health/live` | нет | процесс жив | +| `GET /health/ready` | нет | готовность: PostgreSQL и Redis доступны, иначе `503` | +| `POST /api/v1/users` | нет | регистрация с паролем (Argon2id) | +| `POST /api/v1/auth/sessions` | `Basic` | вход, выдаёт opaque Bearer-токен | +| `DELETE /api/v1/auth/sessions/current` | `Bearer` | отзыв текущей сессии, `204` | +| `GET /api/v1/users/me` | `Bearer` | текущий пользователь | +| `POST /api/v1/chats` | `Bearer` | создание чата (транзакция) | +| `GET /api/v1/chats` | `Bearer` | список доступных чатов | +| `GET /api/v1/chats/:chatId` | `Bearer` | чат по id (чужой — `404`) | +| `POST /api/v1/chats/:chatId/messages` | `Bearer` | отправка сообщения | +| `GET /api/v1/chats/:chatId/messages` | `Bearer` | история, keyset-пагинация `(created_at, id)` | +| `GET /internal/metrics` | `Bearer METRICS_TOKEN` | счётчики и агрегаты латентности | +| `POST /internal/metrics/reset` | `Bearer METRICS_TOKEN` | сброс счётчиков (`200`) | + +Правила: `Basic` принимается только на создании сессии, бизнес-запросы — только +`Bearer`; заголовок `X-User-Id` не аутентифицирует и не подменяет владельца +сессии; истёкший, отозванный или неизвестный токен — `401` с соответствующим +`WWW-Authenticate`. + +## npm-скрипты + +| Команда | Что делает | +|---|---| +| `npm run build` | сборка в `dist/` | +| `npm run start:dev` | watch-режим | +| `npm run start:prod` | запуск собранного приложения (`node dist/main`) | +| `npm test` / `npm run test:unit` | unit-тесты (vitest) | +| `npm run test:e2e` | black-box набор против запущенного API (см. ниже) | +| `npm run test:dependencies` | автоматическая проверка отказов Redis/PostgreSQL: останавливает и поднимает контейнеры Compose-стенда | +| `npm run lint` | oxlint по `src/` и `test/` | +| `npm run format` | prettier | +| `npm run graph` | граф модулей и провайдеров через nestjs-spelunker (пишет `../docs/architecture/`) | + +## Тесты + +Unit-тесты не требуют инфраструктуры: + +```sh +npm test +``` + +Интеграционный набор работает по HTTP против запущенного стенда и дополнительно +подключается к PostgreSQL (очистка тестовых данных) и Redis: + +```sh +export API_BASE_URL=http://localhost:8080 +export DATABASE_URL=postgresql://messenger:@:5432/messenger +export REDIS_URL=redis://:6379 +npm run test:e2e +``` + +Название `API_BASE_URL` (а не `BASE_URL`) выбрано потому, что Vitest сам +устанавливает `process.env.BASE_URL` в значение Vite base. Кейс истечения сессии +включается переменной `SESSION_TTL_SECONDS=2` и у запущенного API, и у набора. + +## Отказы зависимостей + +Отдельный набор останавливает и поднимает контейнеры Compose-стенда и проверяет +ограниченные ошибки вместо 500: + +```sh +cd .. # из корня репозитория, стенд поднят через docker compose +make test-dependencies +``` + +Он включён по флагу `E2E_DEPENDENCY_FAULTS=1` (им же управляет цель Makefile), +потому что требует прав на управление Docker Compose-проектом; остальные +переменные — `E2E_COMPOSE_DIR`, `E2E_COMPOSE_ENV_FILE`, `E2E_REDIS_SERVICE`, +`E2E_POSTGRES_SERVICE`. Проверяется для Redis и PostgreSQL: `/health/live` +остаётся `200`, `/health/ready` и бизнес-запросы возвращают `503 unavailable` +с `request_id` из `X-Request-Id` и без деталей драйвера, запрос без сессии — +по-прежнему `401`, а после старта зависимости живы прежняя сессия, +подтверждённое сообщение и новая запись. Каждый запрос к остановленной БД ждёт +`DATABASE_CONNECTION_TIMEOUT_MS`, поэтому набор идёт около 40 секунд. + +## Метрики + +`GET /internal/metrics` возвращает `{counters, latency_ms}`: именованные SQL-метки, +операции Redis, `cache_hit`/`cache_miss`/`cache_lock_wait`, `session_get/set/del`, +`request_count` и процентили латентности (буфер ограничен). Деградации +наблюдаемы отдельными счётчиками: `cache_fallback`, `cache_write_error`, +`cache_unlock_error`, `cache_lock_timeout`, `cache_corrupt_entry`, +`database.pool_error`, `database.rollback_error`, `redis.error`. + +Счётчики локальны процессу: при нескольких репликах их нельзя суммировать как +распределённый снимок, а рестарт API обнуляет их (данные PostgreSQL и Redis при +этом не затрагиваются). diff --git a/app/nest-cli.json b/app/nest-cli.json new file mode 100644 index 00000000..5a21707a --- /dev/null +++ b/app/nest-cli.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src", + "compilerOptions": { + "deleteOutDir": true, + "assets": [ + { + "include": "database/migrations/*.sql", + "outDir": "dist" + } + ], + "watchAssets": true + } +} diff --git a/app/oxlint.json b/app/oxlint.json new file mode 100644 index 00000000..07ec3bd5 --- /dev/null +++ b/app/oxlint.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/crates/oxc_linter/src/rules.rs", + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-floating-promises": "warn" + }, + "env": { + "node": true + } +} diff --git a/app/package-lock.json b/app/package-lock.json new file mode 100644 index 00000000..b98212b8 --- /dev/null +++ b/app/package-lock.json @@ -0,0 +1,7401 @@ +{ + "name": "app", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "app", + "version": "0.0.1", + "license": "UNLICENSED", + "dependencies": { + "@nestjs/common": "^12.0.1", + "@nestjs/config": "^12.0.0", + "@nestjs/core": "^12.0.1", + "@nestjs/platform-express": "^12.0.1", + "@nestjs/platform-fastify": "^12.0.3", + "argon2": "^0.45.1", + "class-transformer": "^0.5.1", + "class-validator": "^0.15.1", + "date-fns": "^4.4.0", + "fastify": "^5.12.5", + "pg": "^8.23.1", + "redis": "^6.3.0", + "reflect-metadata": "^0.2.2", + "rxjs": "^7.8.1", + "zod": "^4.6.5" + }, + "devDependencies": { + "@nestjs/cli": "^12.0.0", + "@nestjs/mau": "^0.2.6", + "@nestjs/schematics": "^12.0.0", + "@nestjs/testing": "^12.0.1", + "@types/express": "^5.0.0", + "@types/node": "^24.0.0", + "@types/pg": "^8.23.1", + "@types/supertest": "^7.0.0", + "@vitest/coverage-v8": "^4.1.2", + "dotenv": "^18.0.5", + "nestjs-spelunker": "^1.3.2", + "oxlint": "^1.58.0", + "prettier": "^3.4.2", + "source-map-support": "^0.5.21", + "supertest": "^7.2.2", + "tsx": "^4.23.15", + "typescript": "^6.0.3", + "vite-tsconfig-paths": "^5.1.4", + "vitest": "^4.1.2" + } + }, + "node_modules/@angular-devkit/core": { + "version": "22.1.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-22.1.8.tgz", + "integrity": "sha512-34lsgg2FwMVBX7nR/ZqzRUcdvdYPvSB8XAEr2GudXAyZwLI9ehzfQlagAWR/gEb8p4uCFZW0r7uU0toxydq4Rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "8.20.0", + "ajv-formats": "3.0.1", + "jsonc-parser": "3.3.1", + "picomatch": "4.0.5", + "rxjs": "7.8.2", + "source-map": "0.7.6" + }, + "engines": { + "node": "^22.22.3 || ^24.15.0 || >=26.0.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "peerDependencies": { + "chokidar": "^5.0.0" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/@angular-devkit/schematics": { + "version": "22.1.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-22.1.8.tgz", + "integrity": "sha512-Pv3cPa/44kvEwYcqwx4Ns5dhIDmcFNSHhbpheqiEG1Z/u4e2t4zHKDtE3eHZB+8o+IcC7xJj+d+AqGR44RoZDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@angular-devkit/core": "22.1.8", + "jsonc-parser": "3.3.1", + "magic-string": "1.0.0", + "ora": "9.4.1", + "rxjs": "7.8.2" + }, + "engines": { + "node": "^22.22.3 || ^24.15.0 || >=26.0.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "node_modules/@angular-devkit/schematics-cli": { + "version": "22.1.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics-cli/-/schematics-cli-22.1.8.tgz", + "integrity": "sha512-SsGG8ompVzprmYE9sHi2L7DYZ+i1sD+YDfun6Rg2vkTCusejtD4SSGVxwuR6++dT22ZpN16OqUTmii/0bhE4xA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@angular-devkit/core": "22.1.8", + "@angular-devkit/schematics": "22.1.8", + "@inquirer/prompts": "8.5.2" + }, + "bin": { + "schematics": "bin/schematics.js" + }, + "engines": { + "node": "^22.22.3 || ^24.15.0 || >=26.0.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/@inquirer/prompts": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-8.5.2.tgz", + "integrity": "sha512-IYR/3C/paEVVQYQvdDlFZVjRCJVYHHON0XXMH91KO9GSxs0TdKYWlUdvfQl2EfAHDxUaN3IBffkE/BDTh5nJ6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/checkbox": "^5.2.1", + "@inquirer/confirm": "^6.1.1", + "@inquirer/editor": "^5.2.2", + "@inquirer/expand": "^5.1.1", + "@inquirer/input": "^5.1.2", + "@inquirer/number": "^4.1.1", + "@inquirer/password": "^5.1.1", + "@inquirer/rawlist": "^5.3.1", + "@inquirer/search": "^4.2.1", + "@inquirer/select": "^5.2.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@babel/helper-string-parser": { + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", + "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@borewit/text-codec": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz", + "integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@epic-web/invariant": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", + "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", + "license": "MIT" + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@fastify/ajv-compiler": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@fastify/ajv-compiler/-/ajv-compiler-4.0.6.tgz", + "integrity": "sha512-NtuzM0SfaMJbGlnjr9LWQUN5LzgSrbB8tf/wRZNas+4E1O/Nmzl53e7ruT61HDZyRCJGC6FxIogmNZO1c5ETBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "ajv": "^8.12.0", + "ajv-formats": "^3.0.1", + "fast-uri": "^4.0.0" + } + }, + "node_modules/@fastify/ajv-compiler/node_modules/fast-uri": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.1.tgz", + "integrity": "sha512-TmHQgewjHtMq1E5QKA0tOE0yeYGQs25KZC/ziJpubRtWI15W92e6vPFydWOeZBVROSHBYw/QhD9d5OefdD6LDg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/@fastify/cors": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@fastify/cors/-/cors-11.3.0.tgz", + "integrity": "sha512-ggQGua+xHv1MvePbPr0v//xLYEsCXbWspquXCJS9Ot5YoRXq8J8ZWzHnxDBVnbtXosvistXo6LtNzOJswf64Fw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "fastify-plugin": "^6.0.0", + "toad-cache": "^3.7.0" + } + }, + "node_modules/@fastify/error": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@fastify/error/-/error-4.2.0.tgz", + "integrity": "sha512-RSo3sVDXfHskiBZKBPRgnQTtIqpi/7zhJOEmAxCiBcM7d0uwdGdxLlsCaLzGs8v8NnxIRlfG0N51p5yFaOentQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/@fastify/fast-json-stringify-compiler": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@fastify/fast-json-stringify-compiler/-/fast-json-stringify-compiler-5.1.0.tgz", + "integrity": "sha512-PxcYtKLbQ8Z+yApiqjK8FwxIwvEj38k2OiLc17u8dkJSlmfi2wHHPaSnaoqBPQqtvF8YVsDgDpP2snDCfFrpfw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "fast-json-stringify": "^7.0.0" + } + }, + "node_modules/@fastify/formbody": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@fastify/formbody/-/formbody-9.0.0.tgz", + "integrity": "sha512-T/af26CSrUARBCvsEmv+DJLPfZlrRKESzqironxP1j7qzuLyKcoZtj6MuTGShuKx1THXugoie2oFbUJxXfGFzA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "fast-querystring": "^1.1.2", + "fastify-plugin": "^6.0.0" + } + }, + "node_modules/@fastify/forwarded": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@fastify/forwarded/-/forwarded-3.0.2.tgz", + "integrity": "sha512-NE8HgKLgYejV9lDpqkEFaDKMLYelJBVfHekhB0UKvX0ghagXRJqg68feg8er1NPXxG4N9i6vPxzt8E+3wHfcmA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/@fastify/merge-json-schemas": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@fastify/merge-json-schemas/-/merge-json-schemas-0.2.1.tgz", + "integrity": "sha512-OA3KGBCy6KtIvLf8DINC5880o5iBlDX4SxzLQS8HorJAbqluzLRn80UXU0bxZn7UOFhFgpRJDasfwn9nG4FG4A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/@fastify/middie": { + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/@fastify/middie/-/middie-9.3.4.tgz", + "integrity": "sha512-dd8phTnVWzx3iKPBKSvtRUT8+Igvy/MP+P5HcY2tjejEyeVbyjkD4HgzKessUObue5RRM5J6PZdxtAqgbn84yw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/error": "^4.0.0", + "fastify-plugin": "^6.0.0", + "find-my-way": "^9.5.0", + "path-to-regexp": "^8.1.0", + "reusify": "^1.0.4" + } + }, + "node_modules/@fastify/proxy-addr": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@fastify/proxy-addr/-/proxy-addr-5.1.1.tgz", + "integrity": "sha512-zv07Y9GEuDsJPegZoDFd4SDWaZOW8N2pa0GSrYmKpId/tjt1Hgo3BjZBVjdVpfVrHaA+Qv5jawtS2O50J5xM9g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/forwarded": "^3.0.0", + "ipaddr.js": "^2.1.0" + } + }, + "node_modules/@fastify/proxy-addr/node_modules/ipaddr.js": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.5.0.tgz", + "integrity": "sha512-aq+t5NAc+cS6rZQQVWC2x98CPqGtKKTMDd4Gaodv0wShnItdKg/51djkGJ1hqH+Oy0ivDftCbSLCQob8zso01w==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@inquirer/ansi": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@inquirer/ansi/-/ansi-2.0.8.tgz", + "integrity": "sha512-WpQM+Ti6Z40EFwwt+uL2p4UabT+W179zHp6HhLVOzfbwnVn05IPO/eXIZXGNqcT1jbQ15SujNLzQ39k4QPPxBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + } + }, + "node_modules/@inquirer/checkbox": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-5.2.5.tgz", + "integrity": "sha512-bRt8J8m+Fot9CXv+zNQGXUq2ET0MggR1fPz7v6edN6MFYmsbfGnMmkmWZJEegMKqrAC8ej/o1sqisHZXZJMAfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.8", + "@inquirer/core": "^12.0.3", + "@inquirer/figures": "^2.0.9", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/confirm": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-6.3.2.tgz", + "integrity": "sha512-Xvr/0HggjddPtGppuqVmxhTw+Hr8PvsZ/k0HmOEaAqQEt80OITNkFWnsdNmyT0/eM4Ab+iJLx2R8rctlEyfSVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/core": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-12.0.3.tgz", + "integrity": "sha512-wsSy0sznmXwkty+2PzZwx00Cazc/E0r0B7mAzdGROz2Ct+DFZXaK7WDjGZvgjRldxH5ZhFVfF2lgkYrqgOw2KA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.8", + "@inquirer/figures": "^2.0.9", + "@inquirer/type": "4.1.1", + "cli-width": "^4.1.0", + "fast-wrap-ansi": "^0.2.0", + "mute-stream": "^3.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/editor": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@inquirer/editor/-/editor-5.3.3.tgz", + "integrity": "sha512-YsKkS2q63IiLtaDK/9nqzdComN97SDQrmKiyNggN+ceP4ty+Z6VwyTz3FpjeUWeW1Efss2xHFKCC9sx7hnrsxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/external-editor": "^3.0.5", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/expand": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/@inquirer/expand/-/expand-5.1.5.tgz", + "integrity": "sha512-uHuXLmXW+TtIfT/9vSBotypAkqn1n34Ul+CLGPos/xANyO4Ff5xZzkYhbKR4NEcfVK4a9mHQOpwVZzluSHFRGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/external-editor": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-3.0.5.tgz", + "integrity": "sha512-f3QQJRIX5ZEneBHNUIuPjmbdzHnmRFJA8r2dkcb8q+OM5Uv5KtnuAttQumnrjcBVBM3mcTX1CkmtAkU58VRZxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.2" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/figures": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-2.0.9.tgz", + "integrity": "sha512-EAWgUTGQ/Umgga51dE3B2PUHbufuXarDfg86uVgoSgNHNNQnyFKcOrQLWVqYMghuSyHh8+2HUH0Js9cTC1WAdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + } + }, + "node_modules/@inquirer/input": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/@inquirer/input/-/input-5.1.6.tgz", + "integrity": "sha512-HtcJhB2QFVXbLuJ5S3syhNbTUVxYvwqV4VRBDkQceBloC9bmTViUoRFP5PbSaDZb3HzfPmpuU/gG4ybVBz4FHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/number": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@inquirer/number/-/number-4.2.3.tgz", + "integrity": "sha512-6Yuwh1NGSbu1Lo4N1EWjXs1jKRntLg/ZCwhmeorEHde90v1XxAozdbd4Iu30eOQLW+6h1hp2O9ujNfLSbTPJnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/password": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@inquirer/password/-/password-5.2.2.tgz", + "integrity": "sha512-W9zYdyzogK+6110mqwaSJWCBu2yA5Q/OfnGSjjZB1bNpHlmUozXxTl0+QOZBNeVd6Qo81/qT75gW05gLAtITxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.8", + "@inquirer/core": "^12.0.3", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/prompts": { + "version": "8.7.2", + "resolved": "https://registry.npmjs.org/@inquirer/prompts/-/prompts-8.7.2.tgz", + "integrity": "sha512-QoRB4wFIjgH5iOhSjoIKMkTvSHDuV+O3OITlIqAYO0oK5x364GJILXiMBvlPiE+klg7Xx9tq5XVqQHcGUDYYPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/checkbox": "^5.2.5", + "@inquirer/confirm": "^6.3.2", + "@inquirer/editor": "^5.3.3", + "@inquirer/expand": "^5.1.5", + "@inquirer/input": "^5.1.6", + "@inquirer/number": "^4.2.3", + "@inquirer/password": "^5.2.2", + "@inquirer/rawlist": "^5.3.5", + "@inquirer/search": "^4.3.3", + "@inquirer/select": "^5.2.5" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/rawlist": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/@inquirer/rawlist/-/rawlist-5.3.5.tgz", + "integrity": "sha512-1oHky1ONfCOwNrnkQGDE1oaSij/3fI6HFMSf2H/WsGO2lEyDX9My82iggITSy9ddSZ8yk8j9v41OI0fVoSIoaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/search": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@inquirer/search/-/search-4.3.3.tgz", + "integrity": "sha512-fyuIU1Nbpvwlikjg3gXwJFDI11+EFjqQ7P+iByfmivIKQ1vmaykNrD/vy5unHuUqUpsOsnvJ25//tPF7E/RBRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/core": "^12.0.3", + "@inquirer/figures": "^2.0.9", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/select": { + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@inquirer/select/-/select-5.2.5.tgz", + "integrity": "sha512-9kc15hr8r/kI+3DO/xLog5nOzTz1jqsHXa6JBFzmQKhkoJ8Slda1I1L/uD8ZSZ9tF1yp79wwXe7mclvX1rqR2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inquirer/ansi": "^2.0.8", + "@inquirer/core": "^12.0.3", + "@inquirer/figures": "^2.0.9", + "@inquirer/type": "4.1.1" + }, + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/type": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-4.1.1.tgz", + "integrity": "sha512-yJoHYrMnxIsJZCY+0Vb66Dy3he3kL3e2wOBKhoSwWWAzZAY82emlxwgprCtp6yRixvNRNq9ztfRWQYPNr3Go7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=23.5.0 || ^22.13.0 || ^20.17.0" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lukeed/csprng": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", + "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@nestjs/cli": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-12.0.3.tgz", + "integrity": "sha512-HofsPoiWsx6gZ7/IivaZJrgsq/3CTCb4FkCQzFu/Q3J2V+4xC7GYnit/HNB66EfuY8j3gWJCzasMKmF5VugmOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@angular-devkit/core": "22.1.8", + "@angular-devkit/schematics": "22.1.8", + "@angular-devkit/schematics-cli": "22.1.8", + "@inquirer/prompts": "8.7.2", + "@nestjs/schematics": "^12.0.0", + "ansis": "4.4.0", + "chokidar": "5.0.0", + "cli-table3": "0.6.5", + "commander": "15.0.0", + "minimatch": "10.2.6", + "node-emoji": "2.2.0", + "ora": "9.4.1", + "tsconfig-paths": "4.2.0", + "typescript": "~6.0.2" + }, + "bin": { + "nest": "bin/nest.js" + }, + "engines": { + "node": ">= 20.11" + }, + "peerDependencies": { + "@rspack/core": "^1.7.7 || ^2.1.10", + "@swc/cli": "^0.8.0", + "@swc/core": "^1.15.18", + "fork-ts-checker-webpack-plugin": "^9.1.0", + "ts-loader": "^9.5.4", + "tsconfig-paths-webpack-plugin": "^4.2.0", + "webpack": "^5.105.4", + "webpack-node-externals": "^3.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "@swc/cli": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "fork-ts-checker-webpack-plugin": { + "optional": true + }, + "ts-loader": { + "optional": true + }, + "tsconfig-paths-webpack-plugin": { + "optional": true + }, + "webpack": { + "optional": true + }, + "webpack-node-externals": { + "optional": true + } + } + }, + "node_modules/@nestjs/common": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-12.0.3.tgz", + "integrity": "sha512-Fosz6lHc9OagZNcF0LTrVHyJS8W7mtuNFBOo9RRccGwyeICBd0hiutjAi9zxnzBcP45RkYXeNB+idA/52jZhBQ==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "1.1.0", + "file-type": "22.1.0", + "iterare": "1.2.1", + "load-esm": "1.0.3", + "tslib": "2.8.1", + "uid": "2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "class-transformer": ">=0.4.1", + "class-validator": ">=0.13.2", + "reflect-metadata": "^0.1.12 || ^0.2.0", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "class-transformer": { + "optional": true + }, + "class-validator": { + "optional": true + } + } + }, + "node_modules/@nestjs/config": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@nestjs/config/-/config-12.0.0.tgz", + "integrity": "sha512-pG5+fFfCo3cdgVkLJLvvhUGfxEjwzv9hIAQ1aJVHvHlHVniDWfwX5pR/utgoAkJzSikv2oTR1BmIF03FXdi42Q==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "1.1.0", + "dotenv": "17.4.2", + "dotenv-expand": "13.0.0", + "es-toolkit": "1.51.0" + }, + "peerDependencies": { + "@nestjs/common": "^11.0.0 || ^12.0.0", + "rxjs": "^7.1.0" + } + }, + "node_modules/@nestjs/config/node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/@nestjs/core": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-12.0.3.tgz", + "integrity": "sha512-Ouv++gAXOL50S8K8n6AN19QGmw51rnIo6v7y9AqUYoaf0NcZlufTu5XTDeC2RtpMz8oXRr9nykBngRjflcoQKA==", + "license": "MIT", + "dependencies": { + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "8.4.2", + "tslib": "2.8.1", + "uid": "2.0.2" + }, + "engines": { + "node": ">= 20" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^12.0.0", + "@nestjs/microservices": "^12.0.0", + "@nestjs/platform-express": "^12.0.0", + "@nestjs/websockets": "^12.0.0", + "reflect-metadata": "^0.1.12 || ^0.2.0", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "@nestjs/microservices": { + "optional": true + }, + "@nestjs/platform-express": { + "optional": true + }, + "@nestjs/websockets": { + "optional": true + } + } + }, + "node_modules/@nestjs/mau": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/@nestjs/mau/-/mau-0.2.8.tgz", + "integrity": "sha512-nIb0i3c/KhKEbxZfYMEKv9Mcvk5miBdZcexnvkgnAUhoMO2BUjOGT+Khf2cZzu7B51Y7v01NG2JVl/HdQEUQ6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "4.1.2", + "cli-progress": "3.12.0", + "commander": "4.1.1", + "inquirer": "8.2.6", + "node-emoji": "2.1.3", + "ora": "5.4.1", + "undici": "6.20.1" + }, + "bin": { + "mau": "bin/mau.js" + }, + "engines": { + "node": ">= 20.0.0" + } + }, + "node_modules/@nestjs/mau/node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@nestjs/mau/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@nestjs/mau/node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@nestjs/mau/node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@nestjs/mau/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@nestjs/mau/node_modules/node-emoji": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.3.tgz", + "integrity": "sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^4.6.0", + "char-regex": "^1.0.2", + "emojilib": "^2.4.0", + "skin-tone": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@nestjs/mau/node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@nestjs/platform-express": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-12.0.3.tgz", + "integrity": "sha512-q9ImjCMjbYYgqvRHHro6sAypNwhjspIAHad0RTL2ww5wYd9gwUGWMss7Q+ACCw5Sksu7Q8S/3rjSLhB+W6B6bg==", + "license": "MIT", + "dependencies": { + "cors": "2.8.6", + "express": "5.2.1", + "multer": "2.4.0", + "path-to-regexp": "8.4.2", + "tslib": "2.8.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^12.0.0", + "@nestjs/core": "^12.0.0" + } + }, + "node_modules/@nestjs/platform-fastify": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/platform-fastify/-/platform-fastify-12.0.3.tgz", + "integrity": "sha512-Cn8jR8jwPJBk7ftkzunplz0LHDahnq7urAO9VjOV0OWkk1YCwaFMm4CElSk3BwBiDwP177anJjJUbVxTlASk4A==", + "license": "MIT", + "dependencies": { + "@fastify/cors": "11.3.0", + "@fastify/formbody": "9.0.0", + "@fastify/middie": "9.3.4", + "fast-querystring": "1.1.2", + "fastify": "5.12.4", + "find-my-way": "9.9.0", + "light-my-request": "6.6.0", + "path-to-regexp": "8.4.2", + "tslib": "2.8.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@fastify/static": "^10.1.2", + "@fastify/view": "^10.0.0 || ^11.0.0 || ^12.0.0", + "@nestjs/common": "^12.0.0", + "@nestjs/core": "^12.0.0" + }, + "peerDependenciesMeta": { + "@fastify/static": { + "optional": true + }, + "@fastify/view": { + "optional": true + } + } + }, + "node_modules/@nestjs/platform-fastify/node_modules/fastify": { + "version": "5.12.4", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.12.4.tgz", + "integrity": "sha512-zATD676fP6tBMsn+jQ7Q5/cO/Qo+149TXH0dUqUKel+1/hcZxwIbnflqtPa9EjlrvpY8eCZcL3M1UYrMc31Y7g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/ajv-compiler": "^4.0.5", + "@fastify/error": "^4.0.0", + "@fastify/fast-json-stringify-compiler": "^5.0.0", + "@fastify/proxy-addr": "^5.0.0", + "abstract-logging": "^2.0.1", + "avvio": "^9.0.0", + "fast-json-stringify": "^7.0.0", + "find-my-way": "^9.6.0", + "light-my-request": "^6.0.0", + "pino": "^9.14.0 || ^10.1.0", + "process-warning": "^5.1.0", + "rfdc": "^1.3.1", + "secure-json-parse": "^4.0.0", + "semver": "^7.6.0", + "toad-cache": "^3.7.0" + } + }, + "node_modules/@nestjs/schematics": { + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-12.0.0.tgz", + "integrity": "sha512-ilsxam7i+SWd2psr12faLVSk86FYKnxRUGO6jAGNi1P9+O0kRaYVOScyrKeIj97W9T9UJoJF38fg+7KgjY/nOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@angular-devkit/core": "22.1.5", + "@angular-devkit/schematics": "22.1.5", + "comment-json": "5.0.0", + "jsonc-parser": "3.3.1", + "pluralize": "8.0.0" + }, + "engines": { + "node": ">=22.12.0" + }, + "peerDependencies": { + "prettier": "^3.0.0", + "typescript": ">=6.0.0" + }, + "peerDependenciesMeta": { + "prettier": { + "optional": true + } + } + }, + "node_modules/@nestjs/schematics/node_modules/@angular-devkit/core": { + "version": "22.1.5", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-22.1.5.tgz", + "integrity": "sha512-HiY6d5dkIdJs5grP9OHvgkf14QOcDIo+hbuT7YKuLItQ++ZxCwUabJMLCCJ5R0KrstE5NqED0dNcyk5WD01t5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "8.20.0", + "ajv-formats": "3.0.1", + "jsonc-parser": "3.3.1", + "picomatch": "4.0.5", + "rxjs": "7.8.2", + "source-map": "0.7.6" + }, + "engines": { + "node": "^22.22.3 || ^24.15.0 || >=26.0.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "peerDependencies": { + "chokidar": "^5.0.0" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/@nestjs/schematics/node_modules/@angular-devkit/schematics": { + "version": "22.1.5", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-22.1.5.tgz", + "integrity": "sha512-HTmo9y8wjXKtJGVTYomTjZsjWzhirpu1pPRAzsVob3eiYOuxv1qDRAgWiHXNGp5CpnbHunZweXY/WffNGOFRyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@angular-devkit/core": "22.1.5", + "jsonc-parser": "3.3.1", + "magic-string": "1.0.0", + "ora": "9.4.1", + "rxjs": "7.8.2" + }, + "engines": { + "node": "^22.22.3 || ^24.15.0 || >=26.0.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, + "node_modules/@nestjs/testing": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-12.0.3.tgz", + "integrity": "sha512-TYDvBI8HvYeldNCmsuSaE4XqSs1Mg7IekSPlJf+zbrVt3+s5sqt4ySMUhbTs8JpMTFMyqCwtPTGVHIcFVuTBbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "2.8.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^12.0.0", + "@nestjs/core": "^12.0.0", + "@nestjs/microservices": "^12.0.0", + "@nestjs/platform-express": "^12.0.0" + }, + "peerDependenciesMeta": { + "@nestjs/microservices": { + "optional": true + }, + "@nestjs/platform-express": { + "optional": true + } + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@ogma/common": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ogma/common/-/common-1.2.0.tgz", + "integrity": "sha512-y2GHkT4t3B9CoI7ELfgZXeMHiiOC/X4XvdeqYLbP5A3keop7fANzjd5pQdtyYQvdQ0lPzcHJiMvOGkIINZHZHQ==", + "dev": true + }, + "node_modules/@ogma/styler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@ogma/styler/-/styler-1.1.0.tgz", + "integrity": "sha512-OtwJ8Ump3sKEAv2DIUi+R2G2Y5v3cEzqRO/sH11MTWikAhac31GZR/xzU+3BoPRT0u8oIob7N5dtOKTdPhqq3w==", + "dev": true, + "dependencies": { + "@ogma/common": "^1.1.1" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.150.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.150.0.tgz", + "integrity": "sha512-rDS5/31E9HfPl/CIzGrn0DOlvBbXFseQ5URJ9sYMfstbKLD/c6Gm9vmRzRGDdAXyOIL4zmO37lc9RIwYqVruZw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.83.0.tgz", + "integrity": "sha512-0yGY24EwsLk5YDe6F+VkmZyRHSwJDALa3nIrPpq7FXmp2lV2d0TzvBCGeZk+wgiULRGr5blhyr4QMp5KCXJUqA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm64": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.83.0.tgz", + "integrity": "sha512-hHfJ0vc17A4iUjH5p9BsTUPYbYRNxGpvD2lbu1aBRk54bzNIx9o5TtYF39QPZcV95DagZd+4DEAw2RH3G2ZsMg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.83.0.tgz", + "integrity": "sha512-hsOjYjszLb/3zym/TkzUMPAoQlTJcuzSyEPOAyA+skXJIX9M0o+4JfOtqopX/Vf4hSLrJ98j0nvFo23gzk8auQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-x64": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.83.0.tgz", + "integrity": "sha512-mjh5oH2EA+wl5yRJYT9K9G61O2zFlpuv+yf2JwZOi0+dq2FnTUtm1h8i+5Ik0fXPWIu/k84I1psZR9aQsLAnyA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.83.0.tgz", + "integrity": "sha512-fNHr64/YaO8YssuoDVC8+F4Uk5enR86q5uxfHkQrjAPs1dbAILOrD2uaud+J7MO8Fx774g44ERLD0IGIvZE48w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.83.0.tgz", + "integrity": "sha512-Qpwy3zzAwMj+8/lyYItHmkSMwbkprFNWTK7jPYDOxSyxEhaSLOWYUTCMkjF334J8/WD0nznCCsoBbIH6hpsuIw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.83.0.tgz", + "integrity": "sha512-s+BirYLFq7JL2k9sP0XI3ZXJ9dYvJ8sX3jLCLoag7tt+zrSHpZxP0jqznfL+Gdgwu7ay0dYgGYJXrQvq3iWloA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.83.0.tgz", + "integrity": "sha512-7lihXt3vKr+GIyapNbHrnFHm/biiW30le6Zv/DExbAFPF6YwCQXVFlONPFehxs0CpGO4CBfYPM9rdDT+XMoIlg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.83.0.tgz", + "integrity": "sha512-q63JalLYVkZiZvls1z3PPUnpmQluOMXp0khqQMznCeAPLGydfNY8JhvuA4WlK57JfrvikU8wB5lPVveqpIXvew==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.83.0.tgz", + "integrity": "sha512-krQmDF+dRbxvdqVPV88ZuOoPPu8X5BuqDA8Hd+qcS4YMRQCb+nexA57DazgGsc/rGdKBe3QmV0mnv0bdpW/p5g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.83.0.tgz", + "integrity": "sha512-MmOl8Y6txEAXZU1RG8Rr264jQ6D7VPmqFsU/45x/FeWsGe32hklTqGrLE6UxHzp5Rjt0wP+20tY8YXKgSFB3mw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-musl": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.83.0.tgz", + "integrity": "sha512-u1rMymh0W3JZkq370kzQsYPULGWqhE09pZRqnZvUSoYaI9pVO5yVX+iYIslmWuEgwuzH9YAaOsScJiobWCHoOw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-s390x-gnu": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.83.0.tgz", + "integrity": "sha512-y0zK3HNwGysu7rqtE+BQG/d0bx5gh/KwlOtghN8oWeK1KcWzeaLqtZrbm8owqdma1lFyrce/hTO5ismuNu+INQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-gnu": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.83.0.tgz", + "integrity": "sha512-rS5gM0NgD7ngmuJmbIehsidtrOwKkLFwCQbKEeb9KuyQrrWNq5Zkn0uV6AYdXOMJ0grrWEiLwBuvMxt8w5vsNw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.83.0.tgz", + "integrity": "sha512-W2IH4EtpcPaWcvNGCA95YoDg4vxqE/ZiPCi3arrxEEpsK7+JQN9WYwrlYFx9pcdP6KPXqRqkv3zdQPHcx7b6YQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.83.0.tgz", + "integrity": "sha512-6LyKkUyoajssTPLlZmDbZIbu4IZ5B4bGuRUnBgCGpEvHP3FQMaYITncHA/unPUo7q+Z+pIu2HhdkQ+8d1SG7iA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.83.0.tgz", + "integrity": "sha512-Uz/fObEtF0jmNJQJ8CGRBKfefYstS0/wjD3s6IGzP8nUwsJykHQJBiN3npHwKiGRGn/vvBEgNr4B3cCzmmatvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.83.0.tgz", + "integrity": "sha512-u7XcvPW6Bk58tY5iWs2ESb0vJjoE/kuSpHxopbwp/p3ZtWVQXZ6wor5w3ssVTHOqd/v8b+QdhSFWQ4grEUNWpA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.83.0.tgz", + "integrity": "sha512-LZRubd7ph13QmAg4fFecTYVZkiYbROR2Htaxh/ufWRkDhPOm2wrwaEYR89e0YpPFD3dqBrPoxS7myBw5hmYA7Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@paralleldrive/cuid2": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.3.1.tgz", + "integrity": "sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "^1.1.5" + } + }, + "node_modules/@phc/format": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@phc/format/-/format-1.0.0.tgz", + "integrity": "sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/@pinojs/redact": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", + "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==", + "license": "MIT" + }, + "node_modules/@redis/bloom": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-6.3.0.tgz", + "integrity": "sha512-NQ5poYpZr0jv6zazN1cy6JY5kIipKFZ3R9GTL4kOUTX3a9YAfY29U8bsE4lWhVQEM+G4V0BXVC57mubIdDijeA==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.3.0" + } + }, + "node_modules/@redis/client": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@redis/client/-/client-6.3.0.tgz", + "integrity": "sha512-fHrjwGCBvAANGi+TuRuwKi83sIOzgHr8eh+Uf48w3fSX7Hhrz174NrWqfJhAC2vnN0d/tfaZpdr6+o6JC3QHwg==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@node-rs/xxhash": "^1.1.0", + "@opentelemetry/api": ">=1 <2" + }, + "peerDependenciesMeta": { + "@node-rs/xxhash": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + } + } + }, + "node_modules/@redis/json": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@redis/json/-/json-6.3.0.tgz", + "integrity": "sha512-yt6vRfPBXtW/3qm53cF81TSQpLMjWdW4/2E9WQ2GgbvsKkuCKCFQIcMiKlil1ZMnezK+IQuS795xKU5psbaegw==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.3.0" + } + }, + "node_modules/@redis/search": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@redis/search/-/search-6.3.0.tgz", + "integrity": "sha512-RPXAZmKjZZG7Tm7m1w9keFdXzbL91PiSHQBfQRe9xwW40jNsTRbG0FwhIz4QlHPU4gKDAsCy8IQHj4yZl4H9rw==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.3.0" + } + }, + "node_modules/@redis/time-series": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-6.3.0.tgz", + "integrity": "sha512-+fJOB8mN1z5WRakCJNh5lVdz1KqvHGSOistsKeitD24QsCtPwyRQXWC0iq6T/i/ubLE/YcguZqPm8F598MKk4A==", + "license": "MIT", + "engines": { + "node": ">= 20.0.0" + }, + "peerDependencies": { + "@redis/client": "^6.3.0" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.9.tgz", + "integrity": "sha512-tNISae1QEf/vkb3xkRcjV5SEdzPE97We5IVaa2Z8jSszQPZ8U60B/YCYpw4QI7VidYsBtKavczXf+DyDs9WGxw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.9.tgz", + "integrity": "sha512-YC8YsI30o606GTZi0VyzYlsDKFP8W61i/QzayHDkLbNEz/IShqAmTa+hsJRj13xTHA0H+6fk4b2UmGn+Q/cMlg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.9.tgz", + "integrity": "sha512-IwhlH3qK5urrY8hZiEgGkHKEFN901p/p2bjxCxJlr4GyNnF7wYpUvK+Y43uaRYuC4hpfjzbR3SJC3arX1jGvmw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.9.tgz", + "integrity": "sha512-XxpJfVzFh+jilRxIXUqcfYAYcunIc/XEzIizsOL1fcJee5Sf7H3mH8WlLmfHfluz5amqR88QQo9izKtmMlavAw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.9.tgz", + "integrity": "sha512-kSfvhmgeWyfkbT3p/1s5vSgboogoah2zkm9fX2zjg2hHxSV7T4KhMWRUUaRk4OXNqoD3QAUeRqLcs1aZOK4U1g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.9.tgz", + "integrity": "sha512-1RVzG17pxqbTfYLC352JlLt6kKLG+6Hr30n8DlIJqsnV5luUDd2Qdx9Ayw1Cabfyb1K9k0jXEZ7evxkRoT+uiw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.9.tgz", + "integrity": "sha512-BXqPvZ2drqVD+/Z8UpKwcs4Mp7grM+eGFku4CAEKrEtcbAsUpzREphK1sogCRZGreVPiMkiiBtw0n3TPteuqvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.9.tgz", + "integrity": "sha512-11vWvo8YDwLzukt27J3aYDWU+gg2P7J+ZOmiJ0hkF5BXZDW7pVya7r40MXDy6ya0i9KamoENSVKIugvJNgFXIA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.9.tgz", + "integrity": "sha512-a1tijMkdwsIARtc0F39ApURROkf3NwqinI6TOiSSWCTR7dT96dffNvMUtDHnq64wKNTIZOIlzKrFvvFUznJiyw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.9.tgz", + "integrity": "sha512-x6SQNdAvv4c3hWqTMaWuawzMX9myaCs/yEmlGsxJzkdClnHW7FbrjQuSiRDhuSYzEYoEMhsaJy9qHG/XNemJPQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.9.tgz", + "integrity": "sha512-9s0AZ8BFK5/n7B/TBoa2yJE3gI3KURrbXcPBlsAsvjU4VeJKgE90y1YtNxyEUIcHPQkg6/yfF3qihUrcM/Kf0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.9.tgz", + "integrity": "sha512-P7VWAmV+WdJluH7ovnRGoiv2i8To7GAZ+kGzfGup635cyL7SyYl3lSUaA3Gp5THf0n/Co5EyEqb2zbqq+nMOHQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.9.tgz", + "integrity": "sha512-1qixtsE4BK8h+yS3BfmZ09UhA7O/N4IACva6YBr7EBvCJraByTuRcgOTaiA62Tm0vey3UcKXLOaoGHtYmNGEVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.9.tgz", + "integrity": "sha512-ok8IQjcEPs1AKZfuEUznVBrJw+gK4soq+bx8b1X2XoMqVClarc1q5JDmVtWXY1xfr6ZuHTAsPXHTgTrqKTZeww==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.9.tgz", + "integrity": "sha512-Ip2mXoU0hM0boq3Rf+ekuT653OROSo6aSYcPT1VHE4q52KvyxgFkQgrgb/IEsxOuvQ2fZZbs8khJAyCEPM24/g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@tokenizer/inflate": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz", + "integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "token-types": "^6.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==", + "license": "MIT" + }, + "node_modules/@types/body-parser": { + "version": "1.19.6", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz", + "integrity": "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/cookiejar": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@types/cookiejar/-/cookiejar-2.1.5.tgz", + "integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/express": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.6.tgz", + "integrity": "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^5.0.0", + "@types/serve-static": "^2" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.1.3.tgz", + "integrity": "sha512-dPfW8NFiOF4wOHc7+N/QSxlY9cfSsenewGbAz8C8U/MULPd/YZ27LvJUIlzaXie7e6Ove9YunJGgC9tbHD2cKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.5.tgz", + "integrity": "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/methods": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@types/methods/-/methods-1.1.4.tgz", + "integrity": "sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.13.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.5.tgz", + "integrity": "sha512-TXyindR+lBr22aJIdMQzCFHPHR6cR4js838mRDCSz5hOKWZvZwsXSSiXDmjRj4iJmgl+sR9O+1mkoVBSMadNug==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.18.0" + } + }, + "node_modules/@types/pg": { + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.23.1.tgz", + "integrity": "sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "pg-protocol": "*", + "pg-types": "^2.2.0" + } + }, + "node_modules/@types/qs": { + "version": "6.15.1", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.1.tgz", + "integrity": "sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-1.2.1.tgz", + "integrity": "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*" + } + }, + "node_modules/@types/superagent": { + "version": "8.1.11", + "resolved": "https://registry.npmjs.org/@types/superagent/-/superagent-8.1.11.tgz", + "integrity": "sha512-KA7srSW/HENDtOw9DOqaFLgWuMqN9WgjEw62lh9dpvRaZDkhdOkazASd7X7i2eMUYLHa1U37ZttnePsH5zTDHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/cookiejar": "^2.1.5", + "@types/methods": "^1.1.4", + "@types/node": "*", + "form-data": "^4.0.0" + } + }, + "node_modules/@types/supertest": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@types/supertest/-/supertest-7.2.1.tgz", + "integrity": "sha512-4CbBvoYVLHL7+yhbYrZET0vsvuyXTC05aRe7dNQkwMzm56auceoy6Yu3K50uZmwfHna1os3CMSgM/3QVkUtPTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/methods": "^1.1.4", + "@types/superagent": "^8.1.0" + } + }, + "node_modules/@types/validator": { + "version": "13.15.10", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.15.10.tgz", + "integrity": "sha512-T8L6i7wCuyoK8A/ZeLYt1+q0ty3Zb9+qbSSvrIVitzT3YjZqkTZ40IbRsPanlB4h1QB3JVL1SYCdR6ngtFYcuA==", + "license": "MIT" + }, + "node_modules/@vitest/coverage-v8": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.1.11.tgz", + "integrity": "sha512-8MVGEFnJIcdGjcbfKmeq8z0pZHH0JlVtoVZH9Q/qwUp6wyFnEJUBMrw9DCaj+ra3vShGmhavjalMIhPNxZAUcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^1.0.2", + "@vitest/utils": "4.1.11", + "ast-v8-to-istanbul": "^1.0.0", + "istanbul-lib-coverage": "^3.2.2", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.2.0", + "magicast": "^0.5.2", + "obug": "^2.1.1", + "std-env": "^4.0.0-rc.1", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@vitest/browser": "4.1.11", + "vitest": "4.1.11" + }, + "peerDependenciesMeta": { + "@vitest/browser": { + "optional": true + } + } + }, + "node_modules/@vitest/expect": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz", + "integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.1.0", + "@types/chai": "^5.2.2", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", + "chai": "^6.2.2", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz", + "integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "4.1.11", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.21" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz", + "integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz", + "integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "4.1.11", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz", + "integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.11", + "@vitest/utils": "4.1.11", + "magic-string": "^0.30.21", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/@vitest/spy": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz", + "integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz", + "integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "4.1.11", + "convert-source-map": "^2.0.0", + "tinyrainbow": "^3.1.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/abstract-logging": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", + "integrity": "sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==", + "license": "MIT" + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ansis": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-4.4.0.tgz", + "integrity": "sha512-9k3v7xcHwgdO/DruxGIg4HtjvlAZlcnsX/mzqUb1t3NkYnl9kK2UJ+Gq0io+vQf7iT//BD/HB/NBkUR1LWxoeA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/argon2": { + "version": "0.45.1", + "resolved": "https://registry.npmjs.org/argon2/-/argon2-0.45.1.tgz", + "integrity": "sha512-skm+/WCjkGqCQxF7FG1LuZXM5yvbFjgbfiCGsud2oLgaDhh6b6dbH0b1EkghbM+xx4Bj8Ape+KKgixoIlWZicQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@phc/format": "^1.0.0", + "cross-env": "^10.1.0", + "node-addon-api": "^8.9.0", + "node-gyp-build": "^4.8.4" + }, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/array-timsort": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz", + "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true, + "license": "MIT" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/ast-v8-to-istanbul": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/ast-v8-to-istanbul/-/ast-v8-to-istanbul-1.0.6.tgz", + "integrity": "sha512-fvpl29helSO2w/z7utIbrkNXILdrLwDwAMH2I/zPKlGf5244+gf+B4cyS1sANcrPY2h+hWCGSgC8N61s/+AF9A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.31", + "estree-walker": "^3.0.3", + "js-tokens": "^10.0.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/avvio": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/avvio/-/avvio-9.3.0.tgz", + "integrity": "sha512-g2tQ7LE7oOSqDfwEm3M+ZCMTJc7KiZCdJ4UwyZJb5ckTKyYu50OYmvv0mCFXPuYXoM4zkSt8zM9XQ9KCvxA74A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/error": "^4.0.0", + "fastq": "^1.17.1" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/body-parser": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.3.0.tgz", + "integrity": "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^2.0.0", + "debug": "^4.4.3", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.2", + "on-finished": "^2.4.1", + "qs": "^6.15.2", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/body-parser/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chai": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", + "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/chardet": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.2.0.tgz", + "integrity": "sha512-rddelWYNPRrXq6PtNEN2S3f6t9ILzvqaN5pVgi4kqt9jHQaXIial9PznB5iSPVlQSLNaaH22ItWz3EJtQ10+OA==", + "dev": true, + "license": "MIT" + }, + "node_modules/chokidar": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", + "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^5.0.0" + }, + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/class-transformer": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz", + "integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==", + "license": "MIT" + }, + "node_modules/class-validator": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.15.1.tgz", + "integrity": "sha512-LqoS80HBBSCVhz/3KloUly0ovokxpdOLR++Al3J3+dHXWt9sTKlKd4eYtoxhxyUjoe5+UcIM+5k9MIxyBWnRTw==", + "license": "MIT", + "dependencies": { + "@types/validator": "^13.15.3", + "libphonenumber-js": "^1.11.1", + "validator": "^13.15.22" + } + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-progress": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", + "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cli-spinners": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-3.4.0.tgz", + "integrity": "sha512-bXfOC4QcT1tKXGorxL3wbJm6XJPDqEnij2gQ2m7ESQuE+/z9YFIWnl/5RpTiKWbMq3EVKR4fRLJGn6DVfu0mpw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-table3": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 12" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-15.0.0.tgz", + "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.12.0" + } + }, + "node_modules/comment-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-5.0.0.tgz", + "integrity": "sha512-uiqLcOiVDJtBP8WGkZHEP+FZIhTzP1dxvn59EfoYUi9gqupjrBWVQkO2atDrbnKPwLeotFYDsuNb26uBMqB+hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-timsort": "^1.0.3", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/component-emitter": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", + "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/content-disposition": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz", + "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cookiejar": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==", + "dev": true, + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-env": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz", + "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==", + "license": "MIT", + "dependencies": { + "@epic-web/invariant": "^1.0.0", + "cross-spawn": "^7.0.6" + }, + "bin": { + "cross-env": "dist/bin/cross-env.js", + "cross-env-shell": "dist/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/date-fns": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.4.0.tgz", + "integrity": "sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dev": true, + "license": "ISC", + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "node_modules/dotenv": { + "version": "18.0.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-18.0.5.tgz", + "integrity": "sha512-aBrGvt6KhjxbEnatqMWOMidftwsrCiCvqh1yNIGB9QyF0J+VcWkKDMsvYOEm7ZS82oiV+BT1sTOtIlAmUlTpwQ==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "dotenv": "dist/index.cjs" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-expand": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-13.0.0.tgz", + "integrity": "sha512-aBfBS8eYIeXmpHI9ThIlA7/WLq+SLt18iXUZhb52rW89QLKQFoIpPG1bPeewoPZsTyjSSO3T7234FBVUM1V2rA==", + "license": "BSD-2-Clause", + "dependencies": { + "dotenv": "^17.4.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-expand/node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "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==", + "dev": true, + "license": "MIT" + }, + "node_modules/emojilib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz", + "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-toolkit": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.51.0.tgz", + "integrity": "sha512-zC2lQGkM7QX+Gm6iM3+WIdZJzthsEd14LvRNJneSO2hzyz/zNBENR8+YXWo1cKxgPBtV6ksPYHELbcwBRzmdCw==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks", + "tests/types", + "tests/browser-compat" + ] + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/external-editor/node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true, + "license": "MIT" + }, + "node_modules/external-editor/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-decode-uri-component": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz", + "integrity": "sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-json-stringify": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-7.0.1.tgz", + "integrity": "sha512-eRSayARSbbwlBjpP4vnTTIRD5QPcIrmihPxDeN1DtKnHPg66UuJLx+8hlK1kaFdjvzyQ/dzALoi4vwAQ+T+iZA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/merge-json-schemas": "^0.2.0", + "ajv": "^8.12.0", + "ajv-formats": "^3.0.1", + "fast-uri": "^4.0.0", + "json-schema-ref-resolver": "^3.0.0", + "rfdc": "^1.2.0" + } + }, + "node_modules/fast-json-stringify/node_modules/fast-uri": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.1.tgz", + "integrity": "sha512-TmHQgewjHtMq1E5QKA0tOE0yeYGQs25KZC/ziJpubRtWI15W92e6vPFydWOeZBVROSHBYw/QhD9d5OefdD6LDg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fast-querystring": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fast-querystring/-/fast-querystring-1.1.2.tgz", + "integrity": "sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==", + "license": "MIT", + "dependencies": { + "fast-decode-uri-component": "^1.0.1" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "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==", + "dev": true, + "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==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-string-truncated-width": "^3.0.2" + } + }, + "node_modules/fast-uri": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", + "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "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==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-string-width": "^3.0.2" + } + }, + "node_modules/fastify": { + "version": "5.12.5", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.12.5.tgz", + "integrity": "sha512-OB2k1dlxs5/NAABqeKV2FUHkSD2BbENsCak8yULVcymn3fHIPDVa9TI3SDnJSWYSllZmSYuZXy2gTnsT+Sut1A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "@fastify/ajv-compiler": "^4.0.5", + "@fastify/error": "^4.0.0", + "@fastify/fast-json-stringify-compiler": "^5.0.0", + "@fastify/proxy-addr": "^5.0.0", + "abstract-logging": "^2.0.1", + "avvio": "^9.0.0", + "fast-json-stringify": "^7.0.0", + "find-my-way": "^9.6.0", + "light-my-request": "^6.0.0", + "pino": "^9.14.0 || ^10.1.0", + "process-warning": "^5.1.0", + "rfdc": "^1.3.1", + "secure-json-parse": "^4.0.0", + "semver": "^7.6.0", + "toad-cache": "^3.7.0" + } + }, + "node_modules/fastify-plugin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-6.0.0.tgz", + "integrity": "sha512-fZOty7z3O7vOliF6d8bHE3wiEh1KcNnKEQensSgTk9C1DvN6nRLS++XVd86v33Hw/8u9Un8A1zDrQ8ujcQDHEg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", + "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/file-type": { + "version": "22.1.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-22.1.0.tgz", + "integrity": "sha512-fbvf9u6jnHWr1EP6V8R99E9iLMhNLXgZkUzWBiPpJ5/89UJ/Atuxjn5YXR+XaZWo2hc2/8mGfTez+NDAgOcpLA==", + "license": "MIT", + "dependencies": { + "@tokenizer/inflate": "^0.4.1", + "strtok3": "^10.3.5", + "token-types": "^6.1.2", + "uint8array-extras": "^1.5.0" + }, + "engines": { + "node": ">=22" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/find-my-way": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-9.9.0.tgz", + "integrity": "sha512-sJsgZ1sQH2UDuowPuMKg8az7Qc8F0jnj+SKkFWU/+T0xcFlgV5skgXOGUqmQzOdmW6ALA7AhJINWx3qFBkbLHA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-querystring": "^1.0.0", + "safe-regex2": "^5.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/form-data": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz", + "integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.4", + "mime-types": "^2.1.35" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/form-data/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/formidable": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.4.tgz", + "integrity": "sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@paralleldrive/cuid2": "^2.2.2", + "dezalgo": "^1.0.4", + "once": "^1.4.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "funding": { + "url": "https://ko-fi.com/tunnckoCore/commissions" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-east-asian-width": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.7.0.tgz", + "integrity": "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true, + "license": "MIT" + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/inquirer": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz", + "integrity": "sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.1", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.21", + "mute-stream": "0.0.8", + "ora": "^5.4.1", + "run-async": "^2.4.0", + "rxjs": "^7.5.5", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6", + "wrap-ansi": "^6.0.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/inquirer/node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 10" + } + }, + "node_modules/inquirer/node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inquirer/node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true, + "license": "ISC" + }, + "node_modules/inquirer/node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "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==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/is-unicode-supported": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz", + "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iterare": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", + "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", + "license": "ISC", + "engines": { + "node": ">=6" + } + }, + "node_modules/js-tokens": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-10.0.0.tgz", + "integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-ref-resolver": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-schema-ref-resolver/-/json-schema-ref-resolver-3.0.0.tgz", + "integrity": "sha512-hOrZIVL5jyYFjzk7+y7n5JDzGlU8rfWDuYyHwGa2WA8/pcmMHezp2xsVwxrebD/Q9t8Nc5DboieySDpCp4WG4A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "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==", + "dev": true, + "license": "MIT" + }, + "node_modules/libphonenumber-js": { + "version": "1.13.13", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.13.13.tgz", + "integrity": "sha512-hV6SmWnyQ8U1QXhhqbqYBHIStNnscG7A5XbGodgdHhf/8N5PwhYpJA5U/yHDjYwPYTd8uNGXqq416XctuvK2PA==", + "license": "MIT" + }, + "node_modules/light-my-request": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-6.6.0.tgz", + "integrity": "sha512-CHYbu8RtboSIoVsHZ6Ye4cj4Aw/yg2oAFimlF7mNvfDV192LR7nDiKtSIfCuLT7KokPSTn/9kfVLm5OGN0A28A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause", + "dependencies": { + "cookie": "^1.0.1", + "process-warning": "^4.0.0", + "set-cookie-parser": "^2.6.0" + } + }, + "node_modules/light-my-request/node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/light-my-request/node_modules/process-warning": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-4.0.1.tgz", + "integrity": "sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/load-esm": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/load-esm/-/load-esm-1.0.3.tgz", + "integrity": "sha512-v5xlu8eHD1+6r8EHTg6hfmO97LN8ugKtiXcy5e6oN72iD2r6u0RPfLl6fxM+7Wnh2ZRq15o0russMst44WauPA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + { + "type": "buymeacoffee", + "url": "https://buymeacoffee.com/borewit" + } + ], + "license": "MIT", + "engines": { + "node": ">=13.2.0" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-7.0.1.tgz", + "integrity": "sha512-ja1E3yCr9i/0hmBVaM0bfwDjnGy8I/s6PP4DFp+yP+a+mrHO4Rm7DtmnqROTUkHIkqffC84YY7AeqX6oFk0WFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-unicode-supported": "^2.0.0", + "yoctocolors": "^2.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/magic-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.0.0.tgz", + "integrity": "sha512-CGvjzMN08iv6w1mm4/x3Gh1hLb4VnyRUA15FFpl6CsCIGGoe36k7kY5KNz9QDbSBN5I/fWHM6ZlIkUTa5xdUEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/magicast": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.5.5.tgz", + "integrity": "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", + "source-map-js": "^1.2.1" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", + "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/multer": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.4.0.tgz", + "integrity": "sha512-7dqa0ZcFfzbefdTuIkzOSMvZWC0J7FLqBOjJUZvDCXShIURWKxAyTT1wHhnE5q19c7jOJf43IYYKjBmZVZmvhg==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "type-is": "^1.6.18" + }, + "engines": { + "node": ">= 10.16.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/multer/node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mute-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-3.0.0.tgz", + "integrity": "sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", + "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==", + "license": "MIT", + "dependencies": { + "content-type": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/negotiator/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/nestjs-spelunker": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/nestjs-spelunker/-/nestjs-spelunker-1.3.2.tgz", + "integrity": "sha512-tVQZvPvlYNRW9PFkl2dj/hCEzUjC/NbJdayhnr/0dBuebFu4fqJNICPQF1BWJgK8GxJARe1kvDAw/GoyvINvOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ogma/styler": "^1.0.0" + }, + "peerDependencies": { + "@nestjs/common": ">6.11.0", + "@nestjs/core": ">6.11.0" + } + }, + "node_modules/node-addon-api": { + "version": "8.9.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.2.tgz", + "integrity": "sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-emoji": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.2.0.tgz", + "integrity": "sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^4.6.0", + "char-regex": "^1.0.2", + "emojilib": "^2.4.0", + "skin-tone": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-9.4.1.tgz", + "integrity": "sha512-6VlU9MLXbjVQD04AZCMX28hVtA5bUoadvUqO76MUCVA0ilwJbMiHsITRPfyVm6p/BC0Av/BXMujx39WCe1LEqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^5.6.2", + "cli-cursor": "^5.0.0", + "cli-spinners": "^3.2.0", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^2.1.0", + "log-symbols": "^7.0.1", + "stdin-discarder": "^0.3.2", + "string-width": "^8.1.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ora/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/string-width": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", + "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.5.0", + "strip-ansi": "^7.1.2" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/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==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/oxlint": { + "version": "1.83.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.83.0.tgz", + "integrity": "sha512-cyDzSzaw3uzP0TeCeq3lLRPPoaUxkbB4ZOXj+kn+5r+BX9V+4bNVGk9lxer+WrgcpebH4JxLlJ3KQjveVztOLQ==", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.83.0", + "@oxlint/binding-android-arm64": "1.83.0", + "@oxlint/binding-darwin-arm64": "1.83.0", + "@oxlint/binding-darwin-x64": "1.83.0", + "@oxlint/binding-freebsd-x64": "1.83.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.83.0", + "@oxlint/binding-linux-arm-musleabihf": "1.83.0", + "@oxlint/binding-linux-arm64-gnu": "1.83.0", + "@oxlint/binding-linux-arm64-musl": "1.83.0", + "@oxlint/binding-linux-ppc64-gnu": "1.83.0", + "@oxlint/binding-linux-riscv64-gnu": "1.83.0", + "@oxlint/binding-linux-riscv64-musl": "1.83.0", + "@oxlint/binding-linux-s390x-gnu": "1.83.0", + "@oxlint/binding-linux-x64-gnu": "1.83.0", + "@oxlint/binding-linux-x64-musl": "1.83.0", + "@oxlint/binding-openharmony-arm64": "1.83.0", + "@oxlint/binding-win32-arm64-msvc": "1.83.0", + "@oxlint/binding-win32-ia32-msvc": "1.83.0", + "@oxlint/binding-win32-x64-msvc": "1.83.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=7.0.2001", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + }, + "vite-plus": { + "optional": true + } + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pg": { + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.23.1.tgz", + "integrity": "sha512-aL96AHANtWjPLDOLqnhx+ngp9+UK7ETEU8VJrDCGvsSSi/mGLcWYsS6Herg7lmaBJe4uwrfqsa7gTEFaSizDoQ==", + "license": "MIT", + "dependencies": { + "pg-connection-string": "^2.14.1", + "pg-pool": "^3.14.0", + "pg-protocol": "^1.16.1", + "pg-types": "2.2.0", + "pgpass": "1.0.5" + }, + "engines": { + "node": ">= 16.0.0" + }, + "optionalDependencies": { + "pg-cloudflare": "^1.4.1" + }, + "peerDependencies": { + "pg-native": ">=3.0.1" + }, + "peerDependenciesMeta": { + "pg-native": { + "optional": true + } + } + }, + "node_modules/pg-cloudflare": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.1.tgz", + "integrity": "sha512-6PQbsFWZcp9EmJEwy5cGQ2La+AMWpP46lgbb8X+U/XsHIUweYDNCpeuKck5RxL2MdVFi7krbbEi5nX4Zh7JhrQ==", + "license": "MIT", + "optional": true + }, + "node_modules/pg-connection-string": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.1.tgz", + "integrity": "sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA==", + "license": "MIT" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "license": "ISC", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz", + "integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==", + "license": "MIT", + "peerDependencies": { + "pg": ">=8.0" + } + }, + "node_modules/pg-protocol": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.16.1.tgz", + "integrity": "sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg==", + "license": "MIT" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", + "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "license": "MIT", + "dependencies": { + "split2": "^4.1.0" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pino": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/pino/-/pino-10.3.1.tgz", + "integrity": "sha512-r34yH/GlQpKZbU1BvFFqOjhISRo1MNx1tWYsYvmj6KIRHSPMT2+yHOEb1SG6NMvRoHRF0a07kCOox/9yakl1vg==", + "license": "MIT", + "dependencies": { + "@pinojs/redact": "^0.4.0", + "atomic-sleep": "^1.0.0", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^3.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.2.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^4.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz", + "integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==", + "license": "MIT", + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz", + "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==", + "license": "MIT" + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz", + "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prettier": { + "version": "3.9.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.8.tgz", + "integrity": "sha512-WRFq3Wn3WId7LLROfMLdH7xaFr2jR62wU8nLO6rQUOLOxNZUviyJQs1M0iIhLexSFy+L+w0ch66wtoO2jRjG0A==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/process-warning": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.1.0.tgz", + "integrity": "sha512-jQSaVHsPgtyw60e1rQ/A+/ArPEj/S8pS/vFnyGa/gYFXrKk/6RuDkoqVDQ5NI5MmS01698ltlAk0NoDBNLujRw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, + "node_modules/proxy-addr": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/qs": { + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", + "integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==", + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "license": "MIT" + }, + "node_modules/range-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", + "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.1.1.tgz", + "integrity": "sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20.19.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/real-require": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", + "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", + "license": "MIT", + "engines": { + "node": ">= 12.13.0" + } + }, + "node_modules/redis": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/redis/-/redis-6.3.0.tgz", + "integrity": "sha512-XFQbPie1lGpKeUZ8ySYY43yLnQy/iIQtHNvIr/1XdaABpb96rUSdm3Mfl+98FEVbv9ZJIzINMno5s0Nh8E5LEw==", + "license": "MIT", + "dependencies": { + "@redis/bloom": "6.3.0", + "@redis/client": "6.3.0", + "@redis/json": "6.3.0", + "@redis/search": "6.3.0", + "@redis/time-series": "6.3.0" + }, + "engines": { + "node": ">= 20.0.0" + } + }, + "node_modules/reflect-metadata": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", + "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", + "license": "Apache-2.0" + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/restore-cursor/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ret": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.5.0.tgz", + "integrity": "sha512-I1XxrZSQ+oErkRR4jYbAyEEu2I0avBvvMM5JN+6EBprOGRCs63ENqZ3vjavq8fBw2+62G5LF5XelKwuJpcvcxw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "license": "MIT" + }, + "node_modules/rolldown": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.9.tgz", + "integrity": "sha512-hx/Pv0N1haXRb11qkfnK5MXB/iqr7i0yjWQqmO9uHqZpBgQSqzc8UsSnEpalsh+j1I8qQ2CkXAkJC8Br3dKSlg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.150.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.9", + "@rolldown/binding-android-arm64": "1.2.9", + "@rolldown/binding-darwin-arm64": "1.2.9", + "@rolldown/binding-darwin-x64": "1.2.9", + "@rolldown/binding-freebsd-x64": "1.2.9", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.9", + "@rolldown/binding-linux-arm64-gnu": "1.2.9", + "@rolldown/binding-linux-arm64-musl": "1.2.9", + "@rolldown/binding-linux-ppc64-gnu": "1.2.9", + "@rolldown/binding-linux-s390x-gnu": "1.2.9", + "@rolldown/binding-linux-x64-gnu": "1.2.9", + "@rolldown/binding-linux-x64-musl": "1.2.9", + "@rolldown/binding-openharmony-arm64": "1.2.9", + "@rolldown/binding-win32-arm64-msvc": "1.2.9", + "@rolldown/binding-win32-x64-msvc": "1.2.9" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-regex2": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-regex2/-/safe-regex2-5.1.1.tgz", + "integrity": "sha512-mOSBvHGDZMuIEZMdOz/aCEYDCv0E7nfcNsIhUF+/P+xC7Hyf3FkvymqgPbg9D1EdSGu+uKbJgy09K/RKKc7kJA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT", + "dependencies": { + "ret": "~0.5.0" + }, + "bin": { + "safe-regex2": "bin/safe-regex2.js" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/secure-json-parse": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.0.tgz", + "integrity": "sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/skin-tone": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz", + "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "unicode-emoji-modifier-base": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sonic-boom": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz", + "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==", + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, + "node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/std-env": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", + "dev": true, + "license": "MIT" + }, + "node_modules/stdin-discarder": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.3.2.tgz", + "integrity": "sha512-eCPu1qRxPVkl5605OTWF8Wz40b4Mf45NY5LQmVPQ599knfs5QhASUm9GbJ5BDMDOXgrnh0wyEdvzmL//YMlw0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "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==", + "dev": true, + "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/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strtok3": { + "version": "10.3.5", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz", + "integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==", + "license": "MIT", + "dependencies": { + "@tokenizer/token": "^0.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/superagent": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-10.3.0.tgz", + "integrity": "sha512-B+4Ik7ROgVKrQsXTV0Jwp2u+PXYLSlqtDAhYnkkD+zn3yg8s/zjA2MeGayPoY/KICrbitwneDHrjSotxKL+0XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "component-emitter": "^1.3.1", + "cookiejar": "^2.1.4", + "debug": "^4.3.7", + "fast-safe-stringify": "^2.1.1", + "form-data": "^4.0.5", + "formidable": "^3.5.4", + "methods": "^1.1.2", + "mime": "2.6.0", + "qs": "^6.14.1" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/supertest": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-7.2.2.tgz", + "integrity": "sha512-oK8WG9diS3DlhdUkcFn4tkNIiIbBx9lI2ClF8K+b2/m8Eyv47LSawxUzZQSNKUrVb2KsqeTDCcjAAVPYaSLVTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cookie-signature": "^1.2.2", + "methods": "^1.1.2", + "superagent": "^10.3.0" + }, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/thread-stream": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-4.2.0.tgz", + "integrity": "sha512-e2zZ96wSChazBsbENf/Pcm/4swHt2cEKQ92rhUjkL9GCKiTDJIaTBenjE/m9DXi0QBmTMDkFDdOomUy20A1tDQ==", + "license": "MIT", + "dependencies": { + "real-require": "^1.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/thread-stream/node_modules/real-require": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-1.0.0.tgz", + "integrity": "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==", + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyrainbow": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz", + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/toad-cache": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.4.tgz", + "integrity": "sha512-m1TdR/rvT7kgGJZhspNtXdsdYk0fddFpJJFlG5s+UkPFo6lkLoZ3YLOaovPYjq1R75NP5JfeTlSHaOsE09peCg==", + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/token-types": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz", + "integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==", + "license": "MIT", + "dependencies": { + "@borewit/text-codec": "^0.2.1", + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/tsconfig-paths": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "json5": "^2.2.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/tsx": { + "version": "4.23.15", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.15.tgz", + "integrity": "sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", + "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", + "license": "MIT", + "dependencies": { + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/type-is/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/typescript": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uid": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", + "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", + "license": "MIT", + "dependencies": { + "@lukeed/csprng": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/uint8array-extras": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz", + "integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/undici": { + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.20.1.tgz", + "integrity": "sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.17" + } + }, + "node_modules/undici-types": { + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", + "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/unicode-emoji-modifier-base": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", + "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/validator": { + "version": "13.15.35", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.35.tgz", + "integrity": "sha512-TQ5pAGhd5whStmqWvYF4OjQROlmv9SMFVt37qoCBdqRffuuklWYQlCNnEs2ZaIBD1kZRNnikiZOS1eqgkar0iw==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vite": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.0.tgz", + "integrity": "sha512-lhZBVvEHefgE+HQZC9O7EBJgCU/nVzFNl7vkS4RE0APtWLP02/8QVIkQtzBxPquh7lq5/78NHipTj7ODQ6XuyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.28", + "rolldown": "~1.2.6", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "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" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-tsconfig-paths": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-5.1.4.tgz", + "integrity": "sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "globrex": "^0.1.2", + "tsconfck": "^3.0.3" + }, + "peerDependencies": { + "vite": "*" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, + "node_modules/vite-tsconfig-paths/node_modules/tsconfck": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz", + "integrity": "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w==", + "deprecated": "unmaintained", + "dev": true, + "license": "MIT", + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^18 || >=20" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/vitest": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz", + "integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "4.1.11", + "@vitest/mocker": "4.1.11", + "@vitest/pretty-format": "4.1.11", + "@vitest/runner": "4.1.11", + "@vitest/snapshot": "4.1.11", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", + "es-module-lexer": "^2.0.0", + "expect-type": "^1.3.0", + "magic-string": "^0.30.21", + "obug": "^2.1.1", + "pathe": "^2.0.3", + "picomatch": "^4.0.3", + "std-env": "^4.0.0-rc.1", + "tinybench": "^2.9.0", + "tinyexec": "^1.0.2", + "tinyglobby": "^0.2.15", + "tinyrainbow": "^3.1.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^20.0.0 || ^22.0.0 || >=24.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "4.1.11", + "@vitest/browser-preview": "4.1.11", + "@vitest/browser-webdriverio": "4.1.11", + "@vitest/coverage-istanbul": "4.1.11", + "@vitest/coverage-v8": "4.1.11", + "@vitest/ui": "4.1.11", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/vitest/node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/yoctocolors": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.2.0.tgz", + "integrity": "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz", + "integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/app/package.json b/app/package.json new file mode 100644 index 00000000..2014015d --- /dev/null +++ b/app/package.json @@ -0,0 +1,66 @@ +{ + "name": "app", + "version": "0.0.1", + "description": "", + "author": "", + "private": true, + "license": "UNLICENSED", + "type": "module", + "scripts": { + "build": "nest build", + "deploy": "nest deploy", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "start": "nest start", + "start:dev": "nest start --watch", + "start:debug": "nest start --debug --watch", + "start:prod": "node dist/main", + "lint": "oxlint src/ test/", + "test": "vitest run", + "test:unit": "vitest run --include 'src/**/*.spec.ts'", + "test:watch": "vitest", + "test:cov": "vitest run --coverage", + "test:debug": "vitest --inspect-brk --no-file-parallelism", + "graph": "npm run build && DATABASE_URL=postgresql://graph-only.invalid/messenger REDIS_URL=redis://graph-only.invalid:6379 tsx scripts/graph-modules.ts", + "test:e2e": "vitest run --config ./vitest.config.e2e.ts", + "test:dependencies": "E2E_DEPENDENCY_FAULTS=1 vitest run --config ./vitest.config.e2e.ts dependency-failures", + "idempotency:gc": "tsx src/messages/idempotency/idempotency-gc.cli.ts" + }, + "dependencies": { + "@nestjs/common": "^12.0.1", + "@nestjs/config": "^12.0.0", + "@nestjs/core": "^12.0.1", + "@nestjs/platform-express": "^12.0.1", + "@nestjs/platform-fastify": "^12.0.3", + "argon2": "^0.45.1", + "class-transformer": "^0.5.1", + "class-validator": "^0.15.1", + "date-fns": "^4.4.0", + "fastify": "^5.12.5", + "pg": "^8.23.1", + "redis": "^6.3.0", + "reflect-metadata": "^0.2.2", + "rxjs": "^7.8.1", + "zod": "^4.6.5" + }, + "devDependencies": { + "@nestjs/cli": "^12.0.0", + "@nestjs/mau": "^0.2.6", + "@nestjs/schematics": "^12.0.0", + "@nestjs/testing": "^12.0.1", + "@types/express": "^5.0.0", + "@types/node": "^24.0.0", + "@types/pg": "^8.23.1", + "@types/supertest": "^7.0.0", + "@vitest/coverage-v8": "^4.1.2", + "dotenv": "^18.0.5", + "nestjs-spelunker": "^1.3.2", + "oxlint": "^1.58.0", + "prettier": "^3.4.2", + "source-map-support": "^0.5.21", + "supertest": "^7.2.2", + "tsx": "^4.23.15", + "typescript": "^6.0.3", + "vite-tsconfig-paths": "^5.1.4", + "vitest": "^4.1.2" + } +} diff --git a/app/scripts/graph-modules.ts b/app/scripts/graph-modules.ts new file mode 100644 index 00000000..5e8e6d86 --- /dev/null +++ b/app/scripts/graph-modules.ts @@ -0,0 +1,123 @@ +import { mkdir, writeFile } from 'node:fs/promises'; +import 'reflect-metadata'; +import { SpelunkerModule, type DebuggedTree } from 'nestjs-spelunker'; +import { AppModule } from '../dist/app.module.js'; + +function mermaidId(name: string): string { + return name.replace(/[^a-zA-Z0-9_]/gu, '_'); +} + +function findDependencyModule( + tree: DebuggedTree[], + dependency: string, +): DebuggedTree | undefined { + return tree.find( + (candidate) => + candidate.providers.some((item) => item.name === dependency) || + candidate.controllers.some((item) => item.name === dependency), + ); +} + +function renderMermaid(tree: DebuggedTree[]): string { + const lines = [ + 'flowchart LR', + ' %% Generated by scripts/graph-modules.ts', + ' %% Solid arrows: module imports; dotted arrows: constructor dependencies', + ]; + const moduleNames = tree.map((module) => module.name); + + for (const module of tree) { + const moduleId = mermaidId(module.name); + lines.push(` subgraph ${moduleId}["${module.name}"]`); + for (const provider of module.providers) { + lines.push( + ` ${moduleId}_${mermaidId(provider.name)}["provider: ${provider.name}"]`, + ); + } + for (const controller of module.controllers) { + lines.push( + ` ${moduleId}_${mermaidId(controller.name)}["controller: ${controller.name}"]`, + ); + } + lines.push(' end'); + } + + for (const module of tree) { + for (const imported of module.imports) { + if (moduleNames.includes(imported)) { + lines.push( + ` ${mermaidId(module.name)} -->|imports| ${mermaidId(imported)}`, + ); + } + } + for (const item of [...module.providers, ...module.controllers]) { + for (const dependency of item.dependencies) { + const targetModule = findDependencyModule(tree, dependency); + if (targetModule) { + const source = `${mermaidId(module.name)}_${mermaidId(item.name)}`; + const target = `${mermaidId(targetModule.name)}_${mermaidId(dependency)}`; + lines.push(` ${source} -.->|injects| ${target}`); + } + } + } + } + + return `${lines.join('\n')}\n`; +} + +function renderMarkdown(tree: DebuggedTree[], mermaid: string): string { + const lines = [ + '# NestJS dependency graph', + '', + 'Generated from `AppModule` with `nestjs-spelunker` static module debugging.', + '', + '- Solid arrows: module imports.', + '- Dotted arrows: constructor dependencies.', + '- The generator does not boot PostgreSQL or Redis.', + '', + '```mermaid', + mermaid.trim(), + '```', + '', + '## Module details', + '', + ]; + + for (const module of tree) { + lines.push( + `### ${module.name}`, + '', + `- Imports: ${module.imports.join(', ') || 'none'}`, + ); + lines.push( + `- Exports: ${module.exports.map((item) => `${item.name} (${item.type})`).join(', ') || 'none'}`, + ); + lines.push('', '| Kind | Name | Dependencies |', '| --- | --- | --- |'); + for (const provider of module.providers) { + lines.push( + `| provider | ${provider.name} | ${provider.dependencies.join(', ') || 'none'} |`, + ); + } + for (const controller of module.controllers) { + lines.push( + `| controller | ${controller.name} | ${controller.dependencies.join(', ') || 'none'} |`, + ); + } + lines.push(''); + } + + return lines.join('\n'); +} + +const tree = await SpelunkerModule.debug(AppModule); +const mermaid = renderMermaid(tree); +await mkdir('../docs/architecture', { recursive: true }); +await writeFile( + '../docs/architecture/nest-module-details.json', + JSON.stringify(tree, null, 2), +); +await writeFile('../docs/architecture/nest-module-graph.mmd', mermaid); +await writeFile( + '../docs/architecture/nest-dependency-graph.md', + renderMarkdown(tree, mermaid), +); diff --git a/app/src/app.module.ts b/app/src/app.module.ts new file mode 100644 index 00000000..c731b7a4 --- /dev/null +++ b/app/src/app.module.ts @@ -0,0 +1,33 @@ +import { Module } from '@nestjs/common'; +import { AppConfigModule } from './config/app-config.module.js'; +import { DatabaseModule } from './database/database.module.js'; +import { RedisModule } from './redis/redis.module.js'; +import { AuthModule } from './auth/auth.module.js'; +import { ChatsModule } from './chats/chats.module.js'; +import { HealthModule } from './health/health.module.js'; +import { MessagesModule } from './messages/messages.module.js'; +import { MetricsModule } from './metrics/metrics.module.js'; +import { UsersModule } from './users/users.module.js'; +import { APP_FILTER } from '@nestjs/core'; +import { ApiExceptionFilter } from './common/errors/api-exception.filter.js'; + +@Module({ + imports: [ + AppConfigModule, + DatabaseModule, + RedisModule, + UsersModule, + AuthModule, + HealthModule, + ChatsModule, + MessagesModule, + MetricsModule, + ], + providers: [ + { + provide: APP_FILTER, + useClass: ApiExceptionFilter, + }, + ], +}) +export class AppModule {} diff --git a/app/src/auth/auth.controller.ts b/app/src/auth/auth.controller.ts new file mode 100644 index 00000000..265696d9 --- /dev/null +++ b/app/src/auth/auth.controller.ts @@ -0,0 +1,79 @@ +import { + BadRequestException, + Body, + Controller, + Delete, + Headers, + HttpCode, + HttpStatus, + Post, + UnauthorizedException, + UseGuards, +} from '@nestjs/common'; +import { TextDecoder } from 'node:util'; +import { AuthService } from './auth.service.js'; +import { CurrentUserGuard } from '../common/auth/current-user.guard.js'; + +const BASE64 = + /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u; +const BASIC_CHALLENGE = 'Basic realm="messenger", charset="UTF-8"'; + +function basicUnauthorized(): UnauthorizedException { + return new UnauthorizedException({ + message: 'Unauthorized', + challenge: BASIC_CHALLENGE, + }); +} + +function bearerUnauthorized(): UnauthorizedException { + return new UnauthorizedException({ + message: 'Unauthorized', + challenge: 'Bearer realm="messenger"', + }); +} + +function parseBasic(value: string | undefined): [string, string] { + if (typeof value !== 'string') throw basicUnauthorized(); + const match = /^Basic[ \t]+([^ \t]+)$/iu.exec(value); + if (!match || !BASE64.test(match[1])) throw basicUnauthorized(); + const bytes = Buffer.from(match[1], 'base64'); + if (bytes.toString('base64') !== match[1]) throw basicUnauthorized(); + let decoded: string; + try { + decoded = new TextDecoder('utf-8', { fatal: true }).decode(bytes); + } catch { + throw basicUnauthorized(); + } + const separator = decoded.indexOf(':'); + if (separator < 1) throw basicUnauthorized(); + return [decoded.slice(0, separator), decoded.slice(separator + 1)]; +} + +@Controller('api/v1/auth/sessions') +export class AuthController { + constructor(private readonly auth: AuthService) {} + + @Post() + create( + @Headers('authorization') authorization: string | undefined, + @Body() body: unknown, + ) { + const [username, password] = parseBasic(authorization); + if (body !== undefined) + throw new BadRequestException( + 'Session creation does not accept a body', + ); + return this.auth.createSession(username, password); + } + + @Delete('current') + @UseGuards(CurrentUserGuard) + @HttpCode(HttpStatus.NO_CONTENT) + async delete( + @Headers('authorization') authorization: string | undefined, + ): Promise { + if (!authorization || !/^Bearer\s+[^\s]+$/iu.test(authorization)) + throw bearerUnauthorized(); + await this.auth.deleteSession(authorization.slice(7).trim()); + } +} diff --git a/app/src/auth/auth.module.ts b/app/src/auth/auth.module.ts new file mode 100644 index 00000000..c29483bd --- /dev/null +++ b/app/src/auth/auth.module.ts @@ -0,0 +1,16 @@ +import { Module } from '@nestjs/common'; +import { DatabaseModule } from '../database/database.module.js'; +import { RedisModule } from '../redis/redis.module.js'; +import { UsersModule } from '../users/users.module.js'; +import { AuthController } from './auth.controller.js'; +import { AuthService } from './auth.service.js'; +import { SessionRepository } from './session.repository.js'; +import { MetricsModule } from '../metrics/metrics.module.js'; + +@Module({ + imports: [UsersModule, DatabaseModule, RedisModule, MetricsModule], + controllers: [AuthController], + providers: [AuthService, SessionRepository], + exports: [AuthService, SessionRepository], +}) +export class AuthModule {} diff --git a/app/src/auth/auth.service.ts b/app/src/auth/auth.service.ts new file mode 100644 index 00000000..f9833586 --- /dev/null +++ b/app/src/auth/auth.service.ts @@ -0,0 +1,63 @@ +import { + Injectable, + ServiceUnavailableException, + UnauthorizedException, +} from '@nestjs/common'; +import argon2 from 'argon2'; +import type { User } from '../users/user.js'; +import { UsersService } from '../users/users.service.js'; +import { SessionRepository } from './session.repository.js'; + +export type SessionResponse = { + token: string; + token_type: 'Bearer'; + expires_at: string; + user: User; +}; + +@Injectable() +export class AuthService { + constructor( + private readonly users: UsersService, + private readonly sessions: SessionRepository, + ) {} + + async createSession( + username: string, + password: string, + ): Promise { + const storedUser = await this.users.findByUsername(username); + if ( + !storedUser || + !(await argon2.verify(storedUser.password_hash, password)) + ) { + throw new UnauthorizedException(); + } + const user: User = { + id: storedUser.id, + username: storedUser.username, + display_name: storedUser.display_name, + created_at: storedUser.created_at, + }; + let session: { token: string; expiresAt: string }; + try { + session = await this.sessions.create(user.id); + } catch { + throw new ServiceUnavailableException('Session store unavailable'); + } + return { + token: session.token, + token_type: 'Bearer', + expires_at: session.expiresAt, + user, + }; + } + + async deleteSession(token: string): Promise { + try { + await this.sessions.delete(token); + } catch { + throw new ServiceUnavailableException('Session store unavailable'); + } + } +} diff --git a/app/src/auth/session.repository.ts b/app/src/auth/session.repository.ts new file mode 100644 index 00000000..57eb2827 --- /dev/null +++ b/app/src/auth/session.repository.ts @@ -0,0 +1,35 @@ +import { Injectable } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { randomBytes } from 'node:crypto'; +import type { AppConfig } from '../config/app-config.schema.js'; +import { RedisClient } from '../redis/redis.client.js'; +import { MetricsService } from '../metrics/metrics.service.js'; + +@Injectable() +export class SessionRepository { + constructor( + private readonly redis: RedisClient, + private readonly config: ConfigService, + private readonly metrics: MetricsService, + ) {} + + async create( + userId: string, + ): Promise<{ token: string; expiresAt: string }> { + const token = randomBytes(32).toString('base64url'); + const ttl = this.config.getOrThrow('SESSION_TTL_SECONDS'); + const expiresAt = new Date(Date.now() + ttl * 1000).toISOString(); + this.metrics.increment('session_set'); + await this.redis.set( + `session:${token}`, + JSON.stringify({ user_id: userId, expires_at: expiresAt }), + { EX: ttl }, + ); + return { token, expiresAt }; + } + + delete(token: string): Promise { + this.metrics.increment('session_del'); + return this.redis.del(`session:${token}`); + } +} diff --git a/app/src/chats/chat.ts b/app/src/chats/chat.ts new file mode 100644 index 00000000..fb2e262e --- /dev/null +++ b/app/src/chats/chat.ts @@ -0,0 +1,6 @@ +export type Chat = { + id: string; + title: string; + member_ids: string[]; + created_at: string; +}; diff --git a/app/src/chats/chats.controller.ts b/app/src/chats/chats.controller.ts new file mode 100644 index 00000000..53dcd865 --- /dev/null +++ b/app/src/chats/chats.controller.ts @@ -0,0 +1,49 @@ +import { + BadRequestException, + Body, + Controller, + DefaultValuePipe, + Get, + Param, + ParseIntPipe, + ParseUUIDPipe, + Post, + Query, + UseGuards, +} from '@nestjs/common'; +import { CurrentUser } from '../common/auth/current-user.decorator.js'; +import { CurrentUserGuard } from '../common/auth/current-user.guard.js'; +import { ChatsService } from './chats.service.js'; +import { CreateChatDto } from './dto/create-chat.dto.js'; +import type { User } from '../users/user.js'; + +@Controller('api/v1/chats') +@UseGuards(CurrentUserGuard) +export class ChatsController { + constructor(private readonly chatsService: ChatsService) {} + + @Post() + create(@Body() body: CreateChatDto, @CurrentUser() currentUser: User) { + return this.chatsService.create(body, currentUser); + } + + @Get() + list( + @CurrentUser() currentUser: User, + @Query('limit', new DefaultValuePipe(50), new ParseIntPipe()) + limit: number, + @Query('cursor') cursor?: string, + ) { + if (limit < 1 || limit > 100) + throw new BadRequestException('limit must be between 1 and 100'); + return this.chatsService.listForUser(currentUser, limit, cursor); + } + + @Get(':chatId') + get( + @Param('chatId', new ParseUUIDPipe()) chatId: string, + @CurrentUser() currentUser: User, + ) { + return this.chatsService.getForUser(chatId, currentUser); + } +} diff --git a/app/src/chats/chats.module.ts b/app/src/chats/chats.module.ts new file mode 100644 index 00000000..5bc65a34 --- /dev/null +++ b/app/src/chats/chats.module.ts @@ -0,0 +1,16 @@ +import { Module } from '@nestjs/common'; +import { DatabaseModule } from '../database/database.module.js'; +import { RedisModule } from '../redis/redis.module.js'; +import { MetricsModule } from '../metrics/metrics.module.js'; +import { UsersModule } from '../users/users.module.js'; +import { ChatsController } from './chats.controller.js'; +import { ChatsRepository } from './chats.repository.js'; +import { ChatsService } from './chats.service.js'; + +@Module({ + imports: [UsersModule, DatabaseModule, RedisModule, MetricsModule], + controllers: [ChatsController], + providers: [ChatsRepository, ChatsService], + exports: [ChatsService], +}) +export class ChatsModule {} diff --git a/app/src/chats/chats.repository.ts b/app/src/chats/chats.repository.ts new file mode 100644 index 00000000..7f724bcb --- /dev/null +++ b/app/src/chats/chats.repository.ts @@ -0,0 +1,109 @@ +import { BadRequestException, Injectable } from '@nestjs/common'; +import { randomUUID } from 'node:crypto'; +import { DatabaseClient } from '../database/database.client.js'; +import type { Cursor } from '../common/http/cursor.js'; +import type { User } from '../users/user.js'; +import type { Chat } from './chat.js'; + +type ChatRow = { + id: string; + title: string; + created_at: Date | string; + member_ids: string[]; +}; + +function toChat(row: ChatRow): Chat { + return { + id: row.id, + title: row.title, + created_at: new Date(row.created_at).toISOString(), + member_ids: row.member_ids, + }; +} + +@Injectable() +export class ChatsRepository { + constructor(private readonly database: DatabaseClient) {} + + async create(title: string, memberIds: string[]): Promise { + const id = randomUUID(); + return this.database.withTransaction(async (client) => { + const users = await client.query<{ id: string }>({ + name: 'chats.validateMembers', + text: 'SELECT id FROM users WHERE id = ANY($1::uuid[])', + values: [memberIds], + }); + if (users.rowCount !== memberIds.length) + throw new BadRequestException('Chat member does not exist'); + const inserted = await client.query({ + name: 'chats.insert', + text: 'INSERT INTO chats (id, title) VALUES ($1, $2) RETURNING id, title, created_at', + values: [id, title], + }); + for (const memberId of memberIds) { + await client.query({ + name: 'chats.insertMember', + text: 'INSERT INTO chat_members (chat_id, user_id) VALUES ($1, $2)', + values: [id, memberId], + }); + } + return { + ...toChat({ ...inserted.rows[0], member_ids: memberIds }), + member_ids: memberIds, + }; + }); + } + + async findForUser(id: string, user: User): Promise { + const result = await this.database.query( + 'chats.findForUser', + `SELECT c.id, c.title, c.created_at, + COALESCE(array_agg(cm.user_id ORDER BY cm.user_id) + FILTER (WHERE cm.user_id IS NOT NULL), '{}') AS member_ids + FROM chats c + LEFT JOIN chat_members cm ON cm.chat_id = c.id + WHERE c.id = $1 + AND EXISTS ( + SELECT 1 FROM chat_members own + WHERE own.chat_id = c.id AND own.user_id = $2 + ) + GROUP BY c.id`, + [id, user.id], + ); + return result.rows[0] ? toChat(result.rows[0]) : undefined; + } + + async findPageForUser( + user: User, + limit: number, + cursor?: Cursor, + ): Promise<{ items: Chat[]; hasMore: boolean }> { + const values: unknown[] = [user.id]; + let predicate = ''; + if (cursor) { + values.push(cursor.created_at, cursor.id); + predicate = + 'AND (c.created_at, c.id) > ($2::timestamptz, $3::uuid)'; + } + values.push(limit + 1); + const result = await this.database.query( + 'chats.listForUser', + `SELECT c.id, c.title, c.created_at, + COALESCE(array_agg(cm.user_id ORDER BY cm.user_id) + FILTER (WHERE cm.user_id IS NOT NULL), '{}') AS member_ids + FROM chats c + LEFT JOIN chat_members cm ON cm.chat_id = c.id + WHERE EXISTS ( + SELECT 1 FROM chat_members own + WHERE own.chat_id = c.id AND own.user_id = $1 + ) + ${predicate} + GROUP BY c.id ORDER BY c.created_at, c.id LIMIT $${values.length}`, + values, + ); + return { + items: result.rows.slice(0, limit).map(toChat), + hasMore: result.rows.length > limit, + }; + } +} diff --git a/app/src/chats/chats.service.ts b/app/src/chats/chats.service.ts new file mode 100644 index 00000000..2a78c65e --- /dev/null +++ b/app/src/chats/chats.service.ts @@ -0,0 +1,61 @@ +import { + BadRequestException, + Injectable, + NotFoundException, +} from '@nestjs/common'; +import { encodeCursor, decodeCursor } from '../common/http/cursor.js'; +import type { Page } from '../common/http/page.js'; +import type { User } from '../users/user.js'; +import type { CreateChatDto } from './dto/create-chat.dto.js'; +import type { Chat } from './chat.js'; +import { ChatsRepository } from './chats.repository.js'; + +@Injectable() +export class ChatsService { + constructor(private readonly chatsRepository: ChatsRepository) {} + + create(input: CreateChatDto, currentUser: User): Promise { + if (!input.member_ids.includes(currentUser.id)) + throw new BadRequestException('Current user must be a chat member'); + if (new Set(input.member_ids).size !== input.member_ids.length) + throw new BadRequestException('Duplicate chat member'); + return this.chatsRepository.create(input.title, input.member_ids); + } + + async getForUser(chatId: string, currentUser: User): Promise { + const chat = await this.chatsRepository.findForUser( + chatId, + currentUser, + ); + if (!chat) throw new NotFoundException(); + return chat; + } + + async listForUser( + currentUser: User, + limit: number, + cursorValue?: string, + ): Promise> { + const scope = `chats:${currentUser.id}`; + const cursor = cursorValue + ? decodeCursor(cursorValue, scope) + : undefined; + const page = await this.chatsRepository.findPageForUser( + currentUser, + limit, + cursor, + ); + const last = page.items.at(-1); + return { + items: page.items, + next_cursor: + page.hasMore && last + ? encodeCursor({ + scope, + created_at: last.created_at, + id: last.id, + }) + : null, + }; + } +} diff --git a/app/src/chats/dto/create-chat.dto.ts b/app/src/chats/dto/create-chat.dto.ts new file mode 100644 index 00000000..37ff853d --- /dev/null +++ b/app/src/chats/dto/create-chat.dto.ts @@ -0,0 +1,26 @@ +import { + ArrayMaxSize, + ArrayMinSize, + ArrayUnique, + IsArray, + IsString, + IsUUID, + Matches, +} from 'class-validator'; +import { CodePointLength } from '../../common/validation/code-point-length.js'; + +export class CreateChatDto { + @IsString() + @CodePointLength(1, 100) + @Matches(/\S/, { + message: 'title must contain a non-whitespace character', + }) + title: string; + + @IsArray() + @ArrayMinSize(1) + @ArrayMaxSize(100) + @ArrayUnique() + @IsUUID('4', { each: true }) + member_ids: string[]; +} diff --git a/app/src/common/auth/current-user.decorator.ts b/app/src/common/auth/current-user.decorator.ts new file mode 100644 index 00000000..dc054212 --- /dev/null +++ b/app/src/common/auth/current-user.decorator.ts @@ -0,0 +1,10 @@ +import { createParamDecorator, ExecutionContext } from '@nestjs/common'; +import type { User } from '../../users/user.js'; +import { FastifyRequest } from 'fastify'; + +export const CurrentUser = createParamDecorator( + (_data: unknown, context: ExecutionContext): User => { + const request = context.switchToHttp().getRequest(); + return request.currentUser!; + }, +); diff --git a/app/src/common/auth/current-user.guard.ts b/app/src/common/auth/current-user.guard.ts new file mode 100644 index 00000000..ae400b1f --- /dev/null +++ b/app/src/common/auth/current-user.guard.ts @@ -0,0 +1,85 @@ +import { + CanActivate, + ExecutionContext, + Injectable, + ServiceUnavailableException, + UnauthorizedException, +} from '@nestjs/common'; +import type { FastifyRequest } from 'fastify'; +import type { User } from '../../users/user.js'; +import { RedisClient } from '../../redis/redis.client.js'; +import { UsersService } from '../../users/users.service.js'; +import { MetricsService } from '../../metrics/metrics.service.js'; + +@Injectable() +export class CurrentUserGuard implements CanActivate { + constructor( + private readonly redis: RedisClient, + private readonly users: UsersService, + private readonly metrics: MetricsService, + ) {} + + async canActivate(context: ExecutionContext): Promise { + const request = context.switchToHttp().getRequest(); + const authorization = request.headers.authorization; + if ( + typeof authorization !== 'string' || + !/^Bearer\s+[^\s]+$/u.test(authorization) + ) { + throw new UnauthorizedException({ + message: 'Unauthorized', + challenge: 'Bearer realm="messenger"', + }); + } + let session: string | null; + try { + this.metrics.increment('session_get'); + session = await this.redis.get( + `session:${authorization.slice(7).trim()}`, + ); + } catch { + throw new ServiceUnavailableException('Session store unavailable'); + } + if (!session) + throw new UnauthorizedException({ + message: 'Unauthorized', + challenge: 'Bearer realm="messenger"', + }); + let userId: string; + try { + const parsed: unknown = JSON.parse(session); + if ( + typeof parsed !== 'object' || + parsed === null || + !('user_id' in parsed) || + typeof parsed.user_id !== 'string' || + !('expires_at' in parsed) || + typeof parsed.expires_at !== 'string' || + !/^(?:\d{4})-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/u.test( + parsed.expires_at, + ) + ) + throw new Error('invalid session'); + const expiresAt = Date.parse(parsed.expires_at); + if (!Number.isFinite(expiresAt) || Date.now() >= expiresAt) + throw new Error('expired session'); + userId = parsed.user_id; + } catch { + throw new UnauthorizedException({ + message: 'Unauthorized', + challenge: 'Bearer realm="messenger"', + }); + } + let user: User | undefined; + try { + user = await this.users.findById(userId); + } catch { + throw new ServiceUnavailableException( + 'Authentication service unavailable', + ); + } + if (!user) throw new UnauthorizedException(); + request.currentUser = user; + return true; + } +} diff --git a/app/src/common/errors/api-error.ts b/app/src/common/errors/api-error.ts new file mode 100644 index 00000000..b26ece9b --- /dev/null +++ b/app/src/common/errors/api-error.ts @@ -0,0 +1,7 @@ +export type ApiErrorBody = { + error: { + code: string; + message: string; + request_id: string; + }; +}; diff --git a/app/src/common/errors/api-exception.filter.ts b/app/src/common/errors/api-exception.filter.ts new file mode 100644 index 00000000..a1384238 --- /dev/null +++ b/app/src/common/errors/api-exception.filter.ts @@ -0,0 +1,168 @@ +import { + ArgumentsHost, + Catch, + ExceptionFilter, + HttpException, + HttpStatus, + Logger, +} from '@nestjs/common'; +import { HttpAdapterHost } from '@nestjs/core'; +import { ConfigService } from '@nestjs/config'; +import { randomUUID } from 'node:crypto'; +import type { AppConfig } from '../../config/app-config.schema.js'; +import { resolveInstanceId } from '../../config/instance-id.js'; +import type { ApiErrorBody } from './api-error.js'; + +type RequestWithId = { requestId?: string; method?: string; url?: string }; +type ExceptionBody = { message?: unknown; challenge?: unknown }; + +// Connection/session loss codes reported by node-postgres and the network layer. +const UNAVAILABLE_ERROR_CODES: Record = { + ECONNREFUSED: true, + ECONNRESET: true, + ENOTFOUND: true, + ETIMEDOUT: true, + EPIPE: true, + '08000': true, + '08001': true, + '08003': true, + '08004': true, + '08006': true, + '57P01': true, + '57P02': true, + '57P03': true, + '53300': true, + // Transient aborts: the statement was cancelled by statement_timeout, the + // transaction was rolled back by a serialization failure or a deadlock. The + // work was never confirmed, so callers see a retryable 503 instead of an + // internal error. Without this, such an abort would be recorded as the final + // result of an idempotent operation. + '57014': true, + '40001': true, + '40P01': true, +}; + +// Some driver failures carry no `code` at all: node-postgres raises plain errors +// when a connection dies or its pool attempt times out, and node-redis reports a +// closed socket the same way. Without these patterns a stopped database would +// surface as an internal fault instead of a bounded outage. +const UNAVAILABLE_ERROR_MESSAGES = [ + 'Connection terminated unexpectedly', + 'Connection terminated due to connection timeout', + 'timeout exceeded when trying to connect', + 'Client has encountered a connection error and is not queryable', + 'Socket closed unexpectedly', + 'Connection is closed', +]; + +function isDependencyOutage(exception: unknown): boolean { + if (typeof exception !== 'object' || exception === null) return false; + const code = (exception as { code?: unknown }).code; + if (typeof code === 'string' && UNAVAILABLE_ERROR_CODES[code] === true) + return true; + const message = (exception as { message?: unknown }).message; + return ( + typeof message === 'string' && + UNAVAILABLE_ERROR_MESSAGES.some((pattern) => message.includes(pattern)) + ); +} + +function errorCodeForStatus(status: number): string { + const codes: Record = { + [HttpStatus.BAD_REQUEST]: 'invalid_request', + [HttpStatus.UNAUTHORIZED]: 'unauthorized', + [HttpStatus.NOT_FOUND]: 'not_found', + [HttpStatus.CONFLICT]: 'conflict', + [HttpStatus.PAYLOAD_TOO_LARGE]: 'payload_too_large', + [HttpStatus.UNSUPPORTED_MEDIA_TYPE]: 'unsupported_media_type', + [HttpStatus.TOO_MANY_REQUESTS]: 'rate_limited', + [HttpStatus.SERVICE_UNAVAILABLE]: 'unavailable', + }; + return codes[status] ?? 'internal_error'; +} + +@Catch() +export class ApiExceptionFilter implements ExceptionFilter { + private readonly logger = new Logger(ApiExceptionFilter.name); + // Guards and pipes run before interceptors, so an error response may be the + // first thing the filter writes: it must carry the replica identity too. + private readonly instanceId: string; + + constructor( + private readonly adapterHost: HttpAdapterHost, + config: ConfigService, + ) { + this.instanceId = resolveInstanceId(config); + } + + catch(exception: unknown, host: ArgumentsHost): void { + const http = host.switchToHttp(); + const request = http.getRequest(); + const response = http.getResponse(); + const adapter = this.adapterHost.httpAdapter; + const requestId = request.requestId ?? randomUUID(); + request.requestId = requestId; + + let status = HttpStatus.INTERNAL_SERVER_ERROR; + let message = 'Internal server error'; + let challenge: string | undefined; + if (exception instanceof HttpException) { + status = exception.getStatus(); + const body = exception.getResponse(); + const details: ExceptionBody = + typeof body === 'object' && body !== null + ? (body as ExceptionBody) + : {}; + const rawMessage = + 'message' in details ? details.message : undefined; + challenge = + typeof details.challenge === 'string' + ? details.challenge + : undefined; + message = Array.isArray(rawMessage) + ? rawMessage.join('; ') + : typeof rawMessage === 'string' + ? rawMessage + : 'Request failed'; + if (status === HttpStatus.NOT_FOUND) message = 'Resource not found'; + if (status >= HttpStatus.INTERNAL_SERVER_ERROR) + message = + status === HttpStatus.SERVICE_UNAVAILABLE + ? 'Service unavailable' + : 'Internal server error'; + } else if (isDependencyOutage(exception)) { + // A dropped dependency is a bounded outage, not an internal fault. + status = HttpStatus.SERVICE_UNAVAILABLE; + message = 'Service unavailable'; + this.logger.warn( + `Dependency outage on ${request.method ?? ''} ${request.url ?? ''}: ${exception instanceof Error ? exception.message : 'unknown error'}`, + ); + } else { + this.logger.error( + `Unhandled exception on ${request.method ?? ''} ${request.url ?? ''}`, + exception instanceof Error + ? exception.stack + : String(exception), + ); + } + if (status === HttpStatus.UNAUTHORIZED) { + const authChallenge = + challenge ?? + (request.method === 'POST' && + request.url?.startsWith('/api/v1/auth/sessions') + ? 'Basic realm="messenger", charset="UTF-8"' + : 'Bearer realm="messenger"'); + adapter.setHeader(response, 'WWW-Authenticate', authChallenge); + } + adapter.setHeader(response, 'X-Request-Id', requestId); + adapter.setHeader(response, 'X-Instance-Id', this.instanceId); + const payload: ApiErrorBody = { + error: { + code: errorCodeForStatus(status), + message, + request_id: requestId, + }, + }; + adapter.reply(response, payload, status); + } +} diff --git a/app/src/common/http/cursor.spec.ts b/app/src/common/http/cursor.spec.ts new file mode 100644 index 00000000..f4e7823b --- /dev/null +++ b/app/src/common/http/cursor.spec.ts @@ -0,0 +1,85 @@ +import { BadRequestException } from '@nestjs/common'; +import { randomUUID } from 'node:crypto'; +import { describe, expect, it } from 'vitest'; +import { decodeCursor, encodeCursor } from './cursor.js'; + +const scope = 'messages:6f1c2a3e-1111-4222-8333-444455556666'; + +function encode(createdAt: string, cursorScope = scope): string { + return encodeCursor({ + scope: cursorScope, + created_at: createdAt, + id: randomUUID(), + }); +} + +describe('decodeCursor', () => { + it('accepts valid instants and normalizes them to canonical milliseconds', () => { + const accepted: Array<[string, string]> = [ + ['2026-01-01T00:00:00.000Z', '2026-01-01T00:00:00.000Z'], + ['2026-01-01T00:00:00Z', '2026-01-01T00:00:00.000Z'], + ['2026-01-01T00:00:00.999999Z', '2026-01-01T00:00:00.999Z'], + ['2024-02-29T23:59:59.000Z', '2024-02-29T23:59:59.000Z'], + ['2026-12-31T23:59:59.999Z', '2026-12-31T23:59:59.999Z'], + ]; + for (const [createdAt, expected] of accepted) { + const decoded = decodeCursor(encode(createdAt), scope); + expect(decoded.created_at).toBe(expected); + expect(decoded.scope).toBe(scope); + } + }); + + it('rejects calendar dates that the platform parser rolls over', () => { + // 2026-02-31 would silently become 2026-03-03 and then fail inside SQL. + for (const createdAt of [ + '2026-02-31T00:00:00.000Z', + '2025-02-29T00:00:00.000Z', + '2026-04-31T00:00:00.000Z', + '2026-06-31T12:00:00.000Z', + ]) { + expect(() => decodeCursor(encode(createdAt), scope)).toThrow( + BadRequestException, + ); + } + }); + + it('rejects out-of-range and malformed timestamps', () => { + for (const createdAt of [ + '2026-01-01T24:00:00.000Z', + '2026-01-01T00:00:60.000Z', + '2026-13-01T00:00:00.000Z', + '2026-00-01T00:00:00.000Z', + '2026-01-01T00:00:00', + '2026-01-01T00:00:00+02:00', + '2026-1-1T00:00:00.000Z', + '2026-01-01', + 'not-a-timestamp', + ]) { + expect(() => decodeCursor(encode(createdAt), scope)).toThrow( + BadRequestException, + ); + } + }); + + it('rejects a cursor from another scope, a malformed id, and non-cursor input', () => { + expect(() => + decodeCursor( + encode('2026-01-01T00:00:00.000Z', 'messages:other'), + scope, + ), + ).toThrow(BadRequestException); + expect(() => + decodeCursor( + encodeCursor({ + scope, + created_at: '2026-01-01T00:00:00.000Z', + id: 'not-a-uuid', + }), + scope, + ), + ).toThrow(BadRequestException); + expect(() => decodeCursor('not-a-cursor', scope)).toThrow( + BadRequestException, + ); + }); +}); diff --git a/app/src/common/http/cursor.ts b/app/src/common/http/cursor.ts new file mode 100644 index 00000000..037d4a4d --- /dev/null +++ b/app/src/common/http/cursor.ts @@ -0,0 +1,54 @@ +import { BadRequestException } from '@nestjs/common'; +import { isValid, parseISO } from 'date-fns'; + +export type Cursor = { + scope: string; + created_at: string; + id: string; +}; + +// Format check for the canonical API shape: `Date.prototype.toISOString()` with +// optional fractional seconds. Explicit ranges reject values such as 24:00:00. +// Calendar validity (2026-02-31, 2025-02-29, 2026-04-31) is checked by +// date-fns `parseISO`, which refuses impossible dates that the platform parser +// would silently roll over into another day. +const CURSOR_TIMESTAMP = + /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/u; + +export function encodeCursor(cursor: Cursor): string { + return Buffer.from(JSON.stringify(cursor), 'utf8').toString('base64url'); +} + +export function decodeCursor(value: string, expectedScope: string): Cursor { + try { + const parsed: unknown = JSON.parse( + Buffer.from(value, 'base64url').toString('utf8'), + ); + if ( + typeof parsed !== 'object' || + parsed === null || + !('scope' in parsed) || + !('created_at' in parsed) || + !('id' in parsed) || + typeof parsed.scope !== 'string' || + typeof parsed.created_at !== 'string' || + typeof parsed.id !== 'string' || + parsed.scope !== expectedScope || + !/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu.test( + parsed.id, + ) || + !CURSOR_TIMESTAMP.test(parsed.created_at) + ) + throw new Error('invalid cursor'); + const instant = parseISO(parsed.created_at); + if (!isValid(instant)) throw new Error('invalid cursor'); + + return { + scope: parsed.scope, + created_at: instant.toISOString(), + id: parsed.id, + }; + } catch { + throw new BadRequestException('Invalid cursor'); + } +} diff --git a/app/src/common/http/page.ts b/app/src/common/http/page.ts new file mode 100644 index 00000000..55c9ff8a --- /dev/null +++ b/app/src/common/http/page.ts @@ -0,0 +1,4 @@ +export type Page = { + items: T[]; + next_cursor: string | null; +}; diff --git a/app/src/common/http/request-id.interceptor.ts b/app/src/common/http/request-id.interceptor.ts new file mode 100644 index 00000000..e1ed4d83 --- /dev/null +++ b/app/src/common/http/request-id.interceptor.ts @@ -0,0 +1,59 @@ +import { + CallHandler, + ExecutionContext, + Injectable, + NestInterceptor, +} from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { HttpAdapterHost } from '@nestjs/core'; +import { randomUUID } from 'node:crypto'; +import { finalize, Observable } from 'rxjs'; +import type { AppConfig } from '../../config/app-config.schema.js'; +import { resolveInstanceId } from '../../config/instance-id.js'; +import { MetricsService } from '../../metrics/metrics.service.js'; + +type RequestWithId = { requestId?: string }; + +@Injectable() +export class RequestIdInterceptor implements NestInterceptor { + // Resolved once: the identity must be stable for the whole process lifetime, + // otherwise a client cannot tell whether it moved to another replica. + private readonly instanceId: string; + + constructor( + private readonly adapterHost: HttpAdapterHost, + private readonly metrics: MetricsService, + config: ConfigService, + ) { + this.instanceId = resolveInstanceId(config); + } + + intercept( + context: ExecutionContext, + next: CallHandler, + ): Observable { + const request = context.switchToHttp().getRequest(); + const response = context.switchToHttp().getResponse(); + const requestId = randomUUID(); + const startedAt = performance.now(); + request.requestId = requestId; + this.adapterHost.httpAdapter.setHeader( + response, + 'X-Request-Id', + requestId, + ); + this.adapterHost.httpAdapter.setHeader( + response, + 'X-Instance-Id', + this.instanceId, + ); + this.metrics.increment('request_count'); + return next + .handle() + .pipe( + finalize(() => + this.metrics.observeLatency(performance.now() - startedAt), + ), + ); + } +} diff --git a/app/src/common/validation/code-point-length.spec.ts b/app/src/common/validation/code-point-length.spec.ts new file mode 100644 index 00000000..2daa8306 --- /dev/null +++ b/app/src/common/validation/code-point-length.spec.ts @@ -0,0 +1,43 @@ +import { validate } from 'class-validator'; +import { describe, expect, it } from 'vitest'; +import { CodePointLength } from './code-point-length.js'; + +class Sample { + @CodePointLength(3, 5) + value!: string; +} + +async function fails(value: unknown): Promise { + const sample = new Sample(); + (sample as { value: unknown }).value = value; + const errors = await validate(sample); + return errors.length > 0; +} + +describe('CodePointLength', () => { + it('counts Unicode code points instead of UTF-16 units', async () => { + // '🔐' is one code point but two UTF-16 units. + expect(await fails('🔐🔐')).toBe(true); + expect(await fails('🔐🔐🔐')).toBe(false); + expect(await fails('🔐🔐🔐🔐🔐')).toBe(false); + expect(await fails('🔐🔐🔐🔐🔐🔐')).toBe(true); + // Combining marks are separate code points, not grapheme clusters: + // three 'é' sequences are six code points and exceed the maximum. + expect(await fails('e\u0301e\u0301')).toBe(false); + expect(await fails('e\u0301e\u0301e\u0301')).toBe(true); + }); + + it('applies to BMP text boundaries', async () => { + expect(await fails('ab')).toBe(true); + expect(await fails('abc')).toBe(false); + expect(await fails('abcde')).toBe(false); + expect(await fails('abcdef')).toBe(true); + }); + + it('rejects empty and non-string values', async () => { + expect(await fails('')).toBe(true); + expect(await fails(undefined)).toBe(true); + expect(await fails(12345)).toBe(true); + expect(await fails(['a', 'b', 'c'])).toBe(true); + }); +}); diff --git a/app/src/common/validation/code-point-length.ts b/app/src/common/validation/code-point-length.ts new file mode 100644 index 00000000..5b3fa3ae --- /dev/null +++ b/app/src/common/validation/code-point-length.ts @@ -0,0 +1,38 @@ +import { + registerDecorator, + ValidatorConstraint, + type ValidationArguments, + type ValidatorConstraintInterface, +} from 'class-validator'; + +// JSON Schema (and the course contract) measure string lengths in Unicode code +// points, while String.prototype.length counts UTF-16 units: one emoji outside +// the BMP is two units. `@Length` therefore accepted an 11-emoji password +// (22 units) and rejected 4000 emoji (8000 units), so these fields use an +// explicit code-point validator instead. +@ValidatorConstraint({ name: 'codePointLength', async: false }) +class CodePointLengthConstraint implements ValidatorConstraintInterface { + validate(value: unknown, args: ValidationArguments): boolean { + const [min, max] = args.constraints as [number, number]; + if (typeof value !== 'string') return false; + const length = [...value].length; + return length >= min && length <= max; + } + + defaultMessage(args: ValidationArguments): string { + const [min, max] = args.constraints as [number, number]; + return `${args.property} must be between ${min} and ${max} code points`; + } +} + +export function CodePointLength(min: number, max: number): PropertyDecorator { + return (target, propertyKey) => { + registerDecorator({ + name: 'codePointLength', + target: target.constructor, + propertyName: String(propertyKey), + constraints: [min, max], + validator: CodePointLengthConstraint, + }); + }; +} diff --git a/app/src/config/app-config.module.ts b/app/src/config/app-config.module.ts new file mode 100644 index 00000000..567ea6a7 --- /dev/null +++ b/app/src/config/app-config.module.ts @@ -0,0 +1,16 @@ +import { Global, Module } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; +import { parseAppConfig } from './app-config.schema.js'; + +@Global() +@Module({ + imports: [ + ConfigModule.forRoot({ + isGlobal: true, + cache: true, + validate: parseAppConfig, + }), + ], + exports: [ConfigModule], +}) +export class AppConfigModule {} diff --git a/app/src/config/app-config.schema.ts b/app/src/config/app-config.schema.ts new file mode 100644 index 00000000..2b442333 --- /dev/null +++ b/app/src/config/app-config.schema.ts @@ -0,0 +1,98 @@ +import { readFileSync } from 'node:fs'; +import { z } from 'zod'; + +function numeric( + name: string, + minimum: number, + maximum: number | undefined, + fallback: number, +) { + let schema = z + .number({ message: `${name} must be a number` }) + .int() + .min(minimum); + if (maximum !== undefined) schema = schema.max(maximum); + return z.preprocess( + (value) => + typeof value === 'string' && value.trim() !== '' + ? Number(value) + : value, + schema.default(fallback), + ); +} + +function requiredString(name: string) { + return z + .string({ message: `${name} is required` }) + .min(1, `${name} is required`); +} + +export const appConfigSchema = z + .object({ + APP_HOST: z.string().min(1).default('0.0.0.0'), + APP_PORT: numeric('APP_PORT', 1, 65535, 8080), + APP_ENV: z.string().min(1).default('lab'), + SESSION_TTL_SECONDS: numeric('SESSION_TTL_SECONDS', 2, undefined, 3600), + DATABASE_URL: requiredString('DATABASE_URL'), + REDIS_URL: requiredString('REDIS_URL'), + DATABASE_POOL_MAX: numeric('DATABASE_POOL_MAX', 1, 100, 10), + DATABASE_CONNECTION_TIMEOUT_MS: numeric( + 'DATABASE_CONNECTION_TIMEOUT_MS', + 1, + undefined, + 5000, + ), + DATABASE_STATEMENT_TIMEOUT_MS: numeric( + 'DATABASE_STATEMENT_TIMEOUT_MS', + 1, + undefined, + 5000, + ), + CACHE_TTL_SECONDS: numeric('CACHE_TTL_SECONDS', 1, undefined, 30), + CACHE_MODE: z.enum(['protected', 'naive']).default('protected'), + CACHE_LOCK_TTL_MS: numeric('CACHE_LOCK_TTL_MS', 1, undefined, 1000), + CACHE_MISS_DELAY_MS: numeric('CACHE_MISS_DELAY_MS', 0, undefined, 0), + METRICS_TOKEN: z.string().min(1).optional(), + DRAIN_DELAY_MS: numeric('DRAIN_DELAY_MS', 0, undefined, 5000), + INSTANCE_ID: z.string().min(1).optional(), + IDEMPOTENCY_TTL_SECONDS: numeric( + 'IDEMPOTENCY_TTL_SECONDS', + 60, + undefined, + 86400, + ), + }) + .strip(); + +export type AppConfig = z.infer; +export type AppConfigKey = keyof AppConfig; + +function resolveSecret( + raw: Record, + key: 'DATABASE_URL' | 'REDIS_URL', +): unknown { + const fileKey = `${key}_FILE`; + const path = raw[fileKey]; + if (typeof path !== 'string' || path.length === 0) return raw[key]; + try { + const value = readFileSync(path, 'utf8').trim(); + if (value.length === 0) + throw new Error(`${fileKey} contains an empty value`); + return value; + } catch (error) { + if ( + error instanceof Error && + error.message.includes('contains an empty value') + ) + throw error; + throw new Error(`${fileKey} could not be read`); + } +} + +export function parseAppConfig(raw: Record): AppConfig { + return appConfigSchema.parse({ + ...raw, + DATABASE_URL: resolveSecret(raw, 'DATABASE_URL'), + REDIS_URL: resolveSecret(raw, 'REDIS_URL'), + }); +} diff --git a/app/src/config/instance-id.ts b/app/src/config/instance-id.ts new file mode 100644 index 00000000..e42f2f48 --- /dev/null +++ b/app/src/config/instance-id.ts @@ -0,0 +1,14 @@ +import { randomUUID } from 'node:crypto'; +import { hostname } from 'node:os'; +import type { ConfigService } from '@nestjs/config'; +import type { AppConfig } from './app-config.schema.js'; + +// A replica must be identifiable from the outside. Inside Docker the hostname is +// the short container ID, so X-Instance-Id can be mapped back to exactly one +// container; INSTANCE_ID exists for platforms where that mapping is not useful. +export function resolveInstanceId(config: ConfigService): string { + const configured = config.get('INSTANCE_ID'); + if (configured) return configured; + const host = hostname(); + return host.length > 0 ? host : randomUUID(); +} diff --git a/app/src/database/database.client.ts b/app/src/database/database.client.ts new file mode 100644 index 00000000..98a1c88f --- /dev/null +++ b/app/src/database/database.client.ts @@ -0,0 +1,75 @@ +import { Injectable, Logger, OnModuleDestroy } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import pg from 'pg'; +import { MetricsService } from '../metrics/metrics.service.js'; +import type { AppConfig } from '../config/app-config.schema.js'; + +@Injectable() +export class DatabaseClient implements OnModuleDestroy { + readonly pool: pg.Pool; + private readonly logger = new Logger(DatabaseClient.name); + + constructor( + private readonly config: ConfigService, + private readonly metrics: MetricsService, + ) { + this.pool = new pg.Pool({ + connectionString: this.config.getOrThrow('DATABASE_URL'), + max: this.config.getOrThrow('DATABASE_POOL_MAX'), + connectionTimeoutMillis: this.config.getOrThrow( + 'DATABASE_CONNECTION_TIMEOUT_MS', + ), + statement_timeout: this.config.getOrThrow( + 'DATABASE_STATEMENT_TIMEOUT_MS', + ), + }); + // Idle clients emit 'error' on the pool when the database drops; without a + // listener Node treats it as uncaught and terminates the process. + this.pool.on('error', (error: Error) => { + this.metrics.increment('database.pool_error'); + this.logger.warn(`PostgreSQL pool error: ${error.message}`); + }); + } + + query( + label: string, + text: string, + values: readonly unknown[] = [], + ): Promise> { + this.metrics.increment(label); + return this.pool.query({ text, values: [...values] }); + } + + async health(): Promise { + await this.query('health.database', 'SELECT 1'); + } + + async withTransaction( + work: (client: pg.PoolClient) => Promise, + ): Promise { + const client = await this.pool.connect(); + try { + await client.query('BEGIN'); + const result = await work(client); + await client.query('COMMIT'); + return result; + } catch (error) { + try { + await client.query('ROLLBACK'); + } catch (rollbackError) { + this.metrics.increment('database.rollback_error'); + this.logger.warn( + `Rollback failed: ${rollbackError instanceof Error ? rollbackError.message : 'unknown error'}`, + ); + } + // Callers must see the operation error, not the rollback error. + throw error; + } finally { + client.release(); + } + } + + async onModuleDestroy(): Promise { + await this.pool.end(); + } +} diff --git a/app/src/database/database.module.ts b/app/src/database/database.module.ts new file mode 100644 index 00000000..fe9f0b76 --- /dev/null +++ b/app/src/database/database.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { MetricsModule } from '../metrics/metrics.module.js'; +import { DatabaseClient } from './database.client.js'; + +@Module({ + imports: [MetricsModule], + providers: [DatabaseClient], + exports: [DatabaseClient], +}) +export class DatabaseModule {} diff --git a/app/src/database/migration.runner.ts b/app/src/database/migration.runner.ts new file mode 100644 index 00000000..dfcd5070 --- /dev/null +++ b/app/src/database/migration.runner.ts @@ -0,0 +1,63 @@ +import { readdir, readFile } from 'node:fs/promises'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { DatabaseClient } from './database.client.js'; +import { MetricsService } from '../metrics/metrics.service.js'; +import { parseAppConfig } from '../config/app-config.schema.js'; + +const migrationsDirectory = join( + dirname(fileURLToPath(import.meta.url)), + 'migrations', +); + +async function migrationFiles(): Promise { + const files = await readdir(migrationsDirectory); + return files.filter((file) => /^\d+_.+\.sql$/u.test(file)).sort(); +} + +export async function runMigrations(database: DatabaseClient): Promise { + await database.query( + 'migrations.ensure_table', + `CREATE TABLE IF NOT EXISTS schema_migrations ( + version text PRIMARY KEY, + applied_at timestamptz NOT NULL DEFAULT now() + )`, + ); + + for (const version of await migrationFiles()) { + await database.withTransaction(async (client) => { + const applied = await client.query({ + text: 'SELECT version FROM schema_migrations WHERE version = $1', + values: [version], + }); + if (applied.rowCount) return; + + const sql = await readFile( + join(migrationsDirectory, version), + 'utf8', + ); + await client.query(sql); + await client.query({ + text: 'INSERT INTO schema_migrations (version) VALUES ($1)', + values: [version], + }); + }); + } +} + +async function main(): Promise { + const config = parseAppConfig(process.env as Record); + const database = new DatabaseClient( + { + getOrThrow: (key: keyof typeof config) => config[key], + } as never, + new MetricsService(), + ); + try { + await runMigrations(database); + } finally { + await database.onModuleDestroy(); + } +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) await main(); diff --git a/app/src/database/migrations/001_initial.sql b/app/src/database/migrations/001_initial.sql new file mode 100644 index 00000000..19225298 --- /dev/null +++ b/app/src/database/migrations/001_initial.sql @@ -0,0 +1,41 @@ +CREATE TABLE IF NOT EXISTS schema_migrations ( + version text PRIMARY KEY, + applied_at timestamptz NOT NULL DEFAULT now() +); + +CREATE TABLE IF NOT EXISTS users ( + id uuid PRIMARY KEY, + username text NOT NULL UNIQUE, + display_name text NOT NULL, + password_hash text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now() +); + +CREATE TABLE IF NOT EXISTS chats ( + id uuid PRIMARY KEY, + title text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now(), + message_version bigint NOT NULL DEFAULT 0 +); + +CREATE TABLE IF NOT EXISTS chat_members ( + chat_id uuid NOT NULL REFERENCES chats(id) ON DELETE CASCADE, + user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE, + PRIMARY KEY (chat_id, user_id) +); + +CREATE TABLE IF NOT EXISTS messages ( + id uuid PRIMARY KEY, + chat_id uuid NOT NULL REFERENCES chats(id) ON DELETE CASCADE, + sender_id uuid NOT NULL REFERENCES users(id) ON DELETE RESTRICT, + text text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now(), + CONSTRAINT messages_sender_member_fk + FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id) + ON DELETE RESTRICT +); + +CREATE INDEX IF NOT EXISTS messages_chat_created_id_idx + ON messages (chat_id, created_at, id); +CREATE INDEX IF NOT EXISTS chat_members_user_chat_idx + ON chat_members (user_id, chat_id); diff --git a/app/src/database/migrations/002_timestamp_precision.sql b/app/src/database/migrations/002_timestamp_precision.sql new file mode 100644 index 00000000..e084dc68 --- /dev/null +++ b/app/src/database/migrations/002_timestamp_precision.sql @@ -0,0 +1,5 @@ +-- HTTP timestamps and keyset cursors use JavaScript millisecond precision. +-- Store the same precision so a returned cursor cannot point before its own row. +ALTER TABLE users ALTER COLUMN created_at TYPE timestamptz(3); +ALTER TABLE chats ALTER COLUMN created_at TYPE timestamptz(3); +ALTER TABLE messages ALTER COLUMN created_at TYPE timestamptz(3); diff --git a/app/src/database/migrations/003_idempotency_keys.sql b/app/src/database/migrations/003_idempotency_keys.sql new file mode 100644 index 00000000..aad214df --- /dev/null +++ b/app/src/database/migrations/003_idempotency_keys.sql @@ -0,0 +1,20 @@ +-- Shared idempotency ledger for POST /api/v1/chats/{id}/messages. +-- The key scope is (user, method, path, key): the same key from another user or +-- another chat is independent, as the contract requires. +-- claim + response are committed in one transaction, so a committed row always +-- carries status_code and response_body (there is no "poisoned" intermediate state). +CREATE TABLE IF NOT EXISTS idempotency_keys ( + user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE, + method text NOT NULL, + path text NOT NULL, + key text NOT NULL, + request_fingerprint text NOT NULL, + status_code integer, + response_body jsonb, + message_id uuid, + created_at timestamptz NOT NULL DEFAULT now(), + PRIMARY KEY (user_id, method, path, key) +); + +CREATE INDEX IF NOT EXISTS idempotency_keys_created_at_idx + ON idempotency_keys (created_at); diff --git a/app/src/database/migrations/004_pg_stat_statements.sql b/app/src/database/migrations/004_pg_stat_statements.sql new file mode 100644 index 00000000..c70da499 --- /dev/null +++ b/app/src/database/migrations/004_pg_stat_statements.sql @@ -0,0 +1,9 @@ +-- Instrumentation for the scaling experiments. pg_stat_statements only works +-- when the server is started with shared_preload_libraries=pg_stat_statements +-- (compose.yaml does that); without the preload the CREATE fails with a plain +-- notice, so a database started without the preload still migrates cleanly. +DO $$ BEGIN + CREATE EXTENSION IF NOT EXISTS pg_stat_statements; +EXCEPTION WHEN OTHERS THEN + RAISE NOTICE 'pg_stat_statements unavailable: %', SQLERRM; +END $$; diff --git a/app/src/health/health.controller.ts b/app/src/health/health.controller.ts new file mode 100644 index 00000000..f297b64c --- /dev/null +++ b/app/src/health/health.controller.ts @@ -0,0 +1,17 @@ +import { Controller, Get } from '@nestjs/common'; +import { HealthService } from './health.service.js'; + +@Controller('health') +export class HealthController { + constructor(private readonly healthService: HealthService) {} + + @Get('live') + getLive() { + return this.healthService.getLiveness(); + } + + @Get('ready') + async getReady() { + return this.healthService.getReadiness(); + } +} diff --git a/app/src/health/health.module.ts b/app/src/health/health.module.ts new file mode 100644 index 00000000..e5b0ac3f --- /dev/null +++ b/app/src/health/health.module.ts @@ -0,0 +1,13 @@ +import { Module } from '@nestjs/common'; +import { HealthController } from './health.controller.js'; +import { LbCheckController } from './lb-check.controller.js'; +import { HealthService } from './health.service.js'; +import { DatabaseModule } from '../database/database.module.js'; +import { RedisModule } from '../redis/redis.module.js'; + +@Module({ + imports: [DatabaseModule, RedisModule], + controllers: [HealthController, LbCheckController], + providers: [HealthService], +}) +export class HealthModule {} diff --git a/app/src/health/health.service.spec.ts b/app/src/health/health.service.spec.ts new file mode 100644 index 00000000..d4b0b6db --- /dev/null +++ b/app/src/health/health.service.spec.ts @@ -0,0 +1,57 @@ +import { describe, expect, it, vi } from 'vitest'; +import { ServiceUnavailableException } from '@nestjs/common'; +import { HealthService } from './health.service.js'; + +describe('HealthService', () => { + it('reports liveness and readiness when dependencies are healthy', async () => { + const database = { health: vi.fn().mockResolvedValue(undefined) }; + const redis = { health: vi.fn().mockResolvedValue(undefined) }; + const config = { get: vi.fn().mockReturnValue(0) }; + const service = new HealthService( + database as never, + redis as never, + config as never, + ); + expect(service.getLiveness()).toEqual({ status: 'ok' }); + await expect(service.getReadiness()).resolves.toEqual({ status: 'ok' }); + }); + + it('rejects readiness when a dependency is unavailable', async () => { + const database = { + health: vi.fn().mockRejectedValue(new Error('down')), + }; + const redis = { health: vi.fn().mockResolvedValue(undefined) }; + const service = new HealthService( + database as never, + redis as never, + { get: vi.fn() } as never, + ); + await expect(service.getReadiness()).rejects.toBeInstanceOf( + ServiceUnavailableException, + ); + }); + + it('keeps liveness healthy while draining', async () => { + const service = new HealthService( + { health: vi.fn() } as never, + { health: vi.fn() } as never, + { get: vi.fn() } as never, + ); + service.setDraining(); + expect(service.getLiveness()).toEqual({ status: 'ok' }); + await expect(service.getReadiness()).rejects.toThrow( + 'Service is shutting down', + ); + }); + + it('keeps the load-balancer check positive while a dependency is down', async () => { + const service = new HealthService( + { health: vi.fn().mockRejectedValue(new Error('down')) } as never, + { health: vi.fn().mockRejectedValue(new Error('down')) } as never, + { get: vi.fn() } as never, + ); + expect(service.getLbCheck()).toEqual({ status: 'ok' }); + service.setDraining(); + expect(() => service.getLbCheck()).toThrow('Draining'); + }); +}); diff --git a/app/src/health/health.service.ts b/app/src/health/health.service.ts new file mode 100644 index 00000000..173ca996 --- /dev/null +++ b/app/src/health/health.service.ts @@ -0,0 +1,57 @@ +import { + Global, + Injectable, + Module, + ServiceUnavailableException, +} from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { DatabaseClient } from '../database/database.client.js'; +import { RedisClient } from '../redis/redis.client.js'; +import type { AppConfig } from '../config/app-config.schema.js'; + +@Injectable() +export class HealthService { + private ready = true; + constructor( + private readonly database: DatabaseClient, + private readonly redis: RedisClient, + private readonly config: ConfigService, + ) {} + getLiveness() { + return { status: 'ok' as const }; + } + // Load-balancer probe, deliberately independent of PostgreSQL and Redis: a + // shared dependency outage cannot be fixed by removing replicas from + // rotation, and draining every backend would answer clients with the LB's + // own HTML error page instead of the bounded API 503. /health/ready stays + // the operator-facing readiness signal. + getLbCheck() { + if (!this.ready) + throw new ServiceUnavailableException('Draining'); + return { status: 'ok' as const }; + } + async getReadiness() { + if (!this.ready) + throw new ServiceUnavailableException('Service is shutting down'); + try { + await Promise.all([this.database.health(), this.redis.health()]); + } catch { + throw new ServiceUnavailableException('Dependencies unavailable'); + } + return { status: 'ok' as const }; + } + setDraining() { + this.ready = false; + } + async beforeApplicationShutdown(signal?: string): Promise { + this.setDraining(); + const delay = this.config.get('DRAIN_DELAY_MS') ?? 5000; + if (signal && delay > 0) { + await new Promise((resolve) => setTimeout(resolve, delay)); + } + } +} + +@Global() +@Module({ providers: [HealthService], exports: [HealthService] }) +export class HealthServiceModule {} diff --git a/app/src/health/lb-check.controller.ts b/app/src/health/lb-check.controller.ts new file mode 100644 index 00000000..6ec3c4de --- /dev/null +++ b/app/src/health/lb-check.controller.ts @@ -0,0 +1,14 @@ +import { Controller, Get } from '@nestjs/common'; +import { HealthService } from './health.service.js'; + +// The load balancer probes this route instead of /health/ready so that a shared +// database outage cannot drain the whole fleet; see HealthService.getLbCheck. +@Controller('internal') +export class LbCheckController { + constructor(private readonly health: HealthService) {} + + @Get('lb-check') + check() { + return this.health.getLbCheck(); + } +} diff --git a/app/src/main.ts b/app/src/main.ts new file mode 100644 index 00000000..e621425f --- /dev/null +++ b/app/src/main.ts @@ -0,0 +1,40 @@ +import { NestFactory } from '@nestjs/core'; +import { HttpAdapterHost } from '@nestjs/core'; +import { ConfigService } from '@nestjs/config'; +import { ValidationPipe } from '@nestjs/common'; +import { + FastifyAdapter, + NestFastifyApplication, +} from '@nestjs/platform-fastify'; +import { AppModule } from './app.module.js'; +import { MetricsService } from './metrics/metrics.service.js'; +import { RequestIdInterceptor } from './common/http/request-id.interceptor.js'; + +async function bootstrap(): Promise { + const app = await NestFactory.create( + AppModule, + new FastifyAdapter({ logger: true }), + ); + app.useGlobalInterceptors( + new RequestIdInterceptor( + app.get(HttpAdapterHost), + app.get(MetricsService), + app.get(ConfigService), + ), + ); + app.useGlobalPipes( + new ValidationPipe({ + whitelist: true, + forbidNonWhitelisted: true, + transform: true, + }), + ); + app.enableShutdownHooks(); + + const config = app.get(ConfigService); + const port = config.getOrThrow('APP_PORT'); + const host = config.getOrThrow('APP_HOST'); + await app.listen(port, host); +} + +await bootstrap(); diff --git a/app/src/messages/cache/messages-cache.metrics.spec.ts b/app/src/messages/cache/messages-cache.metrics.spec.ts new file mode 100644 index 00000000..13da19e1 --- /dev/null +++ b/app/src/messages/cache/messages-cache.metrics.spec.ts @@ -0,0 +1,37 @@ +import { ConfigService } from '@nestjs/config'; +import { describe, expect, it, vi } from 'vitest'; +import { MetricsService } from '../../metrics/metrics.service.js'; +import { MessagesCacheService } from './messages-cache.service.js'; + +describe('MessagesCacheService metrics', () => { + it('records a miss and a hit for a protected page fill', async () => { + const metrics = new MetricsService(); + const page = { items: [], next_cursor: null }; + const redis = { + get: vi + .fn() + .mockResolvedValueOnce(null) + .mockResolvedValueOnce(null) + .mockResolvedValue(JSON.stringify(page)), + setNxPx: vi.fn().mockResolvedValue(true), + set: vi.fn().mockResolvedValue('OK'), + unlock: vi.fn().mockResolvedValue(1), + }; + const config = new ConfigService({ + CACHE_MODE: 'protected', + CACHE_LOCK_TTL_MS: 1000, + CACHE_TTL_SECONDS: 30, + }); + const service = new MessagesCacheService( + redis as never, + config, + metrics, + ); + await service.getOrLoad('chat', 1n, undefined, 50, async () => page); + await service.getOrLoad('chat', 1n, undefined, 50, async () => page); + expect(metrics.snapshot().counters).toMatchObject({ + cache_miss: 1, + cache_hit: 1, + }); + }); +}); diff --git a/app/src/messages/cache/messages-cache.module.ts b/app/src/messages/cache/messages-cache.module.ts new file mode 100644 index 00000000..f1cfddfe --- /dev/null +++ b/app/src/messages/cache/messages-cache.module.ts @@ -0,0 +1,11 @@ +import { Module } from '@nestjs/common'; +import { MessagesCacheService } from './messages-cache.service.js'; +import { MetricsModule } from '../../metrics/metrics.module.js'; +import { RedisModule } from '../../redis/redis.module.js'; + +@Module({ + imports: [RedisModule, MetricsModule], + providers: [MessagesCacheService], + exports: [MessagesCacheService], +}) +export class MessagesCacheModule {} diff --git a/app/src/messages/cache/messages-cache.service.spec.ts b/app/src/messages/cache/messages-cache.service.spec.ts new file mode 100644 index 00000000..c4053491 --- /dev/null +++ b/app/src/messages/cache/messages-cache.service.spec.ts @@ -0,0 +1,72 @@ +import { ConfigService } from '@nestjs/config'; +import { describe, expect, it, vi } from 'vitest'; +import type { AppConfig } from '../../config/app-config.schema.js'; +import type { RedisClient } from '../../redis/redis.client.js'; +import { MessagesCacheService } from './messages-cache.service.js'; +import { MetricsService } from '../../metrics/metrics.service.js'; + +function serviceWithRedis(redis: Partial): MessagesCacheService { + const config = new ConfigService({ + CACHE_MODE: 'protected', + CACHE_LOCK_TTL_MS: 1000, + CACHE_TTL_SECONDS: 30, + CACHE_MISS_DELAY_MS: 0, + }); + return new MessagesCacheService( + redis as RedisClient, + config, + new MetricsService(), + ); +} + +describe('MessagesCacheService fallback', () => { + it('loads from the authoritative source when Redis read fails', async () => { + const load = vi + .fn() + .mockResolvedValue({ items: [{ id: 'db' }], next_cursor: null }); + const service = serviceWithRedis({ + get: vi.fn().mockRejectedValue(new Error('redis down')), + }); + + await expect( + service.getOrLoad('chat', 1n, undefined, 50, load), + ).resolves.toEqual({ + items: [{ id: 'db' }], + next_cursor: null, + }); + expect(load).toHaveBeenCalledOnce(); + }); + + it('falls back after bounded lock contention', async () => { + const load = vi + .fn() + .mockResolvedValue({ items: [{ id: 'db' }], next_cursor: null }); + const service = serviceWithRedis({ + get: vi.fn().mockResolvedValue(null), + setNxPx: vi.fn().mockResolvedValue(false), + }); + + await expect( + service.getOrLoad('chat', 1n, undefined, 50, load), + ).resolves.toEqual({ + items: [{ id: 'db' }], + next_cursor: null, + }); + expect(load).toHaveBeenCalledOnce(); + }); + + it('returns the authoritative page when cache write fails', async () => { + const page = { items: [{ id: 'db' }], next_cursor: null }; + const load = vi.fn().mockResolvedValue(page); + const service = serviceWithRedis({ + get: vi.fn().mockResolvedValue(null), + setNxPx: vi.fn().mockResolvedValue(true), + set: vi.fn().mockRejectedValue(new Error('redis down')), + unlock: vi.fn().mockResolvedValue(1), + }); + + await expect( + service.getOrLoad('chat', 1n, undefined, 50, load), + ).resolves.toEqual(page); + }); +}); diff --git a/app/src/messages/cache/messages-cache.service.ts b/app/src/messages/cache/messages-cache.service.ts new file mode 100644 index 00000000..565c17c4 --- /dev/null +++ b/app/src/messages/cache/messages-cache.service.ts @@ -0,0 +1,205 @@ +import { Injectable, Logger } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { setTimeout as delay } from 'node:timers/promises'; +import type { AppConfig } from '../../config/app-config.schema.js'; +import { RedisClient } from '../../redis/redis.client.js'; +import type { Page } from '../../common/http/page.js'; +import { MetricsService } from '../../metrics/metrics.service.js'; + +const LOCK_RETRY_COUNT = 4; +const LOCK_RETRY_DELAY_MS = 25; + +export type CachePage = Page; + +@Injectable() +export class MessagesCacheService { + private readonly logger = new Logger(MessagesCacheService.name); + + constructor( + private readonly redis: RedisClient, + private readonly config: ConfigService, + private readonly metrics: MetricsService, + ) {} + + async getOrLoad( + chatId: string, + version: bigint, + cursor: string | undefined, + limit: number, + loader: () => Promise, + ): Promise { + const key = this.cacheKey(chatId, version, cursor, limit); + if (this.config.getOrThrow('CACHE_MODE') === 'naive') { + return this.loadNaively(key, loader); + } + + let cached: string | null; + try { + cached = await this.redis.get(key); + } catch (error) { + return this.fallbackToDatabase('read', error, loader); + } + const cachedPage = this.parsePage(cached); + if (cachedPage) { + this.metrics.increment('cache_hit'); + return cachedPage; + } + this.metrics.increment('cache_miss'); + + const lockKey = `lock:${key}`; + const owner = `${process.pid}:${Math.random().toString(36).slice(2)}`; + for (let attempt = 0; attempt < LOCK_RETRY_COUNT; attempt += 1) { + let locked: boolean; + try { + locked = await this.redis.setNxPx( + lockKey, + owner, + this.config.getOrThrow('CACHE_LOCK_TTL_MS'), + ); + } catch (error) { + return this.fallbackToDatabase('lock', error, loader); + } + if (locked) return this.fillLocked(key, lockKey, owner, loader); + + if (attempt === 0) this.metrics.increment('cache_lock_wait'); + try { + const waitedPage = this.parsePage(await this.redis.get(key)); + if (waitedPage) { + this.metrics.increment('cache_hit'); + return waitedPage; + } + } catch (error) { + return this.fallbackToDatabase('waiting read', error, loader); + } + await delay(LOCK_RETRY_DELAY_MS); + } + + // The owner did not publish the page within the bounded wait: serve the + // authoritative result instead of blocking the request further. + this.metrics.increment('cache_lock_timeout'); + return loader(); + } + + private async fillLocked( + key: string, + lockKey: string, + owner: string, + loader: () => Promise, + ): Promise { + try { + let secondCheck: string | null; + try { + secondCheck = await this.redis.get(key); + } catch (error) { + return this.fallbackToDatabase('double-check', error, loader); + } + const secondPage = this.parsePage(secondCheck); + if (secondPage) { + this.metrics.increment('cache_hit'); + return secondPage; + } + + const page = await loader(); + try { + await this.redis.set(key, JSON.stringify(page), { + EX: this.config.getOrThrow('CACHE_TTL_SECONDS'), + }); + } catch (error) { + // Redis is derived state: the page is still valid for this response, + // but the failure must stay visible in metrics and logs. + this.metrics.increment('cache_write_error'); + this.logger.warn( + `Cache fill failed: ${error instanceof Error ? error.message : 'unknown error'}`, + ); + } + return page; + } finally { + try { + await this.redis.unlock(lockKey, owner); + } catch (error) { + // The lock has a TTL, so a stale lock expires on its own; a successful + // response must not be replaced by an unlock failure. + this.metrics.increment('cache_unlock_error'); + this.logger.warn( + `Cache unlock failed: ${error instanceof Error ? error.message : 'unknown error'}`, + ); + } + } + } + + private cacheKey( + chatId: string, + version: bigint, + cursor: string | undefined, + limit: number, + ): string { + return `messages:${chatId}:v${version.toString()}:c${cursor ?? 'start'}:l${limit}`; + } + + private async loadNaively( + key: string, + loader: () => Promise, + ): Promise { + let cached: string | null; + try { + cached = await this.redis.get(key); + } catch (error) { + return this.fallbackToDatabase('naive read', error, loader); + } + const cachedPage = this.parsePage(cached); + if (cachedPage) { + this.metrics.increment('cache_hit'); + return cachedPage; + } + this.metrics.increment('cache_miss'); + + const cacheMissDelay = this.config.getOrThrow('CACHE_MISS_DELAY_MS'); + if (cacheMissDelay > 0) await delay(cacheMissDelay); + const page = await loader(); + try { + await this.redis.set(key, JSON.stringify(page), { + EX: this.config.getOrThrow('CACHE_TTL_SECONDS'), + }); + } catch (error) { + this.metrics.increment('cache_write_error'); + this.logger.warn( + `Cache fill failed: ${error instanceof Error ? error.message : 'unknown error'}`, + ); + } + return page; + } + + private async fallbackToDatabase( + stage: string, + error: unknown, + loader: () => Promise, + ): Promise { + this.metrics.increment('cache_fallback'); + this.logger.warn( + `Cache ${stage} failed, serving PostgreSQL: ${error instanceof Error ? error.message : 'unknown error'}`, + ); + return loader(); + } + + private parsePage(value: string | null): CachePage | undefined { + if (!value) return undefined; + try { + const parsed: unknown = JSON.parse(value); + if ( + typeof parsed !== 'object' || + parsed === null || + !('items' in parsed) || + !('next_cursor' in parsed) || + !Array.isArray(parsed.items) || + (parsed.next_cursor !== null && + typeof parsed.next_cursor !== 'string') + ) + return undefined; + return { items: parsed.items, next_cursor: parsed.next_cursor }; + } catch { + // A malformed entry is treated as a miss and overwritten by the owner fill. + this.metrics.increment('cache_corrupt_entry'); + return undefined; + } + } +} diff --git a/app/src/messages/dto/create-message.dto.ts b/app/src/messages/dto/create-message.dto.ts new file mode 100644 index 00000000..57e5be26 --- /dev/null +++ b/app/src/messages/dto/create-message.dto.ts @@ -0,0 +1,8 @@ +import { IsString } from 'class-validator'; +import { CodePointLength } from '../../common/validation/code-point-length.js'; + +export class CreateMessageDto { + @IsString() + @CodePointLength(1, 4000) + text!: string; +} diff --git a/app/src/messages/idempotency/idempotency-gc.cli.ts b/app/src/messages/idempotency/idempotency-gc.cli.ts new file mode 100644 index 00000000..7ab0da55 --- /dev/null +++ b/app/src/messages/idempotency/idempotency-gc.cli.ts @@ -0,0 +1,33 @@ +import { fileURLToPath } from 'node:url'; +import { parseAppConfig } from '../../config/app-config.schema.js'; +import { DatabaseClient } from '../../database/database.client.js'; +import { MetricsService } from '../../metrics/metrics.service.js'; +import { IdempotencyRepository } from './idempotency.repository.js'; + +// Manual operator pass over the idempotency ledger: the API also purges expired +// claims in the background, but an operator must be able to reclaim space +// without waiting for traffic. It never touches unexpired claims. +// in the stand: docker compose exec api node dist/messages/idempotency/idempotency-gc.cli.js +// on the host: npm run idempotency:gc (needs a reachable DATABASE_URL) +async function main(): Promise { + const config = parseAppConfig(process.env as Record); + const database = new DatabaseClient( + { + getOrThrow: (key: keyof typeof config) => config[key], + } as never, + new MetricsService(), + ); + try { + const repository = new IdempotencyRepository(database); + const purged = await repository.purgeExpired( + config.IDEMPOTENCY_TTL_SECONDS, + ); + process.stdout.write( + `Purged ${purged} idempotency key(s) older than ${config.IDEMPOTENCY_TTL_SECONDS} seconds\n`, + ); + } finally { + await database.onModuleDestroy(); + } +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) await main(); diff --git a/app/src/messages/idempotency/idempotency.module.ts b/app/src/messages/idempotency/idempotency.module.ts new file mode 100644 index 00000000..33c8a329 --- /dev/null +++ b/app/src/messages/idempotency/idempotency.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { DatabaseModule } from '../../database/database.module.js'; +import { IdempotencyRepository } from './idempotency.repository.js'; + +@Module({ + imports: [DatabaseModule], + providers: [IdempotencyRepository], + exports: [IdempotencyRepository], +}) +export class IdempotencyModule {} diff --git a/app/src/messages/idempotency/idempotency.repository.ts b/app/src/messages/idempotency/idempotency.repository.ts new file mode 100644 index 00000000..79221398 --- /dev/null +++ b/app/src/messages/idempotency/idempotency.repository.ts @@ -0,0 +1,152 @@ +import { Injectable } from '@nestjs/common'; +import type pg from 'pg'; +import { DatabaseClient } from '../../database/database.client.js'; +import type { Message } from '../message.js'; + +// A committed row always carries the response: the claim and the stored response +// are written in the same transaction, so there is no poisoned intermediate +// state to re-check at replay time. +export type IdempotencyRecord = { + request_fingerprint: string; + status_code: number; + response_body: Message; + created_at: Date | string; + expired: boolean; +}; + +const PURGE_BATCH_LIMIT = 1000; +const PURGE_BATCHES = 10; + +@Injectable() +export class IdempotencyRepository { + constructor(private readonly database: DatabaseClient) {} + + /** True when this request created the claim, i.e. it owns the side effect. */ + async claim( + client: pg.PoolClient, + userId: string, + path: string, + key: string, + fingerprint: string, + ): Promise { + const result = await client.query({ + text: `INSERT INTO idempotency_keys (user_id, method, path, key, request_fingerprint) + VALUES ($1, 'POST', $2, $3, $4) + ON CONFLICT DO NOTHING + RETURNING created_at`, + values: [userId, path, key, fingerprint], + }); + return result.rowCount === 1; + } + + async read( + client: pg.PoolClient, + userId: string, + path: string, + key: string, + ttlSeconds: number, + ): Promise { + const result = await client.query({ + text: `SELECT request_fingerprint, status_code, response_body, created_at, + created_at < now() - make_interval(secs => $4::double precision) AS expired + FROM idempotency_keys + WHERE user_id = $1 AND method = 'POST' AND path = $2 AND key = $3`, + values: [userId, path, key, ttlSeconds], + }); + return result.rows[0]; + } + + async store( + client: pg.PoolClient, + userId: string, + path: string, + key: string, + statusCode: number, + message: Message, + ): Promise { + await client.query({ + text: `UPDATE idempotency_keys + SET status_code = $4, response_body = $5::jsonb, message_id = $6 + WHERE user_id = $1 AND method = 'POST' AND path = $2 AND key = $3`, + values: [ + userId, + path, + key, + statusCode, + JSON.stringify(message), + message.id, + ], + }); + } + + async forget( + client: pg.PoolClient, + userId: string, + path: string, + key: string, + ): Promise { + await client.query({ + text: `DELETE FROM idempotency_keys + WHERE user_id = $1 AND method = 'POST' AND path = $2 AND key = $3`, + values: [userId, path, key], + }); + } + + async isMember( + client: pg.PoolClient, + chatId: string, + userId: string, + ): Promise { + const result = await client.query<{ is_member: boolean }>({ + text: `SELECT EXISTS ( + SELECT 1 FROM chat_members WHERE chat_id = $1 AND user_id = $2 + ) AS is_member`, + values: [chatId, userId], + }); + return result.rows[0]?.is_member === true; + } + + /** + * Deletes expired claims in bounded batches. The transaction-scoped advisory + * lock makes the pass single-flight across replicas without risking a lock + * leaking back into the pool with a released connection. Returns the number + * of deleted rows (0 when another replica is purging). + */ + async purgeExpired(ttlSeconds: number): Promise { + const client = await this.database.pool.connect(); + try { + await client.query('BEGIN'); + try { + const lock = await client.query<{ locked: boolean }>( + "SELECT pg_try_advisory_xact_lock(hashtext('idempotency_gc')) AS locked", + ); + if (lock.rows[0]?.locked !== true) { + await client.query('ROLLBACK'); + return 0; + } + let purged = 0; + for (let batch = 0; batch < PURGE_BATCHES; batch += 1) { + const result = await client.query({ + text: `DELETE FROM idempotency_keys + WHERE ctid IN ( + SELECT ctid FROM idempotency_keys + WHERE created_at < now() - make_interval(secs => $1::double precision) + LIMIT ${PURGE_BATCH_LIMIT} + )`, + values: [ttlSeconds], + }); + const deleted = result.rowCount ?? 0; + purged += deleted; + if (deleted < PURGE_BATCH_LIMIT) break; + } + await client.query('COMMIT'); + return purged; + } catch (error) { + await client.query('ROLLBACK').catch(() => undefined); + throw error; + } + } finally { + client.release(); + } + } +} diff --git a/app/src/messages/idempotency/idempotency.ts b/app/src/messages/idempotency/idempotency.ts new file mode 100644 index 00000000..9c3d0474 --- /dev/null +++ b/app/src/messages/idempotency/idempotency.ts @@ -0,0 +1,18 @@ +import { createHash } from 'node:crypto'; +import type { CreateMessageDto } from '../dto/create-message.dto.js'; + +// Contract: ASCII [A-Za-z0-9._:-]{1,128}. Anything else (including a duplicated +// header, which Fastify joins with ", ") is rejected as a client error. +export const IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9._:-]{1,128}$/; + +export function messagesPath(chatId: string): string { + return `/api/v1/chats/${chatId}/messages`; +} + +// The fingerprint is derived from the validated payload with a fixed field +// order, so neither JSON key order nor an absent optional field can change it. +export function idempotencyFingerprint(input: CreateMessageDto): string { + return createHash('sha256') + .update(JSON.stringify({ text: input.text })) + .digest('hex'); +} diff --git a/app/src/messages/message.ts b/app/src/messages/message.ts new file mode 100644 index 00000000..1fd5bfe8 --- /dev/null +++ b/app/src/messages/message.ts @@ -0,0 +1,7 @@ +export type Message = { + id: string; + chat_id: string; + sender_id: string; + text: string; + created_at: string; +}; diff --git a/app/src/messages/messages.controller.ts b/app/src/messages/messages.controller.ts new file mode 100644 index 00000000..a4fcdb14 --- /dev/null +++ b/app/src/messages/messages.controller.ts @@ -0,0 +1,53 @@ +import { + BadRequestException, + Body, + Controller, + DefaultValuePipe, + Get, + Headers, + Param, + ParseIntPipe, + ParseUUIDPipe, + Post, + Query, + UseGuards, +} from '@nestjs/common'; +import { CurrentUser } from '../common/auth/current-user.decorator.js'; +import { CurrentUserGuard } from '../common/auth/current-user.guard.js'; +import type { User } from '../users/user.js'; +import { CreateMessageDto } from './dto/create-message.dto.js'; +import { MessagesService } from './messages.service.js'; + +@Controller('api/v1/chats/:chatId/messages') +@UseGuards(CurrentUserGuard) +export class MessagesController { + constructor(private readonly messagesService: MessagesService) {} + + @Post() + create( + @Param('chatId', new ParseUUIDPipe()) chatId: string, + @Body() body: CreateMessageDto, + @CurrentUser() currentUser: User, + @Headers('idempotency-key') idempotencyKey?: string | string[], + ) { + return this.messagesService.create( + chatId, + body, + currentUser, + idempotencyKey, + ); + } + + @Get() + list( + @Param('chatId', new ParseUUIDPipe()) chatId: string, + @CurrentUser() currentUser: User, + @Query('limit', new DefaultValuePipe(50), new ParseIntPipe()) + limit: number, + @Query('cursor') cursor?: string, + ) { + if (limit < 1 || limit > 100) + throw new BadRequestException('limit must be between 1 and 100'); + return this.messagesService.list(chatId, currentUser, limit, cursor); + } +} diff --git a/app/src/messages/messages.module.ts b/app/src/messages/messages.module.ts new file mode 100644 index 00000000..df803a01 --- /dev/null +++ b/app/src/messages/messages.module.ts @@ -0,0 +1,26 @@ +import { Module } from '@nestjs/common'; +import { DatabaseModule } from '../database/database.module.js'; +import { ChatsModule } from '../chats/chats.module.js'; +import { MessagesController } from './messages.controller.js'; +import { MessagesRepository } from './messages.repository.js'; +import { MessagesService } from './messages.service.js'; +import { MessagesCacheModule } from './cache/messages-cache.module.js'; +import { IdempotencyModule } from './idempotency/idempotency.module.js'; +import { UsersModule } from '../users/users.module.js'; +import { RedisModule } from '../redis/redis.module.js'; +import { MetricsModule } from '../metrics/metrics.module.js'; + +@Module({ + imports: [ + ChatsModule, + MessagesCacheModule, + IdempotencyModule, + DatabaseModule, + UsersModule, + RedisModule, + MetricsModule, + ], + controllers: [MessagesController], + providers: [MessagesRepository, MessagesService], +}) +export class MessagesModule {} diff --git a/app/src/messages/messages.repository.spec.ts b/app/src/messages/messages.repository.spec.ts new file mode 100644 index 00000000..ff217026 --- /dev/null +++ b/app/src/messages/messages.repository.spec.ts @@ -0,0 +1,47 @@ +import { describe, expect, it, vi } from 'vitest'; +import type { Cursor } from '../common/http/cursor.js'; +import type { Message } from './message.js'; +import { MessagesRepository } from './messages.repository.js'; + +const message = (id: string, created_at: string): Message => ({ + id, + chat_id: 'chat', + sender_id: 'sender', + text: id, + created_at, +}); + +describe('MessagesRepository', () => { + it('uses named SQL history and a keyset cursor', async () => { + const query = vi.fn().mockResolvedValue({ rows: [], rowCount: 0 }); + const repository = new MessagesRepository({ + query, + withTransaction: vi.fn(), + } as never); + const cursor: Cursor = { + scope: 'messages:chat', + created_at: '2026-01-01T00:00:01.000Z', + id: '1', + }; + await repository.findPage('chat', 10, cursor); + expect(query).toHaveBeenCalledWith( + 'messages.history', + expect.stringContaining('(created_at, id) >'), + expect.arrayContaining(['chat', cursor.created_at, cursor.id, 11]), + ); + }); + + it('returns rows in response shape', async () => { + const query = vi + .fn() + .mockResolvedValue({ + rows: [message('1', '2026-01-01T00:00:00.000Z')], + rowCount: 1, + }); + const repository = new MessagesRepository({ query } as never); + await expect(repository.findPage('chat', 1)).resolves.toEqual({ + items: [message('1', '2026-01-01T00:00:00.000Z')], + hasMore: false, + }); + }); +}); diff --git a/app/src/messages/messages.repository.ts b/app/src/messages/messages.repository.ts new file mode 100644 index 00000000..75c84aa3 --- /dev/null +++ b/app/src/messages/messages.repository.ts @@ -0,0 +1,93 @@ +import { + Injectable, + NotFoundException, +} from '@nestjs/common'; +import { randomUUID } from 'node:crypto'; +import type pg from 'pg'; +import { DatabaseClient } from '../database/database.client.js'; +import type { Cursor } from '../common/http/cursor.js'; +import type { Message } from './message.js'; + +type MessageRow = { + id: string; + chat_id: string; + sender_id: string; + text: string; + created_at: Date | string; +}; + +function toMessage(row: MessageRow): Message { + return { + id: row.id, + chat_id: row.chat_id, + sender_id: row.sender_id, + text: row.text, + created_at: new Date(row.created_at).toISOString(), + }; +} + +@Injectable() +export class MessagesRepository { + constructor(private readonly database: DatabaseClient) {} + + // The caller owns the transaction: the message insert, the chat version bump + // and the idempotency claim must commit or roll back as one unit. + async create( + client: pg.PoolClient, + chatId: string, + senderId: string, + text: string, + ): Promise { + const id = randomUUID(); + const membership = await client.query({ + name: 'messages.checkMembership', + text: 'SELECT 1 FROM chat_members WHERE chat_id = $1 AND user_id = $2', + values: [chatId, senderId], + }); + if (!membership.rowCount) throw new NotFoundException(); + const result = await client.query({ + name: 'messages.insert', + text: 'INSERT INTO messages (id, chat_id, sender_id, text) VALUES ($1, $2, $3, $4) RETURNING id, chat_id, sender_id, text, created_at', + values: [id, chatId, senderId, text], + }); + await client.query({ + name: 'messages.incrementVersion', + text: 'UPDATE chats SET message_version = message_version + 1 WHERE id = $1', + values: [chatId], + }); + return toMessage(result.rows[0]); + } + + async getVersion(chatId: string, userId: string): Promise { + const result = await this.database.query<{ message_version: string }>( + 'messages.version', + 'SELECT c.message_version FROM chats c WHERE c.id = $1 AND EXISTS (SELECT 1 FROM chat_members WHERE chat_id = c.id AND user_id = $2)', + [chatId, userId], + ); + if (!result.rows[0]) throw new NotFoundException(); + return BigInt(result.rows[0].message_version); + } + + async findPage( + chatId: string, + limit: number, + cursor?: Cursor, + ): Promise<{ items: Message[]; hasMore: boolean }> { + const values: unknown[] = [chatId]; + let predicate = ''; + if (cursor) { + values.push(cursor.created_at, cursor.id); + predicate = 'AND (created_at, id) > ($2::timestamptz, $3::uuid)'; + } + values.push(limit + 1); + const result = await this.database.query( + 'messages.history', + `SELECT id, chat_id, sender_id, text, created_at FROM messages WHERE chat_id = $1 ${predicate} ORDER BY created_at, id LIMIT $${values.length}`, + values, + ); + return { + items: result.rows.slice(0, limit).map(toMessage), + hasMore: result.rows.length > limit, + }; + } +} diff --git a/app/src/messages/messages.service.ts b/app/src/messages/messages.service.ts new file mode 100644 index 00000000..63c4d4c4 --- /dev/null +++ b/app/src/messages/messages.service.ts @@ -0,0 +1,231 @@ +import { + BadRequestException, + ConflictException, + HttpStatus, + Injectable, + Logger, + NotFoundException, + ServiceUnavailableException, +} from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import type pg from 'pg'; +import { decodeCursor, encodeCursor } from '../common/http/cursor.js'; +import type { Page } from '../common/http/page.js'; +import type { AppConfig } from '../config/app-config.schema.js'; +import type { User } from '../users/user.js'; +import { ChatsService } from '../chats/chats.service.js'; +import { DatabaseClient } from '../database/database.client.js'; +import { MetricsService } from '../metrics/metrics.service.js'; +import type { CreateMessageDto } from './dto/create-message.dto.js'; +import type { Message } from './message.js'; +import { MessagesRepository } from './messages.repository.js'; +import { MessagesCacheService } from './cache/messages-cache.service.js'; +import { + IDEMPOTENCY_KEY_PATTERN, + idempotencyFingerprint, + messagesPath, +} from './idempotency/idempotency.js'; +import { IdempotencyRepository } from './idempotency/idempotency.repository.js'; + +// A claim row can disappear between our failed insert attempt and the read +// (the previous owner rolled back), so a bounded retry is part of the protocol. +const MAX_CLAIM_ATTEMPTS = 3; +const PURGE_EVERY_REQUESTS = 512; + +type CreateOutcome = + | { kind: 'created'; message: Message } + | { kind: 'replayed'; message: Message } + | { kind: 'retry' }; + +@Injectable() +export class MessagesService { + private readonly logger = new Logger(MessagesService.name); + private requestsSincePurge = 0; + + constructor( + private readonly messagesRepository: MessagesRepository, + private readonly chatsService: ChatsService, + private readonly cache: MessagesCacheService, + private readonly idempotency: IdempotencyRepository, + private readonly database: DatabaseClient, + private readonly config: ConfigService, + private readonly metrics: MetricsService, + ) {} + + async create( + chatId: string, + input: CreateMessageDto, + currentUser: User, + rawKey: string | string[] | undefined, + ): Promise { + // The key is validated before anything else: a missing, malformed or + // duplicated header is a client error, never a stored result. + if (typeof rawKey !== 'string' || !IDEMPOTENCY_KEY_PATTERN.test(rawKey)) + throw new BadRequestException( + 'Idempotency-Key header is required', + ); + if ([...input.text].every((character) => /\s/u.test(character))) + throw new BadRequestException('Message text cannot be blank'); + await this.chatsService.getForUser(chatId, currentUser); + + const path = messagesPath(chatId); + const fingerprint = idempotencyFingerprint(input); + for (let attempt = 1; attempt <= MAX_CLAIM_ATTEMPTS; attempt += 1) { + const outcome = await this.database.withTransaction((client) => + this.attemptCreate(client, { + chatId, + path, + key: rawKey, + fingerprint, + text: input.text, + userId: currentUser.id, + }), + ); + if (outcome.kind !== 'retry') { + this.scheduleExpiredPurge(); + return outcome.message; + } + } + throw new ServiceUnavailableException( + 'Idempotency key could not be claimed', + ); + } + + // One attempt = one transaction: the claim, the side effect and the stored + // response commit together, so a retry can never duplicate a message and a + // failure never leaves a half-finished claim behind. + private async attemptCreate( + client: pg.PoolClient, + request: { + chatId: string; + path: string; + key: string; + fingerprint: string; + text: string; + userId: string; + }, + ): Promise { + const { chatId, path, key, fingerprint, text, userId } = request; + const claimed = await this.idempotency.claim( + client, + userId, + path, + key, + fingerprint, + ); + if (claimed) { + this.metrics.increment('idempotency.claim'); + const message = await this.messagesRepository.create( + client, + chatId, + userId, + text, + ); + await this.idempotency.store( + client, + userId, + path, + key, + HttpStatus.CREATED, + message, + ); + this.metrics.increment('messages.write'); + return { kind: 'created', message }; + } + + const record = await this.idempotency.read( + client, + userId, + path, + key, + this.config.getOrThrow('IDEMPOTENCY_TTL_SECONDS'), + ); + if (!record) { + // The previous owner aborted, so nothing was created and the key is + // free again. + this.metrics.increment('idempotency.claim_lost'); + return { kind: 'retry' }; + } + if (record.request_fingerprint !== fingerprint) { + this.metrics.increment('idempotency.conflict'); + throw new ConflictException( + 'Idempotency key reused with a different body', + ); + } + if (record.expired) { + this.metrics.increment('idempotency.released'); + await this.idempotency.forget(client, userId, path, key); + return { kind: 'retry' }; + } + // A replay re-checks access, as the contract requires: the stored result + // is only returned to a caller that may still read this chat. + if (!(await this.idempotency.isMember(client, chatId, userId))) + throw new NotFoundException(); + this.metrics.increment('idempotency.replay'); + return { kind: 'replayed', message: record.response_body }; + } + + // Expired claims are storage hygiene, not part of the request: the pass runs + // outside the request transaction, at most once per PURGE_EVERY_REQUESTS + // successful writes, and its failure never changes the client's result. + private scheduleExpiredPurge(): void { + this.requestsSincePurge += 1; + if (this.requestsSincePurge < PURGE_EVERY_REQUESTS) return; + this.requestsSincePurge = 0; + const ttl = this.config.getOrThrow('IDEMPOTENCY_TTL_SECONDS'); + void this.idempotency + .purgeExpired(ttl) + .then((purged) => { + if (purged > 0) this.metrics.increment('idempotency.purged'); + }) + .catch((error: unknown) => { + this.metrics.increment('idempotency.purge_error'); + this.logger.warn( + `Idempotency purge failed: ${error instanceof Error ? error.message : 'unknown error'}`, + ); + }); + } + + async list( + chatId: string, + currentUser: User, + limit: number, + cursorValue?: string, + ): Promise> { + await this.chatsService.getForUser(chatId, currentUser); + const scope = `messages:${chatId}`; + const cursor = cursorValue + ? decodeCursor(cursorValue, scope) + : undefined; + const version = await this.messagesRepository.getVersion( + chatId, + currentUser.id, + ); + const page = await this.cache.getOrLoad( + chatId, + version, + cursorValue, + limit, + async () => { + const loaded = await this.messagesRepository.findPage( + chatId, + limit, + cursor, + ); + const lastLoaded = loaded.items.at(-1); + return { + items: loaded.items, + next_cursor: + loaded.hasMore && lastLoaded + ? encodeCursor({ + scope, + created_at: lastLoaded.created_at, + id: lastLoaded.id, + }) + : null, + }; + }, + ); + return page as Page; + } +} diff --git a/app/src/metrics/metrics.controller.ts b/app/src/metrics/metrics.controller.ts new file mode 100644 index 00000000..9c2100d5 --- /dev/null +++ b/app/src/metrics/metrics.controller.ts @@ -0,0 +1,54 @@ +import { + Controller, + Get, + Headers, + HttpCode, + HttpStatus, + Post, + UnauthorizedException, +} from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import type { AppConfig } from '../config/app-config.schema.js'; +import { resolveInstanceId } from '../config/instance-id.js'; +import { MetricsService } from './metrics.service.js'; + +@Controller('internal') +export class MetricsController { + private readonly instanceId: string; + private readonly buildId: string; + + constructor( + private readonly config: ConfigService, + private readonly metrics: MetricsService, + ) { + this.instanceId = resolveInstanceId(config); + this.buildId = process.env.BUILD_ID ?? 'unknown'; + } + + @Get('metrics') + get(@Headers('authorization') authorization?: string) { + this.requireToken(authorization); + return { + ...this.metrics.snapshot(), + instance_id: this.instanceId, + build_id: this.buildId, + }; + } + + @Post('metrics/reset') + @HttpCode(HttpStatus.OK) + reset(@Headers('authorization') authorization?: string): { status: 'ok' } { + this.requireToken(authorization); + this.metrics.reset(); + return { status: 'ok' }; + } + + private requireToken(authorization?: string): void { + const token = this.config.get('METRICS_TOKEN'); + if (!token || authorization !== `Bearer ${token}`) + throw new UnauthorizedException({ + message: 'Unauthorized', + challenge: 'Bearer realm="metrics"', + }); + } +} diff --git a/app/src/metrics/metrics.module.ts b/app/src/metrics/metrics.module.ts new file mode 100644 index 00000000..3e945a56 --- /dev/null +++ b/app/src/metrics/metrics.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { MetricsController } from './metrics.controller.js'; +import { MetricsService } from './metrics.service.js'; + +@Module({ + controllers: [MetricsController], + providers: [MetricsService], + exports: [MetricsService], +}) +export class MetricsModule {} diff --git a/app/src/metrics/metrics.service.spec.ts b/app/src/metrics/metrics.service.spec.ts new file mode 100644 index 00000000..2b5e5017 --- /dev/null +++ b/app/src/metrics/metrics.service.spec.ts @@ -0,0 +1,62 @@ +import { describe, expect, it } from 'vitest'; +import { MetricsService } from './metrics.service.js'; + +describe('MetricsService', () => { + it('computes nearest-rank percentiles from observed latencies', () => { + const metrics = new MetricsService(); + metrics.increment('cache_hit'); + metrics.increment('cache_hit'); + metrics.observeLatency(30); + metrics.observeLatency(10); + metrics.observeLatency(20); + expect(metrics.snapshot()).toEqual({ + counters: { cache_hit: 2 }, + latency_ms: { + count: 3, + sample_count: 3, + p50: 20, + p95: 30, + p99: 30, + max: 30, + }, + }); + }); + + it('keeps snapshots isolated from callers and later observations', () => { + const metrics = new MetricsService(); + metrics.increment('cache_hit'); + const snapshot = metrics.snapshot(); + snapshot.counters.cache_hit = 99; + metrics.increment('cache_hit'); + expect(metrics.snapshot().counters.cache_hit).toBe(2); + expect(snapshot.latency_ms.count).toBe(0); + }); + + it('bounds retained samples but keeps cumulative count and maximum', () => { + const metrics = new MetricsService(); + metrics.observeLatency(9000); + for (let index = 0; index < 4096; index += 1) + metrics.observeLatency(10); + expect(metrics.snapshot().latency_ms).toEqual({ + count: 4097, + sample_count: 4096, + p50: 10, + p95: 10, + p99: 10, + max: 9000, + }); + }); + + it('ignores invalid latency observations', () => { + const metrics = new MetricsService(); + for (const value of [-1, NaN, Infinity]) metrics.observeLatency(value); + expect(metrics.snapshot().latency_ms).toEqual({ + count: 0, + sample_count: 0, + p50: 0, + p95: 0, + p99: 0, + max: 0, + }); + }); +}); diff --git a/app/src/metrics/metrics.service.ts b/app/src/metrics/metrics.service.ts new file mode 100644 index 00000000..bf54a994 --- /dev/null +++ b/app/src/metrics/metrics.service.ts @@ -0,0 +1,69 @@ +import { Injectable } from '@nestjs/common'; + +const LATENCY_SAMPLE_CAPACITY = 4096; + +type LatencySnapshot = { + count: number; + sample_count: number; + p50: number; + p95: number; + p99: number; + max: number; +}; + +@Injectable() +export class MetricsService { + private readonly counters: Record = {}; + private readonly latencies: number[] = []; + private latencyCount = 0; + private maximumLatency = 0; + private nextSample = 0; + + increment(name: string): void { + this.counters[name] = (this.counters[name] ?? 0) + 1; + } + + observeLatency(milliseconds: number): void { + if (!Number.isFinite(milliseconds) || milliseconds < 0) return; + this.latencyCount += 1; + this.maximumLatency = Math.max(this.maximumLatency, milliseconds); + this.latencies[this.nextSample] = milliseconds; + this.nextSample = (this.nextSample + 1) % LATENCY_SAMPLE_CAPACITY; + } + + snapshot(): { + counters: Record; + latency_ms: LatencySnapshot; + } { + const sorted = [...this.latencies].sort((left, right) => left - right); + return { + counters: { ...this.counters }, + latency_ms: { + count: this.latencyCount, + sample_count: sorted.length, + p50: this.percentile(sorted, 0.5), + p95: this.percentile(sorted, 0.95), + p99: this.percentile(sorted, 0.99), + max: this.maximumLatency, + }, + }; + } + + reset(): void { + for (const name of Object.keys(this.counters)) + delete this.counters[name]; + this.latencies.length = 0; + this.latencyCount = 0; + this.maximumLatency = 0; + this.nextSample = 0; + } + + private percentile(sorted: number[], percentile: number): number { + if (sorted.length === 0) return 0; + const index = Math.min( + sorted.length - 1, + Math.ceil(sorted.length * percentile) - 1, + ); + return sorted[index]; + } +} diff --git a/app/src/redis/redis.client.ts b/app/src/redis/redis.client.ts new file mode 100644 index 00000000..911d3d32 --- /dev/null +++ b/app/src/redis/redis.client.ts @@ -0,0 +1,134 @@ +import { Injectable, Logger, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; +import { createClient, type RedisClientType } from 'redis'; +import type { AppConfig } from '../config/app-config.schema.js'; +import { MetricsService } from '../metrics/metrics.service.js'; + +const UNLOCK_SCRIPT = + 'if redis.call("get", KEYS[1]) == ARGV[1] then return redis.call("del", KEYS[1]) else return 0 end'; +type Client = RedisClientType; + +@Injectable() +export class RedisClient implements OnModuleInit, OnModuleDestroy { + readonly client: Client; + private readonly logger = new Logger(RedisClient.name); + + constructor( + private readonly config: ConfigService, + private readonly metrics: MetricsService, + ) { + this.client = createClient({ + url: this.config.getOrThrow('REDIS_URL'), + disableOfflineQueue: true, + socket: { + reconnectStrategy: (attempt) => + Math.min(1000 + attempt * 250, 5000), + connectTimeout: 5000, + }, + }) as Client; + // Reconnect failures must be visible; the readiness probe pings Redis. + this.client.on('error', (error: Error) => { + this.metrics.increment('redis.error'); + this.logger.warn(`Redis error: ${error.message}`); + }); + } + + async onModuleInit(): Promise { + await this.client.connect(); + } + + async onModuleDestroy(): Promise { + if (this.client.isOpen) await this.client.quit(); + } + + async health(): Promise { + this.metrics.increment('redis.ping'); + await this.client.ping(); + } + + async get(key: string): Promise { + this.metrics.increment('redis.get'); + return this.client.get(key); + } + + async set( + key: string, + value: string, + options?: { EX?: number; PX?: number; NX?: boolean }, + ): Promise { + this.metrics.increment('redis.set'); + return this.client.set(key, value, options); + } + + async setNxEx( + key: string, + value: string, + seconds: number, + ): Promise { + this.metrics.increment('redis.set'); + return ( + (await this.client.set(key, value, { NX: true, EX: seconds })) === + 'OK' + ); + } + + async setNxPx( + key: string, + value: string, + milliseconds: number, + ): Promise { + this.metrics.increment('redis.set'); + return ( + (await this.client.set(key, value, { + NX: true, + PX: milliseconds, + })) === 'OK' + ); + } + + async del(key: string): Promise { + this.metrics.increment('redis.del'); + return this.client.del(key); + } + + async incr(key: string): Promise { + this.metrics.increment('redis.incr'); + return this.client.incr(key); + } + + async expire(key: string, seconds: number): Promise { + this.metrics.increment('redis.expire'); + return (await this.client.expire(key, seconds)) === 1; + } + + async scan( + cursor: number, + pattern?: string, + count = 100, + ): Promise<{ cursor: number; keys: string[] }> { + this.metrics.increment('redis.scan'); + const result = await this.client.scan(String(cursor), { + MATCH: pattern, + COUNT: count, + }); + return { cursor: Number(result.cursor), keys: result.keys }; + } + + async unlock(key: string, owner: string): Promise { + this.metrics.increment('redis.unlock'); + return Number( + await this.client.eval(UNLOCK_SCRIPT, { + keys: [key], + arguments: [owner], + }), + ); + } + + pipeline(commands: Array<[string, ...string[]]>): Promise { + this.metrics.increment('redis.pipeline'); + const multi = this.client.multi(); + for (const [command, ...args] of commands) + multi.addCommand([command, ...args]); + return multi.exec(); + } +} diff --git a/app/src/redis/redis.module.ts b/app/src/redis/redis.module.ts new file mode 100644 index 00000000..74464f56 --- /dev/null +++ b/app/src/redis/redis.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { MetricsModule } from '../metrics/metrics.module.js'; +import { RedisClient } from './redis.client.js'; + +@Module({ + imports: [MetricsModule], + providers: [RedisClient], + exports: [RedisClient], +}) +export class RedisModule {} diff --git a/app/src/types.d.ts b/app/src/types.d.ts new file mode 100644 index 00000000..6a215a66 --- /dev/null +++ b/app/src/types.d.ts @@ -0,0 +1,7 @@ +import { User } from './users/user.ts'; + +declare module 'fastify' { + interface FastifyRequest { + currentUser?: User; + } +} diff --git a/app/src/users/dto/create-user.dto.ts b/app/src/users/dto/create-user.dto.ts new file mode 100644 index 00000000..8e82f58e --- /dev/null +++ b/app/src/users/dto/create-user.dto.ts @@ -0,0 +1,22 @@ +import { IsString, Matches } from 'class-validator'; +import { CodePointLength } from '../../common/validation/code-point-length.js'; + +export class CreateUserDTO { + @IsString() + @Matches(/^[a-z0-9_]{3,32}$/) + username!: string; + + @IsString() + @CodePointLength(1, 100) + @Matches(/\S/u, { + message: 'display_name must contain a non-whitespace character', + }) + display_name!: string; + + @IsString() + @CodePointLength(12, 128) + @Matches(/\S/u, { + message: 'password must contain a non-whitespace character', + }) + password!: string; +} diff --git a/app/src/users/user.ts b/app/src/users/user.ts new file mode 100644 index 00000000..9c91d9e7 --- /dev/null +++ b/app/src/users/user.ts @@ -0,0 +1,6 @@ +export type User = { + id: string; + username: string; + display_name: string; + created_at: string; +}; diff --git a/app/src/users/users.controller.ts b/app/src/users/users.controller.ts new file mode 100644 index 00000000..1ab8c777 --- /dev/null +++ b/app/src/users/users.controller.ts @@ -0,0 +1,22 @@ +import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common'; +import { CurrentUser } from '../common/auth/current-user.decorator.js'; +import { CurrentUserGuard } from '../common/auth/current-user.guard.js'; +import type { User } from './user.js'; +import { CreateUserDTO } from './dto/create-user.dto.js'; +import { UsersService } from './users.service.js'; + +@Controller('api/v1/users') +export class UsersController { + constructor(private readonly usersService: UsersService) {} + + @Post() + create(@Body() body: CreateUserDTO) { + return this.usersService.create(body); + } + + @Get('/me') + @UseGuards(CurrentUserGuard) + getMe(@CurrentUser() currentUser: User) { + return currentUser; + } +} diff --git a/app/src/users/users.module.ts b/app/src/users/users.module.ts new file mode 100644 index 00000000..55a73289 --- /dev/null +++ b/app/src/users/users.module.ts @@ -0,0 +1,16 @@ +import { Module } from '@nestjs/common'; +import { UsersController } from './users.controller.js'; +import { UsersRepository } from './users.repository.js'; +import { UsersService } from './users.service.js'; +import { CurrentUserGuard } from '../common/auth/current-user.guard.js'; +import { RedisModule } from '../redis/redis.module.js'; +import { MetricsModule } from '../metrics/metrics.module.js'; +import { DatabaseModule } from '../database/database.module.js'; + +@Module({ + imports: [DatabaseModule, RedisModule, MetricsModule], + controllers: [UsersController], + providers: [UsersRepository, UsersService, CurrentUserGuard], + exports: [UsersService, CurrentUserGuard, RedisModule, MetricsModule], +}) +export class UsersModule {} diff --git a/app/src/users/users.repository.ts b/app/src/users/users.repository.ts new file mode 100644 index 00000000..4fbbe865 --- /dev/null +++ b/app/src/users/users.repository.ts @@ -0,0 +1,71 @@ +import { ConflictException, Injectable } from '@nestjs/common'; +import { DatabaseClient } from '../database/database.client.js'; +import type { User } from './user.js'; + +type UserRow = { + id: string; + username: string; + display_name: string; + password_hash: string; + created_at: Date | string; +}; + +function toUser(row: UserRow): User { + return { + id: row.id, + username: row.username, + display_name: row.display_name, + created_at: new Date(row.created_at).toISOString(), + }; +} + +@Injectable() +export class UsersRepository { + constructor(private readonly database: DatabaseClient) {} + + async findById(id: string): Promise { + const result = await this.database.query( + 'users.findById', + 'SELECT id, username, display_name, password_hash, created_at FROM users WHERE id = $1', + [id], + ); + const row = result.rows[0]; + return row ? toUser(row) : undefined; + } + + async findByUsername( + username: string, + ): Promise<(User & { password_hash: string }) | undefined> { + const result = await this.database.query( + 'users.findByUsername', + 'SELECT id, username, display_name, password_hash, created_at FROM users WHERE username = $1', + [username], + ); + const row = result.rows[0]; + return row + ? { ...toUser(row), password_hash: row.password_hash } + : undefined; + } + + async create(user: { + id: string; + username: string; + display_name: string; + password_hash: string; + }): Promise { + try { + const result = await this.database.query( + 'users.insert', + `INSERT INTO users (id, username, display_name, password_hash) + VALUES ($1, $2, $3, $4) + RETURNING id, username, display_name, password_hash, created_at`, + [user.id, user.username, user.display_name, user.password_hash], + ); + return toUser(result.rows[0]); + } catch (error) { + if ((error as { code?: string }).code === '23505') + throw new ConflictException('Username already exists'); + throw error; + } + } +} diff --git a/app/src/users/users.service.ts b/app/src/users/users.service.ts new file mode 100644 index 00000000..e4ac35df --- /dev/null +++ b/app/src/users/users.service.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@nestjs/common'; +import argon2 from 'argon2'; +import { randomUUID } from 'node:crypto'; +import { CreateUserDTO } from './dto/create-user.dto.js'; +import { User } from './user.js'; +import { UsersRepository } from './users.repository.js'; + +@Injectable() +export class UsersService { + constructor(private readonly usersRepository: UsersRepository) {} + + async create(input: CreateUserDTO): Promise { + const passwordHash = await argon2.hash(input.password, { + type: argon2.argon2id, + }); + return this.usersRepository.create({ + id: randomUUID(), + username: input.username, + display_name: input.display_name, + password_hash: passwordHash, + }); + } + + findById(id: string): Promise { + return this.usersRepository.findById(id); + } + + findByUsername(username: string) { + return this.usersRepository.findByUsername(username); + } +} diff --git a/app/test/app.e2e-spec.ts b/app/test/app.e2e-spec.ts new file mode 100644 index 00000000..737e9b38 --- /dev/null +++ b/app/test/app.e2e-spec.ts @@ -0,0 +1,644 @@ +import { afterAll, beforeAll, describe, expect, it } from 'vitest'; +import { randomUUID } from 'node:crypto'; +import { setTimeout as sleep } from 'node:timers/promises'; +import { Pool } from 'pg'; +import { createClient } from 'redis'; +import type { SessionResponse } from '../src/auth/auth.service.js'; +import type { Chat } from '../src/chats/chat.js'; +import type { ApiErrorBody } from '../src/common/errors/api-error.js'; +import type { Page } from '../src/common/http/page.js'; +import type { Message } from '../src/messages/message.js'; +import type { User } from '../src/users/user.js'; + +// The suite is black-box: run it against the compiled application process. +// Vitest sets process.env.BASE_URL itself (Vite base), so the API URL uses its own name. +const baseUrl = (process.env.API_BASE_URL ?? 'http://localhost:8080').replace( + /\/+$/u, + '', +); +const basicChallenge = 'Basic realm="messenger", charset="UTF-8"'; +const bearerChallenge = 'Bearer realm="messenger"'; +const password = 'integration:пароль🔐'; +const runId = randomUUID().replaceAll('-', '').slice(0, 12); +const usernames: string[] = []; +const tokens: string[] = []; +let sequence = 0; +let database: Pool; +let redis: ReturnType; + +type Actor = { user: User; password: string; token: string }; +type HttpResult = { body: T; response: Response }; + +async function http( + path: string, + init: RequestInit = {}, +): Promise> { + const response = await fetch(`${baseUrl}${path}`, init); + const text = await response.text(); + let body: unknown = undefined; + if (text) { + try { + body = JSON.parse(text); + } catch { + body = text; + } + } + return { body: body as T, response }; +} + +function json( + body: unknown, + headers: Record = {}, +): RequestInit { + return { + method: 'POST', + headers: { 'content-type': 'application/json', ...headers }, + body: JSON.stringify(body), + }; +} + +function basic(username: string, secret: string): string { + return `Basic ${Buffer.from(`${username}:${secret}`, 'utf8').toString('base64')}`; +} + +function bearer(token: string): Record { + return { authorization: `Bearer ${token}` }; +} + +function idempotencyKey(): Record { + return { 'idempotency-key': randomUUID().replaceAll('-', '') }; +} + +function messageHeaders(token: string): Record { + return { ...bearer(token), ...idempotencyKey() }; +} + +async function register( + displayName = 'Интеграционный пользователь', + secret = password, +): Promise { + const username = `e2e_${runId}_${sequence++}`.slice(0, 32); + usernames.push(username); + const result = await http( + '/api/v1/users', + json({ username, display_name: displayName, password: secret }), + ); + expect(result.response.status).toBe(201); + return result.body; +} + +async function login(user: User, secret = password): Promise { + const result = await http('/api/v1/auth/sessions', { + method: 'POST', + headers: { authorization: basic(user.username, secret) }, + }); + expect(result.response.status).toBe(201); + tokens.push(result.body.token); + return result.body; +} + +async function actor(displayName?: string): Promise { + const user = await register(displayName); + const session = await login(user); + return { user, password, token: session.token }; +} + +function expectError( + result: HttpResult, + status: number, + code: string, +): void { + expect(result.response.status).toBe(status); + expect(result.body.error.code).toBe(code); + expect(result.body.error.request_id).toBe( + result.response.headers.get('x-request-id'), + ); +} + +describe('HTTP integration contract', () => { + beforeAll(async () => { + database = new Pool({ + connectionString: process.env.DATABASE_URL, + connectionTimeoutMillis: 5000, + }); + redis = createClient({ + url: process.env.REDIS_URL, + socket: { reconnectStrategy: false }, + }); + redis.on('error', () => {}); + await redis.connect(); + }); + + afterAll(async () => { + if (usernames.length) { + await database.query('BEGIN'); + try { + await database.query( + `DELETE FROM messages WHERE sender_id IN (SELECT id FROM users WHERE username = ANY($1::text[]))`, + [usernames], + ); + await database.query( + `DELETE FROM chats WHERE id IN (SELECT chat_id FROM chat_members WHERE user_id IN (SELECT id FROM users WHERE username = ANY($1::text[])))`, + [usernames], + ); + await database.query( + 'DELETE FROM users WHERE username = ANY($1::text[])', + [usernames], + ); + await database.query('COMMIT'); + } catch (error) { + await database.query('ROLLBACK'); + throw error; + } + } + if (redis.isOpen) redis.destroy(); + await database.end(); + }); + + it('serves liveness and requires real session authentication', async () => { + const live = await http<{ status: string }>('/health/live'); + expect(live.response.status).toBe(200); + expect(live.body).toEqual({ status: 'ok' }); + const denied = await http('/api/v1/users/me'); + expectError(denied, 401, 'unauthorized'); + expect(denied.response.headers.get('www-authenticate')).toBe( + bearerChallenge, + ); + }); + + it('measures string lengths in Unicode code points', async () => { + const emoji = '🔐'; + const username = (suffix: string) => + `e2e_${runId}_${suffix}`.slice(0, 32); + const rejected = await http( + '/api/v1/users', + json({ + username: username('cp_short'), + display_name: 'Code points', + password: emoji.repeat(11), + }), + ); + expectError(rejected, 400, 'invalid_request'); + const tooLongPassword = await http( + '/api/v1/users', + json({ + username: username('cp_long'), + display_name: 'Code points', + password: emoji.repeat(129), + }), + ); + expectError(tooLongPassword, 400, 'invalid_request'); + const tooLongName = await http( + '/api/v1/users', + json({ + username: username('cp_name'), + display_name: emoji.repeat(101), + password, + }), + ); + expectError(tooLongName, 400, 'invalid_request'); + + const shortUsername = username('cp_ok'); + usernames.push(shortUsername); + const boundaryPassword = emoji.repeat(12); + const created = await http( + '/api/v1/users', + json({ + username: shortUsername, + display_name: emoji.repeat(100), + password: boundaryPassword, + }), + ); + expect(created.response.status).toBe(201); + expect([...created.body.display_name].length).toBe(100); + // The stored password keeps all 12 code points: authentication works. + const session = await http('/api/v1/auth/sessions', { + method: 'POST', + headers: { + authorization: basic(shortUsername, boundaryPassword), + }, + }); + expect(session.response.status).toBe(201); + tokens.push(session.body.token); + + const longTitleRejected = await http( + '/api/v1/chats', + json( + { title: emoji.repeat(101), member_ids: [created.body.id] }, + bearer(session.body.token), + ), + ); + expectError(longTitleRejected, 400, 'invalid_request'); + const longTitle = await http( + '/api/v1/chats', + json( + { title: emoji.repeat(100), member_ids: [created.body.id] }, + bearer(session.body.token), + ), + ); + expect(longTitle.response.status).toBe(201); + const tooLongText = await http( + `/api/v1/chats/${longTitle.body.id}/messages`, + json({ text: emoji.repeat(4001) }, messageHeaders(session.body.token)), + ); + expectError(tooLongText, 400, 'invalid_request'); + const boundaryText = await http( + `/api/v1/chats/${longTitle.body.id}/messages`, + json({ text: emoji.repeat(4000) }, messageHeaders(session.body.token)), + ); + expect(boundaryText.response.status).toBe(201); + expect([...boundaryText.body.text].length).toBe(4000); + }); + + it('rejects whitespace-only and too-short credentials', async () => { + const username = `e2e_${runId}_${sequence++}`.slice(0, 32); + usernames.push(username); + const cases = [ + { password: ' '.repeat(12), display_name: 'Пользователь' }, + { password: '\t'.repeat(16), display_name: 'Пользователь' }, + { password: 'short-pass', display_name: 'Пользователь' }, + { password, display_name: ' ' }, + ]; + for (const body of cases) { + const result = await http( + '/api/v1/users', + json({ username, ...body }), + ); + expectError(result, 400, 'invalid_request'); + } + const accepted = await http( + '/api/v1/users', + json({ username, display_name: 'Пользователь', password }), + ); + expect(accepted.response.status).toBe(201); + }); + + it('registers, logs in with Unicode/colon password, and challenges malformed Basic', async () => { + const user = await register(); + const session = await login(user); + expect(session.user.id).toBe(user.id); + expect(session.token_type).toBe('Bearer'); + const me = await http('/api/v1/users/me', { + headers: bearer(session.token), + }); + expect(me.response.status).toBe(200); + expect(me.body.id).toBe(user.id); + for (const authorization of [ + 'Basic !!!', + 'Basic YWJj', + 'Bearer nope', + ]) { + const result = await http('/api/v1/auth/sessions', { + method: 'POST', + headers: { authorization }, + }); + expectError(result, 401, 'unauthorized'); + expect(result.response.headers.get('www-authenticate')).toBe( + basicChallenge, + ); + } + const bodyResult = await http('/api/v1/auth/sessions', { + ...json({ unexpected: true }), + headers: { authorization: basic(user.username, password) }, + }); + expectError(bodyResult, 400, 'invalid_request'); + }); + + it('returns conflict for concurrent duplicate registration', async () => { + const username = `e2e_${runId}_race`.slice(0, 32); + usernames.push(username); + const results = await Promise.all([ + http( + '/api/v1/users', + json({ username, display_name: 'Race A', password }), + ), + http( + '/api/v1/users', + json({ username, display_name: 'Race B', password }), + ), + ]); + expect( + results.filter((item) => item.response.status === 201), + 'duplicate registration must create exactly one user', + ).toHaveLength(1); + expect( + results.filter((item) => item.response.status === 409), + 'loser of the race must receive 409, not 500', + ).toHaveLength(1); + // The database unique index is the race-proof guard, so verify its effect. + const persisted = await database.query<{ count: string }>( + 'SELECT count(*)::text AS count FROM users WHERE username = $1', + [username], + ); + expect(persisted.rows[0]?.count).toBe('1'); + }); + + it('uses Bearer only, ignores X-User-Id spoofing, and prevents logout replay', async () => { + const alice = await actor('Алиса'); + const bob = await actor('Боб'); + const spoof = await http('/api/v1/users/me', { + headers: { ...bearer(alice.token), 'x-user-id': bob.user.id }, + }); + expect(spoof.response.status).toBe(200); + expect((spoof.body as unknown as User).id).toBe(alice.user.id); + const basicBusiness = await http('/api/v1/users/me', { + headers: { authorization: basic(alice.user.username, password) }, + }); + expectError(basicBusiness, 401, 'unauthorized'); + expect(basicBusiness.response.headers.get('www-authenticate')).toBe( + bearerChallenge, + ); + const logout = await http('/api/v1/auth/sessions/current', { + method: 'DELETE', + headers: bearer(alice.token), + }); + expect(logout.response.status).toBe(204); + const replay = await http('/api/v1/users/me', { + headers: bearer(alice.token), + }); + expectError(replay, 401, 'unauthorized'); + }); + + it('rejects unknown and duplicate chat members and hides chats from outsiders', async () => { + const alice = await actor(); + const bob = await actor(); + const outsider = await actor(); + const unknown = await http( + '/api/v1/chats', + json( + { title: 'unknown', member_ids: [alice.user.id, randomUUID()] }, + bearer(alice.token), + ), + ); + expectError(unknown, 400, 'invalid_request'); + const leaked = await http(`/api/v1/chats?limit=100`, { + headers: bearer(alice.token), + }); + expect(leaked.response.status).toBe(200); + expect( + (leaked.body as unknown as Page).items.some( + (item) => item.title === 'unknown', + ), + ).toBe(false); + const duplicate = await http( + '/api/v1/chats', + json( + { + title: 'duplicate', + member_ids: [alice.user.id, alice.user.id], + }, + bearer(alice.token), + ), + ); + expectError(duplicate, 400, 'invalid_request'); + const created = await http( + '/api/v1/chats', + json( + { + title: `chat-${runId}`, + member_ids: [alice.user.id, bob.user.id], + }, + bearer(alice.token), + ), + ); + expect(created.response.status).toBe(201); + const hidden = await http( + `/api/v1/chats/${created.body.id}`, + { headers: bearer(outsider.token) }, + ); + expectError(hidden, 404, 'not_found'); + }); + + it('keeps sender server-owned and makes writes visible to a second session', async () => { + const alice = await actor(); + const secondSession = (await login(alice.user)).token; + const chat = await http( + '/api/v1/chats', + json( + { title: `messages-${runId}`, member_ids: [alice.user.id] }, + bearer(alice.token), + ), + ); + expect(chat.response.status).toBe(201); + const blank = await http( + `/api/v1/chats/${chat.body.id}/messages`, + json( + { text: ' \n\t', sender_id: randomUUID() }, + messageHeaders(alice.token), + ), + ); + expectError(blank, 400, 'invalid_request'); + const spoof = await http( + `/api/v1/chats/${chat.body.id}/messages`, + json( + { text: 'hello', sender_id: randomUUID() }, + messageHeaders(alice.token), + ), + ); + expectError(spoof, 400, 'invalid_request'); + await http(`/api/v1/chats/${chat.body.id}/messages?limit=50`, { + headers: bearer(secondSession), + }); + const sent = await http( + `/api/v1/chats/${chat.body.id}/messages`, + json({ text: 'hello' }, messageHeaders(alice.token)), + ); + expect(sent.response.status).toBe(201); + expect(sent.body.sender_id).toBe(alice.user.id); + const page = await http>( + `/api/v1/chats/${chat.body.id}/messages?limit=50`, + { headers: bearer(secondSession) }, + ); + expect(page.response.status).toBe(200); + expect(page.body.items.map((item) => item.id)).toContain(sent.body.id); + }); + + it('validates cursor, limits, malformed JSON, and paginates without repeats', async () => { + const alice = await actor(); + const chat = await http( + '/api/v1/chats', + json( + { title: `pages-${runId}`, member_ids: [alice.user.id] }, + bearer(alice.token), + ), + ); + for (const text of ['one', 'two', 'three']) { + const sent = await http( + `/api/v1/chats/${chat.body.id}/messages`, + json({ text }, messageHeaders(alice.token)), + ); + expect(sent.response.status).toBe(201); + } + const invalidLimit = await http( + `/api/v1/chats/${chat.body.id}/messages?limit=101`, + { headers: bearer(alice.token) }, + ); + expectError(invalidLimit, 400, 'invalid_request'); + const invalidCursor = await http( + `/api/v1/chats/${chat.body.id}/messages?cursor=not-a-cursor`, + { headers: bearer(alice.token) }, + ); + expectError(invalidCursor, 400, 'invalid_request'); + const rolledOver = http( + `/api/v1/chats/${chat.body.id}/messages?cursor=${encodeURIComponent( + Buffer.from( + JSON.stringify({ + scope: `messages:${chat.body.id}`, + created_at: '2026-02-31T00:00:00.000Z', + id: randomUUID(), + }), + 'utf8', + ).toString('base64url'), + )}`, + { headers: bearer(alice.token) }, + ); + expectError(await rolledOver, 400, 'invalid_request'); + const malformed = await http('/api/v1/users', { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: '{', + }); + expectError(malformed, 400, 'invalid_request'); + const first = await http>( + `/api/v1/chats/${chat.body.id}/messages?limit=2`, + { headers: bearer(alice.token) }, + ); + expect(first.body.items).toHaveLength(2); + const second = await http>( + `/api/v1/chats/${chat.body.id}/messages?limit=2&cursor=${encodeURIComponent(first.body.next_cursor!)}`, + { headers: bearer(alice.token) }, + ); + expect(second.body.items).toHaveLength(1); + expect( + new Set( + [...first.body.items, ...second.body.items].map( + (item) => item.id, + ), + ).size, + ).toBe(3); + }); + + it.skipIf(process.env.SESSION_TTL_SECONDS !== '2')( + 'expires sessions with TTL=2', + async () => { + const user = await register(); + const session = await login(user); + await sleep(2300); + const expired = await http('/api/v1/users/me', { + headers: bearer(session.token), + }); + expectError(expired, 401, 'unauthorized'); + }, + ); +}); + +// lab3: the Idempotency-Key contract of POST /chats/{id}/messages. The suite is +// black-box, so these assertions hold for one replica and for a load-balanced +// fleet alike. +describe('message idempotency', () => { + async function chatFor(token: string, memberIds: string[]): Promise { + const created = await http( + '/api/v1/chats', + json({ title: `idempotency-${runId}`, member_ids: memberIds }, bearer(token)), + ); + expect(created.response.status).toBe(201); + return created.body.id; + } + + async function textsIn(chatId: string, token: string): Promise { + const page = await http>( + `/api/v1/chats/${chatId}/messages?limit=100`, + { headers: bearer(token) }, + ); + expect(page.response.status).toBe(200); + return page.body.items.map((item) => item.text); + } + + it('requires a well-formed Idempotency-Key', async () => { + const alice = await actor(); + const chatId = await chatFor(alice.token, [alice.user.id]); + const path = `/api/v1/chats/${chatId}/messages`; + const missing = await http( + path, + json({ text: 'без ключа' }, bearer(alice.token)), + ); + expectError(missing, 400, 'invalid_request'); + for (const key of ['has space', 'comma,separated', 'x'.repeat(129)]) { + const malformed = await http( + path, + json({ text: 'плохой ключ' }, { ...bearer(alice.token), 'idempotency-key': key }), + ); + expectError(malformed, 400, 'invalid_request'); + } + }); + + it('replays the stored response and conflicts on a different body', async () => { + const alice = await actor(); + const chatId = await chatFor(alice.token, [alice.user.id]); + const path = `/api/v1/chats/${chatId}/messages`; + const key = randomUUID().replaceAll('-', ''); + const headers = { ...bearer(alice.token), 'idempotency-key': key }; + const text = `повтор ${runId}`; + + const first = await http(path, json({ text }, headers)); + expect(first.response.status).toBe(201); + const replayed = await http(path, json({ text }, headers)); + expect(replayed.response.status).toBe(201); + expect(replayed.body).toEqual(first.body); + + const conflict = await http( + path, + json({ text: 'другой body' }, headers), + ); + expectError(conflict, 409, 'conflict'); + + expect(await textsIn(chatId, alice.token)).toEqual([text]); + }); + + it('creates exactly one message for concurrent requests with one key', async () => { + const alice = await actor(); + const chatId = await chatFor(alice.token, [alice.user.id]); + const path = `/api/v1/chats/${chatId}/messages`; + const headers = { ...bearer(alice.token), ...idempotencyKey() }; + const text = `конкурентный повтор ${runId}`; + + const results = await Promise.all( + Array.from({ length: 8 }, () => http(path, json({ text }, headers))), + ); + for (const result of results) expect(result.response.status).toBe(201); + const ids = new Set(results.map((result) => result.body.id)); + expect( + ids.size, + 'one key must resolve to exactly one message across replicas', + ).toBe(1); + expect(await textsIn(chatId, alice.token)).toEqual([text]); + }); + + it('scopes the key per user and per chat path', async () => { + const alice = await actor(); + const bob = await actor(); + const outsider = await actor(); + const chatId = await chatFor(alice.token, [alice.user.id, bob.user.id]); + const path = `/api/v1/chats/${chatId}/messages`; + const key = randomUUID().replaceAll('-', ''); + const foreignChatId = await chatFor(outsider.token, [outsider.user.id]); + + const denied = await http( + `/api/v1/chats/${foreignChatId}/messages`, + json({ text: 'чужое' }, { ...bearer(alice.token), 'idempotency-key': key }), + ); + expectError(denied, 404, 'not_found'); + + const mine = await http( + path, + json({ text: 'своё' }, { ...bearer(alice.token), 'idempotency-key': key }), + ); + expect(mine.response.status).toBe(201); + const other = await http( + path, + json({ text: 'своё' }, { ...bearer(bob.token), 'idempotency-key': key }), + ); + expect(other.response.status).toBe(201); + expect(other.body.id).not.toBe(mine.body.id); + }); +}); diff --git a/app/test/dependency-failures.e2e-spec.ts b/app/test/dependency-failures.e2e-spec.ts new file mode 100644 index 00000000..4a629138 --- /dev/null +++ b/app/test/dependency-failures.e2e-spec.ts @@ -0,0 +1,299 @@ +import { execFile } from 'node:child_process'; +import { randomUUID } from 'node:crypto'; +import { setTimeout as sleep } from 'node:timers/promises'; +import { fileURLToPath } from 'node:url'; +import { promisify } from 'node:util'; +import { afterAll, beforeAll, describe, expect, it } from 'vitest'; +import type { SessionResponse } from '../src/auth/auth.service.js'; +import type { Chat } from '../src/chats/chat.js'; +import type { ApiErrorBody } from '../src/common/errors/api-error.js'; +import type { Page } from '../src/common/http/page.js'; +import type { Message } from '../src/messages/message.js'; +import type { User } from '../src/users/user.js'; + +// Automated counterpart of the manual Redis/PostgreSQL outage checks: the suite +// stops a dependency of the Compose stand, asserts a bounded 503 (never a 500, +// never a trusted anonymous request, never a leaked driver error) and then +// restarts it to prove recovery without data loss. +// +// It is opt-in because it needs control over the Docker Compose project: +// make test-dependencies +// cd app && E2E_DEPENDENCY_FAULTS=1 npm run test:dependencies +const enabled = process.env.E2E_DEPENDENCY_FAULTS === '1'; +const baseUrl = (process.env.API_BASE_URL ?? 'http://localhost:8080').replace( + /\/+$/u, + '', +); +const composeDir = + process.env.E2E_COMPOSE_DIR ?? + fileURLToPath(new URL('../..', import.meta.url)); +const composeEnvFile = process.env.E2E_COMPOSE_ENV_FILE ?? '.env'; +const redisService = process.env.E2E_REDIS_SERVICE ?? 'redis'; +const postgresService = process.env.E2E_POSTGRES_SERVICE ?? 'postgres'; +const password = 'outage-check:пароль🔐'; +const runId = randomUUID().replaceAll('-', '').slice(0, 12); +// A request that reaches a stopped database waits for the pool connection +// timeout, so every outage step costs up to DATABASE_CONNECTION_TIMEOUT_MS. +const outagedRequestBudgetMs = 180_000; + +const execFileAsync = promisify(execFile); + +type Result = { body: T; text: string; response: Response }; + +async function compose(...args: string[]): Promise { + await execFileAsync( + 'docker', + ['compose', '--env-file', composeEnvFile, ...args], + { cwd: composeDir, timeout: 120_000 }, + ); +} + +async function request( + path: string, + init: RequestInit = {}, +): Promise> { + const response = await fetch(`${baseUrl}${path}`, init); + const text = await response.text(); + return { body: (text ? JSON.parse(text) : undefined) as T, text, response }; +} + +function json( + body: unknown, + headers: Record = {}, +): RequestInit { + return { + method: 'POST', + headers: { 'content-type': 'application/json', ...headers }, + body: JSON.stringify(body), + }; +} + +function bearer(token: string): Record { + return { authorization: `Bearer ${token}` }; +} + +// POST messages needs a unique Idempotency-Key in lab3+; outage checks only +// need the write path, not replay semantics. +function messageHeaders(token: string): Record { + return { + ...bearer(token), + 'idempotency-key': randomUUID().replaceAll('-', ''), + }; +} + +function basic(username: string, secret: string): string { + return `Basic ${Buffer.from(`${username}:${secret}`, 'utf8').toString('base64')}`; +} + +// The dependencies recover asynchronously, so readiness is polled instead of +// asserted right after docker compose returns. +async function waitForReadiness( + expected: number, + timeoutMs = 90_000, +): Promise { + const deadline = Date.now() + timeoutMs; + let last: number | string = 'no response'; + for (;;) { + try { + const probe = await request('/health/ready'); + last = probe.response.status; + if (probe.response.status === expected) return; + } catch (error) { + last = error instanceof Error ? error.message : 'request failed'; + } + if (Date.now() > deadline) + throw new Error( + `readiness never became ${expected} within ${timeoutMs}ms (last: ${String(last)})`, + ); + await sleep(250); + } +} + +function expectBoundedOutage(result: Result): void { + expect(result.response.status).toBe(503); + expect(result.body.error.code).toBe('unavailable'); + expect(result.body.error.message).toBe('Service unavailable'); + expect(result.body.error.request_id).toBe( + result.response.headers.get('x-request-id'), + ); + // A bounded error must not leak driver details, SQL text or a stack trace. + expect(result.text).not.toMatch( + /ECONNREFUSED|ECONNRESET|Connection terminated|pg\.|node_modules|at .*\(.+:\d+:\d+\)/u, + ); +} + +async function historyOf( + chatId: string, + token: string, +): Promise>> { + return request>(`/api/v1/chats/${chatId}/messages?limit=100`, { + headers: bearer(token), + }); +} + +describe.skipIf(!enabled)('dependency outages', () => { + let user: User; + let token: string; + let chat: Chat; + let message: Message; + + beforeAll(async () => { + await compose('up', '-d'); + await waitForReadiness(200); + const username = `outage_${runId}`; + const registered = await request( + '/api/v1/users', + json({ username, display_name: 'Отказ зависимости', password }), + ); + expect(registered.response.status).toBe(201); + user = registered.body; + const session = await request( + '/api/v1/auth/sessions', + { + method: 'POST', + headers: { authorization: basic(username, password) }, + }, + ); + expect(session.response.status).toBe(201); + token = session.body.token; + const created = await request( + '/api/v1/chats', + json( + { title: `outage-${runId}`, member_ids: [user.id] }, + bearer(token), + ), + ); + expect(created.response.status).toBe(201); + chat = created.body; + const sent = await request( + `/api/v1/chats/${chat.id}/messages`, + json({ text: 'Сообщение до отказа' }, messageHeaders(token)), + ); + expect(sent.response.status).toBe(201); + message = sent.body; + }, outagedRequestBudgetMs); + + afterAll(async () => { + // Always restore the stand, even when an assertion failed mid-outage. + await compose('start', redisService); + await compose('start', postgresService); + await waitForReadiness(200); + }, outagedRequestBudgetMs); + + it( + 'serves bounded 503 for the Redis outage and recovers the session', + async () => { + await compose('stop', redisService); + + const live = await request('/health/live'); + expect(live.response.status).toBe(200); + await waitForReadiness(503); + + expectBoundedOutage(await request('/health/ready')); + + expectBoundedOutage( + await request('/api/v1/users/me', { + headers: bearer(token), + }), + ); + + expectBoundedOutage( + await request('/api/v1/auth/sessions', { + method: 'POST', + headers: { authorization: basic(user.username, password) }, + }), + ); + + // A request without a session must stay unauthorized during an outage: + // the outage may not turn an anonymous caller into a trusted one. + const anonymous = await request('/api/v1/chats', { + headers: { 'x-user-id': user.id }, + }); + expect(anonymous.response.status).toBe(401); + expect(anonymous.body.error.code).toBe('unauthorized'); + + await compose('start', redisService); + await waitForReadiness(200); + + // Sessions live in Redis with persistence, so the old token still works. + const recovered = await request('/api/v1/users/me', { + headers: bearer(token), + }); + expect(recovered.response.status).toBe(200); + expect(recovered.body.id).toBe(user.id); + + const history = await historyOf(chat.id, token); + expect(history.response.status).toBe(200); + expect(history.body.items.map((item) => item.id)).toContain( + message.id, + ); + }, + outagedRequestBudgetMs, + ); + + it( + 'serves bounded 503 for the PostgreSQL outage and keeps confirmed data', + async () => { + await compose('stop', postgresService); + + const live = await request('/health/live'); + expect(live.response.status).toBe(200); + await waitForReadiness(503); + + expectBoundedOutage(await request('/health/ready')); + + // Redis still answers, so these requests reach the database layer. + expectBoundedOutage( + await request('/api/v1/users/me', { + headers: bearer(token), + }), + ); + + expectBoundedOutage( + await request('/api/v1/chats', { + headers: bearer(token), + }), + ); + + expectBoundedOutage( + await request( + `/api/v1/chats/${chat.id}/messages?limit=100`, + { headers: bearer(token) }, + ), + ); + + expectBoundedOutage( + await request( + '/api/v1/users', + json({ + username: `outage_${runId}_late`, + display_name: 'Отказ зависимости', + password, + }), + ), + ); + + await compose('start', postgresService); + await waitForReadiness(200); + + const recovered = await request('/api/v1/users/me', { + headers: bearer(token), + }); + expect(recovered.response.status).toBe(200); + expect(recovered.body.id).toBe(user.id); + + const history = await historyOf(chat.id, token); + expect(history.response.status).toBe(200); + expect(history.body.items.map((item) => item.id)).toContain( + message.id, + ); + + const sent = await request( + `/api/v1/chats/${chat.id}/messages`, + json({ text: 'Сообщение после отказа' }, messageHeaders(token)), + ); + expect(sent.response.status).toBe(201); + }, + outagedRequestBudgetMs, + ); +}); diff --git a/app/tsconfig.build.json b/app/tsconfig.build.json new file mode 100644 index 00000000..2eafee0e --- /dev/null +++ b/app/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "./src" + }, + "include": ["src"], + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] +} diff --git a/app/tsconfig.json b/app/tsconfig.json new file mode 100644 index 00000000..8109c41f --- /dev/null +++ b/app/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "nodenext", + "moduleResolution": "nodenext", + "resolvePackageJsonExports": true, + "esModuleInterop": true, + "isolatedModules": true, + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "ES2023", + "sourceMap": true, + "outDir": "./dist", + "incremental": true, + "skipLibCheck": true, + "strict": true, + "strictPropertyInitialization": false, + "types": ["vitest/globals", "node"] + } +} diff --git a/app/vitest.config.e2e.ts b/app/vitest.config.e2e.ts new file mode 100644 index 00000000..a7d63173 --- /dev/null +++ b/app/vitest.config.e2e.ts @@ -0,0 +1,14 @@ +import { defineConfig } from 'vitest/config'; +import tsconfigPaths from 'vite-tsconfig-paths'; + +export default defineConfig({ + plugins: [tsconfigPaths()], + test: { + globals: true, + root: './', + include: ['test/*.e2e-spec.ts'], + testTimeout: 30_000, + hookTimeout: 30_000, + sequence: { concurrent: false }, + }, +}); diff --git a/app/vitest.config.ts b/app/vitest.config.ts new file mode 100644 index 00000000..9384f47b --- /dev/null +++ b/app/vitest.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'vitest/config'; +import tsconfigPaths from 'vite-tsconfig-paths'; + +export default defineConfig({ + // Resolves the path aliases declared in tsconfig.json, including the ones + // added by `nest g library`. + plugins: [tsconfigPaths()], + test: { + globals: true, + root: './', + include: ['**/*.spec.ts'], + }, +}); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..1d264164 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,63 @@ +services: + postgres: + image: postgres:16.4-alpine + environment: + POSTGRES_DB: ${POSTGRES_DB:-messenger} + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env} + volumes: + - postgres-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 5s + timeout: 3s + retries: 20 + + redis: + image: redis:7.4.2-alpine + command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"] + volumes: + - redis-data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 3s + retries: 20 + + migrate: + build: + context: . + dockerfile: Dockerfile + image: mtusi-messenger:lab3 + command: ["node", "dist/database/migration.runner.js"] + env_file: [.env] + depends_on: + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + restart: "no" + + api: + build: + context: . + dockerfile: Dockerfile + image: mtusi-messenger:lab3 + ports: + - "${APP_PUBLIC_PORT:-8080}:${APP_PORT:-8080}" + env_file: [.env] + environment: + CACHE_MODE: ${CACHE_MODE:-protected} + CACHE_MISS_DELAY_MS: ${CACHE_MISS_DELAY_MS:-0} + SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} + depends_on: + migrate: { condition: service_completed_successfully } + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + healthcheck: + test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:'+ (process.env.APP_PORT||8080) + '/health/ready').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"] + interval: 5s + timeout: 3s + retries: 20 + +volumes: + postgres-data: + redis-data: diff --git a/scripts/restart.sh b/scripts/restart.sh new file mode 100755 index 00000000..4d00912e --- /dev/null +++ b/scripts/restart.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`. +# Semantic and evidence notes: tests/README.md ("Проверка сохранности") and REPORT.md. +set -euo pipefail + +compose=(docker compose --env-file .env) +"${compose[@]}" restart postgres redis api +"${compose[@]}" up -d --no-recreate --no-deps --wait postgres redis api -- 2.54.0 From 917ed1a734565cd6ef0a9ef5a7e58e55dc36cbbf Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 15 Oct 2026 21:14:17 +0300 Subject: [PATCH 02/16] =?UTF-8?q?lab3:=20=D1=81=D1=82=D0=B5=D0=BD=D0=B4=20?= =?UTF-8?q?HAProxy=20+=20=D1=80=D0=B5=D0=BF=D0=BB=D0=B8=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=20compose,=20=D0=BB=D0=B8=D0=BC=D0=B8=D1=82?= =?UTF-8?q?=D1=8B,=20=D1=85=D1=83=D0=BA=D0=B8=20=D0=BE=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B8=20=D0=BA=D0=B2=D0=B8?= =?UTF-8?q?=D0=B5=D1=81=D1=86=D0=B5=D0=BD=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - compose.yaml: проект mtusi-lab3, HAProxy как единственная точка входа, deploy.replicas ${API_REPLICAS:-2}, CPU/RAM-лимиты на каждый сервис, stop_grace_period 20s, лимиты из переменных (API_CPUS_PER_REPLICA и т.д.), loopback-порты PostgreSQL/Redis только для операторских проверок; у API портов нет; container_name нигде не задан. - infra/haproxy/haproxy.cfg: проба GET /internal/lb-check, inter 500ms/fall 2 (~1s обнаружение), server-template + DNS Docker вместо статического списка, stats на 127.0.0.1:8404. - Дрейн: SIGTERM -> реплика сразу перестаёт проходить пробу LB -> пауза DRAIN_DELAY_MS -> закрытие сервера и пулов. Nest уничтожает провайдеров раньше beforeApplicationShutdown, поэтому последовательность вынесена в main.ts, а HealthService отвечает только за флаг not-ready. - scripts/stop-one.sh (остановка ровно одной реплики по X-Instance-Id), scripts/start-replica.sh (восстановление до API_REPLICAS), scripts/quiesce.sh (остановка/возврат посторонних контейнеров хоста), restart.sh перезапускает и LB, scripts/app-e2e.sh (host-side e2e через loopback-порты). - Makefile: stand-up/down/status, stand-replica, wait-ready, quiesce-up/down, test-e2e, test-failover-all, rolling-update, track1, evidence. - Dockerfile: ARG/ENV BUILD_ID для доказательства rolling update. Проверено: make test, make test-e2e, make test-persistence (restart.sh), make test-failover (stop-one.sh, восстановление через start-replica.sh), make test-dependencies; docker inspect подтверждает NanoCpus/Memory и отсутствие опубликованных портов у api. --- .gitignore | 1 + Dockerfile | 5 + Makefile | 61 ++++++++- app/src/health/health.service.spec.ts | 5 - app/src/health/health.service.ts | 14 +-- app/src/main.ts | 25 +++- compose.yaml | 174 ++++++++++++++++++++++++++ docker-compose.yml | 63 ---------- infra/haproxy/haproxy.cfg | 54 ++++++++ scripts/app-e2e.sh | 19 +++ scripts/quiesce.sh | 70 +++++++++++ scripts/restart.sh | 4 +- scripts/start-replica.sh | 16 +++ scripts/stop-one.sh | 35 ++++++ 14 files changed, 464 insertions(+), 82 deletions(-) create mode 100644 compose.yaml delete mode 100644 docker-compose.yml create mode 100644 infra/haproxy/haproxy.cfg create mode 100755 scripts/app-e2e.sh create mode 100755 scripts/quiesce.sh create mode 100755 scripts/start-replica.sh create mode 100755 scripts/stop-one.sh diff --git a/.gitignore b/.gitignore index b5a71896..8515d854 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ coverage/ .vscode/ # Keep small, sanitized evidence summaries in evidence/ under version control. # Inspect git diff --cached: ignore rules are not a secret scanner. +.lab3-quiesce.json diff --git a/Dockerfile b/Dockerfile index ae3280e5..7f8f579d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,11 @@ FROM node:25.7.0-slim AS runtime WORKDIR /usr/src/app +# BUILD_ID доказывается через GET /internal/metrics и меняется при rolling +# update: он показывает, какая именно сборка отвечает на запрос. +ARG BUILD_ID=unknown +ENV BUILD_ID=$BUILD_ID + ENV NODE_ENV=production ENV APP_PORT=8080 ENV DRAIN_DELAY_MS=5000 diff --git a/Makefile b/Makefile index a5a4d426..87c4b9f8 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,23 @@ CA_FILE ?= ACTION_SCRIPT ?= TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",) COMPOSE_ENV_FILE ?= .env +COMPOSE = docker compose --env-file $(COMPOSE_ENV_FILE) +LAB3 = $(PYTHON) scripts/lab3/lab3.py +FAILOVER_RUNS ?= 3 +RATE ?= 200 +TRACK1_ARGS ?= -.PHONY: help check validate test load test-persistence test-failover test-dependencies +.PHONY: help check validate test load test-persistence test-failover test-dependencies \ + stand-up stand-down stand-status stand-replica wait-ready quiesce-up quiesce-down \ + test-e2e test-failover-all rolling-update track1 evidence help: @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes; test-dependencies: stops/restarts Redis and PostgreSQL" + @echo "stand-up/stand-down/stand-status: HAProxy + API x API_REPLICAS over shared PostgreSQL and Redis" + @echo "stand-replica: restore one missing API replica; wait-ready: wait for /health/ready" + @echo "quiesce-up/quiesce-down: stop and restore unrelated background containers of the host" + @echo "test-e2e: app black-box suite against the stand; test-failover-all: failover for every replica in turn" + @echo "rolling-update: replace replicas one by one under load; track1: full scaling-price series; evidence: rebuild aggregates and graphs" check: $(PYTHON) scripts/check_contract.py @@ -32,3 +44,50 @@ test-failover: test-dependencies: cd app && E2E_COMPOSE_DIR="$(CURDIR)" E2E_COMPOSE_ENV_FILE="$(COMPOSE_ENV_FILE)" npm run test:dependencies + +stand-up: + $(COMPOSE) up -d --build --wait + +stand-down: + $(COMPOSE) down + +stand-status: + $(COMPOSE) ps + +stand-replica: + scripts/start-replica.sh + +wait-ready: + @for attempt in $$(seq 1 60); do \ + if curl -fsS "$(BASE_URL)/health/ready" >/dev/null 2>&1; then \ + echo "stand is ready ($(BASE_URL))"; exit 0; \ + fi; \ + sleep 1; \ + done; \ + echo "stand did not become ready within 60s" >&2; exit 1 + +quiesce-up: + scripts/quiesce.sh up + +quiesce-down: + scripts/quiesce.sh down + +test-e2e: + scripts/app-e2e.sh + +test-failover-all: + @for run in $$(seq 1 $(FAILOVER_RUNS)); do \ + echo "=== failover run $$run of $(FAILOVER_RUNS)"; \ + $(MAKE) test-failover ACTION_SCRIPT=scripts/stop-one.sh || exit 1; \ + scripts/start-replica.sh; \ + $(MAKE) wait-ready; \ + done + +rolling-update: + $(LAB3) rolling-update --under-load --rate $(RATE) + +track1: + $(LAB3) track1 $(TRACK1_ARGS) + +evidence: + $(LAB3) analyze diff --git a/app/src/health/health.service.spec.ts b/app/src/health/health.service.spec.ts index d4b0b6db..05ae6b93 100644 --- a/app/src/health/health.service.spec.ts +++ b/app/src/health/health.service.spec.ts @@ -6,11 +6,9 @@ describe('HealthService', () => { it('reports liveness and readiness when dependencies are healthy', async () => { const database = { health: vi.fn().mockResolvedValue(undefined) }; const redis = { health: vi.fn().mockResolvedValue(undefined) }; - const config = { get: vi.fn().mockReturnValue(0) }; const service = new HealthService( database as never, redis as never, - config as never, ); expect(service.getLiveness()).toEqual({ status: 'ok' }); await expect(service.getReadiness()).resolves.toEqual({ status: 'ok' }); @@ -24,7 +22,6 @@ describe('HealthService', () => { const service = new HealthService( database as never, redis as never, - { get: vi.fn() } as never, ); await expect(service.getReadiness()).rejects.toBeInstanceOf( ServiceUnavailableException, @@ -35,7 +32,6 @@ describe('HealthService', () => { const service = new HealthService( { health: vi.fn() } as never, { health: vi.fn() } as never, - { get: vi.fn() } as never, ); service.setDraining(); expect(service.getLiveness()).toEqual({ status: 'ok' }); @@ -48,7 +44,6 @@ describe('HealthService', () => { const service = new HealthService( { health: vi.fn().mockRejectedValue(new Error('down')) } as never, { health: vi.fn().mockRejectedValue(new Error('down')) } as never, - { get: vi.fn() } as never, ); expect(service.getLbCheck()).toEqual({ status: 'ok' }); service.setDraining(); diff --git a/app/src/health/health.service.ts b/app/src/health/health.service.ts index 173ca996..785f2083 100644 --- a/app/src/health/health.service.ts +++ b/app/src/health/health.service.ts @@ -4,10 +4,8 @@ import { Module, ServiceUnavailableException, } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; import { DatabaseClient } from '../database/database.client.js'; import { RedisClient } from '../redis/redis.client.js'; -import type { AppConfig } from '../config/app-config.schema.js'; @Injectable() export class HealthService { @@ -15,7 +13,6 @@ export class HealthService { constructor( private readonly database: DatabaseClient, private readonly redis: RedisClient, - private readonly config: ConfigService, ) {} getLiveness() { return { status: 'ok' as const }; @@ -40,16 +37,13 @@ export class HealthService { } return { status: 'ok' as const }; } + // Called on SIGTERM before the drain delay: the replica turns not-ready for + // both the LB probe and the operator probe while it finishes in-flight + // requests. The delay itself lives in main.ts, because Nest destroys + // providers (closing the pools) before this class could serve anyone. setDraining() { this.ready = false; } - async beforeApplicationShutdown(signal?: string): Promise { - this.setDraining(); - const delay = this.config.get('DRAIN_DELAY_MS') ?? 5000; - if (signal && delay > 0) { - await new Promise((resolve) => setTimeout(resolve, delay)); - } - } } @Global() diff --git a/app/src/main.ts b/app/src/main.ts index e621425f..1421e99f 100644 --- a/app/src/main.ts +++ b/app/src/main.ts @@ -7,6 +7,7 @@ import { NestFastifyApplication, } from '@nestjs/platform-fastify'; import { AppModule } from './app.module.js'; +import { HealthService } from './health/health.service.js'; import { MetricsService } from './metrics/metrics.service.js'; import { RequestIdInterceptor } from './common/http/request-id.interceptor.js'; @@ -29,12 +30,34 @@ async function bootstrap(): Promise { transform: true, }), ); - app.enableShutdownHooks(); const config = app.get(ConfigService); const port = config.getOrThrow('APP_PORT'); const host = config.getOrThrow('APP_HOST'); await app.listen(port, host); + + // Drain before teardown. Nest's own shutdown sequence destroys providers + // (closing the database pool and Redis) before `beforeApplicationShutdown` + // runs, so relying on it would keep the replica listed in the load balancer + // while it can no longer serve: SIGTERM must first turn the replica + // not-ready for the LB probe, then wait DRAIN_DELAY_MS, and only then close + // the server and the pools. + const health = app.get(HealthService); + const drainDelayMs = config.getOrThrow('DRAIN_DELAY_MS'); + let shuttingDown = false; + const shutdown = async (): Promise => { + if (shuttingDown) return; + shuttingDown = true; + health.setDraining(); + if (drainDelayMs > 0) + await new Promise((resolve) => setTimeout(resolve, drainDelayMs)); + await app.close(); + process.exit(0); + }; + for (const signal of ['SIGTERM', 'SIGINT', 'SIGHUP'] as const) + process.once(signal, () => { + void shutdown(); + }); } await bootstrap(); diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..bb7f4079 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,174 @@ +# Стенд lab3: клиент -> HAProxy -> API x N -> общие PostgreSQL и Redis. +# Одна команда запуска: make stand-up (docker compose --env-file .env up -d --build --wait) +# +# Проект запинен именем, чтобы имена контейнеров и labels были предсказуемы для +# scripts/stop-one.sh; container_name нигде не задан, иначе масштабирование +# одного Compose-service стало бы невозможным. +name: mtusi-lab3 + +services: + postgres: + image: postgres:16.4-alpine + # pg_stat_statements включён для трека 1 (агрегаты SQL по репликам); + # max_connections поднят под N x DATABASE_POOL_MAX. + command: + [ + 'postgres', + '-c', + 'shared_preload_libraries=pg_stat_statements', + '-c', + 'max_connections=120', + '-c', + 'shared_buffers=128MB', + '-c', + 'effective_cache_size=384MB', + ] + environment: + POSTGRES_DB: ${POSTGRES_DB:-messenger} + POSTGRES_USER: ${POSTGRES_USER:-messenger} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env} + # Только loopback: операторские проверки (host-side npm run test:e2e, + # psql в evidence). API-реплики портов не публикуют вовсе. + ports: + - '127.0.0.1:${POSTGRES_PUBLISHED_PORT:-5432}:5432' + volumes: + - postgres-data:/var/lib/postgresql/data + deploy: + resources: + limits: + cpus: '${PG_CPUS:-1.5}' + memory: ${PG_MEMORY:-512m} + healthcheck: + test: + [ + 'CMD-SHELL', + 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}', + ] + interval: 5s + timeout: 3s + retries: 20 + + redis: + image: redis:7.4.2-alpine + # appendonly: сессии и кэш переживают рестарт контейнера (проверка + # сохранности с неизменным токеном). volatile-lru вытесняет только + # ключи с TTL; в стенде у них ограниченный набор и объём. + command: + [ + 'redis-server', + '--appendonly', + 'yes', + '--appendfsync', + 'everysec', + '--maxmemory', + '96mb', + '--maxmemory-policy', + 'volatile-lru', + ] + ports: + - '127.0.0.1:${REDIS_PUBLISHED_PORT:-6379}:6379' + volumes: + - redis-data:/data + deploy: + resources: + limits: + cpus: '${REDIS_CPUS:-0.25}' + memory: ${REDIS_MEMORY:-128m} + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + interval: 5s + timeout: 3s + retries: 20 + + # Миграции выполняются один раз отдельным сервисом, а не гонкой реплик: + # api стартует только после его успешного завершения. + migrate: + build: + context: . + dockerfile: Dockerfile + image: ${API_IMAGE:-mtusi-messenger:lab3} + command: ['node', 'dist/database/migration.runner.js'] + env_file: [.env] + deploy: + resources: + limits: + cpus: '0.5' + memory: 192m + depends_on: + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + restart: 'no' + + api: + build: + context: . + dockerfile: Dockerfile + args: + BUILD_ID: ${BUILD_ID:-unknown} + image: ${API_IMAGE:-mtusi-messenger:lab3} + # Портов нет намеренно: единственная точка входа — HAProxy. + env_file: [.env] + environment: + CACHE_MODE: ${CACHE_MODE:-protected} + CACHE_MISS_DELAY_MS: ${CACHE_MISS_DELAY_MS:-0} + SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} + # Дрейн длиннее обнаружения отказа LB (500 ms x fall 2 ≈ 1 s). + DRAIN_DELAY_MS: ${DRAIN_DELAY_MS:-3000} + deploy: + replicas: ${API_REPLICAS:-2} + resources: + limits: + cpus: '${API_CPUS_PER_REPLICA:-1.5}' + memory: ${API_MEMORY_PER_REPLICA:-768m} + stop_grace_period: 20s + restart: unless-stopped + depends_on: + migrate: { condition: service_completed_successfully } + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + healthcheck: + test: + [ + 'CMD', + 'node', + '-e', + "fetch('http://127.0.0.1:'+ (process.env.APP_PORT||8080) + '/health/ready').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))", + ] + interval: 5s + timeout: 3s + retries: 20 + + haproxy: + image: haproxy:3.2-alpine + ports: + - '${APP_PUBLIC_PORT:-8080}:8080' + # Страница статистики — интерфейс LB, публикуется только на loopback. + - '127.0.0.1:${LB_STATS_PORT:-8404}:8404' + volumes: + - ./infra/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro + deploy: + resources: + limits: + cpus: '${LB_CPUS:-0.25}' + memory: ${LB_MEMORY:-128m} + depends_on: + api: { condition: service_healthy } + + # Генератор нагрузки запускается только явно: --profile load + loadgen: + image: grafana/k6:0.54.0 + profiles: ['load'] + volumes: + - ./scripts/load:/load:ro + command: ['run', '/load/write-ladder.js'] + deploy: + resources: + limits: + cpus: '${LOADGEN_CPUS:-1.5}' + memory: ${LOADGEN_MEMORY:-256m} + depends_on: + haproxy: { condition: service_healthy } + +volumes: + postgres-data: + redis-data: diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 1d264164..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,63 +0,0 @@ -services: - postgres: - image: postgres:16.4-alpine - environment: - POSTGRES_DB: ${POSTGRES_DB:-messenger} - POSTGRES_USER: ${POSTGRES_USER:-messenger} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in .env} - volumes: - - postgres-data:/var/lib/postgresql/data - healthcheck: - test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] - interval: 5s - timeout: 3s - retries: 20 - - redis: - image: redis:7.4.2-alpine - command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec"] - volumes: - - redis-data:/data - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 5s - timeout: 3s - retries: 20 - - migrate: - build: - context: . - dockerfile: Dockerfile - image: mtusi-messenger:lab3 - command: ["node", "dist/database/migration.runner.js"] - env_file: [.env] - depends_on: - postgres: { condition: service_healthy } - redis: { condition: service_healthy } - restart: "no" - - api: - build: - context: . - dockerfile: Dockerfile - image: mtusi-messenger:lab3 - ports: - - "${APP_PUBLIC_PORT:-8080}:${APP_PORT:-8080}" - env_file: [.env] - environment: - CACHE_MODE: ${CACHE_MODE:-protected} - CACHE_MISS_DELAY_MS: ${CACHE_MISS_DELAY_MS:-0} - SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} - depends_on: - migrate: { condition: service_completed_successfully } - postgres: { condition: service_healthy } - redis: { condition: service_healthy } - healthcheck: - test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:'+ (process.env.APP_PORT||8080) + '/health/ready').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"] - interval: 5s - timeout: 3s - retries: 20 - -volumes: - postgres-data: - redis-data: diff --git a/infra/haproxy/haproxy.cfg b/infra/haproxy/haproxy.cfg new file mode 100644 index 00000000..1a69d9e2 --- /dev/null +++ b/infra/haproxy/haproxy.cfg @@ -0,0 +1,54 @@ +# HAProxy — единственная точка входа lab3. +# +# Проверка готовности backend: GET /internal/lb-check (не /health/ready): +# недоступность общей БД/Redis не лечится выводом реплик из ротации, а вывод +# всех реплик подменил бы ограниченный 503 API страницей ошибки LB. +# inter 500 ms, fall 2 => максимальное время обнаружения отказа ≈ 1 s, что +# короче окна дреина API (DRAIN_DELAY_MS=3000): узел уходит из ротации раньше, +# чем перестаёт обслуживать. +# +# Реплики не перечислены статически: server-template + DNS Docker обновляет +# список адресов при масштабировании (init-addr none — стартовать без адресов +# и дождаться DNS, а не падать при пустом ответе). + +global + maxconn 8192 + log stdout format raw local0 + +defaults + mode http + option httplog + timeout connect 500ms + timeout client 35s + timeout server 30s + timeout queue 2s + retries 3 + option redispatch + retry-on conn-failure + +resolvers docker + nameserver dns1 127.0.0.11:53 + resolve_retries 3 + timeout resolve 1s + timeout retry 1s + hold valid 500ms + hold nx 500ms + hold other 1s + +frontend http + bind *:8080 + default_backend api + +backend api + balance roundrobin + option httpchk GET /internal/lb-check + http-check expect status 200 + default-server check inter 500ms fastinter 250ms downinter 1s fall 2 rise 2 maxconn 200 + server-template api 1-8 api:8080 resolvers docker init-addr none + +listen stats + bind *:8404 + stats enable + stats uri /stats + stats refresh 1s + stats show-legends diff --git a/scripts/app-e2e.sh b/scripts/app-e2e.sh new file mode 100755 index 00000000..a0fb3af5 --- /dev/null +++ b/scripts/app-e2e.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Black-box набор приложения (app/test/*.e2e-spec.ts) против поднятого стенда. +# Требует loopback-портов PostgreSQL и Redis из compose.yaml: API-реплики портов +# не публикуют, а сам набор подключается к хранилищам напрямую для проверки +# фактического состояния (уникальность пользователей, история сообщений). +set -eu + +env_file="${COMPOSE_ENV_FILE:-.env}" +# shellcheck disable=SC1090 +set -a +. "./$env_file" +set +a + +export API_BASE_URL="${API_BASE_URL:-http://127.0.0.1:${APP_PUBLIC_PORT:-8080}}" +export DATABASE_URL="postgresql://${POSTGRES_USER:-messenger}:${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD in $env_file}@127.0.0.1:${POSTGRES_PUBLISHED_PORT:-5432}/${POSTGRES_DB:-messenger}" +export REDIS_URL="redis://127.0.0.1:${REDIS_PUBLISHED_PORT:-6379}" + +cd "$(dirname "$0")/../app" +exec npm run test:e2e diff --git a/scripts/quiesce.sh b/scripts/quiesce.sh new file mode 100755 index 00000000..31a74f5b --- /dev/null +++ b/scripts/quiesce.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# Готовит хост к измерениям: посторонние контейнеры (чужие БД, прокси, dev-серверы) +# потребляют CPU/RAM и портят сравнение конфигураций стенда. Скрипт запоминает, +# что именно он остановил, и возвращает только это: чужие контейнеры, поднятые +# пользователем после `up`, скрипт не трогает. +# +# scripts/quiesce.sh up остановить фон перед серией +# scripts/quiesce.sh down вернуть ровно остановленное +# scripts/quiesce.sh status состояние фона и список остановленного +# +# Список переопределяется QUIESCE_CONTAINERS (имена через пробел), файл +# состояния — QUIESCE_STATE_FILE. +set -eu + +state_file="${QUIESCE_STATE_FILE:-.lab3-quiesce.json}" +containers="${QUIESCE_CONTAINERS:-omniroute lampa caddy redis valkey sql-lab-db-1 redis-lab-redis-1}" + +is_running() { + [ "$(docker inspect -f '{{.State.Running}}' "$1" 2>/dev/null || printf false)" = 'true' ] +} + +case "${1:-}" in +up) + if [ -f "$state_file" ]; then + printf 'quiesce: %s exists, background is already quiesced (run down first)\n' "$state_file" >&2 + exit 1 + fi + stopped='' + for container in $containers; do + if is_running "$container"; then + docker stop "$container" >/dev/null + stopped="$stopped $container" + printf 'quiesce: stopped %s\n' "$container" + fi + done + printf '%s\n' "$stopped" | tr ' ' '\n' | sed '/^$/d' | + jq -Rn --arg at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ + '{started_at: $at, stopped: [inputs]}' >"$state_file" + printf 'quiesce: %s stopped %s\n' "$(basename "$state_file")" "$(tr -d '\n' <"$state_file")" + ;; +down) + if [ ! -f "$state_file" ]; then + printf 'quiesce: no %s, nothing to restore\n' "$state_file" >&2 + exit 0 + fi + for container in $(jq -r '.stopped[]' "$state_file"); do + docker start "$container" >/dev/null + printf 'quiesce: started %s\n' "$container" + done + rm -f "$state_file" + ;; +status) + if [ -f "$state_file" ]; then + printf 'quiesced at %s: %s\n' \ + "$(jq -r '.started_at' "$state_file")" \ + "$(jq -r '.stopped | join(" ")' "$state_file")" + else + printf 'background is not quiesced\n' + fi + for container in $containers; do + if docker inspect -f '{{.State.Status}}' "$container" >/dev/null 2>&1; then + printf '%s\t%s\n' "$container" "$(docker inspect -f '{{.State.Status}}' "$container")" + fi + done + ;; +*) + printf 'usage: %s up|down|status\n' "$0" >&2 + exit 2 + ;; +esac diff --git a/scripts/restart.sh b/scripts/restart.sh index 4d00912e..44eac15d 100755 --- a/scripts/restart.sh +++ b/scripts/restart.sh @@ -4,5 +4,5 @@ set -euo pipefail compose=(docker compose --env-file .env) -"${compose[@]}" restart postgres redis api -"${compose[@]}" up -d --no-recreate --no-deps --wait postgres redis api +"${compose[@]}" restart postgres redis api haproxy +"${compose[@]}" up -d --no-recreate --no-deps --wait postgres redis api haproxy diff --git a/scripts/start-replica.sh b/scripts/start-replica.sh new file mode 100755 index 00000000..329995ee --- /dev/null +++ b/scripts/start-replica.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Восстанавливает недостающую API-реплику до объявленного числа реплик. +# Вызывается после make test-failover (или после остановки реплики вручную): +# Compose создаёт ровно ту реплику, которой не хватает, и не трогает остальные +# (--no-deps: миграции и БД не перезапускаются). +set -eu + +env_file="${COMPOSE_ENV_FILE:-.env}" +replicas="${API_REPLICAS:-}" +if [ -z "$replicas" ] && [ -f "$env_file" ]; then + replicas=$(sed -n 's/^API_REPLICAS=//p' "$env_file" | tail -n 1) +fi +replicas="${replicas:-2}" + +exec docker compose --env-file "$env_file" up -d --no-deps \ + --scale "api=${replicas}" api diff --git a/scripts/stop-one.sh b/scripts/stop-one.sh new file mode 100755 index 00000000..ea93fd86 --- /dev/null +++ b/scripts/stop-one.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Останавливает ровно одну API-реплику стенда — ту, которую обслужила текущая +# сессия. TARGET_INSTANCE_ID приходит из теста (значение X-Instance-Id ответа), +# а в Docker hostname контейнера равен его короткому ID, поэтому сопоставление +# однозначно. Ничего, кроме этой реплики, скрипт не трогает: ни LB, ни БД, ни +# тома. Возврат управления — быстрый (SIGTERM -> дрейн DRAIN_DELAY_MS=3s -> +# выход), останавливать реплику "навсегда" не требуется. +set -eu + +: "${TARGET_INSTANCE_ID:?test provides target API instance alias}" +project="${LAB3_PROJECT:-mtusi-lab3}" + +target='' +for container in $( + docker ps \ + --filter "label=com.docker.compose.project=${project}" \ + --filter 'label=com.docker.compose.service=api' \ + --format '{{.ID}}' +); do + case "$container" in + "$TARGET_INSTANCE_ID"*) + target="$container" + break + ;; + esac +done + +if [ -z "$target" ]; then + printf 'stop-one: no running api replica of project %s whose id starts with %s\n' \ + "$project" "$TARGET_INSTANCE_ID" >&2 + exit 1 +fi + +printf 'stop-one: stopping api replica %s\n' "$target" >&2 +docker stop --time 10 "$target" >/dev/null -- 2.54.0 From 410e1ea3ad1b12b1bc650484c3531e6bf76479be Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 15 Oct 2026 21:25:03 +0300 Subject: [PATCH 03/16] =?UTF-8?q?lab3:=20=D1=85=D0=B0=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D1=81=D1=81=20=D1=8D=D0=BA=D1=81=D0=BF=D0=B5=D1=80=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20(k6,=20=D1=81=D1=8D=D0=BC?= =?UTF-8?q?=D0=BF=D0=BB=D0=B5=D1=80,=20=D0=B0=D0=BD=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=B7)=20=D0=B8=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D1=81=D0=BA=D0=B8=D0=B5=20=D1=86=D0=B5=D0=BB=D0=B8=20Mak?= =?UTF-8?q?efile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - scripts/load/common.js + write-ladder.js + write-steady.js: лестница плоских полок constant-arrival-rate, пошаговые счётчики/тренды (k6 не создаёт подметрики произвольных тегов), подготовка синтетических пользователей и чатов, сводка JSON в stdout без файлов из контейнера; MODE=write|read. - scripts/lab3/lab3.py (stdlib): stand, check (spread/instances/idempotency), run, sweep, growth, failover, rolling-update, ab, analyze, quiesce, track1. Сэмплер: docker stats (--no-stream, поток склеивает JSON и печатает ANSI), HAProxy stats CSV (заголовок помечен '#'), /internal/metrics каждой реплики, pg_stat_database/pg_stat_activity/pg_stat_statements, фон хоста. raw: