_firebase_transport_dart 0.1.0
_firebase_transport_dart: ^0.1.0 copied to clipboard
Internal request helpers shared by the firebase_*_dart packages. Not for application code.
Unreleased #
Breaking (unreleased API) #
The package was never published, so these changes have no deprecation path; the callers in this repository are updated.
-
TransportErroris a new sealed family.TransportException,CapExceededExceptionandTokenFetchExceptionextend it (same names, same members), and so does the new sealedSseException. Migration: catchTransportErrorfor "any failure of the package", andswitchover it without a default. -
SseDecoderis aStreamTransformer<List<int>, SseEvent>(response.stream.transform(SseDecoder(...))) instead of a push parser withaddandclose.SseItemis gone.SseMalformed,SseEventTooLargeandSseStreamTooLargeare nowSseExceptions that end the stream as its error, after the events before them;SseMalformed.truncatedtells a body that ended inside an event from invalid bytes (it replaces theclose()call). Migration: listen to the transformed stream, and handleSseExceptioninonError. -
RequestTokens.headersForistakeHeaders(it still works once; the name says it consumes the tokens). -
RequestTokens.forTestingis removed. Tests usefakeRequestTokens(...)frompackage:_firebase_transport_dart/testing.dart; the main library no longer carries a test factory. -
RpcStatus.kebabisfirebaseCode, andRpcStatus.codeis the gRPC number (0 to 16), soRpcStatus.fromCode(status.code)round-trips. -
rpcStatusOfFailuremapsSseExceptiontoRpcStatus.internal(it wasunknownwhen these were not exceptions). -
The main library lists its exports by owner with explicit
showlists. Nothing public is dropped; a new public name in a source file now has to be added to the barrel. -
SseEventgets==,hashCodeandtoString(the data is left out of the text). -
RequestTokens.withoutAuth(): the same tokens without the Auth token, for an attempt that must go out for no user; the original counts as used. -
TransportException.statusCode: the HTTP status of aredirectedrefusal (null for the other failures). AsendCapped(acceptNotModified: true)caller gets a 304 Not Modified from the request's origin as aCappedResponsewith an empty body; every other 3xx is still refused.sendStreaming'sheadersDeadlineandreadCapped'sdeadlinearerequired Duration?: an explicit null means no deadline, for a caller with its own watchdog, and then acancelfuture is required (without one the call throwsArgumentErrorbefore it sends or reads).readCappedtakes an optionalcancelfuture, which ends the read withTransportFailure.cancelled. An accepted 304 also completes the request's abort future, so its connection is released whatever the client does with the body. -
sendCapped,sendStreamingandreadCappedtakeredact: values the request carries outside its URL query and headers (an id in a path segment, a field of the body) that are redacted from a client error's detail too, as written and percent-decoded, when they have four characters or more. Before, a message that quoted only such a value kept it.
0.1.0 #
First version. Internal request helpers shared by the firebase_*_dart packages of this repository. Not for
application code.
- Hosts:
isLoopbackHost(rule L),isHostLabelandEmulatorHost(rule E). Rule L: a host is loopback only when it islocalhost, a127.x.x.xaddress or the IPv6::1; rule E: an emulator host ishost:portand never a production domain. - Tokens:
TokenSource,RequestTokensand the token rules (rule T: tokens go only tohttpsorwsshosts, which includes production, to the configured emulator, or to a loopback host); one failure rule for Auth and App Check tokens. - Headers:
FirebaseHeaders,AuthHeaderStyleand the header value checks. - Status mapping:
RpcStatusandRpcErrorBody. - Capped send and read:
sendCapped,sendStreamingandreadCappedwithCappedResponse,TransportExceptionandCapExceededException. A body left before its end has its subscription cancelled (and, insendCappedandsendStreaming, its request aborted); withIOClientthe connection then closes, which a test against a server sending without end checks. - Bounded numbers, a JSON depth guard and a one-time log:
parseBoundedInt,decodeGuardedBytes,decodeGuardedTextandLogOnce. - Server-sent events:
SseDecoder.
Limits: the package does not resolve names, a provider that returns its session token as a limited-use token cannot be detected, tokens sent to an emulator travel in clear text, and each limited-use token costs one mint per attempt (see the README).