Skip to content

feat(postgrest): add csv, explain, head, dryRun, stripNulls, maxAffected and geojson to the typed transform builder - #1848

Merged
spydon merged 1 commit into
mainfrom
lukasklingsbo/sdk-1838-typed-transform-modifiers
Sep 17, 2026
Merged

spydon merged 1 commit into
mainfrom
lukasklingsbo/sdk-1838-typed-transform-modifiers

Conversation

@spydon

@spydon spydon commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

What

Adds the result-shape modifiers that PostgrestTransformBuilder<T> already has to PostgrestTypedTransformBuilder<Row, T>, so a typed caller no longer has to rebuild the query with from() to reach them.

Method Awaited type
csv() String
explain(...) String
head() void
geojson() Map<String, dynamic>
dryRun() T
stripNulls() T
maxAffected(int) T

Each delegates to the wrapped untyped builder. csv, dryRun, stripNulls and maxAffected return a PostgrestTypedTransformBuilder, so order, limit, range and friends still chain after them. head, geojson and explain return a PostgrestTypedBuilder, matching how their untyped counterparts return a plain PostgrestBuilder.

final String csv = await client.table(Books.table).select().csv();

final Book preview = await client
    .table(Books.table)
    .insert({'title': 'foo'})
    .select()
    .single()
    .dryRun();

await client.table(Books.table).delete().where(Books.isDone.eq(true)).maxAffected(10);

Why

SDK-1361 deliberately left these out to keep the first typed surface reviewable.

Tests

typed_query_test.dart gains a result modifiers group that asserts the headers each method sends and that the row type survives dryRun, stripNulls and maxAffected.

The new symbols are registered in sdk-compliance.yaml next to their untyped counterparts. Symbol, drift and schema checks pass locally against the pinned capability-matrix tooling.

Closes https://linear.app/supabase/issue/SDK-1838

Summary by CodeRabbit

  • New Features

    • Added typed query support for CSV, GeoJSON, and EXPLAIN responses.
    • Added HEAD requests, dry runs, null-stripped JSON responses, and maximum affected-row limits.
    • EXPLAIN requests support configurable analysis, verbosity, settings, buffers, WAL, and output format options.
    • Typed results are preserved across supported transformations and mutations.
  • Tests

    • Added coverage for result formatting, request modifiers, response parsing, and transform composition.
  • Documentation

    • Updated the capability matrix to include the new typed transform features.

…ted and geojson to the typed transform builder
@spydon
spydon requested a review from a team as a code owner September 17, 2026 12:05
@github-actions github-actions Bot added the postgrest This issue or pull request is related to postgrest label Sep 17, 2026
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 97cf2e90-9cd7-4bc1-ad2d-9b66baea0773

📥 Commits

Reviewing files that changed from the base of the PR and between a3a7559 and 73406f3.

📒 Files selected for processing (3)
  • packages/postgrest/lib/src/postgrest_typed_transform_builder.dart
  • packages/postgrest/test/typed_query_test.dart
  • sdk-compliance.yaml

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Changes

The typed PostgREST transform builder now supports null stripping, dry runs, affected-row limits, CSV, HEAD, GeoJSON, and configurable EXPLAIN responses. Tests cover request options, response types, and transform composition. SDK compliance metadata lists the new capabilities.

Typed transform support

Layer / File(s) Summary
Typed transform-builder methods
packages/postgrest/lib/src/postgrest_typed_transform_builder.dart
Adds typed methods for request modifiers and CSV, HEAD, GeoJSON, and EXPLAIN responses.
Typed modifier behavior validation
packages/postgrest/test/typed_query_test.dart
Verifies headers, HTTP methods, query composition, response bodies, and preserved typed results.
SDK capability metadata
sdk-compliance.yaml
Adds the new typed transform-builder symbols to the capability matrix.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: grdsdev

Merge Risk: ⚪ Minimal · up to 73406

The added typed modifiers, tests, and capability metadata have no identified merge-blocking issue.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the added methods in the typed transform builder. It is concise enough for the scope of the change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lukasklingsbo/sdk-1838-typed-transform-modifiers

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@spydon
spydon merged commit 85fd453 into main Sep 17, 2026
45 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-1838-typed-transform-modifiers branch September 17, 2026 13:42
spydon added a commit that referenced this pull request Sep 17, 2026
…ter (#1850)

## Summary

Main does not compile since #1848 and #1849 merged within minutes of
each other. #1849 replaced the typed transform builder's
`PostgrestTable` field with a `RowConverter<Row>` (`_rowFromJson`), and
#1848 added `stripNulls`, `dryRun`, `maxAffected` and `csv` on top of
the old field. Neither PR's CI saw the other, so every check on main and
on the open PRs fails at compile time in
`postgrest_typed_transform_builder.dart`:

```
Error: The getter '_table' isn't defined for the type 'PostgrestTypedTransformBuilder<Row, T>'.
```

## Changes

- The four methods from #1848 pass `_rowFromJson` to the private
constructor, like the rest of the class does after #1849.
- The two tests from #1848 that passed raw maps use `BookInsert` and
`BookUpdate`, which #1849 made the only accepted payload types on the
typed builder.
- The `dryRun` dartdoc example uses `BookInsert` as well.

No public API change. `dart analyze` on `packages` and `examples` is
clean, `typed_query_test.dart` passes (49), DCM is clean.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved typed mutation operations so options such as dry runs,
affected-row limits, CSV responses, and null stripping consistently
preserve the expected result types.
- Updated typed insert and update usage in mutation scenarios to ensure
submitted data is handled with the correct typed representations.

- **Documentation**
- Updated the dry-run example to demonstrate usage with a typed insert
value.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

postgrest This issue or pull request is related to postgrest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants