Query Conversion

parseQuery

parseQuery signature
export const parseQuery = (
value: string,
format: QueryFormat
): IParseQueryResult;
Supported formats
export type QueryFormat =
| 'SQL'
| 'Mongo'
| 'AQL'
| 'JSONata'
| 'JsonLogic'
| 'CEL'
| 'Elasticsearch'
| 'SpEL'
| 'Prisma'
| 'OData'
| 'RSQL'
| 'Dynamo'
| 'Django';
Parse result
export interface IParseQueryResult {
fields: IBuilderFieldProps[];
data: DenormalizedQuery;
}

Parameters

  • value The input string to parse.
  • format The source syntax. Parsing behavior is selected entirely from this value.

Return value

  • fields Field metadata inferred by the parser where possible. Some parsers can infer types and operator sets from the source expression.
  • data The denormalized query tree produced from the input string.

Field comparisons

Parsing a field-reference rule
const result = parseQuery(
'WHERE ORDER_TOTAL >= ORDER_APPROVAL_LIMIT',
'SQL'
);
console.log(result.data[0]);
// {
// type: 'GROUP',
// value: 'AND',
// isNegated: false,
// children: [
// {
// field: 'ORDER_TOTAL',
// operator: 'LARGER_EQUAL',
// valueSource: 'field',
// valueField: 'ORDER_APPROVAL_LIMIT',
// },
// ],
// }
  • Rule shape When the source syntax uses a native right-hand-side field reference, the parsed rule uses valueSource: 'field' plus valueField.
  • Supported native parsing SQL, Mongo, AQL, JSONata, JsonLogic, CEL, SpEL, Prisma, OData, Dynamo, and Django can infer field comparisons from builder-compatible expressions.
  • Guardrails Unsupported or ambiguous shapes fail explicitly rather than being guessed as field references, including the intentionally unsupported RSQL and Elasticsearch cases.

Related recipes

© Vojtěch Václav Porteš 2026 - All library contents are available under the MIT license.
Loading privacy preferences...