feat: переработать кастомизацию HttpClient

- добавлен плоский ApiConfig с lifecycle hooks
- добавлены ApiError, retry context, timeout и кастомные parser/serializer
- обновлены примеры, документация и тесты под новый API
This commit is contained in:
2026-06-30 23:52:06 +03:00
parent fe5d3ae091
commit 6662224a9a
9 changed files with 719 additions and 217 deletions

View File

@@ -141,7 +141,7 @@ bun test -t "should generate client with custom name"
- ❌ Без outputPath
- ✅ Опциональное поле fileName
### 4. Сгенерированный клиент (7 кейсов)
### 4. Сгенерированный клиент
**Компиляция:**
- ✅ TypeScript компиляция без ошибок
@@ -152,9 +152,10 @@ bun test -t "should generate client with custom name"
-Все endpoints присутствуют
- ✅ Корректные имена методов
- ✅ HttpClient инициализация
-Метод `setSecurityData`
-Lifecycle hooks в `HttpClient`
- ✅ Отсутствие устаревшего `baseApiParams`
### 5. Интеграционные E2E (15 кейсов)
### 5. Интеграционные E2E
**Полный цикл:**
- ✅ CLI → создание → импорт → использование
@@ -164,17 +165,15 @@ bun test -t "should generate client with custom name"
**HTTP с mock:**
- ✅ GET без параметров
- ✅ GET с query параметрами
- ✅ POST с body
-PUT/PATCH/DELETE
-Статусы 200, 201, 400, 401, 404, 500
- ❌ Network errors
-Bearer authentication
- ✅ Custom headers
-Обработка 404 статуса
-Bearer authentication через `onRequest`
- ✅ Retry через `onError` и `ApiError`
-Timeout через `AbortSignal`
## Дополнительная информация
- [План тестирования](../TESTING-PLAN.md)
- [Contributing Guidelines](../CONTRIBUTING.md)
- [Bun Test Documentation](https://bun.sh/docs/cli/test)
- [Bun Test Documentation](https://bun.sh/docs/cli/test)