Skip to content

v0.6.0

Latest

Choose a tag to compare

@github-actions github-actions released this 19 Jun 09:36
407464a

Changelog

💥 Breaking / Migration

  • arraySet(...) is now replacement-only. Out-of-bounds indexes are no-ops because it now uses jsonb_set(..., false). Use arrayPush(...) for append behavior.
  • setPipe(...) no longer initializes SQL NULL roots implicitly. Use .$default(...) at the branch you want to create before nested writes.
  • access(...).$path is removed. Use .$value for JSONB extraction or .$text for text extraction.

🐘 PostgreSQL Compatibility

  • JSON helpers no longer rely on json_query(...).
  • Effective PostgreSQL support now goes down to PostgreSQL 14 instead of PostgreSQL 17.
  • CI now verifies the package against real PostgreSQL 14, 15, 16, 17, and 18.

🚀 JSON Helpers

Containment

  • Added contains(...) for typed JSONB containment predicates.
  • json.contains(source).path.$contains(value) emits root source @> value, so full-column GIN and jsonb_path_ops indexes can be used.
  • Added direct containment form: json.contains(source, value).
  • contains(...) accepts SQL containment values at the root; nested proxy paths intentionally reject SQL values.

Updates and Defaults

  • .$default(...) now handles SQL NULL roots by initializing the root to {} before applying branch defaults.
  • setPipe(...) now preserves SQL NULL unless a step explicitly creates the branch with .$default(...).

SQL Values

  • build(...) now supports computed SQL expressions inside JSON structures.
  • SQL expressions embedded into JSONB are wrapped with to_jsonb(...); plain JavaScript values stay parameterized.
  • coalesce(...) now handles JavaScript and SQL fallback values through jsonBuild(...).

Arrays

  • arrayPush(...) appends values in order and treats SQL NULL / JSON null targets as [].
  • arraySet(...) replaces an existing element only; out-of-bounds indexes are no-ops.
  • arrayDelete(...) removes an existing element; out-of-bounds indexes are no-ops.
  • arrayPush(...) and arraySet(...) map JavaScript undefined to JSON null.

🕒 Temporal

  • Temporal custom columns are updated for newer Drizzle ORM RC custom type behavior.
  • Temporal columns now decode correctly in Drizzle relational query builder results, including nested one and many relations.
  • monthDay.constraints(...) now validates month-specific day bounds, e.g. rejects 02-30.
  • yearMonth.constraints(...) now supports Temporal-compatible signed expanded years and enforces Temporal range boundaries.
  • Temporal docs now include insert, select, filter, SQL expression, and relational query examples.

✅ Tests / CI

  • Added real PostgreSQL-backed integration tests, beyond the previous PGlite-only coverage.
  • Added JSONB index tests proving contains(...) works with full-column GIN and jsonb_path_ops indexes.
  • Added expression-index coverage for accessor-based predicates.
  • Added SQL injection coverage for JSON access, build, coalesce, merge, set, setPipe, contains, and array helpers.
  • Added Temporal relational query builder decoding coverage.

📦 Dependencies

  • drizzle-orm: 1.0.0-rc.1 -> 1.0.0-rc.3
  • temporal-polyfill: development/test version updated to ^1.0.1; peer range remains ^0.3.2.

📚 Docs / Skill

  • Expanded JSON docs with helper semantics, index guidance, SQL values, array behavior, and migration notes.
  • Expanded Temporal docs with relational query builder behavior and query examples.
  • Added drizzle-pg-utils agent skill with focused JSON subreferences and Temporal guidance.

Full Changelog: v0.5.0...v0.6.0