fetcher-integration
Workflow
- Start with
@ahoo-wang/fetcherbefore reaching for higher-level packages. - Prefer
NamedFetcherwhen the client will be reused by decorators, generated clients, or app services. - Mutate
FetchExchangeinside interceptors; do not return a replacement exchange fromintercept(). - Use
ResultExtractorswhen callers need typed values instead of rawResponseobjects. - Load
references/api.mdfor exact method signatures, lifecycle order, or full examples.
Key Practices
- Keep interceptors small and phase-specific: request shaping, response validation, and error recovery are separate responsibilities.
- Use
urlParams.pathfor template variables andurlParams.queryfor query strings. - Use
validateStatusorIGNORE_VALIDATE_STATUSintentionally when non-2xx responses are part of the domain flow.
References
references/api.md: Detailed package API, examples, and edge-case guidance. Load it only when the task needs method signatures, interceptor ordering, URL parameter examples, error hierarchy, and complete service setup examples.
Related Skills
- $fetcher-decorator-service: Use when services should be declared with TypeScript decorators.
- $fetcher-openapi-generator: Use when clients should be generated from an OpenAPI document.
- $fetcher-cosec-auth: Use when interceptors need CoSec authentication behavior.