foobara 0.0.92 → 0.0.93
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/CHANGELOG.md +8 -0
- data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +39 -18
- data/projects/command/src/transformed_command.rb +83 -40
- data/projects/command_connectors/src/command_connector/commands/describe.rb +1 -5
- data/projects/command_connectors/src/command_connector.rb +61 -59
- data/projects/command_connectors/src/command_registry/exposed_command.rb +2 -2
- data/projects/command_connectors/src/command_registry/exposed_domain.rb +10 -3
- data/projects/command_connectors/src/command_registry/exposed_organization.rb +2 -2
- data/projects/command_connectors/src/serializers/atomic_serializer.rb +1 -1
- data/projects/command_connectors/src/transformers/load_delegated_attributes_entities_pre_commit_transformer.rb +40 -0
- data/projects/common/src/data_path.rb +16 -0
- data/projects/common/src/error.rb +10 -4
- data/projects/common/src/possible_error.rb +9 -3
- data/projects/detached_entity/src/concerns/associations.rb +26 -20
- data/projects/detached_entity/src/concerns/reflection.rb +3 -3
- data/projects/detached_entity/src/detached_entity_type.rb +8 -3
- data/projects/detached_entity/src/extensions/builtin_types/detached_entity/validators/{attributes_declaration.rb → model_instance_is_valid.rb} +1 -1
- data/projects/domain/src/domain_module_extension.rb +12 -4
- data/projects/domain/src/extensions/foobara.rb +31 -28
- data/projects/domain/src/is_manifestable.rb +6 -2
- data/projects/domain/src/organization_module_extension.rb +6 -2
- data/projects/entity/src/concerns/queries.rb +29 -31
- data/projects/entity/src/extensions/builtin_types/entity/validators/{attributes_declaration.rb → model_instance_is_valid.rb} +1 -1
- data/projects/model/src/concerns/reflection.rb +8 -2
- data/projects/model/src/concerns/types.rb +121 -23
- data/projects/model/src/extensions/builtin_types/model/supported_transformers/mutable.rb +1 -2
- data/projects/model/src/extensions/builtin_types/model/validators/{attributes_declaration.rb → model_instance_is_valid.rb} +1 -1
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb +29 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_desugarizer.rb +39 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_validator.rb +44 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/move_private_from_element_types_to_root.rb +48 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/symbolize_private.rb +34 -0
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +34 -2
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/valid_attribute_names.rb +54 -0
- data/projects/model/src/model.rb +9 -0
- data/projects/model_attribute_helpers/src/attribute_helpers.rb +25 -4
- data/projects/namespace/src/is_namespace.rb +34 -15
- data/projects/persistence/src/entity_attributes_crud_driver.rb +25 -1
- data/projects/persistence/src/entity_base/transaction_table.rb +28 -3
- data/projects/type_declarations/src/desugarizer.rb +1 -1
- data/projects/type_declarations/src/type_builder.rb +42 -39
- data/projects/type_declarations/src/type_declaration_handler.rb +1 -1
- data/projects/type_declarations/src/type_declaration_handler_registry.rb +1 -1
- data/projects/type_declarations/src/type_declaration_validator.rb +1 -1
- data/projects/type_declarations/src/type_declarations.rb +39 -10
- data/projects/types/src/extensions/error.rb +3 -3
- data/projects/types/src/type/concerns/reflection.rb +79 -4
- data/projects/types/src/type.rb +42 -17
- data/projects/value/src/caster.rb +1 -1
- data/projects/value/src/mutator.rb +1 -1
- data/projects/value/src/processor/casting.rb +1 -1
- data/projects/value/src/processor/pipeline.rb +1 -1
- data/projects/value/src/processor/selection.rb +1 -1
- data/projects/value/src/processor.rb +13 -5
- data/projects/value/src/transformer.rb +1 -1
- data/projects/value/src/validator.rb +1 -1
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 447d11c02182fce4303fe2db74bbc322e0589d51161756496b2c5d8390a26eab
|
4
|
+
data.tar.gz: 3a1ce551119b74488a5fe9fc86651ab914eec93f87f1d806da8f4b58135d8de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf4413d689bef2063e5a43d8c88cc8f70b3d6158f722419fb613ee4a2c13560d8fff23addd5cc34d4f18ad7c6437435d5382f205b6aa53904888354e6cb0de04
|
7
|
+
data.tar.gz: 761d8e8de14d04d5ca8c2916c23ead8cc261ca8b641584083ef2cb25e9fc9a621515be5a5524d41c97b0a867d829ae8b8cd802b6935b152b9ae8ef55ec9c6944
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# [0.0.93] - 2025-04-06
|
2
|
+
|
3
|
+
- Add delegated attributes to models
|
4
|
+
- Add private attributes to models
|
5
|
+
- Pass manifest construction context through thread_parent instead of passing it everywhere
|
6
|
+
- Various namespace lookup bugfixes
|
7
|
+
- Various bugfixes for .find_all/many type of methods in both Model and crud drivers
|
8
|
+
|
1
9
|
# [0.0.92] - 2025-04-01
|
2
10
|
|
3
11
|
- Improve error call stacks in calls like #run!
|
@@ -19,36 +19,48 @@ module Foobara
|
|
19
19
|
remove_instance_variable("@all") if instance_variable_defined?("@all")
|
20
20
|
end
|
21
21
|
|
22
|
-
def foobara_manifest
|
22
|
+
def foobara_manifest
|
23
|
+
to_include = TypeDeclarations.foobara_manifest_context_to_include
|
24
|
+
|
23
25
|
depends_on = self.depends_on.map do |command_name|
|
24
26
|
other_command = Foobara::Namespace.global.foobara_lookup!(command_name,
|
25
27
|
mode: Foobara::Namespace::LookupMode::ABSOLUTE)
|
26
|
-
to_include
|
28
|
+
if to_include
|
29
|
+
to_include << other_command
|
30
|
+
end
|
27
31
|
other_command.foobara_manifest_reference
|
28
32
|
end.sort
|
29
33
|
|
30
|
-
types = types_depended_on
|
31
|
-
to_include
|
34
|
+
types = types_depended_on.map do |t|
|
35
|
+
if to_include
|
36
|
+
to_include << t
|
37
|
+
end
|
32
38
|
t.foobara_manifest_reference
|
33
39
|
end.sort
|
34
40
|
|
35
41
|
inputs_types_depended_on = self.inputs_types_depended_on.map do |t|
|
36
|
-
to_include
|
42
|
+
if to_include
|
43
|
+
to_include << t
|
44
|
+
end
|
37
45
|
t.foobara_manifest_reference
|
38
46
|
end.sort
|
39
47
|
|
40
48
|
result_types_depended_on = self.result_types_depended_on.map do |t|
|
41
|
-
to_include
|
49
|
+
if to_include
|
50
|
+
to_include << t
|
51
|
+
end
|
42
52
|
t.foobara_manifest_reference
|
43
53
|
end.sort
|
44
54
|
|
45
55
|
errors_types_depended_on = self.errors_types_depended_on.map do |t|
|
46
|
-
to_include
|
56
|
+
if to_include
|
57
|
+
to_include << t
|
58
|
+
end
|
47
59
|
t.foobara_manifest_reference
|
48
60
|
end.sort
|
49
61
|
|
50
62
|
possible_errors = self.possible_errors.map do |possible_error|
|
51
|
-
[possible_error.key.to_s, possible_error.foobara_manifest
|
63
|
+
[possible_error.key.to_s, possible_error.foobara_manifest]
|
52
64
|
end.sort.to_h
|
53
65
|
|
54
66
|
h = Util.remove_blank(
|
@@ -78,15 +90,18 @@ module Foobara
|
|
78
90
|
Util.non_full_name(self)
|
79
91
|
end
|
80
92
|
|
81
|
-
def types_depended_on
|
93
|
+
def types_depended_on
|
94
|
+
remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?
|
95
|
+
|
82
96
|
if defined?(@types_depended_on) && @types_depended_on.key?(remove_sensitive)
|
83
97
|
return @types_depended_on[remove_sensitive]
|
84
98
|
end
|
85
99
|
|
86
100
|
@types_depended_on ||= {}
|
87
101
|
@types_depended_on[remove_sensitive] = begin
|
88
|
-
types = inputs_types_depended_on
|
89
|
-
|
102
|
+
types = inputs_types_depended_on |
|
103
|
+
result_types_depended_on |
|
104
|
+
errors_types_depended_on
|
90
105
|
|
91
106
|
unless depends_on_entities.empty?
|
92
107
|
entity_types = depends_on_entities.map(&:entity_type)
|
@@ -96,14 +111,16 @@ module Foobara
|
|
96
111
|
end
|
97
112
|
|
98
113
|
types |= entity_types
|
99
|
-
types |= entity_types.map
|
114
|
+
types |= entity_types.map(&:types_depended_on).inject(:|)
|
100
115
|
end
|
101
116
|
|
102
117
|
types
|
103
118
|
end
|
104
119
|
end
|
105
120
|
|
106
|
-
def inputs_types_depended_on
|
121
|
+
def inputs_types_depended_on
|
122
|
+
remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?
|
123
|
+
|
107
124
|
if defined?(@inputs_types_depended_on) && @inputs_types_depended_on.key?(remove_sensitive)
|
108
125
|
return @inputs_types_depended_on[remove_sensitive]
|
109
126
|
end
|
@@ -121,14 +138,16 @@ module Foobara
|
|
121
138
|
end
|
122
139
|
# :nocov:
|
123
140
|
else
|
124
|
-
inputs_type.types_depended_on
|
141
|
+
inputs_type.types_depended_on
|
125
142
|
end
|
126
143
|
else
|
127
144
|
Set.new
|
128
145
|
end
|
129
146
|
end
|
130
147
|
|
131
|
-
def result_types_depended_on
|
148
|
+
def result_types_depended_on
|
149
|
+
remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?
|
150
|
+
|
132
151
|
if defined?(@result_types_depended_on) && @result_types_depended_on.key?(remove_sensitive)
|
133
152
|
return @result_types_depended_on[remove_sensitive]
|
134
153
|
end
|
@@ -138,14 +157,16 @@ module Foobara
|
|
138
157
|
if result_type.registered?
|
139
158
|
Set[result_type]
|
140
159
|
else
|
141
|
-
result_type.types_depended_on
|
160
|
+
result_type.types_depended_on
|
142
161
|
end
|
143
162
|
else
|
144
163
|
Set.new
|
145
164
|
end
|
146
165
|
end
|
147
166
|
|
148
|
-
def errors_types_depended_on
|
167
|
+
def errors_types_depended_on
|
168
|
+
remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?
|
169
|
+
|
149
170
|
if defined?(@errors_types_depended_on) && @errors_types_depended_on.key?(remove_sensitive)
|
150
171
|
return @errors_types_depended_on[remove_sensitive]
|
151
172
|
end
|
@@ -153,7 +174,7 @@ module Foobara
|
|
153
174
|
@errors_types_depended_on ||= {}
|
154
175
|
@errors_types_depended_on[remove_sensitive] = begin
|
155
176
|
error_classes = possible_errors.map(&:error_class)
|
156
|
-
error_classes.map
|
177
|
+
error_classes.map(&:types_depended_on).inject(:|) || Set.new
|
157
178
|
end
|
158
179
|
end
|
159
180
|
end
|
@@ -174,28 +174,48 @@ module Foobara
|
|
174
174
|
@possible_errors ||= error_context_type_map.values
|
175
175
|
end
|
176
176
|
|
177
|
-
def possible_errors_manifest
|
178
|
-
|
179
|
-
|
180
|
-
|
177
|
+
def possible_errors_manifest
|
178
|
+
errors_proc = -> do
|
179
|
+
possible_errors.map do |possible_error|
|
180
|
+
[possible_error.key.to_s, possible_error.foobara_manifest]
|
181
|
+
end.sort.to_h
|
182
|
+
end
|
183
|
+
|
184
|
+
if TypeDeclarations.manifest_context_set?(:remove_sensitive)
|
185
|
+
errors_proc.call
|
186
|
+
else
|
187
|
+
TypeDeclarations.with_manifest_context(remove_sensitive: true, &errors_proc)
|
188
|
+
end
|
181
189
|
end
|
182
190
|
|
183
191
|
def inputs_types_depended_on
|
184
|
-
|
192
|
+
TypeDeclarations.with_manifest_context(remove_sensitive: false) do
|
193
|
+
inputs_type_for_manifest&.types_depended_on || []
|
194
|
+
end
|
185
195
|
end
|
186
196
|
|
187
|
-
def result_types_depended_on
|
188
|
-
result_type_for_manifest&.types_depended_on
|
197
|
+
def result_types_depended_on
|
198
|
+
type_proc = -> { result_type_for_manifest&.types_depended_on || [] }
|
199
|
+
|
200
|
+
if TypeDeclarations.manifest_context_set?(:remove_sensitive)
|
201
|
+
type_proc.call
|
202
|
+
else
|
203
|
+
TypeDeclarations.with_manifest_context(remove_sensitive: true, &type_proc)
|
204
|
+
end
|
189
205
|
end
|
190
206
|
|
191
|
-
def types_depended_on
|
207
|
+
def types_depended_on
|
208
|
+
# Seems to be not necessary?
|
209
|
+
# types = command_class.types_depended_on
|
210
|
+
|
211
|
+
types = Set.new
|
212
|
+
|
192
213
|
# TODO: memoize this
|
193
214
|
# TODO: this should not delegate to command since transformers are in play
|
194
|
-
types = command_class.types_depended_on(remove_sensitive:)
|
195
215
|
|
196
216
|
type = inputs_type
|
197
217
|
|
198
|
-
if type
|
218
|
+
if type
|
199
219
|
if type.registered?
|
200
220
|
# TODO: if we ever change from attributes-only inputs type
|
201
221
|
# then this will be handy
|
@@ -207,75 +227,98 @@ module Foobara
|
|
207
227
|
types |= type.types_depended_on
|
208
228
|
end
|
209
229
|
|
210
|
-
|
230
|
+
types_proc = proc do
|
231
|
+
type = result_type
|
211
232
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
233
|
+
if type
|
234
|
+
if type.registered?
|
235
|
+
# TODO: if we ever change from attributes-only inputs type
|
236
|
+
# then this will be handy
|
237
|
+
# :nocov:
|
238
|
+
types |= [type]
|
239
|
+
# :nocov:
|
240
|
+
end
|
241
|
+
|
242
|
+
types |= type.types_depended_on
|
219
243
|
end
|
220
244
|
|
221
|
-
|
222
|
-
|
245
|
+
possible_errors.each do |possible_error|
|
246
|
+
error_class = possible_error.error_class
|
247
|
+
types |= error_class.types_depended_on
|
248
|
+
end
|
223
249
|
|
224
|
-
|
225
|
-
error_class = possible_error.error_class
|
226
|
-
types |= error_class.types_depended_on(remove_sensitive:)
|
250
|
+
types
|
227
251
|
end
|
228
252
|
|
229
|
-
|
253
|
+
if TypeDeclarations.manifest_context_set?(:remove_sensitive)
|
254
|
+
types_proc.call
|
255
|
+
else
|
256
|
+
TypeDeclarations.with_manifest_context(remove_sensitive: true, &types_proc)
|
257
|
+
end
|
230
258
|
end
|
231
259
|
|
232
|
-
def foobara_manifest
|
260
|
+
def foobara_manifest
|
261
|
+
to_include = TypeDeclarations.foobara_manifest_context_to_include
|
262
|
+
|
233
263
|
types = types_depended_on.select(&:registered?).map do |t|
|
234
|
-
to_include
|
264
|
+
if to_include
|
265
|
+
to_include << t
|
266
|
+
end
|
235
267
|
t.foobara_manifest_reference
|
236
268
|
end.sort
|
237
269
|
|
238
|
-
inputs_transformers =
|
239
|
-
|
240
|
-
|
241
|
-
|
270
|
+
inputs_transformers = TypeDeclarations.with_manifest_context(remove_sensitive: false) do
|
271
|
+
self.inputs_transformers.map(&:foobara_manifest)
|
272
|
+
end
|
273
|
+
result_transformers = self.result_transformers.map(&:foobara_manifest)
|
274
|
+
errors_transformers = self.errors_transformers.map(&:foobara_manifest)
|
275
|
+
pre_commit_transformers = self.pre_commit_transformers.map(&:foobara_manifest)
|
242
276
|
serializers = self.serializers.map do |s|
|
243
277
|
if s.respond_to?(:foobara_manifest)
|
244
|
-
to_include
|
278
|
+
if to_include
|
279
|
+
to_include << s
|
280
|
+
end
|
245
281
|
s.foobara_manifest_reference
|
246
282
|
else
|
247
283
|
{ proc: s.to_s }
|
248
284
|
end
|
249
285
|
end
|
250
286
|
|
251
|
-
response_mutators = self.response_mutators.map
|
252
|
-
request_mutators =
|
287
|
+
response_mutators = self.response_mutators.map(&:foobara_manifest)
|
288
|
+
request_mutators = TypeDeclarations.with_manifest_context(remove_sensitive: false) do
|
289
|
+
self.request_mutators.map(&:foobara_manifest)
|
290
|
+
end
|
253
291
|
|
254
292
|
authenticator_manifest = if authenticator
|
255
293
|
if authenticator.respond_to?(:foobara_manifest)
|
256
294
|
# TODO: test this path
|
257
295
|
# :nocov:
|
258
|
-
authenticator.foobara_manifest
|
296
|
+
authenticator.foobara_manifest
|
259
297
|
# :nocov:
|
260
298
|
else
|
261
299
|
true
|
262
300
|
end
|
263
301
|
end
|
264
302
|
|
265
|
-
inputs_types_depended_on =
|
266
|
-
|
303
|
+
inputs_types_depended_on = TypeDeclarations.with_manifest_context(remove_sensitive: false) do
|
304
|
+
self.inputs_types_depended_on.map(&:foobara_manifest_reference).sort
|
305
|
+
end
|
306
|
+
|
307
|
+
result_types_depended_on = self.result_types_depended_on.map(&:foobara_manifest_reference)
|
267
308
|
result_types_depended_on = result_types_depended_on.sort
|
268
309
|
|
269
310
|
# TODO: Do NOT defer to command_class.foobara_manifest because it might process types that
|
270
311
|
# might not have an exposed command and might not need one due to transformers/mutators/remove_sensitive flag
|
271
|
-
command_class.foobara_manifest
|
312
|
+
command_class.foobara_manifest.merge(
|
272
313
|
Util.remove_blank(
|
273
314
|
inputs_types_depended_on:,
|
274
315
|
result_types_depended_on:,
|
275
316
|
types_depended_on: types,
|
276
|
-
inputs_type:
|
277
|
-
|
278
|
-
|
317
|
+
inputs_type: TypeDeclarations.with_manifest_context(remove_sensitive: false) do
|
318
|
+
inputs_type_for_manifest&.reference_or_declaration_data
|
319
|
+
end,
|
320
|
+
result_type: result_type_for_manifest&.reference_or_declaration_data,
|
321
|
+
possible_errors: possible_errors_manifest,
|
279
322
|
capture_unknown_error:,
|
280
323
|
inputs_transformers:,
|
281
324
|
result_transformers:,
|
@@ -16,11 +16,7 @@ module Foobara
|
|
16
16
|
attr_accessor :manifest
|
17
17
|
|
18
18
|
def build_manifest
|
19
|
-
self.manifest =
|
20
|
-
manifestable.foobara_manifest
|
21
|
-
else
|
22
|
-
manifestable.foobara_manifest(to_include: Set.new)
|
23
|
-
end
|
19
|
+
self.manifest = manifestable.foobara_manifest
|
24
20
|
end
|
25
21
|
|
26
22
|
def stamp_request_metadata
|
@@ -396,10 +396,9 @@ module Foobara
|
|
396
396
|
Foobara.foobara_lookup_type(name, mode: Namespace::LookupMode::RELAXED)
|
397
397
|
end
|
398
398
|
|
399
|
-
def foobara_manifest
|
399
|
+
def foobara_manifest
|
400
400
|
process_delayed_connections
|
401
401
|
|
402
|
-
# Drive all of this off of the list of exposed commands...
|
403
402
|
to_include = Set.new
|
404
403
|
|
405
404
|
to_include << command_registry.global_organization
|
@@ -423,81 +422,84 @@ module Foobara
|
|
423
422
|
processor_class: {}
|
424
423
|
}
|
425
424
|
|
426
|
-
|
427
|
-
|
425
|
+
TypeDeclarations.with_manifest_context(to_include: additional_to_include, remove_sensitive: true) do
|
426
|
+
until to_include.empty? && additional_to_include.empty?
|
427
|
+
object = nil
|
428
428
|
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
429
|
+
if to_include.empty?
|
430
|
+
until additional_to_include.empty?
|
431
|
+
o = additional_to_include.first
|
432
|
+
additional_to_include.delete(o)
|
433
433
|
|
434
|
-
|
435
|
-
|
436
|
-
|
434
|
+
if o.is_a?(::Module)
|
435
|
+
if o.foobara_domain? || o.foobara_organization?
|
436
|
+
unless o.foobara_root_namespace == command_registry
|
437
|
+
next
|
438
|
+
end
|
439
|
+
elsif o.is_a?(::Class) && o < Foobara::Command
|
437
440
|
next
|
438
441
|
end
|
439
|
-
elsif o.is_a?(::
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
442
|
+
elsif o.is_a?(Types::Type)
|
443
|
+
if o.sensitive?
|
444
|
+
# :nocov:
|
445
|
+
raise UnexpectedSensitiveTypeInManifestError,
|
446
|
+
"Unexpected sensitive type in manifest: #{o.scoped_full_path}. " \
|
447
|
+
"Make sure these are not included."
|
444
448
|
# :nocov:
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
command_registry.foobara_all_domain.each do |exposed_domain|
|
457
|
-
additional_to_include << exposed_domain
|
458
|
-
end
|
449
|
+
else
|
450
|
+
domain_name = o.foobara_domain.scoped_full_name
|
451
|
+
|
452
|
+
unless command_registry.foobara_registered?(domain_name)
|
453
|
+
command_registry.build_and_register_exposed_domain(domain_name)
|
454
|
+
|
455
|
+
# Since we don't know which other domains/orgs creating this domain might have created,
|
456
|
+
# we will just add them all to be included just in case
|
457
|
+
command_registry.foobara_all_domain.each do |exposed_domain|
|
458
|
+
additional_to_include << exposed_domain
|
459
|
+
end
|
459
460
|
|
460
|
-
|
461
|
-
|
461
|
+
command_registry.foobara_all_organization.each do |exposed_organization|
|
462
|
+
additional_to_include << exposed_organization
|
463
|
+
end
|
462
464
|
end
|
463
465
|
end
|
464
466
|
end
|
465
|
-
end
|
466
467
|
|
467
|
-
|
468
|
-
|
468
|
+
object = o
|
469
|
+
break
|
470
|
+
end
|
471
|
+
else
|
472
|
+
object = to_include.first
|
473
|
+
to_include.delete(object)
|
469
474
|
end
|
470
|
-
else
|
471
|
-
object = to_include.first
|
472
|
-
to_include.delete(object)
|
473
|
-
end
|
474
475
|
|
475
|
-
|
476
|
-
|
476
|
+
break unless object
|
477
|
+
next if included.include?(object)
|
477
478
|
|
478
|
-
|
479
|
+
manifest_reference = object.foobara_manifest_reference.to_sym
|
479
480
|
|
480
|
-
|
481
|
+
category_symbol = command_registry.foobara_category_symbol_for(object)
|
481
482
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
483
|
+
unless category_symbol
|
484
|
+
# :nocov:
|
485
|
+
raise "no category symbol for #{object}"
|
486
|
+
# :nocov:
|
487
|
+
end
|
487
488
|
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
489
|
+
namespace = if object.is_a?(Types::Type)
|
490
|
+
object.created_in_namespace
|
491
|
+
else
|
492
|
+
Foobara::Namespace.current
|
493
|
+
end
|
493
494
|
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
495
|
+
cat = h[category_symbol] ||= {}
|
496
|
+
# TODO: do we really need to enter the namespace here for this?
|
497
|
+
cat[manifest_reference] = Foobara::Namespace.use namespace do
|
498
|
+
object.foobara_manifest
|
499
|
+
end
|
499
500
|
|
500
|
-
|
501
|
+
included << object
|
502
|
+
end
|
501
503
|
end
|
502
504
|
|
503
505
|
h[:domain].each_value do |domain_manifest|
|
@@ -100,8 +100,8 @@ module Foobara
|
|
100
100
|
@full_command_symbol ||= Util.underscore_sym(full_command_name)
|
101
101
|
end
|
102
102
|
|
103
|
-
def foobara_manifest
|
104
|
-
transformed_command_class.foobara_manifest
|
103
|
+
def foobara_manifest
|
104
|
+
transformed_command_class.foobara_manifest.merge(super).merge(
|
105
105
|
Util.remove_blank(
|
106
106
|
scoped_category: :command,
|
107
107
|
domain: command_class.domain.foobara_manifest_reference,
|
@@ -9,10 +9,17 @@ module Foobara
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# TODO: unable to address types here so it is handled as a hack higher up...
|
12
|
-
def foobara_manifest
|
13
|
-
to_include
|
12
|
+
def foobara_manifest
|
13
|
+
to_include = TypeDeclarations.foobara_manifest_context_to_include
|
14
|
+
|
15
|
+
if to_include
|
16
|
+
to_include << foobara_organization
|
17
|
+
end
|
18
|
+
|
19
|
+
domain_manifest = TypeDeclarations.with_manifest_context(to_include: Set.new) do
|
20
|
+
unexposed_domain.foobara_manifest
|
21
|
+
end
|
14
22
|
|
15
|
-
domain_manifest = unexposed_domain.foobara_manifest(to_include: Set.new, remove_sensitive:)
|
16
23
|
mode = Foobara::Namespace::LookupMode::DIRECT
|
17
24
|
commands = foobara_all_command(mode:).map(&:foobara_manifest_reference).sort
|
18
25
|
|
@@ -9,8 +9,8 @@ module Foobara
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# TODO: unable to address types here so it is handled as a hack higher up...
|
12
|
-
def foobara_manifest
|
13
|
-
organization_manifest = unexposed_organization.foobara_manifest
|
12
|
+
def foobara_manifest
|
13
|
+
organization_manifest = unexposed_organization.foobara_manifest
|
14
14
|
mode = Foobara::Namespace::LookupMode::DIRECT
|
15
15
|
domains = foobara_all_domain(mode:).map(&:foobara_manifest_reference).sort
|
16
16
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Foobara
|
2
|
+
module CommandConnectors
|
3
|
+
module Transformers
|
4
|
+
# TODO: Should be a mutator instead
|
5
|
+
class LoadDelegatedAttributesEntitiesPreCommitTransformer < Value::Transformer
|
6
|
+
def applicable?(request)
|
7
|
+
request.command.outcome.success?
|
8
|
+
end
|
9
|
+
|
10
|
+
def transform(request)
|
11
|
+
result = request.command.outcome.result
|
12
|
+
load_delegated_attribute_entities(result)
|
13
|
+
|
14
|
+
request
|
15
|
+
end
|
16
|
+
|
17
|
+
def load_delegated_attribute_entities(object)
|
18
|
+
case object
|
19
|
+
when Entity
|
20
|
+
object.class.delegates.each_key do |delegated_attribute_name|
|
21
|
+
object.send(delegated_attribute_name)
|
22
|
+
end
|
23
|
+
when Array
|
24
|
+
object.each do |element|
|
25
|
+
load_delegated_attribute_entities(element)
|
26
|
+
end
|
27
|
+
when Hash
|
28
|
+
object.each_key do |key|
|
29
|
+
load_delegated_attribute_entities(key)
|
30
|
+
end
|
31
|
+
|
32
|
+
object.each_value do |value|
|
33
|
+
load_delegated_attribute_entities(value)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -76,6 +76,14 @@ module Foobara
|
|
76
76
|
def parse(key_string)
|
77
77
|
new(key_string)
|
78
78
|
end
|
79
|
+
|
80
|
+
def for(object)
|
81
|
+
if object.is_a?(DataPath)
|
82
|
+
object
|
83
|
+
else
|
84
|
+
new(object)
|
85
|
+
end
|
86
|
+
end
|
79
87
|
end
|
80
88
|
|
81
89
|
attr_reader :path
|
@@ -204,6 +212,14 @@ module Foobara
|
|
204
212
|
self.class == other.class && path == other.path
|
205
213
|
end
|
206
214
|
|
215
|
+
def last
|
216
|
+
path.last
|
217
|
+
end
|
218
|
+
|
219
|
+
def empty?
|
220
|
+
path.empty?
|
221
|
+
end
|
222
|
+
|
207
223
|
private
|
208
224
|
|
209
225
|
def normalize_all(key_parts)
|