forest_admin_rpc_agent 1.16.0 → 1.16.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: 915a415974e37353207eb84a188b9503492cd5ffd0662605f544dfc2c46b0953
4
- data.tar.gz: 3c17d468f44ae2c67aecf95b2ac320c72806b60e5b99bb0ac30bae2bd275870a
3
+ metadata.gz: df3244dd5c21cca95f5d9b58b849c0860859927829fc36529131762904e9f1ed
4
+ data.tar.gz: 729564217792b1a376fa8cf72ef0a8cc539dde666677d84c57b8ab219031d555
5
5
  SHA512:
6
- metadata.gz: d8acefedaaac921e1c77c2e6516446d335ea8670cf4bca1d246d5467581f5b9ecc462f318240e31767203bdf3507b54eedd18e0df4eb63d4944ab4be8bf7b5d5
7
- data.tar.gz: 36073296734ed1a3ef2c78ae0513ee43013eb8eaa6dda34cbbc1ff3916fc0f00d48b8fcad732deaa8399beeac43ea64342d1eee31244f8a0cab6033ee829357a
6
+ metadata.gz: e4669d57b1d4dbea9d8f2b0ae7dfd15750442753873373decb9d41c4b57ba3a746873348052315961439bcb1a6020830d528974af16c1130f4096866612e7621
7
+ data.tar.gz: 51c7303e8a879912c0f8620185f603c49e72d7a29bd287658bd2342e8ec96c9236fadc8e244c2e238db10ccc3e6ae63c6be72ca312c1d081478a7f82036c7a38
@@ -15,7 +15,7 @@ module ForestAdminRpcAgent
15
15
  return {} unless args[:params]['collection_name']
16
16
 
17
17
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
18
- collection = datasource.get_collection(args[:params]['collection_name'])
18
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
19
19
  filter = FilterFactory.from_plain_object(args[:params]['filter'])
20
20
  data = args[:params]['data']
21
21
  action = args[:params]['action']
@@ -15,7 +15,7 @@ module ForestAdminRpcAgent
15
15
  return {} unless args[:params]['collection_name']
16
16
 
17
17
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
18
- collection = datasource.get_collection(args[:params]['collection_name'])
18
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
19
19
  filter = FilterFactory.from_plain_object(args[:params]['filter'])
20
20
  metas = args[:params]['metas'] || {}
21
21
  data = args[:params]['data']
@@ -15,7 +15,7 @@ module ForestAdminRpcAgent
15
15
  return {} unless args[:params]['collection_name']
16
16
 
17
17
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
18
- collection = datasource.get_collection(args[:params]['collection_name'])
18
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
19
19
 
20
20
  aggregation = Aggregation.new(
21
21
  operation: args[:params]['aggregation']['operation'],
@@ -62,6 +62,16 @@ module ForestAdminRpcAgent
62
62
  route_alias: @name
63
63
  end
64
64
 
65
+ protected
66
+
67
+ def get_collection_safe(datasource, collection_name)
68
+ datasource.get_collection(collection_name)
69
+ rescue ForestAdminDatasourceToolkit::Exceptions::ForestException => e
70
+ raise ForestAdminAgent::Http::Exceptions::NotFoundError, e.message if e.message.include?('not found')
71
+
72
+ raise
73
+ end
74
+
65
75
  private
66
76
 
67
77
  def serialize_response(result)
@@ -14,7 +14,7 @@ module ForestAdminRpcAgent
14
14
 
15
15
  chart_name = args[:params]['chart']
16
16
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
17
- collection = datasource.get_collection(args[:params]['collection_name'])
17
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
18
18
 
19
19
  collection.render_chart(caller, chart_name, args[:params]['record_id'])
20
20
  end
@@ -11,7 +11,7 @@ module ForestAdminRpcAgent
11
11
  return {} unless args[:params]['collection_name']
12
12
 
13
13
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
14
- collection = datasource.get_collection(args[:params]['collection_name'])
14
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
15
15
 
16
16
  [collection.create(args[:caller], args[:params]['data'].first)]
17
17
  end
@@ -15,7 +15,7 @@ module ForestAdminRpcAgent
15
15
  return {} unless args[:params]['collection_name']
16
16
 
17
17
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
18
- collection = datasource.get_collection(args[:params]['collection_name'])
18
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
19
19
  filter = FilterFactory.from_plain_object(args[:params]['filter'])
20
20
 
21
21
  collection.delete(args[:caller], filter)
@@ -15,7 +15,7 @@ module ForestAdminRpcAgent
15
15
  return {} unless args[:params]['collection_name']
16
16
 
17
17
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
18
- collection = datasource.get_collection(args[:params]['collection_name'])
18
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
19
19
  projection = Projection.new(args[:params]['projection'])
20
20
  filter = FilterFactory.from_plain_object(args[:params]['filter'])
21
21
 
@@ -13,7 +13,7 @@ module ForestAdminRpcAgent
13
13
  return {} unless args[:params]['collection_name']
14
14
 
15
15
  datasource = ForestAdminRpcAgent::Facades::Container.datasource
16
- collection = datasource.get_collection(args[:params]['collection_name'])
16
+ collection = get_collection_safe(datasource, args[:params]['collection_name'])
17
17
  filter = FilterFactory.from_plain_object(args[:params]['filter'])
18
18
 
19
19
  collection.update(args[:caller], filter, args[:params]['patch'])
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRpcAgent
2
- VERSION = "1.16.0"
2
+ VERSION = "1.16.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_rpc_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-12-02 00:00:00.000000000 Z
12
+ date: 2025-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: base64