volcano-sdk 0.32.1 → 0.32.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/lib/volcano/immutable_request_value.rb +21 -4
- data/lib/volcano/version.rb +1 -1
- data/sig/auth_credentials.rbs +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea2aa2e1bb816dd0f4feef5c80d3dab616b24d56b54e81394fb63d5774bddae0
|
|
4
|
+
data.tar.gz: 7ce5d0819d1a808fb4ee54c63c830a2a5173b0d15449174a007ac4b03236f0ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '037199a369e46cb09775fb9e85b1396ff373d3a39b88411670ccae2b9a3494985755016b1af78f41d84cbe674ff5703c3f1cef4c49b7c8f05a3e9e7ba46b38ed'
|
|
7
|
+
data.tar.gz: d178936e2018bcad91947371b2ee56878ef5f06f42df97e5a273035ae9395a2219062efd80bad18c2d8b4f13abd5eb8eb4908d17d8e46561faa1f4a36ac77471
|
|
@@ -5,16 +5,33 @@ module Volcano
|
|
|
5
5
|
# Copies JSON-like request values before storing them in builders or sending them.
|
|
6
6
|
module ImmutableRequestValue
|
|
7
7
|
def self.capture(value)
|
|
8
|
+
# @type var active: Hash[Integer, bool]
|
|
9
|
+
active = {}
|
|
10
|
+
capture_value(value, active)
|
|
11
|
+
rescue SystemStackError
|
|
12
|
+
raise TypeError, 'Request value nesting is too deep'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.capture_value(value, active)
|
|
8
16
|
case value
|
|
9
17
|
when String, Time then value.dup.freeze
|
|
10
|
-
when Array then value
|
|
11
|
-
when Hash then capture_hash(value)
|
|
18
|
+
when Array, Hash then capture_container(value, active)
|
|
12
19
|
else value
|
|
13
20
|
end
|
|
14
21
|
end
|
|
15
22
|
|
|
16
|
-
def self.
|
|
17
|
-
|
|
23
|
+
def self.capture_container(value, active)
|
|
24
|
+
id = value.object_id
|
|
25
|
+
raise TypeError, 'Request value contains a cycle' if active.key?(id)
|
|
26
|
+
|
|
27
|
+
active[id] = true
|
|
28
|
+
copy = value.is_a?(Array) ? value.map { |item| capture_value(item, active) } : capture_hash(value, active)
|
|
29
|
+
active.delete(id)
|
|
30
|
+
copy.freeze
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.capture_hash(value, active)
|
|
34
|
+
value.to_h { |key, item| [capture_value(key, active), capture_value(item, active)] }
|
|
18
35
|
end
|
|
19
36
|
end
|
|
20
37
|
private_constant :ImmutableRequestValue
|
data/lib/volcano/version.rb
CHANGED
data/sig/auth_credentials.rbs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
module Volcano
|
|
2
|
+
type auth_state_event = :initial_session | :signed_in | :signed_out | :token_refreshed
|
|
3
|
+
|
|
2
4
|
class Auth
|
|
3
5
|
def current_session: () -> Session?
|
|
4
6
|
def current_session=: (Session session) -> void
|
|
5
|
-
def on_auth_state_change: () { (
|
|
7
|
+
def on_auth_state_change: () { (auth_state_event, Session?) -> void } -> AuthSubscription
|
|
6
8
|
def sign_in: (email: String, password: String) -> Session
|
|
7
9
|
def sign_up: (email: String, password: String, ?metadata: session_user_input, ?sign_in_when_allowed: bool) -> SignUpResult
|
|
8
10
|
def sign_in_anonymously: (?metadata: session_user_input) -> Session
|