feat: add image path autocomplete option#92
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review Summary by QodoAdd automatic TMDB image path expansion with opt-in autocomplete option
WalkthroughsDescription• Add autocomplete_paths option to enable automatic TMDB image path expansion • Implement recursive response transformation in ImageAPI.autocompleteImagePaths() • Integrate path autocompletion into ApiClient response pipeline before user interceptors • Forward images config from TMDB class through to ApiClient • Refactor type guards into dedicated utils/types.ts module • Add comprehensive test coverage for path autocompletion logic Diagramflowchart LR
A["TMDB Config<br/>images.autocomplete_paths"] -->|"passes to"| B["ApiClient"]
B -->|"creates"| C["ImageAPI<br/>if enabled"]
D["API Response"] -->|"flows through"| E["sanitizeNulls"]
E -->|"transforms via"| C
C -->|"autocompleteImagePaths"| F["Expanded URLs"]
F -->|"passes to"| G["User Interceptor"]
G -->|"returns"| H["Final Response"]
File Changes1. packages/tmdb/src/client.ts
|
Code Review by Qodo
1. autocomplete_paths gates URL expansion
|
| this.requestInterceptors = raw == null ? [] : Array.isArray(raw) ? raw : [raw]; | ||
| this.onSuccessInterceptor = options.interceptors?.response?.onSuccess; | ||
| this.onErrorInterceptor = options.interceptors?.response?.onError; | ||
| this.imageApi = options.images?.autocomplete_paths ? new ImageAPI(options.images) : undefined; |
There was a problem hiding this comment.
1. autocomplete_paths gates url expansion 📎 Requirement gap ≡ Correctness
Image path autocompletion is only enabled when options.images?.autocomplete_paths is explicitly set, so TMDB image path fields can still be returned as raw partial paths even when default image options exist. This violates the requirement to autocomplete image path fields to full URLs using default options rather than requiring an opt-in flag.
Agent Prompt
## Issue description
The API response transformation only autocompletes TMDB image path fields when `images.autocomplete_paths` is explicitly enabled, which contradicts the requirement to expand image paths using default options.
## Issue Context
The response pipeline already supports transforming sanitized responses via `ImageAPI.autocompleteImagePaths()`, but transformer construction is gated behind `autocomplete_paths`, and the config docs explicitly describe it as disabled by default.
## Fix Focus Areas
- packages/tmdb/src/client.ts[49-49]
- packages/tmdb/src/client.ts[265-272]
- packages/tmdb/src/types/config/images.ts[65-72]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Closes #89
Changes
autocomplete_pathsoption toImagesConfigto enable automatic expansion of TMDB image paths to full URLsImageAPI.autocompleteImagePaths()method for recursive response transformationApiClientresponse pipeline (applied before user interceptors)imagesconfig fromTMDBclass to shared clientImageAPItest coverage to 100% (statements, branches)Features
default_image_sizesfor each image typeExample