blocks_runtime 0.2.0
blocks_runtime: ^0.2.0 copied to clipboard
Runtime library for Blocks client SDK — JSON-RPC 2.0 HTTP client, WebSocket realtime, and file transferables.
0.2.0 #
- Breaking for classes that implement or override
BlocksClient:call(String method, Object params)takesObject, notMap<String, dynamic>, so an override must widen its parameter. Callers are unaffected. BlocksClient.callaccepts itsparamsas aList(positional) as well as aMap, and throws anArgumentErrorfor anything else before sending. Generated clients now send a list: an AWS Blocks server reads params by position, so a map that leaves a key out moves the later values up a slot.- A realtime message that fails to decode (a payload the channel's decoder rejects, or a frame that isn't JSON) is now an error on the subscription's stream, which stays open for the next message. It used to be thrown inside the WebSocket listener, where the app could not catch it.
- Add
RealtimeChannel.fromJsonValue, which decodes each message's payload as any JSON value, for channels whose message type isn't an object (such asRealtimeChannel<List<String>>).RealtimeChannel.fromJsonis unchanged. BlocksClientnow POSTs a call to{baseUrl}/{namespace}(for example…/aws-blocks/api/reportsforreports.build) instead of the shared/aws-blocks/api, the same path the TypeScript client uses, so a namespace that runs on its own compute is served by that compute. The JSON-RPC body is unchanged. Deploy the backend with@aws-blocks/core0.8.0 or later before shipping an app built with this version: an older backend serves only/aws-blocks/apiand rejects the per-namespace path.- Add
validateTransferableDescriptor, which checks a descriptor's__blockstag against the tag the spec declared and returns it. - Add
UnknownTransferable, returned for a direct method result whose transferable tag has no known runtime binding, instead of untypeddynamic. - Fix
OidcClient's defaultauthorizeParamsBasePathandcallbackPath: they were/auth/authorize-paramsand/auth/callback, routes no auth block serves. They are now/aws-blocks/auth/authorize-paramsand/aws-blocks/auth/callback(exposed asOidcClient.defaultAuthorizeParamsBasePathandOidcClient.defaultCallbackPath), matching the backend's routes. A client built from a descriptor that names both paths is unchanged. - Add
blocksDeepEqualsandblocksDeepHash, value equality for lists and maps (recursively, with a map's key order ignored). Generated models use them to compare their list and map fields. - Add
toJson()toRealtimeChannel,FileDownloadHandle,FileUploadHandle,OidcClientandUnknownTransferable. It returns the{"__blocks": …}descriptor the value was hydrated from, unchanged (keys this runtime doesn't read included), as a copy. AnOidcClientbuilt with its constructor describes its providers and paths, in the shapeOidcClient.fromJsonreads. Generated clients send a transferable this way when a call passes one back to the server, andjsonEncodecalls it too. - Breaking:
SessionStoregainscookieHeaderFor(Uri)and an optionalrequestUriargument onsetCookies; custom implementations must add both.InMemorySessionStoreandPersistentSessionStorenow parse and enforce theSecure,PathandExpires/Max-Agecookie attributes, matching the Kotlin runtime: a cookie is sent only to the host that set it, only to request paths under itsPath, and, whenSecure, only overhttps/wss.Max-Agetakes precedence overExpires, and a cookie whoseMax-Ageis zero or less, or whoseExpireshas passed, is removed. A cookie with an empty value (name=; Path=/) is also removed rather than stored, as in the Swift runtime. Cookies are keyed by host, path and name rather than by name alone, and a new cookie replaces the same-named cookies that would be sent on that request, as in the Kotlin runtime.cookieHeaderForlists the cookie with the longestPathfirst when several same-named cookies apply.BlocksClientandOidcClientpass the request URL tocookieHeaderFor, and tosetCookiesthe URL of the response, which is the last redirect target when the HTTP client followed redirects.cookieHeaderstill returns every unexpired cookie. PersistentSessionStorenow stores a JSON list of cookie records. The name → value map written by earlier versions is still read: those cookies keepPath=/, noSecureand no expiry, as before, until the server sets them again. That format recorded no host, so until then those cookies are sent to any host; the Swift runtime instead recovers the host from its earlier storage key. This applies only to cookies written before the upgrade and ends once the server sets each cookie again.
0.1.4 #
- Send the
aws-blocks-dartuser-agent token on outbound runtime requests
0.1.3 #
- Minor bug fixes and improvements
0.1.2 #
- Bump dependencies and minimal Dart version
0.1.1 #
- Minor bug fixes and improvements
0.1.0 #
- Initial release