ruby_event_store-browser 2.15.0 → 2.16.0

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: 1c366c7c2559c3b772eaa684cb2de31f0cf263d5ae28e321dc1bf1218a1db70a
4
- data.tar.gz: ca0415ad35e0ee4a8777f1ff49e8159bfa3c8c08bc567c712d1cda2ee849fcae
3
+ metadata.gz: 9cb90a52015d1f514d68911b5c55e4f6173aa9f731d8d5996df5841b56fefd7b
4
+ data.tar.gz: bbcc7f349e97eaf69e1d4e827eb9a3439e0118305fe4528a74925f46544a8bc3
5
5
  SHA512:
6
- metadata.gz: da3601297498d22bf614e33fefd4ba5d040a77d2c0c6a57a0bd389321dced3bcc6ea26873426e82f9c80eeb64495c8514505166712fb47eb35132cbd9ea22b1e
7
- data.tar.gz: f3be76ac481a1f910dc27137a9aba4d33aa5b6aa9bf4b6c178b960580db29520b5f53485c8a6e6ded4bae26ab3625a76d79f6cad80b6b8a57c7794b1d2783a76
6
+ metadata.gz: df4bcaafe58065b8da8cfe7c945cd2ebf08300b767e26f5005dd30314c6573e471e4710660826687d2cb2ca77ed3de89bd43770910a451450b3640ba2e6aa3c1
7
+ data.tar.gz: 5bb7187864197a651d79faf598ffcf80232e711f6b48191e9e75e277352ff31458d2896bfd2094e38c994e2c5ed8400f18e911773460f1a357a01a39e9daf31b
@@ -9,7 +9,9 @@ module RubyEventStore
9
9
  @path =
10
10
  load_path
11
11
  .select { |entry| String === entry }
12
- .find { |entry| entry.match? %r{ruby_event_store-browser(?:-\d+\.\d+\.\d+)?/lib\z} }
12
+ .find do |entry|
13
+ entry.match? %r{ruby_event_store-browser(?:-\d+\.\d+\.\d+)?/lib\z}
14
+ end
13
15
  end
14
16
 
15
17
  def version
@@ -20,7 +20,9 @@ module RubyEventStore
20
20
  private
21
21
 
22
22
  def streams
23
- event_store.streams_of(event_id).map { |stream| { "id" => stream.name, "type" => "streams" } }
23
+ event_store
24
+ .streams_of(event_id)
25
+ .map { |stream| { "id" => stream.name, "type" => "streams" } }
24
26
  end
25
27
 
26
28
  attr_reader :event_store, :event_id
@@ -30,7 +32,9 @@ module RubyEventStore
30
32
  end
31
33
 
32
34
  def parent_event_id
33
- event_store.read.event(event.metadata.fetch(:causation_id))&.event_id if event.metadata.has_key?(:causation_id)
35
+ if event.metadata.has_key?(:causation_id)
36
+ event_store.read.event(event.metadata.fetch(:causation_id))&.event_id
37
+ end
34
38
  end
35
39
  end
36
40
  end
@@ -47,14 +47,18 @@ module RubyEventStore
47
47
 
48
48
  def events_forward(position)
49
49
  spec = event_store.read.limit(count)
50
- spec = spec.stream(stream_name) unless stream_name.eql?(SERIALIZED_GLOBAL_STREAM_NAME)
50
+ spec = spec.stream(stream_name) unless stream_name.eql?(
51
+ SERIALIZED_GLOBAL_STREAM_NAME
52
+ )
51
53
  spec = spec.from(position) unless position.equal?(HEAD)
52
54
  spec.to_a
53
55
  end
54
56
 
55
57
  def events_backward(position)
56
58
  spec = event_store.read.limit(count).backward
57
- spec = spec.stream(stream_name) unless stream_name.eql?(SERIALIZED_GLOBAL_STREAM_NAME)
59
+ spec = spec.stream(stream_name) unless stream_name.eql?(
60
+ SERIALIZED_GLOBAL_STREAM_NAME
61
+ )
58
62
  spec = spec.from(position) unless position.equal?(HEAD)
59
63
  spec.to_a
60
64
  end
@@ -70,7 +74,12 @@ module RubyEventStore
70
74
  end
71
75
 
72
76
  def prev_page_link(event_id)
73
- routing.paginated_events_from_stream_url(id: stream_name, position: event_id, direction: :forward, count: count)
77
+ routing.paginated_events_from_stream_url(
78
+ id: stream_name,
79
+ position: event_id,
80
+ direction: :forward,
81
+ count: count
82
+ )
74
83
  end
