feat(434): facet-value typeahead combobox for text fields
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,21 @@ export function getSearchFields(): Promise<SearchField[]> {
|
||||
return request<SearchField[]>('/api/v1/search/fields');
|
||||
}
|
||||
|
||||
export type SearchFieldValues = components['schemas']['SearchFieldValuesResponseModel'];
|
||||
|
||||
// Backs the rule builder's facet-value typeahead (#434): distinct values a text field already holds
|
||||
// in the library, matching the in-progress query prefix. `.values` is non-nullable on the DTO, but we
|
||||
// still coerce defensively at the boundary (Core-DTO-nullable convention) in case a future model
|
||||
// change reintroduces nullability.
|
||||
export function getSearchFieldValues(name: string, q: string, limit = 50): Promise<string[]> {
|
||||
const searchParams = new URLSearchParams();
|
||||
searchParams.set('q', q);
|
||||
searchParams.set('limit', String(limit));
|
||||
return request<SearchFieldValues>(`/api/v1/search/fields/${encodeURIComponent(name)}/values?${searchParams.toString()}`).then(
|
||||
(result) => result.values ?? []
|
||||
);
|
||||
}
|
||||
|
||||
// The ten media-item id arrays a search query resolves to, one bucket per addable kind. Wire keys
|
||||
// match AddItemsToCollectionRequest exactly, so a result pipes straight into addItemsToCollection /
|
||||
// addItemsToPlaylist via toAddItemsRequestFromSearch below.
|
||||
|
||||
Reference in New Issue
Block a user