npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@imqueue/pg-sequelize

v4.2.0

Published

Sequelize/Postgres toolkit for @imqueue microservices — turns a query described as data (filters, paging, ordering, fields) into one efficient statement, plus database views as models and the Postgres index options Sequelize cannot express

Readme

@imqueue/pg-sequelize

Build Status Known Vulnerabilities License

Turns a query described as data — a filter, a page, an order and the fields the caller actually needs — into one efficient Sequelize statement. Plus database views as models, the Postgres index options Sequelize cannot express, and a single import surface for the whole ORM stack.

Sequelize v6, and the alternative

This targets Sequelize v6 — a mature line, proven in production, and the one this package is actively developed against. Sequelize v7 is still in alpha upstream, so v6 is what there is to build on today; if v7 lands, this follows it.

If you would rather build on Prisma, @imqueue/pg-prisma covers the same ground for that stack. Both are supported — pick the ORM you want to live with.

Renamed

This package was called @imqueue/sequelize up to and including 4.1.3. The old name is deprecated on npm and receives no further releases; there is no compatibility shim. To migrate, change the dependency and every import specifier — no export changed name or signature, and the pg- prefix only states what was always true: this targets Postgres specifically, not every Sequelize dialect.

Install

npm i --save @imqueue/pg-sequelize

Usage

Connect once, anywhere in the service. Every later call hands back the same instance, so only the first one needs the configuration:

import { database, query } from '@imqueue/pg-sequelize';

const sequelize = database({
    logger: console,
    modelsPath: './src/orm/models',
    sequelize: {
        benchmark: true,
        dialect: 'postgres',
        storage: 'sequelize',
        pool: {
            max: 250,
            min: 2,
            idle: 30000,
            acquire: 30000,
        },
    },
});

Then let the caller's own arguments build the query. autoQuery reads the requested field map, so a column nobody asked for is not selected and a relation nobody reached into is not joined:

const where = query.toWhereOptions(query.withRangeFilters(filter));
const rows = await LeadModel.findAll(query.autoQuery<FindOptions>(
    LeadModel,
    fields,
    where,
    query.toLimitOptions(pageOptions),
    query.toOrderOptions(orderBy),
));
const total = await LeadModel.count(query.autoCountQuery(LeadModel, fields, where));

filter, fields, pageOptions and orderBy are plain JSON — FilterInput, FieldsInput, PaginationInput and OrderByInput describe them — because Sequelize writes its operators as ES symbols, and a symbol cannot survive a wire format. A GraphQL resolver is the case this was written against, passing its arguments and its selected field set straight through; an RPC method taking a filter object is the same problem.

Docs

Every exported symbol carries its own documentation, so an editor is the fastest reference. The same content is published, symbol by symbol, as the API reference — searchable, and linkable when you need to point someone at one thing. The wider ecosystem documentation is at imqueue.org.

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE