forest_admin_rpc_agent 1.30.2 → 1.30.3

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: 63ee09337b460cc64e31c41f8199b74693a3fcedfa09450bedbe258eb5b7ca04
4
- data.tar.gz: 4d97e15d8760be804d833b0807f90b80b12e2f26a5ba1bea88c9058dde84a5ac
3
+ metadata.gz: 114572fb4823a100919207db7a3b3f60ed16ccb32ac514fe18fadfd13a6e2bd3
4
+ data.tar.gz: 497ba90f3402615ac88a9703b7c6cedf8bb04801700e3b4a3b80168b332cea0e
5
5
  SHA512:
6
- metadata.gz: 7c64cc648820b01fe4842aa962f9729e85134137caf6f421be4b980942e635e7368f41e35684065150fd61ff0c6e91638fdc65c21b4dde6b1f568daff99b15ae
7
- data.tar.gz: aff27eadfc5b2e2fc681a95d8f72006c036a2433c460a2bf700864dbd37df2f6a2fee8a5b1b3c848411715cc68b0d604ff23f00d92525372559d934a4c6d81bd
6
+ metadata.gz: 2126d1058d5c5cfea20ef9dca5168a77089cd3aa4227e736672086b12eb21936ef7839bdb568f4eaf3febbafaa60f594e332eef91ab0032bf4b4a3cd44eaea7c
7
+ data.tar.gz: 81d9459feafaa4999ee8386cad21ccb28576e769b4758f86d49e57337a4ecbe16d1be6de2338b9f75b5fb7de38f779dcf86d1874de661362bf3d417e18a95cb4
@@ -84,32 +84,9 @@ module ForestAdminRpcAgent
84
84
  relations = {}
85
85
 
86
86
  if @rpc_collections.include?(collection.name)
87
- # RPC collection → extract relations to non-RPC collections
88
- collection.schema[:fields].each do |field_name, field|
89
- next if field.type == 'Column'
90
- next if relation_targets_rpc_collection?(field)
91
-
92
- relations[field_name] = field
93
- end
87
+ extract_rpc_collection_relations(collection, relations)
94
88
  else
95
- fields = {}
96
-
97
- collection.schema[:fields].each do |field_name, field|
98
- if field.type != 'Column' && relation_targets_rpc_collection?(field)
99
- relations[field_name] = field
100
- else
101
- if field.type == 'Column'
102
- field.filter_operators = ForestAdminAgent::Utils::Schema::FrontendFilterable.sort_operators(
103
- field.filter_operators
104
- )
105
- end
106
-
107
- fields[field_name] = field
108
- end
109
- end
110
-
111
- # Normal collection → include in schema
112
- collections << collection.schema.merge({ name: collection.name, fields: fields })
89
+ collections << build_normal_collection_payload(collection, relations)
113
90
  end
114
91
 
115
92
  rpc_relations[collection.name] = relations unless relations.empty?
@@ -131,6 +108,55 @@ module ForestAdminRpcAgent
131
108
  schema
132
109
  end
133
110
 
111
+ # RPC collection → extract relations targeting non-RPC collections.
112
+ def extract_rpc_collection_relations(collection, relations)
113
+ collection.schema[:fields].each do |field_name, field|
114
+ next if field.type == 'Column'
115
+ next if relation_targets_rpc_collection?(field)
116
+
117
+ relations[field_name] = field
118
+ end
119
+ end
120
+
121
+ # Normal (non-RPC) collection → split fields between local schema and cross-RPC relations.
122
+ def build_normal_collection_payload(collection, relations)
123
+ fields = {}
124
+
125
+ collection.schema[:fields].each do |field_name, field|
126
+ if field.type != 'Column' && relation_targets_rpc_collection?(field)
127
+ relations[field_name] = field
128
+ else
129
+ if field.type == 'Column'
130
+ field.filter_operators = ForestAdminAgent::Utils::Schema::FrontendFilterable.sort_operators(
131
+ field.filter_operators
132
+ )
133
+ end
134
+ fields[field_name] = field
135
+ end
136
+ end
137
+
138
+ collection.schema.merge(
139
+ name: collection.name,
140
+ fields: fields,
141
+ actions: serialize_actions(collection.schema[:actions])
142
+ )
143
+ end
144
+
145
+ # Only expose the fields needed by an RPC consumer: scope, is_generate_file, static_form,
146
+ # description, submit_button_label. Drops `form` (computed via /action-form) and `execute`
147
+ # (server-side callback) — neither belongs on the wire.
148
+ def serialize_actions(actions)
149
+ (actions || {}).transform_values do |action|
150
+ {
151
+ scope: action.scope,
152
+ is_generate_file: action.is_generate_file,
153
+ static_form: action.static_form,
154
+ description: action.description,
155
+ submit_button_label: action.submit_button_label
156
+ }
157
+ end
158
+ end
159
+
134
160
  def relation_targets_rpc_collection?(relation)
135
161
  if relation.type == 'PolymorphicManyToOne'
136
162
  relation.foreign_collections.any? { |fc| @rpc_collections.include?(fc) }
@@ -1,3 +1,3 @@
1
1
  module ForestAdminRpcAgent
2
- VERSION = "1.30.2"
2
+ VERSION = "1.30.3"
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.30.2
4
+ version: 1.30.3
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-05-21 00:00:00.000000000 Z
12
+ date: 2026-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: base64