foobara 0.1.12 → 0.1.13
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 +7 -0
- data/projects/builtin_types/src/builtin_types.rb +1 -3
- data/projects/command/src/command_pattern_implementation/concerns/namespace.rb +10 -0
- data/projects/command_connectors/src/command_connector.rb +12 -12
- data/projects/command_connectors/src/command_registry/exposed_command.rb +1 -2
- data/projects/command_connectors/src/command_registry.rb +0 -2
- data/projects/domain/src/domain_module_extension.rb +45 -10
- data/projects/domain/src/global_domain.rb +0 -1
- data/projects/domain/src/global_organization.rb +1 -2
- data/projects/domain/src/module_extension.rb +2 -8
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +14 -3
- data/projects/namespace/src/ambiguous_registry.rb +1 -9
- data/projects/namespace/src/is_namespace.rb +30 -18
- data/projects/namespace/src/namespace.rb +10 -0
- data/projects/namespace/src/namespace_helpers.rb +1 -12
- data/projects/namespace/src/scoped.rb +34 -5
- data/projects/type_declarations/lib/foobara/type_declarations.rb +0 -1
- data/projects/type_declarations/src/attributes_transformers/from_yaml.rb +0 -1
- data/projects/type_declarations/src/attributes_transformers/only.rb +0 -1
- data/projects/type_declarations/src/attributes_transformers/reject.rb +0 -1
- data/projects/type_declarations/src/remove_sensitive_values_transformer.rb +31 -1
- data/projects/type_declarations/src/type_builder.rb +1 -1
- data/projects/types/src/type.rb +5 -1
- 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: 1261fd639b27af7af53e6a9be2225216d27ac77a83bddf4d78d645102473bff6
|
4
|
+
data.tar.gz: 8d1c16370a2adfdbd9eb47126d1ab830b502c2b7dfa885ed9099d0851a9bcd60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5a6ef53e71864b9d756447f8eaae461e798d243c23121e041a12a6e0c4ecaa87b624c593d185549b2714569b965913447fa747e5df7922d8a538d1a60061b94
|
7
|
+
data.tar.gz: 5a45569f70560c505b4c61a44fc91a0145e9d362c1f07ecacc2fb7cdbc3bbf12b9bc1f35ea51996f6138d060ed09b236483ed88fe12886609d3e241624db451a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.1.13] - 2025-09-27
|
2
|
+
|
3
|
+
- Fix various bugs resulting in values missing from connector manifest or included when they should not be
|
4
|
+
- Type creation performance improvements
|
5
|
+
- Fix bugs revolving around incorreclty making use of unregistered types
|
6
|
+
- Fix bug with deleting entries from an AmbiguousRegistry
|
7
|
+
|
1
8
|
# [0.1.12] - 2025-09-24
|
2
9
|
|
3
10
|
- Fix bug where a hard-deleted, non-persisted record cannot be cast
|
@@ -90,8 +90,7 @@ module Foobara
|
|
90
90
|
|
91
91
|
# TODO: really need to encapsulate this somehow...
|
92
92
|
type.type_symbol = type_symbol
|
93
|
-
type.foobara_parent_namespace
|
94
|
-
type.foobara_parent_namespace.foobara_register(type)
|
93
|
+
(type.foobara_parent_namespace || GlobalDomain).foobara_register(type)
|
95
94
|
|
96
95
|
supported_casters_module = Util.constant_value(builtin_type_module, :SupportedCasters)
|
97
96
|
supported_caster_classes = if supported_casters_module
|
@@ -151,7 +150,6 @@ module Foobara
|
|
151
150
|
parent = scoped.scoped_namespace
|
152
151
|
|
153
152
|
if parent.nil? || parent == Foobara || parent == Namespace.global || parent == GlobalDomain
|
154
|
-
scoped.foobara_parent_namespace = type
|
155
153
|
type.foobara_register(scoped)
|
156
154
|
end
|
157
155
|
end
|
@@ -48,6 +48,16 @@ module Foobara
|
|
48
48
|
def full_command_symbol
|
49
49
|
@full_command_symbol ||= Util.underscore_sym(full_command_name)
|
50
50
|
end
|
51
|
+
|
52
|
+
def handle_reregistered_types!
|
53
|
+
if inputs_type
|
54
|
+
inputs inputs_type.reference_or_declaration_data
|
55
|
+
end
|
56
|
+
|
57
|
+
if result_type
|
58
|
+
result result_type.reference_or_declaration_data
|
59
|
+
end
|
60
|
+
end
|
51
61
|
end
|
52
62
|
|
53
63
|
foobara_delegate :type_for_declaration, to: :class
|
@@ -504,11 +504,12 @@ module Foobara
|
|
504
504
|
to_include << command_registry.global_organization
|
505
505
|
to_include << command_registry.global_domain
|
506
506
|
|
507
|
-
command_registry.
|
508
|
-
to_include <<
|
507
|
+
command_registry.foobara_each_command(mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) do |exposed_command|
|
508
|
+
to_include << exposed_command
|
509
509
|
end
|
510
510
|
|
511
511
|
included = Set.new
|
512
|
+
|
512
513
|
additional_to_include = Set.new
|
513
514
|
|
514
515
|
h = {
|
@@ -551,23 +552,22 @@ module Foobara
|
|
551
552
|
"Make sure these are not included."
|
552
553
|
# :nocov:
|
553
554
|
else
|
555
|
+
|
554
556
|
mode = Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
555
557
|
domain_name = o.foobara_domain.scoped_full_name
|
556
558
|
|
557
559
|
exposed_domain = command_registry.foobara_lookup_domain(domain_name, mode:)
|
558
560
|
|
559
|
-
|
560
|
-
exposed_domain = command_registry.build_and_register_exposed_domain(domain_name)
|
561
|
+
exposed_domain ||= command_registry.build_and_register_exposed_domain(domain_name)
|
561
562
|
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
563
|
+
# Since we don't know which other domains/orgs creating this domain might have created,
|
564
|
+
# we will just add them all to be included just in case
|
565
|
+
command_registry.foobara_all_domain(mode:).each do |exposed_domain|
|
566
|
+
additional_to_include << exposed_domain
|
567
|
+
end
|
567
568
|
|
568
|
-
|
569
|
-
|
570
|
-
end
|
569
|
+
command_registry.foobara_all_organization(mode:).each do |exposed_organization|
|
570
|
+
additional_to_include << exposed_organization
|
571
571
|
end
|
572
572
|
end
|
573
573
|
end
|
@@ -94,7 +94,6 @@ module Foobara
|
|
94
94
|
exposed_domain.foobara_depends_on domain_module
|
95
95
|
|
96
96
|
exposed_organization.foobara_register(exposed_domain)
|
97
|
-
exposed_domain.foobara_parent_namespace = exposed_organization
|
98
97
|
|
99
98
|
domain_module.foobara_depends_on.each do |domain_name|
|
100
99
|
# TODO: test this code path!!
|
@@ -135,7 +134,6 @@ module Foobara
|
|
135
134
|
exposed_organization.unexposed_organization = org
|
136
135
|
|
137
136
|
foobara_register(exposed_organization)
|
138
|
-
exposed_organization.foobara_parent_namespace = self
|
139
137
|
|
140
138
|
exposed_organization
|
141
139
|
end
|
@@ -264,18 +264,54 @@ module Foobara
|
|
264
264
|
foobara_type_from_declaration(*type_declaration_bits, &block)
|
265
265
|
end
|
266
266
|
|
267
|
-
if type_symbol.is_a?(::Array)
|
268
|
-
|
269
|
-
|
267
|
+
new_scoped_path, new_type_symbol = if type_symbol.is_a?(::Array)
|
268
|
+
[type_symbol, type_symbol.join("::").to_sym]
|
269
|
+
else
|
270
|
+
type_symbol = type_symbol.to_s if type_symbol.is_a?(::Symbol)
|
271
|
+
|
272
|
+
[type_symbol.split("::"), type_symbol.to_sym]
|
273
|
+
end
|
274
|
+
|
275
|
+
if type.scoped_path_set? && type.registered? && foobara_registered?(type, mode: Namespace::LookupMode::DIRECT)
|
276
|
+
old_symbol = type.type_symbol
|
277
|
+
old_type = foobara_lookup_type(old_symbol, mode: Namespace::LookupMode::DIRECT)
|
278
|
+
|
279
|
+
if old_symbol != new_type_symbol
|
280
|
+
foobara_unregister(type)
|
281
|
+
|
282
|
+
type.scoped_path = new_scoped_path
|
283
|
+
type.type_symbol = new_type_symbol
|
284
|
+
|
285
|
+
foobara_register(type)
|
286
|
+
# :nocov:
|
287
|
+
elsif old_type != type
|
288
|
+
# TODO: delete this check if it's not really helping
|
289
|
+
|
290
|
+
raise "Didn't expect to find an old type"
|
291
|
+
# :nocov:
|
292
|
+
end
|
270
293
|
else
|
271
|
-
|
294
|
+
type.scoped_path = new_scoped_path
|
295
|
+
type.type_symbol = new_type_symbol
|
272
296
|
|
273
|
-
|
274
|
-
type.type_symbol = type_symbol.to_sym
|
275
|
-
end
|
297
|
+
old_type = foobara_lookup_type(new_type_symbol, mode: Namespace::LookupMode::DIRECT)
|
276
298
|
|
277
|
-
|
278
|
-
|
299
|
+
if old_type && old_type != type
|
300
|
+
# TODO: delete this check if it's not really helping
|
301
|
+
# :nocov:
|
302
|
+
raise "Didn't expect to find an old type"
|
303
|
+
# :nocov:
|
304
|
+
end
|
305
|
+
|
306
|
+
if foobara_registered?(type, mode: Namespace::LookupMode::DIRECT)
|
307
|
+
# TODO: delete this check if it's not really helping
|
308
|
+
# :nocov:
|
309
|
+
raise "Already registered: #{type.inspect}"
|
310
|
+
# :nocov:
|
311
|
+
end
|
312
|
+
|
313
|
+
foobara_register(type)
|
314
|
+
end
|
279
315
|
|
280
316
|
_set_type_constant(type)
|
281
317
|
|
@@ -299,7 +335,6 @@ module Foobara
|
|
299
335
|
end
|
300
336
|
|
301
337
|
foobara_register(type)
|
302
|
-
type.foobara_parent_namespace = self
|
303
338
|
|
304
339
|
type.target_class
|
305
340
|
end
|
@@ -3,8 +3,7 @@ require_relative "module_extension"
|
|
3
3
|
module Foobara
|
4
4
|
module GlobalOrganization
|
5
5
|
foobara_namespace!(scoped_path: [])
|
6
|
-
|
7
|
-
foobara_parent_namespace.foobara_register(self)
|
6
|
+
Namespace.global.foobara_register(self)
|
8
7
|
|
9
8
|
foobara_organization!
|
10
9
|
self.foobara_manifest_reference = self.foobara_organization_name = "global_organization"
|
@@ -20,10 +20,7 @@ module Foobara
|
|
20
20
|
foobara_autoset_namespace!(default_namespace: Foobara::GlobalOrganization)
|
21
21
|
foobara_autoset_scoped_path!
|
22
22
|
|
23
|
-
|
24
|
-
parent = foobara_parent_namespace
|
25
|
-
parent.foobara_register(self)
|
26
|
-
self.foobara_parent_namespace = parent
|
23
|
+
foobara_parent_namespace.foobara_register(self)
|
27
24
|
end
|
28
25
|
|
29
26
|
include(DomainModuleExtension)
|
@@ -99,10 +96,7 @@ module Foobara
|
|
99
96
|
self.scoped_namespace = Namespace.global
|
100
97
|
foobara_autoset_scoped_path!(make_top_level: true)
|
101
98
|
|
102
|
-
|
103
|
-
parent = foobara_parent_namespace
|
104
|
-
parent.foobara_register(self)
|
105
|
-
self.foobara_parent_namespace = parent
|
99
|
+
foobara_parent_namespace.foobara_register(self)
|
106
100
|
end
|
107
101
|
end
|
108
102
|
|
@@ -98,15 +98,26 @@ module Foobara
|
|
98
98
|
domain = root_namespace.foobara_lookup_domain(domain_name)
|
99
99
|
|
100
100
|
type_symbol = type.declaration_data[:name]
|
101
|
-
type.type_symbol = type_symbol.to_sym
|
102
|
-
|
103
|
-
model_class.description type.declaration_data[:description]
|
104
101
|
|
105
102
|
if domain.foobara_type_registered?(type_symbol, mode: Namespace::LookupMode::DIRECT)
|
106
103
|
existing_type = domain.foobara_lookup_type(type_symbol, mode: Namespace::LookupMode::DIRECT)
|
104
|
+
|
105
|
+
if existing_type.created_in_namespace == type.created_in_namespace &&
|
106
|
+
existing_type.type_symbol == type_symbol.to_sym &&
|
107
|
+
existing_type.declaration_data == type.declaration_data
|
108
|
+
# There's nothing different about this new model type. Let's just return the old one
|
109
|
+
# to reduce burdens on clearing caches.
|
110
|
+
existing_type.clear_caches
|
111
|
+
return Outcome.success(existing_type)
|
112
|
+
end
|
113
|
+
|
107
114
|
domain.foobara_unregister(existing_type)
|
108
115
|
end
|
109
116
|
|
117
|
+
type.type_symbol = type_symbol.to_sym
|
118
|
+
|
119
|
+
model_class.description type.declaration_data[:description]
|
120
|
+
|
110
121
|
domain.foobara_register_model(model_class)
|
111
122
|
|
112
123
|
if type.declaration_data[:delegates]
|
@@ -21,15 +21,7 @@ module Foobara
|
|
21
21
|
# :nocov:
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
unless registered
|
27
|
-
# :nocov:
|
28
|
-
raise NotRegisteredError, "Not registered: #{short_name.inspect}"
|
29
|
-
# :nocov:
|
30
|
-
end
|
31
|
-
|
32
|
-
unless entry.delete(registered)
|
24
|
+
unless entry.delete(scoped)
|
33
25
|
# :nocov:
|
34
26
|
raise NotRegisteredError, "Not registered: #{short_name.inspect}"
|
35
27
|
# :nocov:
|
@@ -3,18 +3,6 @@ require_relative "scoped"
|
|
3
3
|
module Foobara
|
4
4
|
class Namespace
|
5
5
|
module IsNamespace
|
6
|
-
class << self
|
7
|
-
def lru_cache
|
8
|
-
@lru_cache ||= Foobara::LruCache.new(200)
|
9
|
-
end
|
10
|
-
|
11
|
-
def clear_lru_cache!
|
12
|
-
if @lru_cache
|
13
|
-
lru_cache.reset!
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
6
|
include Scoped
|
19
7
|
|
20
8
|
def scoped_clear_caches
|
@@ -35,7 +23,16 @@ module Foobara
|
|
35
23
|
|
36
24
|
def foobara_parent_namespace=(namespace)
|
37
25
|
self.scoped_namespace = namespace
|
38
|
-
|
26
|
+
|
27
|
+
if namespace
|
28
|
+
if namespace.foobara_children.include?(self)
|
29
|
+
# :nocov:
|
30
|
+
raise "Already registered on parent"
|
31
|
+
# :nocov:
|
32
|
+
end
|
33
|
+
|
34
|
+
namespace.foobara_children << self
|
35
|
+
end
|
39
36
|
end
|
40
37
|
|
41
38
|
def foobara_add_category(symbol, &block)
|
@@ -102,13 +99,24 @@ module Foobara
|
|
102
99
|
|
103
100
|
# TODO: make this thread-safe
|
104
101
|
def foobara_register(scoped)
|
102
|
+
if scoped.scoped_unregistered?
|
103
|
+
scoped.scoped_reregistering!
|
104
|
+
end
|
105
|
+
|
105
106
|
foobara_registry.register(scoped)
|
106
107
|
|
108
|
+
if scoped.is_a?(Namespace::IsNamespace)
|
109
|
+
scoped.foobara_parent_namespace = self
|
110
|
+
else
|
111
|
+
scoped.scoped_namespace = self
|
112
|
+
end
|
113
|
+
|
107
114
|
# TODO: do we really need to clear the whole cache? Why not just the possible
|
108
115
|
# impacted keys based on scoped.scoped_path ?
|
109
|
-
|
110
|
-
|
111
|
-
|
116
|
+
Namespace.clear_lru_cache!
|
117
|
+
if scoped.unregistered_foobara_manifest_reference
|
118
|
+
scoped.unregistered_foobara_manifest_reference = nil
|
119
|
+
end
|
112
120
|
|
113
121
|
if scoped.respond_to?(:foobara_on_register)
|
114
122
|
scoped.foobara_on_register
|
@@ -124,9 +132,13 @@ module Foobara
|
|
124
132
|
|
125
133
|
foobara_registry.unregister(scoped)
|
126
134
|
foobara_children.delete(scoped)
|
135
|
+
|
136
|
+
scoped.unregistered_foobara_manifest_reference = scoped.foobara_manifest_reference
|
137
|
+
|
127
138
|
scoped.scoped_namespace = nil
|
139
|
+
scoped.scoped_unregistered!
|
128
140
|
|
129
|
-
|
141
|
+
Namespace.clear_lru_cache!
|
130
142
|
end
|
131
143
|
|
132
144
|
def foobara_unregister_all
|
@@ -136,7 +148,7 @@ module Foobara
|
|
136
148
|
end
|
137
149
|
|
138
150
|
def lru_cache
|
139
|
-
|
151
|
+
Namespace.lru_cache
|
140
152
|
end
|
141
153
|
|
142
154
|
def foobara_lookup(path, filter: nil, mode: LookupMode::GENERAL)
|
@@ -49,6 +49,16 @@ module Foobara
|
|
49
49
|
# :nocov:
|
50
50
|
end
|
51
51
|
end
|
52
|
+
|
53
|
+
def lru_cache
|
54
|
+
@lru_cache ||= Foobara::LruCache.new(1000)
|
55
|
+
end
|
56
|
+
|
57
|
+
def clear_lru_cache!
|
58
|
+
if @lru_cache
|
59
|
+
lru_cache.reset!
|
60
|
+
end
|
61
|
+
end
|
52
62
|
end
|
53
63
|
|
54
64
|
class NotFoundError < StandardError; end
|
@@ -47,13 +47,7 @@ module Foobara
|
|
47
47
|
NamespaceHelpers.foobara_autoset_namespace(subclass, default_namespace: scoped_default_namespace)
|
48
48
|
NamespaceHelpers.foobara_autoset_scoped_path(subclass)
|
49
49
|
|
50
|
-
|
51
|
-
if subclass.is_a?(Foobara::Namespace::IsNamespace)
|
52
|
-
subclass.foobara_parent_namespace = subclass.scoped_namespace
|
53
|
-
end
|
54
|
-
|
55
|
-
subclass.scoped_namespace.foobara_register(subclass)
|
56
|
-
end
|
50
|
+
subclass.scoped_namespace&.foobara_register(subclass)
|
57
51
|
end
|
58
52
|
end
|
59
53
|
end
|
@@ -262,11 +256,6 @@ module Foobara
|
|
262
256
|
|
263
257
|
mod.foobara_register(scoped)
|
264
258
|
|
265
|
-
if scoped.is_a?(Namespace::IsNamespace)
|
266
|
-
scoped.foobara_parent_namespace = mod
|
267
|
-
else
|
268
|
-
scoped.scoped_namespace = mod
|
269
|
-
end
|
270
259
|
end
|
271
260
|
end
|
272
261
|
end
|
@@ -3,8 +3,16 @@ module Foobara
|
|
3
3
|
class NoScopedPathSetError < StandardError; end
|
4
4
|
|
5
5
|
attr_reader :scoped_namespace
|
6
|
+
attr_accessor :unregistered_foobara_manifest_reference
|
6
7
|
|
7
8
|
def scoped_path
|
9
|
+
if scoped_unregistered?
|
10
|
+
# TODO: can probably delete this defensive check
|
11
|
+
# :nocov:
|
12
|
+
raise "Cannot use unregistered Scoped object"
|
13
|
+
# :nocov:
|
14
|
+
end
|
15
|
+
|
8
16
|
unless defined?(@scoped_path)
|
9
17
|
# :nocov:
|
10
18
|
raise NoScopedPathSetError, "No scoped path set. Explicitly set it to nil if that's what you want."
|
@@ -22,11 +30,13 @@ module Foobara
|
|
22
30
|
|
23
31
|
def scoped_clear_caches
|
24
32
|
[
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
:@scoped_absolute_name,
|
34
|
+
:@scoped_name,
|
35
|
+
:@scoped_prefix,
|
36
|
+
:@scoped_full_name,
|
37
|
+
:@scoped_full_path,
|
38
|
+
:@scoped_short_name,
|
39
|
+
:@scoped_short_path
|
30
40
|
].each do |variable|
|
31
41
|
remove_instance_variable(variable) if instance_variable_defined?(variable)
|
32
42
|
end
|
@@ -78,6 +88,13 @@ module Foobara
|
|
78
88
|
attr_writer :foobara_manifest_reference
|
79
89
|
|
80
90
|
def foobara_manifest_reference
|
91
|
+
if scoped_unregistered?
|
92
|
+
# TODO: can probably delete this defensive check
|
93
|
+
# :nocov:
|
94
|
+
raise "Cannot use unregistered Scoped object"
|
95
|
+
# :nocov:
|
96
|
+
end
|
97
|
+
|
81
98
|
@foobara_manifest_reference ||= scoped_full_name
|
82
99
|
end
|
83
100
|
|
@@ -109,5 +126,17 @@ module Foobara
|
|
109
126
|
def scoped_category
|
110
127
|
@scoped_category ||= Namespace.global.foobara_category_symbol_for(self)
|
111
128
|
end
|
129
|
+
|
130
|
+
def scoped_unregistered!
|
131
|
+
@scoped_unregistered = true
|
132
|
+
end
|
133
|
+
|
134
|
+
def scoped_unregistered?
|
135
|
+
@scoped_unregistered
|
136
|
+
end
|
137
|
+
|
138
|
+
def scoped_reregistering!
|
139
|
+
@scoped_unregistered = nil
|
140
|
+
end
|
112
141
|
end
|
113
142
|
end
|
@@ -18,7 +18,6 @@ module Foobara
|
|
18
18
|
transformer_class.from_yaml_attributes = attribute_names
|
19
19
|
|
20
20
|
Namespace::NamespaceHelpers.foobara_autoset_scoped_path(transformer_class, set_namespace: true)
|
21
|
-
transformer_class.foobara_parent_namespace = transformer_class.scoped_namespace
|
22
21
|
transformer_class.scoped_namespace.foobara_register(transformer_class)
|
23
22
|
|
24
23
|
transformer_class
|
@@ -19,7 +19,6 @@ module Foobara
|
|
19
19
|
transformer_class.only_attributes = attribute_names
|
20
20
|
|
21
21
|
Namespace::NamespaceHelpers.foobara_autoset_scoped_path(transformer_class, set_namespace: true)
|
22
|
-
transformer_class.foobara_parent_namespace = transformer_class.scoped_namespace
|
23
22
|
transformer_class.scoped_namespace.foobara_register(transformer_class)
|
24
23
|
|
25
24
|
transformer_class
|
@@ -17,7 +17,6 @@ module Foobara
|
|
17
17
|
transformer_class.reject_attributes = attribute_names
|
18
18
|
|
19
19
|
Namespace::NamespaceHelpers.foobara_autoset_scoped_path(transformer_class, set_namespace: true)
|
20
|
-
transformer_class.foobara_parent_namespace = transformer_class.scoped_namespace
|
21
20
|
transformer_class.scoped_namespace.foobara_register(transformer_class)
|
22
21
|
|
23
22
|
transformer_class
|
@@ -16,19 +16,49 @@ module Foobara
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_all_association_types_in_current_namespace(type)
|
19
|
+
already_sanitized = Set.new
|
20
|
+
|
19
21
|
associations = Foobara::DetachedEntity.construct_deep_associations(type)
|
20
22
|
|
21
23
|
associations&.values&.reverse&.each do |entity_type|
|
24
|
+
next if already_sanitized.include?(entity_type)
|
25
|
+
|
22
26
|
next if entity_type.sensitive?
|
23
|
-
|
27
|
+
|
28
|
+
unless entity_type.has_sensitive_types?
|
29
|
+
already_sanitized << entity_type
|
30
|
+
next
|
31
|
+
end
|
32
|
+
|
33
|
+
ns = Namespace.current
|
24
34
|
|
25
35
|
declaration = entity_type.declaration_data
|
26
36
|
sanitized_type_declaration = TypeDeclarations.remove_sensitive_types(declaration)
|
27
37
|
|
38
|
+
existing_type = ns.foobara_lookup(
|
39
|
+
entity_type.full_type_symbol,
|
40
|
+
mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
41
|
+
)
|
42
|
+
|
43
|
+
if existing_type
|
44
|
+
if existing_type.declaration_data == sanitized_type_declaration
|
45
|
+
already_sanitized << entity_type
|
46
|
+
already_sanitized << existing_type
|
47
|
+
next
|
48
|
+
else
|
49
|
+
# :nocov:
|
50
|
+
raise "Did not expect to be re-sanitizing #{entity_type.full_type_symbol}"
|
51
|
+
# :nocov:
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
28
56
|
# We want to make sure that any types that change due to having sensitive types
|
29
57
|
# has a corresponding registered type in the command registry domain if needed
|
30
58
|
# TODO: this all feels so messy and brittle.
|
31
59
|
Domain.current.foobara_type_from_declaration(sanitized_type_declaration)
|
60
|
+
|
61
|
+
already_sanitized << entity_type
|
32
62
|
end
|
33
63
|
end
|
34
64
|
|
data/projects/types/src/type.rb
CHANGED
@@ -481,7 +481,11 @@ module Foobara
|
|
481
481
|
|
482
482
|
if registered?
|
483
483
|
# TODO: we should just use the symbol and nothing else in this context instead of a hash with 1 element.
|
484
|
-
|
484
|
+
if scoped_unregistered?
|
485
|
+
unregistered_foobara_manifest_reference.to_sym
|
486
|
+
else
|
487
|
+
foobara_manifest_reference.to_sym
|
488
|
+
end
|
485
489
|
elsif remove_sensitive
|
486
490
|
TypeDeclarations.remove_sensitive_types(declaration_data)
|
487
491
|
else
|
data/version.rb
CHANGED