75
84
 
76
85
  def next_page_link(event_id)
@@ -83,11 +92,21 @@ module RubyEventStore
83
92
  end
84
93
 
85
94
  def first_page_link
86
- routing.paginated_events_from_stream_url(id: stream_name, position: :head, direction: :backward, count: count)
95
+ routing.paginated_events_from_stream_url(
96
+ id: stream_name,
97
+ position: :head,
98
+ direction: :backward,
99
+ count: count
100
+ )
87
101
  end
88
102
 
89
103
  def last_page_link
90
- routing.paginated_events_from_stream_url(id: stream_name, position: :head, direction: :forward, count: count)
104
+ routing.paginated_events_from_stream_url(
105
+ id: stream_name,
106
+ position: :head,
107
+ direction: :forward,
108
+ count: count
109
+ )
91
110
  end
92
111
 
93
112
  def count
@@ -10,7 +10,14 @@ module RubyEventStore
10
10
  end
11
11
 
12
12
  def to_h
13
- { data: JsonApiStream.new(stream_name, events_from_stream_url, related_streams).to_h }
13
+ {
14
+ data:
15
+ JsonApiStream.new(
16
+ stream_name,
17
+ events_from_stream_url,
18
+ related_streams
19
+ ).to_h
20
+ }
14
21
  end
15
22
 
16
23
  private
@@ -22,7 +29,9 @@ module RubyEventStore
22
29
  end
23
30
 
24
31
  def related_streams
25
- related_streams_query.call(stream_name) unless related_streams_query.equal?(DEFAULT_RELATED_STREAMS_QUERY)
32
+ unless related_streams_query.equal?(DEFAULT_RELATED_STREAMS_QUERY)
33
+ related_streams_query.call(stream_name)
34
+ end
26
35
  end
27
36
  end
28
37
  end
@@ -14,7 +14,7 @@ module RubyEventStore
14
14
  type: "events",
