foobara 0.0.109 → 0.0.110

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: ee346090e6fcaa8a036f4edd3df0eda6ca76b55d600906b86226aa8c4a13862d
4
- data.tar.gz: 403fd19ededf68298e03087abeb747a23e7015d4f45981bf0afefab64a5bd204
3
+ metadata.gz: 71a254889aa452b7a219cb8d9b4c7d1c2eb2c21ea452ae783e62d601720c387b
4
+ data.tar.gz: 451cf0735d2c75026c92b92381e0e8a3766ed69a8a08eed739e6866e88f5b134
5
5
  SHA512:
6
- metadata.gz: 70dba1fa9bbed33a1cee53a7b64c1d36b417b1a148f678a1a52878b9677b550f7bd0d47f644c4df4bb7c08591bc0d288ad13423c9af88a61e613f9ca82dd216e
7
- data.tar.gz: 8aeb22a52568439b29b0ba823a7add6b18301b0bd08f2532ca5829c36364634c5d7145894d694c7dab8af1b63229a1c3bc7ffcc06881e52b28b4ea6c51ef0b2c
6
+ metadata.gz: 6d758bae9e990d477c7775966b69dd1a51ae1878b938fec278a76ebbb8dd88a417e6c68f3a11174929cb86f858294bf1207206704bba70c458035e3798b12597
7
+ data.tar.gz: 9f7c770b990f942884aaa79f45f7ce344aaabaa8a939536d869802c25ccc2ada3b7ddb476119a543d5546019874ae44929af29d5437d0574e447a4f8acc398ed
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # [0.0.110] - 2025-04-23
2
+
3
+ - Automatically load associations needed for delegated attributes for
4
+ result of commands exposed via command connectors
5
+
1
6
  # [0.0.109] - 2025-04-22
2
7
 
3
8
  - Support CommandConnector transformers that don't take declaration_data
@@ -36,7 +36,7 @@ module Foobara
36
36
 
37
37
  unless authenticator.symbol
38
38
  # :nocov:
39
- raise ArgumentError, "Expected an authenticator to have a symbol"
39
+ raise ArgumentError, "Expected authenticator to have a symbol"
40
40
  # :nocov:
41
41
  end
42
42
 
@@ -90,6 +90,22 @@ module Foobara
90
90
  self.allowed_rule = allowed_rule
91
91
  self.requires_authentication = requires_authentication
92
92
  self.authenticator = authenticator
93
+
94
+ # A bit hacky... we should check if we need to shim in a LoadDelegatedAttributesEntitiesPreCommitTransformer
95
+ unless aggregate_entities
96
+ # It's possible delegates have been added or removed via the result transformers...
97
+ # We should figure out a way to check the transformed result type instead.
98
+ if _has_delegated_attributes?(command_class.result_type)
99
+ self.pre_commit_transformers = [
100
+ *self.pre_commit_transformers,
101
+ CommandConnectors::Transformers::LoadDelegatedAttributesEntitiesPreCommitTransformer
102
+ ].uniq
103
+ end
104
+ end
105
+ end
106
+
107
+ def _has_delegated_attributes?(type)
108
+ type&.extends?(BuiltinTypes[:model]) && type.target_class&.has_delegated_attributes?
93
109
  end
94
110
 
95
111
  def full_command_name
@@ -155,6 +155,10 @@ module Foobara
155
155
  @delegates ||= {}
156
156
  end
157
157
 
158
+ def has_delegated_attributes?
159
+ !delegates.empty?
160
+ end
161
+
158
162
  def private_attribute_names
159
163
  @private_attribute_names ||= []
160
164
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.109
4
+ version: 0.0.110
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
@@ -508,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
508
508
  - !ruby/object:Gem::Version
509
509
  version: '0'
510
510
  requirements: []
511
- rubygems_version: 3.6.7
511
+ rubygems_version: 3.6.8
512
512
  specification_version: 4
513
513
  summary: A command-centric and discoverable software framework with a focus on domain
514
514
  concepts and abstracting away integration code