mirror of
https://github.com/logos-storage/nim-json-rpc.git
synced 2026-01-07 16:13:07 +00:00
simplify imports (#98)
remove broken uint64 converter - upstream std/json also includes a broken uint64 converter
This commit is contained in:
parent
ac5288651c
commit
64d40d6c1a
@ -6,7 +6,7 @@ license = "Apache License 2.0"
|
|||||||
skipDirs = @["tests"]
|
skipDirs = @["tests"]
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
requires "nim >= 0.17.3",
|
requires "nim >= 1.2.0",
|
||||||
"nimcrypto",
|
"nimcrypto",
|
||||||
"stint",
|
"stint",
|
||||||
"chronos",
|
"chronos",
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import
|
import
|
||||||
std/[tables, json, macros],
|
std/[tables, macros],
|
||||||
chronos,
|
chronos,
|
||||||
./jsonmarshal
|
./jsonmarshal
|
||||||
|
|
||||||
from strutils import toLowerAscii, replace
|
from strutils import toLowerAscii, replace
|
||||||
|
|
||||||
export
|
export
|
||||||
chronos, json, tables
|
chronos, jsonmarshal, tables
|
||||||
|
|
||||||
type
|
type
|
||||||
ClientId* = int64
|
ClientId* = int64
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import
|
import
|
||||||
std/[json, strutils, tables, uri],
|
std/[strutils, tables, uri],
|
||||||
stew/byteutils,
|
stew/byteutils,
|
||||||
chronicles, httputils, chronos, json_serialization/std/net,
|
chronicles, httputils, json_serialization/std/net,
|
||||||
../client
|
../client
|
||||||
|
|
||||||
|
export client
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "JSONRPC-HTTP-CLIENT"
|
topics = "JSONRPC-HTTP-CLIENT"
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
import
|
import
|
||||||
std/[json, tables],
|
std/tables,
|
||||||
../client, chronos
|
chronos,
|
||||||
|
../client
|
||||||
|
|
||||||
|
export client
|
||||||
|
|
||||||
type
|
type
|
||||||
RpcSocketClient* = ref object of RpcClient
|
RpcSocketClient* = ref object of RpcClient
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
import
|
import
|
||||||
std/[json, strtabs, tables],
|
std/[strtabs, tables],
|
||||||
../client, chronos
|
chronos,
|
||||||
|
../client
|
||||||
|
|
||||||
|
export client
|
||||||
|
|
||||||
const newsUseChronos = true
|
const newsUseChronos = true
|
||||||
include news
|
include news
|
||||||
|
|||||||
@ -2,16 +2,12 @@ import
|
|||||||
std/[macros, json, options, typetraits],
|
std/[macros, json, options, typetraits],
|
||||||
stew/byteutils
|
stew/byteutils
|
||||||
|
|
||||||
export json
|
export json, options
|
||||||
|
|
||||||
proc expect*(actual, expected: JsonNodeKind, argName: string) =
|
proc expect*(actual, expected: JsonNodeKind, argName: string) =
|
||||||
if actual != expected: raise newException(ValueError, "Parameter [" & argName & "] expected " & $expected & " but got " & $actual)
|
if actual != expected:
|
||||||
|
raise newException(
|
||||||
proc `%`*(n: byte{not lit}): JsonNode =
|
ValueError, "Parameter [" & argName & "] expected " & $expected & " but got " & $actual)
|
||||||
newJInt(int(n))
|
|
||||||
|
|
||||||
proc `%`*(n: uint64{not lit}): JsonNode =
|
|
||||||
newJInt(int(n))
|
|
||||||
|
|
||||||
proc `%`*(n: ref SomeInteger): JsonNode =
|
proc `%`*(n: ref SomeInteger): JsonNode =
|
||||||
if n.isNil:
|
if n.isNil:
|
||||||
@ -19,13 +15,6 @@ proc `%`*(n: ref SomeInteger): JsonNode =
|
|||||||
else:
|
else:
|
||||||
newJInt(n[])
|
newJInt(n[])
|
||||||
|
|
||||||
when (NimMajor, NimMinor, NimPatch) < (0, 19, 9):
|
|
||||||
proc `%`*[T](option: Option[T]): JsonNode =
|
|
||||||
if option.isSome:
|
|
||||||
`%`(option.get)
|
|
||||||
else:
|
|
||||||
newJNull()
|
|
||||||
|
|
||||||
# Compiler requires forward decl when processing out of module
|
# Compiler requires forward decl when processing out of module
|
||||||
proc fromJson*(n: JsonNode, argName: string, result: var bool)
|
proc fromJson*(n: JsonNode, argName: string, result: var bool)
|
||||||
proc fromJson*(n: JsonNode, argName: string, result: var int)
|
proc fromJson*(n: JsonNode, argName: string, result: var int)
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import
|
import
|
||||||
std/[json, macros, options, strutils, tables],
|
std/[macros, options, strutils, tables],
|
||||||
chronicles, chronos, json_serialization/writer,
|
chronicles, chronos, json_serialization/writer,
|
||||||
./jsonmarshal
|
./jsonmarshal
|
||||||
|
|
||||||
export
|
export
|
||||||
chronos, json, jsonmarshal
|
chronos, jsonmarshal
|
||||||
|
|
||||||
type
|
type
|
||||||
StringOfJson* = JsonString
|
StringOfJson* = JsonString
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import
|
import
|
||||||
std/[json, macros],
|
chronos,
|
||||||
chronos, chronicles,
|
|
||||||
./router,
|
./router,
|
||||||
./jsonmarshal
|
./jsonmarshal
|
||||||
|
|
||||||
export chronos, json, jsonmarshal, router, chronicles
|
export chronos, jsonmarshal, router
|
||||||
|
|
||||||
type
|
type
|
||||||
RpcServer* = ref object of RootRef
|
RpcServer* = ref object of RootRef
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import
|
import
|
||||||
std/[json, strutils],
|
std/[strutils],
|
||||||
chronicles, httputils, chronos,
|
chronicles, httputils, chronos,
|
||||||
../server, ../errors
|
".."/[errors, server]
|
||||||
|
|
||||||
|
export server
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "JSONRPC-HTTP-SERVER"
|
topics = "JSONRPC-HTTP-SERVER"
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import
|
import
|
||||||
std/json,
|
|
||||||
chronicles,
|
chronicles,
|
||||||
json_serialization/std/net,
|
json_serialization/std/net,
|
||||||
../server, ../errors
|
".."/[errors, server]
|
||||||
|
|
||||||
export server
|
export errors, server
|
||||||
|
|
||||||
type
|
type
|
||||||
RpcSocketServer* = ref object of RpcServer
|
RpcSocketServer* = ref object of RpcServer
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user