foobara 0.0.78 → 0.0.80
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 +11 -0
- data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/desugarizers/alphabetize_required.rb +38 -0
- data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +63 -35
- data/projects/command/src/transformed_command.rb +12 -11
- data/projects/command_connectors/src/command_connector.rb +9 -2
- data/projects/command_connectors/src/command_registry/exposed_command.rb +3 -3
- data/projects/command_connectors/src/command_registry/exposed_domain.rb +2 -2
- data/projects/command_connectors/src/command_registry/exposed_organization.rb +2 -2
- data/projects/common/src/error.rb +2 -2
- data/projects/common/src/possible_error.rb +1 -1
- data/projects/detached_entity/lib/foobara/detached_entity.rb +4 -1
- data/projects/detached_entity/src/concerns/associations.rb +60 -20
- data/projects/detached_entity/src/concerns/reflection.rb +3 -3
- data/projects/detached_entity/src/concerns/types.rb +7 -1
- data/projects/detached_entity/src/detached_entity_type.rb +2 -2
- data/projects/detached_entity/src/sensitive_type_removers/detached_entity.rb +8 -0
- data/projects/domain/src/domain_module_extension.rb +5 -1
- data/projects/domain/src/is_manifestable.rb +1 -1
- data/projects/domain/src/organization_module_extension.rb +1 -1
- data/projects/entity/lib/foobara/entity.rb +4 -1
- data/projects/entity/src/sensitive_type_removers/entity.rb +8 -0
- data/projects/model/lib/foobara/model.rb +9 -2
- data/projects/model/src/concerns/reflection.rb +8 -2
- data/projects/model/src/sensitive_type_removers/extended_model.rb +10 -0
- data/projects/model/src/sensitive_type_removers/model.rb +19 -0
- data/projects/type_declarations/lib/foobara/type_declarations.rb +10 -2
- data/projects/type_declarations/src/attributes.rb +1 -0
- data/projects/type_declarations/src/desugarizer.rb +1 -1
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +9 -1
- data/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +7 -3
- data/projects/type_declarations/src/sensitive_type_remover.rb +17 -0
- data/projects/type_declarations/src/sensitive_type_removers/array.rb +21 -0
- data/projects/type_declarations/src/sensitive_type_removers/attributes.rb +43 -0
- 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 +21 -0
- data/projects/types/src/extensions/error.rb +3 -3
- data/projects/types/src/type/concerns/reflection.rb +29 -8
- data/projects/types/src/type.rb +40 -9
- data/projects/value/src/caster.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 +3 -3
- data/projects/value/src/transformer.rb +1 -1
- data/projects/value/src/validator.rb +1 -1
- metadata +11 -3
@@ -36,7 +36,7 @@ module Foobara
|
|
36
36
|
foobara_all_domain(mode: Namespace::LookupMode::DIRECT)
|
37
37
|
end
|
38
38
|
|
39
|
-
def foobara_manifest(to_include: Set.new)
|
39
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
40
40
|
domains = foobara_domains.map do |domain|
|
41
41
|
to_include << domain
|
42
42
|
domain.foobara_manifest_reference
|
@@ -7,7 +7,10 @@ module Foobara
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def install!
|
10
|
-
TypeDeclarations
|
10
|
+
handler = TypeDeclarations::Handlers::ExtendEntityTypeDeclaration.new
|
11
|
+
TypeDeclarations.register_type_declaration(handler)
|
12
|
+
|
13
|
+
TypeDeclarations.register_sensitive_type_remover(SensitiveTypeRemovers::Entity.new(handler))
|
11
14
|
|
12
15
|
detached_entity = Namespace.global.foobara_lookup_type!(:detached_entity)
|
13
16
|
BuiltinTypes.build_and_register!(:entity, detached_entity, nil)
|
@@ -6,8 +6,15 @@ module Foobara
|
|
6
6
|
class Model
|
7
7
|
class << self
|
8
8
|
def install!
|
9
|
-
TypeDeclarations
|
10
|
-
TypeDeclarations.register_type_declaration(
|
9
|
+
model_handler = TypeDeclarations::Handlers::ExtendModelTypeDeclaration.new
|
10
|
+
TypeDeclarations.register_type_declaration(model_handler)
|
11
|
+
extended_model_handler = TypeDeclarations::Handlers::ExtendRegisteredModelTypeDeclaration.new
|
12
|
+
TypeDeclarations.register_type_declaration(extended_model_handler)
|
13
|
+
|
14
|
+
TypeDeclarations.register_sensitive_type_remover(SensitiveTypeRemovers::Model.new(model_handler))
|
15
|
+
TypeDeclarations.register_sensitive_type_remover(
|
16
|
+
SensitiveTypeRemovers::ExtendedModel.new(extended_model_handler)
|
17
|
+
)
|
11
18
|
|
12
19
|
atomic_duck = Namespace.global.foobara_lookup_type!(:atomic_duck)
|
13
20
|
BuiltinTypes.build_and_register!(:model, atomic_duck, nil)
|
@@ -5,9 +5,15 @@ module Foobara
|
|
5
5
|
include Concern
|
6
6
|
|
7
7
|
module ClassMethods
|
8
|
-
def foobara_manifest(to_include: Set.new)
|
8
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
9
|
+
attributes_declaration = foobara_attributes_type.declaration_data
|
10
|
+
|
11
|
+
if remove_sensitive
|
12
|
+
attributes_declaration = TypeDeclarations.remove_sensitive_types(attributes_declaration)
|
13
|
+
end
|
14
|
+
|
9
15
|
Util.remove_blank(
|
10
|
-
attributes_type:
|
16
|
+
attributes_type: attributes_declaration,
|
11
17
|
organization_name: foobara_type.foobara_domain.foobara_organization_name,
|
12
18
|
domain_name: foobara_type.foobara_domain.foobara_domain_name,
|
13
19
|
model_name: foobara_model_name,
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Foobara
|
2
|
+
class Model
|
3
|
+
module SensitiveTypeRemovers
|
4
|
+
class Model < TypeDeclarations::SensitiveTypeRemover
|
5
|
+
def transform(strict_type_declaration)
|
6
|
+
old_attributes_declaration = strict_type_declaration[:attributes_declaration]
|
7
|
+
|
8
|
+
new_attributes_declaration = remove_sensitive_types(old_attributes_declaration)
|
9
|
+
|
10
|
+
if new_attributes_declaration == old_attributes_declaration
|
11
|
+
strict_type_declaration
|
12
|
+
else
|
13
|
+
strict_type_declaration.merge(attributes_declaration: new_attributes_declaration)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -44,6 +44,7 @@ module Foobara
|
|
44
44
|
:@foobara_lowercase_constants,
|
45
45
|
@original_foobara_lowercase_constants || []
|
46
46
|
)
|
47
|
+
GlobalDomain.send(:remove_const, :Types)
|
47
48
|
end
|
48
49
|
|
49
50
|
@original_scoped.each do |scoped|
|
@@ -59,10 +60,17 @@ module Foobara
|
|
59
60
|
|
60
61
|
register_type_declaration(Handlers::RegisteredTypeDeclaration.new)
|
61
62
|
register_type_declaration(Handlers::ExtendRegisteredTypeDeclaration.new)
|
62
|
-
|
63
|
+
array_handler = Handlers::ExtendArrayTypeDeclaration.new
|
64
|
+
register_type_declaration(array_handler)
|
63
65
|
register_type_declaration(Handlers::ExtendAssociativeArrayTypeDeclaration.new)
|
64
|
-
|
66
|
+
attributes_handler = Handlers::ExtendAttributesTypeDeclaration.new
|
67
|
+
register_type_declaration(attributes_handler)
|
65
68
|
register_type_declaration(Handlers::ExtendTupleTypeDeclaration.new)
|
69
|
+
|
70
|
+
@sensitive_type_removers = nil
|
71
|
+
|
72
|
+
register_sensitive_type_remover(SensitiveTypeRemovers::Attributes.new(attributes_handler))
|
73
|
+
register_sensitive_type_remover(SensitiveTypeRemovers::Array.new(array_handler))
|
66
74
|
end
|
67
75
|
|
68
76
|
def install!
|
@@ -8,7 +8,7 @@ module Foobara
|
|
8
8
|
class TypeSetToArrayDesugarizer < ArrayDesugarizer
|
9
9
|
def applicable?(sugary_type_declaration)
|
10
10
|
if sugary_type_declaration.is_a?(::Hash) && sugary_type_declaration.key?(:type)
|
11
|
-
extra_keys = sugary_type_declaration.keys - %i[type description]
|
11
|
+
extra_keys = sugary_type_declaration.keys - %i[type description sensitive sensitive_exposed]
|
12
12
|
|
13
13
|
return false if extra_keys.any?
|
14
14
|
|
@@ -27,6 +27,14 @@ module Foobara
|
|
27
27
|
strict_type_declaration[:description] = sugary_type_declaration[:description]
|
28
28
|
end
|
29
29
|
|
30
|
+
if sugary_type_declaration.key?(:sensitive)
|
31
|
+
strict_type_declaration[:sensitive] = sugary_type_declaration[:sensitive]
|
32
|
+
end
|
33
|
+
|
34
|
+
if sugary_type_declaration.key?(:sensitive_exposed)
|
35
|
+
strict_type_declaration[:sensitive_exposed] = sugary_type_declaration[:sensitive_exposed]
|
36
|
+
end
|
37
|
+
|
30
38
|
strict_type_declaration
|
31
39
|
end
|
32
40
|
end
|
@@ -45,10 +45,12 @@ module Foobara
|
|
45
45
|
category << processor
|
46
46
|
end
|
47
47
|
|
48
|
+
sensitive = strict_type_declaration[:sensitive]
|
49
|
+
sensitive_exposed = strict_type_declaration[:sensitive_exposed]
|
50
|
+
|
48
51
|
type_class.new(
|
49
52
|
strict_type_declaration,
|
50
53
|
base_type:,
|
51
|
-
# description: strict_type_declaration.is_a?(::Hash) && strict_type_declaration[:description],
|
52
54
|
description: strict_type_declaration[:description],
|
53
55
|
casters:,
|
54
56
|
transformers:,
|
@@ -56,7 +58,9 @@ module Foobara
|
|
56
58
|
element_processors:,
|
57
59
|
# TODO: can't we just set this to [] here??
|
58
60
|
target_classes: target_classes(strict_type_declaration),
|
59
|
-
name: type_name(strict_type_declaration)
|
61
|
+
name: type_name(strict_type_declaration),
|
62
|
+
sensitive:,
|
63
|
+
sensitive_exposed:
|
60
64
|
)
|
61
65
|
end
|
62
66
|
|
@@ -70,7 +74,7 @@ module Foobara
|
|
70
74
|
end
|
71
75
|
|
72
76
|
def non_processor_keys
|
73
|
-
%i[type _desugarized description]
|
77
|
+
%i[type _desugarized description sensitive sensitive_exposed]
|
74
78
|
end
|
75
79
|
end
|
76
80
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Foobara
|
2
|
+
module TypeDeclarations
|
3
|
+
class SensitiveTypeRemover < Value::Transformer
|
4
|
+
def applicable?(strict_type_declaration)
|
5
|
+
handler.applicable?(strict_type_declaration)
|
6
|
+
end
|
7
|
+
|
8
|
+
def handler
|
9
|
+
declaration_data
|
10
|
+
end
|
11
|
+
|
12
|
+
def remove_sensitive_types(strict_type_declaration)
|
13
|
+
TypeDeclarations.remove_sensitive_types(strict_type_declaration)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative "../sensitive_type_remover"
|
2
|
+
|
3
|
+
module Foobara
|
4
|
+
module TypeDeclarations
|
5
|
+
module SensitiveTypeRemovers
|
6
|
+
class Array < SensitiveTypeRemover
|
7
|
+
def transform(strict_type_declaration)
|
8
|
+
old_element_declaration = strict_type_declaration[:element_type_declaration]
|
9
|
+
|
10
|
+
new_element_declaration = remove_sensitive_types(old_element_declaration)
|
11
|
+
|
12
|
+
if new_element_declaration == old_element_declaration
|
13
|
+
strict_type_declaration
|
14
|
+
else
|
15
|
+
strict_type_declaration.merge(element_type_declaration: new_element_declaration)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative "../sensitive_type_remover"
|
2
|
+
|
3
|
+
module Foobara
|
4
|
+
module TypeDeclarations
|
5
|
+
module SensitiveTypeRemovers
|
6
|
+
class Attributes < SensitiveTypeRemover
|
7
|
+
def transform(strict_type_declaration)
|
8
|
+
to_change = {}
|
9
|
+
to_remove = []
|
10
|
+
|
11
|
+
strict_type_declaration[:element_type_declarations].each_pair do |attribute_name, attribute_declaration|
|
12
|
+
if attribute_declaration[:sensitive]
|
13
|
+
to_remove << attribute_name
|
14
|
+
else
|
15
|
+
new_declaration = remove_sensitive_types(attribute_declaration)
|
16
|
+
|
17
|
+
if new_declaration != attribute_declaration
|
18
|
+
to_change[attribute_name] = new_declaration
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
if to_change.empty? && to_remove.empty?
|
24
|
+
strict_type_declaration
|
25
|
+
else
|
26
|
+
new_declaration = if to_remove.empty?
|
27
|
+
strict_type_declaration
|
28
|
+
else
|
29
|
+
TypeDeclarations::Attributes.reject(strict_type_declaration, *to_remove)
|
30
|
+
end
|
31
|
+
|
32
|
+
unless to_change.empty?
|
33
|
+
new_elements = new_declaration[:element_type_declarations].merge(to_change)
|
34
|
+
new_declaration = new_declaration.merge(element_type_declarations: new_elements)
|
35
|
+
end
|
36
|
+
|
37
|
+
new_declaration
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -4,7 +4,7 @@ module Foobara
|
|
4
4
|
module TypeDeclarations
|
5
5
|
class TypeDeclarationHandler < Value::Processor::Pipeline
|
6
6
|
class << self
|
7
|
-
def foobara_manifest(to_include: Set.new)
|
7
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
8
8
|
# :nocov:
|
9
9
|
super.merge(processor_type: :type_declaration_handler)
|
10
10
|
# :nocov:
|
@@ -2,7 +2,7 @@ module Foobara
|
|
2
2
|
module TypeDeclarations
|
3
3
|
class TypeDeclarationHandlerRegistry < Value::Processor::Selection
|
4
4
|
class << self
|
5
|
-
def foobara_manifest(to_include: Set.new)
|
5
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
6
6
|
# :nocov:
|
7
7
|
super.merge(processor_type: :type_declaration_handler_registry)
|
8
8
|
# :nocov:
|
@@ -17,6 +17,27 @@ module Foobara
|
|
17
17
|
global_type_declaration_handler_registry.register(type_declaration_handler)
|
18
18
|
end
|
19
19
|
|
20
|
+
def register_sensitive_type_remover(sensitive_type_remover)
|
21
|
+
handler = sensitive_type_remover.handler
|
22
|
+
sensitive_type_removers[handler.class.name] = sensitive_type_remover
|
23
|
+
end
|
24
|
+
|
25
|
+
def sensitive_type_removers
|
26
|
+
@sensitive_type_removers ||= {}
|
27
|
+
end
|
28
|
+
|
29
|
+
def remove_sensitive_types(strict_type_declaration)
|
30
|
+
handler = GlobalDomain.foobara_type_builder.type_declaration_handler_for(strict_type_declaration)
|
31
|
+
|
32
|
+
sensitive_type_remover = sensitive_type_removers[handler.class.name]
|
33
|
+
|
34
|
+
if sensitive_type_remover
|
35
|
+
sensitive_type_remover.process_value!(strict_type_declaration)
|
36
|
+
else
|
37
|
+
strict_type_declaration
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
20
41
|
def strict(&)
|
21
42
|
using_mode(Mode::STRICT, &)
|
22
43
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Foobara
|
2
2
|
class Error
|
3
3
|
class << self
|
4
|
-
def types_depended_on(*args)
|
4
|
+
def types_depended_on(*args, remove_sensitive: false)
|
5
5
|
if args.size == 1
|
6
|
-
context_type.types_depended_on(args.first)
|
6
|
+
context_type.types_depended_on(args.first, remove_sensitive:)
|
7
7
|
elsif args.empty?
|
8
8
|
begin
|
9
9
|
if context_type
|
10
|
-
context_type.types_depended_on
|
10
|
+
context_type.types_depended_on(remove_sensitive:)
|
11
11
|
else
|
12
12
|
raise Foobara::TypeDeclarations::ErrorExtension::NoContextTypeSetError
|
13
13
|
end
|
@@ -6,7 +6,7 @@ module Foobara
|
|
6
6
|
include Concern
|
7
7
|
|
8
8
|
# as soon as we hit a registered type, don't go further down that path
|
9
|
-
def types_depended_on(result = nil)
|
9
|
+
def types_depended_on(result = nil, remove_sensitive: false)
|
10
10
|
start = result.nil?
|
11
11
|
result ||= Set.new
|
12
12
|
return if result.include?(self)
|
@@ -15,16 +15,31 @@ module Foobara
|
|
15
15
|
|
16
16
|
return if !start && registered?
|
17
17
|
|
18
|
-
to_process = types_to_add_to_manifest
|
18
|
+
to_process = types_to_add_to_manifest(remove_sensitive:)
|
19
19
|
|
20
20
|
if element_types
|
21
21
|
to_process += case element_types
|
22
22
|
when Type
|
23
|
-
|
23
|
+
if remove_sensitive && element_types.sensitive?
|
24
|
+
# TODO: test this code path
|
25
|
+
# :nocov:
|
26
|
+
[]
|
27
|
+
# :nocov:
|
28
|
+
else
|
29
|
+
[element_types]
|
30
|
+
end
|
24
31
|
when ::Hash
|
25
|
-
element_types.values.select
|
32
|
+
element_types.values.select do |value|
|
33
|
+
if !remove_sensitive || !value.sensitive?
|
34
|
+
value.is_a?(Type)
|
35
|
+
end
|
36
|
+
end
|
26
37
|
when ::Array
|
27
|
-
|
38
|
+
if remove_sensitive
|
39
|
+
element_types.reject(&:sensitive?)
|
40
|
+
else
|
41
|
+
element_types
|
42
|
+
end
|
28
43
|
else
|
29
44
|
# :nocov:
|
30
45
|
raise "Not sure how to find dependent types for #{element_types}"
|
@@ -33,7 +48,7 @@ module Foobara
|
|
33
48
|
end
|
34
49
|
|
35
50
|
to_process.each do |type|
|
36
|
-
type.types_depended_on(result)
|
51
|
+
type.types_depended_on(result, remove_sensitive:)
|
37
52
|
end
|
38
53
|
|
39
54
|
if start
|
@@ -43,8 +58,14 @@ module Foobara
|
|
43
58
|
result
|
44
59
|
end
|
45
60
|
|
46
|
-
def types_to_add_to_manifest
|
47
|
-
[*base_type, *
|
61
|
+
def types_to_add_to_manifest(remove_sensitive: false)
|
62
|
+
types = [*base_type, *possible_errors.map(&:error_class)]
|
63
|
+
|
64
|
+
if element_type && (!remove_sensitive || !element_type.sensitive?)
|
65
|
+
types << element_type
|
66
|
+
end
|
67
|
+
|
68
|
+
types
|
48
69
|
end
|
49
70
|
|
50
71
|
def deep_types_depended_on
|
data/projects/types/src/type.rb
CHANGED
@@ -27,7 +27,10 @@ module Foobara
|
|
27
27
|
:name,
|
28
28
|
:target_classes,
|
29
29
|
:description,
|
30
|
+
:sensitive,
|
31
|
+
:sensitive_exposed,
|
30
32
|
:processor_classes_requiring_type
|
33
|
+
|
31
34
|
attr_reader :type_symbol
|
32
35
|
|
33
36
|
def initialize(
|
@@ -44,8 +47,12 @@ module Foobara
|
|
44
47
|
element_types: nil,
|
45
48
|
structure_count: nil,
|
46
49
|
processor_classes_requiring_type: nil,
|
50
|
+
sensitive: nil,
|
51
|
+
sensitive_exposed: nil,
|
47
52
|
**opts
|
48
53
|
)
|
54
|
+
self.sensitive = sensitive
|
55
|
+
self.sensitive_exposed = sensitive_exposed
|
49
56
|
self.base_type = base_type
|
50
57
|
self.description = description
|
51
58
|
self.casters = [*casters, *base_type&.casters]
|
@@ -68,6 +75,14 @@ module Foobara
|
|
68
75
|
validate_processors!
|
69
76
|
end
|
70
77
|
|
78
|
+
def sensitive?
|
79
|
+
sensitive
|
80
|
+
end
|
81
|
+
|
82
|
+
def sensitive_exposed?
|
83
|
+
sensitive_exposed
|
84
|
+
end
|
85
|
+
|
71
86
|
def apply_all_processors_needing_type!
|
72
87
|
each_processor_class_requiring_type do |processor_class|
|
73
88
|
# TODO: is this a smell?
|
@@ -294,10 +309,12 @@ module Foobara
|
|
294
309
|
scoped_full_name
|
295
310
|
end
|
296
311
|
|
297
|
-
def reference_or_declaration_data(declaration_data = self.declaration_data)
|
312
|
+
def reference_or_declaration_data(declaration_data = self.declaration_data, remove_sensitive: false)
|
298
313
|
if registered?
|
299
314
|
# TODO: we should just use the symbol and nothing else in this context instead of a hash with 1 element.
|
300
315
|
{ type: foobara_manifest_reference.to_sym }
|
316
|
+
elsif remove_sensitive
|
317
|
+
TypeDeclarations.remove_sensitive_types(declaration_data)
|
301
318
|
else
|
302
319
|
declaration_data
|
303
320
|
end
|
@@ -308,10 +325,10 @@ module Foobara
|
|
308
325
|
scoped_full_name
|
309
326
|
end
|
310
327
|
|
311
|
-
def foobara_manifest(to_include: Set.new)
|
328
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
312
329
|
types = []
|
313
330
|
|
314
|
-
types_depended_on.each do |dependent_type|
|
331
|
+
types_depended_on(remove_sensitive:).each do |dependent_type|
|
315
332
|
if dependent_type.registered?
|
316
333
|
types << dependent_type.foobara_manifest_reference
|
317
334
|
to_include << dependent_type
|
@@ -319,9 +336,15 @@ module Foobara
|
|
319
336
|
end
|
320
337
|
|
321
338
|
possible_errors_manifests = possible_errors.map do |possible_error|
|
322
|
-
[possible_error.key.to_s, possible_error.foobara_manifest(to_include:)]
|
339
|
+
[possible_error.key.to_s, possible_error.foobara_manifest(to_include:, remove_sensitive:)]
|
323
340
|
end.sort.to_h
|
324
341
|
|
342
|
+
declaration_data = self.declaration_data
|
343
|
+
|
344
|
+
if remove_sensitive
|
345
|
+
declaration_data = TypeDeclarations.remove_sensitive_types(declaration_data)
|
346
|
+
end
|
347
|
+
|
325
348
|
h = Util.remove_blank(
|
326
349
|
name:,
|
327
350
|
target_classes: target_classes.map(&:name).sort,
|
@@ -331,15 +354,23 @@ module Foobara
|
|
331
354
|
builtin: builtin?
|
332
355
|
).merge(description:, base_type: base_type_for_manifest&.full_type_name&.to_sym)
|
333
356
|
|
357
|
+
if sensitive?
|
358
|
+
h[:sensitive] = true
|
359
|
+
end
|
360
|
+
|
361
|
+
if sensitive_exposed?
|
362
|
+
h[:sensitive_exposed] = true
|
363
|
+
end
|
364
|
+
|
334
365
|
h.merge!(
|
335
|
-
supported_processor_manifest(to_include).merge(
|
336
|
-
Util.remove_blank(processors: processor_manifest(to_include))
|
366
|
+
supported_processor_manifest(to_include, remove_sensitive:).merge(
|
367
|
+
Util.remove_blank(processors: processor_manifest(to_include, remove_sensitive:))
|
337
368
|
)
|
338
369
|
)
|
339
370
|
|
340
371
|
target_classes.sort_by(&:name).each do |target_class|
|
341
372
|
if target_class.respond_to?(:foobara_manifest)
|
342
|
-
h.merge!(target_class.foobara_manifest(to_include:))
|
373
|
+
h.merge!(target_class.foobara_manifest(to_include:, remove_sensitive:))
|
343
374
|
end
|
344
375
|
end
|
345
376
|
|
@@ -354,7 +385,7 @@ module Foobara
|
|
354
385
|
base_type
|
355
386
|
end
|
356
387
|
|
357
|
-
def supported_processor_manifest(to_include)
|
388
|
+
def supported_processor_manifest(to_include, remove_sensitive: false)
|
358
389
|
supported_casters = []
|
359
390
|
supported_transformers = []
|
360
391
|
supported_validators = []
|
@@ -384,7 +415,7 @@ module Foobara
|
|
384
415
|
)
|
385
416
|
end
|
386
417
|
|
387
|
-
def processor_manifest(to_include)
|
418
|
+
def processor_manifest(to_include, remove_sensitive: false)
|
388
419
|
casters_manifest = []
|
389
420
|
transformers_manifest = []
|
390
421
|
validators_manifest = []
|
@@ -3,7 +3,7 @@ module Foobara
|
|
3
3
|
# TODO: do we really need these?? Can't just use a transformer?
|
4
4
|
class Caster < Transformer
|
5
5
|
class << self
|
6
|
-
def foobara_manifest(to_include: Set.new)
|
6
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
7
7
|
super.merge(processor_type: :caster)
|
8
8
|
end
|
9
9
|
|
@@ -9,7 +9,7 @@ module Foobara
|
|
9
9
|
class MoreThanOneApplicableProcessorError < DataError; end
|
10
10
|
|
11
11
|
class << self
|
12
|
-
def foobara_manifest(to_include: Set.new)
|
12
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
13
13
|
# :nocov:
|
14
14
|
super.merge(processor_type: :selection)
|
15
15
|
# :nocov:
|
@@ -25,7 +25,7 @@ module Foobara
|
|
25
25
|
true
|
26
26
|
end
|
27
27
|
|
28
|
-
def foobara_manifest(to_include: Set.new)
|
28
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
29
29
|
errors = error_classes.map do |error_class|
|
30
30
|
to_include << error_class
|
31
31
|
error_class.foobara_manifest_reference
|
@@ -317,9 +317,9 @@ module Foobara
|
|
317
317
|
|
318
318
|
# TODO: is this in the wrong place? Should this be an extension?
|
319
319
|
|
320
|
-
def foobara_manifest(to_include: Set.new)
|
320
|
+
def foobara_manifest(to_include: Set.new, remove_sensitive: false)
|
321
321
|
possible_errors = self.possible_errors.map do |possible_error|
|
322
|
-
[possible_error.key.to_s, possible_error.foobara_manifest(to_include:)]
|
322
|
+
[possible_error.key.to_s, possible_error.foobara_manifest(to_include:, remove_sensitive:)]
|
323
323
|
end
|
324
324
|
|
325
325
|
manifest = super.dup
|