Skip to content

FiltersRequestSchema

const FiltersRequestSchema: mutable<$Array<Struct<{
field: mutableKey<String>;
filter: mutableKey<Union<readonly [Union<readonly [Struct<{
kind: ...;
operator: ...;
value: ...;
}>, Struct<{
kind: ...;
operator: ...;
values: ...;
}>, Struct<{
kind: ...;
operator: ...;
}>]>, Union<readonly [Struct<{
kind: ...;
operator: ...;
value: ...;
}>, Struct<{
from: ...;
kind: ...;
operator: ...;
to: ...;
}>, Struct<{
kind: ...;
operator: ...;
values: ...;
}>, Struct<{
kind: ...;
operator: ...;
}>]>, Union<readonly [Struct<{
kind: ...;
operator: ...;
value: ...;
}>, Struct<{
kind: ...;
operator: ...;
values: ...;
}>, Struct<{
kind: ...;
operator: ...;
}>]>, Union<readonly [Struct<{
kind: ...;
operator: ...;
value: ...;
}>, Struct<{
kind: ...;
operator: ...;
}>]>, Union<readonly [Struct<{
anchor: ...;
end: ...;
kind: ...;
operator: ...;
timeZone: ...;
unit: ...;
weekStartsOn: ...;
}>, Struct<{
kind: ...;
operator: ...;
}>]>, Union<readonly [Struct<{
kind: ...;
operator: ...;
values: ...;
}>, Struct<{
kind: ...;
operator: ...;
}>]>]>>;
}>>>;

Defined in: filters/schemas-effect-v4.ts:322

Flat AND-combined list of column filters (the common case): validates a FiltersRequest (ColumnFilter[]), e.g. a request body, before it reaches an adapter.

import { Schema } from "effect";
import { FiltersRequestSchema } from "@xtandard/lib/filters/effect/v4";
const input = [
{ field: "name", filter: { kind: "text", operator: "contains", value: "ada" } },
{ field: "amount", filter: { kind: "number", operator: "gte", value: 10 } },
];
Schema.decodeUnknownSync(FiltersRequestSchema)(input);
// → `input`, typed as `FiltersRequest`
Schema.is(FiltersRequestSchema)([{ field: "name" }]);
// → false (missing `filter`)