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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25301c4cc967f51373288c05e253162638fdc080ca9aa49fc7d7749ee6dafb63
4
- data.tar.gz: 6e2be804ffc2f9633c38008b853d5e1053ad9f7f7c901ad724c3780412aa3f6e
3
+ metadata.gz: 6ec20852770933e9219667b03301dd436625ff3088f9e04829ef8c1957da2340
4
+ data.tar.gz: b79cb2c854a05cf4a7bd341315b4df2ea6b7bbcf8740b8841d7b27ff782c4afc
5
5
  SHA512:
6
- metadata.gz: ec2e1384125065ab6d84f75da5ba7f611888c1bb7cdda2ba8a1f2e7188d5b14fae99b25c2ddbbcfb4b7c2b49c4dd3f9bf793841037530f9a4869a2fa5cf472dc
7
- data.tar.gz: c73551250d6870ba6a138ef50541a3fea04ca3faace04a920ddc517ca44302b4cbf281b5c7fb2546ece27ff6154c9873ce227a0a3b3a2b18886eb1738bcc8d53
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.0"
480
+ version = "0.10.1"
481
481
  source = "registry+https://github.com/rust-lang/crates.io-index"
482
- checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601"
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.1"
1324
+ version = "6.4.2"
1325
1325
  source = "registry+https://github.com/rust-lang/crates.io-index"
1326
- checksum = "d43ccdfe15a81ab0a8af639e90254227c9a46afd9c5f5b6ec7efaa345c4b0f00"
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.102"
1724
+ version = "0.3.103"
1725
1725
  source = "registry+https://github.com/rust-lang/crates.io-index"
1726
- checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31"
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.5"
1735
+ version = "0.46.6"
1736
1736
  source = "registry+https://github.com/rust-lang/crates.io-index"
1737
- checksum = "6a5fe5206f06e589caf25e79fc05ccdf91fca745685fe9fe1a13bbdfb479a631"
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.45"
2450
+ version = "1.0.46"
2451
2451
  source = "registry+https://github.com/rust-lang/crates.io-index"
2452
- checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
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.5"
2615
+ version = "0.46.6"
2616
2616
  source = "registry+https://github.com/rust-lang/crates.io-index"
2617
- checksum = "69e4e17ef386c5383591d07623d3de49cbc601156e7582973e6db98d66a57de2"
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.3"
3054
+ version = "0.16.0-rc.4"
3054
3055
  source = "registry+https://github.com/rust-lang/crates.io-index"
3055
- checksum = "bb487eab26c3b52911ccee24022a07370ea82913b36b61b77ced03a67590aab6"
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.3"
3074
+ version = "0.16.0-rc.4"
3074
3075
  source = "registry+https://github.com/rust-lang/crates.io-index"
3075
- checksum = "a7732590fce30f9c4db14bb99c21b642329de9075402ba8e4c119814aed86d04"
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.3"
3100
+ version = "0.16.0-rc.4"
3100
3101
  source = "registry+https://github.com/rust-lang/crates.io-index"
3101
- checksum = "3f317f88da7336e1aabb88b1f070ccec7a9670bd1c776b4c56a92b984b394bb8"
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.3"
3121
+ version = "0.16.0-rc.4"
3121
3122
  source = "registry+https://github.com/rust-lang/crates.io-index"
3122
- checksum = "e5170da38930651806f2b572d385f1e2b104eb00e7339f1b65dac2e9e99b7e95"
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.3"
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.49"
3351
+ version = "0.3.51"
3351
3352
  source = "registry+https://github.com/rust-lang/crates.io-index"
3352
- checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469"
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.29"
3371
+ version = "0.2.30"
3371
3372
  source = "registry+https://github.com/rust-lang/crates.io-index"
3372
- checksum = "71c652a3727a9cbb9a02f707f530b618ce00d0ccd762009c8c23bd191df3c17d"
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.3"
3821
+ version = "1.23.4"
3821
3822
  source = "registry+https://github.com/rust-lang/crates.io-index"
