Skip to content

Add TypeScript client query builder calls for views with args - #6336

Open
JasonAtClockwork wants to merge 1 commit into
masterfrom
jlarabie/view-args-lite-ts-builder
Open

JasonAtClockwork wants to merge 1 commit into
masterfrom
jlarabie/view-args-lite-ts-builder

Conversation

@JasonAtClockwork

@JasonAtClockwork JasonAtClockwork commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Description of Changes

Stacked on #6324 to add typed calls for views with args in the TypeScript query builder. Limits based on the stacked PR to disallow filtering and joins but views without params remain unchanged.

  • Updated codegen to emit params for TypeScript with a __withViewParams wrapper
  • Added new ViewCall type for query builder to map the function with the args
  • Fixed Uint8Array to Sql

Limitations:

  • Hooks on a view call will show rows from every active call as rows don't record the args, this is a problem for semijoin as well that we'll need to fix
  • subscribe(tables => ...) is already untyped for every table, so view calls need a cast
    // Typed: use the generated `tables` export
    conn.subscriptionBuilder().subscribe(tables.byId({ id: 7 }));
    
    // Untyped callback: works at runtime, but needs a cast to compile
    conn.subscriptionBuilder().subscribe((t: any) => t.byId({ id: 7 }));

API and ABI breaking changes

None

Rollback safety impact

n/a

Expected complexity level and risk

2 - Limited to the TS query builder and codegen

Testing

  • Extended unit tests in query.test.ts to cover query builder changes
  • Local e2e testing with AI assistance to test the types and limitations

@JasonAtClockwork
JasonAtClockwork marked this pull request as ready for review October 19, 2026 18:06
@JasonAtClockwork
JasonAtClockwork force-pushed the jlarabie/view-args-lite-ts-builder branch from 438ed3c to a05d98e Compare October 19, 2026 21:25
@JasonAtClockwork
JasonAtClockwork changed the base branch from jlarabie/view-args-lite to master October 19, 2026 21:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant