$ open source · GPL-3.0 — need a commercial license? imqueue.com →

FilterInput class

A where clause as plain, serializable JSON.

Signature:

export declare class FilterInput 

Remarks

Gives a remote caller the same expressive power Sequelize offers locally — comparison, set membership, pattern matching, regular expressions and range operators, nested arbitrarily through $and and $or. Every operator is a $-prefixed string rather than a symbol, because symbols do not survive the wire; FILTER_OPS does the translation on arrival.

Two things follow from how query.toWhereOptions walks it. Keys are read recursively, so a value that is itself an object is treated as a nested filter and only a non-object value ends the walk. And any key that is NOT a known operator is kept verbatim as a column name — which is what lets you mix columns and operators in one object, and also means a typo becomes a column rather than a complaint.

The declared property types are the common cases rather than hard limits; the runtime walk does not enforce them.

Example

// type is 'fast' or 'std', and the reservation was created this year
const filter = {
    $or: [{ type: 'fast' }, { type: 'std' }],
    createdAt: { $gte: '2026-01-01' },
} as FilterInput;

Properties

Property

Modifiers

Type

Description

$adjacent?

[number, number]

(Optional) Ranges touch without overlapping (Postgres -|-).

$and?

FilterInput | Array<FilterInput | number | string | boolean | null>

(Optional) Every nested condition must hold (SQL AND).

$any?

number[] | string[]

(Optional) Equals any element of the array (Postgres = ANY).

$between?

Array<number | string>

(Optional) Within the inclusive [low, high] pair (SQL BETWEEN).

$contained?

[number, number]

(Optional) The column's range is contained by this one (Postgres <@).

$contains?

number | [number, number]

(Optional) The column's range contains this value or range (Postgres @>).

$eq?

number | string | boolean | null

(Optional) Equal to. With null, becomes IS NULL.

$gt?

number

(Optional) Greater than.

$gte?

number

(Optional) Greater than or equal to.

$iLike?

string

(Optional) Case-insensitive pattern match (Postgres ILIKE).

$in?

Array<number | string | boolean | null>

(Optional) One of the listed values (SQL IN). An empty list matches nothing.

$iRegexp?

string

(Optional) Matches a regular expression, case-insensitively (Postgres ~*).

$like?

string

(Optional) Case-sensitive pattern match, % and _ as wildcards (SQL LIKE).

$lt?

number

(Optional) Less than.

$lte?

number

(Optional) Less than or equal to.

$ne?

number | string

(Optional) Not equal to.

$noExtendLeft?

[number, number]

(Optional) Range does not extend past this one's left bound (Postgres &>).

$noExtendRight?

[number, number]

(Optional) Range does not extend past this one's right bound (Postgres &<).

$not?

boolean

(Optional) Negates the nested condition (SQL NOT).

$notBetween?

Array<number | string>

(Optional) Outside the inclusive [low, high] pair.

$notILike?

string

(Optional) Fails a case-insensitive pattern match.

$notIn?

Array<number | string | boolean | null>

(Optional) None of the listed values (SQL NOT IN).

$notIRegexp?

string

(Optional) Fails a case-insensitive regular expression (Postgres !~*).

$notLike?

string

(Optional) Fails a case-sensitive pattern match.

$notRegexp?

string

(Optional) Fails a POSIX regular expression (Postgres !~).

$or?

FilterInput | Array<FilterInput | number | string | boolean | null>

(Optional) At least one nested condition must hold (SQL OR).

$overlap?

[number, number]

(Optional) Ranges share at least one value (Postgres &&).

$regexp?

string

(Optional) Matches a POSIX regular expression (Postgres ~).

$strictLeft?

[number, number]

(Optional) Range lies entirely to the left of this one (Postgres <<).

$strictRight?

[number, number]

(Optional) Range lies entirely to the right of this one (Postgres >>).