forest_admin_agent 1.40.0 → 1.41.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 +4 -4
- data/lib/forest_admin_agent/routes/charts/charts.rb +5 -1
- data/lib/forest_admin_agent/routes/resources/related/associate_related.rb +1 -0
- data/lib/forest_admin_agent/routes/resources/related/dissociate_related.rb +1 -0
- data/lib/forest_admin_agent/routes/resources/related/update_related.rb +5 -0
- data/lib/forest_admin_agent/routes/resources/store.rb +2 -0
- data/lib/forest_admin_agent/utils/schema/generator_field.rb +1 -1
- data/lib/forest_admin_agent/utils/schema/schema_emitter.rb +1 -1
- data/lib/forest_admin_agent/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e206afe12d8b554e97e214bc27441b51ddf5252d3e4b1ee5800645bd27baa228
|
|
4
|
+
data.tar.gz: cb1e6a7aa74f086fb70ebc7f30808db2b984660f6e375a49a5ee3467ebf0dbd2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 681910cfb585cef1e368db4e0f464b8866d35615cd1b2daaee1f02a45da613a52ec0a5063620ea36d2b1f47061486922227cc67cfa2d314b38f97a47c06fb7c8
|
|
7
|
+
data.tar.gz: 16763d62485a9bf7be6d253fb68352e8da2edc2d7679b606b4b535fce67d2e301e39f236c649d4cb27930fb6b3b9a7daec5643ca9a51fb30e9e34bf14095e20a
|
|
@@ -237,7 +237,11 @@ module ForestAdminAgent
|
|
|
237
237
|
field: aggregate_field_name(args))
|
|
238
238
|
result = context.collection.aggregate(context.caller, filter, aggregation)
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
# `Aggregation#apply` groups the records it is given, so a filter
|
|
241
|
+
# matching none of them answers with no row at all -- which is what an
|
|
242
|
+
# in-memory aggregation hands back for an empty selection. Indexing
|
|
243
|
+
# that answered a value chart with a 500 where the figure is zero.
|
|
244
|
+
result.first&.[]('value') || 0
|
|
241
245
|
end
|
|
242
246
|
|
|
243
247
|
# The permission root stays the chart's own collection, which the leaderboard call site does
|
|
@@ -28,6 +28,7 @@ module ForestAdminAgent
|
|
|
28
28
|
target_primary_key_values = Utils::Id.unpack_id(context.child_collection, args[:params]['data'][0]['id'],
|
|
29
29
|
with_key: true)
|
|
30
30
|
relation = Schema.get_to_many_relation(context.collection, args[:params]['relation_name'])
|
|
31
|
+
Collection.assert_writable_relation!(args[:params]['relation_name'], relation)
|
|
31
32
|
|
|
32
33
|
case relation.type
|
|
33
34
|
when 'OneToMany'
|
|
@@ -34,6 +34,7 @@ module ForestAdminAgent
|
|
|
34
34
|
|
|
35
35
|
filter = get_base_foreign_filter(args, context)
|
|
36
36
|
relation = Schema.get_to_many_relation(context.collection, args[:params]['relation_name'])
|
|
37
|
+
Collection.assert_writable_relation!(args[:params]['relation_name'], relation)
|
|
37
38
|
|
|
38
39
|
relation_name = args[:params]['relation_name']
|
|
39
40
|
options = {
|
|
@@ -28,6 +28,11 @@ module ForestAdminAgent
|
|
|
28
28
|
# Must run before unpack_id: unauthorized callers get a 403, not a validation error
|
|
29
29
|
context.permissions.can?(:edit, mutated_collection(relation, context))
|
|
30
30
|
|
|
31
|
+
# Every relation type this route writes through can be read-only (#379's
|
|
32
|
+
# OneToOne identity join is the reason this exists, but the flag itself sits on
|
|
33
|
+
# the shared RelationSchema, so enforce it once here rather than per-branch).
|
|
34
|
+
Collection.assert_writable_relation!(args[:params]['relation_name'], relation)
|
|
35
|
+
|
|
31
36
|
parent_primary_key_values = Utils::Id.unpack_id(context.collection, args[:params]['id'])
|
|
32
37
|
|
|
33
38
|
linked_primary_key_values = if (id = args.dig(:params, 'data', 'id'))
|
|
@@ -67,6 +67,8 @@ module ForestAdminAgent
|
|
|
67
67
|
id = value.dig('data', 'id')
|
|
68
68
|
return if id.nil?
|
|
69
69
|
|
|
70
|
+
ForestAdminDatasourceToolkit::Utils::Collection.assert_writable_relation!(field, schema)
|
|
71
|
+
|
|
70
72
|
{
|
|
71
73
|
schema: schema,
|
|
72
74
|
foreign_collection: context.datasource.get_collection(schema.foreign_collection),
|
|
@@ -127,7 +127,7 @@ module ForestAdminAgent
|
|
|
127
127
|
isFilterable: foreign_collection_filterable?(foreign_collection),
|
|
128
128
|
isPrimaryKey: false,
|
|
129
129
|
isRequired: false,
|
|
130
|
-
isReadOnly: key_field.is_read_only,
|
|
130
|
+
isReadOnly: relation.is_read_only || key_field.is_read_only,
|
|
131
131
|
isSortable: target_field.is_sortable,
|
|
132
132
|
validations: [],
|
|
133
133
|
reference: "#{foreign_collection.name}.#{relation.origin_key_target}"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_agent
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.41.0
|
|
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: 2026-
|
|
12
|
+
date: 2026-09-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|