Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ Metrics/ClassLength:
- 'packages/forest_admin_datasource_rpc/lib/forest_admin_datasource_rpc/Utils/schema_polling_pool.rb'
- 'packages/forest_admin_datasource_rpc/lib/forest_admin_datasource_rpc/Utils/sse_client.rb'
- 'packages/forest_admin_rpc_agent/lib/forest_admin_rpc_agent/routes/sse.rb'
- 'packages/forest_admin_rpc_agent/lib/forest_admin_rpc_agent/agent.rb'

Style/OpenStructUse:
Exclude:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ def setup(options)
@rpc_collections = []
@cached_schema = nil
@cached_schema_hash = nil
@customizer = ForestAdminRpcAgent::DatasourceCustomizer.new
end

def add_datasource(datasource, options = {})
if options[:mark_collections_as_rpc]
options[:mark_collections_callback] = ->(ds) { mark_collections_as_rpc(*ds.collections.keys) }
end

super
end

def send_schema(force: false)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module ForestAdminRpcAgent
class DatasourceCustomizer < ForestAdminDatasourceCustomizer::DatasourceCustomizer
def add_datasource(datasource, options)
@stack.queue_customization(lambda {
if options[:include] || options[:exclude]
publication_decorator = Decorators::Publication::PublicationDatasourceDecorator.new(datasource)
publication_decorator.keep_collections_matching(options[:include], options[:exclude])
datasource = publication_decorator
end

if options[:rename]
rename_collection_decorator = Decorators::RenameCollection::RenameCollectionDatasourceDecorator.new(
datasource
)
rename_collection_decorator.rename_collections(options[:rename])
datasource = rename_collection_decorator
end

options[:mark_collections_callback]&.call(datasource)

@composite_datasource.add_data_source(datasource)
})

self
Copy link

@qltysh qltysh bot Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with high complexity (count = 5): add_datasource [qlty:function-complexity]

end
end
end
Loading