forest_admin_rpc_agent 1.22.3 → 1.23.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: f894b881efb3778128a19b44f96982d8e805e934ec83c269c78987b223e8bdc9
4
- data.tar.gz: 30bfd791c848af51e3581d76414d098fb08d887cb8a71cfffdd5160841789096
3
+ metadata.gz: d841358efdebca724970e354de2654890fa827a83fc8b678b5928d7663d0abdb
4
+ data.tar.gz: b14dc4aba5ee7a936bd3846d9c6d7e2c4713163d3cad151c4a0c57a1bb9c6edc
5
5
  SHA512:
6
- metadata.gz: 26ba7b64d4f41b412fdb73bed05204cf273bee61fafc45c627d7b6c19ec8da6a7c1f608b4c9fd64a0bc150ad7bf382772b2cc77ff9916c58cfb222aa918eaa13
7
- data.tar.gz: d386628ca181fd8952662ab920b90e7a1971f5a79e257d3e177ade0ba589c926d1488120471e7f7ad02ba9ee5d73724158e221e2d8e5c26cc162574188b66ef1
6
+ metadata.gz: 591826aaba5b2e1c8dfc038ccedbcf252a3dc331077f04e8e73b23707eec1fc3118fc95057ae15bac050b41f8b3be9d0101381cf1f22fda6f4fb9e0e5d7c91b4
7
+ data.tar.gz: 8b68310281aca918ec0db5e1106b7ea6c59bd00c4852c677451c50a184055dd5fafc6f39323913225dd90b2af721727b4056d37c2d8ad40bccd1a9ddd3179e1f
@@ -12,6 +12,15 @@ module ForestAdminRpcAgent
12
12
  @rpc_collections = []
13
13
  @cached_schema = nil
14
14
  @cached_schema_hash = nil
15
+ @customizer = ForestAdminRpcAgent::DatasourceCustomizer.new
16
+ end
17
+
18
+ def add_datasource(datasource, options = {})
19
+ if options[:mark_collections_as_rpc]
20
+ options[:mark_collections_callback] = ->(ds) { mark_collections_as_rpc(*ds.collections.keys) }
21
+ end
22
+
23
+ super
15
24
  end
16
25
 
17
26
  def send_schema(force: false)
@@ -0,0 +1,27 @@
1
+ module ForestAdminRpcAgent
2
+ class DatasourceCustomizer < ForestAdminDatasourceCustomizer::DatasourceCustomizer
3
+ def add_datasource(datasource, options)
4
+ @stack.queue_customization(lambda {
5
+ if options[:include] || options[:exclude]
6
+ publication_decorator = Decorators::Publication::PublicationDatasourceDecorator.new(datasource)
7
+ publication_decorator.keep_collections_matching(options[:include], options[:exclude])
8
+ datasource = publication_decorator
9
+ end
10
+
11
+ if options[:rename]
12
+ rename_collection_decorator = Decorators::RenameCollection::RenameCollectionDatasourceDecorator.new(
13
+ datasource
14
+ )
15
+ rename_collection_decorator.rename_collections(options[:rename])
16
+ datasource = rename_collection_decorator
17
+ end
18
+
19
+ options[:mark_collections_callback]&.call(datasource)
20
+
21
+ @composite_datasource.add_data_source(datasource)
22
+ })
23
+
24
+ self
25
+ end
26
+ end
27
+ end
@@ -23,7 +23,7 @@ module ForestAdminRpcAgent
23
23
  'ETag matches, returning 304 Not Modified'
24
24
  )
25
25
  return { status: HTTP_NOT_MODIFIED, content: nil,
26
- headers: { 'ETag' => quote_etag(agent.cached_schema_hash) } }
26
+ headers: { 'ETag' => agent.cached_schema_hash } }
27
27
  end
28
28
 
29
29
  # Get schema from cache (or build from datasource if not cached)
@@ -34,7 +34,7 @@ module ForestAdminRpcAgent
34
34
  {
35
35
  status: HTTP_OK,
36
36
  content: schema,
37
- headers: { 'ETag' => quote_etag(etag) }
37
+ headers: { 'ETag' => etag }
38
38
  }
39
39
  end
40
40
 
@@ -45,26 +45,11 @@ module ForestAdminRpcAgent
45
45
  return nil unless request
46
46
 
47
47
  # Get If-None-Match header (works for both Rails and Sinatra)
48
- etag = if request.respond_to?(:get_header)
49
- request.get_header('HTTP_IF_NONE_MATCH')
50
- elsif request.respond_to?(:env)
51
- request.env['HTTP_IF_NONE_MATCH']
52
- end
53
-
54
- # Strip quotes from ETag value if present
55
- unquote_etag(etag)
56
- end
57
-
58
- def quote_etag(etag)
59
- return nil unless etag
60
-
61
- %("#{etag}")
62
- end
63
-
64
- def unquote_etag(etag)
65
- return nil unless etag
66
-
67
- etag.gsub(/\A"?|"?\z/, '')
48
+ if request.respond_to?(:get_header)
49
+ request.get_header('HTTP_IF_NONE_MATCH')
50
+ elsif request.respond_to?(:env)
51
+ request.env['HTTP_IF_NONE_MATCH']
52
+ end
68
53
  end
69
54
  end
70
55
  end
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRpcAgent
2
- VERSION = "1.22.3"
2
+ VERSION = "1.23.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.22.3
4
+ version: 1.23.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: 2026-01-23 00:00:00.000000000 Z
12
+ date: 2026-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: base64
@@ -200,6 +200,7 @@ files:
200
200
  - forest_admin_rpc_agent.gemspec
201
201
  - lib/forest_admin_rpc_agent.rb
202
202
  - lib/forest_admin_rpc_agent/agent.rb
203
+ - lib/forest_admin_rpc_agent/datasource_customizer.rb
203
204
  - lib/forest_admin_rpc_agent/engine.rb
204
205
  - lib/forest_admin_rpc_agent/extensions/config_loader.rb
205
206
  - lib/forest_admin_rpc_agent/extensions/sinatra_extension.rb