Skip to content

OPERATORS_BY_KIND

const OPERATORS_BY_KIND: Record<FieldKind, readonly string[]>;

Defined in: filters/resource-metadata.ts:77

The operator vocabulary a field of each kind supports (for UI operator pickers and FieldMetadata.operators). Each entry is the matching *_OPERATORS constant (text → TEXT_OPERATORS, …).

Fill a field’s operators and build a picker

import { OPERATORS_BY_KIND, type FieldKind } from "@xtandard/lib/filters";
OPERATORS_BY_KIND.boolean; // → ["eq", "ne", "isNull", "isNotNull"]
const pickerOptions = (kind: FieldKind) =>
OPERATORS_BY_KIND[kind].map((op) => ({ value: op, label: op }));
pickerOptions("number").slice(0, 2);
// → [{ value: "eq", label: "eq" }, { value: "ne", label: "ne" }]