hearth 1.0.0.pre2 → 1.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/hearth/anonymous_auth_resolver.rb +11 -0
- data/lib/hearth/auth_schemes/anonymous.rb +3 -3
- data/lib/hearth/auth_schemes.rb +3 -3
- data/lib/hearth/client.rb +66 -0
- data/lib/hearth/client_stubs.rb +1 -3
- data/lib/hearth/config/resolver.rb +6 -5
- data/lib/hearth/context.rb +1 -0
- data/lib/hearth/dns/host_address.rb +20 -16
- data/lib/hearth/endpoint_rules.rb +154 -0
- data/lib/hearth/http/client.rb +5 -7
- data/lib/hearth/http/error_inspector.rb +2 -2
- data/lib/hearth/http/field.rb +4 -19
- data/lib/hearth/http/header_list_builder.rb +42 -0
- data/lib/hearth/http/header_list_parser.rb +92 -0
- data/lib/hearth/http/middleware/content_length.rb +3 -3
- data/lib/hearth/http/middleware/content_md5.rb +0 -1
- data/lib/hearth/http/middleware/request_compression.rb +7 -10
- data/lib/hearth/http.rb +2 -0
- data/lib/hearth/{identity_resolver.rb → identity_provider.rb} +1 -1
- data/lib/hearth/interceptor_context.rb +8 -4
- data/lib/hearth/interceptors.rb +2 -1
- data/lib/hearth/json.rb +4 -4
- data/lib/hearth/middleware/auth.rb +9 -6
- data/lib/hearth/middleware/build.rb +0 -1
- data/lib/hearth/middleware/endpoint.rb +79 -0
- data/lib/hearth/middleware/host_prefix.rb +1 -2
- data/lib/hearth/middleware/initialize.rb +0 -1
- data/lib/hearth/middleware/parse.rb +0 -1
- data/lib/hearth/middleware/retry.rb +9 -2
- data/lib/hearth/middleware/send.rb +0 -1
- data/lib/hearth/middleware.rb +1 -0
- data/lib/hearth/middleware_stack.rb +1 -1
- data/lib/hearth/number_helper.rb +1 -1
- data/lib/hearth/query/param.rb +7 -3
- data/lib/hearth/query/param_matcher.rb +5 -6
- data/lib/hearth/{refreshing_identity_resolver.rb → refreshing_identity_provider.rb} +2 -2
- data/lib/hearth/request.rb +2 -2
- data/lib/hearth/response.rb +5 -2
- data/lib/hearth/retry/adaptive.rb +2 -2
- data/lib/hearth/retry/client_rate_limiter.rb +8 -6
- data/lib/hearth/retry/exponential_backoff.rb +1 -1
- data/lib/hearth/retry/standard.rb +2 -2
- data/lib/hearth/retry.rb +16 -3
- data/lib/hearth/structure.rb +7 -3
- data/lib/hearth/stubs.rb +12 -4
- data/lib/hearth/time_helper.rb +1 -2
- data/lib/hearth/validator.rb +37 -21
- data/lib/hearth/waiters/poller.rb +4 -2
- data/lib/hearth/waiters/waiter.rb +6 -5
- data/lib/hearth/xml/node.rb +0 -1
- data/lib/hearth/xml/node_matcher.rb +0 -1
- data/lib/hearth.rb +8 -4
- data/sig/lib/hearth/aliases.rbs +5 -3
- data/sig/lib/hearth/anonymous_auth_resolver.rbs +5 -0
- data/sig/lib/hearth/auth_schemes.rbs +1 -1
- data/sig/lib/hearth/client.rbs +9 -0
- data/sig/lib/hearth/configuration.rbs +2 -2
- data/sig/lib/hearth/dns/host_address.rbs +1 -3
- data/sig/lib/hearth/dns/host_resolver.rbs +3 -3
- data/sig/lib/hearth/endpoint_rules.rbs +17 -0
- data/sig/lib/hearth/http/field.rbs +1 -1
- data/sig/lib/hearth/http/fields.rbs +1 -1
- data/sig/lib/hearth/http/header_list_builder.rbs +15 -0
- data/sig/lib/hearth/http/header_list_parser.rbs +19 -0
- data/sig/lib/hearth/http/networking_error.rbs +6 -0
- data/sig/lib/hearth/http/response.rbs +1 -1
- data/sig/lib/hearth/identities.rbs +1 -1
- data/sig/lib/hearth/{identity_resolver.rbs → identity_provider.rbs} +1 -1
- data/sig/lib/hearth/interceptor_context.rbs +4 -2
- data/sig/lib/hearth/interfaces.rbs +52 -30
- data/sig/lib/hearth/json/parse_error.rbs +9 -0
- data/sig/lib/hearth/networking_error.rbs +7 -0
- data/sig/lib/hearth/output.rbs +4 -4
- data/sig/lib/hearth/plugin_list.rbs +5 -7
- data/sig/lib/hearth/query/param.rbs +2 -2
- data/sig/lib/hearth/refreshing_identity_provider.rbs +10 -0
- data/sig/lib/hearth/request.rbs +2 -2
- data/sig/lib/hearth/response.rbs +2 -2
- data/sig/lib/hearth/retry/exponential_backoff.rbs +1 -1
- data/sig/lib/hearth/retry.rbs +1 -1
- data/sig/lib/hearth/structure.rbs +1 -2
- data/sig/lib/hearth/stubs.rbs +9 -0
- data/sig/lib/hearth/union.rbs +1 -1
- data/sig/lib/hearth/xml/parse_error.rbs +9 -0
- metadata +26 -10
- data/lib/hearth/retry/strategy.rb +0 -20
data/lib/hearth/stubs.rb
CHANGED
@@ -3,19 +3,27 @@
|
|
3
3
|
module Hearth
|
4
4
|
# Provides a thread safe data structure for adding and getting stubs
|
5
5
|
# per operation.
|
6
|
-
# @api private
|
7
6
|
class Stubs
|
8
|
-
|
9
|
-
|
7
|
+
# Initializes the stubs with an optional hash of stubs.
|
8
|
+
# For an example of stubs, see {ClientStubs}.
|
9
|
+
# @param [Hash<Symbol, Array<Stub>>] stubs
|
10
|
+
def initialize(stubs = {})
|
11
|
+
@stubs = stubs
|
10
12
|
@stub_mutex = Mutex.new
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
# Adds a stub or list of stubs to the given operation name.
|
16
|
+
# @param [String] operation_name
|
17
|
+
# @param [Array<Stub>] stubs
|
18
|
+
def set_stubs(operation_name, stubs)
|
14
19
|
@stub_mutex.synchronize do
|
15
20
|
@stubs[operation_name.to_sym] = stubs
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
24
|
+
# Returns the next stub for the given operation name.
|
25
|
+
# @param [String] operation_name
|
26
|
+
# @return [Stub, nil]
|
19
27
|
def next(operation_name)
|
20
28
|
@stub_mutex.synchronize do
|
21
29
|
stubs = @stubs[operation_name] || []
|
data/lib/hearth/time_helper.rb
CHANGED
data/lib/hearth/validator.rb
CHANGED
@@ -7,17 +7,34 @@ module Hearth
|
|
7
7
|
# * Raise errors with context when validation fails.
|
8
8
|
# @api private
|
9
9
|
module Validator
|
10
|
-
# Validate the given value is
|
10
|
+
# Validate the given value is within the expected range (inclusive).
|
11
11
|
# @param value [Object] The value to validate.
|
12
|
-
# @param
|
12
|
+
# @param min [Numeric] The minimum that the given value should be.
|
13
|
+
# @param max [Numeric] The maximum that the given value should be.
|
13
14
|
# @param context [String] The context of the value being validated.
|
14
|
-
# @raise [ArgumentError] Raises when the value is not
|
15
|
-
def self.
|
16
|
-
return if value.nil? ||
|
15
|
+
# @raise [ArgumentError] Raises when the value is not within expected range.
|
16
|
+
def self.validate_range!(value, min:, max:, context:)
|
17
|
+
return if value.nil? || value.between?(min, max)
|
17
18
|
|
18
19
|
raise ArgumentError,
|
19
|
-
"Expected #{context} to be
|
20
|
-
"
|
20
|
+
"Expected #{context} to be between " \
|
21
|
+
"#{min} to #{max}, got #{value}."
|
22
|
+
end
|
23
|
+
|
24
|
+
# Validate the given value responds to the given methods.
|
25
|
+
# @param value [Object] The value to validate.
|
26
|
+
# @param methods [Array<Symbol>] The methods to validate against.
|
27
|
+
# @param context [String] The context of the value being validated.
|
28
|
+
# @raise [ArgumentError] Raises when the value does not respond to the
|
29
|
+
# methods.
|
30
|
+
def self.validate_responds_to!(value, *methods, context:)
|
31
|
+
if value.nil? || methods.all? { |method| value.respond_to?(method) }
|
32
|
+
return
|
33
|
+
end
|
34
|
+
|
35
|
+
raise ArgumentError,
|
36
|
+
"Expected #{context} to respond to " \
|
37
|
+
"[#{methods.map(&:to_s).join(', ')}], got #{value.class}."
|
21
38
|
end
|
22
39
|
|
23
40
|
# Validate a value is present and not nil.
|
@@ -28,6 +45,19 @@ module Hearth
|
|
28
45
|
raise ArgumentError, "Expected #{context} to be set." if value.nil?
|
29
46
|
end
|
30
47
|
|
48
|
+
# Validate the given value is of the given type(s).
|
49
|
+
# @param value [Object] The value to validate.
|
50
|
+
# @param types [Array<Class>] The types to validate against.
|
51
|
+
# @param context [String] The context of the value being validated.
|
52
|
+
# @raise [ArgumentError] Raises when the value is not one of given type(s).
|
53
|
+
def self.validate_types!(value, *types, context:)
|
54
|
+
return if value.nil? || types.any? { |type| value.is_a?(type) }
|
55
|
+
|
56
|
+
raise ArgumentError,
|
57
|
+
"Expected #{context} to be in " \
|
58
|
+
"[#{types.map(&:to_s).join(', ')}], got #{value.class}."
|
59
|
+
end
|
60
|
+
|
31
61
|
# Validate unknown parameters are not present for a given Struct.
|
32
62
|
# @param struct [Struct] The Struct to validate against.
|
33
63
|
# @param params [Hash] The parameters to validate.
|
@@ -41,19 +71,5 @@ module Hearth
|
|
41
71
|
raise ArgumentError,
|
42
72
|
"Unexpected members: [#{unknown.join(', ')}]"
|
43
73
|
end
|
44
|
-
|
45
|
-
# Validate the given value is within the expected range (inclusive).
|
46
|
-
# @param value [Object] The value to validate.
|
47
|
-
# @param min [Numeric] The minimum that the given value should be.
|
48
|
-
# @param max [Numeric] The maximum that the given value should be.
|
49
|
-
# @param context [String] The context of the value being validated.
|
50
|
-
# @raise [ArgumentError] Raises when the value is not within expected range.
|
51
|
-
def self.validate_range!(value, min:, max:, context:)
|
52
|
-
return if value.nil? || value.between?(min, max)
|
53
|
-
|
54
|
-
raise ArgumentError,
|
55
|
-
"Expected #{context} to be between " \
|
56
|
-
"#{min} to #{max}, got #{value}."
|
57
|
-
end
|
58
74
|
end
|
59
75
|
end
|
@@ -21,7 +21,7 @@ module Hearth
|
|
21
21
|
# * `:retry` - The waiter may be retried.
|
22
22
|
# * `:error` - The waiter encountered an un-expected error.
|
23
23
|
#
|
24
|
-
# @example A
|
24
|
+
# @example A trivial (bad) example of a waiter that polls indefinitely.
|
25
25
|
#
|
26
26
|
# loop do
|
27
27
|
#
|
@@ -39,7 +39,7 @@ module Hearth
|
|
39
39
|
# @param [Client] client
|
40
40
|
# @param [Hash] params
|
41
41
|
# @param [Hash] options
|
42
|
-
# @return [Array<Symbol,Response>]
|
42
|
+
# @return [Array<Symbol, Response, ApiError>]
|
43
43
|
def call(client, params = {}, options = {})
|
44
44
|
begin
|
45
45
|
options = options.merge(input_output_interceptor)
|
@@ -81,6 +81,8 @@ module Hearth
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def error_type_matcher?(matcher, error)
|
84
|
+
return false unless error
|
85
|
+
|
84
86
|
# handle shape ID cases
|
85
87
|
matcher = matcher.split('#').last.split('$').first
|
86
88
|
error.class.to_s.include?(matcher) || error.error_code == matcher
|
@@ -68,11 +68,12 @@ module Hearth
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def delay(attempt)
|
71
|
-
delay =
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
delay =
|
72
|
+
if attempt > attempt_ceiling
|
73
|
+
max_delay
|
74
|
+
else
|
75
|
+
min_delay * (2**(attempt - 1))
|
76
|
+
end
|
76
77
|
|
77
78
|
delay = Kernel.rand(min_delay..delay)
|
78
79
|
|
data/lib/hearth/xml/node.rb
CHANGED
data/lib/hearth.rb
CHANGED
@@ -6,10 +6,11 @@ require_relative 'hearth/auth_option'
|
|
6
6
|
# must be required before auth_schemes
|
7
7
|
require_relative 'hearth/identities'
|
8
8
|
require_relative 'hearth/auth_schemes'
|
9
|
+
require_relative 'hearth/anonymous_auth_resolver'
|
9
10
|
|
10
11
|
require_relative 'hearth/block_io'
|
11
12
|
require_relative 'hearth/checksums'
|
12
|
-
require_relative 'hearth/
|
13
|
+
require_relative 'hearth/client'
|
13
14
|
require_relative 'hearth/configuration'
|
14
15
|
require_relative 'hearth/config/env_provider'
|
15
16
|
require_relative 'hearth/config/resolver'
|
@@ -23,8 +24,12 @@ require_relative 'hearth/networking_error'
|
|
23
24
|
require_relative 'hearth/request'
|
24
25
|
require_relative 'hearth/response'
|
25
26
|
|
27
|
+
# must be required before endpoint rules
|
28
|
+
require_relative 'hearth/structure'
|
29
|
+
|
30
|
+
require_relative 'hearth/endpoint_rules'
|
26
31
|
require_relative 'hearth/http'
|
27
|
-
require_relative 'hearth/
|
32
|
+
require_relative 'hearth/identity_provider'
|
28
33
|
require_relative 'hearth/interceptor'
|
29
34
|
require_relative 'hearth/interceptors'
|
30
35
|
require_relative 'hearth/interceptor_context'
|
@@ -36,10 +41,9 @@ require_relative 'hearth/number_helper'
|
|
36
41
|
require_relative 'hearth/output'
|
37
42
|
require_relative 'hearth/query/param'
|
38
43
|
require_relative 'hearth/query/param_list'
|
39
|
-
require_relative 'hearth/
|
44
|
+
require_relative 'hearth/refreshing_identity_provider'
|
40
45
|
require_relative 'hearth/retry'
|
41
46
|
require_relative 'hearth/signers'
|
42
|
-
require_relative 'hearth/structure'
|
43
47
|
require_relative 'hearth/stubs'
|
44
48
|
require_relative 'hearth/time_helper'
|
45
49
|
require_relative 'hearth/union'
|
data/sig/lib/hearth/aliases.rbs
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
module Hearth
|
2
|
+
type document = Hash[Symbol, document] | Array[document] | String | bool | Numeric
|
2
3
|
|
3
|
-
type stub =
|
4
|
-
|
4
|
+
type stub = Structure | Response | { data: Hash[Symbol, untyped] } |
|
5
|
+
{ error: { class: Class, data: Hash[Symbol, untyped] } } | ApiError | Proc
|
6
|
+
end
|
@@ -5,7 +5,7 @@ module Hearth
|
|
5
5
|
|
6
6
|
attr_reader scheme_id: String
|
7
7
|
|
8
|
-
def
|
8
|
+
def identity_provider: (?Hash[Symbol, IdentityProvider] identity_providers) -> IdentityProvider
|
9
9
|
|
10
10
|
attr_reader signer: Signers::Base
|
11
11
|
end
|
@@ -5,13 +5,13 @@ module Hearth
|
|
5
5
|
|
6
6
|
attr_reader service: Integer
|
7
7
|
|
8
|
-
attr_reader family: Integer
|
8
|
+
attr_reader family: Integer?
|
9
9
|
|
10
10
|
attr_reader socktype: Symbol
|
11
11
|
|
12
|
-
attr_reader protocol: Integer
|
12
|
+
attr_reader protocol: Integer?
|
13
13
|
|
14
|
-
attr_reader flags: Integer
|
14
|
+
attr_reader flags: Integer?
|
15
15
|
|
16
16
|
def resolve_address: (nodename: String, ?service: Integer, ?family: Integer?, ?socktype: Symbol, ?protocol: Integer?, ?flags: Integer?) -> Array[HostAddress]
|
17
17
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Hearth
|
2
|
+
module EndpointRules
|
3
|
+
class AuthScheme < Struct[untyped]
|
4
|
+
attr_accessor scheme_id: String
|
5
|
+
|
6
|
+
attr_accessor properties: Hash[String, untyped]
|
7
|
+
end
|
8
|
+
|
9
|
+
class Endpoint < Struct[untyped]
|
10
|
+
attr_accessor uri: String
|
11
|
+
|
12
|
+
attr_accessor auth_schemes: Array[AuthScheme]
|
13
|
+
|
14
|
+
attr_accessor headers: Hash[String, String | Array[String]]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Hearth
|
2
|
+
module HTTP
|
3
|
+
module HeaderListBuilder
|
4
|
+
def self.build_list: (Array[untyped] value) -> String
|
5
|
+
|
6
|
+
def self.build_string_list: (Array[String] value ) -> String
|
7
|
+
|
8
|
+
def self.build_http_date_list: (Array[Time] value) -> String
|
9
|
+
|
10
|
+
def self.build_date_time_list: (Array[Time] value) -> String
|
11
|
+
|
12
|
+
def self.build_epoch_seconds_list: (Array[Time] value) -> String
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Hearth
|
2
|
+
module HTTP
|
3
|
+
module HeaderListParser
|
4
|
+
def self.parse_boolean_list: (String value) -> Array[bool]
|
5
|
+
|
6
|
+
def self.parse_integer_list: (String value) -> Array[Integer]
|
7
|
+
|
8
|
+
def self.parse_float_list: (String value) -> Array[Float]
|
9
|
+
|
10
|
+
def self.build_string_list: (String value ) -> Array[String]
|
11
|
+
|
12
|
+
def self.build_http_date_list: (String value ) -> Array[Time]
|
13
|
+
|
14
|
+
def self.build_date_time_list: (String value ) -> Array[Time]
|
15
|
+
|
16
|
+
def self.build_epoch_seconds_list: (String value ) -> Array[Time]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Hearth
|
2
2
|
module HTTP
|
3
3
|
class Response < Hearth::Response
|
4
|
-
def initialize: (?status: Integer, ?reason: String?, ?fields: Fields, ?body:
|
4
|
+
def initialize: (?status: Integer, ?reason: String?, ?fields: Fields, ?body: _WritableIO) -> void
|
5
5
|
|
6
6
|
attr_accessor status: Integer
|
7
7
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Hearth
|
2
2
|
class InterceptorContext
|
3
|
-
def initialize: (input: Structure, request: Request, response: Response, output: Structure,
|
3
|
+
def initialize: (input: Structure, request: Request, response: Response, output: Output[Structure], logger: Logger) -> void
|
4
4
|
|
5
5
|
attr_reader input: Structure
|
6
6
|
|
@@ -8,7 +8,9 @@ module Hearth
|
|
8
8
|
|
9
9
|
attr_reader response: Response
|
10
10
|
|
11
|
-
attr_reader output: Structure
|
11
|
+
attr_reader output: Output[Structure]
|
12
|
+
|
13
|
+
attr_reader logger: Logger
|
12
14
|
|
13
15
|
attr_reader attributes: Hash[Symbol, untyped]
|
14
16
|
end
|
@@ -10,56 +10,78 @@ end
|
|
10
10
|
class Logger
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
module Hearth
|
14
|
+
interface _Plugin[ServiceConfig]
|
15
|
+
def call: (ServiceConfig) -> void
|
16
|
+
end
|
16
17
|
|
17
|
-
interface _Interceptor
|
18
|
-
|
18
|
+
interface _Interceptor
|
19
|
+
def read_before_execution: (InterceptorContext) -> void
|
19
20
|
|
20
|
-
|
21
|
+
def modify_before_serialization: (InterceptorContext) -> void
|
21
22
|
|
22
|
-
|
23
|
+
def read_before_serialization: (InterceptorContext) -> void
|
23
24
|
|
24
|
-
|
25
|
+
def read_after_serialization: (InterceptorContext) -> void
|
25
26
|
|
26
|
-
|
27
|
+
def modify_before_retry_loop: (InterceptorContext) -> void
|
27
28
|
|
28
|
-
|
29
|
+
def read_before_attempt: (InterceptorContext) -> void
|
29
30
|
|
30
|
-
|
31
|
+
def modify_before_signing: (InterceptorContext) -> void
|
31
32
|
|
32
|
-
|
33
|
+
def read_before_signing: (InterceptorContext) -> void
|
33
34
|
|
34
|
-
|
35
|
+
def read_after_signing: (InterceptorContext) -> void
|
35
36
|
|
36
|
-
|
37
|
+
def modify_before_transmit: (InterceptorContext) -> void
|
37
38
|
|
38
|
-
|
39
|
+
def read_before_transmit: (InterceptorContext) -> void
|
39
40
|
|
40
|
-
|
41
|
+
def read_after_transmit: (InterceptorContext) -> void
|
41
42
|
|
42
|
-
|
43
|
+
def modify_before_deserialization: (InterceptorContext) -> void
|
43
44
|
|
44
|
-
|
45
|
+
def read_before_deserialization: (InterceptorContext) -> void
|
45
46
|
|
46
|
-
|
47
|
+
def read_after_deserialization: (InterceptorContext) -> void
|
47
48
|
|
48
|
-
|
49
|
+
def modify_before_attempt_completion: (InterceptorContext) -> void
|
49
50
|
|
50
|
-
|
51
|
+
def read_after_attempt: (InterceptorContext) -> void
|
51
52
|
|
52
|
-
|
53
|
+
def modify_before_completion: (InterceptorContext) -> void
|
53
54
|
|
54
|
-
|
55
|
-
end
|
55
|
+
def read_after_execution: (InterceptorContext) -> void
|
56
|
+
end
|
57
|
+
|
58
|
+
interface _ErrorInspector
|
59
|
+
def initialize: (ApiError, Response) -> void
|
60
|
+
|
61
|
+
def retryable?: () -> bool
|
62
|
+
|
63
|
+
def error_type: () -> String
|
56
64
|
|
57
|
-
|
58
|
-
|
65
|
+
def hints: () -> Hash[Symbol, untyped]
|
66
|
+
end
|
59
67
|
|
60
|
-
|
68
|
+
interface _RetryStrategy
|
69
|
+
def acquire_initial_retry_token: (?String? _token_scope) -> Retry::Token
|
61
70
|
|
62
|
-
|
71
|
+
def refresh_retry_token: (Retry::Token _retry_token, _ErrorInspector _error_info) -> Retry::Token?
|
63
72
|
|
64
|
-
|
65
|
-
end
|
73
|
+
def record_success: (Retry::Token _retry_token) -> Retry::Token
|
74
|
+
end
|
75
|
+
|
76
|
+
interface _AuthResolver[Params]
|
77
|
+
def resolve: (Params) -> AuthSchemes::Base
|
78
|
+
end
|
79
|
+
|
80
|
+
interface _EndpointResolver[Params]
|
81
|
+
def resolve: (Params) -> EndpointRules::Endpoint
|
82
|
+
end
|
83
|
+
|
84
|
+
interface _WritableIO
|
85
|
+
def write: (*_ToS) -> Integer
|
86
|
+
end
|
87
|
+
end
|
data/sig/lib/hearth/output.rbs
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Hearth
|
2
|
-
class Output
|
3
|
-
def initialize: (?error:
|
2
|
+
class Output[DATA]
|
3
|
+
def initialize: (?error: ApiError?, ?data: Structure?, ?metadata: Hash[Symbol, untyped]) -> void
|
4
4
|
|
5
|
-
attr_accessor error:
|
5
|
+
attr_accessor error: ApiError?
|
6
6
|
|
7
|
-
attr_accessor data:
|
7
|
+
attr_accessor data: DATA?
|
8
8
|
|
9
9
|
attr_accessor metadata: Hash[Symbol, untyped]
|
10
10
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
module Hearth
|
2
|
-
class PluginList
|
3
|
-
def initialize: (?Array[_Plugin] plugins) -> void
|
2
|
+
class PluginList[ServiceConfig]
|
3
|
+
def initialize: (?Array[_Plugin[ServiceConfig]] plugins) -> void
|
4
4
|
|
5
|
-
def add: (_Plugin plugin) -> void
|
5
|
+
def add: (_Plugin[ServiceConfig] plugin) -> void
|
6
6
|
|
7
7
|
alias << add
|
8
8
|
|
9
|
-
def apply: (
|
9
|
+
def apply: (ServiceConfig) -> void
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
def each: () ?{ (_Plugin) -> void } -> void
|
11
|
+
def each: () ?{ (_Plugin[ServiceConfig]) -> void } -> void
|
14
12
|
end
|
15
13
|
end
|
@@ -5,13 +5,13 @@ module Hearth
|
|
5
5
|
|
6
6
|
attr_reader name: String
|
7
7
|
|
8
|
-
attr_reader value: (String | Array[String])
|
8
|
+
attr_reader value: (String | Array[String])?
|
9
9
|
|
10
10
|
def to_s: () -> String
|
11
11
|
|
12
12
|
def ==: (Param other) -> bool
|
13
13
|
|
14
|
-
def <=>: (Param other) ->
|
14
|
+
def <=>: (Param other) -> Integer
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/sig/lib/hearth/request.rbs
CHANGED