
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
typeorm-query-builder-extended
Advanced tools
Easily transform a query string into a TypeORM SelectQueryBuilder with foreign relation/table
This library allows you to automatically transform a Express.js req.query or a valid key/value object into a TypeORM SelectQueryBuilder that allows the option of making queries to a foreign relation/table through the query or key/value object parsed
yarn add typeorm-query-builder-extended
OR
npm install typeorm-query-builder-extended
A req.query string or valid key/value object is sent to the builder along with the initial SelectQueryBuilder that should have been previously created. The builder converts all props from the query object into a valid SelectQueryBuilder props and appends it to the afore added SelectQueryBuilder
Use ExtendedQueryBuilder export from package and pass your req.query or key/value object as arguments:
import { ExtendedQueryBuilder } from 'typeorm-query-builder-extended';
const queryBuilder = <YOUR_REPOSITORY>.createQueryBuilder(<YOUR_ALIAS>); // <YOUR_REPOSITORY> i.e: personRepository | <YOUR_ALIAS> i.e: person
const builder = new ExtendedQueryBuilder(queryBuilder, req.query); // The third parameter is an optional array of properties in the req.query that you do not want in the database query object.(i.e: page, limit, etc)
const builtQuery = builder.build();
// Now your query is built, use get the rows queried for
const results = builtQuery.getRawMany();
One query is mainly of 4 parts:
The Alias denoting table in the query stringThe name of column of the table being queried onThe operation done on the tableThe value of the query operationfoo/?<TABLE_ALIAS>_._<COLUMN_NAME>__<LOOKUP>=<COLUMN_VALUE>
Denoted by _._ in the query string
i.e: person_._
/* Omitted... */.createQueryBuilder('person');
.
.
.
queryBuilder.leftJoin('person.company', 'company');
Denoted by __
i.e:
person_._firstName__ (IF YOU HAVE A LOOKUP YOU WANT TO ADD)person_._firstName (IF YOU DO NOT HAVE A LOOKUP YOU WANT TO ADD)Check the available lookups here
This is denoted by adding it after your query lookup
import { getRepository } from 'typeorm';
import { ExtendedQueryBuilder } from 'typeorm-query-builder-extended';
import { User } from './path-to-your-entity/User'; // Your typeORM entity class
.
.
.
app.get('/foo', (req, res) => {
const userRepository = getRepository(User);
const queryBuilder = userRepository.createQueryBuilder('user');
const builder = new ExtendedQueryBuilder(queryBuilder, req.query);
const builtQuery = builder.build();
const results = builtQuery.getMany();
return res.status(200).send(results); //returned results from the built query
});
| Lookup | Behaviour | Example | Types Working on |
|---|---|---|---|
| (none) | Return entries that match with value | foo=sam | String, Number, Enums |
| contains | Return entries that contains value | foo__contains=sa | String, Enums |
| startswith | Return entries that starts with value | foo__startswith=a | String |
| endswith | Return entries that ends with value | foo__endswith=am | String |
| lt | Return entries with value less than or equal to provided | foo__lt=18 | Number, Date |
| lte | Return entries with value less than provided | foo__lte=18 | Number, Date |
| gt | Returns entries with value greater than provided | foo__gt=18 | Number, Date |
| gte | Return entries with value greater than or equal to provided | foo__gte=18 | Number, Date |
| in | Return entries that match with values in list | foo__in=developer,tester | String, Enums, Number |
| between | Return entries in range | foo__between=1,27 | String, Number |
| jsonarrcontain | Return entries that match a jsonb array column that contains value in the list | foo__jsonarrcontain=RED,BLUE,ORANGE | String, Number, Enums |
| not | Return entries that do not match with value | foo__not=ACTIVE | String, Number, Enums |
FAQs
Easily transform a query string into a TypeORM SelectQueryBuilder with foreign relation/table
The npm package typeorm-query-builder-extended receives a total of 7 weekly downloads. As such, typeorm-query-builder-extended popularity was classified as not popular.
We found that typeorm-query-builder-extended demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.