Commit 0973d51
feat(app): add createClientEffect for zero-boilerplate OpenAPI usage (#6)
* Initial commit with task details
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.
Issue: #5
* feat(app): add createClientEffect with universal dispatcher for zero-boilerplate API usage
- Add createUniversalDispatcher that classifies responses by HTTP status range
(2xx → success channel, non-2xx → error channel) without code generation
- Add createClientEffect<Paths>(options) — zero-boilerplate Effect-based API client
that works with any OpenAPI schema without generated dispatchers or registry setup
- Export new APIs through shell/api-client/index.ts
This enables the user's desired DSL:
const apiClientEffect = createClientEffect<paths>(clientOptions)
apiClientEffect.POST("/api/auth/login", { body: credentials })
INVARIANT: ∀ path, method: path ∈ PathsForMethod<Paths, method> (compile-time)
INVARIANT: ∀ status ∈ [200..299]: success channel; otherwise: error channel (runtime)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(tests): add runtime and type-level tests for createClientEffect with auth schema
- 10 runtime tests: POST /api/auth/login (200, 400, 401, 500),
POST /api/auth/logout (204), GET /api/auth/me (200, 401),
POST /api/register (201, 409), UnexpectedContentType boundary error
- 23 type-level tests: PathsForMethod constraints, literal status preservation,
HttpError status unions, ApiFailure union members, RequestOptionsFor body constraints
Total tests: 69 → 102 (all passing)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Revert "Initial commit with task details"
This reverts commit ab9bf8c.
* fix(lint): exclude generated openapi.d.ts from lint rules that conflict with openapi-typescript output
- Add ESLint override for openapi.d.ts: disable sonarjs/class-name and max-lines
(openapi-typescript generates lowercase interface names per OpenAPI spec convention)
- Add openapi.d.ts to jscpd ignore list (generated types have structural repetition by design)
- Auto-formatted openapi.d.ts by ESLint dprint (semicolons → ASI, tabs → spaces)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(app): export createClientEffect from package entry point and add CI integration test
- Export createClientEffect and createUniversalDispatcher from src/index.ts
so `import { createClientEffect, type ClientOptions } from "openapi-effect"` works
- Add integration test verifying the exact user DSL snippet from issue #5:
createClientEffect<paths>(options).POST("/api/auth/login", { body: credentials })
- 5 new tests: POST with body, yield* pattern, error handling, GET, 204 no-content
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: codex-ci <codex-ci@users.noreply.github.com>1 parent a349302 commit 0973d51
File tree
9 files changed
+1283
-441
lines changed- packages/app
- src
- core/api
- shell/api-client
- tests/api-client
9 files changed
+1283
-441
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments