{"id":43731,"library":"query-orm-client","title":"QueryOrmClient","description":"QueryOrmClient is a JavaScript/TypeScript library that provides URL-based ORM-like query construction for building filter, sort, pagination, and field selection parameters in REST API calls. Version 0.0.8 is the latest stable release. It supports rich filter operators (=, !=, >, >=, <, <=, like, in, between), multi-field sorting, select with aliases, and pagination. The library is dependency-free, ships TypeScript type declarations, and works both as an npm module and via a UMD script tag. It automatically encodes URLs and allows optional raw output.","status":"active","version":"0.0.8","language":"javascript","source_language":"en","source_url":"https://github.com/mdao-work/query-orm-client","tags":["javascript","query-orm-client","typescript"],"install":[{"cmd":"npm install query-orm-client","lang":"bash","label":"npm"},{"cmd":"yarn add query-orm-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add query-orm-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export; works with both ESM and CJS. For UMD script tag, use global queryOrmClient.","wrong":"const QueryOrmClient = require('query-orm-client')","symbol":"QueryOrmClient","correct":"import QueryOrmClient from 'query-orm-client'"},{"note":"Global when loaded via script tag; not an npm export.","wrong":"// not available as import","symbol":"queryOrmClient","correct":"// after UMD script: const qoc = new queryOrmClient()"},{"note":"Package ships types but type import uses default import syntax with 'type' keyword.","wrong":"import { QueryOrmClient } from 'query-orm-client'","symbol":"QueryOrmClient type","correct":"import type QueryOrmClient from 'query-orm-client'"}],"quickstart":{"code":"import QueryOrmClient from 'query-orm-client';\n\nconst qoc = new QueryOrmClient();\n\nqoc.where('status', 'active')\n   .where('age', '>', 18)\n   .whereIn('tags', ['new', 'hot'])\n   .orderBy('created_at', 'desc')\n   .select(['id', 'name', 'email'])\n   .page(1, 20);\n\nconst queryString = qoc.toUriQueryString();\nconsole.log(queryString);\n// Output (approx): filter[status{eq}]=active&filter[age{gt}]=18&filter[tags{in}]=new,hot&order_by=created_at&sorted_by=desc&select=id,name,email&page=1&page_size=20","lang":"typescript","description":"Build a query with where conditions, sorting, field selection, and pagination, then generate the URL query string."},"warnings":[{"fix":"Always call toUriQueryString last in the chain, or assign intermediate results.","message":"Method chaining is fragile: calling toUriQueryString returns a string, not the QueryOrmClient instance, so further chaining after that will fail.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use removeWhere only when you want to clear all conditions for that field.","message":"removeWhere removes ALL conditions for a given field, regardless of how many were added. There is no way to remove a specific condition.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"For 'in' and 'between', use a single comma-separated string or an array with exactly one element containing the comma-separated values.","message":"Operators 'in' and 'between' expect a single string value (comma-separated) or an array. Passing an array with multiple elements may cause unexpected behavior.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use toUriQueryString() for encoded, toUriQueryString(false) for raw. Only use raw if you are certain the values are safe.","message":"toUriQueryString defaults to encoding the URL. Passing false outputs raw string without encoding, which may cause issues if special characters are present.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin to exact version in package.json and test before upgrading.","message":"The package version is 0.0.8 and API may change without major version bump, as semver is not strictly followed for pre-1.0 releases.","severity":"breaking","affected_versions":"<1.0.0"}],"env_vars":null,"search_vec":"'0.0.8':31 'alias':51 'allow':82 'api':28 'automat':78 'base':11 'build':18 'call':29 'client':90 'construct':16 'declar':63 'depend':58 'dependency-fre':57 'encod':79 'field':23,47 'filter':19,40 'free':59 'javascript':86 'javascript/typescript':5 'latest':34 'librari':6,55 'like':14,42 'modul':70 'multi':46 'multi-field':45 'npm':69 'oper':41 'option':83 'orm':13,89 'orm-lik':12 'output':85 'pagin':21,53 'paramet':25 'provid':8 'queri':15,88 'query-orm-cli':87 'queryormcli':1,2 'raw':84 'releas':36 'rest':27 'rich':39 'script':75 'select':24,49 'ship':60 'sort':20,48 'stabl':35 'support':38 'tag':76 'type':62 'typescript':61,91 'umd':74 'url':10,80 'url-bas':9 'version':30 'via':72 'work':65","created_at":"2026-06-05T17:01:12.758035+00:00","updated_at":"2026-06-05T17:01:12.758035+00:00","problems":[{"fix":"Ensure you create an instance: const qoc = new queryOrmClient(); (script) or const qoc = new QueryOrmClient(); (ESM).","cause":"Using the global queryOrmClient (via script) but then trying to call methods on a non-existent object, or forgetting to invoke the constructor with new.","error":"TypeError: queryOrm.where is not a function"},{"fix":"Make sure the chain starts with new QueryOrmClient() and ends with toUriQueryString(). Do not call toUriQueryString mid-chain.","cause":"Chaining methods incorrectly, e.g., calling toUriQueryString() after a method that returns undefined, or assigning to a variable that is not the instance.","error":"Cannot read property 'toUriQueryString' of undefined"},{"fix":"Run 'npm install query-orm-client' and ensure you are using the correct import: import QueryOrmClient from 'query-orm-client'.","cause":"Package is not installed, or the import path is incorrect.","error":"Module not found: Error: Can't resolve 'query-orm-client'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mdao-work/query-orm-client#readme","github":"https://github.com/mdao-work/query-orm-client","docs":null,"changelog":null,"pypi":null,"npm":"query-orm-client","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}