volcano-sdk 0.32.5 → 0.32.7
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/README.md +1 -1
- data/lib/volcano/client.rb +19 -17
- data/lib/volcano/database.rb +1 -1
- data/lib/volcano/durable_models.rb +0 -3
- data/lib/volcano/function_resolution.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/api/auth_configuration_api.rb +6 -6
- data/lib/volcano/generated/lib/volcano-generated/api/databases_api.rb +4 -4
- data/lib/volcano/generated/lib/volcano-generated/api/frontends_api.rb +2 -2
- data/lib/volcano/generated/lib/volcano-generated/api/logs_api.rb +6 -6
- data/lib/volcano/generated/lib/volcano-generated/models/auth_config.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project.rb +3 -3
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_auth_signup.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_custom_domain.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_email_template.rb +2 -2
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_email_templates.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_hosted_pages.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/project_config_project.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/realtime_plan_limits.rb +1 -1
- data/lib/volcano/generated/lib/volcano-generated/models/update_auth_config_request.rb +1 -1
- data/lib/volcano/generated_transport.rb +8 -5
- data/lib/volcano/generated_transport_anonymous.rb +6 -5
- data/lib/volcano/generated_transport_auth.rb +19 -17
- data/lib/volcano/generated_transport_confirmation.rb +6 -8
- data/lib/volcano/generated_transport_email_change.rb +6 -1
- data/lib/volcano/generated_transport_functions.rb +13 -6
- data/lib/volcano/generated_transport_logs.rb +18 -21
- data/lib/volcano/generated_transport_oauth.rb +18 -8
- data/lib/volcano/generated_transport_sessions.rb +6 -3
- data/lib/volcano/generated_transport_storage.rb +1 -1
- data/lib/volcano/generated_transport_support.rb +42 -23
- data/lib/volcano/generated_transport_upload_session_api.rb +14 -11
- data/lib/volcano/lock_guard.rb +1 -1
- data/lib/volcano/models.rb +0 -6
- data/lib/volcano/realtime/connection.rb +3 -1
- data/lib/volcano/realtime/postgres_changes.rb +0 -2
- data/lib/volcano/realtime.rb +0 -2
- data/lib/volcano/session.rb +1 -3
- data/lib/volcano/storage_models.rb +0 -3
- data/lib/volcano/storage_upload_models.rb +0 -3
- data/lib/volcano/user.rb +0 -3
- data/lib/volcano/version.rb +1 -1
- metadata +1 -1
|
@@ -7,11 +7,10 @@ module Volcano
|
|
|
7
7
|
invoke do
|
|
8
8
|
apis = @api_factory.call(authorization)
|
|
9
9
|
request = Generated::AuthConfirmEmailRequest.new(token:)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
request, debug_return_type: 'String'
|
|
13
|
-
)
|
|
10
|
+
data, status, headers = apis.authentication.auth_confirm_email_with_http_info(
|
|
11
|
+
request, debug_return_type: 'String'
|
|
14
12
|
)
|
|
13
|
+
response(data, status, headers)
|
|
15
14
|
end
|
|
16
15
|
end
|
|
17
16
|
|
|
@@ -19,11 +18,10 @@ module Volcano
|
|
|
19
18
|
invoke do
|
|
20
19
|
apis = @api_factory.call(authorization)
|
|
21
20
|
request = Generated::AuthForgotPasswordRequest.new(email:)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
request, debug_return_type: 'String'
|
|
25
|
-
)
|
|
21
|
+
data, status, headers = apis.authentication.auth_resend_confirmation_with_http_info(
|
|
22
|
+
request, debug_return_type: 'String'
|
|
26
23
|
)
|
|
24
|
+
response(data, status, headers)
|
|
27
25
|
end
|
|
28
26
|
end
|
|
29
27
|
end
|
|
@@ -14,6 +14,8 @@ module Volcano
|
|
|
14
14
|
request,
|
|
15
15
|
debug_return_type: 'String'
|
|
16
16
|
)
|
|
17
|
+
raise TypeError unless data.is_a?(String)
|
|
18
|
+
|
|
17
19
|
response(JSON.parse(data), status, headers)
|
|
18
20
|
end
|
|
19
21
|
rescue JSON::ParserError, TypeError => e
|
|
@@ -23,7 +25,8 @@ module Volcano
|
|
|
23
25
|
def auth_cancel_email_change(authorization:)
|
|
24
26
|
invoke do
|
|
25
27
|
apis = @api_factory.call(authorization)
|
|
26
|
-
|
|
28
|
+
data, status, headers = apis.authentication.auth_cancel_email_change_with_http_info
|
|
29
|
+
response(data, status, headers)
|
|
27
30
|
end
|
|
28
31
|
end
|
|
29
32
|
|
|
@@ -35,6 +38,8 @@ module Volcano
|
|
|
35
38
|
request,
|
|
36
39
|
debug_return_type: 'String'
|
|
37
40
|
)
|
|
41
|
+
raise TypeError unless body.is_a?(String)
|
|
42
|
+
|
|
38
43
|
response(JSON.parse(body), status, headers)
|
|
39
44
|
end
|
|
40
45
|
rescue JSON::ParserError, TypeError => e
|
|
@@ -70,21 +70,28 @@ module Volcano
|
|
|
70
70
|
function_id, request, follow_location: false, debug_return_type: 'String'
|
|
71
71
|
)
|
|
72
72
|
rescue Generated::ApiError => e
|
|
73
|
-
|
|
73
|
+
status = error_status(e)
|
|
74
|
+
raise if status.zero?
|
|
74
75
|
|
|
75
|
-
[e.response_body,
|
|
76
|
+
[e.response_body, status, e.response_headers || {}]
|
|
76
77
|
end
|
|
77
78
|
|
|
78
79
|
def function_body(body, headers)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
text = body.dup.force_encoding(Encoding::UTF_8).scrub.delete_prefix("\uFEFF")
|
|
82
|
-
return nil if text.empty?
|
|
80
|
+
text = normalized_function_text(body)
|
|
81
|
+
return nil if text.nil? || text.empty?
|
|
83
82
|
return text unless function_json?(text, headers)
|
|
84
83
|
|
|
85
84
|
parse_function_json(text)
|
|
86
85
|
end
|
|
87
86
|
|
|
87
|
+
def normalized_function_text(body)
|
|
88
|
+
raise TypeError, 'Expected a string function response' unless body.nil? || body.is_a?(String)
|
|
89
|
+
|
|
90
|
+
return nil if body.nil? || body.empty?
|
|
91
|
+
|
|
92
|
+
body.dup.force_encoding(Encoding::UTF_8).scrub.delete_prefix("\uFEFF")
|
|
93
|
+
end
|
|
94
|
+
|
|
88
95
|
def parse_function_json(text)
|
|
89
96
|
parsed = JSON.parse(text)
|
|
90
97
|
valid_function_encoding?(parsed) ? parsed : text
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Volcano
|
|
4
|
+
# Logs operations backed by the generated API client.
|
|
4
5
|
class GeneratedTransport
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
body
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
)
|
|
14
|
-
response(parse_body(data), status, headers)
|
|
15
|
-
end
|
|
6
|
+
def search_project_logs(authorization:, project_id:, request:)
|
|
7
|
+
invoke do
|
|
8
|
+
apis = @api_factory.call(authorization)
|
|
9
|
+
body = Generated::LogSearchRequest.new(deep_symbolize(request))
|
|
10
|
+
data, status, headers = apis.logs.search_project_logs_with_http_info(
|
|
11
|
+
project_id, body, debug_return_type: 'String'
|
|
12
|
+
)
|
|
13
|
+
response(parse_body(data), status, headers)
|
|
16
14
|
end
|
|
15
|
+
end
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
end
|
|
17
|
+
def get_project_log_activity(authorization:, project_id:, request:)
|
|
18
|
+
invoke do
|
|
19
|
+
apis = @api_factory.call(authorization)
|
|
20
|
+
body = Generated::LogActivityRequest.new(deep_symbolize(request))
|
|
21
|
+
data, status, headers = apis.logs.get_project_log_activity_with_http_info(
|
|
22
|
+
project_id, body, debug_return_type: 'String'
|
|
23
|
+
)
|
|
24
|
+
response(parse_body(data), status, headers)
|
|
27
25
|
end
|
|
28
26
|
end
|
|
29
|
-
private_constant :LogTransport
|
|
30
27
|
end
|
|
31
28
|
end
|
|
@@ -4,52 +4,61 @@ module Volcano
|
|
|
4
4
|
# OAuth operations for the internal generated transport.
|
|
5
5
|
class GeneratedTransport
|
|
6
6
|
def auth_oauth_authorization_url(anon_key:, provider:, redirect_url:, client_state:)
|
|
7
|
-
oauth_authorization_api.auth_o_auth_authorize_with_http_info(
|
|
7
|
+
url = oauth_authorization_api.auth_o_auth_authorize_with_http_info(
|
|
8
8
|
provider, anon_key,
|
|
9
9
|
redirect_url:, client_state:, response_mode: 'code'
|
|
10
10
|
).first
|
|
11
|
+
raise TypeError, 'Expected OAuth authorization URL' unless url.is_a?(String)
|
|
12
|
+
|
|
13
|
+
url
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
def auth_oauth_exchange(authorization:, code:, redirect_url:)
|
|
14
17
|
invoke do
|
|
15
18
|
apis = @api_factory.call(authorization)
|
|
16
19
|
request = Generated::AuthOAuthExchangeRequest.new(code:, redirect_url:)
|
|
17
|
-
|
|
20
|
+
data, status, headers = apis.oauth.auth_o_auth_exchange_with_http_info(request)
|
|
21
|
+
response(data, status, headers)
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
def auth_link_oauth_provider(authorization:, provider:)
|
|
22
26
|
invoke do
|
|
23
27
|
apis = @api_factory.call(authorization)
|
|
24
|
-
|
|
28
|
+
data, status, headers = apis.oauth.auth_link_o_auth_provider_with_http_info(provider)
|
|
29
|
+
response(data, status, headers)
|
|
25
30
|
end
|
|
26
31
|
end
|
|
27
32
|
|
|
28
33
|
def auth_list_oauth_providers(authorization:)
|
|
29
34
|
invoke do
|
|
30
35
|
apis = @api_factory.call(authorization)
|
|
31
|
-
|
|
36
|
+
data, status, headers = apis.oauth.auth_list_o_auth_providers_with_http_info
|
|
37
|
+
response(data, status, headers)
|
|
32
38
|
end
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
def auth_unlink_oauth_provider(authorization:, provider:)
|
|
36
42
|
invoke do
|
|
37
43
|
apis = @api_factory.call(authorization)
|
|
38
|
-
|
|
44
|
+
data, status, headers = apis.oauth.auth_unlink_o_auth_provider_with_http_info(provider)
|
|
45
|
+
response(data, status, headers)
|
|
39
46
|
end
|
|
40
47
|
end
|
|
41
48
|
|
|
42
49
|
def auth_get_oauth_provider_token(authorization:, provider:)
|
|
43
50
|
invoke do
|
|
44
51
|
apis = @api_factory.call(authorization)
|
|
45
|
-
|
|
52
|
+
data, status, headers = apis.oauth.get_o_auth_provider_token_with_http_info(provider)
|
|
53
|
+
response(data, status, headers)
|
|
46
54
|
end
|
|
47
55
|
end
|
|
48
56
|
|
|
49
57
|
def auth_refresh_oauth_provider_token(authorization:, provider:)
|
|
50
58
|
invoke do
|
|
51
59
|
apis = @api_factory.call(authorization)
|
|
52
|
-
|
|
60
|
+
data, status, headers = apis.oauth.refresh_o_auth_provider_token_with_http_info(provider)
|
|
61
|
+
response(data, status, headers)
|
|
53
62
|
end
|
|
54
63
|
end
|
|
55
64
|
|
|
@@ -57,7 +66,8 @@ module Volcano
|
|
|
57
66
|
invoke do
|
|
58
67
|
apis = @api_factory.call(authorization)
|
|
59
68
|
request = Generated::CallOAuthProviderAPIRequest.new(endpoint:, method:, body:)
|
|
60
|
-
|
|
69
|
+
data, status, headers = apis.oauth.call_o_auth_provider_api_with_http_info(provider, request)
|
|
70
|
+
response(data, status, headers)
|
|
61
71
|
end
|
|
62
72
|
end
|
|
63
73
|
end
|
|
@@ -6,21 +6,24 @@ module Volcano
|
|
|
6
6
|
def auth_get_my_sessions(authorization:, page:, limit:)
|
|
7
7
|
invoke do
|
|
8
8
|
apis = @api_factory.call(authorization)
|
|
9
|
-
|
|
9
|
+
data, status, headers = apis.authentication.auth_get_my_sessions_with_http_info(page: page, limit: limit)
|
|
10
|
+
response(data, status, headers)
|
|
10
11
|
end
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
def auth_delete_all_my_sessions(authorization:)
|
|
14
15
|
invoke do
|
|
15
16
|
apis = @api_factory.call(authorization)
|
|
16
|
-
|
|
17
|
+
data, status, headers = apis.authentication.auth_delete_all_my_sessions_with_http_info
|
|
18
|
+
response(data, status, headers)
|
|
17
19
|
end
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def auth_delete_my_session(authorization:, session_id:)
|
|
21
23
|
invoke do
|
|
22
24
|
apis = @api_factory.call(authorization)
|
|
23
|
-
|
|
25
|
+
data, status, headers = apis.authentication.auth_delete_my_session_with_http_info(session_id)
|
|
26
|
+
response(data, status, headers)
|
|
24
27
|
end
|
|
25
28
|
end
|
|
26
29
|
end
|
|
@@ -10,7 +10,7 @@ module Volcano
|
|
|
10
10
|
options = { content_type: content_type }.compact
|
|
11
11
|
result = apis.storage.upload_storage_object_with_http_info(bucket_name, path, file, options)
|
|
12
12
|
data_value, status, headers = result
|
|
13
|
-
|
|
13
|
+
response(data_value, status, headers)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -16,11 +16,12 @@ module Volcano
|
|
|
16
16
|
private
|
|
17
17
|
|
|
18
18
|
def deserialize_private_model(klass, value)
|
|
19
|
-
if klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
method_name = if klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of)
|
|
20
|
+
:build
|
|
21
|
+
else
|
|
22
|
+
:build_from_hash
|
|
23
|
+
end
|
|
24
|
+
klass.method(method_name).call(value)
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
27
|
private_constant :ModelDeserialization
|
|
@@ -64,8 +65,7 @@ module Volcano
|
|
|
64
65
|
|
|
65
66
|
# Implements storage endpoints omitted by the generated API surface.
|
|
66
67
|
class StorageApi < Generated::StorageObjectsApi
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
DOWNLOAD_HEADERS = { 'Accept' => 'application/octet-stream, application/json' }.freeze
|
|
69
69
|
UPLOAD_OPTIONS = {
|
|
70
70
|
operation: :'StorageObjectsApi.upload_storage_object',
|
|
71
71
|
header_params: { 'Accept' => 'application/json', 'Content-Type' => 'multipart/form-data' }.freeze,
|
|
@@ -74,7 +74,7 @@ module Volcano
|
|
|
74
74
|
}.freeze
|
|
75
75
|
DOWNLOAD_OPTIONS = {
|
|
76
76
|
operation: :'StorageObjectsApi.download_storage_object',
|
|
77
|
-
header_params:
|
|
77
|
+
header_params: DOWNLOAD_HEADERS,
|
|
78
78
|
auth_names: %w[ServiceRoleKey AuthUserAccessToken AnonKey].freeze,
|
|
79
79
|
return_type: 'File'
|
|
80
80
|
}.freeze
|
|
@@ -101,7 +101,10 @@ module Volcano
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def download_storage_object_with_http_info(bucket_name, path, opts = {})
|
|
104
|
-
|
|
104
|
+
provided_headers = opts[:header_params]
|
|
105
|
+
raise TypeError, 'Invalid storage headers' unless provided_headers.nil? || provided_headers.is_a?(Hash)
|
|
106
|
+
|
|
107
|
+
header_params = DOWNLOAD_HEADERS.merge(provided_headers || {})
|
|
105
108
|
header_params['Range'] = opts[:range] unless opts[:range].nil?
|
|
106
109
|
options = opts.merge(DOWNLOAD_OPTIONS, header_params: header_params)
|
|
107
110
|
|
|
@@ -134,15 +137,19 @@ module Volcano
|
|
|
134
137
|
private
|
|
135
138
|
|
|
136
139
|
def parse_body(value)
|
|
137
|
-
|
|
140
|
+
# @type var empty_body: Hash[String, Object?]
|
|
141
|
+
empty_body = {}
|
|
142
|
+
return empty_body if value.nil?
|
|
143
|
+
raise TypeError, 'Expected a string response body' unless value.is_a?(String)
|
|
144
|
+
return empty_body if value.empty?
|
|
138
145
|
|
|
139
146
|
JSON.parse(value)
|
|
140
147
|
rescue JSON::ParserError
|
|
141
|
-
|
|
148
|
+
empty_body
|
|
142
149
|
end
|
|
143
150
|
|
|
144
151
|
def plain_value(value)
|
|
145
|
-
value = value.to_hash if value.respond_to?(:to_hash)
|
|
152
|
+
value = value.method(:to_hash).call if value.respond_to?(:to_hash)
|
|
146
153
|
case value
|
|
147
154
|
when Hash then plain_hash(value)
|
|
148
155
|
when Array then value.map { |item| plain_value(item) }
|
|
@@ -155,9 +162,13 @@ module Volcano
|
|
|
155
162
|
end
|
|
156
163
|
|
|
157
164
|
def deep_symbolize(value)
|
|
165
|
+
value.to_h { |key, item| [key.to_sym, deep_symbolize_value(item)] }
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def deep_symbolize_value(value)
|
|
158
169
|
case value
|
|
159
|
-
when Hash then
|
|
160
|
-
when Array then value.map { |item|
|
|
170
|
+
when Hash then deep_symbolize(value)
|
|
171
|
+
when Array then value.map { |item| deep_symbolize_value(item) }
|
|
161
172
|
else value
|
|
162
173
|
end
|
|
163
174
|
end
|
|
@@ -166,19 +177,24 @@ module Volcano
|
|
|
166
177
|
return value.to_s.b unless value.respond_to?(:read)
|
|
167
178
|
|
|
168
179
|
prepare_stream(value)
|
|
169
|
-
value.read.
|
|
180
|
+
result = value.method(:read).call
|
|
181
|
+
raise TypeError, 'Expected a binary stream' unless result.is_a?(String)
|
|
182
|
+
|
|
183
|
+
result.b
|
|
170
184
|
ensure
|
|
171
|
-
value.close! if value.respond_to?(:close!)
|
|
185
|
+
value.method(:close!).call if value.respond_to?(:close!)
|
|
172
186
|
end
|
|
173
187
|
|
|
174
188
|
def prepare_stream(value)
|
|
175
189
|
reopen_stream(value)
|
|
176
|
-
value.binmode if value.respond_to?(:binmode)
|
|
177
|
-
value.rewind if value.respond_to?(:rewind)
|
|
190
|
+
value.method(:binmode).call if value.respond_to?(:binmode)
|
|
191
|
+
value.method(:rewind).call if value.respond_to?(:rewind)
|
|
178
192
|
end
|
|
179
193
|
|
|
180
194
|
def reopen_stream(value)
|
|
181
|
-
|
|
195
|
+
return unless value.respond_to?(:closed?) && value.method(:closed?).call && value.respond_to?(:open)
|
|
196
|
+
|
|
197
|
+
value.method(:open).call
|
|
182
198
|
end
|
|
183
199
|
end
|
|
184
200
|
|
|
@@ -192,11 +208,12 @@ module Volcano
|
|
|
192
208
|
end
|
|
193
209
|
|
|
194
210
|
def generated_configuration(authorization)
|
|
195
|
-
uri = URI(@api_url)
|
|
211
|
+
uri = URI.parse(@api_url)
|
|
212
|
+
path = uri.path || ''
|
|
196
213
|
Generated::Configuration.new.tap do |configuration|
|
|
197
214
|
configuration.scheme = uri.scheme
|
|
198
215
|
configuration.host = host_with_port(uri)
|
|
199
|
-
configuration.base_path =
|
|
216
|
+
configuration.base_path = path == '/' ? '' : path
|
|
200
217
|
configuration.ignore_operation_servers = true
|
|
201
218
|
configuration.access_token = authorization
|
|
202
219
|
configuration.timeout = timeout_milliseconds
|
|
@@ -226,9 +243,11 @@ module Volcano
|
|
|
226
243
|
end
|
|
227
244
|
|
|
228
245
|
def host_with_port(uri)
|
|
229
|
-
|
|
246
|
+
host = uri.host
|
|
247
|
+
raise ArgumentError, 'API URL requires a host' unless host
|
|
248
|
+
return host if uri.port == uri.default_port
|
|
230
249
|
|
|
231
|
-
"#{
|
|
250
|
+
"#{host}:#{uri.port}"
|
|
232
251
|
end
|
|
233
252
|
end
|
|
234
253
|
end
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Volcano
|
|
4
4
|
# Corrects generated HTTP operations for resumable storage uploads.
|
|
5
|
-
|
|
5
|
+
class GeneratedTransport::StorageApi
|
|
6
|
+
UPLOAD_PART_HEADERS = { 'Accept' => 'application/json', 'Content-Type' => 'application/octet-stream' }.freeze
|
|
7
|
+
COMPLETE_HEADERS = { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }.freeze
|
|
8
|
+
STATUS_HEADERS = { 'Accept' => 'application/json' }.freeze
|
|
9
|
+
ABORT_HEADERS = { 'Accept' => 'application/json' }.freeze
|
|
6
10
|
CREATE_OPTIONS = {
|
|
7
11
|
operation: :'StorageObjectsApi.upload_storage_object',
|
|
8
12
|
header_params: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }.freeze,
|
|
@@ -11,25 +15,25 @@ module Volcano
|
|
|
11
15
|
}.freeze
|
|
12
16
|
UPLOAD_PART_OPTIONS = {
|
|
13
17
|
operation: :'StorageObjectsApi.upload_part',
|
|
14
|
-
header_params:
|
|
18
|
+
header_params: UPLOAD_PART_HEADERS,
|
|
15
19
|
auth_names: %w[ServiceRoleKey AuthUserAccessToken AnonKey].freeze,
|
|
16
20
|
return_type: 'UploadSessionPart'
|
|
17
21
|
}.freeze
|
|
18
22
|
COMPLETE_OPTIONS = {
|
|
19
23
|
operation: :'StorageObjectsApi.upload_storage_object',
|
|
20
|
-
header_params:
|
|
24
|
+
header_params: COMPLETE_HEADERS,
|
|
21
25
|
auth_names: %w[ServiceRoleKey AuthUserAccessToken AnonKey].freeze,
|
|
22
26
|
return_type: 'CompleteUploadSessionResponse'
|
|
23
27
|
}.freeze
|
|
24
28
|
STATUS_OPTIONS = {
|
|
25
29
|
operation: :'StorageObjectsApi.download_storage_object',
|
|
26
|
-
header_params:
|
|
30
|
+
header_params: STATUS_HEADERS,
|
|
27
31
|
auth_names: %w[ServiceRoleKey AuthUserAccessToken AnonKey].freeze,
|
|
28
32
|
return_type: 'UploadSessionStatusResponse'
|
|
29
33
|
}.freeze
|
|
30
34
|
ABORT_OPTIONS = {
|
|
31
35
|
operation: :'StorageObjectsApi.delete_storage_object',
|
|
32
|
-
header_params:
|
|
36
|
+
header_params: ABORT_HEADERS,
|
|
33
37
|
auth_names: %w[ServiceRoleKey AuthUserAccessToken].freeze
|
|
34
38
|
}.freeze
|
|
35
39
|
|
|
@@ -39,7 +43,7 @@ module Volcano
|
|
|
39
43
|
end
|
|
40
44
|
|
|
41
45
|
def upload_part_with_http_info(bucket_name, path, session_id, part_number, data)
|
|
42
|
-
headers =
|
|
46
|
+
headers = UPLOAD_PART_HEADERS.merge(
|
|
43
47
|
'X-Upload-Session' => session_id, 'X-Part-Number' => part_number.to_s
|
|
44
48
|
)
|
|
45
49
|
call_storage_api(
|
|
@@ -48,22 +52,21 @@ module Volcano
|
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
def complete_upload_session_with_http_info(bucket_name, path, session_id)
|
|
51
|
-
headers =
|
|
55
|
+
headers = COMPLETE_HEADERS.merge(
|
|
52
56
|
'X-Upload-Session' => session_id, 'X-Upload-Complete' => 'true'
|
|
53
57
|
)
|
|
54
|
-
options = COMPLETE_OPTIONS.merge(header_params: headers, body:
|
|
58
|
+
options = COMPLETE_OPTIONS.merge(header_params: headers, body: '{}')
|
|
55
59
|
call_storage_api(:POST, bucket_name, path, options)
|
|
56
60
|
end
|
|
57
61
|
|
|
58
62
|
def get_upload_session_with_http_info(bucket_name, path, session_id)
|
|
59
|
-
headers =
|
|
63
|
+
headers = STATUS_HEADERS.merge('X-Upload-Session' => session_id)
|
|
60
64
|
call_storage_api(:GET, bucket_name, path, STATUS_OPTIONS.merge(header_params: headers))
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
def abort_upload_session_with_http_info(bucket_name, path, session_id)
|
|
64
|
-
headers =
|
|
68
|
+
headers = ABORT_HEADERS.merge('X-Upload-Session' => session_id)
|
|
65
69
|
call_storage_api(:DELETE, bucket_name, path, ABORT_OPTIONS.merge(header_params: headers))
|
|
66
70
|
end
|
|
67
71
|
end
|
|
68
|
-
private_constant :UploadSessionStorageApi
|
|
69
72
|
end
|
data/lib/volcano/lock_guard.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Volcano
|
|
|
14
14
|
def initialize(lease, ttl:, started_at:)
|
|
15
15
|
@lease = lease
|
|
16
16
|
@ttl = ttl
|
|
17
|
-
@lease_clock = LockLeaseClock.new(ttl: ttl, started_at: started_at)
|
|
17
|
+
@lease_clock = LockLeaseClock.new(ttl: ttl, started_at: started_at) # rubocop:disable Lint/NameTypo -- Inherited Class#new.
|
|
18
18
|
@mutex = Mutex.new
|
|
19
19
|
@changed = ConditionVariable.new
|
|
20
20
|
@failure = nil
|
data/lib/volcano/models.rb
CHANGED
|
@@ -11,10 +11,6 @@ module Volcano
|
|
|
11
11
|
|
|
12
12
|
# Reopens the generated record for checked initialization.
|
|
13
13
|
class AuthSession
|
|
14
|
-
# @dynamic id, user_id, provider, expires_at, is_active, is_current, user_agent
|
|
15
|
-
# @dynamic ip_address, last_ip_address, last_activity_at, session_started_at
|
|
16
|
-
# @dynamic created_at, updated_at, members, with, to_h, deconstruct
|
|
17
|
-
# @dynamic deconstruct_keys, self.[], self.members
|
|
18
14
|
def initialize(**attributes)
|
|
19
15
|
unknown = attributes.keys - AUTH_SESSION_ATTRIBUTES
|
|
20
16
|
raise ArgumentError, "unknown keywords: #{unknown.join(', ')}" unless unknown.empty?
|
|
@@ -51,8 +47,6 @@ module Volcano
|
|
|
51
47
|
|
|
52
48
|
# Reopens the generated record for checked initialization.
|
|
53
49
|
class LinkedOAuthProvider
|
|
54
|
-
# @dynamic provider, linked_at, updated_at, members, with, to_h, deconstruct
|
|
55
|
-
# @dynamic deconstruct_keys, self.[], self.members
|
|
56
50
|
def initialize(provider:, linked_at:, updated_at:)
|
|
57
51
|
provider = immutable_value(provider)
|
|
58
52
|
linked_at = immutable_value(linked_at)
|
|
@@ -99,7 +99,9 @@ module Volcano
|
|
|
99
99
|
def open_socket(address)
|
|
100
100
|
require 'async/http/endpoint'
|
|
101
101
|
require 'async/websocket/client'
|
|
102
|
-
|
|
102
|
+
# Use the HTTP/1.1 upgrade supported by the public API.
|
|
103
|
+
endpoint = Async::HTTP::Endpoint.parse(address, protocol: Async::HTTP::Protocol::HTTP11)
|
|
104
|
+
Async::WebSocket::Client.connect(endpoint)
|
|
103
105
|
end
|
|
104
106
|
|
|
105
107
|
def realtime_secrets = [@client.anon_token, @client.current_session&.access_token]
|
|
@@ -8,8 +8,6 @@ module Volcano
|
|
|
8
8
|
|
|
9
9
|
# Immutable snapshot of a Postgres change publication.
|
|
10
10
|
class PostgresChange
|
|
11
|
-
# @dynamic type, schema, table, record, old_record, columns, timestamp, id, mode
|
|
12
|
-
# @dynamic members, with, to_h, deconstruct, deconstruct_keys, self.[], self.members
|
|
13
11
|
def initialize(type:, schema:, table:, timestamp:, **payload)
|
|
14
12
|
type = Immutable.call(type.to_s)
|
|
15
13
|
schema = Immutable.call(schema.to_s)
|
data/lib/volcano/realtime.rb
CHANGED
data/lib/volcano/session.rb
CHANGED
|
@@ -5,7 +5,7 @@ require 'time'
|
|
|
5
5
|
|
|
6
6
|
module Volcano
|
|
7
7
|
SESSION_USER_CODER = JSON::Coder.new(freeze: true, allow_duplicate_key: false) do |value|
|
|
8
|
-
value.instance_of?(Time) ? Time.at(value
|
|
8
|
+
value.instance_of?(Time) ? Time.at(Rational(value)).utc.iso8601(9) : value
|
|
9
9
|
end
|
|
10
10
|
private_constant :SESSION_USER_CODER
|
|
11
11
|
|
|
@@ -14,8 +14,6 @@ module Volcano
|
|
|
14
14
|
|
|
15
15
|
# Reopens the generated record for checked initialization.
|
|
16
16
|
class Session
|
|
17
|
-
# @dynamic access_token, refresh_token, user_id, user, members, with, to_h
|
|
18
|
-
# @dynamic deconstruct, deconstruct_keys, self.[], self.members
|
|
19
17
|
def initialize(access_token:, refresh_token: nil, user_id: nil, user: nil)
|
|
20
18
|
user = immutable_user(user)
|
|
21
19
|
super
|
|
@@ -10,9 +10,6 @@ module Volcano
|
|
|
10
10
|
|
|
11
11
|
# Validates and freezes object metadata returned by storage.
|
|
12
12
|
class StorageObject
|
|
13
|
-
# @dynamic id, bucket_id, name, size, mime_type, is_public, owner_id, etag
|
|
14
|
-
# @dynamic metadata, created_at, updated_at, public_url
|
|
15
|
-
# @dynamic members, with, to_h, deconstruct, deconstruct_keys, self.[], self.members
|
|
16
13
|
def initialize(**attributes)
|
|
17
14
|
unknown = attributes.keys - STORAGE_OBJECT_ATTRIBUTES
|
|
18
15
|
raise ArgumentError, "unknown keywords: #{unknown.join(', ')}" unless unknown.empty?
|
|
@@ -76,9 +76,6 @@ module Volcano
|
|
|
76
76
|
|
|
77
77
|
# Freezes upload progress returned by storage.
|
|
78
78
|
class UploadSessionStatus
|
|
79
|
-
# @dynamic session_id, status, path, content_type, total_size, part_size
|
|
80
|
-
# @dynamic total_parts, parts_uploaded, bytes_uploaded, parts, expires_at, created_at
|
|
81
|
-
# @dynamic members, with, to_h, deconstruct, deconstruct_keys, self.[], self.members
|
|
82
79
|
def initialize(**attributes)
|
|
83
80
|
unknown = attributes.keys - UPLOAD_SESSION_STATUS_ATTRIBUTES
|
|
84
81
|
raise ArgumentError, "unknown keywords: #{unknown.join(', ')}" unless unknown.empty?
|
data/lib/volcano/user.rb
CHANGED
|
@@ -14,9 +14,6 @@ module Volcano
|
|
|
14
14
|
|
|
15
15
|
# Reopens the generated record for checked initialization.
|
|
16
16
|
class User
|
|
17
|
-
# @dynamic id, project_id, email, email_confirmed, user_metadata, app_metadata
|
|
18
|
-
# @dynamic avatar_url, status, banned_until, last_sign_in_at, created_at, updated_at
|
|
19
|
-
# @dynamic members, with, to_h, deconstruct, deconstruct_keys, self.[], self.members
|
|
20
17
|
def initialize(id:, email:, status:, **attributes)
|
|
21
18
|
validate_optional_attributes(attributes)
|
|
22
19
|
id = freeze_value(id)
|
data/lib/volcano/version.rb
CHANGED