Repository navigation
refactor(postgres)!: publish the parts of postgres() that the Supabase extension reuses as Early Access, not GA - #31241
Conversation
…s export Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…e first; records for the API check Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
… as the one extension built on a facade Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…d for the Supabase slice Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
… the facade Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…o the runtime entry with the Early Access prefix The runtime/internal/prepared-query entry is deleted. Its seven names that the Supabase extension uses are exported from the root entry as ea_preparedStatementQuery, ea_preparedStatementExecute, ea_transactionStart, ea_createTransactionStart and the types Ea_PreparedStatementQueryTarget, Ea_PreparedStatementExecuteTarget and Ea_TransactionStartTarget. The others are not exported. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…y Access names on the runtime and static entries The four internal/* entries of the PostgreSQL facade are deleted. The runtime entry exports ea_resolveOptionalPostgresBinding, ea_connectWithBinding, Ea_PostgresBindingRules, ea_buildPostgresQueryMembers, Ea_PostgresQueryMembersOptions, ea_validateTransactionOptions, ea_validateCursorOptions, ea_toDriverCursorOptions, and Ea_PostgresRuntimeImpl in place of PostgresRuntimeImpl. The static entry exports ea_buildPostgresStaticContext and ea_validatePostgresContract. The Supabase extension imports the new names. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…he PostgreSQL client parts Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…al entries Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…ntime class as breaks Records whose fingerprints changed only because a type they use was renamed or lost its internal path keep their reasons. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…two records Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
No extension names the type; Supabase passes an object literal to ea_buildPostgresQueryMembers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…r exported Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…, and what forwarding code does now Drops Ea_PostgresQueryMembersOptions, adds .tsx to the globs and matches PostgresRuntimeImpl with the same lookarounds as other guides. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…ntime class Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…l prepared-query path Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
…QueryMembersOptions Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Public API changesThis pull request changes the ## API changes
- `@prisma/orm-extension-supabase`:
- `@prisma/orm-extension-supabase/runtime: RoleBoundDb`:
- `@prisma/orm-extension-supabase/runtime: SupabaseRoleScope`:
- `@prisma/orm-extension-supabase/runtime: SupabaseRuntimeImpl`:
- `@prisma/orm-family-sql`:
- `@prisma/orm-family-sql (not exported): TransactionStart`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: PreparedStatementExecuteTarget`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: PreparedStatementQueryTarget`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: SettledTransactionTarget`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: TransactionSettlementState`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: TransactionStart`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: TransactionStartTarget`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: createTransactionStart`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: preparedStatementExecute`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: preparedStatementQuery`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: settlementOf`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: transactionSettlement`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: transactionStart`:
- `@prisma/orm-family-sql/runtime/internal/prepared-query: wasRefusedBeforeBegin`:
- `@prisma/orm-family-sql/runtime: ConnectionProvider`:
- `@prisma/orm-family-sql/runtime: Ea_PreparedStatementExecuteTarget`:
- `@prisma/orm-family-sql/runtime: Ea_PreparedStatementQueryTarget`:
- `@prisma/orm-family-sql/runtime: Ea_TransactionStartTarget`:
- `@prisma/orm-family-sql/runtime: SqlRuntimeBase`:
- `@prisma/orm-family-sql/runtime: ea_createTransactionStart`:
- `@prisma/orm-family-sql/runtime: ea_preparedStatementExecute`:
- `@prisma/orm-family-sql/runtime: ea_preparedStatementQuery`:
- `@prisma/orm-family-sql/runtime: ea_transactionStart`:
- `@prisma/orm-mariadb`:
- `@prisma/orm-mariadb/family-runtime/internal/prepared-query: everything from @prisma/orm-family-sql/runtime/internal/prepared-query`:
- `@prisma/orm-mysql`:
- `@prisma/orm-mysql/family-runtime/internal/prepared-query: everything from @prisma/orm-family-sql/runtime/internal/prepared-query`:
- `@prisma/orm-postgres`:
- `@prisma/orm-postgres/family-runtime/internal/prepared-query: everything from @prisma/orm-family-sql/runtime/internal/prepared-query`:
- `@prisma/orm-postgres/internal/options: PostgresBindingRules`:
- `@prisma/orm-postgres/internal/options: connectWithBinding`:
- `@prisma/orm-postgres/internal/options: resolveOptionalPostgresBinding`:
- `@prisma/orm-postgres/internal/options: toDriverCursorOptions`:
- `@prisma/orm-postgres/internal/options: validateCursorOptions`:
- `@prisma/orm-postgres/internal/options: validateTransactionOptions`:
- `@prisma/orm-postgres/internal/static-context: PostgresStaticContext`:
- `@prisma/orm-postgres/internal/static-context: buildPostgresStaticContext`:
- `@prisma/orm-postgres/internal/transaction-members: buildPostgresQueryMembers`:
- `@prisma/orm-postgres/internal/validate-contract: validatePostgresContract`:
- `@prisma/orm-postgres/runtime: Ea_PostgresBindingRules`:
- `@prisma/orm-postgres/runtime: Ea_PostgresRuntimeImpl`:
- `@prisma/orm-postgres/runtime: PostgresRuntimeImpl`:
- `@prisma/orm-postgres/runtime: ea_buildPostgresQueryMembers`:
- `@prisma/orm-postgres/runtime: ea_connectWithBinding`:
- `@prisma/orm-postgres/runtime: ea_resolveOptionalPostgresBinding`:
- `@prisma/orm-postgres/runtime: ea_toDriverCursorOptions`:
- `@prisma/orm-postgres/runtime: ea_validateCursorOptions`:
- `@prisma/orm-postgres/runtime: ea_validateTransactionOptions`:
- `@prisma/orm-postgres/static: ea_buildPostgresStaticContext`:
- `@prisma/orm-postgres/static: ea_validatePostgresContract`:
- `@prisma/orm-sqlite`:
- `@prisma/orm-sqlite/family-runtime/internal/prepared-query: everything from @prisma/orm-family-sql/runtime/internal/prepared-query`:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: willbot <[email protected]> Signed-off-by: Will Madden <[email protected]>
size-limit report 📦
|
@prisma/orm-better-auth
@prisma/orm-extension-arktype-json
@prisma/orm-extension-middleware-cache
@prisma/orm-extension-paradedb
@prisma/orm-extension-pgvector
@prisma/orm-extension-postgis
@prisma/orm-extension-supabase
@prisma/orm-family-mongo
@prisma/orm-family-sql
@prisma/orm-framework
@prisma/orm-mariadb
@prisma/orm-mongo
@prisma/orm-mysql
@prisma/orm-postgres
@prisma/orm-postgres-contrib
@prisma/orm-sqlite
@prisma/orm-target-mariadb
@prisma/orm-target-mongo
@prisma/orm-target-mysql
@prisma/orm-target-postgres
@prisma/orm-target-sqlite
@prisma/orm-toolchain
commit: |
At a glance
From release 8.0, everything a user can import from a generally available (GA) package must keep working until Prisma 9. This pull request decides that the building blocks of the PostgreSQL client are not promised that long. They are published under Early Access names, which may change in any release, and the
internalimport paths that held them are deleted.The Supabase extension is the one caller. Before:
After:
The code behind each name is unchanged. What breaks is any code that imports the deleted
internalpaths or the old class namePostgresRuntimeImpl. That is extension code only: no example application, user guide orprisma orm inittemplate imports them.Background
@prisma/orm-postgresis the PostgreSQL facade: the one package an application installs to use PostgreSQL. Itsruntimepath exportspostgres(), which builds the client an application queries with.@prisma/orm-extension-supabaseis a separate published package. Itssupabase()builds a different PostgreSQL client: one with no query interface until the application binds a database role, so no query can run without a role. It assembles that client from the same pieces aspostgres(): connection handling, the builder for the client'ssql,ormandtransactionmembers, the option checks, and the runtime class, which it subclasses. Because it is a separate package, it can only use what the facade publishes, and the facade published those pieces on four import paths namedinternal, for Supabase alone.Anyone could import those paths, and nothing told a reader they might change.
The decision
The
ea_prefix (Ea_for a type or class) marks a name as Early Access.docs/oss/versioning.mddefines it: an Early Access name may change in any release, and the CI check that compares each package's exports with the last release does not fail when one changes.These pieces get that prefix because they are the seams inside
postgres(). They were cut out of it so Supabase could reuse them, not designed as an interface. Their signatures expose how the client is put together today:buildPostgresQueryMemberstakes the execution context, the query builder and a transaction context as separate inputs. Publishing them under plain names would freeze that structure until Prisma 9. If they prove stable, a later release adds plain names beside the prefixed ones.One limit: the prepared-query names also key members of the SQL family's
SqlRuntimeBase, a GA class. The CI check judges a class's members as part of it, so changing those names would still be a recorded break. Settling that class's own level is the project's next platform slice; the plan records it.They move onto the paths that already load their code:
runtime, wherepostgres()lives, andstatic, which holds the parts that need no database driver.What changes
@prisma/orm-postgresdeletesinternal/options,internal/static-context,internal/transaction-membersandinternal/validate-contract. Their exports move toruntimeandstaticwith the prefix, andPostgresRuntimeImplbecomesEa_PostgresRuntimeImpl.@prisma/orm-family-sql, the package shared by every SQL database, deletesruntime/internal/prepared-query. The seven names Supabase uses move toruntimewith the prefix. The path's six other names (settlementOf,transactionSettlement,wasRefusedBeforeBeginand three types) are no longer exported at all: nothing outside the package uses them, and every name we export is one we must keep in some form.@prisma/orm-mysql,@prisma/orm-mariadband@prisma/orm-sqliteeach re-export the SQL family's paths under their own name, so each losesfamily-runtime/internal/prepared-querytoo.@prisma/orm-postgresas a peer dependency; the decision record on the published packages now says it is the only extension that builds on a facade instead of the lower-level packages.A change from the design we agreed
The design moved the runtime class and
validatePostgresContractinto@prisma/orm-target-postgres, the lower-level PostgreSQL package. Building it showed that was wrong, so both stay in the facade:prisma ormcommands load the target, and keeping the query-execution code out of that load is the reason.PostgresRuntimeImplextends a class from the SQL runtime, so moving it would pull that code in.validatePostgresContractandcontractFromJsonmark a contract as validated under one shared key, so a contract checked by one is not checked again by the other. Moving one of them to another package would need that key exported and kept in step across packages.Either way the names are published at Early Access, so users are promised the same thing.
API changes
The CI check requires each package whose export list changed to be named here.
@prisma/orm-postgres: the five removed paths, andPostgresRuntimeImplrenamedEa_PostgresRuntimeImpl.runtimeaddsea_resolveOptionalPostgresBinding,ea_connectWithBinding,Ea_PostgresBindingRules,ea_buildPostgresQueryMembers,ea_validateTransactionOptions,ea_validateCursorOptionsandea_toDriverCursorOptions;staticaddsea_buildPostgresStaticContextandea_validatePostgresContract. Each is a part ofpostgres()the Supabase extension reuses. Five earlier break records (fix(sql-builder)!: a column name that several joined tables share must name its table #31150, feat(postgres)!: a PostgreSQL contract lists the capabilities it requires (optional, with a warning, until 8.0) #31218) were updated: a record is tied to the exact text of the types it covers, and these covered the copies ofPostgresStaticContextunder the deletedinternal/static-contextpath. With those copies gone, the check could also compareserverlessandstatic's default exports, which it had left undecided, and found the same column-name break (fix(sql-builder)!: a column name that several joined tables share must name its table #31150) in them; two records were added for it.@prisma/orm-family-sql:runtime/internal/prepared-queryremoved;runtimeadds the sevenea_/Ea_names above.@prisma/orm-mysql:family-runtime/internal/prepared-queryremoved, because the SQL family's path it re-exported is removed.@prisma/orm-mariadb:family-runtime/internal/prepared-queryremoved, because the SQL family's path it re-exported is removed.@prisma/orm-sqlite:family-runtime/internal/prepared-queryremoved, because the SQL family's path it re-exported is removed.@prisma/orm-extension-supabase: no change to its own exports; three records updated becauseRoleBoundDb, which the three types build on, now extendsEa_PreparedStatementQueryTargetandEa_PreparedStatementExecuteTarget.How it was checked
runtimeandstaticand the old names are gone.postgres()itself is unchanged: the facade exports its existing functions under a second name (export { buildPostgresQueryMembers as ea_buildPostgresQueryMembers }) and its own code still calls them directly.Alternatives considered
internalpaths and document them as unstable. Rejected: a reader cannot see a document from an import line, and the CI check treats every path of a GA package as promised. A name prefix is visible wherever the name is used.@prisma/orm-postgres/runtime-toolkit. Rejected:runtimealready loads this code, so a separate path keeps nothing out of an application's bundle. The level belongs in the name, which the reader sees at every use.postgres()until Prisma 9, for one caller we expect to change.postgres(), with Supabase as a thin layer on top. Rejected: Supabase's client must have no query interface until a role is bound. A hook can add topostgres()'s client but cannot remove the interface it already has.Part of the project to reduce what the GA packages export (Linear TML-3979). Its plan is in
projects/reduce-exported-apis/.Agent: gilderoy-93
🤖 Generated with Claude Code
Summary by CodeRabbit