Repository navigation
feat(supabase): run the typed function calls through the client interceptors - #2056
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Typed RPC executor support packages/postgrest/lib/src/postgrest_rpc.dart, packages/postgrest/lib/src/postgrest_table_executor.dart |
PostgrestRpc accepts an optional executor and uses it for typed rows and value calls. withExecutor returns a copy with the supplied executor while retaining the client and schema settings. |
Supabase RPC routing and validation packages/supabase/lib/src/supabase_query_schema.dart, packages/supabase/lib/src/supabase_client_interceptor.dart, packages/supabase/lib/src/supabase_client.dart, packages/supabase/test/client_interceptor_test.dart, AGENTS.md, MIGRATION.md |
SupabaseQuerySchema.rpc supplies the wrapped executor. Documentation distinguishes typed RPC interception from untyped RPC bypass. Tests cover typed RPC interception and outgoing request properties. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant SupabaseQuerySchema
participant PostgrestRpc
participant SupabaseClientInterceptor
participant PostgrestHttpTableExecutor
SupabaseQuerySchema->>PostgrestRpc: supply wrapped executor
PostgrestRpc->>SupabaseClientInterceptor: execute typed RPC request
SupabaseClientInterceptor->>PostgrestHttpTableExecutor: forward request through inner executor
Possibly related PRs
- supabase/supabase-flutter#1940: Adds the typed table executor and interceptor chain that this change extends to typed RPC calls.
- supabase/supabase-flutter#2026: Changes HTTP executor handling for RPC requests, including GET arguments used by the newly intercepted typed RPC calls.
Suggested labels: postgrest
Merge Risk: 
Minimal · up to 4190b
-
No actionable issue remains from the supplied evidence; the change is mergeable after normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the main change: typed function calls (rpc) now run through the Supabase client interceptors. The changeset matches this. It adds an optional executor to PostgrestRpc, routes SupabaseClient and SupabaseQuerySchema rpc calls through the interceptor-wrapped executor, documents the behavior, and adds tests. The title uses the conventional feat(supabase) prefix and is 76 characters long. It omits the untyped rpc bypass and the read-only GET behavior, which is acceptable for a title.
Full details: Docstring Coverage
-
Explanation
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 files. (8 skipped: 8 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
…calls and cover read-only calls
4573ac3 to
4190b69
Compare
What
Stacked on #1940.
The typed function calls on
client.rpc,rowsandvalueand the methodssupabase_typegengenerates on top of them, already collect aPostgrestTableRequestwithPostgrestTableOperation.rpc. However, they always sent it through a freshPostgrestHttpTableExecutor, so the interceptors from #1940 never saw them. They now run through the same executor chain astable(). That means an interceptor such as an offline layer can cache, queue or answer function calls as well as table requests.The untyped
client.rpc('fn')keeps bypassing the interceptors, the same wayfrom()does.postgrest
PostgrestRpctakes an optional executor thatrowsandvaluerun through, andwithExecutorreturns a copy that uses another one. Both are@internal, so no public surface is added. Without an executor it behaves exactly as before.supabase
SupabaseClient.rpcandSupabaseQuerySchema.rpchand the interceptor-wrapped executor toPostgrestRpc. Schema scoping is unchanged because the request carries its schema, as it does for tables.wrapTableExecutordocuments what a function call request looks like to an interceptor: it counts as a mutation unlessreadOnlyis set, its table has no primary key, and a call read as a value has no rows. It also says that typed requests an interceptor makes on the client pass through the chain again, so the interceptor should useinnerto bypass it.PostgrestTableExecutor,SupabaseClientInterceptor,SupabaseClientandrpc, plusMIGRATION.mdandAGENTS.md, now say which calls pass through interceptors.Tests
packages/supabase/test/client_interceptor_test.dartcovers:rpc.rowswith a filter andrpc.valuereaching the interceptor asrpcrequests, with the filter andapikeyon the wire.Content-Profile.get: true) reaching the interceptor withreadOnlyset and going out as a GET.rpc('ping')still bypassing the interceptor.Summary by CodeRabbit