Commit Graph

628 Commits

Author SHA1 Message Date
Jacek Sieka 31af0f2bda
v0.5.0 (#230)
* avoid depending on #head
2024-10-29 10:07:21 +01:00
Jacek Sieka 98a5efba4d
Various error handling and processing fixes (#228)
* remove redundant gcsafe/raises
* rework async raises to chronos 4.0 where this was not yet done
* streamline logging between http/socket/ws
  * don't log error when raising exceptions (whoever handles should log)
  * debug-log requests in all variants of server and client
* unify ipv4/ipv6 address resolution, with preference for ipv6
* fix server start so that it consistently raises only when no addresses
could be bound
2024-10-22 21:58:46 +02:00
andri lim 0408795be9
v0.4.4 (#227)
* v0.4.4

* Replace apt-fast with apt-get
2024-10-15 16:59:34 +07:00
metagn a222f44635
fix stylecheck for UInt256 (#226) 2024-10-10 11:57:04 +00:00
tersec be16a6528a
work around Nim 2.0.10 issue (#225)
* work around Nim 2.0.10 issue

* adjust Json/JSON capitalization in tests
2024-10-04 03:50:33 +00:00
Miran 9da5b609bf
update ci.yml to test Nim 2.2; also test gcc-14 (#223) 2024-09-11 12:36:14 +02:00
Juan M Gómez e27c10ad41
Some minimal changes to be able to base the `nimlangserver` in `json_rpc` (#222)
* adds processClientHook

This is useful to shape the request and response to defined protocols (i.e. lsp)

* overloads tryRoute

* apply suggestions

* update test
2024-07-23 17:05:54 +07:00
Miran 8e1cdb1823
update ci.yml and be more explicit in .nimble (#221) 2024-07-01 18:07:28 +02:00
andri lim f40a8ba5c8
Add redefine pragma to inner template (#220) 2024-06-18 23:00:47 +07:00
Kim De Mey ad8721e0f3
Export errors for json-rpc clients (#218)
Errors should get exported considering they are part of the
json-rpc APIs.
2024-03-15 09:05:33 +01:00
Kim De Mey a20ba207d2
Introduce custom application error with optional data object (#216)
This addresses two items:
- Use ApplicationError instead of InvalidRequest for custom
application errors. Avoiding confusing regarding the usage of
InvalidRequest (although the actual error code used could/would
be different).
- Allow for defining an optional data object that gets returned
in the error response, as per json-rpc specification.
2024-03-04 09:19:28 +01:00
Etan Kissling 8682bb6c85
align maximum body size between Websock and HTTP transports (#211)
HTTP has a 128 MB limit, while websock uses the library default (20 MB).
Align both to 128 MB. This should be enough for an Ethereum `getPayload`
with 6 blobs, all hex encoded binary + JSON overhead.
2024-02-20 14:34:20 +01:00
andri lim 9c65df3053
Add build test with chronicles to json enabled (#215)
* Add build test with chronicles to json enabled

* Fix windows failing test
2024-02-19 13:47:40 +07:00
andri lim 514049a287
Fix ws and socket client error handling and add test to #212 (#213) 2024-02-19 08:53:10 +07:00
andri lim 47cfc8916f
Improve batch call example and wrapper comments (#214) 2024-02-19 08:52:10 +07:00
Etan Kissling 171c747584
avoid failing uninitialized `Future` (#212)
In #195, a regression got introduced where an uninitialized `requestFut`
gets `fail()`-ed if the message's `id` cannot be found in pending list.
Revert back to return an `err()` instead, as before.
2024-02-17 09:02:20 +01:00
tersec a7e68ec059
use non-EOL macOS version for GitHub Actions CI (#210) 2024-02-16 17:36:52 +00:00
tersec 20fb49fdd0
test refc in CI in Nim 2.0 and later (#209) 2024-02-14 02:28:29 +00:00
jangko 583b89c264
v0.4.2 2024-02-04 14:52:37 +07:00
andri lim 165e54133d
Add framework to support more optional types (#206)
* Add framework to support more optional types

This PR add a framework to rpc server by using more templates than macros to handle optional types.
Now rpc server recognize both `std/options` and `results.Opt` as optional type for the parameters.
If needed user can add more optional types by overloading `rpc_isOptional` template.
Now aliases to optional types also works.

* Don't expose types used internally by the wrapper
2024-02-02 14:14:37 +07:00
jangko 2157e8980d
Should compile if chronicles log turned on 2024-01-31 16:46:44 +07:00
jangko 95a6f550cd
v0.4.0 2024-01-31 15:10:29 +07:00
jangko 0b8cec3aa8
Implement RPC batch call both in servers and clients 2024-01-31 13:13:41 +07:00
jangko 85d6a67fbc
Move CancelledError handling to outer try/except of RpcWebsocketServer 2024-01-29 10:40:40 +07:00
jangko c5c40af304
HttpAuthHook use async raises 2024-01-27 18:00:02 +07:00
jangko addfc322f5
Revert "Fix CI badge url"
This reverts commit 169b0e7961.
2024-01-27 16:12:41 +07:00
jangko bdc7f36f6d
Upgrade github actions to v4 2024-01-27 14:49:42 +07:00
jangko 169b0e7961
Fix CI badge url 2024-01-27 14:49:28 +07:00
jangko 110c45a333
http server better exception handling 2024-01-27 14:47:24 +07:00
jangko 9c2b36e636
Use pragma push/pop pair to disable warning 2024-01-27 14:39:41 +07:00
jangko 9a34452e23
Refactoring: extract rpc handler from HTTP and WebSocket server 2024-01-25 19:43:00 +07:00
jangko dad0255c71
Client pass meaningful error to newFut when processMessage failed 2024-01-23 12:10:33 +07:00
andri lim 26a6cb1790
Client also handle error message if id is null (#196)
* Client also handle error message if id is null

* Reduce compiler warnings in testethcalls

* Fix gcsafe error
2024-01-21 12:06:18 +07:00
andri lim 8d79d52841
Improve both client and server resilience against fields and elements with null value (#195)
* Improve resilience against null fields

* Fix client processMessage when handling error

* Improve both client and server resilience against fields and elements with null value
2024-01-17 14:10:05 +07:00
jangko b6d068f489
Fix improper yield usage in json-rpc-websocketserver 2024-01-15 10:59:16 +07:00
jangko f90e946b6a
Router.register should not raise exception 2024-01-13 15:36:47 +07:00
jangko 66208055bc
Both http server and client now can handle chunked transfer 2024-01-12 17:05:55 +07:00
jangko 97d19b9583
Add comments in wrapper generator 2024-01-12 08:33:29 +07:00
jangko a6475e49b2
v0.3.0 2024-01-11 21:23:55 +07:00
jangko ab3dd0009b
RPC server handle null return value correctly 2024-01-11 13:57:18 +07:00
jangko 08ceae27e0
Move errors module back to json_rpc folder 2024-01-08 10:37:29 +07:00
jangko c688889c85
Fix example in the README.md 2024-01-07 16:50:33 +07:00
jangko 09d1281a62
Add onProcessMessage hook to client 2024-01-07 16:12:23 +07:00
jangko 20b4c9a0fb
Let the OS choose the port for tests 2024-01-07 15:33:43 +07:00
jangko 31b741720b
Add test for createRpcSigsFromNim and createSingleRpcSig 2024-01-04 20:36:43 +07:00
jangko 2f6a605aa2
Reenable test hhtps 2024-01-04 11:53:15 +07:00
jangko 834de413d9
Rename jrpc_sys module back to jsonmarshal 2024-01-04 11:40:22 +07:00
jangko 014658d1e4
Fix optional parameter parsing fails in rpc macro with generics 2024-01-04 11:17:31 +07:00
kdeme f59e387da2
Add example test case that currently fails the Option parsing 2024-01-04 11:01:49 +07:00
jangko 76dd352ace
Remove StringOfJson 2024-01-04 07:49:19 +07:00