forest_admin_datasource_customizer 1.13.1 → 1.13.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 +4 -4
- data/lib/forest_admin_datasource_customizer/decorators/action/result_builder.rb +13 -16
- data/lib/forest_admin_datasource_customizer/decorators/binary/binary_collection_decorator.rb +5 -5
- data/lib/forest_admin_datasource_customizer/decorators/validation/validation_collection_decorator.rb +1 -1
- data/lib/forest_admin_datasource_customizer/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: a506e245343e6bede97932de2086844c4e0cc0350c4d0a7534a15156c7599997
|
|
4
|
+
data.tar.gz: 0a44724088ff4ee539ae64b9f7b082c167af0fbce8c16a85d0fb36c2422899cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36cd54ee3503d1542e1033f86e4e0dedc1e5b261cb3e83bc3f373e79e42bcbe3c09f9366dfa761999d488defd44ca7b3be53d92aa62de97a31bf1174e6cee20b
|
|
7
|
+
data.tar.gz: e48603a5fb00043bce6ac92202f7376ecec3fbc2e8b5dcd0bfc60ac58769d3830a429b129b3ac96f00fcb1c60e045448c38c6eb124c3e2dfbb026a8a252a5568
|
|
@@ -14,40 +14,37 @@ module ForestAdminDatasourceCustomizer
|
|
|
14
14
|
|
|
15
15
|
def success(message: 'Success', options: {})
|
|
16
16
|
{
|
|
17
|
-
|
|
17
|
+
response_headers: @headers,
|
|
18
18
|
type: 'Success',
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
message: message,
|
|
20
|
+
invalidated: options.key?(:invalidated) ? options[:invalidated] : [],
|
|
21
21
|
html: options.key?(:html) ? options[:html] : nil
|
|
22
22
|
}
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def error(message: 'Error', options: {})
|
|
26
26
|
{
|
|
27
|
-
|
|
27
|
+
response_headers: @headers,
|
|
28
28
|
type: 'Error',
|
|
29
|
-
|
|
30
|
-
error: message,
|
|
29
|
+
message: message,
|
|
31
30
|
html: options.key?(:html) ? options[:html] : nil
|
|
32
31
|
}
|
|
33
32
|
end
|
|
34
33
|
|
|
35
34
|
def webhook(url:, method: 'POST', headers: {}, body: {})
|
|
36
35
|
{
|
|
37
|
-
|
|
36
|
+
response_headers: @headers,
|
|
38
37
|
type: 'Webhook',
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
url: url
|
|
44
|
-
}
|
|
38
|
+
body: body,
|
|
39
|
+
headers: headers,
|
|
40
|
+
method: method,
|
|
41
|
+
url: url
|
|
45
42
|
}
|
|
46
43
|
end
|
|
47
44
|
|
|
48
45
|
def file(content:, name: 'file', mime_type: 'application/octet-stream')
|
|
49
46
|
{
|
|
50
|
-
|
|
47
|
+
response_headers: @headers,
|
|
51
48
|
type: 'File',
|
|
52
49
|
name: name,
|
|
53
50
|
mime_type: mime_type,
|
|
@@ -57,9 +54,9 @@ module ForestAdminDatasourceCustomizer
|
|
|
57
54
|
|
|
58
55
|
def redirect_to(path:)
|
|
59
56
|
{
|
|
60
|
-
|
|
57
|
+
response_headers: @headers,
|
|
61
58
|
type: 'Redirect',
|
|
62
|
-
|
|
59
|
+
path: path
|
|
63
60
|
}
|
|
64
61
|
end
|
|
65
62
|
end
|
data/lib/forest_admin_datasource_customizer/decorators/binary/binary_collection_decorator.rb
CHANGED
|
@@ -40,7 +40,7 @@ module ForestAdminDatasourceCustomizer
|
|
|
40
40
|
if schema.type == 'Column'
|
|
41
41
|
new_schema = schema.dup
|
|
42
42
|
new_schema.column_type = replace_column_type(schema.column_type)
|
|
43
|
-
new_schema.
|
|
43
|
+
new_schema.validation = replace_validation(name, schema)
|
|
44
44
|
fields[name] = new_schema
|
|
45
45
|
else
|
|
46
46
|
fields[name] = schema
|
|
@@ -203,8 +203,8 @@ module ForestAdminDatasourceCustomizer
|
|
|
203
203
|
def replace_validation(name, column_schema)
|
|
204
204
|
if column_schema.column_type == 'Binary'
|
|
205
205
|
validations = []
|
|
206
|
-
min_length = (column_schema.
|
|
207
|
-
max_length = (column_schema.
|
|
206
|
+
min_length = (column_schema.validation.find { |v| v[:operator] == Operators::LONGER_THAN } || {})[:value]
|
|
207
|
+
max_length = (column_schema.validation.find { |v| v[:operator] == Operators::SHORTER_THAN } || {})[:value]
|
|
208
208
|
|
|
209
209
|
if should_use_hex(name)
|
|
210
210
|
validations << { operator: Operators::MATCH, value: '/^[0-9a-f]+$/' }
|
|
@@ -214,14 +214,14 @@ module ForestAdminDatasourceCustomizer
|
|
|
214
214
|
validations << { operator: Operators::MATCH, value: '/^data:.*;base64,.*/' }
|
|
215
215
|
end
|
|
216
216
|
|
|
217
|
-
if column_schema.
|
|
217
|
+
if column_schema.validation.find { |v| v[:operator] == Operators::PRESENT }
|
|
218
218
|
validations << { operator: Operators::PRESENT }
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
return validations
|
|
222
222
|
end
|
|
223
223
|
|
|
224
|
-
column_schema.
|
|
224
|
+
column_schema.validation
|
|
225
225
|
end
|
|
226
226
|
end
|
|
227
227
|
end
|
data/lib/forest_admin_datasource_customizer/decorators/validation/validation_collection_decorator.rb
CHANGED
|
@@ -40,7 +40,7 @@ module ForestAdminDatasourceCustomizer
|
|
|
40
40
|
def refine_schema(child_schema)
|
|
41
41
|
@validation.each do |name, rules|
|
|
42
42
|
field = child_schema[:fields][name]
|
|
43
|
-
field.
|
|
43
|
+
field.validation = (field.validation || []).concat(rules)
|
|
44
44
|
child_schema[:fields][name] = field
|
|
45
45
|
end
|
|
46
46
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_admin_datasource_customizer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.13.
|
|
4
|
+
version: 1.13.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-11-
|
|
12
|
+
date: 2025-11-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|