Fixed the scm info that goes in pom.xml
files.
This release is mostly centered around documentation and cljdoc compatibility.
deps.edn
doc
directoryThe public API has seen it's main functions renamed following the new SDK ADR. Several functions have been renamed or removed:
Old | new |
---|---|
merge-fragment! | patch-elements! |
merge-fragments! | patch-elements-seq! |
remove-fragments! | remove-element! |
merge-signals! | patch-signals! |
remove-signals | removed |
All the examples and snippets have been updated following the ADR changes.
clj-kondo.exports/starfederation.datastar.clojure/sdk
directory. This change
allows for other projects to use
starfederation.datastar.clojure/XXXX/config.edn
for their clj-kondo config.->sse-response
is running, the on-open
callback runs
just after. For instance that any middleware that would add headers after the
execution of the ->sse-response
function won't work, the initial response
being already sent.
The new starfederation.datastar.clojure.adapter.http-kit2
API changes this behavior. In this new api the initial response is not sent
during ->sse-response
. Instead a middleware takes care of sending it and
only then calls the on-open
callback. If this middleware is the last to run
on the return any addition to the response map will be taken into account.on-open
) in the adapter namespaces were not
properly recognized by Clj-kondo. This generated unresolved var
warnings. A
specific Clj-kondo config has been added to fix these warnings.Connection keep-alive
HTTP header has been changed. The header is now
properly added for versions older than HTTP/1.1
.1.13.0
to 1.14.1
. This encourages users
to use Jetty 12 when using ring jetty adapter.:on-open
and :on-close
keywords. The
->sse-response
functions of both adapters will not use them anymore. The
corresponding docstrings are updated.:on-open
and :on-close
keywords for the ->sse-response
function is deprecated and will be removed in a future release.
See ->sse-response
's docstring.starfederation.datastar.clojure.api/lock-sse!
. This is a macro allowing
its body to be protected by a SSE generator's lock.IOException
is thrown sending an event, adapters will close
themselves. Other exceptions are rethrown. When trying to close an already
closed SSE generator, the close-sse!
function just returns false
.
Previously the ring adapter was potentially throwing in that case.
Also the on-close
callback can be called at most once.
Both adapters behave similarly when it comes to errors.starfederation.datastar.clojure.api.sse
namespace
makes it a generic SSE event formatter.
starfederation.datastar.clojure.sse/write-event!
is now Datastar agnosticstarfederation.datastar.clojure.sse/headers
is now a generic function
to make HTTP headers containing the SSE specific ones.2.9.0-alpha2
-> 2.9.0-alpha4
starfederation.datastar.clojure.adapter.test/->sse-response
. This is a mock
for a SSE ring response that records the SSE events sent with it.:on-close
callback using http-kit)starfederation.datastar.clojure.api/redirect!
helper function uses a js
timeout for redirection[!important] This change comes with these breaking changes:
- The
adapter-jetty
directory has been renamedadapter-ring
, this mean a change in yourdeps.edn
. Check the readme.- The
starfederation.datastar.clojure.adapter.ring-jetty
has been moved tostarfederation.datastar.clojure.adapter.ring
->sse-response
functions from the adapters now have the option to
modify the HTTP response status code. It is useful when wanting to return
204 responses for instance.Can you improve this documentation? These fine people already did:
Jérémy, Jeremy Schoffen & JeremSEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
Ctrl+k | Jump to recent docs |
← | Move to previous article |
→ | Move to next article |
Ctrl+/ | Jump to the search field |