spikard 0.12.0 → 0.15.2

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.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/Steepfile +6 -0
  3. data/ext/spikard_rb/extconf.rb +1 -2
  4. data/ext/spikard_rb/{Cargo.lock → native/Cargo.lock} +897 -451
  5. data/ext/spikard_rb/native/Cargo.toml +24 -0
  6. data/ext/spikard_rb/src/lib.rs +5366 -3
  7. data/lib/spikard/native.rb +86 -0
  8. data/lib/spikard/version.rb +6 -1
  9. data/lib/spikard.rb +8 -45
  10. data/lib/spikard_rb.so +0 -0
  11. data/sig/types.rbs +427 -0
  12. metadata +14 -242
  13. data/LICENSE +0 -1
  14. data/README.md +0 -267
  15. data/ext/spikard_rb/Cargo.toml +0 -17
  16. data/lib/spikard/app.rb +0 -428
  17. data/lib/spikard/background.rb +0 -58
  18. data/lib/spikard/config.rb +0 -506
  19. data/lib/spikard/converters.rb +0 -13
  20. data/lib/spikard/grpc.rb +0 -182
  21. data/lib/spikard/handler_wrapper.rb +0 -113
  22. data/lib/spikard/provide.rb +0 -214
  23. data/lib/spikard/response.rb +0 -173
  24. data/lib/spikard/schema.rb +0 -243
  25. data/lib/spikard/sse.rb +0 -111
  26. data/lib/spikard/streaming_response.rb +0 -44
  27. data/lib/spikard/testing.rb +0 -432
  28. data/lib/spikard/upload_file.rb +0 -131
  29. data/lib/spikard/websocket.rb +0 -59
  30. data/sig/spikard.rbs +0 -719
  31. data/vendor/crates/spikard-bindings-shared/Cargo.toml +0 -80
  32. data/vendor/crates/spikard-bindings-shared/examples/config_extraction.rs +0 -132
  33. data/vendor/crates/spikard-bindings-shared/src/config_extractor.rs +0 -905
  34. data/vendor/crates/spikard-bindings-shared/src/conversion_traits.rs +0 -210
  35. data/vendor/crates/spikard-bindings-shared/src/di_traits.rs +0 -252
  36. data/vendor/crates/spikard-bindings-shared/src/error_response.rs +0 -404
  37. data/vendor/crates/spikard-bindings-shared/src/grpc_metadata.rs +0 -199
  38. data/vendor/crates/spikard-bindings-shared/src/handler_base.rs +0 -252
  39. data/vendor/crates/spikard-bindings-shared/src/json_conversion.rs +0 -829
  40. data/vendor/crates/spikard-bindings-shared/src/lazy_cache.rs +0 -587
  41. data/vendor/crates/spikard-bindings-shared/src/lib.rs +0 -33
  42. data/vendor/crates/spikard-bindings-shared/src/lifecycle_base.rs +0 -298
  43. data/vendor/crates/spikard-bindings-shared/src/lifecycle_executor.rs +0 -594
  44. data/vendor/crates/spikard-bindings-shared/src/response_builder.rs +0 -743
  45. data/vendor/crates/spikard-bindings-shared/src/response_interpreter.rs +0 -944
  46. data/vendor/crates/spikard-bindings-shared/src/test_client_base.rs +0 -260
  47. data/vendor/crates/spikard-bindings-shared/src/validation_helpers.rs +0 -369
  48. data/vendor/crates/spikard-bindings-shared/tests/config_extractor_behavior.rs +0 -192
  49. data/vendor/crates/spikard-bindings-shared/tests/error_response_edge_cases.rs +0 -383
  50. data/vendor/crates/spikard-bindings-shared/tests/full_coverage.rs +0 -459
  51. data/vendor/crates/spikard-bindings-shared/tests/handler_base_integration.rs +0 -280
  52. data/vendor/crates/spikard-bindings-shared/tests/integration_tests.rs +0 -669
  53. data/vendor/crates/spikard-core/Cargo.toml +0 -60
  54. data/vendor/crates/spikard-core/src/bindings/mod.rs +0 -3
  55. data/vendor/crates/spikard-core/src/bindings/response.rs +0 -130
  56. data/vendor/crates/spikard-core/src/debug.rs +0 -127
  57. data/vendor/crates/spikard-core/src/di/container.rs +0 -702
  58. data/vendor/crates/spikard-core/src/di/dependency.rs +0 -273
  59. data/vendor/crates/spikard-core/src/di/error.rs +0 -118
  60. data/vendor/crates/spikard-core/src/di/factory.rs +0 -538
  61. data/vendor/crates/spikard-core/src/di/graph.rs +0 -507
  62. data/vendor/crates/spikard-core/src/di/mod.rs +0 -192
  63. data/vendor/crates/spikard-core/src/di/resolved.rs +0 -428
  64. data/vendor/crates/spikard-core/src/di/value.rs +0 -282
  65. data/vendor/crates/spikard-core/src/errors.rs +0 -72
  66. data/vendor/crates/spikard-core/src/http.rs +0 -492
  67. data/vendor/crates/spikard-core/src/lib.rs +0 -29
  68. data/vendor/crates/spikard-core/src/lifecycle.rs +0 -1273
  69. data/vendor/crates/spikard-core/src/metadata.rs +0 -378
  70. data/vendor/crates/spikard-core/src/parameters.rs +0 -2546
  71. data/vendor/crates/spikard-core/src/problem.rs +0 -358
  72. data/vendor/crates/spikard-core/src/request_data.rs +0 -1146
  73. data/vendor/crates/spikard-core/src/router.rs +0 -530
  74. data/vendor/crates/spikard-core/src/schema_registry.rs +0 -197
  75. data/vendor/crates/spikard-core/src/type_hints.rs +0 -311
  76. data/vendor/crates/spikard-core/src/validation/error_mapper.rs +0 -710
  77. data/vendor/crates/spikard-core/src/validation/mod.rs +0 -470
  78. data/vendor/crates/spikard-core/tests/bindings_response_tests.rs +0 -136
  79. data/vendor/crates/spikard-core/tests/di_dependency_defaults.rs +0 -37
  80. data/vendor/crates/spikard-core/tests/error_mapper.rs +0 -761
  81. data/vendor/crates/spikard-core/tests/parameters_edge_cases.rs +0 -106
  82. data/vendor/crates/spikard-core/tests/parameters_full.rs +0 -701
  83. data/vendor/crates/spikard-core/tests/parameters_schema_and_formats.rs +0 -301
  84. data/vendor/crates/spikard-core/tests/request_data_roundtrip.rs +0 -67
  85. data/vendor/crates/spikard-core/tests/validation_coverage.rs +0 -250
  86. data/vendor/crates/spikard-core/tests/validation_error_paths.rs +0 -45
  87. data/vendor/crates/spikard-http/Cargo.toml +0 -87
  88. data/vendor/crates/spikard-http/examples/sse-notifications.rs +0 -148
  89. data/vendor/crates/spikard-http/examples/websocket-chat.rs +0 -92
  90. data/vendor/crates/spikard-http/src/auth.rs +0 -301
  91. data/vendor/crates/spikard-http/src/background.rs +0 -1860
  92. data/vendor/crates/spikard-http/src/bindings/mod.rs +0 -3
  93. data/vendor/crates/spikard-http/src/bindings/response.rs +0 -1
  94. data/vendor/crates/spikard-http/src/body_metadata.rs +0 -8
  95. data/vendor/crates/spikard-http/src/cors.rs +0 -1026
  96. data/vendor/crates/spikard-http/src/debug.rs +0 -128
  97. data/vendor/crates/spikard-http/src/di_handler.rs +0 -1672
  98. data/vendor/crates/spikard-http/src/grpc/framing.rs +0 -469
  99. data/vendor/crates/spikard-http/src/grpc/handler.rs +0 -1122
  100. data/vendor/crates/spikard-http/src/grpc/mod.rs +0 -434
  101. data/vendor/crates/spikard-http/src/grpc/service.rs +0 -622
  102. data/vendor/crates/spikard-http/src/grpc/streaming.rs +0 -319
  103. data/vendor/crates/spikard-http/src/handler_response.rs +0 -901
  104. data/vendor/crates/spikard-http/src/handler_trait.rs +0 -1015
  105. data/vendor/crates/spikard-http/src/handler_trait_tests.rs +0 -290
  106. data/vendor/crates/spikard-http/src/jsonrpc/http_handler.rs +0 -502
  107. data/vendor/crates/spikard-http/src/jsonrpc/method_registry.rs +0 -648
  108. data/vendor/crates/spikard-http/src/jsonrpc/mod.rs +0 -58
  109. data/vendor/crates/spikard-http/src/jsonrpc/protocol.rs +0 -1207
  110. data/vendor/crates/spikard-http/src/jsonrpc/router.rs +0 -2262
  111. data/vendor/crates/spikard-http/src/lib.rs +0 -548
  112. data/vendor/crates/spikard-http/src/lifecycle/adapter.rs +0 -230
  113. data/vendor/crates/spikard-http/src/lifecycle.rs +0 -1193
  114. data/vendor/crates/spikard-http/src/middleware/mod.rs +0 -560
  115. data/vendor/crates/spikard-http/src/middleware/multipart.rs +0 -912
  116. data/vendor/crates/spikard-http/src/middleware/urlencoded.rs +0 -513
  117. data/vendor/crates/spikard-http/src/middleware/validation.rs +0 -768
  118. data/vendor/crates/spikard-http/src/openapi/mod.rs +0 -309
  119. data/vendor/crates/spikard-http/src/openapi/parameter_extraction.rs +0 -535
  120. data/vendor/crates/spikard-http/src/openapi/schema_conversion.rs +0 -1363
  121. data/vendor/crates/spikard-http/src/openapi/spec_generation.rs +0 -667
  122. data/vendor/crates/spikard-http/src/query_parser.rs +0 -793
  123. data/vendor/crates/spikard-http/src/response.rs +0 -720
  124. data/vendor/crates/spikard-http/src/server/fast_router.rs +0 -186
  125. data/vendor/crates/spikard-http/src/server/grpc_routing.rs +0 -858
  126. data/vendor/crates/spikard-http/src/server/handler.rs +0 -1661
  127. data/vendor/crates/spikard-http/src/server/lifecycle_execution.rs +0 -253
  128. data/vendor/crates/spikard-http/src/server/mod.rs +0 -1649
  129. data/vendor/crates/spikard-http/src/server/request_extraction.rs +0 -871
  130. data/vendor/crates/spikard-http/src/server/routing_factory.rs +0 -618
  131. data/vendor/crates/spikard-http/src/sse.rs +0 -1409
  132. data/vendor/crates/spikard-http/src/testing/form.rs +0 -52
  133. data/vendor/crates/spikard-http/src/testing/multipart.rs +0 -64
  134. data/vendor/crates/spikard-http/src/testing/test_client.rs +0 -787
  135. data/vendor/crates/spikard-http/src/testing.rs +0 -617
  136. data/vendor/crates/spikard-http/src/websocket.rs +0 -1477
  137. data/vendor/crates/spikard-http/tests/auth_integration.rs +0 -645
  138. data/vendor/crates/spikard-http/tests/background_behavior.rs +0 -832
  139. data/vendor/crates/spikard-http/tests/common/grpc_helpers.rs +0 -1012
  140. data/vendor/crates/spikard-http/tests/common/handlers.rs +0 -309
  141. data/vendor/crates/spikard-http/tests/common/mod.rs +0 -33
  142. data/vendor/crates/spikard-http/tests/common/test_builders.rs +0 -628
  143. data/vendor/crates/spikard-http/tests/di_handler_error_responses.rs +0 -162
  144. data/vendor/crates/spikard-http/tests/di_integration.rs +0 -192
  145. data/vendor/crates/spikard-http/tests/doc_snippets.rs +0 -5
  146. data/vendor/crates/spikard-http/tests/grpc_bidirectional_streaming.rs +0 -430
  147. data/vendor/crates/spikard-http/tests/grpc_client_streaming.rs +0 -738
  148. data/vendor/crates/spikard-http/tests/grpc_error_handling_test.rs +0 -652
  149. data/vendor/crates/spikard-http/tests/grpc_integration_test.rs +0 -334
  150. data/vendor/crates/spikard-http/tests/grpc_metadata_test.rs +0 -532
  151. data/vendor/crates/spikard-http/tests/grpc_server_integration.rs +0 -495
  152. data/vendor/crates/spikard-http/tests/grpc_server_streaming.rs +0 -974
  153. data/vendor/crates/spikard-http/tests/lifecycle_execution.rs +0 -1093
  154. data/vendor/crates/spikard-http/tests/middleware_stack_integration.rs +0 -389
  155. data/vendor/crates/spikard-http/tests/multipart_behavior.rs +0 -656
  156. data/vendor/crates/spikard-http/tests/request_extraction_full.rs +0 -513
  157. data/vendor/crates/spikard-http/tests/server_auth_middleware_behavior.rs +0 -328
  158. data/vendor/crates/spikard-http/tests/server_config_builder.rs +0 -314
  159. data/vendor/crates/spikard-http/tests/server_configured_router_behavior.rs +0 -200
  160. data/vendor/crates/spikard-http/tests/server_cors_preflight.rs +0 -83
  161. data/vendor/crates/spikard-http/tests/server_handler_wrappers.rs +0 -464
  162. data/vendor/crates/spikard-http/tests/server_method_router_additional_behavior.rs +0 -286
  163. data/vendor/crates/spikard-http/tests/server_method_router_coverage.rs +0 -118
  164. data/vendor/crates/spikard-http/tests/server_middleware_behavior.rs +0 -99
  165. data/vendor/crates/spikard-http/tests/server_middleware_branches.rs +0 -204
  166. data/vendor/crates/spikard-http/tests/server_openapi_jsonrpc_static.rs +0 -421
  167. data/vendor/crates/spikard-http/tests/server_router_behavior.rs +0 -121
  168. data/vendor/crates/spikard-http/tests/sse_behavior.rs +0 -620
  169. data/vendor/crates/spikard-http/tests/sse_full_behavior.rs +0 -584
  170. data/vendor/crates/spikard-http/tests/sse_handler_behavior.rs +0 -130
  171. data/vendor/crates/spikard-http/tests/test_client_requests.rs +0 -167
  172. data/vendor/crates/spikard-http/tests/testing_helpers.rs +0 -87
  173. data/vendor/crates/spikard-http/tests/testing_module_coverage.rs +0 -155
  174. data/vendor/crates/spikard-http/tests/urlencoded_content_type.rs +0 -82
  175. data/vendor/crates/spikard-http/tests/websocket_behavior.rs +0 -663
  176. data/vendor/crates/spikard-http/tests/websocket_full_behavior.rs +0 -440
  177. data/vendor/crates/spikard-http/tests/websocket_integration.rs +0 -150
  178. data/vendor/crates/spikard-rb/Cargo.toml +0 -68
  179. data/vendor/crates/spikard-rb/build.rs +0 -200
  180. data/vendor/crates/spikard-rb/src/background.rs +0 -63
  181. data/vendor/crates/spikard-rb/src/config/mod.rs +0 -5
  182. data/vendor/crates/spikard-rb/src/config/server_config.rs +0 -401
  183. data/vendor/crates/spikard-rb/src/conversion.rs +0 -688
  184. data/vendor/crates/spikard-rb/src/di/builder.rs +0 -100
  185. data/vendor/crates/spikard-rb/src/di/mod.rs +0 -375
  186. data/vendor/crates/spikard-rb/src/grpc/handler.rs +0 -834
  187. data/vendor/crates/spikard-rb/src/grpc/mod.rs +0 -13
  188. data/vendor/crates/spikard-rb/src/gvl.rs +0 -80
  189. data/vendor/crates/spikard-rb/src/handler.rs +0 -699
  190. data/vendor/crates/spikard-rb/src/integration/mod.rs +0 -3
  191. data/vendor/crates/spikard-rb/src/lib.rs +0 -2264
  192. data/vendor/crates/spikard-rb/src/lifecycle.rs +0 -303
  193. data/vendor/crates/spikard-rb/src/metadata/mod.rs +0 -5
  194. data/vendor/crates/spikard-rb/src/metadata/route_extraction.rs +0 -507
  195. data/vendor/crates/spikard-rb/src/request.rs +0 -439
  196. data/vendor/crates/spikard-rb/src/runtime/mod.rs +0 -5
  197. data/vendor/crates/spikard-rb/src/runtime/server_runner.rs +0 -344
  198. data/vendor/crates/spikard-rb/src/server.rs +0 -307
  199. data/vendor/crates/spikard-rb/src/sse.rs +0 -231
  200. data/vendor/crates/spikard-rb/src/testing/client.rs +0 -698
  201. data/vendor/crates/spikard-rb/src/testing/mod.rs +0 -7
  202. data/vendor/crates/spikard-rb/src/testing/sse.rs +0 -108
  203. data/vendor/crates/spikard-rb/src/testing/websocket.rs +0 -573
  204. data/vendor/crates/spikard-rb/src/websocket.rs +0 -475
  205. data/vendor/crates/spikard-rb-macros/Cargo.toml +0 -25
  206. data/vendor/crates/spikard-rb-macros/src/lib.rs +0 -51
