diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..4c85f9c --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import js from '@eslint/js'; +import globals from 'globals'; +export default [js.configs.recommended,{files:['**/*.js'],languageOptions:{globals:{...globals.node,...globals.browser}},rules:{'no-unused-vars':['error',{argsIgnorePattern:'^_'}]}},{ignores:['node_modules/**']}]; diff --git a/openspec/changes/tptip-4-private-profile/design.md b/openspec/changes/tptip-4-private-profile/design.md new file mode 100644 index 0000000..f921085 --- /dev/null +++ b/openspec/changes/tptip-4-private-profile/design.md @@ -0,0 +1,21 @@ +## Context +Основная ветка содержит шаблон без приложения и настроенных проверок. В общей папке работают другие сессии; реализация ведётся в отдельном worktree. + +## Goals / Non-Goals +Цель: полностью рабочий приватный профиль и вычисляемое питание. Не переносить чужие незавершённые задачи. + +## Decisions +- Node.js 24 LTS и встроенный SQLite: транзакции, изоляция пользователей и минимум зависимостей. Файл в DATA_DIR на постоянном томе; не localStorage. +- Пароль: scrypt с индивидуальной солью; вход по имени и паролю, непрозрачная серверная сессия, HttpOnly SameSite=Strict cookie, срок 7 дней. Проверять Origin у мутаций, ограничить размер тела и частоту попыток. +- При регистрации и каждом входе рост 100–250 см и вес 25–350 кг обязательны. Возраст 18–100, пол для формулы и активность пользователь выбирает самостоятельно, без предустановок. Формула Mifflin–St Jeor с коэффициентом активности; белок 1.6 г/кг. Это ориентир для здоровых взрослых, не медицинское назначение. +- GET/PUT /api/profile не принимают идентификатор другого пользователя. Меню вычисляется на сервере из сохранённого профиля при каждом чтении, порции масштабируются под калории. Пароли и измерения не логируются. +- Все тексты и названия блюд в i18n.json (ru/kk/en), ключи ошибок переводит клиент. Статические файлы доступны строго по белому списку. +- Sentry включается только при DSN, с release/environment и без PII. + +## Risks / Trade-offs +- Один экземпляр сервера → SQLite достаточен, несколько реплик потребуют общей БД. +- Потеря тома → регулярная резервная копия data/profile.sqlite средствами платформы; не удалять том при обновлении. +- Будущая интеграция TPTIP-8 → сохранение server.js и index.html потребует разрешения конфликтов; собственные файлы профиля изолированы в profile/. + +## Migration Plan +Создание таблиц при старте. Профили не заполняются фиктивными данными. Откат образа сохраняет том; резервная копия перед миграциями. diff --git a/openspec/changes/tptip-4-private-profile/proposal.md b/openspec/changes/tptip-4-private-profile/proposal.md new file mode 100644 index 0000000..8a75ab0 --- /dev/null +++ b/openspec/changes/tptip-4-private-profile/proposal.md @@ -0,0 +1,20 @@ +TPTIP-4 — https://peppa.telecom.quest — личные данные вместо подставленного роста и веса. + +## Why +В основной ветке только шаблон: сохранённого tasks.md и приложения нет. Нужен работающий личный профиль, на данных которого можно строить питание. + +## What Changes +- Регистрация и вход с обязательными ростом и весом, без заполненных заранее значений. +- Закрытый профиль с редактированием и пересчётом нормы и порций меню. +- Проверки значений и тексты на русском, казахском и английском. + +## Capabilities +### New Capabilities +- `private-profile`: авторизация, личные измерения, расчёт питания. +### Modified Capabilities +Нет. + +## Impact +Новый небольшой Node.js сервер, SQLite, браузерный интерфейс, проверки и контейнер. Ветки TPTIP-8 и TPTIP-6 ещё не в main; их изменения не включаются. Вне scope: журнал тренировок, фотографии, восстановление пароля, лечебные рекомендации. + +Открытые вопросы к PM: нет. diff --git a/openspec/changes/tptip-4-private-profile/specs/private-profile/spec.md b/openspec/changes/tptip-4-private-profile/specs/private-profile/spec.md new file mode 100644 index 0000000..dbd77e4 --- /dev/null +++ b/openspec/changes/tptip-4-private-profile/specs/private-profile/spec.md @@ -0,0 +1,44 @@ +## Purpose +Личный профиль хранит введённые пользователем измерения и позволяет рассчитывать питание без подставленных данных. + +## ADDED Requirements + +### Requirement: Обязательные измерения +Система SHALL требовать рост 100–250 см и вес 25–350 кг при регистрации и входе, без значений по умолчанию, с проверками в браузере и на сервере. + +#### Scenario: Регистрация с измерениями +- **GIVEN** новый пользователь открыл регистрацию +- **WHEN** он вводит рост 182, вес 81 и остальные обязательные данные +- **THEN** открывается его профиль с ростом 182 и весом 81 + +#### Scenario: Пустое или неверное измерение +- **GIVEN** пользователь открыл вход +- **WHEN** он оставляет рост пустым или вводит вес «abc» +- **THEN** продолжить нельзя и показана подсказка исправить данные + +### Requirement: Изменение и расчёт +Система SHALL сохранять изменения профиля и вычислять норму калорий, белка и порции меню по введённым данным при каждом чтении; без полного профиля расчёт недоступен. + +#### Scenario: Пересчёт после изменения +- **GIVEN** пользователь вошёл с ростом 182 и весом 81 +- **WHEN** он сохраняет вес 84 +- **THEN** профиль показывает вес 84, обновлённые калории, белок и порции меню +- **AND** обновление страницы сохраняет результат + +#### Scenario: Ошибка редактирования +- **GIVEN** пользователь вошёл с весом 81 +- **WHEN** он пытается сохранить вес 0 +- **THEN** показана подсказка допустимого диапазона и сохранён вес 81 + +### Requirement: Приватность +Система SHALL отдавать профиль и питание только владельцу после входа, сохранять данные на сервере и прекращать доступ после выхода. + +#### Scenario: Два пользователя +- **GIVEN** у Анны вес 81, а у Бориса 92 в отдельных учётных записях +- **WHEN** Борис открывает профиль +- **THEN** он видит только вес 92 + +#### Scenario: Доступ без входа +- **GIVEN** пользователь вышел из учётной записи +- **WHEN** он запрашивает профиль повторно +- **THEN** данные не возвращаются и требуется войти diff --git a/openspec/changes/tptip-4-private-profile/tasks.md b/openspec/changes/tptip-4-private-profile/tasks.md new file mode 100644 index 0000000..0f2d937 --- /dev/null +++ b/openspec/changes/tptip-4-private-profile/tasks.md @@ -0,0 +1,9 @@ +## 1. Личный профиль +- [x] 1.1 Реализовать серверную регистрацию, вход, выход, приватное хранение и редактирование, расчёт питания; проверить интеграционными тестами границы, изоляцию и пересчёт. +## 2. Интерфейс +- [ ] 2.1 Создать форму входа и регистрации, профиль и меню с пустыми полями, переводами ru/kk/en и словарём; проверить сценарии в браузере. +## 3. Доставка +- [ ] 3.1 Настроить контейнер, постоянный том, Sentry и команды проверок; описать запуск и проверить /healthz. +- [ ] 3.2 Запустить проверки через peppa-check, сверить видимые тексты со словарём, выполнить openspec validate. +## Workflow follow-up +- Архивировать, записать память, открыть PR и передать в review после зелёных проверок. diff --git a/package-lock.json b/package-lock.json index 868a7ca..56ccf86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,21 @@ { - "name": "treker-po-trenirovkam-i-pitaniyu", - "version": "1.0.0", + "name": "tptip-profile", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "treker-po-trenirovkam-i-pitaniyu", - "version": "1.0.0", + "name": "tptip-profile", + "dependencies": { + "@sentry/node": "^11.13.0" + }, "devDependencies": { "@eslint/js": "^10.0.1", "eslint": "^10.15.0", "globals": "^17.14.0", - "jsdom": "^31.0.1" + "playwright": "^1.65.1" + }, + "engines": { + "node": ">=24" } }, "node_modules/@cacheable/memory": { @@ -166,24 +170,6 @@ "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/@exodus/bytes": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", - "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^20.19.0 || ^22.12.0 || >=24.0.0" - }, - "peerDependencies": { - "@noble/hashes": "^1.8.0 || ^2.0.0" - }, - "peerDependenciesMeta": { - "@noble/hashes": { - "optional": true - } - } - }, "node_modules/@humanfs/core": { "version": "0.19.2", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", @@ -254,9 +240,14 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz", "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==", - "dev": true, "license": "BlueOak-1.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==", + "license": "MIT" + }, "node_modules/@keyv/bigmap": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", @@ -281,6 +272,463 @@ "dev": true, "license": "MIT" }, + "node_modules/@opentelemetry/api": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.10.0.tgz", + "integrity": "sha512-lMkyes8iHrG+mk6WH7X70MdCLI2RS0FwNBY1PyQ8UemaijE2m5mv5A0Niy3HtbYTFrgkUEQjFMXmSAk2hQDuPQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm-eabi": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.152.0.tgz", + "integrity": "sha512-393VtirINkae4XHBTkq/yQxhOwEr4V+r0et37P2fp+sYZSdYgZTRDPo5Um8vBh0QjMZ+RmaMy4PP0qwr4cTMwA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.152.0.tgz", + "integrity": "sha512-iYFcExATJNZ0rZj0o02THbD1Nc9jAW0nVgIQPee6ejbSASpbZXlIMw8jxtpzaG14JQTWwGSZ6U5dEtRJXE6V3Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.152.0.tgz", + "integrity": "sha512-fnU+DfUzi5/rFy0LzmipYRz06PAUUkOS8kCJQ3Eg6oqlunC1XZXoffFqxmdL51RmcbYtUG3P8DVG1U5fckoa2A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-x64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.152.0.tgz", + "integrity": "sha512-Y3U2okryWTs7hDld6UhjJwLNf8/do+x4g4C+1U5SiGwrTLwbO83WJYJA8+l9iFSilWBgnfpd/+U76tfeNxUHzA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-freebsd-x64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.152.0.tgz", + "integrity": "sha512-XkhkRrrPffEw+ZLv/d/5pEni0buxinm/E/N6fLbJCunD1DBbeCTtVP23ESV+4CWCWdSz397asks1ViGslpmWiQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.152.0.tgz", + "integrity": "sha512-MLzsRRbdfmdzo6JEhbC1yKU9ItfvM8tEf18HM32jCiNYZEz6J3bRBRl3cTkKR0vBdrk9ZVlcARXtwHccs+epDA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-musleabihf": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.152.0.tgz", + "integrity": "sha512-HHerTEJz7Iy10Ji6BGsk4gqG6PU0UzFuBu91jIEOX89FnrI5ECWSEr7BLpkYQhp7U0QFtMnBhNfQKI0hYZK78w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.152.0.tgz", + "integrity": "sha512-9Bb8GyzZ2uSLzRDZ27usaKokr07mxiBe2dDF5b6bd2janmaJTT1gL51UfP7AU30yFiXrJvcRyFKREAgKwZYs0w==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.152.0.tgz", + "integrity": "sha512-om7iDMUroI74A/lfRRWY9/Ev3VWrVsrUZ4tyvyh8raBey/sdcfyAD7tYWc+iykAiotnmftyKTpUKFr1QnaBrAQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-ppc64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.152.0.tgz", + "integrity": "sha512-Lf1OL2lMTqwDMFC6jnRb30B+WYHKV0XT+bPHcFM6xHtNVwxpobiTzUIvKH6a0LWpvfwyru8Yu6zCGHqqFHH+gg==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.152.0.tgz", + "integrity": "sha512-BYWSMQK+YJ9ZILStPcmmiSVq8KEG9Qdq/c4BHPC3rUEq/fEDCVjUIwdj5ZzjgZ9P9is9PKu0tcAXzq1ZXg4urQ==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.152.0.tgz", + "integrity": "sha512-d2LqHNNNqdH185sRK5dPKWZu201JrNu9/CRFuVEuT+ht7n/QaVblEMWT9MALQPrDWYvhG10P+NSKJFquDWZ09w==", + "cpu": [ + "riscv64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-s390x-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.152.0.tgz", + "integrity": "sha512-8gBeHt5rA/8+pKhHl+zLggfa3L/V/L2at96p7ty6pBE7id6lFO19nFUc15u2PcjC4OYeYK465MKy1fhhbpFIGw==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.152.0.tgz", + "integrity": "sha512-ltgrSF6L+yPTVsIdaAyqKq3zTqzj/1VlNbxWZuxAe8flR3sWdyNsKvdXukoO8/ucJbLickhmieRBge+o/e8Ugw==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.152.0.tgz", + "integrity": "sha512-LcMp6BvrBnewSfdkLHoSqidhoAq4syKOTBV5TYHWd+2VnGkfD/nPRRVIzTBt/Lkbt7pfOFDGtkiTntFS0p6sQQ==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-openharmony-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-openharmony-arm64/-/binding-openharmony-arm64-0.152.0.tgz", + "integrity": "sha512-jbhoMCslVxzRCRNQ8TSHxjYdSKRvk8O6ciLVDkahJvmyHDzBqba/bMQHM6ULKj/rgHNNbSzlIiakdx8SEfkJzA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-arm64-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.152.0.tgz", + "integrity": "sha512-JZYVlhv36mr/nertnRB7vchJECOBb1Lz6lltalILsB+o9M/is+H6BEDRLQKdqA4JKs6NjJszo46+iM5sfwj6jQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-ia32-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.152.0.tgz", + "integrity": "sha512-1X9oganvVsunRH0lH10UU05N+H9atpX6WsOybByUjwnfcd3h/0tYwvuv16XuHglrIUOnxV2TodbLVEwwafd64g==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-x64-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.152.0.tgz", + "integrity": "sha512-sw0M80/dn9rcpu+Rqqph/C+MjvDDce6MlXmFjsNQtPEymha0eJy3ml6+foSUTqFfpDIDyHZZ4eoJ43IoMe8bJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.152.0.tgz", + "integrity": "sha512-oM/5rLBm2tPkg0iBgkH/FOeR3PCDpY19GTgAZjMFM8h9WI9VW7cLgzp6nwtarYKmovavIQZ+Fe/RKX/8C8O/Rw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@sentry/bundler-plugins": { + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@sentry/bundler-plugins/-/bundler-plugins-11.13.0.tgz", + "integrity": "sha512-MYH2ygxSQDf6Iuh+EmQUX4+ygWKQOWDk4j3N8O2qA9hV/8FDlUa6NSSZh30prWsSas2KJh3+63mZHwltbYYF+g==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.13.0", + "dotenv": "^17.4.2", + "glob": "^14.0.3", + "magic-string": "~0.30.8 || ^1.0.0", + "oxc-parser": "^0.152.0", + "sentry": "^0.49.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "rollup": ">=3.2.0", + "webpack": ">=5.1.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/@sentry/conventions": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@sentry/conventions/-/conventions-0.33.0.tgz", + "integrity": "sha512-5aa3g/VOnMoL8yHbfkYIWBYC3BLgMudgRNBTKNMrcMEj1mE9aKIt/CYCG7sasijhiSU4nTcSEzyM2voIVzLCng==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@sentry/core": { + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-11.13.0.tgz", + "integrity": "sha512-dRJI8RwAZvtEtW62awlZdSt8EN6fuyb3cTED78A/IgIkhNcAhhR41x+B2GuMOOJ5lrb/dOCuWLBhZwwyHW2/pg==", + "license": "MIT", + "dependencies": { + "@sentry/conventions": "^0.33.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/node": { + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-11.13.0.tgz", + "integrity": "sha512-Yj9fsfiTKmitluyH7jbGHJox58tSpoRY0318v8EvICDpp4VcCc8Kn36PZFO9chj6ezKQHNGIxxL53O4OF7u1Kg==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/bundler-plugins": "11.13.0", + "@sentry/conventions": "^0.33.0", + "@sentry/core": "11.13.0", + "@sentry/opentelemetry": "11.13.0", + "@sentry/server-runtime-injection": "11.13.0", + "@sentry/server-utils": "11.13.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/opentelemetry": { + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@sentry/opentelemetry/-/opentelemetry-11.13.0.tgz", + "integrity": "sha512-dhynqfjuL1mSM1SdzsbJvdf2JMjrSw7TdPSYHYH8m1KgAOeUdXBAAxP5M/9663vZ+IYhp0JlVxLxWgVtAh2aIQ==", + "license": "MIT", + "dependencies": { + "@sentry/conventions": "^0.33.0", + "@sentry/core": "11.13.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + } + }, + "node_modules/@sentry/server-runtime-injection": { + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@sentry/server-runtime-injection/-/server-runtime-injection-11.13.0.tgz", + "integrity": "sha512-fX+wXIbIAmu8TNhF5NMtZ21BKw8rPgXKQi7ka2eqx/JOTcdtPr22YaCiKZrljgdP9qzcD8y0oxDPrTz+PzgOmQ==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.13.0", + "@sentry/server-utils": "11.13.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/server-utils": { + "version": "11.13.0", + "resolved": "https://registry.npmjs.org/@sentry/server-utils/-/server-utils-11.13.0.tgz", + "integrity": "sha512-572farncJRHPqX3NIczJRwbo00WM8mQiwl7A+1hla3OWtI5KTIFXPC9UjTNqU2Km4angophhmDdK+ZxHCe+SyA==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.33.0", + "@sentry/core": "11.13.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, "node_modules/@types/esrecurse": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", @@ -346,44 +794,15 @@ "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/bcp-47": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bcp-47/-/bcp-47-2.1.2.tgz", - "integrity": "sha512-wsv86UuNFuPnVieKLyECTT+CP1WSAHeoIg5P3xu2kA9Z+7fVPoKt7dxzSeEhtJel0AI+NW3fIW3KtTKQKUCngg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-alphanumerical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/bcp-47-match": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/bcp-47-match/-/bcp-47-match-2.0.3.tgz", - "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==", - "dev": true, - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/brace-expansion": { "version": "5.0.13", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.13.tgz", "integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==", - "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -421,20 +840,6 @@ "node": ">= 8" } }, - "node_modules/data-urls": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", - "integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-mimetype": "^5.0.0", - "whatwg-url": "^17.1.2" - }, - "engines": { - "node": "^22.14.0 || >=24.0.0" - } - }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -453,13 +858,6 @@ } } }, - "node_modules/decimal.js": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", - "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", - "dev": true, - "license": "MIT" - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -467,17 +865,16 @@ "dev": true, "license": "MIT" }, - "node_modules/entities": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", - "integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", - "dev": true, + "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": ">=20.19.0" + "node": ">=12" }, "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "url": "https://dotenvx.com" } }, "node_modules/escape-string-regexp": { @@ -715,6 +1112,23 @@ "dev": true, "license": "ISC" }, + "node_modules/glob": { + "version": "14.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-14.0.6.tgz", + "integrity": "sha512-OwXjVP2svY5EyLY75Vek96C8qK43gqrt4xsZ+qSILdnaEiJPXkd62mcfUSNx/TQErQRdu5uM5kF67sfONragKw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^11.0.5", + "minipass": "^7.1.3", + "path-scurry": "^3.0.0" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -761,19 +1175,6 @@ "dev": true, "license": "MIT" }, - "node_modules/html-encoding-sniffer": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", - "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@exodus/bytes": "^1.15.1" - }, - "engines": { - "node": "^22.13.0 || >=24.0.0" - } - }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -794,43 +1195,6 @@ "node": ">=0.8.19" } }, - "node_modules/is-alphabetical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", - "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", - "dev": true, - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-alphanumerical": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", - "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-alphabetical": "^2.0.0", - "is-decimal": "^2.0.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, - "node_modules/is-decimal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", - "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", - "dev": true, - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -854,13 +1218,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-potential-custom-element-name": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", - "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true, - "license": "MIT" - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -868,44 +1225,6 @@ "dev": true, "license": "ISC" }, - "node_modules/jsdom": { - "version": "31.0.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-31.0.1.tgz", - "integrity": "sha512-CbhJL8ZQg3eKswxSZth4QO9tW0jPIhmR0vtSXQSbKSfWbwIT6hoRc17wdHIVTQ43KI0mdV5iTJr3281IDgVZ5g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@exodus/bytes": "^1.16.0", - "bcp-47": "^2.1.2", - "bcp-47-match": "^2.0.3", - "data-urls": "^8.0.0", - "decimal.js": "^10.6.0", - "html-encoding-sniffer": "^7.0.0", - "is-potential-custom-element-name": "^1.0.1", - "lru-cache": "^11.5.3", - "parse5": "^8.1.0", - "parse5-parser-stream": "^8.1.0", - "saxes": "^6.0.0", - "tough-cookie": "^6.0.2", - "undici": "^8.12.3", - "w3c-xmlserializer": "^6.0.0", - "webidl-conversions": "^8.0.1", - "whatwg-mimetype": "^5.0.0", - "whatwg-url": "^17.3.0", - "xml-name-validator": "^5.0.0" - }, - "engines": { - "node": "^22.22.2 || ^24.15.0 || >=26.0.0" - }, - "peerDependencies": { - "@napi-rs/canvas": "^1.0.13" - }, - "peerDependenciesMeta": { - "@napi-rs/canvas": { - "optional": true - } - } - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -964,17 +1283,24 @@ "version": "11.5.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", - "dev": true, "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, "node_modules/minimatch": { "version": "11.0.9", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.1.0", @@ -987,6 +1313,15 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1019,6 +1354,42 @@ "node": ">= 0.8.0" } }, + "node_modules/oxc-parser": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.152.0.tgz", + "integrity": "sha512-ZztsZgaCWmPeKYMdoTT5e0oV/oxD1NeLWNR3kAtr/G707cUPYaaozRlVDHLCGnszHJRszN9mJwmPNpqgwloC0A==", + "license": "MIT", + "dependencies": { + "@oxc-project/types": "^0.152.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxc-parser/binding-android-arm-eabi": "0.152.0", + "@oxc-parser/binding-android-arm64": "0.152.0", + "@oxc-parser/binding-darwin-arm64": "0.152.0", + "@oxc-parser/binding-darwin-x64": "0.152.0", + "@oxc-parser/binding-freebsd-x64": "0.152.0", + "@oxc-parser/binding-linux-arm-gnueabihf": "0.152.0", + "@oxc-parser/binding-linux-arm-musleabihf": "0.152.0", + "@oxc-parser/binding-linux-arm64-gnu": "0.152.0", + "@oxc-parser/binding-linux-arm64-musl": "0.152.0", + "@oxc-parser/binding-linux-ppc64-gnu": "0.152.0", + "@oxc-parser/binding-linux-riscv64-gnu": "0.152.0", + "@oxc-parser/binding-linux-riscv64-musl": "0.152.0", + "@oxc-parser/binding-linux-s390x-gnu": "0.152.0", + "@oxc-parser/binding-linux-x64-gnu": "0.152.0", + "@oxc-parser/binding-linux-x64-musl": "0.152.0", + "@oxc-parser/binding-openharmony-arm64": "0.152.0", + "@oxc-parser/binding-win32-arm64-msvc": "0.152.0", + "@oxc-parser/binding-win32-ia32-msvc": "0.152.0", + "@oxc-parser/binding-win32-x64-msvc": "0.152.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -1051,32 +1422,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parse5": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.1.tgz", - "integrity": "sha512-EcR/6WDcU7b2N3vQSxKALCk9lXGtUMQxXio008OEMBE0kavu/7JLfBEeFPzi43nMqVDSbEn3QCK+BMCc9zO//w==", - "dev": true, - "license": "MIT", - "dependencies": { - "entities": "^9.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/parse5-parser-stream": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-8.1.1.tgz", - "integrity": "sha512-hMcVbbUJcQmP8rURWUdYrT1flRiBiBVjq/RYGguJpDUgIXSqdYKlE0CxthmdMWoSlBAuL5bUBa73g0pttSy7Hw==", - "dev": true, - "license": "MIT", - "dependencies": { - "parse5": "^8.1.1" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1097,6 +1442,51 @@ "node": ">=8" } }, + "node_modules/path-scurry": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-3.0.0.tgz", + "integrity": "sha512-1pTbQqH1wIwMi/eleQ5leFTTCkzFsPcgXNjwOA8YGGW/W4/kHT3dssE7Z6NH+zuqNLOzOB0uaD61yl7cAcVhgg==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/playwright": { + "version": "1.65.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz", + "integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.65.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.65.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz", + "integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -1137,17 +1527,16 @@ "dev": true, "license": "MIT" }, - "node_modules/saxes": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", - "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", - "dev": true, - "license": "ISC", - "dependencies": { - "xmlchars": "^2.2.0" + "node_modules/sentry": { + "version": "0.49.0", + "resolved": "https://registry.npmjs.org/sentry/-/sentry-0.49.0.tgz", + "integrity": "sha512-9tjS0jTx5FQzhwAGhpcnwvqE0MlQiwJtunsIUNqGkw6E9CBOMbijlamIDUqvZTDtJAveVwa9L5ziP44bOJUzcQ==", + "license": "FSL-1.1-Apache-2.0", + "bin": { + "sentry": "dist/bin.cjs" }, "engines": { - "node": ">=v12.22.7" + "node": ">=20.0" } }, "node_modules/shebang-command": { @@ -1173,52 +1562,6 @@ "node": ">=8" } }, - "node_modules/tldts": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.5.4.tgz", - "integrity": "sha512-Rn2ABgjHZrA+jzqom5zhxA0hLohzYrIgfCPyhpTUxqsUrcsBYuab49LseR9waB9Jr8/MxdodvMHA91oRiGLO3Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "tldts-core": "^7.5.4" - }, - "bin": { - "tldts": "bin/cli.js" - } - }, - "node_modules/tldts-core": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.5.4.tgz", - "integrity": "sha512-9+4zWtKEDZ3V3FoZ1B97rv+5z5oqp7yeXGVze3CxgQ+CJro9do9DCPD00wxstYZDXDMXsurkBerFfiB6GYtPbA==", - "dev": true, - "license": "MIT" - }, - "node_modules/tough-cookie": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.1.0.tgz", - "integrity": "sha512-FTxc8u8Kl2tz0Lat1u8ksvcy8bwHRyEMawwTWybo51JqaC6O7SvfuhAKg+Ld6VqyIe2QRJBzY9HA7y2WyFRT2w==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tldts": "^7.0.5" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/tr46": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", - "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "^2.3.1" - }, - "engines": { - "node": "^22.14.0 || >=24.0.0" - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -1232,16 +1575,6 @@ "node": ">= 0.8.0" } }, - "node_modules/undici": { - "version": "8.12.4", - "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.4.tgz", - "integrity": "sha512-8Mx+uNKKER2bA4AdtedkqRbwUCIJFr2nJckXRe5yrDqzePqwLP7VNcctN8/XdmDSbF7mS+jJKIszlL+vbam1VA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=22.19.0" - } - }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -1252,54 +1585,6 @@ "punycode": "^2.1.0" } }, - "node_modules/w3c-xmlserializer": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", - "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "xml-name-validator": "^5.0.0" - }, - "engines": { - "node": "^22.22.2 || ^24.15.0 || >=26.0.0" - } - }, - "node_modules/webidl-conversions": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", - "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=20" - } - }, - "node_modules/whatwg-mimetype": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", - "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=20" - } - }, - "node_modules/whatwg-url": { - "version": "17.3.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz", - "integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@exodus/bytes": "^1.16.0", - "tr46": "^7.0.0", - "webidl-conversions": "^8.0.1" - }, - "engines": { - "node": "^22.14.0 || >=24.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1326,23 +1611,6 @@ "node": ">=0.10.0" } }, - "node_modules/xml-name-validator": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", - "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18" - } - }, - "node_modules/xmlchars": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true, - "license": "MIT" - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 34714eb..750f593 100644 --- a/package.json +++ b/package.json @@ -1,16 +1 @@ -{ - "name": "treker-po-trenirovkam-i-pitaniyu", - "version": "1.0.0", - "private": true, - "type": "commonjs", - "scripts": { - "lint": "eslint .", - "test": "env -u NODE_TEST_CONTEXT node --test tests/*.test.js" - }, - "devDependencies": { - "@eslint/js": "^10.0.1", - "eslint": "^10.15.0", - "globals": "^17.14.0", - "jsdom": "^31.0.1" - } -} +{"name":"tptip-profile","private":true,"type":"module","engines":{"node":">=24"},"scripts":{"start":"node server.js","lint":"eslint .","test":"node --test tests/*.test.js","build":"node --check server.js && node --check profile/app.js"},"dependencies":{"@sentry/node":"^11.13.0"},"devDependencies":{"@eslint/js":"^10.0.1","eslint":"^10.15.0","globals":"^17.14.0","playwright":"^1.65.1"}} \ No newline at end of file diff --git a/profile/service.js b/profile/service.js new file mode 100644 index 0000000..de00917 --- /dev/null +++ b/profile/service.js @@ -0,0 +1,86 @@ +import { DatabaseSync } from 'node:sqlite'; +import { randomBytes, scrypt as derive, timingSafeEqual, createHash } from 'node:crypto'; +import { promisify } from 'node:util'; +const scrypt = promisify(derive); +export class InputError extends Error { + constructor(key, status = 400) { super(key); this.status = status; } +} +export function validateProfile(input) { + const out = {}; + for (const [key, min, max] of [['height',100,250],['weight',25,350],['age',18,100]]) { + const value = input[key]; + if (!['number','string'].includes(typeof value) || !/^\d+(?:[.,]\d+)?$/.test(String(value))) throw new InputError(key); + out[key] = Number(String(value).replace(',', '.')); + if (!Number.isFinite(out[key]) || out[key] < min || out[key] > max) throw new InputError(key); + } + if (!Number.isInteger(out.age)) throw new InputError('age'); + if (!['male','female'].includes(input.sex)) throw new InputError('sex'); + out.sex = input.sex; + if (!['1.2','1.375','1.55','1.725'].includes(String(input.activity))) throw new InputError('activity'); + out.activity = Number(input.activity); + return out; +} +export function nutrition(profile) { + const p = validateProfile(profile); + const calories = Math.round((10*p.weight + 6.25*p.height - 5*p.age + (p.sex === 'male' ? 5 : -161))*p.activity); + const protein = Math.round(p.weight*1.6); + // One illustrative day: proportions sum to the daily energy estimate. + const menu = [ + { name: 'breakfast', share: .3, kcal100: 130, protein100: 7 }, + { name: 'lunch', share: .4, kcal100: 150, protein100: 12 }, + { name: 'dinner', share: .3, kcal100: 140, protein100: 11 }, + ].map(m => ({name:m.name, grams: Math.round(calories*m.share/m.kcal100*100), calories: Math.round(calories*m.share), protein: Math.round(calories*m.share/m.kcal100*m.protein100)})); + return { calories, protein, menu }; +} +const hash = value => createHash('sha256').update(value).digest('hex'); +export class ProfileService { + constructor(file, {now = () => Date.now()} = {}) { + this.now = now; + this.db = new DatabaseSync(file); + this.db.exec(`PRAGMA journal_mode=WAL; PRAGMA foreign_keys=ON; + CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, username TEXT UNIQUE NOT NULL, salt TEXT NOT NULL, password TEXT NOT NULL, profile TEXT NOT NULL); + CREATE TABLE IF NOT EXISTS sessions (token TEXT PRIMARY KEY, user_id INTEGER NOT NULL REFERENCES users(id), expires INTEGER NOT NULL);`); + } + credentials(input) { + if (typeof input.username !== 'string' || !/^[a-zA-Z0-9_-]{3,40}$/.test(input.username)) throw new InputError('username'); + if (typeof input.password !== 'string' || input.password.length < 12 || input.password.length > 128) throw new InputError('password'); + return input.username.toLowerCase(); + } + async authenticate(input, register) { + const username = this.credentials(input); + const profile = validateProfile(input); + const user = this.db.prepare('SELECT * FROM users WHERE username=?').get(username); + const salt = register || !user ? randomBytes(16).toString('hex') : user.salt; + const password = Buffer.from(await scrypt(input.password, salt, 64)); + let id; + if (register) { + if (user) throw new InputError('credentials', 409); + id = this.db.prepare('INSERT INTO users(username,salt,password,profile) VALUES(?,?,?,?)').run(username,salt,password.toString('hex'),JSON.stringify(profile)).lastInsertRowid; + } else { + if (!user || !timingSafeEqual(password, Buffer.from(user.password,'hex'))) throw new InputError('credentials',401); + id = user.id; + this.db.prepare('UPDATE users SET profile=? WHERE id=?').run(JSON.stringify(profile), id); + } + this.db.prepare('DELETE FROM sessions WHERE expires<=?').run(this.now()); + const token = randomBytes(32).toString('hex'); + this.db.prepare('INSERT INTO sessions VALUES(?,?,?)').run(hash(token),id,this.now()+7*86400000); + return token; + } + user(token) { + if (!token) throw new InputError('signin',401); + const user = this.db.prepare('SELECT users.* FROM users JOIN sessions ON user_id=users.id WHERE token=? AND expires>?').get(hash(token),this.now()); + if (!user) throw new InputError('signin',401); + return user; + } + read(token) { + const user = this.user(token), profile = JSON.parse(user.profile); + return {username:user.username,profile,nutrition:nutrition(profile)}; + } + update(token,input) { + const user = this.user(token), profile = validateProfile(input); + this.db.prepare('UPDATE users SET profile=? WHERE id=?').run(JSON.stringify(profile),user.id); + return this.read(token); + } + logout(token) { this.db.prepare('DELETE FROM sessions WHERE token=?').run(hash(token || '')); } + close() { this.db.close(); } +} diff --git a/server.js b/server.js index 9e81187..7bbb89d 100644 --- a/server.js +++ b/server.js @@ -1,41 +1,63 @@ -// Мини-сервер стенда (TPTIP-6): слушает $PORT, /healthz → 200, отдаёт файлы приложения по белому списку. -// Пока index.html нет, на «/» отдаётся страница продукта about.html. -const http = require('node:http'); -const fs = require('node:fs'); -const path = require('node:path'); - -const DIR = process.env.APP_DIR || __dirname; -const FILES = { - '/gym-plan.i18n.js': ['gym-plan.i18n.js', 'text/javascript; charset=utf-8'], - '/': ['index.html', 'text/html; charset=utf-8'], - '/index.html': ['index.html', 'text/html; charset=utf-8'], - '/manifest.webmanifest': ['manifest.webmanifest', 'application/manifest+json'], - '/sw.js': ['sw.js', 'text/javascript; charset=utf-8'], - '/icon.svg': ['icon.svg', 'image/svg+xml'], - '/about.html': ['about.html', 'text/html; charset=utf-8'], - '/about.i18n.json': ['about.i18n.json', 'application/json; charset=utf-8'] -}; -const FALLBACK = { '/': ['about.html', 'text/html; charset=utf-8'] }; - -function send(res, f, fallback) { - fs.readFile(path.join(DIR, f[0]), (err, buf) => { - if (err && err.code === 'ENOENT' && fallback) return send(res, fallback, null); - if (err && err.code === 'ENOENT') { res.writeHead(404); return res.end('not found'); } - if (err) { res.writeHead(500); return res.end('error'); } - res.writeHead(200, { 'content-type': f[1], 'cache-control': 'no-cache' }); - res.end(buf); +import * as Sentry from '@sentry/node'; +import { createServer } from 'node:http'; +import { readFile } from 'node:fs/promises'; +import { mkdirSync } from 'node:fs'; +import { resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { ProfileService, InputError } from './profile/service.js'; +if (process.env.SENTRY_DSN) Sentry.init({dsn:process.env.SENTRY_DSN,release:process.env.SENTRY_RELEASE,environment:process.env.SENTRY_ENVIRONMENT || 'dev',sendDefaultPii:false,beforeSend(event){ delete event.request; delete event.user; return event; }}); +const root = fileURLToPath(new URL('.',import.meta.url)); +const files = new Map([['/',['profile/index.html','text/html']],['/profile/app.js',['profile/app.js','text/javascript']],['/profile/style.css',['profile/style.css','text/css']],['/profile/i18n.json',['profile/i18n.json','application/json']]]); +export function createApp({database,secure = process.env.NODE_ENV === 'production'} = {}) { + if (!database) mkdirSync(process.env.DATA_DIR || resolve(root,'data'),{recursive:true,mode:0o700}); + const service = new ProfileService(database || resolve(process.env.DATA_DIR || resolve(root,'data'),'profile.sqlite')); + const attempts = new Map(); + const server = createServer(async (req,res) => { + res.setHeader('Cache-Control','no-store'); + res.setHeader('X-Content-Type-Options','nosniff'); + res.setHeader('Referrer-Policy','no-referrer'); + res.setHeader('Content-Security-Policy',"default-src 'self'; script-src 'self'; style-src 'self'; frame-ancestors 'none'; form-action 'self'; base-uri 'none'"); + const send = (status,data) => {res.writeHead(status,{'Content-Type':'application/json; charset=utf-8'});res.end(JSON.stringify(data));}; + try { + const path = new URL(req.url,'http://localhost').pathname; + if (req.method === 'GET' && path === '/healthz') return send(200,{ok:true}); + if (req.method === 'GET' && files.has(path)) { + const [file,type] = files.get(path); + res.writeHead(200,{'Content-Type':type+'; charset=utf-8'});res.end(await readFile(resolve(root,file)));return; + } + if (!path.startsWith('/api/')) throw new InputError('notFound',404); + const token = req.headers.cookie?.match(/(?:^|;\s*)session=([a-f0-9]{64})(?:;|$)/)?.[1]; + if (req.method === 'GET' && path === '/api/profile') return send(200,service.read(token)); + if (!['POST','PUT'].includes(req.method)) throw new InputError('notFound',404); + if (!req.headers.origin || new URL(req.headers.origin).host !== req.headers.host || !['http:','https:'].includes(new URL(req.headers.origin).protocol)) throw new InputError('request',403); + if (!req.headers['content-type']?.startsWith('application/json')) throw new InputError('request',415); + let body = ''; + for await (const chunk of req) {body += chunk; if (Buffer.byteLength(body)>8192) throw new InputError('request',413);} + let input; try {input = JSON.parse(body);} catch {throw new InputError('request');} + if (!input || typeof input !== 'object' || Array.isArray(input)) throw new InputError('request'); + if (req.method === 'POST' && ['/api/register','/api/login'].includes(path)) { + const now = Date.now(); + for (const [key,limit] of attempts) if (limit.until20) throw new InputError('rate',429); + attempts.set(ip,limit); + const session = await service.authenticate(input,path === '/api/register'); + res.setHeader('Set-Cookie',`session=${session}; HttpOnly; SameSite=Strict; Path=/; Max-Age=604800${secure ? '; Secure' : ''}`); + return send(200,service.read(session)); + } + if (req.method === 'PUT' && path === '/api/profile') return send(200,service.update(token,input)); + if (req.method === 'POST' && path === '/api/logout') { + service.logout(token);res.setHeader('Set-Cookie',`session=; HttpOnly; SameSite=Strict; Path=/; Max-Age=0${secure ? '; Secure' : ''}`);return send(200,{ok:true}); + } + throw new InputError('notFound',404); + } catch(error) { + if (!(error instanceof InputError)) Sentry.captureException(error); + send(error instanceof InputError ? error.status : 500,{error:error instanceof InputError ? error.message : 'server'}); + } }); + server.requestTimeout = 15000; + server.on('close',() => service.close()); + return server; } - -function createServer() { - return http.createServer((req, res) => { - const url = (req.url || '/').split('?')[0]; - if (url === '/healthz') { res.writeHead(200, { 'content-type': 'text/plain' }); return res.end('ok'); } - const f = FILES[url]; - if (!f) { res.writeHead(404); return res.end('not found'); } - send(res, f, FALLBACK[url]); - }); -} - -if (require.main === module) createServer().listen(Number(process.env.PORT) || 3000, '0.0.0.0'); -module.exports = { createServer }; +if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) createApp().listen(Number(process.env.PORT || 3000),'0.0.0.0'); diff --git a/tests/profile.test.js b/tests/profile.test.js new file mode 100644 index 0000000..184c00f --- /dev/null +++ b/tests/profile.test.js @@ -0,0 +1,69 @@ +import {test} from 'node:test'; +import assert from 'node:assert/strict'; +import {mkdtemp,rm} from 'node:fs/promises'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {createApp} from '../server.js'; +import {validateProfile,ProfileService,nutrition} from '../profile/service.js'; +const profile = {height:182,weight:81,age:32,sex:'male',activity:1.375}; +const account = {username:'anna',password:'a-long-private-password',...profile}; +test('Пустое или неверное измерение; границы диапазонов',() => { + for (const [key,values] of Object.entries({height:['',null,'abc','1e2',[],true,99,251],weight:['',null,'abc',0,351],age:[17,101,20.5],sex:['','unknown'],activity:['',99]})) { + for (const value of values) assert.throws(()=>validateProfile({...profile,[key]:value})); + } + for (const p of [{height:100,weight:25,age:18},{height:250,weight:350,age:100}]) assert.doesNotThrow(()=>validateProfile({...profile,...p})); + assert.equal(validateProfile({...profile,weight:'81,5'}).weight,81.5); + assert.equal(nutrition(profile).calories,2465); + assert.equal(nutrition(profile).protein,130); +}); +test('Регистрация с измерениями; два пользователя; пересчёт; ошибка редактирования; доступ без входа',async t => { + const server = createApp({database:':memory:'}); + await new Promise(r=>server.listen(0,'127.0.0.1',r)); + t.after(()=>new Promise(r=>server.close(r))); + const origin = `http://127.0.0.1:${server.address().port}`; + const call = async(path,method='GET',body,cookie,headers={}) => { + const response = await fetch(origin+path,{method,headers:{origin,'Content-Type':'application/json',...(cookie?{cookie}:{}),...headers},body:body===undefined?undefined:JSON.stringify(body)}); + return {status:response.status,body:await response.json(),cookie:response.headers.get('set-cookie'),headers:response.headers}; + }; + assert.equal((await call('/api/profile')).status,401); + assert.equal((await call('/api/register','POST',{...account,height:''})).status,400); + const anna = await call('/api/register','POST',account); + assert.equal(anna.status,200);assert.equal(anna.body.profile.height,182); + assert.match(anna.cookie,/HttpOnly/);assert.match(anna.cookie,/SameSite=Strict/); + assert.equal(anna.headers.get('cache-control'),'no-store'); + assert.equal(JSON.stringify(anna.body).includes('password'),false); + const boris = await call('/api/register','POST',{...account,username:'boris',weight:92}); + const own = await call('/api/profile?username=anna','GET',undefined,boris.cookie); + assert.equal(own.body.profile.weight,92); + const updated = await call('/api/profile','PUT',{...profile,weight:84,user_id:2},anna.cookie); + assert.equal(updated.body.profile.weight,84); + assert.notEqual(updated.body.nutrition.calories,anna.body.nutrition.calories); + assert.notEqual(updated.body.nutrition.protein,anna.body.nutrition.protein); + assert.notEqual(updated.body.nutrition.menu[0].grams,anna.body.nutrition.menu[0].grams); + assert.equal((await call('/api/profile','GET',undefined,anna.cookie)).body.profile.weight,84); + assert.equal((await call('/api/profile','PUT',{...profile,weight:0},anna.cookie)).status,400); + assert.equal((await call('/api/profile','GET',undefined,anna.cookie)).body.profile.weight,84); + assert.equal((await call('/api/profile','PUT',profile,anna.cookie,{origin:'https://attacker.example'})).status,403); + assert.equal((await call('/api/profile','PUT',profile,anna.cookie,{origin:''})).status,403); + assert.equal((await call('/api/login','POST',{...account,password:'wrong-password-long'})).status,401); + assert.equal((await call('/api/login','POST',{...account,weight:''})).status,400); + const login = await call('/api/login','POST',{...account,weight:86}); + assert.equal(login.body.profile.weight,86); + assert.equal((await call('/api/logout','POST',{},login.cookie)).status,200); + assert.equal((await call('/api/profile','GET',undefined,login.cookie)).status,401); + for (let n=0;n<21;n++) await call('/api/login','POST',account); + assert.equal((await call('/api/login','POST',account)).status,429); + assert.equal((await fetch(origin+'/.peppa/project.json')).status,404); + assert.equal((await fetch(origin+'/healthz')).status,200); +}); +test('Сохранение после перезапуска и истечение срока входа',async t=>{ + const dir = await mkdtemp(join(tmpdir(),'tptip-test-')); + t.after(()=>rm(dir,{recursive:true,force:true})); + let now = Date.now(); + let service = new ProfileService(join(dir,'profile.sqlite'),{now:()=>now}); + const token = await service.authenticate(account,true); + service.close();service = new ProfileService(join(dir,'profile.sqlite'),{now:()=>now}); + assert.equal(service.read(token).profile.weight,81); + now += 8*86400000; + assert.throws(()=>service.read(token));service.close(); +});