foobara 0.0.15 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/projects/entity/src/extensions/builtin_types/entity/casters/hash.rb +1 -0
- data/projects/model/src/extensions/builtin_types/model/transformers/mutable.rb +13 -5
- data/projects/model/src/model.rb +2 -1
- data/projects/persistence/src/entity_base/transaction.rb +5 -0
- 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: 89c535ec7934bbfbe1a665f068ada534300095d5224c81315e7ca60d84e50459
|
4
|
+
data.tar.gz: 7900c49115eace2fbbc7c35e1516c29ca4831763268ea130ce9aecc2b841f53f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31ae262884a960219e3f738ac50706d36eb44f8336bbf56741f0b66387270201c36fa83fecba3531a6d46f7cbb5187d4a6693058f06b7186481e043a1ce981da
|
7
|
+
data.tar.gz: '08d1a902c9948229402dcf23df1279e90ad4c3668c2e9270e8199c07c4978ddb744d4b3de702d0e3661141c11a16d8e7f9a6dc884ced1e98b245650a669eb2ca'
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## [0.0.17] - 2024-11-22
|
2
|
+
|
3
|
+
- Fix bug where mutable not being set explicitly raises
|
4
|
+
- Also, make it so models don't default to mutable false when processed by a model type
|
5
|
+
- Add a Transaction#perform convenience method
|
6
|
+
|
1
7
|
## [0.0.15] - 2024-11-20
|
2
8
|
|
3
9
|
- Move entity attributes type declaration helpers from Command::EntityHelpers to Entity for convenience.
|
@@ -11,11 +11,19 @@ module Foobara
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def transform(record)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
if parent_declaration_data.key?(:mutable)
|
15
|
+
# hmmmm.... can we really just arbitrarily clobber this?
|
16
|
+
# wouldn't that be surprising to calling code that passes in a record/model?
|
17
|
+
# One use-case of this seems to be to reduce the amount of possible errors a command reports
|
18
|
+
# by declaring that only some subset or none of the attributes are mutable.
|
19
|
+
# However, we shouldn't react to this by clobbering the mutable state of the record because it might not
|
20
|
+
# be a fresh record fetched from a primary key it might be an already loaded record/model from some other
|
21
|
+
# context and that context might be surprised to learn that we've clobbered its mutability status.
|
22
|
+
# Solutions?
|
23
|
+
# 1. In the case of models, we could duplicate the model if the mutable value is different.
|
24
|
+
# 2. But what about entities? We almost need some sort of proxy entity that tightens the mutability?
|
25
|
+
record.mutable = parent_declaration_data[:mutable]
|
26
|
+
end
|
19
27
|
|
20
28
|
record
|
21
29
|
end
|
data/projects/model/src/model.rb
CHANGED
@@ -207,6 +207,7 @@ module Foobara
|
|
207
207
|
end
|
208
208
|
end
|
209
209
|
|
210
|
+
# why do we default to true here but false in the transformers?
|
210
211
|
mutable = options.key?(:mutable) ? options[:mutable] : true
|
211
212
|
|
212
213
|
self.mutable = if mutable.is_a?(::Array)
|
@@ -227,7 +228,7 @@ module Foobara
|
|
227
228
|
def write_attribute(attribute_name, value)
|
228
229
|
attribute_name = attribute_name.to_sym
|
229
230
|
|
230
|
-
if mutable == true || mutable
|
231
|
+
if mutable == true || mutable&.include?(attribute_name)
|
231
232
|
outcome = cast_attribute(attribute_name, value)
|
232
233
|
attributes[attribute_name] = outcome.success? ? outcome.result : value
|
233
234
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara-util
|