Repository navigation
feat(typegen): depend on the registry alone and prepare it for hosted consumers - #213
Conversation
…stry alone `introspect`, `Queryable`, `IntrospectOptions`, `GeneratorMetadata` and `GENERATOR_METADATA_VERSION` are re-exported from @supabase/postgrest-typegen. A consumer that depended on both packages directly could resolve two postgrest-typegen versions, introspecting with one and generating with the other; with a single dependency the registry pins the version the in-process generators were built against, and adding a language is one dependency bump in the CLI.
…of ES modules works The package ships ES modules only and its `require` export condition resolves to one. Node accepts that without a flag from 20.19.0, so the engines range now says so, matching @supabase/typegen.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 14 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughTypegen now re-exports introspection APIs and metadata contracts from postgrest-typegen. Its documentation and tests reflect and verify these exports. The postgrest-typegen package also raises its minimum supported Node.js version to 20.19.0. Priority: ⚪ Not assessed Change: Feature Merge Risk: ⚪ Minimal · up to No actionable merge risk is established. The API is wired through the package roots, and the Node.js minimum change does not expand the runtime requirement for typegen consumers. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ules works `>=20.19.0` admitted Node 21 and 22.0 through 22.11, where require() of an ES module still needs a flag; `^20.19.0 || >=22.12.0` matches the actual requirement in both packages. Also point the remaining docs and the Host comment at the re-exported introspect(), drop a redundant comment, and merge the two pass-through tests into one.
Node 20 reached end of life in April 2026 and Node 21 was never an LTS line, so the compound range only kept dead lines alive. 22.12.0 is the first Node 22 release that accepts require() of an ES module without a flag, and postgres-meta, the one Node consumer, already runs on 22.
…ional Both prepare postgres-meta for dispatching its hosted generator routes through the registry. Its Swift route has always accepted `private` and `package`, so the choice list now carries all four generator levels; extra choices change nothing for existing CLI users. A hosted service cannot run processes, so `Host.spawn` is optional and an out-of-process language asked to generate without one fails with a clear SpawnUnavailableError instead of the consumer having to stub it.
…pull request It lives in #214 now, so release-please records it as a patch on postgrest-typegen instead of attributing this feature to that package.
…etect-one-to-one-relationships The registry named the option after the CLI's inverted flag. The flag only ever worked with --db-url, targets PostgREST 9 from 2022, and the CLI already sniffs the local stack's PostgREST version itself, while postgres-meta's route exposes the positive parameter. So the option now carries the generator's own name and polarity, defaults to true, and is a consumer option: the calling program knows the target's PostgREST version. The CLI adapter keeps --postgrest-v9-compat as a deprecated alias that sets it to false.
Split out of #213 so release-please records it as a patch on postgrest-typegen rather than folding it into the typegen feature. ## Summary `@supabase/postgrest-typegen` now declares `engines.node` as `>=22.12.0`, replacing `>=20.0.0`. - The package ships ES modules only and its `require` export condition resolves to one. Node accepts `require()` of an ES module without a flag from 22.12.0; on earlier versions it throws `ERR_REQUIRE_ESM`, so the old range advertised support that did not work for CommonJS consumers. CodeRabbit raised this on #211 for `@supabase/typegen`, which already declares the same range. - Node 20 reached end of life in April 2026 and Node 21 was never a long-term-support line, so neither is worth keeping in the range. - postgres-meta, the one consumer that runs this package under Node, is on Node 22 in its Dockerfile and `.nvmrc`. The Supabase CLI is unaffected: it compiles with Bun and bundles the package. ## Consequence Anyone installing on Node 20 will now see an engines warning. That is a declared-support change on a published package, not a behavior change: nothing in the package differs between the two ranges.
## Summary `@supabase/typegen` depended on `@supabase/postgrest-typegen` through `^0.2.3` and its lockfile still resolved 0.2.3. This pins the dependency to the exact `0.2.4` released in #215. ## Why an exact pin The registry's contract, added in #213, is that a consumer depends on `@supabase/typegen` alone and gets one postgrest-typegen version for both introspection (re-exported `introspect`) and the in-process generators. A caret range lets a consumer's lockfile resolve any later 0.2.x, so "the version the generators were built against" would not be a guarantee. With an exact pin it is: every postgrest-typegen bump becomes a registry release, and dependabot's existing bun group bumps the pin. ## Changes - `packages/typegen/package.json` and `bun.lock`: `0.2.4`, exact. - README and CLAUDE.md: one sentence each on why the pin is exact. Checks: typecheck, format and lint, knip, 47 tests, and a frozen-lockfile install all pass.
🤖 I have created a release *beep* *boop* --- ## 0.1.0 (2026-09-25) ### Features * **typegen:** depend on the registry alone and prepare it for hosted consumers ([#213](#213)) ([ff5e98d](ff5e98d)) ### Bug Fixes * **typegen:** pin @supabase/postgrest-typegen to 0.2.4 ([#216](#216)) ([de4806e](de4806e)) ### Miscellaneous Chores * release 1.3.0 ([#97](#97)) ([ee2ef6e](ee2ef6e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Follow-up to #211 (SDK-1955), preparing for the CLI adapter in SDK-1956.
Summary
@supabase/typegenre-exportsintrospect,Queryable,IntrospectOptions,GeneratorMetadataandGENERATOR_METADATA_VERSIONfrom@supabase/postgrest-typegen. The CLI can then depend on the registry alone: one dependency to bump when a language is added, and the document is always produced by the samepostgrest-typegenversion the in-process generators were built against. Depending on both packages directly would let a lockfile resolve two versions, introspecting with one and generating with the other.@supabase/typegennow declaresengines.nodeas>=22.12.0. It ships ES modules only and itsrequireexport condition resolves to one, the finding CodeRabbit raised on feat(typegen): add language registry package so new languages need no CLI change #211; 22.12.0 is the first Node 22 release that accepts that without a flag. Node 20 reached end of life in April 2026 and Node 21 was never an LTS line, so neither is worth keeping in the range. The same change for@supabase/postgrest-typegenis fix(postgrest-typegen): require Node 22.12 or newer #214, kept separate so release-please records it as a patch on that package. The Supabase CLI is unaffected either way: it compiles with Bun and bundles both packages.Two changes that prepare postgres-meta for dispatching its hosted
/generators/*routes through the registry. The Swift option now accepts all four generator access levels (internal,public,private,package), since postgres-meta's route always did and extra choices change nothing for existing CLI users.Host.spawnis optional: a hosted service cannot run processes, so an out-of-process language asked to generate without one fails with aSpawnUnavailableErrorrather than the consumer stubbing a runner.postgrest-v9-compatis gone as a registry option. It was the CLI's inverted name for the generator'sdetectOneToOneRelationships, only ever worked with--db-url, and targets PostgREST 9 from 2022; the CLI sniffs the local stack's PostgREST version itself and postgres-meta's route exposes the positive parameter. The option is nowdetect-one-to-one-relationships, a consumer option defaulting totrue, so both consumers set it from what they know about the target and no user sees a 2022 compatibility switch. TypeScript therefore has no user flags;swift-access-controlis the only one left in the registry. The CLI adapter (SDK-1956) keeps--postgrest-v9-compatas a deprecated alias that sets the option tofalse.Changes
packages/typegen/src/index.ts: the re-exports, with a comment stating why.packages/typegen/test/reexports.test.ts:introspectis the same functionpostgrest-typegenexports and the document version matches.packages/typegen/README.mdandCLAUDE.md: the usage example importsintrospectfrom@supabase/typegen, and the "Where it sits" section explains the single-dependency rule.packages/typegen/package.json: engines range.packages/typegen/src/contract.ts: theHostcomment points at the re-exportedintrospect();spawnis optional.packages/typegen/src/errors.tsandsrc/languages/external.ts:SpawnUnavailableError.packages/typegen/src/languages/index.ts: Swift choice list;detect-one-to-one-relationshipsreplacespostgrest-v9-compat.Notes
packages/typegen, so the squash commit lands in the typegen changelog alone.