Skip to content

feat(contract)!: replace contract caller with contract client factory#1699

Merged
dinwwwh merged 1 commit into
middleapi:mainfrom
dinwwwh:claude/openapi-caller-contract-client-ceabed
Jul 21, 2026
Merged

feat(contract)!: replace contract caller with contract client factory#1699
dinwwwh merged 1 commit into
middleapi:mainfrom
dinwwwh:claude/openapi-caller-contract-client-ceabed

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Jul 21, 2026

Copy link
Copy Markdown
Member

createContractCaller is now createContractClientFactory: instead of calling a procedure directly, it returns a client for the passed contract — and it accepts router contracts too. Same for createContractJsonifiedCallercreateContractJsonifiedClientFactory in @orpc/openapi.

export const createClient = createContractClientFactory(link, { /** options */ })

const client = createClient(procedure)
const output = await client(input)

// router contracts (including sub-routers) work too
const users = createClient(usersRouter)
const output = await users.list(input)
  • Paths resolve as a base path (derived from the first procedure defining meta.path) + the router shape, so sub-routers of the root contract work
  • contractRef registers every procedure inside the passed contract at its resolved path
  • createContractUtilsFactory / createContractJsonifiedUtilsFactory in @orpc/tanstack-query accept router contracts the same way
  • New resolveBasePathMeta helper exported from @orpc/contract

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orpc Ready Ready Preview, Comment Jul 21, 2026 2:30am

@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown
More templates

@orpc/arktype

npm i https://pkg.pr.new/middleapi/orpc/@orpc/arktype@1699

@orpc/bun

npm i https://pkg.pr.new/middleapi/orpc/@orpc/bun@1699

@orpc/client

npm i https://pkg.pr.new/middleapi/orpc/@orpc/client@1699

@orpc/cloudflare

npm i https://pkg.pr.new/middleapi/orpc/@orpc/cloudflare@1699

@orpc/contract

npm i https://pkg.pr.new/middleapi/orpc/@orpc/contract@1699

@orpc/experimental-effect

npm i https://pkg.pr.new/middleapi/orpc/@orpc/experimental-effect@1699

@orpc/evlog

npm i https://pkg.pr.new/middleapi/orpc/@orpc/evlog@1699

@orpc/json-schema

npm i https://pkg.pr.new/middleapi/orpc/@orpc/json-schema@1699

@orpc/nest

npm i https://pkg.pr.new/middleapi/orpc/@orpc/nest@1699

@orpc/next

npm i https://pkg.pr.new/middleapi/orpc/@orpc/next@1699

@orpc/openapi

npm i https://pkg.pr.new/middleapi/orpc/@orpc/openapi@1699

@orpc/opentelemetry

npm i https://pkg.pr.new/middleapi/orpc/@orpc/opentelemetry@1699

@orpc/pinia-colada

npm i https://pkg.pr.new/middleapi/orpc/@orpc/pinia-colada@1699

@orpc/pino

npm i https://pkg.pr.new/middleapi/orpc/@orpc/pino@1699

@orpc/publisher

npm i https://pkg.pr.new/middleapi/orpc/@orpc/publisher@1699

@orpc/ratelimit

npm i https://pkg.pr.new/middleapi/orpc/@orpc/ratelimit@1699

@orpc/server

npm i https://pkg.pr.new/middleapi/orpc/@orpc/server@1699

@orpc/shared

npm i https://pkg.pr.new/middleapi/orpc/@orpc/shared@1699

@orpc/tanstack-query

npm i https://pkg.pr.new/middleapi/orpc/@orpc/tanstack-query@1699

@orpc/trpc

npm i https://pkg.pr.new/middleapi/orpc/@orpc/trpc@1699

@orpc/valibot

npm i https://pkg.pr.new/middleapi/orpc/@orpc/valibot@1699

@orpc/zod

npm i https://pkg.pr.new/middleapi/orpc/@orpc/zod@1699

commit: f4db018

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 18 untouched benchmarks


Comparing dinwwwh:claude/openapi-caller-contract-client-ceabed (f4db018) with main (d7648e4)

Open in CodSpeed

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — replaced the single-procedure contract caller with a contract client factory that accepts router/sub-router contracts, threading base-path resolution through TanStack Query utils and the OpenAPI jsonified wrapper.

  • Renamed contract entry pointscreateContractCallercreateContractClientFactory in @orpc/contract and createContractJsonifiedCallercreateContractJsonifiedClientFactory in @orpc/openapi.
  • Router-contract support — factories now accept a RouterContract, return a RouterContractClient, and resolve procedure paths as basePath + shape.
  • New helper — exported resolveBasePathMeta derives the base path from the first procedure contract that defines meta.path.
  • TanStack Query alignmentcreateContractUtilsFactory and createContractJsonifiedUtilsFactory now take a ContractClientFactory, accept router contracts, and derive the query-key path from the contract (the path option is no longer exposed on factory options).
  • Docs & cleanup — updated apps/content/docs/advanced/scaling-large-projects.md and removed the stale **/.claude/** exclusion from vitest.config.ts.

Pullfrog  | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@dinwwwh dinwwwh changed the title feat(contract): replace contract caller with contract client factory feat(contract)!: replace contract caller with contract client factory Jul 21, 2026
@dinwwwh
dinwwwh merged commit c2beea1 into middleapi:main Jul 21, 2026
11 checks passed
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