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

@eikonstudio/bqquery

v0.1.0

Published

Tiny, type-safe BigQuery query helpers with great DX

Readme

@eikonstudio/bqquery

Tiny, type-safe BigQuery helpers built on top of @google-cloud/bigquery.

Install

bun add @eikonstudio/bqquery

Why this package?

@google-cloud/bigquery is powerful, but the common query flow usually needs a little ceremony. @eikonstudio/bqquery keeps the everyday path tiny:

  • bq() creates a client
  • query<T>() returns typed rows
  • one<T>() returns the first row or null
  • value<T>() returns the first column from the first row

Quick Start

import { bq } from "@eikonstudio/bqquery";

const db = bq({
  projectId: "my-project",
  dataset: "analytics",
  location: "US",
});

const users = await db.query<{ id: string; email: string }>(
  "select id, email from users where active = @active",
  { active: true },
);

Authentication

Application Default Credentials (ADC)

import { bq } from "@eikonstudio/bqquery";

const db = bq();

Parsed service-account object

import { bq } from "@eikonstudio/bqquery";

const db = bq({
  credentials: {
    project_id: "my-project",
    client_email: "[email protected]",
    private_key: process.env.GCP_PRIVATE_KEY!,
  },
});

JSON string

import { bq } from "@eikonstudio/bqquery";

const db = bq({
  credentialsJson: process.env.GCP_CREDENTIALS,
});

Base64-encoded JSON

import { bq } from "@eikonstudio/bqquery";

const db = bq({
  credentialsBase64: process.env.GCP_CREDENTIALS_BASE64,
});

Query Helpers

query<T>()

const rows = await db.query<{ user_id: string; total: number }>(
  `
    select user_id, count(*) as total
    from users
    where created_at >= @since
    group by user_id
  `,
  { since: "2026-01-01" },
);

one<T>()

const user = await db.one<{ id: string; email: string }>(
  "select id, email from users where id = @id limit 1",
  { id: "u_123" },
);

value<T>()

const count = await db.value<number>(
  "select count(*) as total from users where active = @active",
  { active: true },
);

Per-query options

Pass an options object when you need more than just params:

const rows = await db.query<{ total: number }>(
  "select count(*) as total from users where created_at >= @since",
  {
    params: { since: "2026-01-01" },
    dataset: "warehouse",
    location: "EU",
    maximumBytesBilled: "1000000",
  },
);

Credential helpers

If you need to validate or transform credentials before creating the client:

import {
  decodeBase64Credentials,
  parseServiceAccountCredentials,
} from "@eikonstudio/bqquery";

const parsed = parseServiceAccountCredentials(process.env.GCP_CREDENTIALS);
const decoded = decodeBase64Credentials(process.env.GCP_CREDENTIALS_BASE64!);