volcano-sdk 0.32.1 → 0.32.3

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: 9d3d0ea5cca245b91aacf3a1df887df87aa5ca81419e1410019f9536fcb640aa
4
+ data.tar.gz: 7173bed2407482a5122d11439e2c557764c1ed10463012490c38448e480bfbb8
5
5
  SHA512:
6
- metadata.gz: 0da1887ccafe797e2169899402489b9eab52d6587782461fd0390dfc63041ebe0a134e6ab89dc42d9ab5e5acf2dae34332516b2727f4bc51726f078319d58205
7
- data.tar.gz: fce88e25d637dfb1dda8bb10b279e0dbfcbe621e4912ca1c941460eb1e94b6cc4b1e84242402b692ba19a66c0cab89992ea14d826beef3710629970dd361353f
6
+ metadata.gz: 7fe8b416c01cf5be74751679b0487e9f5c6031ff35caa039b936b63eb49fdf87ece8f3e65e7afbd28f4acf3ccbddf3892f492d2796aec82f59c840ba82f4c7fe
7
+ data.tar.gz: 76844522cca4fbfefb369d9d597079d5b6ae28d385a297f77b43c012c6101b3fbc42bd96f9dee82da7a9f66b318e9446b17524e4803f9f9e83ed9cac4d9a1e64
@@ -29,10 +29,11 @@ module Volcano
29
29
  # DNS-safe name pattern an invoke checks would reject half the input.
30
30
  function_id = identifier(function_name, 'function_name')
31
31
  name = execution_name.nil? ? nil : execution_name_argument(execution_name)
32
+ request_payload = ImmutableRequestValue.capture(payload)
32
33
  response = Transport.invoke do
33
34
  @transport.start_durable_execution_from_application(
34
35
  authorization: @client.function_token,
35
- function_id: function_id, payload: payload.dup, execution_name: name
36
+ function_id: function_id, payload: request_payload, execution_name: name
36
37
  )
37
38
  end
38
39
  durable_execution(Transport.body(response, 202))
@@ -62,6 +63,7 @@ module Volcano
62
63
  project = identifier(project_id, 'project_id')
63
64
  function_id = identifier(function_name, 'function_name')
64
65
  validate_paging(page, limit)
66
+ status = status&.dup&.freeze
65
67
  response = Transport.invoke do
66
68
  @transport.list_durable_executions(
67
69
  authorization: @client.session_token, project_id: project, function_id: function_id,
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'time'
4
+ require_relative 'immutable_request_value'
4
5
 
5
6
  module Volcano
6
7
  DURABLE_EXECUTION_ATTRIBUTES = %i[
@@ -65,16 +66,10 @@ module Volcano
65
66
  # `result` is the function's own JSON, so it is frozen all the way down.
66
67
  def immutable_value(value)
67
68
  case value
68
- when Hash then immutable_value_hash(value)
69
- when Array then value.map { |item| immutable_value(item) }.freeze
70
- when Time, String then value.dup.freeze
69
+ when Hash, Array, Time, String then ImmutableRequestValue.capture(value)
71
70
  else value
72
71
  end
73
72
  end
74
-
75
- def immutable_value_hash(value)
76
- value.to_h { |key, item| [immutable_value(key), immutable_value(item)] }.freeze
77
- end
78
73
  end
79
74
 
80
75
  # One page of a durable function's executions, most recent first.
@@ -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.3'
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kong