forest_admin_agent 1.39.0 → 1.39.1

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: 6d8e421dc1033f0430516e5bb4d8b6393d1d8a8b9c0d396db8ea8dfa942984c3
4
- data.tar.gz: ec2f491f596a6eef622817e3cd687d83bd9f555dbefc7418121e5f41c64bb4df
3
+ metadata.gz: 428e77bbb38c12b3b742940d6389b10953d719dbbb01ee121130dd01f9eb8868
4
+ data.tar.gz: 1b87f61a2aceb41b7ecd1e1c65339374a3f50c9faccaaf48331cebbff73a8760
5
5
  SHA512:
6
- metadata.gz: 5f822cf9a20bf034e51ea355cde7a894d904214e095dabec83952d95ae2856cc8a79de43713a48e6914d046c52a2bc271d91ffe762bfdb833fe2fe790584a08c
7
- data.tar.gz: ff1bb212d93c979e0ab69a802f8da3e839cc350b6e29cbfb08706e65d01882048266f44eb8d3c235db3e1af6f1df2efd0e4bde42509af6f3618a76a7a4a8ea58
6
+ metadata.gz: 0d1408d54a4650b3850fd62647704eaca320f376603639328d3e2356b0064adc1a2cbd05920040eafd0314fce89cba22fb09456b8244a9d6e238c21bc7c54b50
7
+ data.tar.gz: a30686d3e81a9febf50189dc66249922c288ab33c9868f51c6d91ff40c2ace58c512bd185e2dd2230c35bbf78e2823485db9ea5685f745bf4183c17a44c9bf64
@@ -6,7 +6,9 @@ module ForestAdminAgent
6
6
 
7
7
  relation = context.collection.schema[:fields][args[:params]['relation_name']]
8
8
  context.child_collection = if relation.type == 'PolymorphicManyToOne'
9
- context.datasource.get_collection(args[:params]['data']['type'])
9
+ if (type = args.dig(:params, 'data', 'type'))
10
+ context.datasource.get_collection(type)
11
+ end
10
12
  else
11
13
  context.datasource.get_collection(relation.foreign_collection)
12
14
  end
@@ -89,7 +89,7 @@ module ForestAdminAgent
89
89
  )
90
90
  end
91
91
 
92
- polymorphic_type = context.child_collection.name.gsub('__', '::')
92
+ polymorphic_type = context.child_collection&.name&.gsub('__', '::')
93
93
  context.collection.update(
94
94
  context.caller,
95
95
  scoped_fk_owner_filter(parent_primary_key_values, context),
@@ -23,6 +23,7 @@ module ForestAdminAgent
23
23
  filter = ForestAdminDatasourceToolkit::Components::Query::Filter.new(
24
24
  condition_tree: ConditionTree::ConditionTreeFactory.intersect([condition_tree, scope])
25
25
  )
26
+ drop_relationships!(args)
26
27
  data = format_attributes(args, context.collection)
27
28
  context.collection.update(context.caller, filter, data)
28
29
  records = context.collection.list(context.caller, filter, ProjectionFactory.all(context.collection))
@@ -37,6 +38,15 @@ module ForestAdminAgent
37
38
  )
38
39
  }
39
40
  end
41
+
42
+ private
43
+
44
+ # The frontend writes relations through PUT /:collection/:id/relationships/:name, which fires
45
+ # before this route. Honouring the relationships block here would turn the untouched relations
46
+ # it always resends as `data: null` into foreign keys set to nil. Parity with agent-nodejs.
47
+ def drop_relationships!(args)
48
+ args[:params][:data].delete(:relationships)
49
+ end
40
50
  end
41
51
  end
42
52
  end
@@ -6,7 +6,7 @@ module ForestAdminAgent
6
6
  module Schema
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
- LIANA_VERSION = "1.39.0"
9
+ LIANA_VERSION = "1.39.1"
10
10
 
11
11
  def self.generate(datasource)
12
12
  datasource.collections
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.39.0"
2
+ VERSION = "1.39.1"
3
3
  end
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.39.0
4
+ version: 1.39.1
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-08-19 00:00:00.000000000 Z
12
+ date: 2026-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport