forest_admin_agent 1.18.1 → 1.18.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34b3a41aa849d5f38a8631577e514899eaf9608230f90049596787a0f9a2042b
|
|
4
|
+
data.tar.gz: c999f42eefa8264753f80788e6ca05d595617d944f95e88f85378bfb0f325e4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 729ab09bc7174076c67f15a3a2018c801d902b0cc1eb2fe2ca5d7414380fa0baa6b5cca22b39940df628e001b38c607a3bbfd0fdbec7aa9ec4fd872460f103a5
|
|
7
|
+
data.tar.gz: 4f11327ae9911fc2398ac8af076c8321c85c114b6d51b4ab352883533789aaba03f30032f39271a1ce186be77b246bcd57d993010ada55e7afa42aa9ad9be823
|
|
@@ -83,6 +83,24 @@ module ForestAdminAgent
|
|
|
83
83
|
|
|
84
84
|
return unless @has_env_secret
|
|
85
85
|
|
|
86
|
+
schema = generate_schema_file
|
|
87
|
+
|
|
88
|
+
if (append_schema_path = Facades::Container.cache(:append_schema_path))
|
|
89
|
+
begin
|
|
90
|
+
append_schema_file = JSON.parse(File.read(append_schema_path), symbolize_names: true)
|
|
91
|
+
schema[:collections] = schema[:collections] + append_schema_file[:collections]
|
|
92
|
+
rescue StandardError => e
|
|
93
|
+
raise "Can't load additional schema #{append_schema_path}: #{e.message}"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
post_schema(schema, force)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Generates or loads the schema and writes it to file (in development mode).
|
|
101
|
+
# This method can be overridden by subclasses that need to customize schema handling.
|
|
102
|
+
# @return [Hash] The schema hash with :meta and :collections keys
|
|
103
|
+
def generate_schema_file
|
|
86
104
|
schema_path = Facades::Container.cache(:schema_path)
|
|
87
105
|
|
|
88
106
|
if Facades::Container.cache(:is_production)
|
|
@@ -93,29 +111,33 @@ module ForestAdminAgent
|
|
|
93
111
|
)
|
|
94
112
|
end
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
JSON.parse(File.read(schema_path), symbolize_names: true)
|
|
97
115
|
else
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
schema
|
|
102
|
-
meta: meta,
|
|
103
|
-
collections: generated
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
File.write(schema_path, format_schema_json(schema))
|
|
116
|
+
datasource = @container.resolve(:datasource)
|
|
117
|
+
schema = build_schema(datasource)
|
|
118
|
+
write_schema_file(schema_path, schema)
|
|
119
|
+
schema
|
|
107
120
|
end
|
|
121
|
+
end
|
|
108
122
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
end
|
|
116
|
-
end
|
|
123
|
+
# Builds the schema hash from the datasource
|
|
124
|
+
# @param datasource [Object] The datasource to generate schema from
|
|
125
|
+
# @return [Hash] The schema hash with :meta and :collections keys
|
|
126
|
+
def build_schema(datasource)
|
|
127
|
+
generated = SchemaEmitter.generate(datasource)
|
|
128
|
+
meta = SchemaEmitter.meta
|
|
117
129
|
|
|
118
|
-
|
|
130
|
+
{
|
|
131
|
+
meta: meta,
|
|
132
|
+
collections: generated
|
|
133
|
+
}
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Writes the schema to a file
|
|
137
|
+
# @param schema_path [String] Path to write the schema file
|
|
138
|
+
# @param schema [Hash] The schema to write
|
|
139
|
+
def write_schema_file(schema_path, schema)
|
|
140
|
+
File.write(schema_path, format_schema_json(schema))
|
|
119
141
|
end
|
|
120
142
|
|
|
121
143
|
private
|
|
@@ -29,8 +29,9 @@ module ForestAdminAgent
|
|
|
29
29
|
action = collection.schema[:actions][name]
|
|
30
30
|
action_index = collection.schema[:actions].keys.index(name)
|
|
31
31
|
slug = get_action_slug(name)
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
if action.static_form
|
|
34
|
+
form_elements = extract_fields_and_layout(collection.get_form(nil, name))
|
|
34
35
|
fields = build_fields(collection, form_elements[:fields])
|
|
35
36
|
layout = form_elements[:layout]
|
|
36
37
|
else
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_agent
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.18.
|
|
4
|
+
version: 1.18.2
|
|
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-12-
|
|
12
|
+
date: 2025-12-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|