forest_admin_agent 1.8.6 → 1.8.8

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: 7579f60b79df6f4e04130b745f7745ea992bb842c3f5dfe2d7ff7aeafe71247a
4
- data.tar.gz: dfe3081243f79d3c222dd77dd562536a96fa594d4807e25d901eec6f8ee886a2
3
+ metadata.gz: c2aae6ff9fe9cca589c65b4fc6c66d5636a4fcce6221381c7cf1db88a5bc6c0f
4
+ data.tar.gz: 1181798a55291fb7178b86e398e3bf9571b2f299bd3678d02ea561d2b746b80c
5
5
  SHA512:
6
- metadata.gz: c8a86edcbe07271fb40f97fa18c218301b425707dec736628f4f283a2bd296ead800ca4c5436ababa7a7e35d8193bf701d64b01474326b177e058eae80ac5e78
7
- data.tar.gz: c97e50102c5688b89201ad2483ca8922e39a58b8b33b2b949f4d78bfc488831238c1dbf888eebb7a8080a61f4ff002eaf2e7506e8f780243bfeea0cd6c1e9491
6
+ metadata.gz: 7feddf88c198be073a0a2abda768ed59eefee58cbc6e388798bb19915f6219ba73950d1fa77baeb8e56f9c7b89c6951c7d85906801c7cdb7c1e4c0dde1a80e2e
7
+ data.tar.gz: caa912666955fe5f18c056584da01fd7ba824f6d19fbe4144574269305c8343e09b79ca8e8bd90ca78cc0974051798722d3376149656ac0efcb964229605d308
@@ -11,8 +11,18 @@ module ForestAdminAgent
11
11
  return message if message
12
12
  end
13
13
 
14
+ return error.message if error.is_a?(ForestAdminDatasourceToolkit::Exceptions::ValidationError)
15
+
14
16
  'Unexpected error'
15
17
  end
18
+
19
+ def get_error_status(error)
20
+ return error.status if error.respond_to?(:status) && error.status
21
+
22
+ return 400 if error.is_a?(ForestAdminDatasourceToolkit::Exceptions::ValidationError)
23
+
24
+ 500
25
+ end
16
26
  end
17
27
  end
18
28
  end
@@ -63,6 +63,13 @@ module ForestAdminAgent
63
63
  attributes_map.each do |attribute_name, attr_data|
64
64
  next if !should_include_attr?(attribute_name, attr_data)
65
65
  value = evaluate_attr_or_block(attribute_name, attr_data[:attr_or_block])
66
+ # Only include the attribute if it's not nil or if the key exists in the object
67
+ # This prevents setting all fields to null for included records
68
+ if value.nil?
69
+ # Check if the key actually exists in the object (for Hash objects)
70
+ # If the key exists in the object, it means that the value is purposely set to null
71
+ next unless @object.is_a?(Hash) && @object.key?(attribute_name.to_s)
72
+ end
66
73
  attributes[format_name(attribute_name)] = value
67
74
  end
68
75
  attributes
@@ -138,9 +145,9 @@ module ForestAdminAgent
138
145
  end
139
146
 
140
147
  object = has_one_relationship(attribute_name, attr_data)
141
- if object.nil? || object.empty?
142
- data[formatted_attribute_name]['data'] = nil
143
- else
148
+ # Only include 'data' key if the relationship object exists
149
+ # Omit 'data' key entirely when null instead of setting it to null
150
+ unless object.nil? || (object.respond_to?(:empty?) && object.empty?)
144
151
  relation = datasource.get_collection(@options[:class_name].gsub('::', '__'))
145
152
  .schema[:fields][attribute_name.to_s]
146
153
  options = @options.clone
@@ -11,7 +11,7 @@ module ForestAdminAgent
11
11
 
12
12
  def self.from_plain_object(collection, filters)
13
13
  if leaf?(filters)
14
- operator = filters[:operator].titleize.tr(' ', '_')
14
+ operator = filters[:operator].titleize.tr(' ', '_').downcase
15
15
  value = parse_value(collection, filters)
16
16
 
17
17
  return ConditionTreeLeaf.new(filters[:field], operator, value)
@@ -6,7 +6,7 @@ module ForestAdminAgent
6
6
  module Schema
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
- LIANA_VERSION = "1.8.6"
9
+ LIANA_VERSION = "1.8.8"
10
10
 
11
11
  def self.generate(datasource)
12
12
  datasource.collections
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.8.6"
2
+ VERSION = "1.8.8"
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.8.6
4
+ version: 1.8.8
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-17 00:00:00.000000000 Z
12
+ date: 2025-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport