Repository navigation
feat(typegen)!: generate only from the document the Supabase CLI pipes in - #1963
Conversation
…s in Remove the built-in database introspection and the --local, --linked, --project-ref, --db-url and --dump-metadata options. supabase_typegen now only reads the GeneratorMetadata document that `supabase gen types --lang dart` pipes in on stdin, which pg-meta has already introspected, sorted and resolved rpcFunctions for.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
What
supabase_typegenno longer connects to a database itself. Its only input is now theGeneratorMetadatadocument thatsupabase gen types --lang dartpipes in on stdin. Before this change it could also run on its own, through a Dart port of the@supabase/postgrest-typegenintrospection. That port repeated work the CLI flow already does: pg-meta introspects the database, sorts the document withsortGeneratorMetadataand attachesrpcFunctions.Changes
--local,--linked,--project-ref,--db-urland--dump-metadataoptions.--schema,--outputand--importstay.package:supabase_typegen/introspection.dartlibrary: the vendored introspection SQL, thesupabase db queryrunner, theconfig.tomlschema defaults, the sort pass and its ICU collation.resolveRpcFunctions. The parser now readsrpcFunctionsfrom the document, and a document without that collection describes no RPC functions.test.yml, and the now unusedtoml,collectionandpostgresdependencies.MIGRATION.mdto usesupabase gen types --lang dart.The
test/fixtures/generator_metadata.jsonfixture is still generated by the upstream TypeScript introspection (tool/regenerate_fixture.ts), so the generator and parser tests run against exactly the document the CLI produces.Breaking
Running
dart run supabase_typegen --local(or any other connection option) now fails with an unknown option error. Usesupabase gen types --lang dart --local > lib/supabase_schema.g.dartinstead.Summary by CodeRabbit