foobara 0.6.1 → 0.6.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/CHANGELOG.md +5 -0
- data/projects/command_connectors/src/command_connector/concerns/reflection.rb +59 -13
- data/projects/command_connectors/src/command_registry.rb +9 -3
- data/projects/typesystem/projects/builtin_types/lib/foobara/builtin_types.rb +1 -0
- data/projects/typesystem/projects/domain/src/extensions/foobara.rb +8 -0
- data/projects/typesystem/projects/types/lib/foobara/types.rb +0 -2
- data/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82cde9f69a93f602dfc7c64ae307642920cd755c0406a549e7247e47992982a4
|
|
4
|
+
data.tar.gz: dd875dcf264ab47d1bc4af1ae08cd391e2bac8771fde7681f213402c3a8ad269
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b37ae22e17b00b133153a71924c1657b0d64f37c141a48ea0d05309f8316a6afe5387627052d83dadc2b58c09b1906190b4633921615420a26c449d3e660c75c
|
|
7
|
+
data.tar.gz: 5887b2e59372917e3b2535dd1b918cedf49c5fd7011e241036ace90b0a45478753d394f93f4f5d473079443ad3092ee4bf3865d42a0dadda66fbadf3e68065d6
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# [0.6.2] - 2026-08-24
|
|
2
|
+
|
|
3
|
+
- Eliminate all direct uses of Foobara.manifest in the test suite and deprecate it
|
|
4
|
+
- Fix bug preventing other combinations an Error missing parent/domain from getting fixed
|
|
5
|
+
|
|
1
6
|
# [0.6.1] - 2026-08-08
|
|
2
7
|
|
|
3
8
|
- Reduce gem size by excluding non-production code/artifacts from sub-projects
|
|
@@ -66,8 +66,14 @@ module Foobara
|
|
|
66
66
|
unless o.foobara_root_namespace == command_registry
|
|
67
67
|
next
|
|
68
68
|
end
|
|
69
|
-
elsif o.is_a?(::Class)
|
|
70
|
-
|
|
69
|
+
elsif o.is_a?(::Class)
|
|
70
|
+
if o < Foobara::Command
|
|
71
|
+
next
|
|
72
|
+
elsif o < Foobara::Value::Processor
|
|
73
|
+
full_domain_name = o.foobara_domain.scoped_full_name
|
|
74
|
+
exposed_domain = command_registry.create_exposed_domain_if_needed(full_domain_name)
|
|
75
|
+
additional_to_include << exposed_domain
|
|
76
|
+
end
|
|
71
77
|
end
|
|
72
78
|
elsif o.is_a?(Types::Type)
|
|
73
79
|
if o.sensitive?
|
|
@@ -77,7 +83,6 @@ module Foobara
|
|
|
77
83
|
"Make sure these are not included."
|
|
78
84
|
# simplecov:enable
|
|
79
85
|
else
|
|
80
|
-
|
|
81
86
|
mode = Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
|
82
87
|
domain_name = o.foobara_domain.scoped_full_name
|
|
83
88
|
|
|
@@ -154,26 +159,67 @@ module Foobara
|
|
|
154
159
|
root_manifest = Manifest::RootManifest.new(manifest_hash)
|
|
155
160
|
|
|
156
161
|
error_category = {}
|
|
162
|
+
reference_to_category = {}
|
|
163
|
+
|
|
164
|
+
# The only thing we can scope to an org is a domain so leaving :organization out
|
|
165
|
+
[
|
|
166
|
+
:command,
|
|
167
|
+
:domain,
|
|
168
|
+
:type,
|
|
169
|
+
:error,
|
|
170
|
+
:processor,
|
|
171
|
+
:processor_class
|
|
172
|
+
].each do |category|
|
|
173
|
+
root_manifest.relevant_manifest[category]&.each_key do |key|
|
|
174
|
+
reference_to_category[key.to_s] = category
|
|
175
|
+
end
|
|
176
|
+
end
|
|
157
177
|
|
|
158
178
|
root_manifest.errors.each do |error|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
179
|
+
# TODO: let's deprecate parent_name and use parent_path instead.
|
|
180
|
+
error_manifest = if root_manifest.contains?(error.parent_name, error.parent_category) &&
|
|
181
|
+
root_manifest.contains?(error[:domain], :domain) &&
|
|
182
|
+
root_manifest.contains?(error.parent[:domain], :domain)
|
|
183
|
+
|
|
184
|
+
error.relevant_manifest
|
|
185
|
+
else
|
|
186
|
+
parent = nil
|
|
187
|
+
|
|
188
|
+
fixed_scoped_path = error.scoped_path.dup
|
|
189
|
+
parent_path = error.scoped_full_path[..-(fixed_scoped_path.size + 1)]
|
|
190
|
+
|
|
191
|
+
loop do
|
|
192
|
+
fixed_scoped_path.unshift(parent_path.pop)
|
|
193
|
+
parent_name = parent_path.join("::")
|
|
194
|
+
|
|
195
|
+
if parent_path.empty?
|
|
196
|
+
parent = root_manifest.global_domain
|
|
197
|
+
break
|
|
198
|
+
elsif reference_to_category.include?(parent_name)
|
|
199
|
+
possible_parent = root_manifest.lookup(parent_name)
|
|
200
|
+
|
|
201
|
+
if root_manifest.contains?(possible_parent[:domain], :domain)
|
|
202
|
+
parent = possible_parent
|
|
203
|
+
break
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
fixed_parent = parent.manifest_path
|
|
209
|
+
fixed_domain = parent[:domain]
|
|
210
|
+
fixed_organization = parent[:organization]
|
|
163
211
|
|
|
164
|
-
fixed_scoped_path = error.scoped_full_path[index..]
|
|
165
|
-
fixed_scoped_name = fixed_scoped_path.join("::")
|
|
166
212
|
fixed_scoped_prefix = fixed_scoped_path[..-2]
|
|
167
|
-
|
|
213
|
+
fixed_scoped_name = fixed_scoped_path.join("::")
|
|
168
214
|
|
|
169
215
|
error.relevant_manifest.merge(
|
|
170
216
|
parent: fixed_parent,
|
|
171
217
|
scoped_path: fixed_scoped_path,
|
|
172
218
|
scoped_name: fixed_scoped_name,
|
|
173
|
-
scoped_prefix: fixed_scoped_prefix
|
|
219
|
+
scoped_prefix: fixed_scoped_prefix,
|
|
220
|
+
domain: fixed_domain,
|
|
221
|
+
organization: fixed_organization
|
|
174
222
|
)
|
|
175
|
-
else
|
|
176
|
-
error.relevant_manifest
|
|
177
223
|
end
|
|
178
224
|
|
|
179
225
|
error_category[error.scoped_full_name.to_sym] = error_manifest
|
|
@@ -204,13 +204,19 @@ module Foobara
|
|
|
204
204
|
end
|
|
205
205
|
end
|
|
206
206
|
|
|
207
|
+
# Why are we calling this _name instead of _reference??
|
|
208
|
+
def create_exposed_domain_if_needed(full_domain_name)
|
|
209
|
+
foobara_lookup_domain(
|
|
210
|
+
full_domain_name,
|
|
211
|
+
mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
|
212
|
+
) || build_and_register_exposed_domain(full_domain_name)
|
|
213
|
+
end
|
|
214
|
+
|
|
207
215
|
private
|
|
208
216
|
|
|
209
217
|
def create_exposed_command(command_class, **opts)
|
|
210
218
|
full_domain_name = command_class.domain.scoped_full_name
|
|
211
|
-
exposed_domain =
|
|
212
|
-
mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) ||
|
|
213
|
-
build_and_register_exposed_domain(full_domain_name)
|
|
219
|
+
exposed_domain = create_exposed_domain_if_needed(full_domain_name)
|
|
214
220
|
|
|
215
221
|
if !opts.key?(:allowed_rule) && allow&.key?(command_class)
|
|
216
222
|
opts = opts.merge(allowed_rule: allow[command_class])
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
module Foobara
|
|
2
2
|
class << self
|
|
3
3
|
def manifest
|
|
4
|
+
# simplecov:disable
|
|
5
|
+
warn "Foobara.manifest is deprecated in favor of CommandConnector#foobara_manifest" \
|
|
6
|
+
"\nIf this breaks a legit use case for Foobara.manifest please let us know and we will consider keeping it!"
|
|
7
|
+
debug_manifest
|
|
8
|
+
# simplecov:enable
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private def debug_manifest
|
|
4
12
|
to_include = Namespace.global.foobara_all_organization.to_set
|
|
5
13
|
|
|
6
14
|
TypeDeclarations.with_manifest_context(to_include:) do
|
data/version.rb
CHANGED