foobara 0.0.142 → 0.1.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/.ruby-version +1 -1
- data/CHANGELOG.md +25 -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 +41 -16
- data/projects/command_connectors/src/command_registry.rb +7 -4
- data/projects/command_connectors/src/transformed_command.rb +55 -43
- 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/possible_error.rb +27 -21
- data/projects/detached_entity/src/concerns/types.rb +7 -1
- data/projects/detached_entity/src/detached_entity_type.rb +10 -0
- 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/domain/src/is_manifestable.rb +19 -7
- 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 +58 -90
- 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 +18 -88
- data/projects/types/src/type.rb +34 -9
- 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 -8
- 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 +11 -8
- 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 -62
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 772c1b159a33ecf7e3f63a1a2a70d8574d986be541bf3ac88cd00a87c8fc8036
|
4
|
+
data.tar.gz: 94ccbde2bafcb9860d7275083659cd8f62f76f8d7bc27b03fcfa2d63e3e085ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a78ea31d30819836a421d49413f2ce379262dac03bf2cc4db2d779c74cc98ea4580f48bd7b472e5d473e3edf269f31af17927adc0248f1ecd7436127585b4e21
|
7
|
+
data.tar.gz: cf07fcd19587a5820afb06f4cba5d783f2f340f552f64fdb8a577bd5794f139e513828ddb97a8263f41c1d31c104b1d34bb1dfec751da3aa0da43d75c78d660d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
# [0.1.2] - 2025-08-24
|
2
|
+
|
3
|
+
- Exclude processor/processor_class categories from manifest by default
|
4
|
+
- Fix bug where entity types were not converted to detached_entity types in manifests
|
5
|
+
- Shorten cast_to declarations by using references when possible
|
6
|
+
|
7
|
+
# [0.1.1] - 2025-08-22
|
8
|
+
|
9
|
+
- Change type declarations for references to registered types to have a structure of `:some_type`
|
10
|
+
instead of a `{ type: :some_type }` structure. This makes things faster and also make things less ambiguous.
|
11
|
+
- Order entity bases and transaction tables by dependencies to simplify making sure associations
|
12
|
+
already have their primary keys set
|
13
|
+
- Add Manifest::Type#primitive? and Manifest::TypeDeclaration#primitive?/#reference?
|
14
|
+
- Add Type#primitive? and Type#derived? concepts
|
15
|
+
- Add ABSOLUTE_SINGLE_NAMESPACE and refactor #foobara_lookup to be much faster
|
16
|
+
- Checking #applicable? is now the caller's responsibility when running value processors
|
17
|
+
- Run RSpec and Rubocop in separate jobs in CI
|
18
|
+
- Don't load pry by default
|
19
|
+
- Introduce TypeDeclaration and use it to eliminate some desugarizers and speed things up significantly
|
20
|
+
while also improving code readability
|
21
|
+
- Eliminate `_desugarized` metadata entry from declaration data now that TypeDeclaration can encapsulate
|
22
|
+
such state
|
23
|
+
- Lazy load Type#element_type(s) and strictify them
|
24
|
+
- Fix bug where .add_inputs is called when .inputs was never called
|
25
|
+
|
1
26
|
# [0.0.142] - 2025-08-10
|
2
27
|
|
3
28
|
- Add LruCache to IsNamespace to speed up lookups
|
@@ -8,12 +8,19 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class MoveDefaultsFromElementTypesToRoot < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(value)
|
11
|
-
value.
|
11
|
+
value.hash? && value[:type] == :attributes && value.key?(:element_type_declarations)
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
15
15
|
defaults = rawish_type_declaration[:defaults]
|
16
|
-
|
16
|
+
|
17
|
+
if defaults
|
18
|
+
unless rawish_type_declaration.deep_duped?
|
19
|
+
defaults = defaults.dup
|
20
|
+
end
|
21
|
+
else
|
22
|
+
defaults = {}
|
23
|
+
end
|
17
24
|
|
18
25
|
element_type_declarations = rawish_type_declaration[:element_type_declarations]
|
19
26
|
|
@@ -8,7 +8,7 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class SymbolizeDefaults < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(value)
|
11
|
-
value.
|
11
|
+
value.hash? && value[:type] == :attributes && value[:defaults]
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
@@ -16,7 +16,7 @@ module Foobara
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def applicable?(strict_type_declaration)
|
19
|
-
strict_type_declaration.
|
19
|
+
strict_type_declaration.hash? && strict_type_declaration.key?(:defaults)
|
20
20
|
end
|
21
21
|
|
22
22
|
def validation_errors(strict_type_declaration)
|
@@ -8,7 +8,7 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class AlphabetizeRequired < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(value)
|
11
|
-
value.
|
11
|
+
value.hash? && value[:type] == :attributes &&
|
12
12
|
value.key?(:required) && value[:required].size > 1
|
13
13
|
end
|
14
14
|
|
@@ -17,11 +17,11 @@ module Foobara
|
|
17
17
|
|
18
18
|
sorted_required = required.sort
|
19
19
|
|
20
|
-
if sorted_required
|
21
|
-
rawish_type_declaration
|
22
|
-
else
|
23
|
-
rawish_type_declaration.merge(required: sorted_required)
|
20
|
+
if sorted_required != required
|
21
|
+
rawish_type_declaration[:required] = sorted_required
|
24
22
|
end
|
23
|
+
|
24
|
+
rawish_type_declaration
|
25
25
|
end
|
26
26
|
|
27
27
|
def priority
|
@@ -8,7 +8,9 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class MoveRequiredFromElementTypesToRoot < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(value)
|
11
|
-
|
11
|
+
return false if value.strict?
|
12
|
+
|
13
|
+
value.hash? && value[:type] == :attributes && value.key?(:element_type_declarations)
|
12
14
|
end
|
13
15
|
|
14
16
|
def desugarize(rawish_type_declaration)
|
@@ -24,13 +26,17 @@ module Foobara
|
|
24
26
|
|
25
27
|
element_type_declarations = rawish_type_declaration[:element_type_declarations]
|
26
28
|
|
29
|
+
changed = false
|
30
|
+
|
27
31
|
element_type_declarations.each_pair do |attribute_name, attribute_type_declaration|
|
28
32
|
if attribute_type_declaration.is_a?(::Hash) && attribute_type_declaration.key?(:required)
|
29
33
|
is_required = attribute_type_declaration[:required]
|
30
34
|
|
31
|
-
if
|
35
|
+
if is_required == true || is_required == false
|
32
36
|
element_type_declarations[attribute_name] = attribute_type_declaration.except(:required)
|
33
37
|
|
38
|
+
changed = true
|
39
|
+
|
34
40
|
if is_required
|
35
41
|
required_attributes << attribute_name
|
36
42
|
else
|
@@ -46,6 +52,10 @@ module Foobara
|
|
46
52
|
rawish_type_declaration[:required] = required_attributes
|
47
53
|
end
|
48
54
|
|
55
|
+
if changed
|
56
|
+
rawish_type_declaration[:element_type_declarations] = element_type_declarations
|
57
|
+
end
|
58
|
+
|
49
59
|
rawish_type_declaration
|
50
60
|
end
|
51
61
|
end
|
@@ -8,11 +8,19 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class ClassDesugarizer < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(rawish_type_declaration)
|
11
|
-
rawish_type_declaration.
|
11
|
+
rawish_type_declaration.class?
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
15
|
-
|
15
|
+
rawish_type_declaration.declaration_data = {
|
16
|
+
type: :duck,
|
17
|
+
instance_of: rawish_type_declaration.declaration_data.name
|
18
|
+
}
|
19
|
+
rawish_type_declaration.is_strict = true
|
20
|
+
rawish_type_declaration.is_deep_duped = true
|
21
|
+
rawish_type_declaration.is_duped = true
|
22
|
+
|
23
|
+
rawish_type_declaration
|
16
24
|
end
|
17
25
|
|
18
26
|
def priority
|
@@ -8,14 +8,19 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class ClassTypeDesugarizer < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(rawish_type_declaration)
|
11
|
-
return false unless rawish_type_declaration.
|
11
|
+
return false unless rawish_type_declaration.hash?
|
12
12
|
|
13
13
|
rawish_type_declaration[:type].is_a?(::Class)
|
14
14
|
end
|
15
15
|
|
16
16
|
def desugarize(rawish_type_declaration)
|
17
17
|
klass = rawish_type_declaration[:type]
|
18
|
-
|
18
|
+
|
19
|
+
rawish_type_declaration[:type] = :duck
|
20
|
+
rawish_type_declaration[:instance_of] = klass.name
|
21
|
+
rawish_type_declaration.is_absolutified = true
|
22
|
+
|
23
|
+
rawish_type_declaration
|
19
24
|
end
|
20
25
|
|
21
26
|
def priority
|
@@ -8,13 +8,12 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class InstanceOfClassDesugarizer < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(rawish_type_declaration)
|
11
|
-
rawish_type_declaration.
|
11
|
+
rawish_type_declaration.hash? && rawish_type_declaration[:instance_of].is_a?(::Class)
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
15
|
-
instance_of = rawish_type_declaration[:instance_of]
|
16
|
-
|
17
|
-
rawish_type_declaration.merge(instance_of:)
|
15
|
+
rawish_type_declaration[:instance_of] = rawish_type_declaration[:instance_of].name
|
16
|
+
rawish_type_declaration
|
18
17
|
end
|
19
18
|
|
20
19
|
def priority
|
@@ -8,13 +8,12 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class InstanceOfSymbolDesugarizer < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(rawish_type_declaration)
|
11
|
-
rawish_type_declaration.
|
11
|
+
rawish_type_declaration.hash? && rawish_type_declaration[:instance_of].is_a?(::Symbol)
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
15
|
-
instance_of = rawish_type_declaration[:instance_of]
|
16
|
-
|
17
|
-
rawish_type_declaration.merge(instance_of:)
|
15
|
+
rawish_type_declaration[:instance_of] = rawish_type_declaration[:instance_of].to_s
|
16
|
+
rawish_type_declaration
|
18
17
|
end
|
19
18
|
|
20
19
|
def priority
|
@@ -16,7 +16,7 @@ module Foobara
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def applicable?(strict_type_declaration)
|
19
|
-
strict_type_declaration.
|
19
|
+
strict_type_declaration.hash? && strict_type_declaration.key?(:instance_of)
|
20
20
|
end
|
21
21
|
|
22
22
|
def validation_errors(strict_type_declaration)
|
@@ -8,19 +8,20 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class CastOneOf < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(rawish_type_declaration)
|
11
|
-
rawish_type_declaration.
|
11
|
+
rawish_type_declaration.hash? && rawish_type_declaration[:one_of].is_a?(::Array)
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
15
15
|
one_of = rawish_type_declaration[:one_of]
|
16
16
|
|
17
|
+
# TODO: for performance, can we just use the type identified by type: when possible?
|
17
18
|
type = type_for_declaration(rawish_type_declaration.except(:one_of))
|
18
19
|
|
19
|
-
one_of = one_of.map do |value|
|
20
|
+
rawish_type_declaration[:one_of] = one_of.map do |value|
|
20
21
|
type.process_value!(value)
|
21
22
|
end
|
22
23
|
|
23
|
-
rawish_type_declaration
|
24
|
+
rawish_type_declaration
|
24
25
|
end
|
25
26
|
|
26
27
|
def priority
|
@@ -8,7 +8,7 @@ module Foobara
|
|
8
8
|
module Desugarizers
|
9
9
|
class ModuleDesugarizer < TypeDeclarations::Desugarizer
|
10
10
|
def applicable?(rawish_type_declaration)
|
11
|
-
rawish_type_declaration.
|
11
|
+
rawish_type_declaration.hash? && rawish_type_declaration[:one_of].is_a?(::Module)
|
12
12
|
end
|
13
13
|
|
14
14
|
def desugarize(rawish_type_declaration)
|
@@ -16,7 +16,7 @@ module Foobara
|
|
16
16
|
|
17
17
|
one_of = Util.constant_values(mod)
|
18
18
|
|
19
|
-
one_of = begin
|
19
|
+
rawish_type_declaration[:one_of] = begin
|
20
20
|
one_of.sort
|
21
21
|
rescue
|
22
22
|
# :nocov:
|
@@ -24,7 +24,7 @@ module Foobara
|
|
24
24
|
# :nocov:
|
25
25
|
end
|
26
26
|
|
27
|
-
rawish_type_declaration
|
27
|
+
rawish_type_declaration
|
28
28
|
end
|
29
29
|
|
30
30
|
def priority
|
@@ -12,8 +12,7 @@ module Foobara
|
|
12
12
|
def context_type_declaration
|
13
13
|
{
|
14
14
|
expected_size: :integer,
|
15
|
-
actual_size: :integer
|
16
|
-
value: :array
|
15
|
+
actual_size: :integer
|
17
16
|
}
|
18
17
|
end
|
19
18
|
end
|
@@ -33,8 +32,7 @@ module Foobara
|
|
33
32
|
message: "Expected tuple to have #{size} elements but it had #{element_type_declarations_size}",
|
34
33
|
context: {
|
35
34
|
expected_size: size,
|
36
|
-
actual_size: element_type_declarations_size
|
37
|
-
value: strict_type_declaration
|
35
|
+
actual_size: element_type_declarations_size
|
38
36
|
}
|
39
37
|
)
|
40
38
|
end
|
@@ -26,13 +26,17 @@ module Foobara
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def add_inputs(...)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
if inputs_type
|
30
|
+
new_type = type_for_declaration(...)
|
31
|
+
new_declaration = TypeDeclarations::Attributes.merge(
|
32
|
+
inputs_type.declaration_data,
|
33
|
+
new_type.declaration_data
|
34
|
+
)
|
35
|
+
|
36
|
+
inputs new_declaration
|
37
|
+
else
|
38
|
+
inputs(...)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
def inputs_type
|
@@ -43,10 +47,6 @@ module Foobara
|
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
def raw_inputs_type_declaration
|
47
|
-
inputs_type.raw_declaration_data
|
48
|
-
end
|
49
|
-
|
50
50
|
def inputs_type_declaration
|
51
51
|
inputs_type.declaration_data
|
52
52
|
end
|
@@ -61,7 +61,7 @@ module Foobara
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
foobara_delegate :inputs_type,
|
64
|
+
foobara_delegate :inputs_type, to: :class
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -24,8 +24,10 @@ module Foobara
|
|
24
24
|
to_include = TypeDeclarations.foobara_manifest_context_to_include
|
25
25
|
|
26
26
|
depends_on = self.depends_on.map do |command_name|
|
27
|
-
other_command = Foobara::Namespace.global.foobara_lookup!(
|
28
|
-
|
27
|
+
other_command = Foobara::Namespace.global.foobara_lookup!(
|
28
|
+
command_name,
|
29
|
+
mode: Foobara::Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
30
|
+
)
|
29
31
|
if to_include
|
30
32
|
to_include << other_command
|
31
33
|
end
|
@@ -494,8 +494,7 @@ module Foobara
|
|
494
494
|
to_include << command_registry.global_organization
|
495
495
|
to_include << command_registry.global_domain
|
496
496
|
|
497
|
-
|
498
|
-
command_registry.foobara_each(mode: Namespace::LookupMode::ABSOLUTE) do |exposed_whatever|
|
497
|
+
command_registry.foobara_each(mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) do |exposed_whatever|
|
499
498
|
to_include << exposed_whatever
|
500
499
|
end
|
501
500
|
|
@@ -507,11 +506,16 @@ module Foobara
|
|
507
506
|
domain: {},
|
508
507
|
type: {},
|
509
508
|
command: {},
|
510
|
-
error: {}
|
511
|
-
processor: {},
|
512
|
-
processor_class: {}
|
509
|
+
error: {}
|
513
510
|
}
|
514
511
|
|
512
|
+
if TypeDeclarations.include_processors?
|
513
|
+
h.merge!(
|
514
|
+
processor: {},
|
515
|
+
processor_class: {}
|
516
|
+
)
|
517
|
+
end
|
518
|
+
|
515
519
|
TypeDeclarations.with_manifest_context(to_include: additional_to_include, remove_sensitive: true) do
|
516
520
|
until to_include.empty? && additional_to_include.empty?
|
517
521
|
object = nil
|
@@ -537,25 +541,47 @@ module Foobara
|
|
537
541
|
"Make sure these are not included."
|
538
542
|
# :nocov:
|
539
543
|
else
|
544
|
+
mode = Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
540
545
|
domain_name = o.foobara_domain.scoped_full_name
|
541
546
|
|
542
|
-
|
543
|
-
|
547
|
+
exposed_domain = command_registry.foobara_lookup_domain(domain_name, mode:)
|
548
|
+
|
549
|
+
unless exposed_domain
|
550
|
+
exposed_domain = command_registry.build_and_register_exposed_domain(domain_name)
|
544
551
|
|
545
552
|
# Since we don't know which other domains/orgs creating this domain might have created,
|
546
553
|
# we will just add them all to be included just in case
|
547
|
-
command_registry.foobara_all_domain(
|
548
|
-
mode: Namespace::LookupMode::ABSOLUTE
|
549
|
-
).each do |exposed_domain|
|
554
|
+
command_registry.foobara_all_domain(mode:).each do |exposed_domain|
|
550
555
|
additional_to_include << exposed_domain
|
551
556
|
end
|
552
557
|
|
553
|
-
command_registry.foobara_all_organization(
|
554
|
-
mode: Namespace::LookupMode::ABSOLUTE
|
555
|
-
).each do |exposed_organization|
|
558
|
+
command_registry.foobara_all_organization(mode:).each do |exposed_organization|
|
556
559
|
additional_to_include << exposed_organization
|
557
560
|
end
|
558
561
|
end
|
562
|
+
|
563
|
+
if o.extends_type?(BuiltinTypes[:entity])
|
564
|
+
declaration_data = o.declaration_data
|
565
|
+
|
566
|
+
if declaration_data.is_a?(::Hash) && declaration_data[:type] == :entity
|
567
|
+
if o.foobara_root_namespace != command_registry.foobara_root_namespace
|
568
|
+
# Let's swap it out with a detached type
|
569
|
+
detached_entity = command_registry.foobara_lookup_type(o.scoped_full_name, mode:)
|
570
|
+
|
571
|
+
unless detached_entity
|
572
|
+
declaration_data = o.declaration_data.merge(
|
573
|
+
type: :detached_entity,
|
574
|
+
model_base_class: "Foobara::DetachedEntity"
|
575
|
+
)
|
576
|
+
|
577
|
+
detached_entity = exposed_domain.foobara_type_from_declaration(declaration_data)
|
578
|
+
end
|
579
|
+
|
580
|
+
additional_to_include << detached_entity
|
581
|
+
next
|
582
|
+
end
|
583
|
+
end
|
584
|
+
end
|
559
585
|
end
|
560
586
|
end
|
561
587
|
|
@@ -586,9 +612,8 @@ module Foobara
|
|
586
612
|
Foobara::Namespace.current
|
587
613
|
end
|
588
614
|
|
589
|
-
cat = h[category_symbol] ||= {}
|
590
615
|
# TODO: do we really need to enter the namespace here for this?
|
591
|
-
|
616
|
+
h[category_symbol][manifest_reference] = Foobara::Namespace.use namespace do
|
592
617
|
object.foobara_manifest
|
593
618
|
end
|
594
619
|
|
@@ -649,7 +674,7 @@ module Foobara
|
|
649
674
|
def all_exposed_commands
|
650
675
|
process_delayed_connections
|
651
676
|
|
652
|
-
command_registry.foobara_all_command(mode: Namespace::LookupMode::
|
677
|
+
command_registry.foobara_all_command(mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE)
|
653
678
|
end
|
654
679
|
|
655
680
|
def all_exposed_type_names
|
@@ -34,7 +34,8 @@ module Foobara
|
|
34
34
|
|
35
35
|
def create_exposed_command(command_class, **)
|
36
36
|
full_domain_name = command_class.domain.scoped_full_name
|
37
|
-
exposed_domain = foobara_lookup_domain(full_domain_name,
|
37
|
+
exposed_domain = foobara_lookup_domain(full_domain_name,
|
38
|
+
mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) ||
|
38
39
|
build_and_register_exposed_domain(full_domain_name)
|
39
40
|
|
40
41
|
exposed_command = create_exposed_command_without_domain(command_class, **)
|
@@ -81,7 +82,7 @@ module Foobara
|
|
81
82
|
|
82
83
|
exposed_organization = foobara_lookup_organization(
|
83
84
|
full_organization_name,
|
84
|
-
mode: Namespace::LookupMode::
|
85
|
+
mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
85
86
|
) || build_and_register_exposed_organization(full_organization_name)
|
86
87
|
|
87
88
|
exposed_domain = Module.new
|
@@ -108,13 +109,15 @@ module Foobara
|
|
108
109
|
end
|
109
110
|
|
110
111
|
def global_domain
|
111
|
-
foobara_lookup_domain("") ||
|
112
|
+
foobara_lookup_domain("", mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) ||
|
113
|
+
build_and_register_exposed_domain("")
|
112
114
|
end
|
113
115
|
|
114
116
|
def global_organization
|
115
117
|
# TODO: test this
|
116
118
|
# :nocov:
|
117
|
-
foobara_lookup_organization("") ||
|
119
|
+
foobara_lookup_organization("", mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE) ||
|
120
|
+
build_and_register_exposed_organization("")
|
118
121
|
# :nocov:
|
119
122
|
end
|
120
123
|
|