pg_eventstore 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b824856ac1174e2aa2431388e12cd2997256ad4a5638c319d22ee1863c24f4ea
4
- data.tar.gz: 64f73d163abf7a80e9384483857ab1d2cfd38da6d98f2d8f7552a24ac8a7fb3c
3
+ metadata.gz: edf4e7b2fb569adcc91434eecc16b269504108e980924f45543996b37f2fca67
4
+ data.tar.gz: 451796b0e92415aadf14c7ef6e2627378d99181f4a37104f8ce50ea990b12c75
5
5
  SHA512:
6
- metadata.gz: c37a3572d224ed2706bf31d416da5bdfb91f37323225fd1f60f060eb76cd96ff33907055f32924cc6d155aa8abae44056e1f982eff560dcca27b70f0c43afa3e
7
- data.tar.gz: 891b7a1e7697b31f53964aeacfe9ae516294421c63e9a7d7095b0bd9489b5cf56ef9101639317cd5894d2f4e7f72b51be6ea14c9b7e5c238aaee2e25379d7a7b
6
+ metadata.gz: 78af9eb3c02e3f002765dfb888263a221e3f77cd005593ecff4c5a8443f781e992ecd30d0f81120f4afcd268b573afab5c8616f683aed0255104db7d1c6e3fa1
7
+ data.tar.gz: d8c27f5efd39737c453b490e176bba7cb6d24456faee0b86fb317899ec7bb19d411ed5fdc3f7ed7742a23deb36e87b70d2ce44a4727bf78e23709f77958bd1b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.2]
4
+ - Improve web app compatibility with rails
5
+
6
+ ## [1.1.1]
7
+ - Allow case insensitive search by context, stream name and event type in admin UI
8
+
3
9
  ## [1.1.0]
4
10
  - Add "Reset position" button on Subscriptions Admin UI page
5
11
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgEventstore
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.2"
5
5
  end
@@ -9,8 +9,6 @@ module PgEventstore
9
9
  set :environment, -> { (ENV['RACK_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV'])&.to_sym || :development }
10
10
  set :logging, -> { environment == :development || environment == :test }
11
11
  set :erb, layout: :'layouts/application'
12
- set :sessions, true
13
- set :session_secret, ENV.fetch('SECRET_KEY_BASE') { SecureRandom.hex(64) }
14
12
 
15
13
  helpers(Paginator::Helpers, Subscriptions::Helpers) do
16
14
  # @return [Array<Hash>, nil]
@@ -29,7 +27,12 @@ module PgEventstore
29
27
 
30
28
  # @return [Symbol]
31
29
  def current_config
32
- PgEventstore.available_configs.include?(session[:current_config]) ? session[:current_config] : :default
30
+ config = request.cookies['current_config']&.to_s&.to_sym
31
+ PgEventstore.available_configs.include?(config) ? config : :default
32
+ end
33
+
34
+ def current_config=(val)
35
+ response.set_cookie('current_config', { value: val.to_s, http_only: true, same_site: :lax })
33
36
  end
34
37
 
35
38
  # @return [PgEventstore::Connection]
@@ -96,8 +99,8 @@ module PgEventstore
96
99
  post '/change_config' do
97
100
  config = params[:config]&.to_sym
98
101
  config = :default unless PgEventstore.available_configs.include?(config)
99
- session[:current_config] = config
100
- redirect(url('/'))
102
+ self.current_config = config
103
+ redirect(redirect_back_url(fallback_url: '/'))
101
104
  end
102
105
 
103
106
  get '/stream_contexts_filtering', provides: :json do
@@ -15,7 +15,7 @@ module PgEventstore
15
15
  where('context is not null and stream_name is not null').
16
16
  group('event_type').order("event_type #{order}").limit(per_page)
17
17
  sql_builder.where("event_type #{direction_operator} ?", starting_id) if starting_id
18
- sql_builder.where('event_type like ?', "#{options[:query]}%")
18
+ sql_builder.where('event_type ilike ?', "#{options[:query]}%")
19
19
  connection.with do |conn|
20
20
  conn.exec_params(*sql_builder.to_exec_params)
21
21
  end.to_a
@@ -30,7 +30,8 @@ module PgEventstore
30
30
  sql_builder =
31
31
  SQLBuilder.new.select('event_type').from('partitions').
32
32
  where('context is not null and stream_name is not null').
33
- where("event_type #{direction_operator} ?", starting_id).where('event_type like ?', "#{options[:query]}%").
33
+ where("event_type #{direction_operator} ?", starting_id).
34
+ where('event_type ilike ?', "#{options[:query]}%").
34
35
  group('event_type').order("event_type #{order}").limit(1).offset(per_page)
35
36
 
36
37
  connection.with do |conn|
@@ -14,7 +14,7 @@ module PgEventstore
14
14
  SQLBuilder.new.select('context').from('partitions').where('stream_name is null and event_type is null')
15
15
  .limit(per_page).order("context #{order}")
16
16
  sql_builder.where("context #{direction_operator} ?", starting_id) if starting_id
17
- sql_builder.where('context like ?', "#{options[:query]}%")
17
+ sql_builder.where('context ilike ?', "#{options[:query]}%")
18
18
  connection.with do |conn|
19
19
  conn.exec_params(*sql_builder.to_exec_params)
20
20
  end.to_a
@@ -28,7 +28,7 @@ module PgEventstore
28
28
  starting_id = collection.first['context']
29
29
  sql_builder =
30
30
  SQLBuilder.new.select('context').from('partitions').where('stream_name is null and event_type is null').
31
- where("context #{direction_operator} ?", starting_id).where('context like ?', "#{options[:query]}%").
31
+ where("context #{direction_operator} ?", starting_id).where('context ilike ?', "#{options[:query]}%").
32
32
  limit(1).offset(per_page).order("context #{order}")
33
33
 
34
34
  connection.with do |conn|
@@ -13,7 +13,7 @@ module PgEventstore
13
13
  sql_builder =
14
14
  SQLBuilder.new.select('stream_name').from('partitions').
15
15
  where('event_type is null and context = ?', options[:context]).
16
- where('stream_name like ?', "#{options[:query]}%")
16
+ where('stream_name ilike ?', "#{options[:query]}%")
17
17
  sql_builder.where("stream_name #{direction_operator} ?", starting_id) if starting_id
18
18
  sql_builder.limit(per_page).order("stream_name #{order}")
19
19
  connection.with do |conn|
@@ -30,7 +30,7 @@ module PgEventstore
30
30
  sql_builder =
31
31
  SQLBuilder.new.select('stream_name').from('partitions').
32
32
  where("stream_name #{direction_operator} ?", starting_id).
33
- where('stream_name like ?', "#{options[:query]}%").
33
+ where('stream_name ilike ?', "#{options[:query]}%").
34
34
  where('event_type is null and context = ?', options[:context]).
35
35
  limit(1).offset(per_page).order("stream_name #{order}")
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_eventstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Dzyzenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg