forest_admin_rpc_agent 1.3.0 → 1.4.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: 1864c16d481ba458e77c25c92087142682e01fad811480131e45998ed81debe6
4
- data.tar.gz: 3d0e960bed5b8c798f28fe1b65de12654de3989d88cea6fbee56461a8043fc5b
3
+ metadata.gz: dce86f43a17822742d269f5ed0fe0e0b1e872103c2ca757223da9ba206d6cd5e
4
+ data.tar.gz: 84f854406e55262bd66e0a46d4fed20a8ac38f666d27ff79525e504f1582a36e
5
5
  SHA512:
6
- metadata.gz: 36b11ef9fd6cda133cfcb1c85217930fe3c578352b838c100aeb9d26893a89d9a019a22a8ccb95468b23090f91ccb0f387aec25c8d54691d16d6cc29d902b5c9
7
- data.tar.gz: fc149936c9c35a65d5fb6141efc16de5fae2d240d20e57da5236f9e1bc22b6aeed4bda887dd31716e1af9e918c6cd0d1d71c72387f5b1639bb00c4043591071c
6
+ metadata.gz: 80b7b5bdca2c923d5ae8042d3e02cc261c70e9299348bf08269968c8c508c92d214a9c242714e7aa5ecaf5cc30be189e5b05297d8062de2d454bd160f4d1d051
7
+ data.tar.gz: 1ca233e4b72ccf48bbc01e27d67dec93df43090410d779b5f447150a2c7b38f4715c93cdb99d7c55e219f255fbc03a258c64e82894bffb7b839d7a4f959e1391
@@ -0,0 +1,22 @@
1
+ require 'jsonapi-serializers'
2
+
3
+ module ForestAdminRpcAgent
4
+ module Routes
5
+ class NativeQuery < BaseRoute
6
+ def initialize
7
+ super('rpc/native-query', 'post', 'rpc_native_query')
8
+ end
9
+
10
+ def handle_request(args)
11
+ return '{}' unless args[:params]['connection_name'] && args[:params]['query']
12
+
13
+ connection_name = args[:params]['connection_name']
14
+ query = args[:params]['query']
15
+ binds = args[:params]['binds'] || []
16
+ datasource = ForestAdminRpcAgent::Facades::Container.datasource
17
+
18
+ datasource.execute_native_query(connection_name, query, binds).to_json
19
+ end
20
+ end
21
+ end
22
+ end
@@ -12,10 +12,19 @@ module ForestAdminRpcAgent
12
12
  def handle_request(_params)
13
13
  agent = ForestAdminRpcAgent::Agent.instance
14
14
  schema = agent.customizer.schema
15
- schema[:collections] = agent.customizer.datasource(ForestAdminRpcAgent::Facades::Container.logger)
16
- .collections
17
- .map { |_name, collection| collection.schema.merge({ name: collection.name }) }
18
- .sort_by { |collection| collection[:name] }
15
+ datasource = agent.customizer.datasource(ForestAdminRpcAgent::Facades::Container.logger)
16
+
17
+ schema[:collections] = datasource.collections
18
+ .map { |_name, collection| collection.schema.merge({ name: collection.name }) }
19
+ .sort_by { |collection| collection[:name] }
20
+
21
+ connections = []
22
+ agent.customizer.datasources.each do |root_datasource|
23
+ connections = connections.union(
24
+ root_datasource.live_query_connections.keys.map { |connection_name| { name: connection_name } }
25
+ )
26
+ end
27
+ schema[:nativeQueryConnections] = connections
19
28
 
20
29
  schema.to_json
21
30
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRpcAgent
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
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.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -103,6 +103,7 @@ files:
103
103
  - lib/forest_admin_rpc_agent/routes/delete.rb
104
104
  - lib/forest_admin_rpc_agent/routes/health_route.rb
105
105
  - lib/forest_admin_rpc_agent/routes/list.rb
106
+ - lib/forest_admin_rpc_agent/routes/native_query.rb
106
107
  - lib/forest_admin_rpc_agent/routes/schema.rb
107
108
  - lib/forest_admin_rpc_agent/routes/sse.rb
108
109
  - lib/forest_admin_rpc_agent/routes/update.rb