supabase_client_gen 0.2.0
supabase_client_gen: ^0.2.0 copied to clipboard
Contract-driven code generator that reads a supabase.yaml specification and produces typed Dart client code — data models, enums, repositories with CRUD and realtime streams, edge function clients, an [...]
0.2.0 #
Production-hardening release. Generated output changes — regenerate downstream clients and review the diff (see "Changed" below).
Added #
- Golden/snapshot test suite plus a round-trip compile check that analyses
generated code against real
supabase_flutter/equatable. - Friendly contract validation: malformed YAML now reports the offending path
(e.g.
data_model.public.things.primary_key) instead of a raw cast crash. --db-urlflag (andSUPABASE_DB_URLenv) ongenerateandvalidateto target any project's Postgres, not just local Supabase.generate --with-db --sync-nullabilitywrites live-DB column nullability back into the contract'snullable_fields, keeping generation deterministic.- Storage bucket clients: typed upload/download, public URL or signed URL per
publicflag, MIME and file-size validation from the contract. --versionflag on both CLIs; provenance header on every generated file.
Changed (output-affecting) #
- Deterministic output: generation reads nullability only from the
contract's
nullable_fields.--with-dbno longer feeds generation directly (it now validates / syncs). Same contract → byte-identical code on any machine. primary_keyis honoured:update/delete/streamuse the table's real primary key instead of a hardcodedid.- Structural workspace scoping:
select/streamare workspace-scoped only when the table actually has aworkspace_idcolumn (was a brittle access-string heuristic that mis-scoped global tables and theworkspacestable itself). - Read-only tables that have realtime now get a repository with a
.stream().
Fixed #
dart formatfailures are surfaced loudly instead of silently producing mis-compared output.edge_functions.runtimescalar no longer crashes contract parsing.- DB↔contract diff respects
nullable_fieldsinstead of always flagging nullable columns.
0.1.0 #
- Initial release.
- Contract-driven code generation from
supabase.yamlto typed Dart. - Data models with
fromJson/toJsonand null-safety. - Enums from Postgres enum types.
- Repository classes with
.select(),.insert(),.update(),.delete(),.stream(). - Edge function clients with typed request/response.
- CLI tools:
generateandvalidate. - Optional live DB nullability detection via
--with-db. - Full validation pipeline: DB ↔ Contract ↔ Generated Code ↔ TS Types ↔ Migrations.