Registry / database / drizzle-toolbelt

drizzle-toolbelt

JSON →
library1.2.0jsnpmunverified

Drizzle Toolbelt (v1.2.0) is a utility library for drizzle-orm, providing helper functions like takeFirst, takeFirstOrThrow, and aggregate to simplify common query patterns. It is actively maintained and ships TypeScript definitions. Key differentiators include a data-first API style and customizable error handling, making it a practical companion to drizzle-orm for Node.js and edge environments.

npm install drizzle-toolbelt
INSTALL
IMPORT
SIG · DRIZZLE-TOOLBELT
D
drizzle-toolbelt
databasejavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

takeFirst
import { takeFirst } from 'drizzle-toolbelt'
const takeFirst = require('drizzle-toolbelt').takeFirst
ESM-only; CJS require is not supported.
takeFirstOrThrow
import { takeFirstOrThrow } from 'drizzle-toolbelt'
import takeFirstOrThrow from 'drizzle-toolbelt'
Named export, not default.
aggregate
import { aggregate } from 'drizzle-toolbelt'
const { aggregate } = require('drizzle-toolbelt')
ESM-only; named export.

Shows how to use takeFirstOrThrow to get a single user or throw a custom error.

import { db } from './db'; import { users } from './schema'; import { takeFirstOrThrow } from 'drizzle-toolbelt'; const user = await db.select().from(users).then(takeFirstOrThrow(new Error('User not found')));
Debug
Known issues
gotchatakeFirstOrThrow returns a function that takes an optional error argument; calling it without parentheses (takeFirstOrThrow) uses default error, not custom.
fix
Use takeFirstOrThrow() to invoke with default, or pass error as argument.
affects: <=1.2.0
gotchaaggregate configuration requires exact field names; mismatched keys cause runtime errors.
fix
Ensure fields object uses correct column aliases from the query.
affects: <=1.2.0
Errors
Common errors & fixes
Cannot find module 'drizzle-toolbelt'
Package not installed or ESM-only and using require()
fix
npm install drizzle-toolbelt; use import instead of require
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
drizzle-toolbelt — npm install drizzle-toolbelt · libregistry