Skip to content

@xtandard/lib/filters/effect/v4

Ready-made Effect 4 schemas for the filter model (peers effect ^4, @js-temporal/polyfill). For effect 3 use @xtandard/lib/filters/effect.

import { … } from "@xtandard/lib/filters/effect/v4";
Name Summary
ArrayFilterSchema Validates an array-kind field filter (the model’s ArrayFilter): an array-column operator (arrayContains/arrayContained/arrayOverlaps) with a values[] list of strings/numbers, or a unary operator.
BooleanFilterSchema Validates a boolean-kind field filter (the model’s BooleanFilter): eq/ne with a boolean value, or a unary operator.
ColumnFilterSchema Validates one ColumnFilter: a public field name plus its filter. The field name is not checked against an allow-list here; the adapters’ spec does that.
DateFilterSchema Validates a date-kind field filter (the model’s DateFilter): a period preset (see DatePresetSchema) or a unary isNull/isNotNull.
DatePresetSchema Validates a date period preset (the model’s DatePreset): operator (is/before/after/between), unit, a real IANA timeZone, a Temporal.PlainDateTime string anchor (and optional end), and an optional weekStartsOn integer 0–6. The anchor is a wall-clock time read in timeZone, not an instant (a Z-suffixed string is rejected); a date-only "2026-02-01" is accepted as midnight.
EnumFilterSchema Validates an enum-kind field filter (the model’s EnumFilter): eq/ne with a string value, a values[] list, or a unary operator. Which enum values are allowed is not checked here.
FieldFilterSchema Validates any field filter (the model’s FieldFilter): the union of the six per-kind schemas, so the operator must be valid for the kind.
FilterNodeSchema Recursive and/or/not tree (the model’s FilterNode), annotated for recursion via Schema.suspend.
FiltersRequestSchema Flat AND-combined list of column filters (the common case): validates a FiltersRequest (ColumnFilter[]), e.g. a request body, before it reaches an adapter.
NumberFilterSchema Validates a number-kind field filter (the model’s NumberFilter): a comparison value, a from + to range, a values[] list, or a unary operator.
SortItemSchema Validates one sort entry { field, dir } (the model’s SortItem); dir is "asc" or "desc".
SortSchema A { field, dir }[] sort list (the model’s Sort), applied in order.
TextFilterSchema Validates a text-kind field filter (the model’s TextFilter): a single value with a text operator (TEXT_SCALAR_OPERATORS), a values[] list with inArray/notInArray, or a unary isNull/isNotNull.