Skip to content

Commit

Permalink
fix(hasura): crud filter types (#5952)
Browse files Browse the repository at this point in the history
  • Loading branch information
alicanerdurmaz authored May 18, 2024
1 parent 3b83cc7 commit a18b36f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/modern-rings-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@refinedev/hasura": patch
---

fix: [`hasuraFilters`](https://github.com/refinedev/refine/blob/master/packages/hasura/src/utils/generateFilters.ts) object type.

All fields in the [`CrudOperators`](https://github.com/refinedev/refine/blob/master/packages/core/src/contexts/data/types.ts#L218) interface must be used in the [`hasuraFilters`](https://github.com/refinedev/refine/blob/master/packages/hasura/src/utils/generateFilters.ts) object type, but some fields may not be supported by Hasura. To resolve this, the object type has been changed to partial.
7 changes: 2 additions & 5 deletions packages/hasura/src/utils/generateFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ export type HasuraCrudFilter = HasuraLogicalFilter | HasuraConditionalFilter;

export type HasuraCrudFilters = HasuraCrudFilter[];

const hasuraFilters: Record<
HasuraCrudOperators,
HasuraFilterCondition | undefined
const hasuraFilters: Partial<
Record<HasuraCrudOperators, HasuraFilterCondition | undefined>
> = {
eq: "_eq",
ne: "_neq",
Expand All @@ -67,8 +66,6 @@ const hasuraFilters: Record<
or: "_or",
and: "_and",
not: "_not",
between: undefined,
nbetween: undefined,
nnull: "_is_null",
startswith: "_iregex",
nstartswith: "_iregex",
Expand Down

0 comments on commit a18b36f

Please sign in to comment.