Skip to content

Commit bbc4e74

Browse files
committed
[CDX-390]: update VarioationsMap type
1 parent 0426731 commit bbc4e74

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/types/index.d.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export type ErrorData = {
9090
};
9191

9292
export interface ResultSources extends Record<string, any> {
93-
token_match: { count: number; [key: string]: any };
94-
embeddings_match: { count: number; [key: string]: any };
93+
token_match: { count: number;[key: string]: any };
94+
embeddings_match: { count: number;[key: string]: any };
9595
}
9696

9797
export interface SortOption extends Record<string, any> {
@@ -215,6 +215,17 @@ export type FilterExpressionRange = {
215215

216216
export type FilterExpressionRangeValue = ['-inf' | number, 'inf' | number];
217217

218+
export interface FilterNode {
219+
field: string;
220+
value: string | number | boolean;
221+
}
222+
223+
interface FilterBy {
224+
and?: Array<FilterNode | FilterBy>;
225+
or?: Array<FilterNode | FilterBy>;
226+
not?: FilterNode | FilterBy;
227+
}
228+
218229
export interface Item extends Record<string, any> {
219230
value: string;
220231
is_slotted: boolean;
@@ -249,10 +260,11 @@ export interface VariationsMap {
249260
name: string,
250261
field: string
251262
}>;
263+
filter_by: FilterBy;
252264
values: {
253265
[key: string]: {
254-
aggregation: 'first' | 'min' | 'max' | 'all',
255-
field: string
266+
aggregation: 'first' | 'min' | 'max' | 'all',
267+
field: string
256268
},
257269
},
258270
dtype: 'array' | 'object'

src/types/tests/autocomplete.test-d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ expectAssignable<AutocompleteResponse>({
6565
field: 'data.VariationId',
6666
},
6767
],
68+
filter_by: {},
6869
values: {
6970
availability: {
7071
aggregation: 'all',

src/types/tests/search.test-d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ expectAssignable<SearchResponse>({
132132
field: 'data.VariationId',
133133
},
134134
],
135+
filter_by: {},
135136
values: {
136137
availability: {
137138
aggregation: 'all',

0 commit comments

Comments
 (0)