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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0f776d6ce8242c9e13c9bda50c0a57656288bfe4ff5e14f88e75c19a7609ded
4
- data.tar.gz: 25436052f65e6ededb49df00688a2e7d4076a233ca84502a2503dc470d1ab6d5
3
+ metadata.gz: ea2aa2e1bb816dd0f4feef5c80d3dab616b24d56b54e81394fb63d5774bddae0
4
+ data.tar.gz: 7ce5d0819d1a808fb4ee54c63c830a2a5173b0d15449174a007ac4b03236f0ac
5
5
  SHA512:
6
- metadata.gz: 0da1887ccafe797e2169899402489b9eab52d6587782461fd0390dfc63041ebe0a134e6ab89dc42d9ab5e5acf2dae34332516b2727f4bc51726f078319d58205
7
- data.tar.gz: fce88e25d637dfb1dda8bb10b279e0dbfcbe621e4912ca1c941460eb1e94b6cc4b1e84242402b692ba19a66c0cab89992ea14d826beef3710629970dd361353f
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.map { |item| capture(item) }.freeze
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.capture_hash(value)
17
- value.to_h { |key, item| [capture(key), capture(item)] }.freeze
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Volcano
4
- VERSION = '0.32.1'
4
+ VERSION = '0.32.2'
5
5
  end
@@ -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: () { (Symbol, Session?) -> void } -> AuthSubscription
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volcano-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.1
4
+ version: 0.32.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kong