forest_admin_datasource_rpc 1.13.3 → 1.13.4

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: 3ab01429fc92e0b89d1e12dd33970ebc6d8fd98d8653aae7a7fea14821c1105b
4
- data.tar.gz: 7339d42ba2be7bd2362c3927b26061f46a539adaa1b17bd181cdc5e18e741984
3
+ metadata.gz: 3f11e3adabb922abce7fa7784d820cb6e07234cb068ca056cdc6de154d46fdab
4
+ data.tar.gz: 38d9c4d70dea9bcbf5eeb4b44df2ef5aa0dae47dab8370a1f4a10bd10d083b9f
5
5
  SHA512:
6
- metadata.gz: b8909e2e6b9317c06b2aba0ba6133efe7e26668add327730f8810b98928f18a79ebecd0d297253997b8e399cd457e469747ca0367dfb9af89560156e1b281385
7
- data.tar.gz: 307d9ea1eec4c95a946a615d2b1777b06d4d64626d48d8a427521cdbb9d7359f8b4c0bc5a9c481649456ca4aa3839981efb6c0a17459c919b17500485c6673e3
6
+ metadata.gz: f8979202f77df088f670297aa10ee84ae018c505f2d91286251d0d27f1b1c99e2d3d5c500d48ab6e04a4c81232a29abea83a2b8d73532b06069b10ec72093ff9
7
+ data.tar.gz: 1118ed85410822de31c20341e673bbef60656450101b765ba92bd11bb8689b204f46ec60fc422bedfd2af7a5248fd03fb9511314ecec6844ce3bc4ded47fc6eb
@@ -38,7 +38,7 @@ module ForestAdminDatasourceRpc
38
38
  faraday.request :json
39
39
  faraday.response :json, parser_options: { symbolize_names: symbolize_keys }
40
40
  faraday.adapter Faraday.default_adapter
41
- faraday.ssl.verify = !ForestAdminRpcAgent::Facades::Container.cache(:debug)
41
+ faraday.ssl.verify = !ForestAdminAgent::Facades::Container.cache(:debug)
42
42
  end
43
43
 
44
44
  timestamp = Time.now.utc.iso8601(3)
@@ -32,7 +32,7 @@ module ForestAdminDatasourceRpc
32
32
  return if @closed
33
33
 
34
34
  @closed = true
35
- ForestAdminRpcAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Closing connection')
35
+ ForestAdminAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Closing connection')
36
36
 
37
37
  # Stop reconnection thread if running
38
38
  if @reconnect_thread&.alive?
@@ -43,11 +43,11 @@ module ForestAdminDatasourceRpc
43
43
  begin
44
44
  @client&.close
45
45
  rescue StandardError => e
46
- ForestAdminRpcAgent::Facades::Container.logger&.log('Debug',
47
- "[SSE Client] Error during close: #{e.message}")
46
+ ForestAdminAgent::Facades::Container.logger&.log('Debug',
47
+ "[SSE Client] Error during close: #{e.message}")
48
48
  end
49
49
 
50
- ForestAdminRpcAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Connection closed')
50
+ ForestAdminAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Connection closed')
51
51
  end
52
52
 
53
53
  private
@@ -67,7 +67,7 @@ module ForestAdminDatasourceRpc
67
67
  'X_SIGNATURE' => signature
68
68
  }
69
69
 
