{"id":40847,"library":"drizzle-orm-helpers","title":"Drizzle ORM Helpers","description":"A collection of unofficial TypeScript-friendly helpers for Drizzle ORM, focused on providing common SQL/dialect-specific values, functions, operators, and column types. Current version is 0.7.6, under active development with frequent releases, primarily targeting PostgreSQL. Unlike official Drizzle ORM packages, these helpers are user-contributed and provisional, intended as stopgaps until official implementations are available. Dependencies include zod (>=3.23.8) and drizzle-orm (>=0.31.2).","status":"active","version":"0.7.6","language":"javascript","source_language":"en","source_url":"https://github.com/iolyd/drizzle-orm-helpers","tags":["javascript"],"install":[{"cmd":"npm install drizzle-orm-helpers","lang":"bash","label":"npm"},{"cmd":"yarn add drizzle-orm-helpers","lang":"bash","label":"yarn"},{"cmd":"pnpm add drizzle-orm-helpers","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for schema validation","package":"zod","optional":false},{"reason":"peer dependency; the helpers extend Drizzle ORM functionality","package":"drizzle-orm","optional":false}],"imports":[{"note":"Package is ESM-only; using require() will fail. Use TypeScript for better type inference.","wrong":"const { jsonObjectAgg } = require('drizzle-orm-helpers')","symbol":"jsonObjectAgg","correct":"import { jsonObjectAgg } from 'drizzle-orm-helpers'"},{"note":"Commonly used alongside jsonObjectAgg. Must be imported separately.","wrong":"","symbol":"jsonBuildObject","correct":"import { jsonBuildObject } from 'drizzle-orm-helpers'"},{"note":"Helper to extract column selection from a table definition.","wrong":"","symbol":"getColumns","correct":"import { getColumns } from 'drizzle-orm-helpers'"},{"note":"Function name is all lowercase 'textenum', not camelCase 'textEnum'.","wrong":"import { textEnum } from 'drizzle-orm-helpers'","symbol":"textenum","correct":"import { textenum } from 'drizzle-orm-helpers'"},{"note":"Generates nanoid strings; accepts options like { size: 12 }.","wrong":"","symbol":"nanoid","correct":"import { nanoid } from 'drizzle-orm-helpers'"},{"note":"Represents TRUE SQL value; used in joins with no condition.","wrong":"","symbol":"$true","correct":"import { $true } from 'drizzle-orm-helpers'"}],"quickstart":{"code":"import { drizzle } from 'drizzle-orm/node-postgres';\nimport { pgTable, text } from 'drizzle-orm/pg-core';\nimport { jsonObjectAgg, jsonBuildObject, getColumns, textenum, nanoid, $true } from 'drizzle-orm-helpers';\n\nconst languages = pgTable('languages', {\n  lang: textenum('lang', { enum: ['fr', 'en'] as const }),\n});\n\nconst projects = pgTable('projects', {\n  id: text('id').default(nanoid({ size: 12 })).primaryKey(),\n  name: text('name'),\n});\n\nexport async function aggExample(db: ReturnType<typeof drizzle>) {\n  const result = await db\n    .select({\n      ...getColumns(projects),\n      translations: jsonObjectAgg(languages.lang, jsonBuildObject({ lang: languages.lang })),\n    })\n    .from(projects)\n    .leftJoin(languages, $true)\n    .groupBy(projects.id);\n  return result;\n}","lang":"typescript","description":"Demonstrates aggregating translations and using custom column types with Drizzle ORM helpers."},"warnings":[{"fix":"Pin exact version and test upgrades thoroughly.","message":"Package is under heavy development; APIs may change without notice in minor versions.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Verify each helper works on your dialect; consider using official Drizzle ORM functions for cross-dialect needs.","message":"Most helpers are oriented towards PostgreSQL; MySQL and SQLite support may be limited or incomplete.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'as const' when passing the enum array to textenum.","message":"The textenum function is not typed to infer the enum type from the array; you must provide a const assertion.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Monitor official Drizzle ORM releases for equivalent functionality and plan migration.","message":"Some helpers may be replaced by official Drizzle ORM functions; check documentation for deprecation notices.","severity":"deprecated","affected_versions":">=0.5.0"}],"env_vars":null,"search_vec":"'0.31.2':68 '0.7.6':29 '3.23.8':63 'activ':31 'avail':59 'collect':5 'column':24 'common':18 'contribut':49 'current':26 'depend':60 'develop':32 'drizzl':1,13,41,66 'drizzle-orm':65 'focus':15 'frequent':34 'friend':10 'function':21 'helper':3,11,45 'implement':57 'includ':61 'intend':52 'javascript':69 'offici':40,56 'oper':22 'orm':2,14,42,67 'packag':43 'postgresql':38 'primarili':36 'provid':17 'provision':51 'releas':35 'sql/dialect-specific':19 'stopgap':54 'target':37 'type':25 'typescript':9 'typescript-friend':8 'unlik':39 'unoffici':7 'user':48 'user-contribut':47 'valu':20 'version':27 'zod':62","created_at":"2026-06-04T18:49:32.972411+00:00","updated_at":"2026-06-04T18:49:32.972411+00:00","problems":[{"fix":"Ensure your project is configured for ESM: set 'type': 'module' in package.json, or import as .mjs file.","cause":"Package is ESM-only and may require 'type': 'module' in package.json or use of .mjs extension.","error":"Cannot find module 'drizzle-orm-helpers' or its corresponding type declarations."},{"fix":"Use ES module import: import { jsonObjectAgg } from 'drizzle-orm-helpers'","cause":"Incorrect import - trying to use jsonObjectAgg without importing it, or using CommonJS require.","error":"jsonObjectAgg is not a function"},{"fix":"Ensure the table passed to helpers like jsonObjectAgg or joinTranslations includes the referenced columns.","cause":"Using getColumns on a table that doesn't have a 'lang' column in the helper functions.","error":"Property 'lang' does not exist on type 'PgTableWithColumns<...>'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/iolyd/drizzle-orm-helpers#readme","github":"https://github.com/iolyd/drizzle-orm-helpers","docs":null,"changelog":null,"pypi":null,"npm":"drizzle-orm-helpers","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}