fix: add tags and show_tags fields to PnC builder (#1626)

This commit is contained in:
Christian Benincasa
2026-01-28 17:38:18 -05:00
committed by GitHub
parent 5a400bf8ed
commit e13ceb514a
12 changed files with 129 additions and 77 deletions

View File

@@ -1035,7 +1035,7 @@ export function normalizeSearchFilter(input: SearchFilter): SearchFilter {
.with(
{
type: 'value',
fieldSpec: { type: P.union('facted_string', 'string') },
fieldSpec: { type: P.union('faceted_string', 'string') },
},
({ fieldSpec }) => {
const key: string =

View File

@@ -12,22 +12,26 @@ export function intersperse<T>(arr: T[], v: T, makeLast: boolean = false): T[] {
return flatMap(arr, (x, i) => (i === 0 && !makeLast ? [x] : [x, v]));
}
type MapperFunc<In, Out> = (t: In, index: number, arr: In[]) => Out;
type TypePredicateFunc<In, Out extends In> = (
t: In,
index: number,
arr: In[],
) => t is Out;
type MapperFunc<
In,
Out,
ArrType extends In[] | ReadonlyArray<In> = In[] | ReadonlyArray<In>,
> = (t: In, index: number, arr: ArrType) => Out;
type TypePredicateFunc<
In,
Out extends In,
ArrType extends In[] | ReadonlyArray<In> = In[] | ReadonlyArray<In>,
> = (t: In, index: number, arr: ArrType) => t is Out;
/**
* Equivalent of compact(map()) but in a single pass on the array
*/
export function collect<T, U extends T>(
arr: T[] | null | undefined,
arr: T[] | ReadonlyArray<T> | null | undefined,
f: TypePredicateFunc<T, U>,
): U[];
export function collect<T, U>(
arr: T[] | null | undefined,
arr: T[] | ReadonlyArray<T> | null | undefined,
f: MapperFunc<T, U | null | undefined>,
): U[];
export function collect<
@@ -36,7 +40,7 @@ export function collect<
Func extends
| MapperFunc<T, U | null | undefined>
| (U extends T ? TypePredicateFunc<T, U> : never),
>(arr: T[] | null | undefined, f: Func): U[] {
>(arr: T[] | ReadonlyArray<T> | null | undefined, f: Func): U[] {
if (isNil(arr)) {
return [];
}