foobara 0.0.142 → 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.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +19 -0
  4. data/projects/builtin_types/lib/foobara/builtin_types.rb +1 -0
  5. 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
  6. data/projects/builtin_types/src/attributes/supported_transformers/defaults/type_declaration_extension/extend_attributes_type_declaration/desugarizers/symbolize_defaults.rb +1 -1
  7. 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
  8. data/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/desugarizers/alphabetize_required.rb +5 -5
  9. 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
  10. data/projects/builtin_types/src/builtin_types.rb +1 -1
  11. data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/class_desugarizer.rb +10 -2
  12. data/projects/builtin_types/src/duck/supported_validators/instance_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/class_type_desugarizer.rb +7 -2
  13. 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
  14. 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
  15. 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
  16. data/projects/builtin_types/src/duck/supported_validators/instance_of.rb +1 -0
  17. data/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/cast_one_of.rb +4 -3
  18. data/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/module_desugarizer.rb +3 -3
  19. data/projects/builtin_types/src/tuple/supported_processors/element_type_declarations/type_declaration_extension/extend_tuple_type_declaration/desugarizers/set_size.rb +1 -1
  20. 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
  21. data/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb +12 -12
  22. data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +4 -2
  23. data/projects/command/src/command_pattern_implementation/concerns/result_type.rb +0 -4
  24. data/projects/command_connectors/src/command_connector.rb +6 -6
  25. data/projects/command_connectors/src/command_registry.rb +7 -4
  26. data/projects/command_connectors/src/transformed_command.rb +22 -8
  27. data/projects/command_connectors/src/transformers/auth_errors_transformer.rb +1 -0
  28. data/projects/command_connectors/src/transformers/entity_to_primary_key_inputs_transformer.rb +4 -0
  29. data/projects/detached_entity/src/concerns/types.rb +7 -1
  30. data/projects/detached_entity/src/extensions/builtin_types/detached_entity/validators/model_instance_is_valid.rb +1 -1
  31. data/projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/hash_desugarizer.rb +6 -9
  32. data/projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/primary_key_desugarizer.rb +2 -1
  33. data/projects/domain/src/domain_module_extension.rb +12 -4
  34. data/projects/entity/src/concerns/types.rb +6 -1
  35. data/projects/foobara/lib/foobara/all.rb +4 -4
  36. data/projects/manifest/src/foobara/manifest/type.rb +11 -2
  37. data/projects/manifest/src/foobara/manifest/type_declaration.rb +46 -2
  38. data/projects/model/src/concerns/aliases.rb +8 -0
  39. data/projects/model/src/concerns/reflection.rb +2 -2
  40. data/projects/model/src/concerns/types.rb +35 -20
  41. data/projects/model/src/extensions/builtin_types/model/validators/model_instance_is_valid.rb +12 -8
  42. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb +1 -1
  43. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +15 -1
  44. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_desugarizer.rb +7 -5
  45. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb +4 -7
  46. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/model_class_desugarizer.rb +0 -2
  47. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/move_private_from_element_types_to_root.rb +28 -9
  48. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/symbolize_private.rb +8 -7
  49. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +4 -7
  50. data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb +14 -2
  51. data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/hash_desugarizer.rb +8 -9
  52. data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/model_class_type_desugarizer.rb +6 -2
  53. data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/mutable_validator.rb +5 -2
  54. data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/normalize_mutable_attributes_desugarizer.rb +8 -7
  55. data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/to_type_transformer.rb +4 -1
  56. data/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration.rb +20 -5
  57. data/projects/model/src/extensions/type_declarations/handlers/registered_type_declaration/model_class_desugarizer.rb +23 -5
  58. data/projects/model/src/extensions/type_declarations/lazy_element_types/model.rb +18 -0
  59. data/projects/model_attribute_helpers/src/attribute_helpers.rb +44 -26
  60. data/projects/namespace/src/is_namespace.rb +58 -90
  61. data/projects/namespace/src/namespace/lookup_mode.rb +13 -2
  62. data/projects/namespace/src/namespace_helpers.rb +1 -0
  63. data/projects/namespace/src/prefixless_registry.rb +2 -0
  64. data/projects/persistence/src/entity_base/transaction/concerns/state_transitions.rb +20 -1
  65. data/projects/persistence/src/entity_base/transaction.rb +14 -11
  66. data/projects/persistence/src/entity_base/transaction_table.rb +10 -49
  67. data/projects/persistence/src/entity_base.rb +39 -0
  68. data/projects/persistence/src/persistence.rb +4 -0
  69. data/projects/type_declarations/src/attributes.rb +15 -9
  70. data/projects/type_declarations/src/attributes_transformers/from_yaml.rb +1 -1
  71. data/projects/type_declarations/src/desugarizer_pipeline.rb +9 -0
  72. data/projects/type_declarations/src/dsl/attributes.rb +14 -5
  73. data/projects/type_declarations/src/handlers/extend_array_type_declaration/array_desugarizer.rb +24 -4
  74. data/projects/type_declarations/src/handlers/extend_array_type_declaration/element_type_declaration_desugarizer.rb +23 -9
  75. data/projects/type_declarations/src/handlers/extend_array_type_declaration/to_type_transformer.rb +3 -7
  76. data/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +15 -4
  77. data/projects/type_declarations/src/handlers/extend_array_type_declaration.rb +12 -2
  78. data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/key_type_declaration_desugarizer.rb +48 -0
  79. data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/to_type_transformer.rb +3 -11
  80. data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration/value_type_declaration_desugarizer.rb +51 -0
  81. data/projects/type_declarations/src/handlers/extend_associative_array_type_declaration.rb +12 -2
  82. data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/dsl_desugarizer.rb +1 -1
  83. data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb +17 -7
  84. data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/hash_desugarizer.rb +16 -19
  85. data/projects/type_declarations/src/handlers/extend_attributes_type_declaration/to_type_transformer.rb +3 -6
  86. data/projects/type_declarations/src/handlers/extend_attributes_type_declaration.rb +13 -2
  87. data/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +3 -3
  88. data/projects/type_declarations/src/handlers/extend_registered_type_declaration.rb +16 -4
  89. data/projects/type_declarations/src/handlers/extend_tuple_type_declaration/array_desugarizer.rb +20 -6
  90. data/projects/type_declarations/src/handlers/extend_tuple_type_declaration/to_type_transformer.rb +3 -9
  91. data/projects/type_declarations/src/handlers/extend_tuple_type_declaration.rb +12 -2
  92. data/projects/type_declarations/src/handlers/registered_type_declaration/to_type_transformer.rb +7 -9
  93. data/projects/type_declarations/src/handlers/registered_type_declaration.rb +22 -7
  94. data/projects/type_declarations/src/lazy_element_types/array.rb +19 -0
  95. data/projects/type_declarations/src/lazy_element_types/attributes.rb +27 -0
  96. data/projects/type_declarations/src/lazy_element_types/hash.rb +38 -0
  97. data/projects/type_declarations/src/lazy_element_types/tuple.rb +23 -0
  98. data/projects/type_declarations/src/sensitive_type_remover.rb +6 -1
  99. data/projects/type_declarations/src/sensitive_type_removers/attributes.rb +2 -0
  100. data/projects/type_declarations/src/type_builder.rb +46 -21
  101. data/projects/type_declarations/src/type_declaration.rb +295 -0
  102. data/projects/type_declarations/src/type_declaration_handler.rb +10 -11
  103. data/projects/type_declarations/src/type_declarations.rb +12 -5
  104. data/projects/types/src/type.rb +26 -4
  105. data/projects/value/src/mutator.rb +1 -4
  106. data/projects/value/src/processor/casting.rb +7 -2
  107. data/projects/value/src/processor/pipeline.rb +9 -1
  108. data/projects/value/src/processor.rb +0 -2
  109. data/projects/value/src/transformer.rb +1 -3
  110. data/projects/value/src/validator.rb +0 -2
  111. data/projects/weak_object_set/src/weak_object_set.rb +2 -0
  112. metadata +10 -7
  113. data/projects/type_declarations/src/handlers/registered_type_declaration/desugarizer_metadata_cleanup_desugarizer.rb +0 -29
  114. data/projects/type_declarations/src/handlers/registered_type_declaration/short_type_name_desugarizer.rb +0 -62
  115. data/projects/type_declarations/src/handlers/registered_type_declaration/strict_desugarizer.rb +0 -32
  116. data/projects/type_declarations/src/handlers/registered_type_declaration/strict_stringified_desugarizer.rb +0 -39
  117. data/projects/type_declarations/src/handlers/registered_type_declaration/symbol_desugarizer.rb +0 -30
  118. data/projects/type_declarations/src/handlers/registered_type_declaration/type_desugarizer.rb +0 -24
@@ -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
@@ -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
@@ -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