Releases: netlogix/Netlogix.JsonApiOrg.Consumer
5.0.1 - Publish testing instance of ConsumerBackend to ObjectManager
The ConsumerBackend is a singleton. Creating a new instance while testing
only works if no included relations are involved. Otherwise, the relation
gets fetched by another instance with no shared resource cache. Obviously,
the correct way is to make the testing object known to the object manager.
5.0.0 - Async endpoint discovery, configurable endpoint cache & improved Type/URI handling
Breaking changes
- Endpoint discovery registration is now asynchronous:
registerEndpointsByEndpointDiscovery()returns aPromiseInterface. - The
Typeclass has been refactored (factory creation and multi-endpoint URI handling).
Code that instantiatesTypedirectly or manages type URIs may require changes.
New features
- Added
requestByTypeAndFilter()to perform asynchronous requests for type/filter queries. - Added request-scoped helpers:
withSparseFields()for JSON:API sparse fieldsets (fields[type]=...)withHeaders()to temporarily apply additional request headers
Bug fixes
- JSON decoding errors now throw
JsonExceptionwith additional context, including the request URI and raw response body, making invalid API responses easier to diagnose. - Added a validation check to ensure a
Typehas a URI configured before building query URLs, preventing obscure runtime errors when querying misconfigured types.
Improvements
- Endpoint discovery cache middleware is now configurable:
- Restrict caching to specific HTTP methods
- Control which request headers are included in the cache key
- Improved endpoint matching logic for discovery requests.
4.4.0 - Map response error status codes to specific exception classes
Guzzle throws generic ClientException instances for HTTP 4xx
responses and generic ServerException instances for HTTP 5xx
responses.
In some cases, the consuming application may need to handle
errors differently depending on the exact status code. For
example, responses with status code 504 ("Gateway Timeout")
often occur when a web server closes the client connection
before the application server finishes processing. In such
cases, retrying the request might succeed, especially if
the initial request primed relevant caches.
To allow for fine-grained error handling using try/catch
blocks, individual status codes are now mapped to dedicated
exception classes.
4.3.1 - Handling of no-store was flipped
The internal state variable of $storeResponse was calculated
correctly, but the response got stored to cache when
$storeResponse===false.
4.3.0 - Prevent in-memory storing when "Cache-Control: no-store" is used as request header
Feature:
The request mechanism now prevents the "request cache" (as described
in the next section below) to be used at all.
Just add the HTTP request header "Cache-Control: no-store" to the
request.
Precondition 1:
There are two different caches: The request cache and the response cache.
The respones cache can utilize the response data, which allows for tagging
cache entries and hence fine grained retention calculation, so the request
cache can be used across different PHP processes and potentially across
different users.
The request cache can only utlize what's known before the request was
made. We usually use a transient memory cache for requests. This allows
a single PHP process to issue the same GET request multiple times without
needing to flush anything, because the cache content gets dropped as soon
as the PHP process is over.
Precondition 2:
Requests not only transport their URI but an array of request heraders
as well. Those request headers are meant to pass to the upstream server.
Usually, request headers are part of the response cache header, so
different request header values might cause cache misses e.g. for
basic auth.
4.2.1 - Don't throw on cache errors
4.2.0 - Fix PHP 8 Deprecations
Introduce parallel fetch requests
- Add multi guzzle based client
- Introduce
ConsumerBackend::requestFromUri(): PromiseInterface - Switch internals from
ConsumerBackendto make use ofrequestFromUri()
4.0.1 - Adjust method signature for null uris
What's Changed
Full Changelog: 4.0.0...4.0.1
4.0.0 - Flow 8.3 Requirement
What's Changed
- Build(deps): Bump actions/cache from 3 to 4 by @dependabot in #18
- feat: Require Flow 8.3 by @paxuclus in #19
Full Changelog: 3.1.4...4.0.0