foobara 0.0.141 → 0.1.1
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/.ruby-version +1 -1
- data/CHANGELOG.md +23 -0
- data/projects/builtin_types/lib/foobara/builtin_types.rb +1 -0
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/desugarizers/move_defaults_from_element_types_to_root.rb +9 -2
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/desugarizers/symbolize_defaults.rb +1 -1
- data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/hash_with_symbolic_keys.rb +1 -1
- data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/desugarizers/alphabetize_required.rb +5 -5
- data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/desugarizers/move_required_from_element_types_to_root.rb +12 -2
- data/projects/builtin_types/src/builtin_types.rb +1 -1
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/class_desugarizer.rb +10 -2
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/class_type_desugarizer.rb +7 -2
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/instance_of_class_desugarizer.rb +3 -4
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/instance_of_symbol_desugarizer.rb +3 -4
- data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/type_declaration_validators/is_valid_class.rb +1 -1
- data/projects/builtin_types/src/duck/supported_validators/instance_of.rb +1 -0
- data/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/cast_one_of.rb +4 -3
- data/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/module_desugarizer.rb +3 -3
- data/projects/builtin_types/src/tuple/supported_processors/element_type_declarations/type_declaration_extension/extend_tuple_type_declaration/desugarizers/set_size.rb +1 -1
- data/projects/builtin_types/src/tuple/supported_processors/element_type_declarations/type_declaration_extension/extend_tuple_type_declaration/type_declaration_validators/size_matches.rb +2 -4
- data/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb +12 -12
- data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +4 -2
- data/projects/command/src/command_pattern_implementation/concerns/result_type.rb +0 -4
- data/projects/command_connectors/src/command_connector.rb +6 -6
- data/projects/command_connectors/src/command_registry.rb +7 -4
- data/projects/command_connectors/src/transformed_command.rb +22 -8
- data/projects/command_connectors/src/transformers/auth_errors_transformer.rb +1 -0
- data/projects/command_connectors/src/transformers/entity_to_primary_key_inputs_transformer.rb +4 -0
- data/projects/common/src/error_collection.rb +1 -1
- data/projects/detached_entity/src/concerns/types.rb +7 -1
- data/projects/detached_entity/src/extensions/builtin_types/detached_entity/validators/model_instance_is_valid.rb +1 -1
- data/projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/hash_desugarizer.rb +6 -9
- data/projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/primary_key_desugarizer.rb +2 -1
- data/projects/domain/src/domain_module_extension.rb +12 -4
- data/projects/entity/src/concerns/types.rb +6 -1
- data/projects/foobara/lib/foobara/all.rb +4 -4
- data/projects/manifest/src/foobara/manifest/type.rb +11 -2
- data/projects/manifest/src/foobara/manifest/type_declaration.rb +46 -2
- data/projects/model/src/concerns/aliases.rb +8 -0
- data/projects/model/src/concerns/reflection.rb +2 -2
- data/projects/model/src/concerns/types.rb +35 -20
- data/projects/model/src/extensions/builtin_types/model/validators/model_instance_is_valid.rb +12 -8
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb +1 -1
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +15 -1
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_desugarizer.rb +7 -5
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb +4 -7
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/model_class_desugarizer.rb +0 -2
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/move_private_from_element_types_to_root.rb +28 -9
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/symbolize_private.rb +8 -7
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +4 -7
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb +14 -2
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/hash_desugarizer.rb +8 -9
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/model_class_type_desugarizer.rb +6 -2
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/mutable_validator.rb +5 -2
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/normalize_mutable_attributes_desugarizer.rb +8 -7
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/to_type_transformer.rb +4 -1
- data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration.rb +20 -5
- data/projects/model/src/extensions/type_declarations/handlers/registered_type_declaration/model_class_desugarizer.rb +23 -5
- data/projects/model/src/extensions/type_declarations/lazy_element_types/model.rb +18 -0
- data/projects/model_attribute_helpers/src/attribute_helpers.rb +44 -26
- data/projects/namespace/src/is_namespace.rb +93 -49
- data/projects/namespace/src/namespace/lookup_mode.rb +13 -2
- data/projects/namespace/src/namespace_helpers.rb +1 -0
- data/projects/namespace/src/prefixless_registry.rb +2 -0
- data/projects/persistence/src/entity_base/transaction/concerns/state_transitions.rb +20 -1
- data/projects/persistence/src/entity_base/transaction.rb +14 -11
- data/projects/persistence/src/entity_base/transaction_table.rb +10 -49
- data/projects/persistence/src/entity_base.rb +39 -0
- data/projects/persistence/src/persistence.rb +4 -0
- data/projects/type_declarations/src/attributes.rb +15 -9
- data/projects/type_declarations/src/attributes_transformers/from_yaml.rb +1 -1
- data/projects/type_declarations/src/desugarizer_pipeline.rb +9 -0
- data/projects/type_declarations/src/dsl/attributes.rb +14 -5
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/array_desugarizer.rb +24 -4
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/element_type_declaration_desugarizer.rb +23 -9
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/to_type_transformer.rb +3 -7
- data/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +15 -4
- data/projects/type_declarations/src/handlers/extend_array_type_declaration.rb +12 -2
- data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/key_type_declaration_desugarizer.rb +48 -0
- data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/to_type_transformer.rb +3 -11
- data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/value_type_declaration_desugarizer.rb +51 -0
- data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration.rb +12 -2
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/dsl_desugarizer.rb +1 -1
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb +17 -7
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/hash_desugarizer.rb +16 -19
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/to_type_transformer.rb +3 -6
- data/projects/type_declarations/src/handlers/extend_attributes_type_declaration.rb +13 -2
- data/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +3 -3
- data/projects/type_declarations/src/handlers/extend_registered_type_declaration.rb +16 -4
- data/projects/type_declarations/src/handlers/extend_tuple_type_declaration/array_desugarizer.rb +20 -6
- data/projects/type_declarations/src/handlers/extend_tuple_type_declaration/to_type_transformer.rb +3 -9
- data/projects/type_declarations/src/handlers/extend_tuple_type_declaration.rb +12 -2
- data/projects/type_declarations/src/handlers/registered_type_declaration/to_type_transformer.rb +7 -9
- data/projects/type_declarations/src/handlers/registered_type_declaration.rb +22 -7
- data/projects/type_declarations/src/lazy_element_types/array.rb +19 -0
- data/projects/type_declarations/src/lazy_element_types/attributes.rb +27 -0
- data/projects/type_declarations/src/lazy_element_types/hash.rb +38 -0
- data/projects/type_declarations/src/lazy_element_types/tuple.rb +23 -0
- data/projects/type_declarations/src/sensitive_type_remover.rb +6 -1
- data/projects/type_declarations/src/sensitive_type_removers/attributes.rb +2 -0
- data/projects/type_declarations/src/type_builder.rb +46 -21
- data/projects/type_declarations/src/type_declaration.rb +295 -0
- data/projects/type_declarations/src/type_declaration_handler.rb +10 -11
- data/projects/type_declarations/src/type_declarations.rb +12 -5
- data/projects/types/src/type.rb +26 -4
- data/projects/value/src/mutator.rb +1 -4
- data/projects/value/src/processor/casting.rb +7 -2
- data/projects/value/src/processor/pipeline.rb +9 -1
- data/projects/value/src/processor.rb +0 -2
- data/projects/value/src/transformer.rb +1 -3
- data/projects/value/src/validator.rb +0 -2
- data/projects/weak_object_set/src/weak_object_set.rb +2 -0
- metadata +24 -21
- data/projects/type_declarations/src/handlers/registered_type_declaration/desugarizer_metadata_cleanup_desugarizer.rb +0 -29
- data/projects/type_declarations/src/handlers/registered_type_declaration/short_type_name_desugarizer.rb +0 -63
- data/projects/type_declarations/src/handlers/registered_type_declaration/strict_desugarizer.rb +0 -32
- data/projects/type_declarations/src/handlers/registered_type_declaration/strict_stringified_desugarizer.rb +0 -39
- data/projects/type_declarations/src/handlers/registered_type_declaration/symbol_desugarizer.rb +0 -30
- data/projects/type_declarations/src/handlers/registered_type_declaration/type_desugarizer.rb +0 -24
@@ -1,29 +0,0 @@
|
|
1
|
-
Foobara.require_project_file("type_declarations", "desugarizer")
|
2
|
-
|
3
|
-
module Foobara
|
4
|
-
module TypeDeclarations
|
5
|
-
module Handlers
|
6
|
-
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
7
|
-
# type_symbol is basically just a flag that lets us know that type is fully qualified.
|
8
|
-
# rather hacky but other potential workarounds seemed gnarlier
|
9
|
-
class DesugarizerMetadataCleanupDesugarizer < TypeDeclarations::Desugarizer
|
10
|
-
def applicable?(strict_type_declaration)
|
11
|
-
strict_type_declaration.is_a?(::Hash)
|
12
|
-
end
|
13
|
-
|
14
|
-
def desugarize(strict_type_declaration)
|
15
|
-
strict_type_declaration = strict_type_declaration.dup
|
16
|
-
|
17
|
-
strict_type_declaration.delete(:_desugarized)
|
18
|
-
|
19
|
-
strict_type_declaration
|
20
|
-
end
|
21
|
-
|
22
|
-
def priority
|
23
|
-
Priority::LOWEST + 100
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
Foobara.require_project_file("type_declarations", "desugarizer")
|
2
|
-
|
3
|
-
module Foobara
|
4
|
-
module TypeDeclarations
|
5
|
-
module Handlers
|
6
|
-
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
7
|
-
class ShortTypeNameDesugarizer < TypeDeclarations::Desugarizer
|
8
|
-
def applicable?(sugary_type_declaration)
|
9
|
-
return false if TypeDeclarations.strict_stringified? || TypeDeclarations.strict?
|
10
|
-
|
11
|
-
sugary_type_declaration = sugary_type_declaration.dup
|
12
|
-
|
13
|
-
return false unless sugary_type_declaration.is_a?(::Hash)
|
14
|
-
|
15
|
-
sugary_type_declaration = normalize_type(sugary_type_declaration)
|
16
|
-
|
17
|
-
if sugary_type_declaration.key?(:type) &&
|
18
|
-
!sugary_type_declaration.dig(:_desugarized, :type_absolutified)
|
19
|
-
type_symbol = sugary_type_declaration[:type]
|
20
|
-
|
21
|
-
(type_symbol.is_a?(::Symbol) || type_symbol.is_a?(::String)) && type_registered?(type_symbol)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def desugarize(sugary_type_declaration)
|
26
|
-
sugary_type_declaration = normalize_type(sugary_type_declaration)
|
27
|
-
|
28
|
-
type_symbol = sugary_type_declaration[:type]
|
29
|
-
type = lookup_type!(type_symbol)
|
30
|
-
|
31
|
-
desugarized = sugary_type_declaration[:_desugarized] || {}
|
32
|
-
desugarized[:type_absolutified] = true
|
33
|
-
# TODO: just use the symbol and nothing else??
|
34
|
-
# maybe confusing in languages with no distinction between symbol and string?
|
35
|
-
sugary_type_declaration.merge(type: type.full_type_symbol, _desugarized: desugarized)
|
36
|
-
end
|
37
|
-
|
38
|
-
# TODO: clean this up in a different desugarizer so we don't have to think about it here
|
39
|
-
def normalize_type(sugary_type_declaration)
|
40
|
-
if sugary_type_declaration.key?("type") && !sugary_type_declaration.key?(:type)
|
41
|
-
if Util.all_symbolizable_keys?(sugary_type_declaration)
|
42
|
-
sugary_type_declaration = Util.symbolize_keys(sugary_type_declaration)
|
43
|
-
type_symbol = sugary_type_declaration[:type]
|
44
|
-
|
45
|
-
if type_symbol.is_a?(::String)
|
46
|
-
sugary_type_declaration[:type] = type_symbol.to_sym
|
47
|
-
end
|
48
|
-
end
|
49
|
-
else
|
50
|
-
sugary_type_declaration = sugary_type_declaration.dup
|
51
|
-
end
|
52
|
-
|
53
|
-
sugary_type_declaration
|
54
|
-
end
|
55
|
-
|
56
|
-
def priority
|
57
|
-
Priority::FIRST + 2
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/projects/type_declarations/src/handlers/registered_type_declaration/strict_desugarizer.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
Foobara.require_project_file("type_declarations", "desugarizer")
|
2
|
-
|
3
|
-
module Foobara
|
4
|
-
module TypeDeclarations
|
5
|
-
module Handlers
|
6
|
-
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
7
|
-
# type_symbol is basically just a flag that lets us know that type is fully qualified.
|
8
|
-
# rather hacky but other potential workarounds seemed gnarlier
|
9
|
-
class StrictDesugarizer < TypeDeclarations::Desugarizer
|
10
|
-
def applicable?(strict_type_declaration)
|
11
|
-
# TODO: we shouldn't have to check if this is a hash. This means some other desugarizer is unnecessarily
|
12
|
-
# processing a type declaration as if it were sugary. Find and fix that to speed this up a tiny bit.
|
13
|
-
return false unless strict_type_declaration.is_a?(::Hash) && TypeDeclarations.strict?
|
14
|
-
|
15
|
-
!strict_type_declaration.dig(:_desugarized, :type_absolutified)
|
16
|
-
end
|
17
|
-
|
18
|
-
def desugarize(strict_type_declaration)
|
19
|
-
strict_type_declaration = Util.symbolize_keys(strict_type_declaration)
|
20
|
-
desugarized = strict_type_declaration[:_desugarized] || {}
|
21
|
-
desugarized[:type_absolutified] = true
|
22
|
-
strict_type_declaration.merge(_desugarized: desugarized)
|
23
|
-
end
|
24
|
-
|
25
|
-
def priority
|
26
|
-
Priority::FIRST
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
Foobara.require_project_file("type_declarations", "desugarizer")
|
2
|
-
|
3
|
-
module Foobara
|
4
|
-
module TypeDeclarations
|
5
|
-
module Handlers
|
6
|
-
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
7
|
-
# type_symbol is basically just a flag that lets us know that type is fully qualified.
|
8
|
-
# rather hacky but other potential workarounds seemed gnarlier
|
9
|
-
class StrictStringifiedDesugarizer < TypeDeclarations::Desugarizer
|
10
|
-
def applicable?(sugary_type_declaration)
|
11
|
-
# TODO: we shouldn't have to check if this is a hash. This means some other desugarizer is unnecessarily
|
12
|
-
# processing a type declaration as if it were sugary. Find and fix that to speed this up a tiny bit.
|
13
|
-
return false unless sugary_type_declaration.is_a?(::Hash) && TypeDeclarations.strict_stringified?
|
14
|
-
|
15
|
-
!sugary_type_declaration.dig(:_desugarized, :type_absolutified)
|
16
|
-
end
|
17
|
-
|
18
|
-
def desugarize(sugary_type_declaration)
|
19
|
-
sugary_type_declaration = Util.symbolize_keys(sugary_type_declaration)
|
20
|
-
type_symbol = sugary_type_declaration[:type]
|
21
|
-
|
22
|
-
type = Foobara.foobara_root_namespace.foobara_lookup_type!(type_symbol,
|
23
|
-
mode: Namespace::LookupMode::ABSOLUTE)
|
24
|
-
|
25
|
-
type_symbol = type.full_type_symbol
|
26
|
-
|
27
|
-
desugarized = sugary_type_declaration[:_desugarized] || {}
|
28
|
-
desugarized[:type_absolutified] = true
|
29
|
-
sugary_type_declaration.merge(_desugarized: desugarized, type: type_symbol)
|
30
|
-
end
|
31
|
-
|
32
|
-
def priority
|
33
|
-
Priority::FIRST
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/projects/type_declarations/src/handlers/registered_type_declaration/symbol_desugarizer.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
Foobara.require_project_file("type_declarations", "desugarizer")
|
2
|
-
|
3
|
-
module Foobara
|
4
|
-
module TypeDeclarations
|
5
|
-
module Handlers
|
6
|
-
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
7
|
-
# TODO: make a quick way to convert a couple simple procs into a transformer
|
8
|
-
class SymbolDesugarizer < TypeDeclarations::Desugarizer
|
9
|
-
def applicable?(sugary_type_declaration)
|
10
|
-
if sugary_type_declaration.is_a?(::Symbol)
|
11
|
-
type_registered?(sugary_type_declaration)
|
12
|
-
elsif sugary_type_declaration.is_a?(::String) && TypeDeclarations.stringified?
|
13
|
-
applicable?(sugary_type_declaration.to_sym)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def desugarize(symbol)
|
18
|
-
# TODO: just use the symbol and nothing else??
|
19
|
-
# maybe confusing in languages with no distinction between symbol and string?
|
20
|
-
{ type: symbol.to_sym }
|
21
|
-
end
|
22
|
-
|
23
|
-
def priority
|
24
|
-
Priority::FIRST
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/projects/type_declarations/src/handlers/registered_type_declaration/type_desugarizer.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
Foobara.require_project_file("type_declarations", "desugarizer")
|
2
|
-
|
3
|
-
module Foobara
|
4
|
-
module TypeDeclarations
|
5
|
-
module Handlers
|
6
|
-
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
7
|
-
# TODO: make a quick way to convert a couple simple procs into a transformer
|
8
|
-
class TypeDesugarizer < TypeDeclarations::Desugarizer
|
9
|
-
def applicable?(sugary_type_declaration)
|
10
|
-
sugary_type_declaration.is_a?(Types::Type)
|
11
|
-
end
|
12
|
-
|
13
|
-
def desugarize(type)
|
14
|
-
type.reference_or_declaration_data
|
15
|
-
end
|
16
|
-
|
17
|
-
def priority
|
18
|
-
Priority::FIRST - 1
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|