3822
- checksum = "144d6b123cef80b301b8f72a9e2ca4370ddec21950d0a103dd22c437006d2db7"
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.125"
3895
+ version = "0.2.126"
3895
3896
  source = "registry+https://github.com/rust-lang/crates.io-index"
3896
- checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a"
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.125"
3908
+ version = "0.2.126"
3908
3909
  source = "registry+https://github.com/rust-lang/crates.io-index"
3909
- checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d"
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.125"
3918
+ version = "0.2.126"
3918
3919
  source = "registry+https://github.com/rust-lang/crates.io-index"
3919
- checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd"
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.125"
3931
+ version = "0.2.126"
3931
3932
  source = "registry+https://github.com/rust-lang/crates.io-index"
3932
- checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f"
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.102"
3940
+ version = "0.3.103"
3940
3941
  source = "registry+https://github.com/rust-lang/crates.io-index"
3941
- checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d"
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.3"
4217
+ version = "0.6.4"
4217
4218
  source = "registry+https://github.com/rust-lang/crates.io-index"
4218
- checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513"
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"
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.3", features = ["di"] }
29
- spikard-core = { version = "0.16.0-rc.3" }
30
- spikard-graphql = { version = "0.16.0-rc.3" }
31
- spikard-http = { version = "0.16.0-rc.3" }
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"] }
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:7584cccc52425023d4ab10991fe2fa280587fa065753d8d2df1f47da0725054b
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))?;
@@ -2,65 +2,72 @@
2
2
 
3
3
  module Spikard
4
4
  module Errors
5
- class Error < StandardError
6
- attr_reader :status_code, :problem_details_type
5
+ class Error < StandardError
6
+ attr_reader :status_code, :problem_details_type
7
7
 
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
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
- 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
- class NotFoundError < Error
24
- # Raised when the requested resource does not exist.
25
- def initialize(message = nil)
26
- super(message, status_code: 404, problem_details_type: nil)
27
- end
28
- end
29
- class ValidationError < Error
30
- # Raised when input validation fails. Carries a list of field errors per RFC 9457.
31
- def initialize(message = nil)
32
- super(message, status_code: 422, problem_details_type: nil)
33
- end
34
- end
35
- class UnauthorizedError < Error
36
- # Raised when the request lacks valid authentication credentials.
37
- def initialize(message = nil)
38
- super(message, status_code: 401, problem_details_type: nil)
39
- end
40
- end
41
- class ForbiddenError < Error
42
- # Raised when the authenticated user lacks permission for the requested action.
43
- def initialize(message = nil)
44
- super(message, status_code: 403, problem_details_type: nil)
45
- end
46
- end
47
- class RateLimitedError < Error
48
- # Raised when the client exceeds the configured request rate limit.
49
- def initialize(message = nil)
50
- super(message, status_code: 429, problem_details_type: nil)
51
- end
52
- end
53
- class ConflictError < Error
54
- # Raised when the request conflicts with the current state of the resource.
55
- def initialize(message = nil)
56
- super(message, status_code: 409, problem_details_type: nil)
57
- end
58
- end
59
- class InternalError < Error
60
- # Raised when the server encounters an unexpected failure.
61
- def initialize(message = nil)
62
- super(message, status_code: 500, problem_details_type: nil)
63
- end
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
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:7584cccc52425023d4ab10991fe2fa280587fa065753d8d2df1f47da0725054b
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
@@ -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
  #
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:7584cccc52425023d4ab10991fe2fa280587fa065753d8d2df1f47da0725054b
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.3"
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:7584cccc52425023d4ab10991fe2fa280587fa065753d8d2df1f47da0725054b
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:7584cccc52425023d4ab10991fe2fa280587fa065753d8d2df1f47da0725054b
2
+ # alef:hash:f080b02c2594d6e75c8d11e59bd6850cf348664e69ec56eb58939e731568749e
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spikard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0.pre.rc.3
4
+ version: 0.16.0.pre.rc.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Na'aman Hirschfeld <nhirschfeld@gmail.com>