@ogs-gmbh/rsql
v2.0.0
Published
Lightweight, zero-dependency TypeScript library for constructing and serializing RSQL queries using customizable operators
Readme
We're OGS, check out our work on github.com/ogs-gmbh
rsql
An established, production-ready package for building RSQL queries in TypeScript, providing a composable operator API with a typed AST and fully customizable serialization.

Composable Operator API
Provides comparison, logical and grouping operators that nest freely, enabling complex filters to be expressed as plain function calls.Typed Abstract Syntax Tree
Every operator returns a fully typed node exposing its kind, values and children, allowing queries to be inspected and transformed instead of parsed from strings.Customizable Serialization
Accepts custom separators on every operator, adapting the output to backends that deviate from the default RSQL notation.Zero Dependencies
Ships as platform-neutral ESM without any runtime dependencies, keeping the footprint of your project minimal.
Getting Started
[!IMPORTANT] We're offering an extensive API-Reference covered with in-depth usage examples of this project.
To get a starting point, simply refer to our documentation at ogs-gmbh.github.io/rsql.
Prerequisites
- Node.js version 18 or higher
- A package manager: e.g. npm, pnpm, ...
Installation
Using npm:
$ npm install @ogs-gmbh/rsqlUsing yarn:
$ yarn add @ogs-gmbh/rsqlUsing pnpm:
$ pnpm add @ogs-gmbh/rsqlUsing bun:
$ bun add @ogs-gmbh/rsqlUsage
Here we provide a simple example.
import { and, define, equals, group, like, or, range } from "@ogs-gmbh/rsql";
const definition = define(
and([
group(or([equals("status", "active"), equals("status", "pending")])),
range("age", 18, 65),
like("name", "*son")
])
);
// "(status==active,status==pending);age=rng=18,65;name=like=*son"
const query = definition.toString();
// "and"
const kind = definition.ast.kind;License
The MIT License (MIT) - Please have a look at the LICENSE file for more details.
Contributing
Contributions are always welcome and greatly appreciated. Whether you want to report a bug, suggest a new feature, or improve the documentation, your input helps make the project better for everyone.
Feel free to submit a pull request, issue or feature request.
Issues and Feature Requests
Reporting an issue or creating a feature request is made by creating a new issue on this repository.
You can create a new issue or feature request here.
Pull Requests
GitHub offers a solid guideline for contributing to open source projects through pull requests, covering key practices. These best practices provide a reliable starting point for making effective contributions.
You can find the guidelines here.
Code Of Conduct
We are committed to keeping a welcoming, inclusive, and respectful community for everyone. To help us achieve this, we kindly ask that you adhere to our Code of Conduct.
Disclaimer
All trademarks and registered trademarks mentioned are property of their respective owners and are used for identification purposes only. Use of these names does not imply endorsement or affiliation.
This project is a trademark of OGS Gesellschaft für Datenverarbeitung und Systemberatung mbH. The License does not grant rights to use the trademark without permission.
Gesellschaft für Datenverarbeitung und Systemberatung mbH
