spikard 0.13.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.
- checksums.yaml +4 -4
- data/Steepfile +6 -0
- data/ext/spikard_rb/extconf.rb +1 -2
- data/ext/spikard_rb/{Cargo.lock → native/Cargo.lock} +819 -424
- data/ext/spikard_rb/native/Cargo.toml +24 -0
- data/ext/spikard_rb/src/lib.rs +5366 -3
- data/lib/spikard/native.rb +86 -0
- data/lib/spikard/version.rb +6 -1
- data/lib/spikard.rb +8 -52
- data/lib/spikard_rb.so +0 -0
- data/sig/types.rbs +427 -0
- metadata +14 -243
- data/LICENSE +0 -1
- data/README.md +0 -285
- data/ext/spikard_rb/Cargo.toml +0 -17
- data/lib/spikard/app.rb +0 -458
- data/lib/spikard/background.rb +0 -58
- data/lib/spikard/config.rb +0 -506
- data/lib/spikard/converters.rb +0 -13
- data/lib/spikard/grpc.rb +0 -232
- data/lib/spikard/handler_wrapper.rb +0 -113
- data/lib/spikard/provide.rb +0 -315
- data/lib/spikard/response.rb +0 -198
- data/lib/spikard/schema.rb +0 -243
- data/lib/spikard/sse.rb +0 -111
- data/lib/spikard/streaming_response.rb +0 -44
- data/lib/spikard/testing.rb +0 -474
- data/lib/spikard/upload_file.rb +0 -131
- data/lib/spikard/websocket.rb +0 -59
- data/sig/spikard.rbs +0 -739
- data/vendor/crates/spikard-bindings-shared/Cargo.toml +0 -75
- data/vendor/crates/spikard-bindings-shared/examples/config_extraction.rs +0 -132
- data/vendor/crates/spikard-bindings-shared/src/config_extractor.rs +0 -905
- data/vendor/crates/spikard-bindings-shared/src/conversion_traits.rs +0 -210
- data/vendor/crates/spikard-bindings-shared/src/di_traits.rs +0 -252
- data/vendor/crates/spikard-bindings-shared/src/error_response.rs +0 -404
- data/vendor/crates/spikard-bindings-shared/src/grpc_metadata.rs +0 -199
- data/vendor/crates/spikard-bindings-shared/src/handler_base.rs +0 -252
- data/vendor/crates/spikard-bindings-shared/src/json_conversion.rs +0 -829
- data/vendor/crates/spikard-bindings-shared/src/lazy_cache.rs +0 -587
- data/vendor/crates/spikard-bindings-shared/src/lib.rs +0 -33
- data/vendor/crates/spikard-bindings-shared/src/lifecycle_base.rs +0 -298
- data/vendor/crates/spikard-bindings-shared/src/lifecycle_executor.rs +0 -594
- data/vendor/crates/spikard-bindings-shared/src/response_builder.rs +0 -743
- data/vendor/crates/spikard-bindings-shared/src/response_interpreter.rs +0 -944
- data/vendor/crates/spikard-bindings-shared/src/test_client_base.rs +0 -260
- data/vendor/crates/spikard-bindings-shared/src/validation_helpers.rs +0 -369
- data/vendor/crates/spikard-bindings-shared/tests/config_extractor_behavior.rs +0 -192
- data/vendor/crates/spikard-bindings-shared/tests/error_response_edge_cases.rs +0 -383
- data/vendor/crates/spikard-bindings-shared/tests/full_coverage.rs +0 -459
- data/vendor/crates/spikard-bindings-shared/tests/handler_base_integration.rs +0 -280
- data/vendor/crates/spikard-bindings-shared/tests/integration_tests.rs +0 -669
- data/vendor/crates/spikard-core/Cargo.toml +0 -55
- data/vendor/crates/spikard-core/src/bindings/mod.rs +0 -3
- data/vendor/crates/spikard-core/src/bindings/response.rs +0 -130
- data/vendor/crates/spikard-core/src/debug.rs +0 -127
- data/vendor/crates/spikard-core/src/di/container.rs +0 -711
- data/vendor/crates/spikard-core/src/di/dependency.rs +0 -273
- data/vendor/crates/spikard-core/src/di/error.rs +0 -118
- data/vendor/crates/spikard-core/src/di/factory.rs +0 -548
- data/vendor/crates/spikard-core/src/di/graph.rs +0 -507
- data/vendor/crates/spikard-core/src/di/mod.rs +0 -192
- data/vendor/crates/spikard-core/src/di/resolved.rs +0 -428
- data/vendor/crates/spikard-core/src/di/value.rs +0 -282
- data/vendor/crates/spikard-core/src/errors.rs +0 -72
- data/vendor/crates/spikard-core/src/http.rs +0 -492
- data/vendor/crates/spikard-core/src/lib.rs +0 -29
- data/vendor/crates/spikard-core/src/lifecycle.rs +0 -1273
- data/vendor/crates/spikard-core/src/metadata.rs +0 -378
- data/vendor/crates/spikard-core/src/parameters.rs +0 -2546
- data/vendor/crates/spikard-core/src/problem.rs +0 -358
- data/vendor/crates/spikard-core/src/request_data.rs +0 -1146
- data/vendor/crates/spikard-core/src/router.rs +0 -530
- data/vendor/crates/spikard-core/src/schema_registry.rs +0 -197
- data/vendor/crates/spikard-core/src/type_hints.rs +0 -311
- data/vendor/crates/spikard-core/src/validation/error_mapper.rs +0 -710
- data/vendor/crates/spikard-core/src/validation/mod.rs +0 -470
- data/vendor/crates/spikard-core/tests/bindings_response_tests.rs +0 -136
- data/vendor/crates/spikard-core/tests/di_dependency_defaults.rs +0 -37
- data/vendor/crates/spikard-core/tests/error_mapper.rs +0 -761
- data/vendor/crates/spikard-core/tests/parameters_edge_cases.rs +0 -106
- data/vendor/crates/spikard-core/tests/parameters_full.rs +0 -701
- data/vendor/crates/spikard-core/tests/parameters_schema_and_formats.rs +0 -301
- data/vendor/crates/spikard-core/tests/request_data_roundtrip.rs +0 -67
- data/vendor/crates/spikard-core/tests/validation_coverage.rs +0 -250
- data/vendor/crates/spikard-core/tests/validation_error_paths.rs +0 -45
- data/vendor/crates/spikard-http/Cargo.toml +0 -82
- data/vendor/crates/spikard-http/examples/sse-notifications.rs +0 -148
- data/vendor/crates/spikard-http/examples/websocket-chat.rs +0 -92
- data/vendor/crates/spikard-http/src/auth.rs +0 -301
- data/vendor/crates/spikard-http/src/background.rs +0 -1859
- data/vendor/crates/spikard-http/src/bindings/mod.rs +0 -3
- data/vendor/crates/spikard-http/src/bindings/response.rs +0 -1
- data/vendor/crates/spikard-http/src/body_metadata.rs +0 -8
- data/vendor/crates/spikard-http/src/cors.rs +0 -1026
- data/vendor/crates/spikard-http/src/debug.rs +0 -128
- data/vendor/crates/spikard-http/src/di_handler.rs +0 -1672
- data/vendor/crates/spikard-http/src/grpc/framing.rs +0 -653
- data/vendor/crates/spikard-http/src/grpc/handler.rs +0 -1211
- data/vendor/crates/spikard-http/src/grpc/mod.rs +0 -556
- data/vendor/crates/spikard-http/src/grpc/service.rs +0 -706
- data/vendor/crates/spikard-http/src/grpc/streaming.rs +0 -319
- data/vendor/crates/spikard-http/src/handler_response.rs +0 -901
- data/vendor/crates/spikard-http/src/handler_trait.rs +0 -1015
- data/vendor/crates/spikard-http/src/handler_trait_tests.rs +0 -290
- data/vendor/crates/spikard-http/src/jsonrpc/http_handler.rs +0 -502
- data/vendor/crates/spikard-http/src/jsonrpc/method_registry.rs +0 -648
- data/vendor/crates/spikard-http/src/jsonrpc/mod.rs +0 -60
- data/vendor/crates/spikard-http/src/jsonrpc/openrpc.rs +0 -325
- data/vendor/crates/spikard-http/src/jsonrpc/protocol.rs +0 -1207
- data/vendor/crates/spikard-http/src/jsonrpc/router.rs +0 -2262
- data/vendor/crates/spikard-http/src/lib.rs +0 -566
- data/vendor/crates/spikard-http/src/lifecycle/adapter.rs +0 -230
- data/vendor/crates/spikard-http/src/lifecycle.rs +0 -1193
- data/vendor/crates/spikard-http/src/middleware/mod.rs +0 -560
- data/vendor/crates/spikard-http/src/middleware/multipart.rs +0 -912
- data/vendor/crates/spikard-http/src/middleware/urlencoded.rs +0 -513
- data/vendor/crates/spikard-http/src/middleware/validation.rs +0 -768
- data/vendor/crates/spikard-http/src/openapi/mod.rs +0 -309
- data/vendor/crates/spikard-http/src/openapi/parameter_extraction.rs +0 -535
- data/vendor/crates/spikard-http/src/openapi/schema_conversion.rs +0 -1363
- data/vendor/crates/spikard-http/src/openapi/spec_generation.rs +0 -667
- data/vendor/crates/spikard-http/src/query_parser.rs +0 -793
- data/vendor/crates/spikard-http/src/response.rs +0 -720
- data/vendor/crates/spikard-http/src/server/fast_router.rs +0 -186
- data/vendor/crates/spikard-http/src/server/grpc_routing.rs +0 -1243
- data/vendor/crates/spikard-http/src/server/handler.rs +0 -1661
- data/vendor/crates/spikard-http/src/server/lifecycle_execution.rs +0 -253
- data/vendor/crates/spikard-http/src/server/mod.rs +0 -1717
- data/vendor/crates/spikard-http/src/server/request_extraction.rs +0 -871
- data/vendor/crates/spikard-http/src/server/routing_factory.rs +0 -618
- data/vendor/crates/spikard-http/src/sse.rs +0 -1409
- data/vendor/crates/spikard-http/src/testing/form.rs +0 -52
- data/vendor/crates/spikard-http/src/testing/multipart.rs +0 -64
- data/vendor/crates/spikard-http/src/testing/test_client.rs +0 -825
- data/vendor/crates/spikard-http/src/testing.rs +0 -617
- data/vendor/crates/spikard-http/src/websocket.rs +0 -1477
- data/vendor/crates/spikard-http/tests/auth_integration.rs +0 -645
- data/vendor/crates/spikard-http/tests/background_behavior.rs +0 -832
- data/vendor/crates/spikard-http/tests/common/grpc_helpers.rs +0 -1012
- data/vendor/crates/spikard-http/tests/common/handlers.rs +0 -309
- data/vendor/crates/spikard-http/tests/common/mod.rs +0 -33
- data/vendor/crates/spikard-http/tests/common/test_builders.rs +0 -628
- data/vendor/crates/spikard-http/tests/di_handler_error_responses.rs +0 -162
- data/vendor/crates/spikard-http/tests/di_integration.rs +0 -192
- data/vendor/crates/spikard-http/tests/doc_snippets.rs +0 -5
- data/vendor/crates/spikard-http/tests/grpc_bidirectional_streaming.rs +0 -430
- data/vendor/crates/spikard-http/tests/grpc_client_streaming.rs +0 -738
- data/vendor/crates/spikard-http/tests/grpc_error_handling_test.rs +0 -652
- data/vendor/crates/spikard-http/tests/grpc_integration_test.rs +0 -334
- data/vendor/crates/spikard-http/tests/grpc_metadata_test.rs +0 -532
- data/vendor/crates/spikard-http/tests/grpc_server_integration.rs +0 -495
- data/vendor/crates/spikard-http/tests/grpc_server_streaming.rs +0 -975
- data/vendor/crates/spikard-http/tests/lifecycle_execution.rs +0 -1093
- data/vendor/crates/spikard-http/tests/middleware_stack_integration.rs +0 -389
- data/vendor/crates/spikard-http/tests/multipart_behavior.rs +0 -656
- data/vendor/crates/spikard-http/tests/request_extraction_full.rs +0 -513
- data/vendor/crates/spikard-http/tests/server_auth_middleware_behavior.rs +0 -328
- data/vendor/crates/spikard-http/tests/server_config_builder.rs +0 -335
- data/vendor/crates/spikard-http/tests/server_configured_router_behavior.rs +0 -374
- data/vendor/crates/spikard-http/tests/server_cors_preflight.rs +0 -83
- data/vendor/crates/spikard-http/tests/server_handler_wrappers.rs +0 -464
- data/vendor/crates/spikard-http/tests/server_method_router_additional_behavior.rs +0 -286
- data/vendor/crates/spikard-http/tests/server_method_router_coverage.rs +0 -118
- data/vendor/crates/spikard-http/tests/server_middleware_behavior.rs +0 -99
- data/vendor/crates/spikard-http/tests/server_middleware_branches.rs +0 -204
- data/vendor/crates/spikard-http/tests/server_openapi_jsonrpc_static.rs +0 -427
- data/vendor/crates/spikard-http/tests/server_router_behavior.rs +0 -121
- data/vendor/crates/spikard-http/tests/sse_behavior.rs +0 -620
- data/vendor/crates/spikard-http/tests/sse_full_behavior.rs +0 -584
- data/vendor/crates/spikard-http/tests/sse_handler_behavior.rs +0 -130
- data/vendor/crates/spikard-http/tests/test_client_requests.rs +0 -167
- data/vendor/crates/spikard-http/tests/testing_helpers.rs +0 -87
- data/vendor/crates/spikard-http/tests/testing_module_coverage.rs +0 -155
- data/vendor/crates/spikard-http/tests/urlencoded_content_type.rs +0 -82
- data/vendor/crates/spikard-http/tests/websocket_behavior.rs +0 -663
- data/vendor/crates/spikard-http/tests/websocket_full_behavior.rs +0 -440
- data/vendor/crates/spikard-http/tests/websocket_integration.rs +0 -150
- data/vendor/crates/spikard-rb/Cargo.toml +0 -63
- data/vendor/crates/spikard-rb/build.rs +0 -200
- data/vendor/crates/spikard-rb/src/background.rs +0 -63
- data/vendor/crates/spikard-rb/src/config/mod.rs +0 -5
- data/vendor/crates/spikard-rb/src/config/server_config.rs +0 -401
- data/vendor/crates/spikard-rb/src/conversion.rs +0 -688
- data/vendor/crates/spikard-rb/src/di/builder.rs +0 -100
- data/vendor/crates/spikard-rb/src/di/mod.rs +0 -410
- data/vendor/crates/spikard-rb/src/grpc/handler.rs +0 -875
- data/vendor/crates/spikard-rb/src/grpc/mod.rs +0 -13
- data/vendor/crates/spikard-rb/src/gvl.rs +0 -80
- data/vendor/crates/spikard-rb/src/handler.rs +0 -699
- data/vendor/crates/spikard-rb/src/integration/mod.rs +0 -3
- data/vendor/crates/spikard-rb/src/lib.rs +0 -2268
- data/vendor/crates/spikard-rb/src/lifecycle.rs +0 -334
- data/vendor/crates/spikard-rb/src/metadata/mod.rs +0 -5
- data/vendor/crates/spikard-rb/src/metadata/route_extraction.rs +0 -507
- data/vendor/crates/spikard-rb/src/request.rs +0 -439
- data/vendor/crates/spikard-rb/src/runtime/mod.rs +0 -5
- data/vendor/crates/spikard-rb/src/runtime/server_runner.rs +0 -368
- data/vendor/crates/spikard-rb/src/server.rs +0 -304
- data/vendor/crates/spikard-rb/src/sse.rs +0 -231
- data/vendor/crates/spikard-rb/src/testing/client.rs +0 -698
- data/vendor/crates/spikard-rb/src/testing/mod.rs +0 -7
- data/vendor/crates/spikard-rb/src/testing/sse.rs +0 -108
- data/vendor/crates/spikard-rb/src/testing/websocket.rs +0 -573
- data/vendor/crates/spikard-rb/src/websocket.rs +0 -521
- data/vendor/crates/spikard-rb-macros/Cargo.toml +0 -20
- data/vendor/crates/spikard-rb-macros/src/lib.rs +0 -51
data/sig/spikard.rbs
DELETED
|
@@ -1,739 +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: (
|
|
359
|
-
Hash[Symbol, untyped],
|
|
360
|
-
untyped,
|
|
361
|
-
?Hash[String, untyped],
|
|
362
|
-
?Hash[String, untyped],
|
|
363
|
-
?Hash[String, untyped],
|
|
364
|
-
?Array[String]
|
|
365
|
-
) -> untyped
|
|
366
|
-
def self.resolve_dependency_by_key: (
|
|
367
|
-
String,
|
|
368
|
-
Hash[String, untyped],
|
|
369
|
-
untyped,
|
|
370
|
-
Hash[String, untyped],
|
|
371
|
-
Hash[String, untyped],
|
|
372
|
-
Array[String]
|
|
373
|
-
) -> untyped
|
|
374
|
-
end
|
|
375
|
-
|
|
376
|
-
# Handler wrapper utilities
|
|
377
|
-
module HandlerWrapper
|
|
378
|
-
def self.wrap_body_handler: () { (untyped) -> (Response | jsonValue) } -> Proc
|
|
379
|
-
def self.wrap_handler: () { (untyped, untyped, untyped) -> (Response | jsonValue) } -> Proc
|
|
380
|
-
def self.wrap_handler_with_context: () { (Hash[Symbol, untyped]) -> (Response | jsonValue) } -> Proc
|
|
381
|
-
|
|
382
|
-
# Instance methods (via module_function)
|
|
383
|
-
def wrap_body_handler: () { (untyped) -> (Response | jsonValue) } -> Proc
|
|
384
|
-
def wrap_handler: () { (untyped, untyped, untyped) -> (Response | jsonValue) } -> Proc
|
|
385
|
-
def wrap_handler_with_context: () { (Hash[Symbol, untyped]) -> (Response | jsonValue) } -> Proc
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
# Application class: collects route metadata so the Rust engine can execute handlers
|
|
389
|
-
class App
|
|
390
|
-
include LifecycleHooks
|
|
391
|
-
include ProvideSupport
|
|
392
|
-
|
|
393
|
-
HTTP_METHODS: Array[String]
|
|
394
|
-
SUPPORTED_OPTIONS: Array[Symbol]
|
|
395
|
-
|
|
396
|
-
@routes: Array[RouteEntry]
|
|
397
|
-
@websocket_handlers: Hash[String, Proc]
|
|
398
|
-
@sse_producers: Hash[String, Proc]
|
|
399
|
-
@grpc_services: Hash[String, untyped]
|
|
400
|
-
@native_hooks: Native::LifecycleRegistry
|
|
401
|
-
@native_dependencies: Native::DependencyRegistry?
|
|
402
|
-
@named_handlers: Hash[String, Proc]
|
|
403
|
-
|
|
404
|
-
attr_reader routes: Array[RouteEntry]
|
|
405
|
-
|
|
406
|
-
def initialize: () -> void
|
|
407
|
-
def register_route: (String, String, ?handler_name: String?, **untyped) ?{ (Native::Request) -> (Response | jsonValue) } -> Proc?
|
|
408
|
-
def get: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
409
|
-
def post: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
410
|
-
def put: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
411
|
-
def patch: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
412
|
-
def delete: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
413
|
-
def options: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
414
|
-
def head: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
415
|
-
def trace: (String, ?handler_name: String?, **untyped) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
416
|
-
def route_metadata: () -> Array[Hash[Symbol, untyped]]
|
|
417
|
-
def handler_map: () -> Hash[String, Proc]
|
|
418
|
-
def handler: (String | Symbol) { (Native::Request) -> (Response | jsonValue) } -> Proc
|
|
419
|
-
def normalized_routes_json: () -> String
|
|
420
|
-
def default_handler_name: (String, String) -> String
|
|
421
|
-
def websocket: (String, ?_handler_name: String?, **untyped) { () -> WebSocketHandler } -> Proc
|
|
422
|
-
def sse: (String, ?_handler_name: String?, **untyped) { () -> SseEventProducer } -> Proc
|
|
423
|
-
def websocket_handlers: () -> Hash[String, Proc]
|
|
424
|
-
def sse_producers: () -> Hash[String, Proc]
|
|
425
|
-
def add_grpc_service: (String, untyped) -> self
|
|
426
|
-
def use_grpc: (Grpc::Service) -> self
|
|
427
|
-
def grpc_services: () -> Hash[String, untyped]
|
|
428
|
-
def run: (?config: ServerConfig | Hash[Symbol, untyped]?) -> void
|
|
429
|
-
|
|
430
|
-
private
|
|
431
|
-
|
|
432
|
-
def normalize_path: (String) -> String
|
|
433
|
-
def validate_route_arguments!: (Proc?, String?, Hash[Symbol, untyped]) -> void
|
|
434
|
-
def build_route_metadata_for: (String, String, String?, Hash[Symbol, untyped], Proc?) -> Hash[Symbol, untyped]
|
|
435
|
-
def native_route_metadata_supported?: () -> bool
|
|
436
|
-
def build_native_route_metadata: (String, String, String?, Hash[Symbol, untyped], Proc?) -> Hash[Symbol, untyped]
|
|
437
|
-
def native_route_metadata_args: (String, String, String?, Hash[Symbol, untyped], Proc?, include_jsonrpc: bool) -> Array[untyped]
|
|
438
|
-
def build_fallback_route_metadata: (String, String, String?, Hash[Symbol, untyped], Proc?) -> Hash[Symbol, untyped]
|
|
439
|
-
def extract_handler_dependencies: (Proc) -> Array[String]
|
|
440
|
-
def build_metadata: (String, String, String, Hash[Symbol, untyped], Array[String]) -> Hash[Symbol, untyped]
|
|
441
|
-
end
|
|
442
|
-
|
|
443
|
-
# Base class for WebSocket message handlers
|
|
444
|
-
class WebSocketHandler
|
|
445
|
-
def handle_message: (jsonObject) -> jsonObject?
|
|
446
|
-
def on_connect: () -> void
|
|
447
|
-
def on_disconnect: () -> void
|
|
448
|
-
end
|
|
449
|
-
|
|
450
|
-
# Server-Sent Event
|
|
451
|
-
class SseEvent
|
|
452
|
-
attr_accessor data: jsonObject
|
|
453
|
-
attr_accessor event_type: String?
|
|
454
|
-
attr_accessor id: String?
|
|
455
|
-
attr_accessor retry_ms: Integer?
|
|
456
|
-
|
|
457
|
-
def initialize: (data: jsonObject, ?event_type: String?, ?id: String?, ?retry_ms: Integer?) -> void
|
|
458
|
-
def to_h: () -> Hash[Symbol, jsonValue]
|
|
459
|
-
end
|
|
460
|
-
|
|
461
|
-
# Base class for SSE event producers
|
|
462
|
-
class SseEventProducer
|
|
463
|
-
def next_event: () -> SseEvent?
|
|
464
|
-
def on_connect: () -> void
|
|
465
|
-
def on_disconnect: () -> void
|
|
466
|
-
end
|
|
467
|
-
|
|
468
|
-
# gRPC support for Spikard
|
|
469
|
-
module Grpc
|
|
470
|
-
# gRPC request object (implemented in Rust via Magnus FFI)
|
|
471
|
-
class Request
|
|
472
|
-
def service_name: () -> String
|
|
473
|
-
def method_name: () -> String
|
|
474
|
-
def payload: () -> String
|
|
475
|
-
def metadata: () -> Hash[String, String]
|
|
476
|
-
def get_metadata: (String) -> String?
|
|
477
|
-
def inspect: () -> String
|
|
478
|
-
def to_s: () -> String
|
|
479
|
-
end
|
|
480
|
-
|
|
481
|
-
# gRPC response object (implemented in Rust via Magnus FFI)
|
|
482
|
-
class Response
|
|
483
|
-
def self.new: (*untyped) -> Response
|
|
484
|
-
def self.error: (String, ?Hash[String, String]) -> Response
|
|
485
|
-
def payload: () -> String
|
|
486
|
-
def payload=: (String) -> void
|
|
487
|
-
def metadata: () -> Hash[String, String]
|
|
488
|
-
def metadata=: (Hash[String, String]?) -> void
|
|
489
|
-
def inspect: () -> String
|
|
490
|
-
def to_s: () -> String
|
|
491
|
-
end
|
|
492
|
-
|
|
493
|
-
# Base class for gRPC handlers
|
|
494
|
-
class Handler
|
|
495
|
-
def handle_request: (Request) -> Response
|
|
496
|
-
end
|
|
497
|
-
|
|
498
|
-
# Service registry for gRPC handlers
|
|
499
|
-
class Service
|
|
500
|
-
@handlers: Hash[String, Handler]
|
|
501
|
-
|
|
502
|
-
def initialize: () -> void
|
|
503
|
-
def register_handler: (String, Handler) -> void
|
|
504
|
-
def get_handler: (String) -> Handler?
|
|
505
|
-
def service_names: () -> Array[String]
|
|
506
|
-
def registered?: (String) -> bool
|
|
507
|
-
end
|
|
508
|
-
end
|
|
509
|
-
|
|
510
|
-
# Schema extraction helpers for Ruby type systems
|
|
511
|
-
module Schema
|
|
512
|
-
def self.extract_json_schema: (untyped) -> jsonObject?
|
|
513
|
-
end
|
|
514
|
-
|
|
515
|
-
# Native Rust extension module (implemented via Magnus FFI)
|
|
516
|
-
module Native
|
|
517
|
-
def self.run_server: (
|
|
518
|
-
String,
|
|
519
|
-
Hash[String | Symbol, Proc],
|
|
520
|
-
ServerConfig,
|
|
521
|
-
LifecycleRegistry,
|
|
522
|
-
Hash[String, Proc],
|
|
523
|
-
Hash[String, Proc],
|
|
524
|
-
Hash[String, untyped],
|
|
525
|
-
DependencyRegistry
|
|
526
|
-
) -> void
|
|
527
|
-
def self.normalize_route_metadata: (String) -> String
|
|
528
|
-
def self.background_run: (Proc) -> void
|
|
529
|
-
def self.build_route_metadata: (*untyped) -> Hash[Symbol, untyped]
|
|
530
|
-
def self.build_response: (jsonValue, Integer, Hash[String, String]) -> BuiltResponse?
|
|
531
|
-
def self.build_streaming_response: (Enumerator[String, void], Integer, Hash[String, String]) -> BuiltResponse?
|
|
532
|
-
|
|
533
|
-
# Built HTTP response from Rust
|
|
534
|
-
class BuiltResponse
|
|
535
|
-
def status_code: () -> Integer
|
|
536
|
-
def headers: () -> Hash[String, String]
|
|
537
|
-
end
|
|
538
|
-
|
|
539
|
-
# Lazy-cached native request object
|
|
540
|
-
class Request
|
|
541
|
-
def method: () -> String
|
|
542
|
-
def path: () -> String
|
|
543
|
-
def path_params: () -> Hash[String, untyped]
|
|
544
|
-
def query: () -> Hash[String, untyped]
|
|
545
|
-
def raw_query: () -> Hash[String, Array[String]]
|
|
546
|
-
def headers: () -> Hash[String, String]
|
|
547
|
-
def cookies: () -> Hash[String, String]
|
|
548
|
-
def body: () -> untyped
|
|
549
|
-
def raw_body: () -> String?
|
|
550
|
-
def params: () -> Hash[String, untyped]
|
|
551
|
-
def to_h: () -> Hash[Symbol, untyped]
|
|
552
|
-
def []: (String | Symbol) -> untyped
|
|
553
|
-
end
|
|
554
|
-
|
|
555
|
-
# Lifecycle hook registry (implemented in Rust)
|
|
556
|
-
class LifecycleRegistry
|
|
557
|
-
def initialize: () -> void
|
|
558
|
-
def add_on_request: (Proc) -> void
|
|
559
|
-
def add_pre_validation: (Proc) -> void
|
|
560
|
-
def add_pre_handler: (Proc) -> void
|
|
561
|
-
def pre_handler: (Proc) -> void
|
|
562
|
-
def add_on_response: (Proc) -> void
|
|
563
|
-
def on_response: (Proc) -> void
|
|
564
|
-
def add_on_error: (Proc) -> void
|
|
565
|
-
def on_error: (Proc) -> void
|
|
566
|
-
end
|
|
567
|
-
|
|
568
|
-
# Dependency injection registry (implemented in Rust)
|
|
569
|
-
class DependencyRegistry
|
|
570
|
-
def initialize: () -> void
|
|
571
|
-
def register_value: (String, untyped) -> void
|
|
572
|
-
def register_factory: (String, Proc, Array[String], bool, bool) -> void
|
|
573
|
-
def keys: () -> Array[String]
|
|
574
|
-
def resolve: (String) -> untyped
|
|
575
|
-
end
|
|
576
|
-
|
|
577
|
-
# Native test client (implemented in Rust)
|
|
578
|
-
class TestClient
|
|
579
|
-
def initialize: (String, Hash[Symbol, Proc], ServerConfig, Hash[String, Proc], Hash[String, Proc], Hash[Symbol, untyped]) -> void
|
|
580
|
-
def request: (String, String, Hash[Symbol, untyped]?) -> Hash[Symbol, untyped]
|
|
581
|
-
def websocket: (String) -> WebSocketTestConnection
|
|
582
|
-
def sse: (String) -> SseStream
|
|
583
|
-
def graphql: (String, Hash[String, untyped]?, String?) -> Hash[Symbol, untyped]
|
|
584
|
-
def graphql_with_status: (String, Hash[String, untyped]?, String?) -> Hash[Symbol, untyped]
|
|
585
|
-
def close: () -> void
|
|
586
|
-
end
|
|
587
|
-
|
|
588
|
-
# Native WebSocket test connection (implemented in Rust)
|
|
589
|
-
class WebSocketTestConnection
|
|
590
|
-
def send_text: (String) -> void
|
|
591
|
-
def send_json: (untyped) -> void
|
|
592
|
-
def receive_text: () -> String
|
|
593
|
-
def receive_json: () -> untyped
|
|
594
|
-
def receive_bytes: () -> String
|
|
595
|
-
def receive_message: () -> WebSocketMessage
|
|
596
|
-
def close: () -> void
|
|
597
|
-
end
|
|
598
|
-
|
|
599
|
-
# Native WebSocket message (implemented in Rust)
|
|
600
|
-
class WebSocketMessage
|
|
601
|
-
def as_text: () -> String?
|
|
602
|
-
def as_json: () -> untyped
|
|
603
|
-
def as_binary: () -> String?
|
|
604
|
-
def is_close: () -> bool
|
|
605
|
-
end
|
|
606
|
-
|
|
607
|
-
# Native SSE stream (implemented in Rust)
|
|
608
|
-
class SseStream
|
|
609
|
-
def body: () -> String
|
|
610
|
-
def events: () -> Array[SseEvent]
|
|
611
|
-
def events_as_json: () -> Array[untyped]
|
|
612
|
-
end
|
|
613
|
-
|
|
614
|
-
# Native SSE event (implemented in Rust)
|
|
615
|
-
class SseEvent
|
|
616
|
-
def data: () -> String
|
|
617
|
-
def as_json: () -> untyped
|
|
618
|
-
end
|
|
619
|
-
end
|
|
620
|
-
|
|
621
|
-
# Testing helpers that wrap the native Ruby extension
|
|
622
|
-
module Testing
|
|
623
|
-
GRAPHQL_WS_MAX_CONTROL_MESSAGES: Integer
|
|
624
|
-
|
|
625
|
-
def self.create_test_client: (App, ?config: ServerConfig?) -> Testing::TestClient
|
|
626
|
-
def self.ensure_native_test_client!: () -> void
|
|
627
|
-
def self.resolve_test_config: (App, ServerConfig?) -> ServerConfig
|
|
628
|
-
def self.build_native_test_client: (App, ServerConfig) -> Native::TestClient
|
|
629
|
-
def self.trace: (String) -> void
|
|
630
|
-
|
|
631
|
-
# Lightweight response wrapper used by the test client
|
|
632
|
-
class Response
|
|
633
|
-
attr_reader status_code: Integer
|
|
634
|
-
attr_reader headers: Hash[String, String]
|
|
635
|
-
attr_reader body: String?
|
|
636
|
-
|
|
637
|
-
@body_text: String?
|
|
638
|
-
|
|
639
|
-
def initialize: (Hash[Symbol, untyped]) -> void
|
|
640
|
-
def status: () -> Integer
|
|
641
|
-
def body_bytes: () -> String
|
|
642
|
-
def body_text: () -> String?
|
|
643
|
-
def text: () -> String?
|
|
644
|
-
def json: () -> jsonValue
|
|
645
|
-
def bytes: () -> Array[Integer]
|
|
646
|
-
end
|
|
647
|
-
|
|
648
|
-
# High level wrapper around the native test client
|
|
649
|
-
class TestClient
|
|
650
|
-
@native: Native::TestClient
|
|
651
|
-
|
|
652
|
-
def initialize: (Native::TestClient) -> void
|
|
653
|
-
def self.new: (App | Native::TestClient, ?config: ServerConfig?) -> TestClient
|
|
654
|
-
def request: (String, String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
655
|
-
def websocket: (String) -> WebSocketTestConnection
|
|
656
|
-
def sse: (String) -> SseStream
|
|
657
|
-
def graphql: (String, ?Hash[String, untyped]?, ?String?, ?path: String) -> Response
|
|
658
|
-
def graphql_with_status: (String, ?Hash[String, untyped]?, ?String?, ?path: String) -> [Integer, Response]
|
|
659
|
-
def graphql_subscription: (String, ?Hash[String, untyped]?, ?String?, ?path: String) -> Hash[String, untyped]
|
|
660
|
-
def close: () -> void
|
|
661
|
-
def get: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
662
|
-
def post: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
663
|
-
def put: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
664
|
-
def patch: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
665
|
-
def delete: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
666
|
-
def head: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
667
|
-
def options: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
668
|
-
def trace: (String, ?Hash[String, String]?, ?untyped, **untyped) -> Response
|
|
669
|
-
|
|
670
|
-
private
|
|
671
|
-
|
|
672
|
-
def build_request_payload: (Hash[String, String]?, untyped, Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
|
|
673
|
-
def body_payload_from: (Hash[Symbol, untyped], untyped) -> Hash[Symbol, untyped]
|
|
674
|
-
def explicit_body_payload: (untyped, untyped, untyped, untyped) -> Hash[Symbol, untyped]
|
|
675
|
-
def websocket_protocol_message: (untyped) -> Hash[String, untyped]
|
|
676
|
-
def websocket_field: (Hash[String | Symbol, untyped], Symbol) -> untyped
|
|
677
|
-
end
|
|
678
|
-
|
|
679
|
-
# WebSocket test connection wrapper
|
|
680
|
-
class WebSocketTestConnection
|
|
681
|
-
@native_ws: Native::WebSocketTestConnection
|
|
682
|
-
|
|
683
|
-
def initialize: (Native::WebSocketTestConnection) -> void
|
|
684
|
-
def send_text: (String) -> void
|
|
685
|
-
def send_json: (jsonValue) -> void
|
|
686
|
-
def receive_text: () -> untyped
|
|
687
|
-
def receive_json: () -> untyped
|
|
688
|
-
def receive_bytes: () -> untyped
|
|
689
|
-
def receive_message: () -> WebSocketMessage
|
|
690
|
-
def close: () -> void
|
|
691
|
-
|
|
692
|
-
private
|
|
693
|
-
|
|
694
|
-
def with_timeout: [T] () { () -> T } -> T
|
|
695
|
-
end
|
|
696
|
-
|
|
697
|
-
# WebSocket message wrapper
|
|
698
|
-
class WebSocketMessage
|
|
699
|
-
@native_msg: Native::WebSocketMessage
|
|
700
|
-
|
|
701
|
-
def initialize: (Native::WebSocketMessage) -> void
|
|
702
|
-
def as_text: () -> untyped
|
|
703
|
-
def as_json: () -> untyped
|
|
704
|
-
def as_binary: () -> String?
|
|
705
|
-
def close?: () -> bool
|
|
706
|
-
end
|
|
707
|
-
|
|
708
|
-
# SSE stream wrapper
|
|
709
|
-
class SseStream
|
|
710
|
-
@native_sse: Native::SseStream
|
|
711
|
-
|
|
712
|
-
def initialize: (Native::SseStream) -> void
|
|
713
|
-
def body: () -> String?
|
|
714
|
-
def events: () -> Array[InlineSseEvent]
|
|
715
|
-
def events_as_json: () -> jsonArray
|
|
716
|
-
|
|
717
|
-
private
|
|
718
|
-
|
|
719
|
-
def parsed_chunks: () -> Array[String]
|
|
720
|
-
end
|
|
721
|
-
|
|
722
|
-
# SSE event wrapper (wraps native event)
|
|
723
|
-
class SseEvent
|
|
724
|
-
@native_event: Native::SseEvent
|
|
725
|
-
|
|
726
|
-
def initialize: (Native::SseEvent) -> void
|
|
727
|
-
def data: () -> untyped
|
|
728
|
-
def as_json: () -> untyped
|
|
729
|
-
end
|
|
730
|
-
|
|
731
|
-
# Lightweight wrapper for parsed SSE events backed by strings
|
|
732
|
-
class InlineSseEvent
|
|
733
|
-
attr_reader data: String
|
|
734
|
-
|
|
735
|
-
def initialize: (String) -> void
|
|
736
|
-
def as_json: () -> jsonValue
|
|
737
|
-
end
|
|
738
|
-
end
|
|
739
|
-
end
|