{"id":26041,"library":"odata-v4-typeorm","title":"odata-v4-typeorm","description":"OData V4 query parser and compiler for TypeORM (0.1.2). Converts OData v4 query strings (e.g., $filter, $select, $orderby, $top, $skip, $expand, $apply) into TypeORM QueryBuilder or repository queries. Supports Express and NestJS middleware. Lightweight alternative to full OData frameworks. Limited to SQL databases; no NoSQL support. Regularly released but early-stage (0.x). Ships TypeScript definitions.","status":"active","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/andryuha49/odata-v4-typeorm","tags":["javascript","typeorm","odata","nodejs","express","nestjs","V4","sql","node","typescript"],"install":[{"cmd":"npm install odata-v4-typeorm","lang":"bash","label":"npm"},{"cmd":"yarn add odata-v4-typeorm","lang":"bash","label":"yarn"},{"cmd":"pnpm add odata-v4-typeorm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency; provides repository and query builder APIs.","package":"typeorm","optional":false}],"imports":[{"note":"Both ESM and CJS supported. 'odataQuery' is a middleware function expecting a TypeORM Repository as argument.","wrong":"const odataQuery = require('odata-v4-typeorm');","symbol":"odataQuery","correct":"import { odataQuery } from 'odata-v4-typeorm';"},{"note":"Named export, not default. Use with repository or query builder and query string object.","wrong":"import executeQuery from 'odata-v4-typeorm';","symbol":"executeQuery","correct":"import { executeQuery } from 'odata-v4-typeorm';"},{"note":"TypeScript type for the query options object. Optional import for type checking.","wrong":null,"symbol":"ODataQuery","correct":"import { ODataQuery } from 'odata-v4-typeorm';"}],"quickstart":{"code":"import express from 'express';\nimport { odataQuery } from 'odata-v4-typeorm';\nimport { getRepository } from 'typeorm';\nimport { User } from './entities/user';\n\nconst app = express();\nconst usersRepository = getRepository(User);\n\napp.get('/api/users', odataQuery(usersRepository));\n\napp.listen(3001, () => console.log('Example app listening on port 3001!'));","lang":"typescript","description":"Express middleware that automatically parses OData v4 query parameters from the request URL and returns filtered/sorted/paginated data from a TypeORM repository."},"warnings":[{"fix":"Manually wrap the response with OData metadata if needed, or use a dedicated OData framework (e.g., odata-v4-server).","message":"The library only translates OData query parameters; it does not build the full OData response envelope (no @odata.context, count, etc.).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade to v0.1.0+ which includes basic $apply support for count, sum, min, max.","message":"Breaking change in v0.0.11: $apply (aggregation) not supported. Use $filter and custom aggregation.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Update calls to executeQuery(repository, req.query) instead of executeQuery(repository, req.queryString).","message":"executeQuery signature changed in v0.0.10: second parameter is now query object, not string.","severity":"deprecated","affected_versions":"<0.0.10"},{"fix":"Use TypeORM 0.2.x or wrap DataSource to provide Connection-compatible repository.","message":"TypeORM versions >=0.3.0 use DataSource, not Connection. This library relies on Connection for repository injection; may require adapter.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use TypeORM's QueryBuilder with leftJoinAndSelect and pass a pre-built queryBuilder to executeQuery.","message":"$expand is not supported by default; you must manually define relations in your entity.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import { odataQuery } from 'odata-v4-typeorm';","cause":"Incorrect import; using default import instead of named import.","error":"TypeError: odataQuery is not a function"},{"fix":"Ensure the repository is properly obtained via getRepository() or dependency injection.","cause":"executeQuery called with a Repository that is not initialized (null/undefined).","error":"Cannot read property 'createQueryBuilder' of undefined"},{"fix":"Add the User entity to entities array in createConnection() or DataSource options.","cause":"Entity not registered in TypeORM connection options.","error":"No metadata for \"User\" was found"},{"fix":"Update to TypeORM 0.2.x or use dataSource.getRepository().","cause":"Using TypeORM 0.3+ where getRepository is no longer exported. Use dataSource.getRepository(User).","error":"getRepository is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}