npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@react-querybuilder/core

v8.18.0

Published

React Query Builder component for constructing queries and filters, with utilities for executing them in various database and evaluation contexts

Downloads

774,671

Readme

@react-querybuilder/core

Core non-React utilities for React Query Builder — types, query processing, validation, formatters, and parsers.

Installation

npm i @react-querybuilder/core
# OR yarn add / pnpm add / bun add

Note: react-querybuilder re-exports everything from this package, so projects already using the main package don't need to install @react-querybuilder/core separately.

Export

Full export documentation

Use formatQuery to convert a query object into any of the supported output formats:

import { formatQuery } from '@react-querybuilder/core';

const query = {
  combinator: 'and',
  rules: [
    { field: 'first_name', operator: 'beginsWith', value: 'Stev' },
    { field: 'last_name', operator: 'in', value: 'Vai, Vaughan' },
  ],
};

formatQuery(query, 'sql');
// "(first_name like 'Stev%' and last_name in ('Vai', 'Vaughan'))"

Supported export formats

| Format | formatQuery type string | Output type | Description | | ------------------------------------------------------------------------------- | ------------------------- | ----------------------- | ------------------------------------------- | | JSON (formatted) | "json" | string | 2-space indented JSON.stringify | | JSON (no IDs) | "json_without_ids" | string | Compact JSON without id/path properties | | SQL | "sql" | string | Standard WHERE clause | | SQL (parameterized) | "parameterized" | ParameterizedSQL | SQL with anonymous (?) bind variables | | SQL (named params) | "parameterized_named" | ParameterizedNamedSQL | SQL with named (:param) bind variables | | MongoDB | "mongodb_query" | Record<string, any> | MongoDB query object | | CEL | "cel" | string | Common Expression Language | | SpEL | "spel" | string | Spring Expression Language | | JsonLogic | "jsonlogic" | JsonLogic | JsonLogic object | | JSONata | "jsonata" | string | JSONata expression | | ElasticSearch | "elasticsearch" | Record<string, any> | ElasticSearch query DSL | | LDAP | "ldap" | string | LDAP filter string | | Cypher | "cypher" | string | Neo4j Cypher WHERE clause | | SPARQL | "sparql" | string | SPARQL FILTER clause | | Gremlin | "gremlin" | string | Apache TinkerPop Gremlin traversal | | Natural language | "natural_language" | string | Human-readable description | | Drizzle | "drizzle" | Drizzle SQL | Drizzle ORM where clause | | Prisma | "prisma" | Record<string, any> | Prisma where object | | Sequelize | "sequelize" | Record<string, any> | Sequelize where object |

Import

Full import documentation

Parser functions convert query strings or objects from various languages into React Query Builder query objects. Each parser must be imported from its own sub-path.

import { parseSQL } from '@react-querybuilder/core/parseSQL';

// Accepts a full SELECT statement or just a WHERE clause
const query = parseSQL(
  `SELECT * FROM my_table WHERE first_name LIKE 'Stev%' AND last_name IN ('Vai', 'Vaughan')`
);

Supported import formats

| Format | Import statement | | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | SQL | import { parseSQL } from "@react-querybuilder/core/parseSQL" | | MongoDB | import { parseMongoDB } from "@react-querybuilder/core/parseMongoDB" | | JsonLogic | import { parseJsonLogic } from "@react-querybuilder/core/parseJsonLogic" | | JSONata | import { parseJSONata } from "@react-querybuilder/core/parseJSONata" | | CEL | import { parseCEL } from "@react-querybuilder/core/parseCEL" | | SpEL | import { parseSpEL } from "@react-querybuilder/core/parseSpEL" | | Cypher | import { parseCypher } from "@react-querybuilder/core/parseCypher" | | GQL | import { parseGQL } from "@react-querybuilder/core/parseCypher" | | SPARQL | import { parseSPARQL } from "@react-querybuilder/core/parseSPARQL" | | Gremlin | import { parseGremlin } from "@react-querybuilder/core/parseGremlin" |

Query manipulation

Full documentation

Programmatically modify query objects with the same functions used internally by the <QueryBuilder /> component:

import { add, remove, update, move } from '@react-querybuilder/core';

const updated = add(query, newRule, parentPath);
const removed = remove(query, rulePath);
const modified = update(query, 'value', 'newValue', rulePath);
const moved = move(query, oldPath, newPath);

Available methods: add, remove, update, move, insert, group.

transformQuery

Full documentation

Recursively processes a query object, transforming rules, groups, operators, combinators, and property names:

import { transformQuery } from '@react-querybuilder/core';

const transformed = transformQuery(query, {
  operatorMap: { '=': '==', '!=': '<>' },
  combinatorMap: { and: '&&', or: '||' },
  propertyMap: { field: 'column' },
  ruleProcessor: rule => ({ ...rule, value: rule.value.trim() }),
});

TypeScript

The core package exports the complete type system used throughout React Query Builder, enabling strongly-typed query manipulation without a React dependency:

import type {
  RuleGroupType, // Standard query structure (combinators at group level)
  RuleGroupTypeIC, // Independent combinators structure
  RuleType, // Individual rule
  FullField, // Field definition with all options
  FullOperator, // Operator definition
  FullCombinator, // Combinator definition
  ExportFormat, // Union of all format strings
  DefaultRuleGroupType,
  DefaultRuleType,
} from '@react-querybuilder/core';

Further reading