Skip to main content

_firebase_transport_dart 0.1.0 copy "_firebase_transport_dart: ^0.1.0" to clipboard
_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.

  • TransportError is a new sealed family. TransportException, CapExceededException and TokenFetchException extend it (same names, same members), and so does the new sealed SseException. Migration: catch TransportError for "any failure of the package", and switch over it without a default.

  • SseDecoder is a StreamTransformer<List<int>, SseEvent> (response.stream.transform(SseDecoder(...))) instead of a push parser with add and close. SseItem is gone. SseMalformed, SseEventTooLarge and SseStreamTooLarge are now SseExceptions that end the stream as its error, after the events before them; SseMalformed.truncated tells a body that ended inside an event from invalid bytes (it replaces the close() call). Migration: listen to the transformed stream, and handle SseException in onError.

  • RequestTokens.headersFor is takeHeaders (it still works once; the name says it consumes the tokens).

  • RequestTokens.forTesting is removed. Tests use fakeRequestTokens(...) from package:_firebase_transport_dart/testing.dart; the main library no longer carries a test factory.

  • RpcStatus.kebab is firebaseCode, and RpcStatus.code is the gRPC number (0 to 16), so RpcStatus.fromCode(status.code) round-trips.

  • rpcStatusOfFailure maps SseException to RpcStatus.internal (it was unknown when these were not exceptions).

  • The main library lists its exports by owner with explicit show lists. Nothing public is dropped; a new public name in a source file now has to be added to the barrel.

  • SseEvent gets ==, hashCode and toString (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 a redirected refusal (null for the other failures). A sendCapped(acceptNotModified: true) caller gets a 304 Not Modified from the request's origin as a CappedResponse with an empty body; every other 3xx is still refused. sendStreaming's headersDeadline and readCapped's deadline are required Duration?: an explicit null means no deadline, for a caller with its own watchdog, and then a cancel future is required (without one the call throws ArgumentError before it sends or reads). readCapped takes an optional cancel future, which ends the read with TransportFailure.cancelled. An accepted 304 also completes the request's abort future, so its connection is released whatever the client does with the body.

  • sendCapped, sendStreaming and readCapped take redact: 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), isHostLabel and EmulatorHost (rule E). Rule L: a host is loopback only when it is localhost, a 127.x.x.x address or the IPv6 ::1; rule E: an emulator host is host:port and never a production domain.
  • Tokens: TokenSource, RequestTokens and the token rules (rule T: tokens go only to https or wss hosts, which includes production, to the configured emulator, or to a loopback host); one failure rule for Auth and App Check tokens.
  • Headers: FirebaseHeaders, AuthHeaderStyle and the header value checks.
  • Status mapping: RpcStatus and RpcErrorBody.
  • Capped send and read: sendCapped, sendStreaming and readCapped with CappedResponse, TransportException and CapExceededException. A body left before its end has its subscription cancelled (and, in sendCapped and sendStreaming, its request aborted); with IOClient the 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, decodeGuardedText and LogOnce.
  • 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).

0
likes
150
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Internal request helpers shared by the firebase_*_dart packages. Not for application code.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#firebase

License

Apache-2.0 (license)

Dependencies

firebase_app_dart, http, meta

More

Packages that depend on _firebase_transport_dart