70
- ForestAdminRpcAgent::Facades::Container.logger&.log(
70
+ ForestAdminAgent::Facades::Container.logger&.log(
71
71
  'Debug',
72
72
  "[SSE Client] Connecting to #{@uri} (attempt ##{@connection_attempts})"
73
73
  )
@@ -90,9 +90,9 @@ module ForestAdminDatasourceRpc
90
90
  end
91
91
  end
92
92
 
93
- ForestAdminRpcAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Connected successfully')
93
+ ForestAdminAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Connected successfully')
94
94
  rescue StandardError => e
95
- ForestAdminRpcAgent::Facades::Container.logger&.log(
95
+ ForestAdminAgent::Facades::Container.logger&.log(
96
96
  'Error',
97
97
  "[SSE Client] Failed to connect: #{e.class} - #{e.message}"
98
98
  )
@@ -129,7 +129,7 @@ module ForestAdminDatasourceRpc
129
129
  err.to_s
130
130
  end
131
131
 
132
- ForestAdminRpcAgent::Facades::Container.logger&.log(log_level, "[SSE Client] Error: #{error_message}")
132
+ ForestAdminAgent::Facades::Container.logger&.log(log_level, "[SSE Client] Error: #{error_message}")
133
133
 
134
134
  # Close client immediately to prevent ld-eventsource from reconnecting with stale credentials
135
135
  begin
@@ -153,7 +153,7 @@ module ForestAdminDatasourceRpc
153
153
 
154
154
  @reconnect_thread = Thread.new do
155
155
  delay = calculate_backoff_delay
156
- ForestAdminRpcAgent::Facades::Container.logger&.log(
156
+ ForestAdminAgent::Facades::Container.logger&.log(
157
157
  'Debug',
158
158
  "[SSE Client] Reconnecting in #{delay} seconds..."
159
159
  )
@@ -177,19 +177,19 @@ module ForestAdminDatasourceRpc
177
177
  if @connecting
178
178
  @connecting = false
179
179
  @connection_attempts = 0
180
- ForestAdminRpcAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Connection stable')
180
+ ForestAdminAgent::Facades::Container.logger&.log('Debug', '[SSE Client] Connection stable')
181
181
  end
182
182
  when 'RpcServerStop'
183
- ForestAdminRpcAgent::Facades::Container.logger&.log('Debug', '[SSE Client] RpcServerStop received')
183
+ ForestAdminAgent::Facades::Container.logger&.log('Debug', '[SSE Client] RpcServerStop received')
184
184
  handle_rpc_stop
185
185
  else
186
- ForestAdminRpcAgent::Facades::Container.logger&.log(
186
+ ForestAdminAgent::Facades::Container.logger&.log(
187
187
  'Debug',
188
188
  "[SSE Client] Unknown event: #{type} with payload: #{data}"
189
189
  )
190
190
  end
191
191
  rescue StandardError => e
192
- ForestAdminRpcAgent::Facades::Container.logger&.log(
192
+ ForestAdminAgent::Facades::Container.logger&.log(
193
193
  'Error',
194
194
  "[SSE Client] Error handling event: #{e.class} - #{e.message}"
195
195
  )
@@ -198,7 +198,7 @@ module ForestAdminDatasourceRpc
198
198
  def handle_rpc_stop
199
199
  @on_rpc_stop&.call
200
200
  rescue StandardError => e
201
- ForestAdminRpcAgent::Facades::Container.logger&.log(
201
+ ForestAdminAgent::Facades::Container.logger&.log(
202
202
  'Error',
203
203
  "[SSE Client] Error in RPC stop callback: #{e.class} - #{e.message}"
204
204
  )
@@ -9,11 +9,11 @@ module ForestAdminDatasourceRpc
9
9
  def initialize(datasource, name, options, schema)
10
10
  super(datasource, name)
11
11
  @options = options
12
- @client = RpcClient.new(@options[:uri], @options[:auth_secret] || ForestAdminRpcAgent::Facades::Container.cache(:auth_secret))
12
+ @client = RpcClient.new(@options[:uri], @options[:auth_secret] || ForestAdminAgent::Facades::Container.cache(:auth_secret))
13
13
  @rpc_collection_uri = "/forest/rpc/#{name}"
14
14
  @base_params = { collection_name: name }
15
15
 
16
- ForestAdminRpcAgent::Facades::Container.logger.log('Debug', "Create Rpc collection #{name}.")
16
+ ForestAdminAgent::Facades::Container.logger.log('Debug', "Create Rpc collection #{name}.")
17
17
 
18
18
  enable_count if schema[:countable]
19
19
  enable_search if schema[:searchable]
@@ -60,7 +60,7 @@ module ForestAdminDatasourceRpc
60
60
  params = build_params(filter: filter.to_h, projection: projection)
61
61
  url = "#{@rpc_collection_uri}/list"
62
62
 
63
- ForestAdminRpcAgent::Facades::Container.logger.log(
63
+ ForestAdminAgent::Facades::Container.logger.log(
64
64
  'Debug',
65
65
  "Forwarding '#{@name}' list call to the Rpc agent on #{url}."
66
66
  )
@@ -72,7 +72,7 @@ module ForestAdminDatasourceRpc
72
72
  params = build_params(data: [data])
73
73
  url = "#{@rpc_collection_uri}/create"
74
74
 
75
- ForestAdminRpcAgent::Facades::Container.logger.log(
75
+ ForestAdminAgent::Facades::Container.logger.log(
76
76
  'Debug',
77
77
  "Forwarding '#{@name}' creation call to the Rpc agent on #{url}."
78
78
  )
@@ -85,7 +85,7 @@ module ForestAdminDatasourceRpc
85
85
  params = build_params(filter: filter.to_h, patch: data)
86
86
  url = "#{@rpc_collection_uri}/update"
87
87
 
88
- ForestAdminRpcAgent::Facades::Container.logger.log(
88
+ ForestAdminAgent::Facades::Container.logger.log(
89
89
  'Debug',
90
90
  "Forwarding '#{@name}' update call to the Rpc agent on #{url}."
91
91
  )
@@ -97,7 +97,7 @@ module ForestAdminDatasourceRpc
97
97
  params = build_params(filter: filter.to_h)
98
98
  url = "#{@rpc_collection_uri}/delete"
99
99
 
100
- ForestAdminRpcAgent::Facades::Container.logger.log(
100
+ ForestAdminAgent::Facades::Container.logger.log(
101
101
  'Debug',
102
102
  "Forwarding '#{@name}' deletion call to the Rpc agent on #{url}."
103
103
  )
@@ -109,7 +109,7 @@ module ForestAdminDatasourceRpc
109
109
  params = build_params(filter: filter.to_h, aggregation: aggregation.to_h, limit: limit)
110
110
  url = "#{@rpc_collection_uri}/aggregate"
111
111
 
112
- ForestAdminRpcAgent::Facades::Container.logger.log(
112
+ ForestAdminAgent::Facades::Container.logger.log(
113
113
  'Debug',
114
114
  "Forwarding '#{@name}' aggregate call to the Rpc agent on #{url}."
115
115
  )
@@ -122,7 +122,7 @@ module ForestAdminDatasourceRpc
122
122
  params = build_params(action: name, filter: filter&.to_h, data: data)
123
123
  url = "#{@rpc_collection_uri}/action-execute"
124
124
 
125
- ForestAdminRpcAgent::Facades::Container.logger.log(
125
+ ForestAdminAgent::Facades::Container.logger.log(
126
126
  'Debug',
127
127
  "Forwarding '#{@name}' action #{name} call to the Rpc agent on #{url}."
128
128
  )
@@ -138,7 +138,7 @@ module ForestAdminDatasourceRpc
138
138
  end
139
139
  url = "#{@rpc_collection_uri}/action-form"
140
140
 
141
- ForestAdminRpcAgent::Facades::Container.logger.log(
141
+ ForestAdminAgent::Facades::Container.logger.log(
142
142
  'Debug',
143
143
  "Forwarding '#{@name}' action form #{name} call to the Rpc agent on #{url}."
144
144
  )
@@ -153,7 +153,7 @@ module ForestAdminDatasourceRpc
153
153
  params = build_params(chart: name, record_id: record_id)
154
154
  url = "#{@rpc_collection_uri}/chart"
155
155
 
156
- ForestAdminRpcAgent::Facades::Container.logger.log(
156
+ ForestAdminAgent::Facades::Container.logger.log(
157
157
  'Debug',
158
158
  "Forwarding '#{@name}' chart #{name} call to the Rpc agent on #{url}."
159
159
  )
@@ -5,7 +5,7 @@ module ForestAdminDatasourceRpc
5
5
  def initialize(options, introspection)
6
6
  super()
7
7
 
8
- ForestAdminRpcAgent::Facades::Container.logger.log(
8
+ ForestAdminAgent::Facades::Container.logger.log(
9
9
  'Info',
10
10
  "Building Rpc Datasource with #{introspection[:collections].length} " \
11
11
  "collections and #{introspection[:charts].length} charts."
@@ -26,10 +26,10 @@ module ForestAdminDatasourceRpc
26
26
  end
27
27
 
28
28
  def render_chart(caller, name)
29
- client = RpcClient.new(@options[:uri], @options[:auth_secret] || ForestAdminRpcAgent::Facades::Container.cache(:auth_secret))
29
+ client = RpcClient.new(@options[:uri], @options[:auth_secret] || ForestAdminAgent::Facades::Container.cache(:auth_secret))
30
30
  url = 'forest/rpc-datasource-chart'
31
31
 
32
- ForestAdminRpcAgent::Facades::Container.logger.log(
32
+ ForestAdminAgent::Facades::Container.logger.log(
33
33
  'Debug',
34
34
  "Forwarding datasource chart '#{name}' call to the Rpc agent on #{url}."
35
35
  )
@@ -38,10 +38,10 @@ module ForestAdminDatasourceRpc
38
38
  end
39
39
 
40
40
  def execute_native_query(connection_name, query, binds)
41
- client = RpcClient.new(@options[:uri], @options[:auth_secret] || ForestAdminRpcAgent::Facades::Container.cache(:auth_secret))
41
+ client = RpcClient.new(@options[:uri], @options[:auth_secret] || ForestAdminAgent::Facades::Container.cache(:auth_secret))
42
42
  url = 'forest/rpc-native-query'
43
43
 
44
- ForestAdminRpcAgent::Facades::Container.logger.log(
44
+ ForestAdminAgent::Facades::Container.logger.log(
45
45
  'Debug',
46
46
  "Forwarding native query for connection '#{connection_name}' to the Rpc agent on #{url}."
47
47
  )
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceRpc
2
- VERSION = "1.13.3"
2
+ VERSION = "1.13.4"
3
3
  end
@@ -10,17 +10,32 @@ module ForestAdminDatasourceRpc
10
10
 
11
11
  def self.build(options)
12
12
  uri = options[:uri]
13
- auth_secret = options[:auth_secret] || ForestAdminRpcAgent::Facades::Container.cache(:auth_secret)
14
- ForestAdminRpcAgent::Facades::Container.logger.log('Info', "Getting schema from RPC agent on #{uri}.")
13
+ auth_secret = options[:auth_secret] || ForestAdminAgent::Facades::Container.cache(:auth_secret)
14
+ ForestAdminAgent::Facades::Container.logger.log('Info', "Getting schema from RPC agent on #{uri}.")
15
15
 
16
16
  begin
17
17
  rpc_client = Utils::RpcClient.new(uri, auth_secret)
18
18
  schema = rpc_client.call_rpc('/forest/rpc-schema', method: :get, symbolize_keys: true)
19
19
  last_hash_schema = Digest::SHA1.hexdigest(schema.to_h.to_s)
20
- rescue StandardError
21
- ForestAdminRpcAgent::Facades::Container.logger.log(
20
+ rescue Faraday::ConnectionFailed => e
21
+ ForestAdminAgent::Facades::Container.logger.log(
22
22
  'Error',
23
- 'Failed to get schema from RPC agent. Please check the RPC agent is running.'
23
+ "Connection failed to RPC agent at #{uri}: #{e.message}\n#{e.backtrace.join("\n")}"
24
+ )
25
+ rescue Faraday::TimeoutError => e
26
+ ForestAdminAgent::Facades::Container.logger.log(
27
+ 'Error',
28
+ "Request timeout to RPC agent at #{uri}: #{e.message}"
29
+ )
30
+ rescue ForestAdminAgent::Http::Exceptions::AuthenticationOpenIdClient => e
31
+ ForestAdminAgent::Facades::Container.logger.log(
32
+ 'Error',
33
+ "Authentication failed with RPC agent at #{uri}: #{e.message}"
34
+ )
35
+ rescue StandardError => e
36
+ ForestAdminAgent::Facades::Container.logger.log(
37
+ 'Error',
38
+ "Failed to get schema from RPC agent at #{uri}: #{e.class} - #{e.message}\n#{e.backtrace.join("\n")}"
24
39
  )
25
40
  end
26
41
 
@@ -29,11 +44,11 @@ module ForestAdminDatasourceRpc
29
44
  ForestAdminDatasourceToolkit::Datasource.new
30
45
  else
31
46
  sse = Utils::SseClient.new("#{uri}/forest/sse", auth_secret) do
32
- ForestAdminRpcAgent::Facades::Container.logger.log('Info', 'RPC server stopped, checking schema...')
47
+ ForestAdminAgent::Facades::Container.logger.log('Info', 'RPC server stopped, checking schema...')
33
48
  new_schema = rpc_client.call_rpc('/forest/rpc-schema', method: :get, symbolize_keys: true)
34
49
 
35
50
  if last_hash_schema == Digest::SHA1.hexdigest(new_schema.to_h.to_s)
36
- ForestAdminRpcAgent::Facades::Container.logger.log('Debug', '[RPCDatasource] Schema has not changed')
51
+ ForestAdminAgent::Facades::Container.logger.log('Debug', '[RPCDatasource] Schema has not changed')
37
52
  else
38
53
  ForestAdminAgent::Builder::AgentFactory.instance.reload!
39
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_rpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.3
4
+ version: 1.13.4
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-11-05 00:00:00.000000000 Z
12
+ date: 2025-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: base64