trpc_dart 0.3.0
trpc_dart: ^0.3.0 copied to clipboard
Pure Dart runtime for tRPC v11 clients - links, batching, SuperJSON, typed errors, and a state-agnostic query cache.
Changelog #
0.3.0 #
- oRPC transport:
OrpcLinkspeaks the RPCHandler/RPCLink wire — slash-delimited pathname routing,{json, meta}envelopes with oRPC 1.x numeric tags (string tags decoded for 2.x compatibility), GET?data=queries with POST fallback, multipart uploads with indexed file maps, root-file and nested-file multipart responses, headerless binary passthrough, and SSE event-iterator streaming (message/done/error, keepalive comments,last-event-idresume). - Binary primitives:
RpcFile(bytes or streaming sources),RpcTransferProgress(transferredBytes,totalBytes,fraction),RpcByteStream, andonSendProgress/onReceiveProgressonRpcCallContext. Platform-neutral (dart:typed_dataonly); no new dependencies. RpcException.fromOrpcWiremaps ORPCError payloads (defined,code,status,message,data) onto the existing typed hierarchy; additivedefinedfield; non-mapdatapreserved under{'value': data}.RpcJson.asBytes/asFile/asByteStreamzero-cast readers.- tRPC binary convention: superjson
registerCustomannotations['custom', 'Uint8Array'](base64) and['custom', 'File']({name, type, data}), with correct root/nested annotation wrapping. LoggingLink.logPayloadsopt-in summaries viarpcSummarizePayload— binary nodes render as bounded size summaries, never raw bytes.- Fixes:
RpcRequest.withAddedHeaderpreservesidempotencyKey,retryable, and progress callbacks;CancelToken.cancel(reason)exposesreason. - Synchronized v0.3.0 lockstep release.
0.2.0 #
- Real-time subscriptions:
HttpSubscriptionLink(SSE, tRPChttpSubscriptionLink-compatible) andWsSubscriptionLink(multiplexed WebSocket,applyWSSHandler-compatible) with an injectable WebSocket connector. SplitLinkroutes query/mutation to the unary link and subscriptions to a stream link, with custom predicate routing.RpcSubscriptionOptions(lastEventId resume, CancelToken, headers, connectionParams, per-subscription reconnect policy,onEventId,idleTimeout,onReconnect) andRpcReconnectPolicy(exponential backoff + jitter, injectable random).RpcLink.invokeStream/RpcClient.sendStream/RpcClient.subscribe<T>: streaming pipeline with retryable-failure reconnection that re-runs the whole chain per attempt (fresh headers, single-flight auth refresh, latest tracked event id resume). Non-retryable 4xx errors terminate;onReconnect(attempt, error)fires before each scheduled reconnect.HttpSubscriptionLinkidle/heartbeat detection:idleTimeoutaborts and reconnects a silent (half-open) stream, resets on every frame/comment/:ping, and cancels cleanly on unsubscribe; the SSEretry:hint floors the next reconnect delay.WsSubscriptionLinkunwrapstracked()envelopes by the authoritativeresult.id, leaving domain objects that happen to carry{id, data}fields intact.AuthLink,ContextLink, andLoggingLinkgained streaming counterparts with the same semantics as their unary paths.SseParser: spec-compliant chunk-safe SSE frame decoder (UTF-8 mid-codepoint splits, CRLF/LF/CR lines, comments, multi-line data).- SuperJSON encoding gains
Setsupport.
0.1.4 #
- Synchronized v0.1.4 lockstep release; no runtime changes.
0.1.3 #
- Comprehensive package documentation and runnable standalone examples for pub.dev.
- Expanded public API dartdoc coverage to 83%+ and full Dart 3.10 formatting compliance.
- Fixed repository provenance verification in pubspec.yaml for 160/160 pub points.
0.1.2 #
- Idempotent OIDC release pipeline and lockstep v0.1.2 package release.
0.1.1 #
- Align repository metadata and packaging rules for automated OIDC publishing.
0.1.0 #
- Initial release.