supabase / postgres-meta

A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries
https://supabase.com
Apache License 2.0
881 stars 116 forks source link

chore(typegen): Extract metadata generation to function #685

Closed isaacharrisholt closed 6 months ago

isaacharrisholt commented 8 months ago

The metadata collection for types was previously in the TypeScript generator route. This PR pulls it out into a separate function, which should make it easier to create type generators for other languages in the future (I plan on implementing types for Go imminently).

The only change introduced by this PR is to exit early from the function if a fetch fails, rather than performing all the fetches then going though the errors one by one. Should mildly increase performance for the unhappy path, though it was more to make the code easier to follow.

What kind of change does this PR introduce?

Refactor

What is the current behavior?

Behaviour not changed.

What is the new behavior?

Behaviour not changed.