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

@malloydata/db-postgres

v0.0.428

Published

Malloy is a modern open source language for describing data relationships and transformations. It is both a semantic modeling language and a querying language that runs queries against a relational database. Malloy currently connects to BigQuery and Postg

Readme

Malloy

Malloy is a modern open source language for describing data relationships and transformations. It is both a semantic modeling language and a querying language that runs queries against a relational database. Malloy currently connects to BigQuery and Postgres, and natively supports DuckDB. We've built a Visual Studio Code extension to facilitate building Malloy data models, querying and transforming data, and creating simple visualizations and dashboards.

This package

This package facilitates using the malloydata/malloy library with Postgres - see here for additional information.

Verified TLS through a tunnel

PostgresConnectionConfiguration.ssl is forwarded verbatim to pg's TLS options. To get servername-based certificate verification through a local tunnel (e.g. an SSH bastion forwarding to a remote Postgres), connect via the loopback IP rather than localhostpg overwrites servername with host whenever host is a DNS name. If the certificate doesn't match the host pg connects to, pg throws a certificate error and the connector annotates it with this servername/host guidance.

import {PostgresConnection} from '@malloydata/db-postgres';

const connection = new PostgresConnection({
  name: 'tunneled_postgres',
  host: '127.0.0.1', // must be an IP, not 'localhost', for servername to take effect
  port: 5432,
  ssl: {
    servername: 'db.example.com',
    ca: '<PEM-encoded CA certificate>',
  },
});

Semantics (pg/Node tls, not libpq)

  • ssl: true — full verification against the system trust store, hostname included (verify-full). A self-signed or custom-CA server fails unless you supply ca (and/or set servername for a tunnel).
  • ssl: { rejectUnauthorized: false } — encrypt but do not verify (libpq's sslmode=require/no-verify). Use only when verification is impossible; it does not stop MITM.
  • ssl: { ca } — trust a specific CA (a PEM string, or an array of PEMs for rotation). This is the path for AWS RDS (or use NODE_EXTRA_CA_CERTS) and Cloud SQL.
  • verify-ca against a cert whose SAN/CN doesn't match any reachable name (e.g. Cloud SQL legacy per-instance certs) needs a checkServerIdentity override. That is a function, so it is not expressible in a saved json config — construct the connection programmatically and pass the full pg ssl (tls.ConnectionOptions) directly.

Do not put TLS parameters in both ssl and the connectionString: pg merges URL ssl params (sslmode, sslrootcert, …) over the ssl object, silently dropping it. Set TLS in one place.

ssl is passed through literally — json config is never reference-resolved (a malloy security invariant), so key/passphrase cannot be pulled from an {env:...}/overlay reference. Inject secret material programmatically at construction time; never persist it in a shared connection config.