foobara 0.1.6 → 0.1.7
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: c106dcffef98c13b230ca60f3433638583db9c1d6a9779995baa073cc1ddff00
|
4
|
+
data.tar.gz: 4159835c178cf602fd7fdedd20d5ed030f37dfb5721b6806847f12dbaa7379cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d352b2e66aa89e993a741da14506decbc13bcde49a71d23225349b409f8871aaf9216c4a6ec38e325adace318ef01a90b078b596bed15df39cc3422fd2b59dbf
|
7
|
+
data.tar.gz: 3bf9fd820cddfaf432c704df09797ce100084507b450df4de8d2bcc4c0294ca77f5009ba51d750a7fb66161108e953a323fa7482ef35b56e6139e1acc8d90948
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# [0.1.7] - 2025-08-25
|
2
|
+
|
3
|
+
- Go back to using :detached_entity for entities that have had sensitive types removed to
|
4
|
+
avoid casting problems with multiple entities with the same name
|
5
|
+
- Remove private attributes as if they were sensitive attributes when exposing models
|
6
|
+
|
1
7
|
# [0.1.6] - 2025-08-25
|
2
8
|
|
3
9
|
- Allow constructing a thunk-like record when removing sensitive values from a thunk
|
@@ -7,14 +7,13 @@ module Foobara
|
|
7
7
|
|
8
8
|
if strict_type_declaration != new_type_declaration
|
9
9
|
if new_type_declaration[:type] == :entity
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
# It's important that we don't create another entity with different attributes
|
11
|
+
# or various things like crud drivers or type transformers can become confused.
|
12
|
+
# So we will create it as a detached_entity instead.
|
13
|
+
new_type_declaration[:type] = :detached_entity
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
end
|
15
|
+
if new_type_declaration[:model_base_class] == "Foobara::Entity"
|
16
|
+
new_type_declaration[:model_base_class] = "Foobara::DetachedEntity"
|
18
17
|
end
|
19
18
|
end
|
20
19
|
end
|
@@ -8,7 +8,7 @@ module Foobara
|
|
8
8
|
elsif record.persisted?
|
9
9
|
# We will assume that we do not need to clean up the primary key itself as
|
10
10
|
# we will assume we don't allow sensitive primary keys for now.
|
11
|
-
thunkish = to_type.target_class.
|
11
|
+
thunkish = to_type.target_class.send(build_method, record.class.primary_key_attribute => record.primary_key)
|
12
12
|
thunkish.skip_validations = true
|
13
13
|
thunkish.mutable = false
|
14
14
|
thunkish
|
@@ -20,7 +20,14 @@ module Foobara
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def build_method
|
23
|
-
:
|
23
|
+
if to_type.extends?(BuiltinTypes[:entity])
|
24
|
+
# TODO: figure out a way to test this path
|
25
|
+
# :nocov:
|
26
|
+
:build
|
27
|
+
# :nocov:
|
28
|
+
else
|
29
|
+
:new
|
30
|
+
end
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
data/projects/types/src/type.rb
CHANGED
@@ -116,6 +116,12 @@ module Foobara
|
|
116
116
|
def has_sensitive_types?
|
117
117
|
return true if sensitive?
|
118
118
|
|
119
|
+
# TODO: this is a hack... come up with a better/separate way to detect types with private attributes
|
120
|
+
if declaration_data.is_a?(::Hash)
|
121
|
+
private = declaration_data[:private]
|
122
|
+
return true if private.is_a?(::Array) && !private.empty?
|
123
|
+
end
|
124
|
+
|
119
125
|
if element_type
|
120
126
|
return true if element_type.has_sensitive_types?
|
121
127
|
end
|
data/version.rb
CHANGED