spikard 0.16.0.pre.rc.3 → 0.16.0.pre.rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/spikard_rb/native/Cargo.lock +40 -39
- data/ext/spikard_rb/native/Cargo.toml +5 -5
- data/ext/spikard_rb/src/lib.rs +30 -1
- data/lib/spikard/errors.rb +65 -58
- data/lib/spikard/native.rb +1 -1
- data/lib/spikard/service.rb +14 -0
- data/lib/spikard/version.rb +2 -2
- data/lib/spikard.rb +1 -1
- data/lib/spikard_rb.so +0 -0
- data/sig/types.rbs +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ec20852770933e9219667b03301dd436625ff3088f9e04829ef8c1957da2340
|
|
4
|
+
data.tar.gz: b79cb2c854a05cf4a7bd341315b4df2ea6b7bbcf8740b8841d7b27ff782c4afc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49a8006a4ed29d8f73d07b977fc306de604a31f2fe6d822bc060b2d22e0b632ff87445efe7feb2484bd10ce758518b353b0c8b67a58657b8bff333fe8b124e57
|
|
7
|
+
data.tar.gz: d3a1357c8188b8c1903f15cc38c377f4fed3b83cdbcb0601a591ee0bbc862db1dce28310cc982d3383cd016c53aa5a7a6dbe8a4a5d325a36a7eab6b4f014a6c7
|
|
@@ -477,9 +477,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
|
477
477
|
|
|
478
478
|
[[package]]
|
|
479
479
|
name = "chacha20"
|
|
480
|
-
version = "0.10.
|
|
480
|
+
version = "0.10.1"
|
|
481
481
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
482
|
-
checksum = "
|
|
482
|
+
checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81"
|
|
483
483
|
dependencies = [
|
|
484
484
|
"cfg-if",
|
|
485
485
|
"cpufeatures 0.3.0",
|
|
@@ -1321,9 +1321,9 @@ dependencies = [
|
|
|
1321
1321
|
|
|
1322
1322
|
[[package]]
|
|
1323
1323
|
name = "handlebars"
|
|
1324
|
-
version = "6.4.
|
|
1324
|
+
version = "6.4.2"
|
|
1325
1325
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1326
|
-
checksum = "
|
|
1326
|
+
checksum = "f26569a2763497b7bd3fbd19374b774ea6038c5293678771259cd534d49740ff"
|
|
1327
1327
|
dependencies = [
|
|
1328
1328
|
"derive_builder",
|
|
1329
1329
|
"log",
|
|
@@ -1721,9 +1721,9 @@ dependencies = [
|
|
|
1721
1721
|
|
|
1722
1722
|
[[package]]
|
|
1723
1723
|
name = "js-sys"
|
|
1724
|
-
version = "0.3.
|
|
1724
|
+
version = "0.3.103"
|
|
1725
1725
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1726
|
-
checksum = "
|
|
1726
|
+
checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102"
|
|
1727
1727
|
dependencies = [
|
|
1728
1728
|
"cfg-if",
|
|
1729
1729
|
"futures-util",
|
|
@@ -1732,9 +1732,9 @@ dependencies = [
|
|
|
1732
1732
|
|
|
1733
1733
|
[[package]]
|
|
1734
1734
|
name = "jsonschema"
|
|
1735
|
-
version = "0.46.
|
|
1735
|
+
version = "0.46.6"
|
|
1736
1736
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1737
|
-
checksum = "
|
|
1737
|
+
checksum = "8374249b1bdce1c1773a09fa294347e19e4bfeb86d845c2d8ebaf8a8dbf11233"
|
|
1738
1738
|
dependencies = [
|
|
1739
1739
|
"ahash",
|
|
1740
1740
|
"bytecount",
|
|
@@ -2447,9 +2447,9 @@ dependencies = [
|
|
|
2447
2447
|
|
|
2448
2448
|
[[package]]
|
|
2449
2449
|
name = "quote"
|
|
2450
|
-
version = "1.0.
|
|
2450
|
+
version = "1.0.46"
|
|
2451
2451
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2452
|
-
checksum = "
|
|
2452
|
+
checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
|
|
2453
2453
|
dependencies = [
|
|
2454
2454
|
"proc-macro2",
|
|
2455
2455
|
]
|
|
@@ -2612,9 +2612,9 @@ dependencies = [
|
|
|
2612
2612
|
|
|
2613
2613
|
[[package]]
|
|
2614
2614
|
name = "referencing"
|
|
2615
|
-
version = "0.46.
|
|
2615
|
+
version = "0.46.6"
|
|
2616
2616
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2617
|
-
checksum = "
|
|
2617
|
+
checksum = "65a910f9d63351f9c9d7dc3053d02b214ea3a005917140c70087d7b59cbc5bb1"
|
|
2618
2618
|
dependencies = [
|
|
2619
2619
|
"ahash",
|
|
2620
2620
|
"fluent-uri",
|
|
@@ -2897,6 +2897,7 @@ version = "1.0.150"
|
|
|
2897
2897
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2898
2898
|
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
|
|
2899
2899
|
dependencies = [
|
|
2900
|
+
"indexmap",
|
|
2900
2901
|
"itoa",
|
|
2901
2902
|
"memchr",
|
|
2902
2903
|
"serde",
|
|
@@ -3050,9 +3051,9 @@ dependencies = [
|
|
|
3050
3051
|
|
|
3051
3052
|
[[package]]
|
|
3052
3053
|
name = "spikard"
|
|
3053
|
-
version = "0.16.0-rc.
|
|
3054
|
+
version = "0.16.0-rc.4"
|
|
3054
3055
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3055
|
-
checksum = "
|
|
3056
|
+
checksum = "a09796d63bb1f8625b23d57356f9f154d77a4014122d955ef510228199ab887d"
|
|
3056
3057
|
dependencies = [
|
|
3057
3058
|
"anyhow",
|
|
3058
3059
|
"axum",
|
|
@@ -3070,9 +3071,9 @@ dependencies = [
|
|
|
3070
3071
|
|
|
3071
3072
|
[[package]]
|
|
3072
3073
|
name = "spikard-core"
|
|
3073
|
-
version = "0.16.0-rc.
|
|
3074
|
+
version = "0.16.0-rc.4"
|
|
3074
3075
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3075
|
-
checksum = "
|
|
3076
|
+
checksum = "0e58a4adfbc691a2edd686da4f49ac29b3d7bdd5701059c5d7a00d1de57fd9a2"
|
|
3076
3077
|
dependencies = [
|
|
3077
3078
|
"anyhow",
|
|
3078
3079
|
"base64",
|
|
@@ -3096,9 +3097,9 @@ dependencies = [
|
|
|
3096
3097
|
|
|
3097
3098
|
[[package]]
|
|
3098
3099
|
name = "spikard-graphql"
|
|
3099
|
-
version = "0.16.0-rc.
|
|
3100
|
+
version = "0.16.0-rc.4"
|
|
3100
3101
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3101
|
-
checksum = "
|
|
3102
|
+
checksum = "b621e9b24f7b7d1c26764dc149d2983eb8b8ff5d77ef36a985423b22d60b3190"
|
|
3102
3103
|
dependencies = [
|
|
3103
3104
|
"async-graphql",
|
|
3104
3105
|
"axum",
|
|
@@ -3117,9 +3118,9 @@ dependencies = [
|
|
|
3117
3118
|
|
|
3118
3119
|
[[package]]
|
|
3119
3120
|
name = "spikard-http"
|
|
3120
|
-
version = "0.16.0-rc.
|
|
3121
|
+
version = "0.16.0-rc.4"
|
|
3121
3122
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3122
|
-
checksum = "
|
|
3123
|
+
checksum = "2512110f59ff7463bdc700469b262e3f22fee1bb813ece014c906ab6b3d82df6"
|
|
3123
3124
|
dependencies = [
|
|
3124
3125
|
"ahash",
|
|
3125
3126
|
"anyhow",
|
|
@@ -3172,7 +3173,7 @@ dependencies = [
|
|
|
3172
3173
|
|
|
3173
3174
|
[[package]]
|
|
3174
3175
|
name = "spikard-rb"
|
|
3175
|
-
version = "0.16.0-rc.
|
|
3176
|
+
version = "0.16.0-rc.4"
|
|
3176
3177
|
dependencies = [
|
|
3177
3178
|
"magnus",
|
|
3178
3179
|
"rb-sys",
|
|
@@ -3347,9 +3348,9 @@ dependencies = [
|
|
|
3347
3348
|
|
|
3348
3349
|
[[package]]
|
|
3349
3350
|
name = "time"
|
|
3350
|
-
version = "0.3.
|
|
3351
|
+
version = "0.3.51"
|
|
3351
3352
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3352
|
-
checksum = "
|
|
3353
|
+
checksum = "85c17d80feb7334b40c484e45ed1a5273dfd8bfda537c3be2e74a06a6686f327"
|
|
3353
3354
|
dependencies = [
|
|
3354
3355
|
"deranged",
|
|
3355
3356
|
"num-conv",
|
|
@@ -3367,9 +3368,9 @@ checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"
|
|
|
3367
3368
|
|
|
3368
3369
|
[[package]]
|
|
3369
3370
|
name = "time-macros"
|
|
3370
|
-
version = "0.2.
|
|
3371
|
+
version = "0.2.30"
|
|
3371
3372
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3372
|
-
checksum = "
|
|
3373
|
+
checksum = "dcef1a61bdb119096e153208ec5cbec23944ce8bca13be5c7f60c634f7403935"
|
|
3373
3374
|
dependencies = [
|
|
3374
3375
|
"num-conv",
|
|
3375
3376
|
"time-core",
|
|
@@ -3817,9 +3818,9 @@ checksum = "e2eebbbfe4093922c2b6734d7c679ebfebd704a0d7e56dfcb0d05818ce28977d"
|
|
|
3817
3818
|
|
|
3818
3819
|
[[package]]
|
|
3819
3820
|
name = "uuid"
|
|
3820
|
-
version = "1.23.
|
|
3821
|
+
version = "1.23.4"
|
|
3821
3822
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3822
|
-
checksum = "
|
|
3823
|
+
checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53"
|
|
3823
3824
|
dependencies = [
|
|
3824
3825
|
"getrandom 0.4.3",
|
|
3825
3826
|
"js-sys",
|
|
@@ -3891,9 +3892,9 @@ dependencies = [
|
|
|
3891
3892
|
|
|
3892
3893
|
[[package]]
|
|
3893
3894
|
name = "wasm-bindgen"
|
|
3894
|
-
version = "0.2.
|
|
3895
|
+
version = "0.2.126"
|
|
3895
3896
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3896
|
-
checksum = "
|
|
3897
|
+
checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4"
|
|
3897
3898
|
dependencies = [
|
|
3898
3899
|
"cfg-if",
|
|
3899
3900
|
"once_cell",
|
|
@@ -3904,9 +3905,9 @@ dependencies = [
|
|
|
3904
3905
|
|
|
3905
3906
|
[[package]]
|
|
3906
3907
|
name = "wasm-bindgen-macro"
|
|
3907
|
-
version = "0.2.
|
|
3908
|
+
version = "0.2.126"
|
|
3908
3909
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3909
|
-
checksum = "
|
|
3910
|
+
checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1"
|
|
3910
3911
|
dependencies = [
|
|
3911
3912
|
"quote",
|
|
3912
3913
|
"wasm-bindgen-macro-support",
|
|
@@ -3914,9 +3915,9 @@ dependencies = [
|
|
|
3914
3915
|
|
|
3915
3916
|
[[package]]
|
|
3916
3917
|
name = "wasm-bindgen-macro-support"
|
|
3917
|
-
version = "0.2.
|
|
3918
|
+
version = "0.2.126"
|
|
3918
3919
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3919
|
-
checksum = "
|
|
3920
|
+
checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e"
|
|
3920
3921
|
dependencies = [
|
|
3921
3922
|
"bumpalo",
|
|
3922
3923
|
"proc-macro2",
|
|
@@ -3927,18 +3928,18 @@ dependencies = [
|
|
|
3927
3928
|
|
|
3928
3929
|
[[package]]
|
|
3929
3930
|
name = "wasm-bindgen-shared"
|
|
3930
|
-
version = "0.2.
|
|
3931
|
+
version = "0.2.126"
|
|
3931
3932
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3932
|
-
checksum = "
|
|
3933
|
+
checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24"
|
|
3933
3934
|
dependencies = [
|
|
3934
3935
|
"unicode-ident",
|
|
3935
3936
|
]
|
|
3936
3937
|
|
|
3937
3938
|
[[package]]
|
|
3938
3939
|
name = "web-sys"
|
|
3939
|
-
version = "0.3.
|
|
3940
|
+
version = "0.3.103"
|
|
3940
3941
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3941
|
-
checksum = "
|
|
3942
|
+
checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141"
|
|
3942
3943
|
dependencies = [
|
|
3943
3944
|
"js-sys",
|
|
3944
3945
|
"wasm-bindgen",
|
|
@@ -4213,9 +4214,9 @@ dependencies = [
|
|
|
4213
4214
|
|
|
4214
4215
|
[[package]]
|
|
4215
4216
|
name = "zlib-rs"
|
|
4216
|
-
version = "0.6.
|
|
4217
|
+
version = "0.6.4"
|
|
4217
4218
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
4218
|
-
checksum = "
|
|
4219
|
+
checksum = "977347db8caa080403f6b6b7c1cda9479a8e869316f7e13a59b19076a40f94e3"
|
|
4219
4220
|
|
|
4220
4221
|
[[package]]
|
|
4221
4222
|
name = "zmij"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "spikard-rb"
|
|
3
|
-
version = "0.16.0-rc.
|
|
3
|
+
version = "0.16.0-rc.4"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
description = "Rust-centric multi-language HTTP framework with polyglot bindings"
|
|
@@ -25,8 +25,8 @@ magnus = "0.8"
|
|
|
25
25
|
rb-sys = ">=0.9, <0.9.128"
|
|
26
26
|
serde = { version = "1", features = ["derive"] }
|
|
27
27
|
serde_json = "1"
|
|
28
|
-
spikard = { version = "0.16.0-rc.
|
|
29
|
-
spikard-core = { version = "0.16.0-rc.
|
|
30
|
-
spikard-graphql = { version = "0.16.0-rc.
|
|
31
|
-
spikard-http = { version = "0.16.0-rc.
|
|
28
|
+
spikard = { version = "0.16.0-rc.4", features = ["di"] }
|
|
29
|
+
spikard-core = { version = "0.16.0-rc.4" }
|
|
30
|
+
spikard-graphql = { version = "0.16.0-rc.4" }
|
|
31
|
+
spikard-http = { version = "0.16.0-rc.4" }
|
|
32
32
|
tokio = { version = "1", features = ["rt-multi-thread"] }
|
data/ext/spikard_rb/src/lib.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:f080b02c2594d6e75c8d11e59bd6850cf348664e69ec56eb58939e731568749e
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -3827,9 +3827,11 @@ impl magnus::TryConvert for SecuritySchemeInfo {
|
|
|
3827
3827
|
})?
|
|
3828
3828
|
};
|
|
3829
3829
|
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
3830
|
+
// For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
|
|
3830
3831
|
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
3831
3832
|
// If both fail, try as Custom variant (for untagged enum support)
|
|
3832
3833
|
serde_json::from_str(&json_str)
|
|
3834
|
+
.or_else(|_| serde_json::from_value(serde_json::json!({ "type": json_str })))
|
|
3833
3835
|
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
3834
3836
|
.or_else(|_| {
|
|
3835
3837
|
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
@@ -3846,6 +3848,15 @@ unsafe impl IntoValueFromNative for SecuritySchemeInfo {}
|
|
|
3846
3848
|
unsafe impl TryConvertOwned for SecuritySchemeInfo {}
|
|
3847
3849
|
impl SecuritySchemeInfo {}
|
|
3848
3850
|
|
|
3851
|
+
impl SecuritySchemeInfo {
|
|
3852
|
+
pub fn _factory_http(scheme: String, bearer_format: Option<String>) -> Self {
|
|
3853
|
+
Self::Http { scheme, bearer_format }
|
|
3854
|
+
}
|
|
3855
|
+
pub fn _factory_api_key(location: String, name: String) -> Self {
|
|
3856
|
+
Self::ApiKey { location, name }
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3849
3860
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
3850
3861
|
pub enum SnapshotError {
|
|
3851
3862
|
InvalidHeader { _0: String },
|
|
@@ -3882,6 +3893,7 @@ impl magnus::TryConvert for SnapshotError {
|
|
|
3882
3893
|
})?
|
|
3883
3894
|
};
|
|
3884
3895
|
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
3896
|
+
// For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
|
|
3885
3897
|
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
3886
3898
|
// If both fail, try as Custom variant (for untagged enum support)
|
|
3887
3899
|
serde_json::from_str(&json_str)
|
|
@@ -3939,6 +3951,7 @@ impl magnus::TryConvert for WebSocketMessage {
|
|
|
3939
3951
|
})?
|
|
3940
3952
|
};
|
|
3941
3953
|
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
3954
|
+
// For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
|
|
3942
3955
|
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
3943
3956
|
// If both fail, try as Custom variant (for untagged enum support)
|
|
3944
3957
|
serde_json::from_str(&json_str)
|
|
@@ -3957,6 +3970,12 @@ impl magnus::TryConvert for WebSocketMessage {
|
|
|
3957
3970
|
unsafe impl IntoValueFromNative for WebSocketMessage {}
|
|
3958
3971
|
unsafe impl TryConvertOwned for WebSocketMessage {}
|
|
3959
3972
|
|
|
3973
|
+
impl WebSocketMessage {
|
|
3974
|
+
pub fn _factory_close(code: u16, reason: Option<String>) -> Self {
|
|
3975
|
+
Self::Close { code, reason }
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3960
3979
|
fn schema_query_only() -> QueryOnlyConfig {
|
|
3961
3980
|
spikard_graphql::schema_query_only().into()
|
|
3962
3981
|
}
|
|
@@ -5421,6 +5440,16 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
5421
5440
|
method!(TestClient::graphql_subscription_async, 3),
|
|
5422
5441
|
)?;
|
|
5423
5442
|
|
|
5443
|
+
let class = module.define_class("SecuritySchemeInfo", ruby.class_object())?;
|
|
5444
|
+
|
|
5445
|
+
class.define_singleton_method("http", function!(SecuritySchemeInfo::_factory_http, 2))?;
|
|
5446
|
+
|
|
5447
|
+
class.define_singleton_method("api_key", function!(SecuritySchemeInfo::_factory_api_key, 2))?;
|
|
5448
|
+
|
|
5449
|
+
let class = module.define_class("WebSocketMessage", ruby.class_object())?;
|
|
5450
|
+
|
|
5451
|
+
class.define_singleton_method("close", function!(WebSocketMessage::_factory_close, 2))?;
|
|
5452
|
+
|
|
5424
5453
|
module.define_module_function("schema_query_only", function!(schema_query_only, 0))?;
|
|
5425
5454
|
|
|
5426
5455
|
module.define_module_function("schema_query_mutation", function!(schema_query_mutation, 0))?;
|
data/lib/spikard/errors.rb
CHANGED
|
@@ -2,65 +2,72 @@
|
|
|
2
2
|
|
|
3
3
|
module Spikard
|
|
4
4
|
module Errors
|
|
5
|
-
class Error < StandardError
|
|
6
|
-
|
|
5
|
+
class Error < StandardError
|
|
6
|
+
attr_reader :status_code, :problem_details_type
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
def initialize(message = nil, status_code: nil, problem_details_type: nil)
|
|
9
|
+
super(message)
|
|
10
|
+
@status_code = status_code
|
|
11
|
+
@problem_details_type = problem_details_type
|
|
12
|
+
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
end
|
|
14
|
+
def to_problem_details
|
|
15
|
+
{
|
|
16
|
+
type: @problem_details_type || "about:blank",
|
|
17
|
+
title: self.class.name.split("::").last,
|
|
18
|
+
status: @status_code || 500,
|
|
19
|
+
detail: message
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class NotFoundError < Error
|
|
25
|
+
# Raised when the requested resource does not exist.
|
|
26
|
+
def initialize(message = nil)
|
|
27
|
+
super(message, status_code: 404, problem_details_type: nil)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class ValidationError < Error
|
|
32
|
+
# Raised when input validation fails. Carries a list of field errors per RFC 9457.
|
|
33
|
+
def initialize(message = nil)
|
|
34
|
+
super(message, status_code: 422, problem_details_type: nil)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class UnauthorizedError < Error
|
|
39
|
+
# Raised when the request lacks valid authentication credentials.
|
|
40
|
+
def initialize(message = nil)
|
|
41
|
+
super(message, status_code: 401, problem_details_type: nil)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class ForbiddenError < Error
|
|
46
|
+
# Raised when the authenticated user lacks permission for the requested action.
|
|
47
|
+
def initialize(message = nil)
|
|
48
|
+
super(message, status_code: 403, problem_details_type: nil)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class RateLimitedError < Error
|
|
53
|
+
# Raised when the client exceeds the configured request rate limit.
|
|
54
|
+
def initialize(message = nil)
|
|
55
|
+
super(message, status_code: 429, problem_details_type: nil)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class ConflictError < Error
|
|
60
|
+
# Raised when the request conflicts with the current state of the resource.
|
|
61
|
+
def initialize(message = nil)
|
|
62
|
+
super(message, status_code: 409, problem_details_type: nil)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class InternalError < Error
|
|
67
|
+
# Raised when the server encounters an unexpected failure.
|
|
68
|
+
def initialize(message = nil)
|
|
69
|
+
super(message, status_code: 500, problem_details_type: nil)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
65
72
|
end
|
|
66
73
|
end
|
data/lib/spikard/native.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:f080b02c2594d6e75c8d11e59bd6850cf348664e69ec56eb58939e731568749e
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
data/lib/spikard/service.rb
CHANGED
|
@@ -8,11 +8,13 @@ module Spikard
|
|
|
8
8
|
# Create a new application with the default server configuration.
|
|
9
9
|
@registrations = []
|
|
10
10
|
end
|
|
11
|
+
|
|
11
12
|
def config(config)
|
|
12
13
|
# Set the server configuration.
|
|
13
14
|
@config = config
|
|
14
15
|
self
|
|
15
16
|
end
|
|
17
|
+
|
|
16
18
|
def route(builder, &block)
|
|
17
19
|
# Register a route using the provided builder and handler function.
|
|
18
20
|
#
|
|
@@ -22,56 +24,67 @@ module Spikard
|
|
|
22
24
|
@registrations.push(["route", [builder], block])
|
|
23
25
|
self
|
|
24
26
|
end
|
|
27
|
+
|
|
25
28
|
def register_route(builder, handler)
|
|
26
29
|
# Register a route callback directly without block syntax.
|
|
27
30
|
@registrations.push(["route", [builder], handler])
|
|
28
31
|
self
|
|
29
32
|
end
|
|
33
|
+
|
|
30
34
|
def get(path: String, &block)
|
|
31
35
|
# Register a GET route at the given path.
|
|
32
36
|
@registrations.push(["get", [spikard::Method::Get, path], block])
|
|
33
37
|
self
|
|
34
38
|
end
|
|
39
|
+
|
|
35
40
|
def post(path: String, &block)
|
|
36
41
|
# Register a POST route at the given path.
|
|
37
42
|
@registrations.push(["post", [spikard::Method::Post, path], block])
|
|
38
43
|
self
|
|
39
44
|
end
|
|
45
|
+
|
|
40
46
|
def put(path: String, &block)
|
|
41
47
|
# Register a PUT route at the given path.
|
|
42
48
|
@registrations.push(["put", [spikard::Method::Put, path], block])
|
|
43
49
|
self
|
|
44
50
|
end
|
|
51
|
+
|
|
45
52
|
def patch(path: String, &block)
|
|
46
53
|
# Register a PATCH route at the given path.
|
|
47
54
|
@registrations.push(["patch", [spikard::Method::Patch, path], block])
|
|
48
55
|
self
|
|
49
56
|
end
|
|
57
|
+
|
|
50
58
|
def delete(path: String, &block)
|
|
51
59
|
# Register a DELETE route at the given path.
|
|
52
60
|
@registrations.push(["delete", [spikard::Method::Delete, path], block])
|
|
53
61
|
self
|
|
54
62
|
end
|
|
63
|
+
|
|
55
64
|
def head(path: String, &block)
|
|
56
65
|
# Register a HEAD route at the given path.
|
|
57
66
|
@registrations.push(["head", [spikard::Method::Head, path], block])
|
|
58
67
|
self
|
|
59
68
|
end
|
|
69
|
+
|
|
60
70
|
def options(path: String, &block)
|
|
61
71
|
# Register an OPTIONS route at the given path.
|
|
62
72
|
@registrations.push(["options", [spikard::Method::Options, path], block])
|
|
63
73
|
self
|
|
64
74
|
end
|
|
75
|
+
|
|
65
76
|
def connect(path: String, &block)
|
|
66
77
|
# Register a CONNECT route at the given path.
|
|
67
78
|
@registrations.push(["connect", [spikard::Method::Connect, path], block])
|
|
68
79
|
self
|
|
69
80
|
end
|
|
81
|
+
|
|
70
82
|
def trace(path: String, &block)
|
|
71
83
|
# Register a TRACE route at the given path.
|
|
72
84
|
@registrations.push(["trace", [spikard::Method::Trace, path], block])
|
|
73
85
|
self
|
|
74
86
|
end
|
|
87
|
+
|
|
75
88
|
def run
|
|
76
89
|
# Run the HTTP server using the configured routes.
|
|
77
90
|
#
|
|
@@ -80,6 +93,7 @@ module Spikard
|
|
|
80
93
|
# Returns an error if server construction or execution fails.
|
|
81
94
|
Spikard.app_run(@registrations)
|
|
82
95
|
end
|
|
96
|
+
|
|
83
97
|
def into_router
|
|
84
98
|
# Build the underlying Axum router.
|
|
85
99
|
#
|
data/lib/spikard/version.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:f080b02c2594d6e75c8d11e59bd6850cf348664e69ec56eb58939e731568749e
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
7
|
module Spikard
|
|
8
8
|
## The version string for this package.
|
|
9
|
-
VERSION = "0.16.0.pre.rc.
|
|
9
|
+
VERSION = "0.16.0.pre.rc.4"
|
|
10
10
|
end
|
data/lib/spikard.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:f080b02c2594d6e75c8d11e59bd6850cf348664e69ec56eb58939e731568749e
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
data/lib/spikard_rb.so
CHANGED
|
Binary file
|
data/sig/types.rbs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:f080b02c2594d6e75c8d11e59bd6850cf348664e69ec56eb58939e731568749e
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
|