Commit Graph

919 Commits

Author SHA1 Message Date
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
Ben Croker ca5414c358
Stop kebabizing class (#611) 2025-02-05 10:02:10 -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
zangster300 bc21b05164
switching tests back to one web server, many pages (#609) 2025-02-05 08:53:24 -06:00
Ben Croker d3b50bc3a9
Fix TypeScript snippets (#597)
* Fix snippets

* Use proper casing
2025-02-05 07:10:04 -06:00
Patrick Marchand 7a994bdff3
Add Accept: text/event-stream to bash tests (#607)
Datastar responses are also valid SSE responses, and the D* client already sends `Accept: text/event-stream` to the server, so tests should replicate that.

Some servers might rely on this for content negotiation.

Co-authored-by: Ismael Celis <ismaelct@gmail.com>
2025-02-04 16:41:41 -06:00
Patrick Marchand 1d74d2328a
Sdk ts web improvements (#551)
* sdk/typescript add support for ResponseInit in web stream method

This allows setting custom headers

* sdk/ts elide datalines with default values

* sdk/ts run deno fmt

* sdk/typescript deno lint

* sdk/typescript better error handling for streams

* sdk/typescript improve deno request abortion support and async completion

* sdk/typescript fix type error in error usage
2025-02-04 16:39:41 -06:00
Ben Croker 552c55939d
Dispatch `RETRYING` SSE event (#585) 2025-02-04 15:41:10 -06:00
Ben Croker 437f8bcf53
Add release note 2025-02-04 15:14:07 -06:00
Ben Croker 0c33439fa6
Restructuring 2025-02-04 12:32:42 -06:00
Ben Croker b4a11683fb
Add `run.go` 2025-02-04 12:31:21 -06:00
Ben Croker 71b95c8949
Wording 2025-02-04 12:28:29 -06:00
Ben Croker 0975e24224
Improve wording 2025-02-04 12:25:06 -06:00
Ben Croker b00c6d160e
Add SDK Contribution Guidelines [deploy-site] 2025-02-04 12:19:08 -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
Johnathan Stevers bca69f6a57
rust and zig snippets (#594) 2025-02-04 08:05:43 -06:00
Ben Croker ff52c94fb5
Improve SDKs [deploy-site] 2025-02-04 08:02:14 -06:00
Greg H 41198f3479
sdk/dotnet-nuget_version (#589)
* sdk/dotnet-nuget_version - updated the nuget version to 1.0.0-beta.3

* sdk/dotnet-nuget_version - updated the nuget version to 1.0.0-beta.1

---------

Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
2025-02-03 20:31:19 -06:00
Greg H 77700d2e2f
task/dotnet-howtos - added polling and redirect howtos #517 (#591)
Co-authored-by: Greg Holden <SpiralOSS@users.noreply.github.com>
2025-02-03 19:28:02 -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
Johnathan Stevers 284c42d981
Fix typo in how_to_bind_keydown_events_to_specific_keys.md (#586)
Changes `whenver` -> `whenever`
2025-02-03 14:01:09 -06:00
Josh 6b726a340e
Add search to the website (#522)
* add description to the markdownRenders func

* add /api/search using bleve

* wrap search functionality in a basic feature flag

* remove some comments that are not needed

* add desktop styling for search

* undo add feature flag

* mobile styling

* fix: merge correct fragment

* fix: menu item being cut off on mobile

* Add keyboard shortcut to add focus

* fix: loading indicator jank

* Styling tweaks

* remove un-neccessary ids

* Update site.css

---------

Co-authored-by: Ben Croker <57572400+bencroker@users.noreply.github.com>
2025-02-03 10:10:33 -06:00
Delaney 9901ae7f4d
Attribute Order issue (#582)
Fixes #580 by adding alias to hash
2025-02-03 09:43:46 -06:00
Ben Croker fe409baf4c
How-to Guides (#517)
* Add polling

* Rename file

* Add `how_to_redirect_the_page_from_the_backend`

* Add Hello World example guide

* Add to nav, start on polling

* Remove `.leading` from code snippets

* Fix typo

* How to bind keydown events to specific keys

* How to redirect from the backend (#565)

* Add how tos with demos

* Fixes

* Fixes

* Add snippets

* Rename to location in snippet

* Wording

* Tweaks

* Prep for merging

* Improve wording

---------

Co-authored-by: Dominik Tarnowski <dom@tdom.dev>
2025-02-03 08:39:38 -06:00
Ben Croker cbbb640533
Fix URLs [deploy-site] 2025-02-03 08:29:15 -06:00
Ismael Celis 97c0760a48
Make SDK tests use bash exit instead of return (#579)
* Use exit instead of return in bash scripts

Return is to return from functions, not scripts.

* Test scripts: exit 1 y files differ
2025-02-03 07:16:49 -06:00
Johnathan Stevers 1d8105af11
elide retry if default (#578) 2025-02-02 21:19:32 -06:00
Lucian 38c0547dfa
Fix overflow issues and add menus (#567) (#575)
* mobile: fix overflow issues (#567)

* add dropdown

---------

Co-authored-by: Lucian Knock <git@lucianknock.com>
Co-authored-by: Delaney Gillilan <delaneygillilan@gmail.com>
2025-02-02 20:51:43 -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 539152a127
Fix SDK formatting 2025-02-02 12:12:09 -06:00
Ben Croker ed980b3d4c
Update SDKs to ignore `retry` if set to default (#573)
* Update SDKs to ignore `retry` if set to default

* Remove from test output

* Build
2025-02-02 11:31:39 -06:00
Prateek Rungta 854ce6ed30
Fix missing `}` (#569) 2025-02-02 07:35:00 -06:00
Ben Croker 16161d8309
Update PHP SDK 2025-02-01 19:49:59 -06:00
Ben Croker 652fd1e130
Improve redirects in SDKs 2025-02-01 18:54:50 -06:00
Ben Croker 2ee3ad21a4
Update JetBrains plugin 2025-02-01 10:15:53 -06:00
Ben Croker 9b2d620499
Remove danglish URI [deploy-site] 2025-02-01 09:53:43 -06:00
Ben Croker dbff015dc9
Update again 2025-02-01 09:28:16 -06:00
Ben Croker fb8325c583
Update VSCode extension 2025-02-01 09:21:01 -06:00
Delaney Gillilan 3f95087783
fix ts pub task 2025-02-01 08:55:29 -06:00
Ben Croker eb8b3b1c5b
Clear out changelog 2025-02-01 08:54:58 -06:00
Ben Croker c25cbec470
Update CDN links 2025-02-01 08:41:17 -06:00
Ben Croker 701370246f
Prep for 1.0.0-beta.3 2025-02-01 08:35:20 -06:00
Ben Croker d7b527f39e
Add release notes 2025-01-31 20:12:24 -06:00
Delaney 51671c666d
Bundler aliasing (#555)
* Bundler aliasing
Fixes #554

* Bundler aliasing
Fixes #554

* Add release note

* Improve alias prefix handling

* Check using `startsWith`

* Use raw key in removals

* Update JavaScript API docs

* Add aliased bundle

* Fix example

* Fix wording

* Fix logic

* skip flaky tests

* Fix and simplify logic

* Rewrite condition

---------

Co-authored-by: Ben Croker <ben@putyourlightson.com>
2025-01-31 20:03:53 -06:00
Ben Croker a5c2e8624b
Add missing runtime errors 2025-01-31 19:59:06 -06:00
Ben Croker 31d2080741
Merge branch 'develop' of https://github.com/starfederation/datastar into develop 2025-01-31 19:05:34 -06:00
Ben Croker 93e8e1405c
Fix example 2025-01-31 18:04:05 -06:00
Ismael Celis e5ccf1242d
Use `retry` in SSE output examples instead of `retryDuration` (#561)
The SDKs expect `retryDuration` as an option, but it maps to `retry` in the SSE output.
2025-01-31 18:00:58 -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 62fe77741b
Library legacy code cleanup (#559)
* Remove unused function

* Remove `version.ts`

* Remove version from build process
2025-01-31 09:56:56 -06:00