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 +4 -4
- data/lib/forest_admin_rpc_agent/agent.rb +51 -25
- data/lib/forest_admin_rpc_agent/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 114572fb4823a100919207db7a3b3f60ed16ccb32ac514fe18fadfd13a6e2bd3
|
|
4
|
+
data.tar.gz: 497ba90f3402615ac88a9703b7c6cedf8bb04801700e3b4a3b80168b332cea0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
-
|
|
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) }
|
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.
|
|
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-
|
|
12
|
+
date: 2026-05-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: base64
|