
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
relational-reselect
Advanced tools
With its decarative style, this library aims to facilitate creation of complex selectors on a normalized store that imposes to perform joins, lookups, relationships, or whatever you call it !
import { createSelector } from 'reselect';
import Query from 'relational-reselect';
// my selectors
const a = createSelector(
aSelector,
aFn,
);
const b = createSelector(
bSelector,
bFn,
);
const c = createSelector(
cSelector,
cFn,
);
// define my query
const myQuery = new Query()
.from(a, 'a')
.leftJoin(b, 'b')
.on(row => row.getIn(['a', 'id']) === row.getIn(['b', 'aRef']))
.leftJoin(c, 'c')
.on(row => row.getIn(['c', 'id']) >= row.getIn(['a', 'cId']));
// get generated selector
const mySelector = myQuery.get();
// or directly run it
const myData = myQuery.run(state);
other examples are available on dedicated CodeSandbox
npm install --save relational-reselect

new Query()Create a new query
get(): Selectorgenerate selector for this query
run(state: State): Collectionrun this query (= execute its selector) and return result
select(selectSpec: SpecificationForTuple): SelectOptional operation if you need to process data coming from From bloc.
In this bloc, any dataSource can be a selector (a simple one or a reselect one) or another valid query if you need to nest them.
Aliases are required for naming dataSources, except when you use except, intersect, and union joins
from(dataSource: DataSource, alias: string): FromRequired operation.
Optional operation. You can join as much data sources as you want as long as you specify how to join them. Supported join types are :
innerJoin(dataSource: DataSource, alias: string): IncompleteJoinleftJoin(dataSource: DataSource, alias: string): IncompleteJoinrightJoin(dataSource: DataSource, alias: string): IncompleteJoinfullJoin(dataSource: DataSource, alias: string): IncompleteJoinexcept(dataSource: DataSource): CompleteJoinintersect(dataSource: DataSource): CompleteJoinunion(dataSource: DataSource): CompleteJoincartesian(dataSource: DataSource, alias: string): CompleteJoinIncomplete joins need to be completed with a on(specification: SpecificationForMatchingTuple): CompleteJoin
where(whereSpec: SpecificationForMatchingTuple): WhereOptional operation. This filter will be applied over data coming from From or Select (if exists) bloc
orderBy(orderBySpec: SpecificationForOrderingTuples): OrderByOptional operation. This sort will be applied over data coming from From, or Select (if exists), or Where (if exists) bloc
TODO !
type Tuple = Map<string, any>;
type SpecificationForTuple = (tuple: Tuple) => Tuple;
type SpecificationForMatchingTuple = (tuple: Tuple) => boolean;
type SpecificationForOrderingTuples = (left: Tuple, right: Tuple) => number;

FAQs
A declarative way to express queries with reselect
We found that relational-reselect 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.