forest_admin_agent 1.24.10 → 1.25.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 945940689d1b0e9df1037a46fb887ef57689ce8777f1e4ab501feb2764e9c8c2
4
- data.tar.gz: 62b510fc2325ef81be9a88ab43b964c21738b360416fc7def5f7c2f25e2456ba
3
+ metadata.gz: 45fec61134e779653a82999fead5dd27c7c72b13314dc5a6681810d83abdaeea
4
+ data.tar.gz: 7e32f7f03127aa861c48ce254a01ec59c9642896ad0f8cc1399deda1ae7735e8
5
5
  SHA512:
6
- metadata.gz: a358be6cd63ebaebca5b002c61d5ff96e6c7f440c719dcf90bf1a94a72c5427ed48ec758b5f1128f13425166684be906c1907806fdd23e9023be1678d1d67dc1
7
- data.tar.gz: 92e025ef1682312f076022ed03b75301789d2f7466917404935fae762ea4f381058e02a85da5daa8fa011abaa318bf07329bb7c0773b811807ed33f59ee34da7
6
+ metadata.gz: 2ddff39b67c542cf99055335354aa6c2e2d571eb4d6a59d715b28f224d912b85715059185841d378f87b5c68c9a2dcf4372d59f4edf1a536a5d84d4689481fda
7
+ data.tar.gz: e1e540e6e508b78548dbfa7b2d078b0c1eccf0153b01ad2ad6e14458628b35e9ca5ae9adb6c31b8295ba9b32e56e7077b8218ddaaabd04f91eb917e1fa794b45
@@ -4,6 +4,7 @@ module ForestAdminAgent
4
4
  module Capabilities
5
5
  class Collections < AbstractRoute
6
6
  include ForestAdminDatasourceToolkit::Schema
7
+ include ForestAdminDatasourceToolkit::Schema::Relations
7
8
 
8
9
  def setup_routes
9
10
  add_route('forest_capabilities_collections',
@@ -22,24 +23,48 @@ module ForestAdminAgent
22
23
 
23
24
  result = collections.map do |collection_name|
24
25
  collection = datasource.get_collection(collection_name)
25
- {
26
- name: collection.name,
27
- fields: collection.schema[:fields].filter_map do |name, field|
28
- next unless field.is_a?(ColumnSchema)
26
+ aggregation_capabilities = collection.schema[:aggregation_capabilities]
29
27
 
28
+ fields = collection.schema[:fields].filter_map do |name, field|
29
+ if field.is_a?(ManyToOneSchema)
30
+ foreign_key_field = collection.schema[:fields][field.foreign_key]
31
+ {
32
+ name: name,
33
+ type: 'ManyToOne',
34
+ isGroupable: foreign_key_field.is_a?(ColumnSchema) ? foreign_key_field.is_groupable : true
35
+ }
36
+ elsif field.is_a?(ColumnSchema)
30
37
  {
31
38
  name: name,
32
39
  type: field.column_type,
33
- operators: field.filter_operators.to_a
40
+ operators: field.filter_operators.to_a,
41
+ isGroupable: field.is_groupable
34
42
  }
35
43
  end
44
+ end
45
+
46
+ collection_result = {
47
+ name: collection.name,
48
+ fields: fields
36
49
  }
50
+
51
+ if aggregation_capabilities
52
+ collection_result[:aggregationCapabilities] = {
53
+ supportGroups: aggregation_capabilities[:support_groups] && fields.any? { |f| f[:isGroupable] },
54
+ supportedDateOperations: aggregation_capabilities[:supported_date_operations]
55
+ }
56
+ end
57
+
58
+ collection_result
37
59
  end
38
60
 
39
61
  {
40
62
  content: {
41
63
  collections: result,
42
- nativeQueryConnections: connections
64
+ nativeQueryConnections: connections,
65
+ agentCapabilities: {
66
+ canUseProjectionOnGetOne: true
67
+ }
43
68
  },
44
69
  status: 200
45
70
  }
@@ -6,6 +6,7 @@ module ForestAdminAgent
6
6
  module Resources
7
7
  class Show < AbstractAuthenticatedRoute
8
8
  include ForestAdminAgent::Builder
9
+ include ForestAdminAgent::Utils
9
10
  include ForestAdminDatasourceToolkit::Components::Query
10
11
  def setup_routes
11
12
  add_route('forest_show', 'get', '/:collection_name/:id', ->(args) { handle_request(args) })
@@ -23,7 +24,7 @@ module ForestAdminAgent
23
24
  condition_tree: ConditionTree::ConditionTreeFactory.intersect([condition_tree, scope])
24
25
  )
25
26
 
26
- projection = ProjectionFactory.all(context.collection)
27
+ projection = QueryStringParser.parse_projection_with_pks(context.collection, args)
27
28
 
28
29
  records = context.collection.list(context.caller, filter, projection)
29
30
 
@@ -6,7 +6,7 @@ module ForestAdminAgent
6
6
  module Schema
7
7
  class SchemaEmitter
8
8
  LIANA_NAME = "agent-ruby"
9
- LIANA_VERSION = "1.24.10"
9
+ LIANA_VERSION = "1.25.0"
10
10
 
11
11
  def self.generate(datasource)
12
12
  datasource.collections
@@ -1,3 +1,3 @@
1
1
  module ForestAdminAgent
2
- VERSION = "1.24.10"
2
+ VERSION = "1.25.0"
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.24.10
4
+ version: 1.25.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-03-02 00:00:00.000000000 Z
12
+ date: 2026-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport