forest_liana 9.17.3 → 9.17.5
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4610a65fec1c6400f4f8b4b904892d23a4e842d5aefac4fed38257abc8cadec4
|
|
4
|
+
data.tar.gz: e5ce8d49d0eded514f8222b3bfe1d69ed70e9cc10a7db8062e63181ed9a400ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f6cef35e4621ca4667021e98c4cc0072ff7309095500a2ee5b76ce82a46a6aee1d95166eb3be33154f80eee51360649d6885dc38ec2cda6fc88afeaf70d26b04
|
|
7
|
+
data.tar.gz: 46d6f1cca8c6e5ac467954efc9ab5ae57a0ef2300cd3508639d98e8ca24d366b499fb97ef25523f12e288ba19a2dff92360ac6b12acfb9782814d4545948ea37
|
|
@@ -75,7 +75,11 @@ module ForestLiana
|
|
|
75
75
|
end
|
|
76
76
|
# NOTICE: Rails 3 do not have a defined_enums method
|
|
77
77
|
elsif REGEX_UUID.match(@search) && column.type == :uuid
|
|
78
|
-
|
|
78
|
+
if column.respond_to?(:array) && column.array
|
|
79
|
+
conditions << ":search_value_for_uuid = ANY(#{column_name})"
|
|
80
|
+
else
|
|
81
|
+
conditions << "#{column_name} = :search_value_for_uuid"
|
|
82
|
+
end
|
|
79
83
|
elsif @resource.respond_to?(:defined_enums) &&
|
|
80
84
|
@resource.defined_enums.has_key?(column.name) &&
|
|
81
85
|
!@resource.defined_enums[column.name][@search.downcase].nil?
|
data/lib/forest_liana/engine.rb
CHANGED
|
@@ -59,7 +59,12 @@ module ForestLiana
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def rake?
|
|
62
|
-
|
|
62
|
+
# NOTICE: `rails db:migrate` runs through Rake but exposes $0 as `rails`,
|
|
63
|
+
# so matching the binary name alone let the bootstrapper introspect
|
|
64
|
+
# models mid-migration (crashing on enums backed by a pending column).
|
|
65
|
+
return true if File.basename($0) == 'rake'
|
|
66
|
+
|
|
67
|
+
defined?(Rake) && Rake.application.top_level_tasks.any? { |task| task != 'default' }
|
|
63
68
|
end
|
|
64
69
|
|
|
65
70
|
def database_available?
|
data/lib/forest_liana/version.rb
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
|
|
3
|
+
module ForestLiana
|
|
4
|
+
describe Engine do
|
|
5
|
+
subject(:engine) { ForestLiana::Engine.instance }
|
|
6
|
+
|
|
7
|
+
describe '#rake?' do
|
|
8
|
+
around do |example|
|
|
9
|
+
original_program_name = $0
|
|
10
|
+
example.run
|
|
11
|
+
$0 = original_program_name
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context 'when invoked through the legacy `rake` binary' do
|
|
15
|
+
it 'returns true' do
|
|
16
|
+
$0 = '/usr/local/bin/rake'
|
|
17
|
+
|
|
18
|
+
expect(engine.rake?).to be(true)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context 'when invoked through `rails` while running a Rake task (e.g. rails db:migrate)' do
|
|
23
|
+
it 'returns true so the bootstrapper does not introspect models mid-task' do
|
|
24
|
+
$0 = '/usr/local/bin/rails'
|
|
25
|
+
allow(Rake.application).to receive(:top_level_tasks).and_return(['db:migrate'])
|
|
26
|
+
|
|
27
|
+
expect(engine.rake?).to be(true)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context 'when booting the application to serve (rails server / console)' do
|
|
32
|
+
it 'returns false so the bootstrapper runs and builds the apimap' do
|
|
33
|
+
$0 = '/usr/local/bin/rails'
|
|
34
|
+
allow(Rake.application).to receive(:top_level_tasks).and_return([])
|
|
35
|
+
|
|
36
|
+
expect(engine.rake?).to be(false)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
context 'when only the default Rake task is present' do
|
|
41
|
+
it 'returns false' do
|
|
42
|
+
$0 = '/usr/local/bin/rails'
|
|
43
|
+
allow(Rake.application).to receive(:top_level_tasks).and_return(['default'])
|
|
44
|
+
|
|
45
|
+
expect(engine.rake?).to be(false)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module ForestLiana
|
|
2
|
+
describe SearchQueryBuilder do
|
|
3
|
+
let(:user) { { 'id' => '1', 'rendering_id' => 1 } }
|
|
4
|
+
let(:collection) { ForestLiana::Model::Collection.new(name: 'Tree', fields: []) }
|
|
5
|
+
let(:search_uuid) { '75fbcb43-f6f8-4cd1-861f-09a61fd1ddad' }
|
|
6
|
+
let(:params) { { search: search_uuid, searchExtended: '0' } }
|
|
7
|
+
let(:builder) { described_class.new(params, [], collection, user) }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(ForestLiana::ScopeManager)
|
|
11
|
+
.to receive(:append_scope_for_user)
|
|
12
|
+
.and_return(nil)
|
|
13
|
+
allow(ForestLiana)
|
|
14
|
+
.to receive(:schema_for_resource)
|
|
15
|
+
.and_return(ForestLiana::Model::Collection.new(name: 'Tree', fields: []))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '#perform' do
|
|
19
|
+
context 'when a column is an array uuid type' do
|
|
20
|
+
let(:array_uuid_column) do
|
|
21
|
+
double('Column', name: 'attachment_ids', type: :uuid, array: true).tap do |col|
|
|
22
|
+
allow(col).to receive(:respond_to?).with(:array).and_return(true)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
let(:normal_uuid_column) do
|
|
27
|
+
double('Column', name: 'external_id', type: :uuid, array: false).tap do |col|
|
|
28
|
+
allow(col).to receive(:respond_to?).with(:array).and_return(true)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
before do
|
|
33
|
+
allow(Tree).to receive(:columns).and_return([array_uuid_column, normal_uuid_column])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'searches the array column using ANY() syntax' do
|
|
37
|
+
result = builder.perform(Tree.all)
|
|
38
|
+
expect(result.to_sql).to match(/= ANY.*attachment_ids/i)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'searches the non-array uuid column using equality syntax' do
|
|
42
|
+
result = builder.perform(Tree.all)
|
|
43
|
+
expect(result.to_sql).to match(/"external_id"\s+=\s+'#{search_uuid}'/i)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_liana
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.17.
|
|
4
|
+
version: 9.17.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sandro Munda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -438,6 +438,7 @@ files:
|
|
|
438
438
|
- spec/helpers/forest_liana/schema_helper_spec.rb
|
|
439
439
|
- spec/lib/forest_liana/bootstrapper_spec.rb
|
|
440
440
|
- spec/lib/forest_liana/collection_spec.rb
|
|
441
|
+
- spec/lib/forest_liana/engine_spec.rb
|
|
441
442
|
- spec/lib/forest_liana/schema_file_updater_spec.rb
|
|
442
443
|
- spec/rails_helper.rb
|
|
443
444
|
- spec/requests/actions_controller_spec.rb
|
|
@@ -465,6 +466,7 @@ files:
|
|
|
465
466
|
- spec/services/forest_liana/schema_adapter_default_values_spec.rb
|
|
466
467
|
- spec/services/forest_liana/schema_adapter_spec.rb
|
|
467
468
|
- spec/services/forest_liana/scope_manager_spec.rb
|
|
469
|
+
- spec/services/forest_liana/search_query_builder_spec.rb
|
|
468
470
|
- spec/services/forest_liana/serializer_factory_spec.rb
|
|
469
471
|
- spec/services/forest_liana/smart_action_field_validator_spec.rb
|
|
470
472
|
- spec/services/forest_liana/smart_action_form_parser_spec.rb
|
|
@@ -748,6 +750,7 @@ test_files:
|
|
|
748
750
|
- spec/helpers/forest_liana/schema_helper_spec.rb
|
|
749
751
|
- spec/lib/forest_liana/bootstrapper_spec.rb
|
|
750
752
|
- spec/lib/forest_liana/collection_spec.rb
|
|
753
|
+
- spec/lib/forest_liana/engine_spec.rb
|
|
751
754
|
- spec/lib/forest_liana/schema_file_updater_spec.rb
|
|
752
755
|
- spec/rails_helper.rb
|
|
753
756
|
- spec/requests/actions_controller_spec.rb
|
|
@@ -775,6 +778,7 @@ test_files:
|
|
|
775
778
|
- spec/services/forest_liana/schema_adapter_default_values_spec.rb
|
|
776
779
|
- spec/services/forest_liana/schema_adapter_spec.rb
|
|
777
780
|
- spec/services/forest_liana/scope_manager_spec.rb
|
|
781
|
+
- spec/services/forest_liana/search_query_builder_spec.rb
|
|
778
782
|
- spec/services/forest_liana/serializer_factory_spec.rb
|
|
779
783
|
- spec/services/forest_liana/smart_action_field_validator_spec.rb
|
|
780
784
|
- spec/services/forest_liana/smart_action_form_parser_spec.rb
|