{"id":20790901,"url":"https://github.com/yarosj/nestjs-implicit-query-params","last_synced_at":"2026-05-09T16:50:55.261Z","repository":{"id":177498869,"uuid":"339146896","full_name":"YarosJ/nestjs-implicit-query-params","owner":"YarosJ","description":"PipeTransform for NestJS, which allows converting query param values types","archived":false,"fork":false,"pushed_at":"2021-02-16T17:44:29.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T00:43:07.457Z","etag":null,"topics":["conversion","decorators","dto","nestjs","pipeline","pipetransform","querystring","requests"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-implicit-query-params","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YarosJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-15T17:01:28.000Z","updated_at":"2021-02-16T17:44:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa392b47-5ac0-43da-853b-812d0431ab1a","html_url":"https://github.com/YarosJ/nestjs-implicit-query-params","commit_stats":null,"previous_names":["yarosj/nestjs-implicit-query-params"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/YarosJ/nestjs-implicit-query-params","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YarosJ%2Fnestjs-implicit-query-params","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YarosJ%2Fnestjs-implicit-query-params/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YarosJ%2Fnestjs-implicit-query-params/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YarosJ%2Fnestjs-implicit-query-params/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YarosJ","download_url":"https://codeload.github.com/YarosJ/nestjs-implicit-query-params/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YarosJ%2Fnestjs-implicit-query-params/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278272286,"owners_count":25959524,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conversion","decorators","dto","nestjs","pipeline","pipetransform","querystring","requests"],"created_at":"2024-11-17T15:38:41.691Z","updated_at":"2025-10-04T05:53:09.440Z","avatar_url":"https://github.com/YarosJ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://nestjs.com/img/logo_text.svg\" width=\"320\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master\n[travis-url]: https://travis-ci.org/nestjs/nest\n[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux\n[linux-url]: https://travis-ci.org/nestjs/nest\n\n## Description\n\nPipeTransform for NestJS, which allows to implicitly or explicitly convert query param values types. An automatic types conversion is enabled by default, but for some cases, e.g. Boolean type, it not work, so to handle such cases can be used custom converters which usage given below.\n\n## Usage of the custom converters\n\n```typescript\nimport implicitQueryParams from 'nestjs-implicit-query-params';\n```\n\nThere are 3 ways that can be used together or separately (for all 3 ways given examples of the conversion to the Boolean type):\n1. Pass functions for the query param keys which receive String value and returns a new value with needed type:\n\n```typescript\n  @Get()\n  getPosts(\n    @Query(implicitQueryParams({\n      personal: fieldValue =\u003e fieldValue === 'true',\n    })) filterDto: GetPostsFilterDto,\n  ): Promise\u003cPosts[]\u003e {\n    return this.postsService.getPosts(filterDto);\n  }\n```\n\n2. Pass objects where values can be mapped directly:\n\n```typescript\n  @Get()\n  getPosts(\n    @Query(implicitQueryParams({\n      personal: {\n        true: true,\n        false: false,\n      },\n    })) filterDto: GetPostsFilterDto,\n  ): Promise\u003cPosts[]\u003e {\n    return this.postsService.getPosts(filterDto);\n  }\n```\n\n3. Use custom query object converters that should handle and return the whole query object:\n\n```typescript\n  @Get()\n  getPosts(\n    @Query(implicitQueryParams(\n      { \u003cExplicit converters if needed\u003e },\n      [\n        (queryObject): any =\u003e {\n          if (typeof queryObject === 'object') {\n            Object.keys(queryObject).forEach((key) =\u003e {\n              const fieldValue: any = queryObject[key];\n\n              if (fieldValue === 'true') {\n                queryObject[key] = true;\n              }\n\n              if (fieldValue === 'false') {\n                queryObject[key] = false;\n              }\n            });\n          }\n\n          return queryObject;\n        },\n      ],\n    )) filterDto: GetPostsFilterDto,\n  ): Promise\u003cPosts[]\u003e {\n    return this.postsService.getPosts(filterDto);\n  }\n```\n\n## License\n\nMIT License. Copyright 2021 Yaroslav Zhuk\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarosj%2Fnestjs-implicit-query-params","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyarosj%2Fnestjs-implicit-query-params","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyarosj%2Fnestjs-implicit-query-params/lists"}