@querry-kit/nest GitHub

Query Transformation

HTTP query parameters usually arrive in NestJS as strings. QueryTransformPipe turns query objects into predictable JavaScript values before controller code receives them.

Pipeline

QueryTransformPipe only transforms Nest arguments where metadata.type === 'query'.

if (metadata.type === 'query' && typeof value === 'object') {
  return parseObject(value);
}

Route params, body values, and custom metadata types are returned unchanged.

Parsing Rules

InputOutput
'42'42
'3.14'3.14
'true'true
'false'false
'null'null
['1', '2'][1, 2]
{ 'user.name': 'Ada' }{ user: { name: 'Ada' } }

Valid JSON object and array strings are parsed recursively. Invalid JSON-like strings and empty strings are preserved.

Dotted Keys

parseObject({
  'where.profile.name': 'Ada',
  'where.active': 'true',
});

// {
//   where: {
//     profile: { name: 'Ada' },
//     active: true
//   }
// }

Avoid sending both dotted and nested variants for the same path; normal object assignment semantics decide the final value.

Validation

The pipe normalizes values; it does not validate them. Compose it with Nest's ValidationPipe and DTO classes for request validation.

Prototype-related path segments (__proto__, constructor, prototype) are ignored during query normalization. Dotted siblings merge into the same parent object. If paths conflict, the later assignment replaces the earlier value at that path.