Allow nullable bookmarks

This commit is contained in:
Adria Navarro 2024-11-20 14:15:46 +01:00
parent 8519cfc495
commit 3250ad4947
2 changed files with 19 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import {
JsonFieldSubType, JsonFieldSubType,
LogicalOperator, LogicalOperator,
RelationshipType, RelationshipType,
RequiredKeys,
Row, Row,
RowSearchParams, RowSearchParams,
SearchFilters, SearchFilters,
@ -206,9 +207,23 @@ datasourceDescribe(
private async performSearch(): Promise<SearchResponse<Row>> { private async performSearch(): Promise<SearchResponse<Row>> {
if (isInMemory) { if (isInMemory) {
return dataFilters.search(_.cloneDeep(rows), { const query: RequiredKeys<Omit<RowSearchParams, "tableId">> = {
...this.query, sort: this.query.sort,
}) query: this.query.query || {},
paginate: this.query.paginate,
bookmark: this.query.bookmark,
limit: this.query.limit,
sortOrder: this.query.sortOrder,
sortType: this.query.sortType,
version: this.query.version,
disableEscaping: this.query.disableEscaping,
countRows: this.query.countRows,
viewId: undefined,
fields: undefined,
indexer: undefined,
rows: undefined,
}
return dataFilters.search(_.cloneDeep(rows), query)
} else { } else {
return config.api.row.search(tableOrViewId, this.query) return config.api.row.search(tableOrViewId, this.query)
} }

View File

@ -72,7 +72,7 @@ const searchRowRequest = z.object({
}) })
.optional(), .optional(),
paginate: z.boolean().optional(), paginate: z.boolean().optional(),
bookmark: z.union([z.string(), z.number()]).optional(), bookmark: z.union([z.string(), z.number()]).nullable().optional(),
limit: z.number().optional(), limit: z.number().optional(),
sort: z.string().optional(), sort: z.string().optional(),
sortOrder: z.nativeEnum(SortOrder).optional(), sortOrder: z.nativeEnum(SortOrder).optional(),