Commit Graph

56 Commits

Author SHA1 Message Date
Glen De Cauwsemaecker 7830ea7bae
change rust repo link to monorepo (#855)
also bump version to 0.1.3
and bump alpha version of rama
2025-04-18 17:09:27 -06:00
Glen De Cauwsemaecker 10b29846ae
add rama support to datastar rust sdk (#847)
* add rama support to datastar rust sdk

Closes #845

* bump rama alpha version
2025-04-16 21:05:33 -06:00
Alex Bozhenko a4145207f0
chore: update go modules in go example (#835)
* chore: update go modules in go example

* unbreak tests
2025-04-12 11:42:35 -06:00
Chase Sterling 16fa3cdd90
Python SDK: change `merge_fragments` to take a string rather than list (#822)
* python sdk: change merge_fragments to take a string rather than list

* Change merge_fragments for fasthtml to accept a string rather than list
2025-04-11 13:01:09 -06:00
Ben Croker 9c36bae809
1.0.0-beta.11 2025-03-29 12:15:41 -06:00
Chase Sterling e422bbdecc
Split various python SDK frameworks to different modules (#770)
* Allow passing arguments to the generator function in fastapi sdk

* Allow passing extra headers in FastAPI streaming response

* Keep method signature of upstream FastAPI streaming response

* Split out python sdk frameworks into their own modules
Make all python sdk frameworks mirror the native way of streaming responses

* Rename the sanic helper in python sdk to match sanic convention.
Add some type hinting to sanic helper

* ruff format new python sdk files
2025-03-29 08:05:42 -06:00
Jason Oppel f754ada278
Fix WSGI/ASGI issues in Django Example Project (#787)
* fix: support connection header over WSGI

Per spec, WSGI doesn't allow the connection header:
https://peps.python.org/pep-0333/#other-http-features

This commit works around that limitation and permits the connection
header over a WSGI connection.

* feat: add WSGI views/urls to Django example

* build(py-sdk): add django/datastar_py/daphne pkgs

Other related changes:
* Added "daphne" to INSTALLED_APPS to provide us with an ASGI runserver.
* Changed a setting to make ASGI the default.

* docs: add a README to the example Django project

The docs explain why Django devs should use ASGI and explain how to use
WSGI if needed.
2025-03-28 19:49:13 -06:00
Ben Croker d7fba2787e
1.0.0-beta.10 2025-03-23 10:15:43 -06:00
Peter Humulock 39cb56db3e
Java Example (#577)
* Java Example

* Fixing Java Example

* Fixing Java Example, removing thread.sleep. fixing dependencies
2025-03-15 07:29:33 -06:00
Jérémy 3a561c2faa
Clojure SDK - Ability to gzip sse streams - improvements - new how to code snippet (#747)
* Feature: gzip

Docs: changelog, removed todos
Feature: locking macro for sse generators.
Feature: flowstorm setup
Refactor: the SSE event writing code is now generic
Chore: bumped http-kit version
Feature: new malli schemas + fixes
Docs: adding the how to load more list items doc

* Fix: forgotten closing call

* Docs: fixed text

* Refactor: using write profiles to configure compression and buffering

Docs: modified the docs to reflect the new write profile mechanism
Refactor: changed the malli schema to go with the write profiles

* Feature: better error handling

* Docs: fixed unbalanced brackets / typos

* Docs: fixed example

* Docs: better write profiles docs

* Refactor: consistent namespaced keyword for all option

`:on-open` and `:on-close` options are deprecated

Docs: all callbacks are documented in docstrings
Calling context, return values and exception behavior are documented

* Refactor: using the new callback name everywhere

* Docs: Readme is redone and more docstrings
2025-03-13 09:41:49 -06:00
Johnathan Stevers eb825e2b7d
Zig SDK match new `build.zig.zon` format (#728)
* update build.zig.zon and comment out tk

* update tokamak and add framework option to build.zig

* update readme
2025-03-06 17:38:14 -06:00
Lucian d60f326230
Fix fasthtml simple example (#736) (#737)
* fix(python sdk): fasthtml simple example import from responses

* fasthtml examples: URLs use latest datastar version

Replace versioned CDN URLs with unversioned ones in FastHTML examples to
automatically use the latest Datastar bundle.

* fix(python examples): fasthtml use repo datastar bundles

---------

Co-authored-by: Lucian Knock <git@lucianknock.com>
2025-03-05 09:17:24 -06:00
Ben Croker 978598f52d
Prep for 1.0.0-beta.9 2025-02-28 11:14:22 -06:00
Johnathan Stevers a7df17505f
Update Zig SDK dependencies (#712)
* update deps

* add config to test

* swap to debug allocator

* bump version

* update example deps
2025-02-26 20:05:16 -06:00
Ben Croker 87b200f764
v1.0.0-beta.8 2025-02-25 09:06:18 -06:00
Lucian b85a6b1241
feat(SDK): FastHTML SSE response and example (#576) (#624)
* feat(SDK): FastHTML SSE response and example (#576)

* feat(sdk): add simple fasthtml example

* remove comments

---------

Co-authored-by: Lucian Knock <git@lucianknock.com>
2025-02-19 10:40:30 -06:00
Ben Croker 47afc9e01e
v1.0.0-beta.7 2025-02-14 09:10:45 -06:00
Ben Croker e822f2c416
Prep for v1.0.0-beta.6 2025-02-12 16:37:12 -06:00
Ismael Celis 7c696b15a3
Remove reduntant example (#649) 2025-02-11 18:21:48 -06:00
Ben Croker 31b0c51a76
Prep for beta.5 2025-02-09 17:29:43 -06:00
Johnathan Stevers 6d16a23999
Prepare Zig SDK for standalone repo (#628)
* prepare zig sdk for its own repo

* fix missing opts

* update dependencies

* add option for http1

* update readme
2025-02-08 08:11:49 -06:00
Henry Laxen 18ea30972e
Haskell SDK (#622)
* ready for pull request

* I had the consts_haskell.qtpl in the wrong place

* made changes requested by Ben

* made changes requested by Ben

* fixed license and version in cabal

* more changes per Ben

* renamed dstar.cabal to datastar.cabal

* Update LICENSE

* Rename LICENSE to LICENSE.md

* Update datastar.cabal

---------

Co-authored-by: Ben Croker <57572400+bencroker@users.noreply.github.com>
2025-02-06 17:30:14 -06:00
Ismael Celis 5d46096dc2
Ruby SDK (#600)
* WiP initial setup, ServerSentEventGenerator class

* WiP working merge_fragments in Rails

* #merge_fragments and #merge_signals

* Handle SSE vs Data* options

* Test that #merge_fragments works with a #call(view_context:) interface

* Test Dispatcher#stream

* #remove_fragments

* #remove_signals

* #execute_script

* execute_script with attributes Hash

* Connection: keep-alive

* Use 2 line-breaks as message end, plus last line's 1 line break (3 total)

* Connection callbacks. #on_connect, #on_disconnect, #on_error

* Dispatcher#signals

* Omit retry if using default value (1000)

* Omit defaults

* Multiline scripts

* Test Rack endpoint

* Document test Rack endpoint

* Add missing defaults

* Spawn multiple streams in threads, client_disconnect and server_disconnect handlers

* Move ThreadSpawner to configuration

* Configure a RailsThreadSpawner when Rails detected

* Move Railtie one dir up

* Global error callback

Datastar.config.on_error { |err| Sentry.notify(err) }

* Catch exception from stream threads in main thread

* Linearlize exception handling

* Refactor dispatcher to handle single stream in main thread, multi streams in separate threads

* spawner => executor. Rails Async executor using fibers.

* Support Async for fiber-based concurrency

* Finalize response for Rack and Rails

* test Rack app

* Threaded demo

* Test Dispatcher#sse?

Also do not check for SSE Accept on stream.
Leave it up to the user.

* Do not check Accept header in test app. Test scripts don't send it properly.

* Document code

* Example progress bar Rack app

* README

* Link to D* SSE docs

* See examples

* Document callbacks

* List Ruby SDK in SDKs.md

* Ruby struct in consts.go

* Document running tasks with arguments via Docker

* Code-gen Ruby constants from shared data via template

* Make test rely on constants

* Datastar.from_rack_env(env) => Datastar::Dispatcher

* Ruby example snippets

* #redirect(location)

* Ruby snippet using #redirect(new_path)

* Add X-Accel-Buffering: no header

To disable response buffering by NGinx and other proxies.

* Clarify linearisation of updates in Readme

* Tidy-up progress example

* Move examples to /examples/ruby

* Document Rails and Phlex

* Version 1.0.0.beta.1

* Version 1.0.0.beta.1

* Do not set Connection header if not HTTP/1.1

* Don't touch BUILDING.md docs in this PR

* Remove Changelog for now

* Sort Ruby alphabetically (just "ruby", not the entire line)

* Add hello world example, remove progress bar one.

* Add hello-world example to code-gen

* Typos
2025-02-05 12:02:18 -06:00
Roman Frołow 5a4b4d699e
Accomodate Zig SDK and examples to test runner changes (#601)
* update zig to work on master

* Updated deps, fixed to use tests.zig as root, add datastar as module, refactoring

* Update test_runner.zig. Move tests to root.zig.

* tokamak: use post0 when no body
2025-02-05 09:39:00 -06:00
JeremS 65a301da9e
Fixing issue #571 / minor changes, improvements (#590)
* Refactor: Ring jetty adapter is now a generic ring adapter

Minor changes:

- Properly eliding SSE retry duration
- Added a small utility in the main api.
- Added a new option to the ->sse-response functions to support
  modifying the HTTP response status.
- Fixed typos and errors in the docs.
- using consts version number.
- Prepared tests for rj9a
- Properly killing webrivers when shutting down tests

* Docs: fixing the fixed typo
2025-02-04 08:15:06 -06:00
Greg H 9b61ee4f67
sdk/dotnet model binding (#574)
* sdk/dotnet - more renaming, doco, and code shortening; caching of signals

* sdk/dotnet - added model binding

* sdk/dotnet-model_binding - FromSignals behaves more like other From* attributes

---------

Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
2025-02-03 17:55:05 -06:00
Ben Croker cbbb640533
Fix URLs [deploy-site] 2025-02-03 08:29:15 -06:00
Johnathan Stevers 93852fc1ad
Rust SDK framework integration + hello-world examples (#558)
* remove infinite scroll example

* add rocket and axum example

* rework how framework integration works

* rocket integration

* add .gitignore

* dont elide `retry`

* add "read signals" to rocket hello-world example

* don't elide `retry` in display

* remove mime dependency

* update cargo.toml

* add underscore to unused consts

* formatting

* use `async_stream` instead of "hand writing" streams

* add axum test

* fix errors

* implement custom sse stream for axum and rocket

* generate hello-world.html

* update readme

* don't track cargo.lock
2025-02-02 18:14:20 -06:00
Ben Croker c25cbec470
Update CDN links 2025-02-01 08:41:17 -06:00
Greg H 34556125ae
Sdk/dotnet updates (#560)
* sdk/dotnet-cleanup - removed all non-standard example and library code for dotnet

* sdk/dotnet - signals are request-based; missing trailing newline added; refactoring

* sdk/dotnet-cleanup - documentation updates

* sdk/dotnet-bugfix - no longer starting streaming response if only accessing signals

---------

Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
2025-01-31 11:27:16 -06:00
Ben Croker 65a84c6602
PHP SDK 1.0.0-beta.8 2025-01-31 09:38:32 -06:00
JeremS 1e55dcf6d5
Clojure SDK (#540)
* Feature: added clojure sdk

Chore: rebasing on latest
(last commit from clojure-sdk d6259824908c)

* Fix: alphabetical order

* Docs: Actual broadcast example

* Test: adding shell test support

Fix: order of options in data-lines for execute scripts events

Fix: fixed signal handling / missing options

Refactor: using the generated constants for boolean options

* Test: passing shell tests

Chore: task build
2025-01-29 16:28:08 -06:00
Ben Croker 50472e2782
Update examples 2025-01-28 20:50:58 -06:00
Greg H 39a93a4d50
example/dotnet-hello_world (#542)
Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
Co-authored-by: Ben Croker <57572400+bencroker@users.noreply.github.com>
2025-01-28 15:55:23 -06:00
Johnathan Stevers afa6e930fa
Fix incorrect hello-world example path for zig tokamak example (#548) 2025-01-28 15:51:48 -06:00
Johnathan Stevers a9cfaf8a78
Zig SDK framework integration + hello-world examples (#546)
* zig sdk framework integration

* hello-world examples

* update code snippets

* fix readme typo

* fix run.go path

* generated `hello-world.html`
2025-01-28 12:48:06 -06:00
Ben Croker 820f1795fa
Update hello world image 2025-01-28 10:12:53 -06:00
Ben Croker 4708c24da0
Fix hello world source 2025-01-28 08:12:42 -06:00
Ben Croker ee5150fa4e
Add hello world HTML to the build process 2025-01-27 16:31:05 -06:00
Delaney 7036bffb0f
add go hello-world example (#536)
Fixes #535
2025-01-27 15:41:53 -06:00
Ben Croker 4bafc8b250
Add Hello World PHP example 2025-01-27 12:01:25 -06:00
Johnathan Stevers 081178321f
Rust SDK (#520)
* rust sdk

* add settle duration an use view transition to `RemoveFragments`

* replace `std::time::Duration` with `core::time::Duration`

* add `settle_duration` and `use_view_transition` setters to `RemoveFragments`

* remove `workspace` from `Cargo.toml`

* update `Cargo.lock`

* align documentation with official documentation

* change description

* use consts

* fix typo in `consts.go`

* code snippets

* add semi colons to bool consts

* fix example

* always include `retry_duration` in event body

* fix typo

* add extra newline to every event

* remove unnecessary `.as_ref()`

* remove `datastar-request: true` validation from `ReadSignals`

* add retry and extra newline to doc tests

* add tests and update package files
2025-01-25 16:25:48 -06:00
Greg H 48151b593c
sdk/dotnet - corrections to doco. fixed sample. keep-alive only if 1.1 (#496)
Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
2025-01-18 10:08:24 -06:00
Felix Ingram 3c6c29f3b9
SDK for python (#250) 2025-01-05 10:35:33 -06:00
Ben Croker 182765419c
Update CDN URLs [deploy-site] 2025-01-03 21:25:44 -06:00
Ben Croker dfb650011c
More docs fixes 2025-01-02 07:28:18 -06:00
Ben Croker bcf016b538
Fix docs, examples and error messages 2025-01-01 20:33:23 -06:00
Delaney abff1d05de
Can `.value` go away? (#429)
* Can .value be removed?
Fixes #428

* get dialog working

* add } to terminators

* Add fujs.svg

* whackamole

* sigh

* recursive regex tag template literals, lol

* Regex example

* (jacks|lack|of|complete|surprise)

* persist fixed

* fix current regex example

* current state

* Update all examples

* regex version of signals, actions and escapement

* Fix Go examples

* fix templates

* Add `@` to actions in examples

* Revert `.Value`

* frontpage

* all test pass

* move to @get/post/put/patch/delete

* Fix up docs and examples

* Add true client size to readme

* Add v1.0.0-beta.1 release notes

* @ → $

* Add space

* Fix more docs and examples

* missed files in merge

---------

Co-authored-by: Ben Croker <ben@putyourlightson.com>
2025-01-01 12:02:26 -06:00
Tom D. cac77adf27
refactor(java-sdk): Rewrite the Java SDK (#430)
- Rewrite the entire API to leverage JDK 17 features and implement a fluent API design.
- Updated the minimal JDK version requirement to 17.
- Temporarily removed examples as they are not yet aligned with the new API.

BREAKING CHANGE: The API has been completely redesigned and requires JDK 17 or higher.
BREAKING CHANGE: Previous examples and usages are no longer compatible.
2024-12-29 15:43:32 -06:00
Greg H 30e47767a5
sdk/dotnet nuget (#372)
* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* On workflow_dispatch

* Use GITHUB_TOKEN

* Replace variables

* sdk/dotnet-nuget

* sdk/dotnet-nuget

* sdk/dotnet-nuget - README updates

---------

Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
Co-authored-by: Ben Croker <57572400+bencroker@users.noreply.github.com>
2024-12-23 12:39:25 -06:00