data/sig/spikard.rbs DELETED
@@ -1,719 +0,0 @@
1
- # Type signatures for Spikard HTTP framework Ruby bindings
2
-
3
- module Spikard
4
- VERSION: String
5
-
6
- # JSON-serializable value types
7
- type jsonPrimitive = String | Integer | Float | bool | nil
8
- type jsonValue = jsonPrimitive | Array[jsonValue] | Hash[String, jsonValue]
9
- type jsonObject = Hash[String, jsonValue]
10
- type jsonArray = Array[jsonValue]
11
-
12
- # Convenience alias (set in spikard.rb)
13
- TestClient: singleton(Testing::TestClient)
14
-
15
- # Struct for route entries (method, path, handler_name, metadata)
16
- class RouteEntry < Struct[untyped]
17
- attr_accessor metadata: Hash[Symbol, untyped]
18
- attr_accessor handler: Proc?
19
-
20
- def initialize: (Hash[Symbol, untyped], Proc?) -> void
21
- end
22
-
23
- # Background job helpers
24
- module Background
25
- SHUTDOWN: Object
26
-
27
- @queue: Thread::Queue
28
- @worker: Thread?
29
- @worker_mutex: Thread::Mutex
30
-
31
- def self.run: () { () -> void } -> void
32
- def self.ensure_worker: () -> void
33
- def self.shutdown: () -> void
34
- end
35
-
36
- # Compression configuration for response compression middleware
37
- class CompressionConfig
38
- attr_accessor gzip: bool
39
- attr_accessor brotli: bool
40
- attr_accessor min_size: Integer
41
- attr_accessor quality: Integer
42
-
43
- def initialize: (?gzip: bool, ?brotli: bool, ?min_size: Integer, ?quality: Integer) -> void
44
-
45
- private
46
-
47
- def normalize_boolean: (String, untyped) -> bool
48
- def normalize_nonnegative_integer: (String, untyped) -> Integer
49
- def normalize_quality: (untyped) -> Integer
50
- end
51
-
52
- # Rate limiting configuration using Generic Cell Rate Algorithm (GCRA)
53
- class RateLimitConfig
54
- attr_accessor per_second: Integer
55
- attr_accessor burst: Integer
56
- attr_accessor ip_based: bool
57
-
58
- def initialize: (per_second: Integer, burst: Integer, ?ip_based: bool) -> void
59
- end
60
-
61
- # JWT authentication configuration
62
- class JwtConfig
63
- attr_accessor secret: String
64
- attr_accessor algorithm: String
65
- attr_accessor audience: Array[String]?
66
- attr_accessor issuer: String?
67
- attr_accessor leeway: Integer
68
-
69
- def initialize: (secret: String, ?algorithm: String, ?audience: Array[String]?, ?issuer: String?, ?leeway: Integer) -> void
70
- end
71
-
72
- # API key authentication configuration
73
- class ApiKeyConfig
74
- attr_accessor keys: Array[String]
75
- attr_accessor header_name: String
76
-
77
- def initialize: (keys: Array[String], ?header_name: String) -> void
78
- end
79
-
80
- # Static file serving configuration
81
- class StaticFilesConfig
82
- attr_accessor directory: String
83
- attr_accessor route_prefix: String
84
- attr_accessor index_file: bool
85
- attr_accessor cache_control: String?
86
-
87
- def initialize: (directory: String, route_prefix: String, ?index_file: bool, ?cache_control: String?) -> void
88
- end
89
-
90
- # Contact information for OpenAPI documentation
91
- class ContactInfo
92
- attr_accessor name: String?
93
- attr_accessor email: String?
94
- attr_accessor url: String?
95
-
96
- def initialize: (?name: String?, ?email: String?, ?url: String?) -> void
97
- end
98
-
99
- # License information for OpenAPI documentation
100
- class LicenseInfo
101
- attr_accessor name: String
102
- attr_accessor url: String?
103
-
104
- def initialize: (name: String, ?url: String?) -> void
105
- end
106
-
107
- # Server information for OpenAPI documentation
108
- class ServerInfo
109
- attr_accessor url: String
110
- attr_accessor description: String?
111
-
112
- def initialize: (url: String, ?description: String?) -> void
113
- end
114
-
115
- # Security scheme configuration for OpenAPI documentation
116
- class SecuritySchemeInfo
117
- attr_accessor type: String
118
- attr_accessor scheme: String?
119
- attr_accessor bearer_format: String?
120
- attr_accessor location: String?
121
- attr_accessor name: String?
122
-
123
- def initialize: (type: String, ?scheme: String?, ?bearer_format: String?, ?location: String?, ?name: String?) -> void
124
-
125
- private
126
-
127
- def validate!: () -> void
128
- end
129
-
130
- # OpenAPI 3.1.0 documentation configuration
131
- class OpenApiConfig
132
- attr_accessor enabled: bool
133
- attr_accessor title: String
134
- attr_accessor version: String
135
- attr_accessor description: String?
136
- attr_accessor swagger_ui_path: String
137
- attr_accessor redoc_path: String
138
- attr_accessor openapi_json_path: String
139
- attr_accessor contact: ContactInfo?
140
- attr_accessor license: LicenseInfo?
141
- attr_accessor servers: Array[ServerInfo]
142
- attr_accessor security_schemes: Hash[String, SecuritySchemeInfo]
143
-
144
- def initialize: (
145
- ?enabled: bool,
146
- ?title: String,
147
- ?version: String,
148
- ?description: String?,
149
- ?swagger_ui_path: String,
150
- ?redoc_path: String,
151
- ?openapi_json_path: String,
152
- ?contact: ContactInfo?,
153
- ?license: LicenseInfo?,
154
- ?servers: Array[ServerInfo],
155
- ?security_schemes: Hash[String, SecuritySchemeInfo]
156
- ) -> void
157
- end
158
-
159
- # JSON-RPC endpoint configuration
160
- class JsonRpcConfig
161
- attr_accessor enabled: bool
162
- attr_accessor endpoint_path: String
163
- attr_accessor enable_batch: bool
164
- attr_accessor max_batch_size: Integer
165
-
166
- def initialize: (?enabled: bool, ?endpoint_path: String, ?enable_batch: bool, ?max_batch_size: Integer) -> void
167
-
168
- private
169
-
170
- def normalize_boolean: (String, untyped) -> bool
171
- def normalize_positive_integer: (String, untyped) -> Integer
172
- end
173
-
174
- # Complete server configuration for Spikard
175
- class ServerConfig
176
- attr_accessor host: String
177
- attr_accessor port: Integer
178
- attr_accessor workers: Integer
179
- attr_accessor enable_request_id: bool
180
- attr_accessor max_body_size: Integer?
181
- attr_accessor request_timeout: Integer?
182
- attr_accessor compression: CompressionConfig?
183
- attr_accessor rate_limit: RateLimitConfig?
184
- attr_accessor jwt_auth: JwtConfig?
185
- attr_accessor api_key_auth: ApiKeyConfig?
186
- attr_accessor static_files: Array[StaticFilesConfig]
187
- attr_accessor graceful_shutdown: bool
188
- attr_accessor shutdown_timeout: Integer
189
- attr_accessor openapi: OpenApiConfig?
190
- attr_accessor jsonrpc: JsonRpcConfig?
191
-
192
- def initialize: (
193
- ?host: String,
194
- ?port: Integer,
195
- ?workers: Integer,
196
- ?enable_request_id: bool,
197
- ?max_body_size: Integer?,
198
- ?request_timeout: Integer?,
199
- ?compression: CompressionConfig?,
200
- ?rate_limit: RateLimitConfig?,
201
- ?jwt_auth: JwtConfig?,
202
- ?api_key_auth: ApiKeyConfig?,
203
- ?static_files: Array[StaticFilesConfig],
204
- ?graceful_shutdown: bool,
205
- ?shutdown_timeout: Integer,
206
- ?openapi: OpenApiConfig?,
207
- ?jsonrpc: JsonRpcConfig?
208
- ) -> void
209
-
210
- private
211
-
212
- def normalize_port: (untyped) -> Integer
213
- def normalize_workers: (untyped) -> Integer
214
- def normalize_boolean: (String, untyped) -> bool
215
- def normalize_optional_nonnegative_integer: (String, untyped) -> Integer?
216
- def normalize_timeout: (String, untyped) -> Integer?
217
- def normalize_static_files: (untyped) -> Array[StaticFilesConfig]
218
- end
219
-
220
- # Native-backed HTTP response facade
221
- class Response
222
- attr_reader content: jsonValue
223
- attr_reader status_code: Integer
224
- attr_reader headers: Hash[String, String]
225
- attr_reader native_response: Native::BuiltResponse?
226
-
227
- def initialize: (
228
- ?content: jsonValue,
229
- ?body: jsonValue,
230
- ?status_code: Integer,
231
- ?headers: Hash[String, String]?,
232
- ?content_type: String?
233
- ) -> void
234
- def status: () -> Integer
235
- def status_code=: (Integer) -> Integer
236
- def headers=: (Hash[String, String]?) -> Hash[String, String]
237
- def content=: (jsonValue) -> jsonValue
238
- def set_header: (String, String) -> void
239
- def set_cookie: (
240
- String,
241
- String,
242
- ?max_age: Integer?,
243
- ?domain: String?,
244
- ?path: String?,
245
- ?secure: bool?,
246
- ?httponly: bool?,
247
- ?samesite: String?
248
- ) -> void
249
- def to_native_response: () -> Native::BuiltResponse?
250
-
251
- private
252
-
253
- def rebuild_native!: () -> void
254
- def ensure_native!: () -> void
255
- def cookie_parts: (Hash[Symbol, untyped]) -> Array[String]
256
- def normalize_headers: (untyped) -> Hash[String, String]
257
- end
258
-
259
- # Streaming response wrapper backed by the native Rust builder
260
- class StreamingResponse
261
- attr_reader stream: Enumerator[String, void]
262
- attr_reader status_code: Integer
263
- attr_reader headers: Hash[String, String]
264
- attr_reader native_response: Native::BuiltResponse?
265
-
266
- def initialize: (Enumerable[String], ?status_code: Integer, ?headers: Hash[String, String]?) -> void
267
- def to_native_response: () -> Native::BuiltResponse?
268
-
269
- private
270
-
271
- def rebuild_native!: () -> void
272
- def ensure_native!: () -> void
273
- end
274
-
275
- # File upload handling for multipart/form-data requests
276
- class UploadFile
277
- attr_reader filename: String
278
- attr_reader content_type: String
279
- attr_reader size: Integer
280
- attr_reader headers: Hash[String, String]
281
- attr_reader content: String
282
-
283
- def initialize: (
284
- String filename,
285
- String content,
286
- ?content_type: String?,
287
- ?size: Integer?,
288
- ?headers: Hash[String, String]?,
289
- ?content_encoding: String?
290
- ) -> void
291
- def read: (?Integer?) -> String?
292
- def text: (?encoding: String) -> String
293
- def seek: (Integer, ?Integer) -> Integer
294
- def tell: () -> Integer
295
- alias pos tell
296
- def rewind: () -> Integer
297
- def close: () -> nil
298
- def closed?: () -> bool
299
-
300
- private
301
-
302
- def base64_encoded?: (untyped) -> bool
303
- end
304
-
305
- # Conversion helpers between native Rust values and Ruby types
306
- module Converters
307
- def self.convert_handler_body: (untyped) -> untyped
308
- end
309
-
310
- # Lifecycle hooks support for Spikard applications
311
- module LifecycleHooks
312
- @native_hooks: Native::LifecycleRegistry
313
-
314
- def on_request: () { (Native::Request) -> (untyped | nil) } -> Proc
315
- def pre_validation: () { (Native::Request) -> (untyped | nil) } -> Proc
316
- def pre_handler: () { (Native::Request) -> (untyped | nil) } -> Proc
317
- def on_response: () { (Response) -> (Response | nil) } -> Proc
318
- def on_error: () { (Response) -> (Response | nil) } -> Proc
319
-
320
- private
321
-
322
- def native_hooks: () -> Native::LifecycleRegistry
323
- end
324
-
325
- # Dependency injection support for Spikard applications
326
- module ProvideSupport
327
- @native_dependencies: Native::DependencyRegistry?
328
-
329
- def provide: (
330
- String | Symbol,
331
- ?untyped,
332
- ?depends_on: Array[String | Symbol],
333
- ?singleton: bool,
334
- ?cacheable: bool
335
- ) ?{ (**untyped) -> untyped } -> self
336
- def dependencies: () -> Native::DependencyRegistry
337
-
338
- private
339
-
340
- def ensure_native_dependencies!: () -> Native::DependencyRegistry
341
- end
342
-
343
- # Wrapper class for dependency providers
344
- class Provide
345
- attr_reader factory: Proc | Method
346
- attr_reader depends_on: Array[String]
347
- attr_reader singleton: bool
348
- attr_reader cacheable: bool
349
-
350
- def initialize: (Proc | Method, ?depends_on: Array[String | Symbol], ?singleton: bool, ?cacheable: bool) -> void
351
- def async?: () -> bool
352
- def async_generator?: () -> bool
353
- end
354
-
355
- # Dependency injection handler wrapper
356
- module DIHandlerWrapper
357
- def self.wrap_handler: (Proc, Hash[String, untyped]) -> Proc
358
- def self.resolve_dependency: (Hash[Symbol, untyped], untyped) -> untyped
359
- end
360
-
361
- # Handler wrapper utilities
362
- module HandlerWrapper
363
- def self.wrap_body_handler: () { (untyped) -> (Response | jsonValue) } -> Proc
364
- def self.wrap_handler: () { (untyped, untyped, untyped) -> (Response | jsonValue) } -> Proc
365
- def self.wrap_handler_with_context: () { (Hash[Symbol, untyped]) -> (Response | jsonValue) } -> Proc
366
-
367
- # Instance methods (via module_function)
368
- def wrap_body_handler: () { (untyped) -> (Response | jsonValue) } -> Proc
369
- def wrap_handler: () { (untyped, untyped, untyped) -> (Response | jsonValue) } -> Proc
370
- def wrap_handler_with_context: () { (Hash[Symbol, untyped]) -> (Response | jsonValue) } -> Proc
371
- end
372
-
373
- # Application class: collects route metadata so the Rust engine can execute handlers
374
- class App
375
- include LifecycleHooks
376
- include ProvideSupport
377
-
378
- HTTP_METHODS: Array[String]
379
- SUPPORTED_OPTIONS: Array[Symbol]
380
-
381
- @routes: Array[RouteEntry]
382
- @websocket_handlers: Hash[String, Proc]
383
- @sse_producers: Hash[String, Proc]
384
- @native_hooks: Native::LifecycleRegistry
385
- @native_dependencies: Native::DependencyRegistry?
386
- @named_handlers: Hash[String, Proc]
387
-
388
- attr_reader routes: Array[RouteEntry]
389
-
390
- def initialize: () -> void
391
- def register_route: (String, String, ?handler_name: String?, **untyped) ?{ (Native::Request) -> (Response | jsonValue) } -> Proc?
392
- def get: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
393
- def post: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
394
- def put: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
395
- def patch: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
396
- def delete: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
397
- def options: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
398
- def head: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
399
- def trace: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
400
- def route_metadata: () -> Array[Hash[Symbol, untyped]]
401
- def handler_map: () -> Hash[String, Proc]
402
- def handler: (String | Symbol) { (Native::Request) -> (Response | jsonValue) } -> Proc
403
- def normalized_routes_json: () -> String
404
- def default_handler_name: (String, String) -> String
405
- def websocket: (String, ?_handler_name: String?, **untyped) { () -> WebSocketHandler } -> Proc
406
- def sse: (String, ?_handler_name: String?, **untyped) { () -> SseEventProducer } -> Proc
407
- def websocket_handlers: () -> Hash[String, Proc]
408
- def sse_producers: () -> Hash[String, Proc]
409
- def run: (?config: ServerConfig | Hash[Symbol, untyped]?, ?host: String?, ?port: Integer?) -> void
410
-
411
- private
412
-
413
- def normalize_path: (String) -> String
414
- def validate_route_arguments!: (Proc?, String?, Hash[Symbol, untyped]) -> void
415
- def build_route_metadata_for: (String, String, String?, Hash[Symbol, untyped], Proc?) -> Hash[Symbol, untyped]
416
- def native_route_metadata_supported?: () -> bool
417
- def build_native_route_metadata: (String, String, String?, Hash[Symbol, untyped], Proc?) -> Hash[Symbol, untyped]
418
- def native_route_metadata_args: (String, String, String?, Hash[Symbol, untyped], Proc?, include_jsonrpc: bool) -> Array[untyped]
419
- def build_fallback_route_metadata: (String, String, String?, Hash[Symbol, untyped], Proc?) -> Hash[Symbol, untyped]
420
- def extract_handler_dependencies: (Proc) -> Array[String]
421
- def build_metadata: (String, String, String, Hash[Symbol, untyped], Array[String]) -> Hash[Symbol, untyped]
422
- end
423
-
424
- # Base class for WebSocket message handlers
425
- class WebSocketHandler
426
- def handle_message: (jsonObject) -> jsonObject?
427
- def on_connect: () -> void
428
- def on_disconnect: () -> void
429
- end
430
-
431
- # Server-Sent Event
432
- class SseEvent
433
- attr_accessor data: jsonObject
434
- attr_accessor event_type: String?
435
- attr_accessor id: String?
436
- attr_accessor retry_ms: Integer?
437
-
438
- def initialize: (data: jsonObject, ?event_type: String?, ?id: String?, ?retry_ms: Integer?) -> void
439
- def to_h: () -> Hash[Symbol, jsonValue]
440
- end
441
-
442
- # Base class for SSE event producers
443
- class SseEventProducer
444
- def next_event: () -> SseEvent?
445
- def on_connect: () -> void
446
- def on_disconnect: () -> void
447
- end
448
-
449
- # gRPC support for Spikard
450
- module Grpc
451
- # gRPC request object (implemented in Rust via Magnus FFI)
452
- class Request
453
- def service_name: () -> String
454
- def method_name: () -> String
455
- def payload: () -> String
456
- def metadata: () -> Hash[String, String]
457
- def get_metadata: (String) -> String?
458
- def inspect: () -> String
459
- def to_s: () -> String
460
- end
461
-
462
- # gRPC response object (implemented in Rust via Magnus FFI)
463
- class Response
464
- def self.new: (*untyped) -> Response
465
- def self.error: (String, ?Hash[String, String]) -> Response
466
- def payload: () -> String
467
- def payload=: (String) -> void
468
- def metadata: () -> Hash[String, String]
469
- def metadata=: (Hash[String, String]?) -> void
470
- def inspect: () -> String
471
- def to_s: () -> String
472
- end
473
-
474
- # Base class for gRPC handlers
475
- class Handler
476
- def handle_request: (Request) -> Response
477
- end
478
-
479
- # Service registry for gRPC handlers
480
- class Service
481
- @handlers: Hash[String, Handler]
482
-
483
- def initialize: () -> void
484
- def register_handler: (String, Handler) -> void
485
- def get_handler: (String) -> Handler?
486
- def service_names: () -> Array[String]
487
- def registered?: (String) -> bool
488
- end
489
- end
490
-
491
- # Schema extraction helpers for Ruby type systems
492
- module Schema
493
- def self.extract_json_schema: (untyped) -> jsonObject?
494
- end
495
-
496
- # Native Rust extension module (implemented via Magnus FFI)
497
- module Native
498
- def self.run_server: (
499
- String,
500
- Hash[String | Symbol, Proc],
501
- ServerConfig,
502
- LifecycleRegistry,
503
- Hash[String, Proc],
504
- Hash[String, Proc],
505
- DependencyRegistry
506
- ) -> void
507
- def self.normalize_route_metadata: (String) -> String
508
- def self.background_run: (Proc) -> void
509
- def self.build_route_metadata: (*untyped) -> Hash[Symbol, untyped]
510
- def self.build_response: (jsonValue, Integer, Hash[String, String]) -> BuiltResponse?
511
- def self.build_streaming_response: (Enumerator[String, void], Integer, Hash[String, String]) -> BuiltResponse?
512
-
513
- # Built HTTP response from Rust
514
- class BuiltResponse
515
- def status_code: () -> Integer
516
- def headers: () -> Hash[String, String]
517
- end
518
-
519
- # Lazy-cached native request object
520
- class Request
521
- def method: () -> String
522
- def path: () -> String
523
- def path_params: () -> Hash[String, untyped]
524
- def query: () -> Hash[String, untyped]
525
- def raw_query: () -> Hash[String, Array[String]]
526
- def headers: () -> Hash[String, String]
527
- def cookies: () -> Hash[String, String]
528
- def body: () -> untyped
529
- def raw_body: () -> String?
530
- def params: () -> Hash[String, untyped]
531
- def to_h: () -> Hash[Symbol, untyped]
532
- def []: (String | Symbol) -> untyped
533
- end
534
-
535
- # Lifecycle hook registry (implemented in Rust)
536
- class LifecycleRegistry
537
- def initialize: () -> void
538
- def add_on_request: (Proc) -> void
539
- def add_pre_validation: (Proc) -> void
540
- def add_pre_handler: (Proc) -> void
541
- def pre_handler: (Proc) -> void
542
- def add_on_response: (Proc) -> void
543
- def on_response: (Proc) -> void
544
- def add_on_error: (Proc) -> void
545
- def on_error: (Proc) -> void
546
- end
547
-
548
- # Dependency injection registry (implemented in Rust)
549
- class DependencyRegistry
550
- def initialize: () -> void
551
- def register_value: (String, untyped) -> void
552
- def register_factory: (String, Proc, Array[String], bool, bool) -> void
553
- def keys: () -> Array[String]
554
- def resolve: (String) -> untyped
555
- end
556
-
557
- # Native test client (implemented in Rust)
558
- class TestClient
559
- def initialize: (String, Hash[Symbol, Proc], ServerConfig, Hash[String, Proc], Hash[String, Proc], Hash[Symbol, untyped]) -> void
560
- def request: (String, String, Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
561
- def websocket: (String) -> WebSocketTestConnection
562
- def sse: (String) -> SseStream
563
- def graphql: (String, Hash[String, untyped]?, String?) -> Hash[Symbol, untyped]
564
- def graphql_with_status: (String, Hash[String, untyped]?, String?) -> Hash[Symbol, untyped]
565
- def close: () -> void
566
- end
567
-
568
- # Native WebSocket test connection (implemented in Rust)
569
- class WebSocketTestConnection
570
- def send_text: (String) -> void
571
- def send_json: (untyped) -> void
572
- def receive_text: () -> String
573
- def receive_json: () -> untyped
574
- def receive_bytes: () -> String
575
- def receive_message: () -> WebSocketMessage
576
- def close: () -> void
577
- end
578
-
579
- # Native WebSocket message (implemented in Rust)
580
- class WebSocketMessage
581
- def as_text: () -> String?
582
- def as_json: () -> untyped
583
- def as_binary: () -> String?
584
- def is_close: () -> bool
585
- end
586
-
587
- # Native SSE stream (implemented in Rust)
588
- class SseStream
589
- def body: () -> String
590
- def events: () -> Array[SseEvent]
591
- def events_as_json: () -> Array[untyped]
592
- end
593
-
594
- # Native SSE event (implemented in Rust)
595
- class SseEvent
596
- def data: () -> String
597
- def as_json: () -> untyped
598
- end
599
- end
600
-
601
- # Testing helpers that wrap the native Ruby extension
602
- module Testing
603
- GRAPHQL_WS_MAX_CONTROL_MESSAGES: Integer
604
-
605
- def self.create_test_client: (App, ?config: ServerConfig?) -> Testing::TestClient
606
- def self.ensure_native_test_client!: () -> void
607
- def self.resolve_test_config: (App, ServerConfig?) -> ServerConfig
608
- def self.build_native_test_client: (App, ServerConfig) -> Native::TestClient
609
- def self.trace: (String) -> void
610
-
611
- # Lightweight response wrapper used by the test client
612
- class Response
613
- attr_reader status_code: Integer
614
- attr_reader headers: Hash[String, String]
615
- attr_reader body: String?
616
-
617
- @body_text: String?
618
-
619
- def initialize: (Hash[Symbol, untyped]) -> void
620
- def status: () -> Integer
621
- def body_bytes: () -> String
622
- def body_text: () -> String?
623
- def text: () -> String?
624
- def json: () -> jsonValue
625
- def bytes: () -> Array[Integer]
626
- end
627
-
628
- # High level wrapper around the native test client
629
- class TestClient
630
- @native: Native::TestClient
631
-
632
- def initialize: (Native::TestClient) -> void
633
- def self.new: (App | Native::TestClient, ?config: ServerConfig?) -> TestClient
634
- def request: (String, String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
635
- def websocket: (String) -> WebSocketTestConnection
636
- def sse: (String) -> SseStream
637
- def graphql: (String, ?Hash[String, untyped]?, ?String?, ?path: String) -> Response
638
- def graphql_with_status: (String, ?Hash[String, untyped]?, ?String?, ?path: String) -> [Integer, Response]
639
- def graphql_subscription: (String, ?Hash[String, untyped]?, ?String?, ?path: String) -> Hash[String, untyped]
640
- def close: () -> void
641
- def get: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
642
- def post: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
643
- def put: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
644
- def patch: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
645
- def delete: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
646
- def head: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
647
- def options: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
648
- def trace: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
649
-
650
- private
651
-
652
- def build_request_payload: (Hash[String, String]?, untyped, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
653
- def body_payload_from: (Hash[Symbol, untyped], untyped) -> Hash[Symbol, untyped]
654
- def explicit_body_payload: (untyped, untyped, untyped, untyped) -> Hash[Symbol, untyped]
655
- def websocket_protocol_message: (untyped) -> Hash[String, untyped]
656
- def websocket_field: (Hash[String | Symbol, untyped], Symbol) -> untyped
657
- end
658
-
659
- # WebSocket test connection wrapper
660
- class WebSocketTestConnection
661
- @native_ws: Native::WebSocketTestConnection
662
-
663
- def initialize: (Native::WebSocketTestConnection) -> void
664
- def send_text: (String) -> void
665
- def send_json: (jsonValue) -> void
666
- def receive_text: () -> untyped
667
- def receive_json: () -> untyped
668
- def receive_bytes: () -> untyped
669
- def receive_message: () -> WebSocketMessage
670
- def close: () -> void
671
-
672
- private
673
-
674
- def with_timeout: [T] () { () -> T } -> T
675
- end
676
-
677
- # WebSocket message wrapper
678
- class WebSocketMessage
679
- @native_msg: Native::WebSocketMessage
680
-
681
- def initialize: (Native::WebSocketMessage) -> void
682
- def as_text: () -> untyped
683
- def as_json: () -> untyped
684
- def as_binary: () -> String?
685
- def close?: () -> bool
686
- end
687
-
688
- # SSE stream wrapper
689
- class SseStream
690
- @native_sse: Native::SseStream
691
-
692
- def initialize: (Native::SseStream) -> void
693
- def body: () -> String?
694
- def events: () -> Array[InlineSseEvent]
695
- def events_as_json: () -> jsonArray
696
-
697
- private
698
-
699
- def parsed_chunks: () -> Array[String]
700
- end
701
-
702
- # SSE event wrapper (wraps native event)
703
- class SseEvent
704
- @native_event: Native::SseEvent
705
-
706
- def initialize: (Native::SseEvent) -> void
707
- def data: () -> untyped
708
- def as_json: () -> untyped
709
- end
710
-
711
- # Lightweight wrapper for parsed SSE events backed by strings
712
- class InlineSseEvent
713
- attr_reader data: String
714
-
715
- def initialize: (String) -> void
716
- def as_json: () -> jsonValue
717
- end
718
- end
719
- end