Skip to content

Version Packages#22

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
changeset-release/main
Open

Version Packages#22
github-actions[bot] wants to merge 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@ingram-tech/nk-db@1.4.0

Minor Changes

  • 8333445: @ingram-tech/nk-db/id: uuidGenerateId now returns the branded Uuid type
    (still a plain string at runtime), and two new helpers ship the sanctioned
    string→Uuid bless for trust boundaries: isUuid (narrowing guard, accepts
    any RFC 9562 version) and asUuid (the throwing variant). Together they let
    sites brand their Drizzle uuid columns (.$type<Uuid>()) so a raw uuid can no
    longer be cast into a public Id<E> slot (or vice versa) without the compiler
    objecting.

  • 30668e6: The id codec is now isomorphic. uuidGenerateId used node:crypto's
    randomBytes, which made the whole of @ingram-tech/nk-db/id node-only even
    though only minting needed it — every module touching an id inherited that, so a
    Drizzle schema.ts could not encode/decode without risking node:crypto in a
    client bundle, and sites resorted to dependency-injecting the codec around their
    schema. Randomness now comes from Web Crypto (a global on Node 19+, Bun, Deno,
    edge, browsers). id.ts has zero imports, and a test keeps it that way.

    exports now resolve under CJS. Every subpath declared only an "import"
    condition, so any CJS resolver failed with ERR_PACKAGE_PATH_NOT_EXPORTED
    including drizzle-kit, which meant a schema.ts importing
    @ingram-tech/nk-db/id broke drizzle-kit generate. The conditions are now
    "default", which resolves under both import and require.

    New: entityOf(registry, value) / decodeAnyId(registry, value). A public
    id is self-describing — its prefix names its entity — so it can be resolved with
    no surrounding context. That is the primitive behind polymorphic FK decoding,
    raw-SQL id binding, and generic event payloads. Sites were hand-rolling the loop
    over decodeOrNull.

    New subpath: @ingram-tech/nk-db/id/drizzlecreateIdColumns(registry)
    returns idColumn(entity) / polymorphicIdColumn (a customType whose
    toDriver decodes a skinned id before it reaches Postgres, on WHERE values as
    well as insert/update SET) plus sqlUuid / sqlUuidArray for the raw-SQL and
    RPC args the column layer cannot reach. dataType stays uuid, so adopting it
    needs no DDL and produces no drizzle-kit diff. It pulls only drizzle-orm and
    the codec, never pg, because it is imported by schema.ts.

@github-actions
github-actions Bot force-pushed the changeset-release/main branch from 80c3d0b to d4af562 Compare July 15, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants