forest_admin_datasource_toolkit 1.12.4 → 1.12.6
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: 108cdfbbd48ef7a4282c02bdc539fb1e2f4f3bde6c187bc57f3c55409aeb7573
|
|
4
|
+
data.tar.gz: 2fa545b164621f558255d286d2d76684b8fcd489292fec67680b6ba521931da5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c1aeff54b92dc0ddf9869f6427372df4c20a29372f4506e416a303945d63873a9cddca8ab05d35b9e6d2ef9ca301054b803748c1fa851aba3f95a2a74c04b02
|
|
7
|
+
data.tar.gz: b1380d47b4b0d68e50a9a4a8f5223a769e50128950c5e5b5f0d9056f71cccbe9a8b6481139a34e2a640533298e95d9c4b18e00891df425406c4c93ae1e676bf6
|
data/lib/forest_admin_datasource_toolkit/components/query/condition_tree/condition_tree_factory.rb
CHANGED
|
@@ -28,7 +28,15 @@ module ForestAdminDatasourceToolkit
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
normalized_ids = ids.map do |id|
|
|
32
|
+
if id.is_a?(Hash)
|
|
33
|
+
primary_key_names.map { |pk_name| id[pk_name] }
|
|
34
|
+
else
|
|
35
|
+
id
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
match_fields(primary_key_names, normalized_ids)
|
|
32
40
|
end
|
|
33
41
|
|
|
34
42
|
def self.intersect(trees = nil)
|
|
@@ -78,18 +78,18 @@ module ForestAdminDatasourceToolkit
|
|
|
78
78
|
)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def self.get_value(collection, caller,
|
|
82
|
-
if
|
|
81
|
+
def self.get_value(collection, caller, primary_key_values, field)
|
|
82
|
+
if primary_key_values.is_a? Array
|
|
83
83
|
index = Schema.primary_keys(collection).index(field)
|
|
84
84
|
|
|
85
|
-
return
|
|
85
|
+
return primary_key_values[index] if index
|
|
86
86
|
elsif Schema.primary_keys(collection).include?(field)
|
|
87
|
-
return
|
|
87
|
+
return primary_key_values[field]
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
records = collection.list(
|
|
91
91
|
caller,
|
|
92
|
-
ForestAdminDatasourceToolkit::Components::Query::Filter.new(condition_tree: ConditionTree::ConditionTreeFactory.match_ids(collection, [
|
|
92
|
+
ForestAdminDatasourceToolkit::Components::Query::Filter.new(condition_tree: ConditionTree::ConditionTreeFactory.match_ids(collection, [primary_key_values])),
|
|
93
93
|
Projection.new([field])
|
|
94
94
|
)
|
|
95
95
|
|
|
@@ -130,7 +130,7 @@ module ForestAdminDatasourceToolkit
|
|
|
130
130
|
nil
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
def self.list_relation(collection,
|
|
133
|
+
def self.list_relation(collection, primary_key_values, relation_name, caller, foreign_filter, projection)
|
|
134
134
|
relation = collection.schema[:fields][relation_name]
|
|
135
135
|
foreign_collection = collection.datasource.get_collection(relation.foreign_collection)
|
|
136
136
|
|
|
@@ -141,7 +141,7 @@ module ForestAdminDatasourceToolkit
|
|
|
141
141
|
through_collection = collection.datasource.get_collection(relation.through_collection)
|
|
142
142
|
records = through_collection.list(
|
|
143
143
|
caller,
|
|
144
|
-
FilterFactory.make_through_filter(collection,
|
|
144
|
+
FilterFactory.make_through_filter(collection, primary_key_values, relation_name, caller, foreign_filter),
|
|
145
145
|
projection.nest(prefix: foreign_relation)
|
|
146
146
|
)
|
|
147
147
|
|
|
@@ -151,12 +151,12 @@ module ForestAdminDatasourceToolkit
|
|
|
151
151
|
|
|
152
152
|
foreign_collection.list(
|
|
153
153
|
caller,
|
|
154
|
-
FilterFactory.make_foreign_filter(collection,
|
|
154
|
+
FilterFactory.make_foreign_filter(collection, primary_key_values, relation_name, caller, foreign_filter),
|
|
155
155
|
projection
|
|
156
156
|
)
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
-
def self.aggregate_relation(collection,
|
|
159
|
+
def self.aggregate_relation(collection, primary_key_values, relation_name, caller, foreign_filter, aggregation, limit = nil)
|
|
160
160
|
relation = collection.schema[:fields][relation_name]
|
|
161
161
|
foreign_collection = collection.datasource.get_collection(relation.foreign_collection)
|
|
162
162
|
|
|
@@ -167,7 +167,7 @@ module ForestAdminDatasourceToolkit
|
|
|
167
167
|
|
|
168
168
|
return through_collection.aggregate(
|
|
169
169
|
caller,
|
|
170
|
-
FilterFactory.make_through_filter(collection,
|
|
170
|
+
FilterFactory.make_through_filter(collection, primary_key_values, relation_name, caller, foreign_filter),
|
|
171
171
|
aggregation,
|
|
172
172
|
limit
|
|
173
173
|
)
|
|
@@ -176,7 +176,7 @@ module ForestAdminDatasourceToolkit
|
|
|
176
176
|
|
|
177
177
|
foreign_collection.aggregate(
|
|
178
178
|
caller,
|
|
179
|
-
FilterFactory.make_foreign_filter(collection,
|
|
179
|
+
FilterFactory.make_foreign_filter(collection, primary_key_values, relation_name, caller, foreign_filter),
|
|
180
180
|
aggregation,
|
|
181
181
|
limit
|
|
182
182
|
)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_toolkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.12.
|
|
4
|
+
version: 1.12.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthieu
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-10-
|
|
12
|
+
date: 2025-10-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|