15
15
  attributes: {
16
16
  event_type: event.event_type,
17
- data: event.data,
17
+ data: sanitize_infinity_values(event.data),
18
18
  metadata: metadata,
19
19
  correlation_stream_name: correlation_stream_name,
20
20
  causation_stream_name: causation_stream_name,
@@ -28,15 +28,38 @@ module RubyEventStore
28
28
 
29
29
  attr_reader :event, :parent_event_id
30
30
 
31
+ def sanitize_infinity_values(value)
32
+ case value
33
+ in Hash => hash
34
+ hash.transform_values { |v| sanitize_infinity_values(v) }
35
+ in Array => array
36
+ array.map { |v| sanitize_infinity_values(v) }
37
+ in Float => f if f.infinite?
38
+ f.positive? ? "Infinity" : "-Infinity"
39
+ in Float => f if f.nan?
40
+ "NaN"
41
+ else
42
+ value
43
+ end
44
+ end
45
+
31
46
  def metadata
32
47
  event.metadata.to_h.tap do |m|
33
- m[:timestamp] = event.metadata.fetch(:timestamp).iso8601(TIMESTAMP_PRECISION)
34
- m[:valid_at] = event.metadata.fetch(:valid_at).iso8601(TIMESTAMP_PRECISION)
48
+ m[:timestamp] = event
49
+ .metadata
50
+ .fetch(:timestamp)
51
+ .iso8601(TIMESTAMP_PRECISION)
52
+ m[:valid_at] = event
53
+ .metadata
54
+ .fetch(:valid_at)
55
+ .iso8601(TIMESTAMP_PRECISION)
35
56
  end
36
57
  end
37
58
 
38
59
  def correlation_stream_name
39
- "$by_correlation_id_#{metadata.fetch(:correlation_id)}" if metadata.has_key?(:correlation_id)
60
+ if metadata.has_key?(:correlation_id)
61
+ "$by_correlation_id_#{metadata.fetch(:correlation_id)}"
62
+ end
40
63
  end
41
64
 
42
65
  def causation_stream_name
@@ -19,7 +19,11 @@ module RubyEventStore
19
19
  return unless request.request_method.eql?(request_method)
20
20
 
21
21
  match_data = regexp.match(File.join("/", request.path_info))
22
- match_data.named_captures.transform_values { |v| Rack::Utils.unescape(v) } if match_data
22
+ if match_data
23
+ match_data.named_captures.transform_values do |v|
24
+ Rack::Utils.unescape(v)
25
+ end
26
+ end
23
27
  end
24
28
 
25
29
  def call(params, urls)
@@ -47,7 +51,14 @@ module RubyEventStore
47
51
  def handle(request)
48
52
  routes.each do |route|
49
53
  route_params = route.match(request)
50
- return route.call(request.params.merge(route_params), urls.with_request(request)) if route_params
54
+ if route_params
55
+ return(
56
+ route.call(
57
+ request.params.merge(route_params),
58
+ urls.with_request(request)
59
+ )
60
+ )
61
+ end
51
62
  end
52
63
  raise NoMatch
53
64
  end
@@ -12,7 +12,11 @@ module RubyEventStore
12
12
  end
13
13
 
14
14
  def with_request(request)
15
- Urls.new(host || request.base_url, root_path || request.script_name, api_url)
15
+ Urls.new(
16
+ host || request.base_url,
17
+ root_path || request.script_name,
18
+ api_url
19
+ )
16
20
  end
17
21
 
18
22
  attr_reader :app_url, :api_url, :host, :root_path
@@ -33,11 +37,20 @@ module RubyEventStore
33
37
  "#{api_url}/streams"
34
38
  end
35
39
 
36
- def paginated_events_from_stream_url(id:, position: nil, direction: nil, count: nil)
40
+ def paginated_events_from_stream_url(
41
+ id:,
42
+ position: nil,
43
+ direction: nil,
44
+ count: nil
45
+ )
37
46
  stream_name = Rack::Utils.escape(id)
38
47
  query_string =
39
48
  URI.encode_www_form(
40
- { "page[position]" => position, "page[direction]" => direction, "page[count]" => count }.compact
49
+ {
50
+ "page[position]" => position,
51
+ "page[direction]" => direction,
52
+ "page[count]" => count
53
+ }.compact
41
54
  )
42
55
 
43
56
  if query_string.empty?
@@ -49,20 +62,12 @@ module RubyEventStore
49
62
 
50
63
  def browser_js_url
51
64
  name = "ruby_event_store_browser.js"
52
- if gem_source.from_git?
53
- cdn_file_url(name)
54
- else
55
- local_file_url(name)
56
- end
65
+ gem_source.from_git? ? cdn_file_url(name) : local_file_url(name)
57
66
  end
58
67
 
59
68
  def browser_css_url
60
69
  name = "ruby_event_store_browser.css"
61
- if gem_source.from_git?
62
- cdn_file_url(name)
63
- else
64
- local_file_url(name)
65
- end
70
+ gem_source.from_git? ? cdn_file_url(name) : local_file_url(name)
66
71
  end
67
72
 
68
73
  def bootstrap_js_url
@@ -70,10 +75,12 @@ module RubyEventStore
70
75
  end
71
76
 
72
77
  def ==(o)
73
- self.class.eql?(o.class) && app_url.eql?(o.app_url) && api_url.eql?(o.api_url)
78
+ self.class.eql?(o.class) && app_url.eql?(o.app_url) &&
79
+ api_url.eql?(o.api_url)
74
80
  end
75
81
 
76
82
  private
83
+
77
84
  attr_reader :gem_source
78
85
 
79
86
  def local_file_url(name)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RubyEventStore
4
4
  module Browser
5
- VERSION = "2.15.0"
5
+ VERSION = "2.16.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store-browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.0
4
+ version: 2.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-09 00:00:00.000000000 Z
10
+ date: 2025-03-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ruby_event_store
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - '='
18
17
  - !ruby/object:Gem::Version
19
- version: 2.15.0
18
+ version: 2.16.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - '='
25
24
  - !ruby/object:Gem::Version
26
- version: 2.15.0
25
+ version: 2.16.0
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rack
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +81,6 @@ metadata:
82
81
  source_code_uri: https://github.com/RailsEventStore/rails_event_store
83
82
  bug_tracker_uri: https://github.com/RailsEventStore/rails_event_store/issues
84
83
  rubygems_mfa_required: 'true'
85
- post_install_message:
86
84
  rdoc_options: []
87
85
  require_paths:
88
86
  - lib
@@ -97,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  - !ruby/object:Gem::Version
98
96
  version: '0'
99
97
  requirements: []
100
- rubygems_version: 3.5.17
101
- signing_key:
98
+ rubygems_version: 3.6.2
102
99
  specification_version: 4
103
100
  summary: Event browser companion application for RubyEventStore
104
101
  test_files: []