trpc

🧙‍♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy.

MIT License

Downloads
7.4M
Stars
32.7K
Committers
405

Bot releases are visible (Hide)

trpc -

Published by KATT about 3 years ago

  • rename originalError to cause to align with https://github.com/tc39/proposal-error-cause (#881)
  • add @internal/@public/@alpha/@beta-tags to indicate users should use and not (#890)
  • add ci checks for node version 12.x (#886)
trpc -

Published by KATT about 3 years ago

  • @trpc/server: Make createContext() optional (#872)

thanks @joaopaulobdac!

trpc -

Published by KATT about 3 years ago

  • @trpc/react: Fix prefetchInfiniteQuery with pageParam - #857

Thank you @hypnodron for finding the issue, fixing it, and adding tests! 🙏

trpc -

Published by KATT about 3 years ago

  • next(): method in server-side middlewares - see docs
  • responseMeta(): Better support for custom HTTP headers & status code - see caching docs
  • Server-side errors in @trpc/next are now serialized

Upgrade guide for the 99% usecase

  1. npx npm-check-updates --filter /@trpc/ -u && yarn
  2. Simply update any .middleware() and add return next() at the end. See middleware docs

Breaking changes

  • Middlewares will now have to call a next() function that you have to call.
  • Reduce TRPCErrors - METHOD_NOT_FOUND removed & PATH_NOT_FOUND renamed to NOT_FOUND (#733)
  • Align input and output serialization (#746)
  • Remove deprecated httpErrors-helper
  • Remove support for ?input to be an array - now assuming a Record<number, unknown>-style dict (changed with backward compat in #669)
  • Remove support for POST calls being { input: x } (originally from #671)
  • Refactored some internals and removed some unnecessary exports on adapters - minor breaking changes if someone relied on something they shouldn't have :)
  • Stricter ErrorFormatter - data has to be a Record<string, unknown>

Minor changes

  • Expose httpStatus as part of error object as the default error shape
  • httpStatus will be used to determine the actual HTTP Status code set
  • Expose TRPCClientError.data as a shortcut to error.shape.data as that's the only one I find myself using
  • TRPCError we infer in @trpc/react is now TRPCErrorLike and is serialized for SSR in @trpc/next
  • add new method responseMeta() that is triggered before a request ends - both as part of @trpc/next & @trpc/server
    • on @trpc/server receives type, paths, errors, and the unserialized data[] that is going out
    • on @trpc/next it client errors

Thanks to @mmkal, @peterp, @anthonyshort, & @simonedelmann for your feedback!

trpc - V9 Release Candidate

Published by KATT about 3 years ago

trpc -

Published by KATT about 3 years ago

  • @trpc/server - inherit stack trace when resolvers failing (#754)
trpc -

Published by KATT about 3 years ago

  • fix inference of procedures without input (null|undefined rather than unknown) (#697)
trpc -

Published by KATT about 3 years ago

  • HTTP batching is now the default behavior and is opt-out rather than opt-in (#670)
  • splitLink: left/right now aliased as true/false (#689)
  • WebSocket server fix: missing initial msgs if slow createContext-fn (#687)
trpc -

Published by KATT over 3 years ago

add workaround for a superjson issue when serializing an object that originates from Object.create(null) - #680

trpc -

Published by KATT over 3 years ago

  • Batching fix: ability to pass undefined to batch inputs without them being type-casted as null - #669
  • HTTP requests: flatten POST HTTP requests, skip wrapping in input property - #671

Both of the above changes shape of HTTP-requests, but backwards-compatability and tests are added, in case someone uses tRPC as a public API.

Thanks to @simonedelmann for the idea on #669!

trpc -

Published by KATT over 3 years ago

  • fix websocket client edge-case where subscriptions aren't resumed on reconnect (#663)
trpc -

Published by KATT over 3 years ago

improve websockets support (#595)

  • make both dev & prod env for full-stack websocket example
  • subscriptions now auto-resubscribe after disconnect and reconnect signal
trpc -

Published by KATT over 3 years ago

@trpc/react: trpc.useQuery ignores enabled: false during SSR (#622 / #621)

thanks @hypnodron!

trpc -

Published by KATT over 3 years ago

  • @trpc/server fix: combined transformers not transforming errors on server (#620)

thanks to @simonedelmann for finding and fixing the issue 🙏

trpc -

Published by KATT over 3 years ago

  • @trpc/server fix - TRPCError wasn't exported (#606 / #608)
trpc -

Published by KATT over 3 years ago

@trpc/next

  • no functional change - just refactored the internals of withTRPC() a bit
trpc -

Published by KATT over 3 years ago

  • add typings for ssg.fetchQuery / ssg.fetchInfiniteQuery (#585)
trpc -

Published by KATT over 3 years ago

  • Align to JSON-RPC2 (#532)
  • Move transformers to router (#545)
  • delete useLiveQuery - #568
  • delete subscriptions on http
  • remove transformer as part of http handler (previously deprecated) #545 / #571
  • flatten client.fetchOpts - #570
  • withTRPC() refactor - now only accepts 1 argument - #572
  • change http req id to null

Upgrade guide

  • Update all trpc-deps: npx npm-check-updates --filter /@trpc/ -u && yarn
  • Update withTRPC() - see docs
  • Update to use router.transform() over transform in http handlers - docs
trpc -

Published by KATT over 3 years ago

(broken build - please ignore)

trpc -

Published by KATT over 3 years ago

  • add deprecation warning for http handler transform (#561)