Commit Graph

59 Commits

Author SHA1 Message Date
Greg Johnston 7683420c03 chore: new clippy warnings 2024-03-31 20:59:35 -04:00
Paolo Barbolini 3e18edb8f9
chore: add repository field to server_fn_macro (#2474) 2024-03-31 14:10:47 -04:00
eliza aa3700ffb9
feat: add `impl_from` argument to `#[server]` proc_macro (#2335)
* Add `impl_into` argument

* Add `impl_into` argument

* Revert unneeded changes

* Address review comments

Rename `impl_into` back to be `impl_from`
Rework docstring

* Fix typo in docstring
2024-02-19 21:16:46 -05:00
Marc-Stefan Cassola 23bc892a24
fix: `#[server]` macro error type detection (#2298)
In most cases when you return `Result<..., ServerFnError<E>>` this worked but when you tried
`Result<..., leptos::ServerFnError<E>>` then it didn't.
2024-02-15 20:20:41 -05:00
Greg Johnston 1dbe8b2d4b fix: correct feature name for `server-fn-macro` crate (broken in #2270) 2024-02-09 17:18:44 -05:00
Sam Judelson 1b55227d10
fix: remove unnecessary default features on `axum` in `server_fns` to support running Axum in a WASM environment (#2270) 2024-02-07 11:08:48 -05:00
Greg Johnston 701e3077fb chore: cargo fmt 2024-02-05 06:38:02 -05:00
martin frances 5029b8f315
Chore: Minor, ran ```cargo fmt``` (#2254) 2024-02-03 14:24:12 -08:00
Greg Johnston b367b68a43
fix: use `#[server(default)]` to pass use default values for a field (#2231) 2024-01-26 14:46:31 -05:00
Greg Johnston 1f9dad421f
fix: allow paths to `ServerFnError` type (#2230) 2024-01-26 11:32:43 -08:00
Greg Johnston ca3806e6bc v0.6.0-rc1 2024-01-24 21:35:14 -05:00
Greg Johnston fce2c727ab
feat: add support for custom encodings to `#[server]` macro (#2216) (closes #2210) 2024-01-21 16:14:02 -05:00
Greg Johnston b4a1d90327 clean up for CI 2024-01-20 12:32:51 -05:00
Greg Johnston 46e7abf9ba allow custom req/res/client types 2024-01-19 15:48:14 -05:00
Greg Johnston c5bab09423 partial support for streaming requests (doesn't actually work in the browser) 2024-01-19 14:17:26 -05:00
Greg Johnston c7fac64054 fix merge error 2024-01-19 14:17:25 -05:00
Greg Johnston 35e8e74dcf get rkyv working and work on custom encoding example 2024-01-19 14:16:58 -05:00
Greg Johnston def4be80b2 docs 2024-01-19 14:16:58 -05:00
Greg Johnston 81fb5160e5 missing makefiles 2024-01-19 14:16:58 -05:00
Greg Johnston c7941f7639 clippy 2024-01-19 14:16:58 -05:00
Greg Johnston 61148026d1 allow type paths for input/output, and properly namespace built-in encodings 2024-01-19 14:16:58 -05:00
Greg Johnston be084a5d1d remove list of magic identifiers, use rust-analyzer to help with imports instead 2024-01-19 14:16:18 -05:00
Greg Johnston f5c007df7b use server fns directly in ActionForm and MultiActionForm 2024-01-19 14:16:18 -05:00
Rakshith Ravi a1bd84f3dc feat: add `serde-lite` codec for server functions (#2168) 2024-01-19 14:16:18 -05:00
Rakshith Ravi f6ce82c9d1 Fixed tests for `server_fn` (#2167)
* Fixed server_fn tests

* Changed type_name to TypeId

* Fixed handling of leading slashes for server_fn endpoint
2024-01-19 14:16:18 -05:00
Greg Johnston f6b95e40f4 make sure endpoint names begin with a / 2024-01-19 14:16:18 -05:00
Greg Johnston f53ac1a4ae remove unused var 2024-01-19 14:16:18 -05:00
Greg Johnston 4e3f1c834c handle client-side and server-side redirects correctly (in Axum) 2024-01-19 14:16:18 -05:00
Greg Johnston c8fbee18c8 finished Actix support? 2024-01-19 14:16:17 -05:00
Greg Johnston e1a9856ca9 more Actix work 2024-01-19 14:16:17 -05:00
Greg Johnston db4158f5c3 clear up warnings 2024-01-19 14:16:17 -05:00
Greg Johnston af62d2e900 automatically include server function handler in `.leptos_router()` 2024-01-19 14:16:17 -05:00
Greg Johnston c3e3ce7878 changes to get `todo_app_sqlite_axum` example working 2024-01-19 14:16:17 -05:00
Greg Johnston dd368a845c @ealmloff changes to reexport actix/axum 2024-01-19 14:16:03 -05:00
benwis c7422cd96e First commit, checkpoint for cyclical dependency error 2024-01-19 14:15:51 -05:00
Greg Johnston 3f34d9bb23
fix: doc comments breaking server functions (closes #2190) (#2191) 2024-01-16 15:31:29 -05:00
Greg Johnston 33590d487b
chore: clean up warnings causing CI issues (#2119) 2023-12-18 08:15:46 -05:00
Trey Lowerison ed61ea9dd2
feat: add support for placing attributes on server functions (#2093)
* fix: add support for placing attributes on server functions

Adding instrumentation to server functions is not straightforward (requires calling out to another ssr-only function which is instrumented). This commit adds all attributes on the server function to both the generated front end and back end functions. If those attributes are only desirable on the backend say, a user can always wrap their attribute in `#[cfg_attr(feature = "ssr", ..)]`.

* nit: formatting in example cargo
2023-12-01 15:36:52 -05:00
Gabriel de Perthuis 2c8f46466b
feat: support default values for annotated server_fn arguments with `#[server(default)]` (#1762)
This allows form submission with checkbox inputs to work.
For example:

    let doit = create_server_action::<DoItSFn>();
    <ActionForm action=doit>
      <input type="checkbox" name="is_good" value="true"/>
      <input type="submit"/>
    </ActionForm>

    #[server(DoItSFn, "/api")]
    pub async fn doit(#[server(default)] is_good: bool) -> Result<(), ServerFnError> {}

If is_good is absent in the request to the server API,
`Default::default()` is used instead.
2023-09-20 20:43:20 -04:00
Fangdun Tsai e706a69139
chore(server_fn_macro): improve docs (#1733) 2023-09-18 20:48:47 -04:00
blorbb c87212f2d7
chore: remove (most) syn 1 dependencies (#1670) 2023-09-08 14:46:38 -04:00
Mark Catley 533fccd1d3
fix: nightly warning in server macro for lifetime (#1580)
On the latest lifetime we're getting the following warning in the server
macro:
 warning: `&` without an explicit lifetime name cannot be used here
   --> src/login.rs:19:1
    |
 19 | #[server(Login, "/api")]
    | ^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
    = note: this warning originates in the attribute macro `server` (in Nightly builds, run with -Z macro-backtrace for more info)
2023-08-24 06:30:13 -04:00
Greg Johnston 5e26e84d77
feat: allow feature-name flexibility when using server functions (#1427) 2023-07-25 06:07:52 -04:00
Joseph Cruz 3481a6ee53
build: run tasks from workpace or member directory (#1339) 2023-07-13 16:46:51 -04:00
Greg Johnston e821efca07
chore: new `cargo fmt` (#1266) 2023-07-02 17:01:39 -04:00
Greg Johnston ee7dbafc85
change: migrate to `nightly` and `csr` features rather than `stable` and `default-features = false` (#1227) 2023-06-26 21:12:14 -04:00
Greg Johnston bb10b32200
feat: register server functions automatically (#1154) 2023-06-11 09:09:21 -04:00
Greg Johnston abf90358fa
fix: pass through docs for server functions (#1164) 2023-06-09 16:07:08 -04:00
Vladimir Motylenko 5a71ca797a
feat: RSX parser with recovery after errors, and unquoted text (#1054)
* Feat: Upgrade to new local version of syn-rsx

* chore: Make macro more IDE friendly

1. Add quotation to RawText node.
2. Replace vec! macro with [].to_vec().
Cons:
1. Temporary remove allow(unused_braces) from expressions, to allow completion after dot in rust-analyzer.

* chore: Change dependency from syn-rsx to rstml

* chore: Fix value_to_string usage, pr comments, and fmt.
2023-05-21 06:45:53 -04:00
Ben Wishovich dd41c0586c
feat: allow specifying exact server function paths (#1069) 2023-05-19 16:47:28 -04:00