foobara 0.5.10 → 0.6.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 +22 -0
- data/lib/foobara/all.rb +4 -2
- data/projects/command/src/command_pattern_implementation/concerns/command_data.rb +3 -3
- data/projects/command/src/command_pattern_implementation/concerns/domain_mappers.rb +2 -2
- data/projects/command/src/command_pattern_implementation/concerns/errors.rb +27 -27
- data/projects/command/src/command_pattern_implementation/concerns/errors_type.rb +7 -11
- data/projects/command/src/command_pattern_implementation/concerns/inputs.rb +4 -24
- data/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb +9 -14
- data/projects/command/src/command_pattern_implementation/concerns/reflection.rb +7 -20
- data/projects/command/src/command_pattern_implementation/concerns/runtime.rb +3 -48
- data/projects/command/src/command_pattern_implementation/concerns/subcommands.rb +5 -5
- data/projects/command/src/command_pattern_implementation.rb +0 -1
- data/projects/command_connectors/lib/foobara/command_connectors.rb +1 -1
- data/projects/command_connectors/src/command_connector/concerns/desugarizers.rb +5 -5
- data/projects/command_connectors/src/command_connector/concerns/reflection.rb +63 -17
- data/projects/command_connectors/src/command_connector/request.rb +26 -10
- data/projects/command_connectors/src/command_connector/response.rb +2 -0
- data/projects/command_connectors/src/command_connector.rb +62 -58
- data/projects/command_connectors/src/command_registry/exposed_command.rb +7 -2
- data/projects/command_connectors/src/command_registry.rb +24 -18
- data/projects/command_connectors/src/desugarizer.rb +2 -2
- data/projects/command_connectors/src/desugarizers/attributes.rb +8 -8
- data/projects/command_connectors/src/desugarizers/auth.rb +1 -1
- data/projects/command_connectors/src/desugarizers/set_inputs.rb +3 -3
- data/projects/command_connectors/src/desugarizers/symbols_to_true.rb +2 -2
- data/projects/command_connectors/src/request_mutator.rb +6 -6
- data/projects/command_connectors/src/response_mutator.rb +6 -6
- data/projects/command_connectors/src/transformed_command.rb +39 -36
- data/projects/command_connectors/src/transformers/auth_errors_transformer.rb +2 -2
- data/projects/command_connectors/src/transformers/entity_to_primary_key_inputs_transformer.rb +2 -2
- data/projects/command_connectors/src/transformers/load_delegated_attributes_entities_pre_commit_transformer.rb +1 -1
- data/projects/domain_mapper/src/domain_mapper.rb +4 -4
- data/projects/domain_mapper/src/domain_mapper_lookups.rb +3 -3
- data/projects/entities/projects/detached_entity/lib/foobara/detached_entity.rb +1 -1
- data/projects/entities/projects/detached_entity/src/concerns/associations.rb +18 -18
- data/projects/entities/projects/detached_entity/src/concerns/initialization.rb +2 -2
- data/projects/entities/projects/detached_entity/src/concerns/primary_key.rb +4 -4
- data/projects/entities/projects/detached_entity/src/concerns/types.rb +2 -2
- data/projects/entities/projects/detached_entity/src/detached_entity_type.rb +4 -4
- data/projects/entities/projects/detached_entity/src/extensions/builtin_types/detached_entity/casters/primary_key.rb +1 -1
- data/projects/entities/projects/detached_entity/src/extensions/builtin_types/detached_entity/validators/model_instance_is_valid.rb +2 -2
- data/projects/entities/projects/detached_entity/src/extensions/type_declarations/handlers/registered_type_declaration/validate_primary_key_present.rb +30 -0
- data/projects/entities/projects/detached_entity/src/remove_sensitive_values_transformer_extensions.rb +2 -2
- data/projects/entities/projects/entity/lib/foobara/entity.rb +1 -1
- data/projects/entities/projects/entity/src/concerns/attributes.rb +6 -6
- data/projects/entities/projects/entity/src/concerns/callbacks.rb +1 -1
- data/projects/entities/projects/entity/src/concerns/initialization.rb +8 -8
- data/projects/entities/projects/entity/src/concerns/mutations.rb +4 -4
- data/projects/entities/projects/entity/src/concerns/persistence.rb +3 -3
- data/projects/entities/projects/entity/src/concerns/queries.rb +7 -7
- data/projects/entities/projects/entity/src/extensions/domain/domain_module_extension.rb +4 -4
- data/projects/entities/projects/entity/src/new_prepend.rb +2 -2
- data/projects/entities/projects/entity/src/not_found_error.rb +8 -8
- data/projects/entities/projects/entity/src/sensitive_value_removers/entity.rb +8 -5
- data/projects/entities/projects/in_memory_crud_driver_minimal/src/in_memory_minimal.rb +4 -4
- data/projects/entities/projects/model_attribute_helpers/lib/foobara/model_attribute_helpers.rb +0 -2
- data/projects/entities/projects/model_attribute_helpers/src/attribute_helper_aliases.rb +1 -1
- data/projects/entities/projects/model_attribute_helpers/src/attribute_helpers.rb +2 -2
- data/projects/entities/projects/nested_transactionable/lib/foobara/nested_transactionable.rb +5 -5
- data/projects/entities/projects/persistence/lib/foobara/persistence.rb +1 -1
- data/projects/entities/projects/persistence/src/entity_attributes_crud_driver.rb +35 -37
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/entity_callback_handling.rb +25 -25
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/state_transitions.rb +8 -8
- data/projects/entities/projects/persistence/src/entity_base/transaction/concerns/transaction_tracking.rb +1 -1
- data/projects/entities/projects/persistence/src/entity_base/transaction.rb +9 -9
- data/projects/entities/projects/persistence/src/entity_base/transaction_table/concerns/record_tracking.rb +4 -4
- data/projects/entities/projects/persistence/src/entity_base/transaction_table.rb +52 -52
- data/projects/entities/projects/persistence/src/entity_base.rb +7 -7
- data/projects/entities/projects/persistence/src/persistence.rb +23 -23
- data/projects/entities/projects/weak_object_set/src/weak_object_set.rb +16 -16
- data/projects/entities_plumbing/lib/foobara/entities_plumbing.rb +6 -2
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entities.rb +21 -5
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_errors_type.rb +23 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_inputs.rb +33 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entity_reflection.rb +39 -0
- data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/runtime.rb +39 -0
- data/projects/manifest/src/base_manifest.rb +9 -9
- data/projects/manifest/src/model.rb +4 -4
- data/projects/manifest/src/type.rb +3 -3
- data/projects/manifest/src/type_declaration.rb +4 -4
- data/projects/model_plumbing/lib/foobara/model_plumbing.rb +2 -0
- data/projects/model_plumbing/src/extensions/command_pattern_implementation/concerns/model_inputs_type.rb +35 -0
- data/projects/typesystem/projects/builtin_types/lib/foobara/builtin_types.rb +2 -1
- data/projects/typesystem/projects/builtin_types/src/builtin_types.rb +8 -8
- data/projects/typesystem/projects/builtin_types/src/duck/supported_validators/one_of/type_declaration_extension/extend_registered_type_declaration/desugarizers/module_desugarizer.rb +2 -2
- data/projects/typesystem/projects/builtin_types/src/email/validator_base.rb +4 -4
- data/projects/typesystem/projects/callback/src/block/concerns/block_parameter_required.rb +2 -2
- data/projects/typesystem/projects/callback/src/block/concerns/keyword_argumentable_block.rb +2 -2
- data/projects/typesystem/projects/callback/src/block/concerns/single_argument_block.rb +2 -2
- data/projects/typesystem/projects/callback/src/block.rb +4 -4
- data/projects/typesystem/projects/callback/src/registry/base.rb +10 -10
- data/projects/typesystem/projects/callback/src/registry/conditioned.rb +2 -2
- data/projects/typesystem/projects/callback/src/registry/multiple_action.rb +6 -6
- data/projects/typesystem/projects/callback/src/runner.rb +4 -4
- data/projects/typesystem/projects/callback/src/set.rb +4 -4
- data/projects/typesystem/projects/common/src/data_path.rb +14 -14
- data/projects/typesystem/projects/common/src/error.rb +11 -11
- data/projects/typesystem/projects/common/src/error_collection.rb +14 -14
- data/projects/typesystem/projects/common/src/error_key.rb +5 -3
- data/projects/typesystem/projects/common/src/outcome.rb +5 -5
- data/projects/typesystem/projects/common/src/possible_error.rb +2 -2
- data/projects/typesystem/projects/concerns/src/concern.rb +3 -3
- data/projects/typesystem/projects/delegate/src/extensions/module.rb +4 -4
- data/projects/typesystem/projects/domain/lib/foobara/domain.rb +2 -2
- data/projects/typesystem/projects/domain/src/domain.rb +5 -5
- data/projects/typesystem/projects/domain/src/domain_module_extension.rb +22 -22
- data/projects/typesystem/projects/domain/src/extensions/foobara.rb +14 -6
- data/projects/typesystem/projects/domain/src/module_extension.rb +4 -4
- data/projects/typesystem/projects/domain/src/organization.rb +6 -6
- data/projects/typesystem/projects/enumerated/src/accessors.rb +4 -4
- data/projects/typesystem/projects/enumerated/src/values.rb +14 -14
- data/projects/{entities → typesystem}/projects/model/lib/foobara/model.rb +1 -1
- data/projects/{entities → typesystem}/projects/model/src/concerns/classes.rb +4 -4
- data/projects/{entities → typesystem}/projects/model/src/concerns/types.rb +5 -5
- data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/casters/hash.rb +1 -1
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +2 -2
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/model_class_desugarizer.rb +6 -6
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/to_type_transformer.rb +4 -4
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration.rb +2 -2
- data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/registered_type_declaration/model_class_desugarizer.rb +6 -10
- data/projects/{entities → typesystem}/projects/model/src/model.rb +13 -13
- data/projects/{entities → typesystem}/projects/model/src/sensitive_value_removers/model.rb +1 -1
- data/projects/typesystem/projects/namespace/src/ambiguous_registry.rb +5 -5
- data/projects/typesystem/projects/namespace/src/base_registry.rb +8 -8
- data/projects/typesystem/projects/namespace/src/is_namespace.rb +19 -19
- data/projects/typesystem/projects/namespace/src/namespace/lookup_mode.rb +2 -2
- data/projects/typesystem/projects/namespace/src/namespace.rb +5 -5
- data/projects/typesystem/projects/namespace/src/namespace_helpers.rb +4 -4
- data/projects/typesystem/projects/namespace/src/prefixless_registry.rb +3 -3
- data/projects/typesystem/projects/namespace/src/scoped.rb +7 -7
- data/projects/typesystem/projects/project/src/foobara.rb +13 -7
- data/projects/typesystem/projects/project/src/project.rb +1 -1
- data/projects/typesystem/projects/state_machine/src/callbacks.rb +14 -14
- data/projects/typesystem/projects/state_machine/src/state_machine.rb +2 -2
- data/projects/typesystem/projects/state_machine/src/sugar.rb +3 -3
- data/projects/typesystem/projects/type_declarations/lib/foobara/type_declarations.rb +1 -1
- data/projects/typesystem/projects/type_declarations/src/attributes.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/from_yaml.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/only.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/reject.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/attributes_transformers/set.rb +4 -4
- data/projects/typesystem/projects/type_declarations/src/desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/dsl/attributes.rb +9 -9
- data/projects/typesystem/projects/type_declarations/src/error_extension.rb +6 -6
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/array_desugarizer.rb +3 -3
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/element_type_declaration_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_array_type_declaration/type_set_to_array_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_attributes_type_declaration/element_type_declarations_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_registered_type_declaration/to_type_transformer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_registered_type_declaration.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/extend_tuple_type_declaration/array_desugarizer.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/handlers/registered_type_declaration.rb +4 -3
- data/projects/typesystem/projects/type_declarations/src/remove_sensitive_values_transformer.rb +3 -3
- data/projects/typesystem/projects/type_declarations/src/type_builder.rb +5 -5
- data/projects/typesystem/projects/type_declarations/src/type_declaration.rb +7 -1
- data/projects/typesystem/projects/type_declarations/src/type_declaration_handler.rb +13 -13
- data/projects/typesystem/projects/type_declarations/src/type_declaration_handler_registry.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/type_declaration_validator.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/type_declarations.rb +2 -2
- data/projects/typesystem/projects/type_declarations/src/with_registries.rb +2 -2
- data/projects/typesystem/projects/types/lib/foobara/types.rb +0 -2
- data/projects/typesystem/projects/types/src/extensions/error.rb +5 -5
- data/projects/typesystem/projects/types/src/type/concerns/reflection.rb +22 -22
- data/projects/typesystem/projects/types/src/type/concerns/supported_processor_registration.rb +4 -4
- data/projects/typesystem/projects/types/src/type.rb +25 -25
- data/projects/typesystem/projects/value/src/caster.rb +11 -11
- data/projects/typesystem/projects/value/src/data_error.rb +1 -1
- data/projects/typesystem/projects/value/src/mutator.rb +3 -3
- data/projects/typesystem/projects/value/src/processor/casting.rb +6 -6
- data/projects/typesystem/projects/value/src/processor/pipeline.rb +2 -2
- data/projects/typesystem/projects/value/src/processor/runner.rb +1 -1
- data/projects/typesystem/projects/value/src/processor/selection.rb +3 -3
- data/projects/typesystem/projects/value/src/processor.rb +23 -23
- data/projects/typesystem/projects/value/src/transformer.rb +5 -5
- data/projects/typesystem/projects/value/src/validator.rb +3 -3
- data/version.rb +2 -2
- metadata +44 -160
- data/projects/command_connectors/Guardfile +0 -6
- data/projects/command_connectors/spec/allowed_rules_spec.rb +0 -77
- data/projects/command_connectors/spec/ambiguous_lookups_spec.rb +0 -143
- data/projects/command_connectors/spec/auth_mappers_spec.rb +0 -201
- data/projects/command_connectors/spec/command_connector_spec.rb +0 -2460
- data/projects/command_connectors/spec/command_registry_spec.rb +0 -9
- data/projects/command_connectors/spec/commands/describe_spec.rb +0 -83
- data/projects/command_connectors/spec/commands/ping_spec.rb +0 -14
- data/projects/command_connectors/spec/commands/query_git_commit_info_spec.rb +0 -55
- data/projects/command_connectors/spec/fixtures/command_connectors/manifest_with_errors_with_missing_command_parents.yaml +0 -1662
- data/projects/command_connectors/spec/not_found_error_spec.rb +0 -17
- data/projects/command_connectors/spec/pre_commit_transformers/load_atoms_pre_commit_transformer_spec.rb +0 -108
- data/projects/command_connectors/spec/request_spec.rb +0 -118
- data/projects/command_connectors/spec/serializer_spec.rb +0 -9
- data/projects/command_connectors/spec/serializers/aggregate_serializer_spec.rb +0 -45
- data/projects/command_connectors/spec/serializers/atomic_serializer_spec.rb +0 -68
- data/projects/command_connectors/spec/serializers/entities_to_primary_keys_serializer_spec.rb +0 -36
- data/projects/command_connectors/spec/serializers/json_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/serializers/noop_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/serializers/yaml_serializer_spec.rb +0 -22
- data/projects/command_connectors/spec/spec_helper.rb +0 -56
- data/projects/command_connectors/spec/support/rubyprof.rb +0 -32
- data/projects/command_connectors/spec/support/term_trap.rb +0 -6
- data/projects/command_connectors/spec/transformers/entity_to_primary_key_inputs_transformer_spec.rb +0 -119
- data/projects/entities/Guardfile +0 -6
- data/projects/entities/spec/builtin_types/detached_entity_spec.rb +0 -300
- data/projects/entities/spec/builtin_types/entity_spec.rb +0 -501
- data/projects/entities/spec/builtin_types/model_spec.rb +0 -420
- data/projects/entities/spec/detached_entity/casting_spec.rb +0 -31
- data/projects/entities/spec/entity/concerns/associations_spec.rb +0 -73
- data/projects/entities/spec/entity/concerns/attribute_helpers_spec.rb +0 -220
- data/projects/entities/spec/entity/concerns/callbacks_spec.rb +0 -61
- data/projects/entities/spec/entity/concerns/initialization_spec.rb +0 -213
- data/projects/entities/spec/entity/concerns/mutations_spec.rb +0 -38
- data/projects/entities/spec/entity/concerns/queries_spec.rb +0 -184
- data/projects/entities/spec/entity/entity_spec.rb +0 -240
- data/projects/entities/spec/entity/extending_existing_spec.rb +0 -137
- data/projects/entities/spec/entity/extensions/domain_module_extension_spec.rb +0 -42
- data/projects/entities/spec/entity/from_type_declaration_spec.rb +0 -34
- data/projects/entities/spec/entity/that_owns_spec.rb +0 -243
- data/projects/entities/spec/entity/weak_object_set_spec.rb +0 -91
- data/projects/entities/spec/model/model_spec.rb +0 -135
- data/projects/entities/spec/model/types_spec.rb +0 -397
- data/projects/entities/spec/nested_transactionable/nested_transactionable_spec.rb +0 -67
- data/projects/entities/spec/persistence/entity_attributes_crud_drivers/in_memory_minimal_spec.rb +0 -13
- data/projects/entities/spec/persistence/entity_base/transaction_spec.rb +0 -509
- data/projects/entities/spec/persistence/entity_base/transaction_table_spec.rb +0 -58
- data/projects/entities/spec/persistence/persistence_spec.rb +0 -148
- data/projects/entities/spec/spec_helper.rb +0 -54
- data/projects/entities/spec/support/rubyprof.rb +0 -32
- data/projects/entities/spec/support/term_trap.rb +0 -6
- data/projects/entities/spec/type_declarations/sensitive_type_removers_spec.rb +0 -90
- data/projects/entities_plumbing/Guardfile +0 -6
- data/projects/entities_plumbing/spec/auth_mappers_spec.rb +0 -159
- data/projects/entities_plumbing/spec/spec_helper.rb +0 -55
- data/projects/entities_plumbing/spec/support/rubyprof.rb +0 -32
- data/projects/entities_plumbing/spec/support/term_trap.rb +0 -6
- data/projects/entities_plumbing/spec/transaction_spec.rb +0 -534
- data/projects/manifest/Guardfile +0 -6
- data/projects/manifest/spec/associations_spec.rb +0 -67
- data/projects/manifest/spec/manifest_spec.rb +0 -382
- data/projects/manifest/spec/model_spec.rb +0 -126
- data/projects/manifest/spec/spec_helper.rb +0 -54
- data/projects/manifest/spec/type_declaration_spec.rb +0 -39
- data/projects/manifest/spec/type_spec.rb +0 -30
- data/projects/typesystem/spec/builtin_types/allow_nil_spec.rb +0 -138
- data/projects/typesystem/spec/builtin_types/array_spec.rb +0 -140
- data/projects/typesystem/spec/builtin_types/associative_array_spec.rb +0 -228
- data/projects/typesystem/spec/builtin_types/attributes_spec.rb +0 -490
- data/projects/typesystem/spec/builtin_types/big_decimal_spec.rb +0 -42
- data/projects/typesystem/spec/builtin_types/boolean_spec.rb +0 -43
- data/projects/typesystem/spec/builtin_types/class_type_desugarizer_spec.rb +0 -17
- data/projects/typesystem/spec/builtin_types/custom_type_spec.rb +0 -430
- data/projects/typesystem/spec/builtin_types/date_spec.rb +0 -37
- data/projects/typesystem/spec/builtin_types/datetime_spec.rb +0 -49
- data/projects/typesystem/spec/builtin_types/email_spec.rb +0 -44
- data/projects/typesystem/spec/builtin_types/float_spec.rb +0 -59
- data/projects/typesystem/spec/builtin_types/instance_of_spec.rb +0 -75
- data/projects/typesystem/spec/builtin_types/one_of_spec.rb +0 -73
- data/projects/typesystem/spec/builtin_types/string_spec.rb +0 -117
- data/projects/typesystem/spec/builtin_types/symbol_spec.rb +0 -24
- data/projects/typesystem/spec/builtin_types/tuple_spec.rb +0 -125
- data/projects/typesystem/spec/callback/callback_spec.rb +0 -155
- data/projects/typesystem/spec/callback/registry/conditioned_spec.rb +0 -152
- data/projects/typesystem/spec/callback/registry/multiple_action_spec.rb +0 -144
- data/projects/typesystem/spec/callback/registry/single_action_spec.rb +0 -114
- data/projects/typesystem/spec/common/data_path_spec.rb +0 -268
- data/projects/typesystem/spec/common/error_collection_spec.rb +0 -77
- data/projects/typesystem/spec/common/error_key_spec.rb +0 -56
- data/projects/typesystem/spec/common/outcome_spec.rb +0 -65
- data/projects/typesystem/spec/common/possible_error_spec.rb +0 -17
- data/projects/typesystem/spec/concerns/concern_spec.rb +0 -122
- data/projects/typesystem/spec/enumerated/accessors_spec.rb +0 -182
- data/projects/typesystem/spec/enumerated/enumerated_spec.rb +0 -32
- data/projects/typesystem/spec/enumerated/values_spec.rb +0 -67
- data/projects/typesystem/spec/foobara/foobara_spec.rb +0 -45
- data/projects/typesystem/spec/namespace/ambiguous_registry_spec.rb +0 -70
- data/projects/typesystem/spec/namespace/foobara_simulation_spec.rb +0 -254
- data/projects/typesystem/spec/namespace/is_namespace_spec.rb +0 -103
- data/projects/typesystem/spec/namespace/namespace_helpers_spec.rb +0 -67
- data/projects/typesystem/spec/namespace/namespace_spec.rb +0 -335
- data/projects/typesystem/spec/namespace/prefixless_registry_spec.rb +0 -30
- data/projects/typesystem/spec/namespace/unambiguous_registry_spec.rb +0 -50
- data/projects/typesystem/spec/spec_helper.rb +0 -52
- data/projects/typesystem/spec/state_machine/callbacks_spec.rb +0 -144
- data/projects/typesystem/spec/state_machine/state_machine_spec.rb +0 -224
- data/projects/typesystem/spec/state_machine/target_attribute_spec.rb +0 -46
- data/projects/typesystem/spec/support/rubyprof.rb +0 -32
- data/projects/typesystem/spec/support/term_trap.rb +0 -6
- data/projects/typesystem/spec/type_declarations/attributes_spec.rb +0 -14
- data/projects/typesystem/spec/type_declarations/attributes_transformer_spec.rb +0 -95
- data/projects/typesystem/spec/type_declarations/dsl/attributes_spec.rb +0 -107
- data/projects/typesystem/spec/type_declarations/handlers/extend_registered_type_declaration_spec.rb +0 -13
- data/projects/typesystem/spec/type_declarations/sensitive_type_removers_spec.rb +0 -210
- data/projects/typesystem/spec/type_declarations/type_builder_spec.rb +0 -47
- data/projects/typesystem/spec/type_declarations/type_declaration_spec.rb +0 -252
- data/projects/typesystem/spec/type_declarations/type_declarations_spec.rb +0 -11
- data/projects/typesystem/spec/type_declarations/typed_transformer_spec.rb +0 -65
- data/projects/typesystem/spec/types/sensitive_spec.rb +0 -36
- data/projects/typesystem/spec/types/type_spec.rb +0 -102
- data/projects/typesystem/spec/value/caster_spec.rb +0 -23
- data/projects/typesystem/spec/value/processor/runner_spec.rb +0 -34
- data/projects/typesystem/spec/value/processor/selection_spec.rb +0 -71
- data/projects/typesystem/spec/value/processor_spec.rb +0 -76
- data/projects/typesystem/spec/value/transformer_spec.rb +0 -27
- /data/projects/{command/src → entities_plumbing/src/extensions}/command_pattern_implementation/concerns/transactions.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/concerns/aliases.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/concerns/reflection.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/supported_transformers/mutable.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/builtin_types/model/validators/model_instance_is_valid.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/array_with_symbolic_elements.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/delegates_validator.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/hash_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/move_private_from_element_types_to_root.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/symbolize_private.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/valid_attribute_names.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/hash_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/model_class_type_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/mutable_validator.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/normalize_mutable_attributes_desugarizer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/handlers/extend_registered_model_type_declaration/to_type_transformer.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/extensions/type_declarations/lazy_element_types/model.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/sensitive_type_removers/extended_model.rb +0 -0
- /data/projects/{entities → typesystem}/projects/model/src/sensitive_type_removers/model.rb +0 -0
|
@@ -66,18 +66,23 @@ module Foobara
|
|
|
66
66
|
unless o.foobara_root_namespace == command_registry
|
|
67
67
|
next
|
|
68
68
|
end
|
|
69
|
-
elsif o.is_a?(::Class)
|
|
70
|
-
|
|
69
|
+
elsif o.is_a?(::Class)
|
|
70
|
+
if o < Foobara::Command
|
|
71
|
+
next
|
|
72
|
+
elsif o < Foobara::Value::Processor
|
|
73
|
+
full_domain_name = o.foobara_domain.scoped_full_name
|
|
74
|
+
exposed_domain = command_registry.create_exposed_domain_if_needed(full_domain_name)
|
|
75
|
+
additional_to_include << exposed_domain
|
|
76
|
+
end
|
|
71
77
|
end
|
|
72
78
|
elsif o.is_a?(Types::Type)
|
|
73
79
|
if o.sensitive?
|
|
74
|
-
# :
|
|
80
|
+
# simplecov:disable
|
|
75
81
|
raise UnexpectedSensitiveTypeInManifestError,
|
|
76
82
|
"Unexpected sensitive type in manifest: #{o.scoped_full_path}. " \
|
|
77
83
|
"Make sure these are not included."
|
|
78
|
-
# :
|
|
84
|
+
# simplecov:enable
|
|
79
85
|
else
|
|
80
|
-
|
|
81
86
|
mode = Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE
|
|
82
87
|
domain_name = o.foobara_domain.scoped_full_name
|
|
83
88
|
|
|
@@ -113,9 +118,9 @@ module Foobara
|
|
|
113
118
|
category_symbol = command_registry.foobara_category_symbol_for(object)
|
|
114
119
|
|
|
115
120
|
unless category_symbol
|
|
116
|
-
# :
|
|
121
|
+
# simplecov:disable
|
|
117
122
|
raise "no category symbol for #{object}"
|
|
118
|
-
# :
|
|
123
|
+
# simplecov:enable
|
|
119
124
|
end
|
|
120
125
|
|
|
121
126
|
namespace = if object.is_a?(Types::Type)
|
|
@@ -154,26 +159,67 @@ module Foobara
|
|
|
154
159
|
root_manifest = Manifest::RootManifest.new(manifest_hash)
|
|
155
160
|
|
|
156
161
|
error_category = {}
|
|
162
|
+
reference_to_category = {}
|
|
163
|
+
|
|
164
|
+
# The only thing we can scope to an org is a domain so leaving :organization out
|
|
165
|
+
[
|
|
166
|
+
:command,
|
|
167
|
+
:domain,
|
|
168
|
+
:type,
|
|
169
|
+
:error,
|
|
170
|
+
:processor,
|
|
171
|
+
:processor_class
|
|
172
|
+
].each do |category|
|
|
173
|
+
root_manifest.relevant_manifest[category]&.each_key do |key|
|
|
174
|
+
reference_to_category[key.to_s] = category
|
|
175
|
+
end
|
|
176
|
+
end
|
|
157
177
|
|
|
158
178
|
root_manifest.errors.each do |error|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
179
|
+
# TODO: let's deprecate parent_name and use parent_path instead.
|
|
180
|
+
error_manifest = if root_manifest.contains?(error.parent_name, error.parent_category) &&
|
|
181
|
+
root_manifest.contains?(error[:domain], :domain) &&
|
|
182
|
+
root_manifest.contains?(error.parent[:domain], :domain)
|
|
183
|
+
|
|
184
|
+
error.relevant_manifest
|
|
185
|
+
else
|
|
186
|
+
parent = nil
|
|
187
|
+
|
|
188
|
+
fixed_scoped_path = error.scoped_path.dup
|
|
189
|
+
parent_path = error.scoped_full_path[..-(fixed_scoped_path.size + 1)]
|
|
190
|
+
|
|
191
|
+
loop do
|
|
192
|
+
fixed_scoped_path.unshift(parent_path.pop)
|
|
193
|
+
parent_name = parent_path.join("::")
|
|
194
|
+
|
|
195
|
+
if parent_path.empty?
|
|
196
|
+
parent = root_manifest.global_domain
|
|
197
|
+
break
|
|
198
|
+
elsif reference_to_category.include?(parent_name)
|
|
199
|
+
possible_parent = root_manifest.lookup(parent_name)
|
|
200
|
+
|
|
201
|
+
if root_manifest.contains?(possible_parent[:domain], :domain)
|
|
202
|
+
parent = possible_parent
|
|
203
|
+
break
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
fixed_parent = parent.manifest_path
|
|
209
|
+
fixed_domain = parent[:domain]
|
|
210
|
+
fixed_organization = parent[:organization]
|
|
163
211
|
|
|
164
|
-
fixed_scoped_path = error.scoped_full_path[index..]
|
|
165
|
-
fixed_scoped_name = fixed_scoped_path.join("::")
|
|
166
212
|
fixed_scoped_prefix = fixed_scoped_path[..-2]
|
|
167
|
-
|
|
213
|
+
fixed_scoped_name = fixed_scoped_path.join("::")
|
|
168
214
|
|
|
169
215
|
error.relevant_manifest.merge(
|
|
170
216
|
parent: fixed_parent,
|
|
171
217
|
scoped_path: fixed_scoped_path,
|
|
172
218
|
scoped_name: fixed_scoped_name,
|
|
173
|
-
scoped_prefix: fixed_scoped_prefix
|
|
219
|
+
scoped_prefix: fixed_scoped_prefix,
|
|
220
|
+
domain: fixed_domain,
|
|
221
|
+
organization: fixed_organization
|
|
174
222
|
)
|
|
175
|
-
else
|
|
176
|
-
error.relevant_manifest
|
|
177
223
|
end
|
|
178
224
|
|
|
179
225
|
error_category[error.scoped_full_name.to_sym] = error_manifest
|
|
@@ -26,9 +26,9 @@ module Foobara
|
|
|
26
26
|
invalid_keys = opts.keys - valid_keys
|
|
27
27
|
|
|
28
28
|
unless invalid_keys.empty?
|
|
29
|
-
# :
|
|
29
|
+
# simplecov:disable
|
|
30
30
|
raise ArgumentError, "invalid keys: #{invalid_keys} expected only #{valid_keys}"
|
|
31
|
-
# :
|
|
31
|
+
# simplecov:enable
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
self.inputs = opts[:inputs] if opts.key?(:inputs)
|
|
@@ -50,7 +50,13 @@ module Foobara
|
|
|
50
50
|
|
|
51
51
|
def authenticate
|
|
52
52
|
return if error
|
|
53
|
-
return unless
|
|
53
|
+
return unless requires_authentication? || authentication_optional?
|
|
54
|
+
|
|
55
|
+
unless authenticator
|
|
56
|
+
raise CommandConnector::NoAuthenticatorGivenError,
|
|
57
|
+
"Running a #{command_class.full_command_name} via #{command_connector} " \
|
|
58
|
+
"requires an authenticator but this connector does not have one"
|
|
59
|
+
end
|
|
54
60
|
|
|
55
61
|
authenticated_user, authenticated_credential = authenticator.authenticate(self)
|
|
56
62
|
|
|
@@ -58,11 +64,21 @@ module Foobara
|
|
|
58
64
|
self.authenticated_user = authenticated_user
|
|
59
65
|
self.authenticated_credential = authenticated_credential
|
|
60
66
|
|
|
67
|
+
return unless requires_authentication?
|
|
68
|
+
|
|
61
69
|
unless authenticated_user
|
|
62
70
|
self.error = CommandConnector::UnauthenticatedError.new
|
|
63
71
|
end
|
|
64
72
|
end
|
|
65
73
|
|
|
74
|
+
def authentication_optional?
|
|
75
|
+
command_class.respond_to?(:authentication_optional) && command_class.authentication_optional
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def requires_authentication?
|
|
79
|
+
command_class.respond_to?(:requires_authentication) && command_class.requires_authentication
|
|
80
|
+
end
|
|
81
|
+
|
|
66
82
|
def auth_mapped_method?(method_name)
|
|
67
83
|
auth_mappers&.key?(method_name)
|
|
68
84
|
end
|
|
@@ -87,9 +103,9 @@ module Foobara
|
|
|
87
103
|
if auth_mapped_method?(method_name)
|
|
88
104
|
auth_mapped_value_for(method_name)
|
|
89
105
|
else
|
|
90
|
-
# :
|
|
106
|
+
# simplecov:disable
|
|
91
107
|
super
|
|
92
|
-
# :
|
|
108
|
+
# simplecov:enable
|
|
93
109
|
end
|
|
94
110
|
end
|
|
95
111
|
|
|
@@ -108,7 +124,7 @@ module Foobara
|
|
|
108
124
|
actual_serializers = objects_to_serializers(serializers)
|
|
109
125
|
|
|
110
126
|
@serializer = if actual_serializers.size == 1
|
|
111
|
-
actual_serializers
|
|
127
|
+
actual_serializers[0]
|
|
112
128
|
else
|
|
113
129
|
Value::Processor::Pipeline.new(processors: actual_serializers)
|
|
114
130
|
end
|
|
@@ -191,9 +207,9 @@ module Foobara
|
|
|
191
207
|
klass = Foobara::CommandConnectors::Serializer.serializer_from_symbol(object)
|
|
192
208
|
|
|
193
209
|
unless klass
|
|
194
|
-
# :
|
|
210
|
+
# simplecov:disable
|
|
195
211
|
raise "Could not find serializer for #{object}"
|
|
196
|
-
# :
|
|
212
|
+
# simplecov:enable
|
|
197
213
|
end
|
|
198
214
|
|
|
199
215
|
klass.new(self)
|
|
@@ -201,9 +217,9 @@ module Foobara
|
|
|
201
217
|
if object.respond_to?(:call)
|
|
202
218
|
Value::Transformer.create(transform: object)
|
|
203
219
|
else
|
|
204
|
-
# :
|
|
220
|
+
# simplecov:disable
|
|
205
221
|
raise "Not sure how to convert #{object} into a serializer"
|
|
206
|
-
# :
|
|
222
|
+
# simplecov:enable
|
|
207
223
|
end
|
|
208
224
|
end
|
|
209
225
|
end
|
|
@@ -2,6 +2,7 @@ module Foobara
|
|
|
2
2
|
class CommandConnector
|
|
3
3
|
class UnexpectedSensitiveTypeInManifestError < StandardError; end
|
|
4
4
|
class AlreadyConnectedError < StandardError; end
|
|
5
|
+
class NoAuthenticatorGivenError < StandardError; end
|
|
5
6
|
|
|
6
7
|
include Concerns::Desugarizers
|
|
7
8
|
include Concerns::Reflection
|
|
@@ -39,9 +40,9 @@ module Foobara
|
|
|
39
40
|
authenticator = to_authenticator(*authenticatorish_args)
|
|
40
41
|
|
|
41
42
|
unless authenticator.symbol
|
|
42
|
-
# :
|
|
43
|
+
# simplecov:disable
|
|
43
44
|
raise ArgumentError, "Expected authenticator to have a symbol"
|
|
44
|
-
# :
|
|
45
|
+
# simplecov:enable
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
authenticator_registry[authenticator.symbol] = authenticator
|
|
@@ -51,13 +52,13 @@ module Foobara
|
|
|
51
52
|
def to_authenticator(*args)
|
|
52
53
|
symbol, object = case args.size
|
|
53
54
|
when 1
|
|
54
|
-
[nil, args
|
|
55
|
+
[nil, args[0]]
|
|
55
56
|
when 2
|
|
56
57
|
args
|
|
57
58
|
else
|
|
58
|
-
# :
|
|
59
|
+
# simplecov:disable
|
|
59
60
|
raise ArgumentError, "Expected 1 or 2 arguments, got #{args.size}"
|
|
60
|
-
# :
|
|
61
|
+
# simplecov:enable
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
case object
|
|
@@ -65,17 +66,17 @@ module Foobara
|
|
|
65
66
|
if object < Authenticator
|
|
66
67
|
object.instance
|
|
67
68
|
else
|
|
68
|
-
# :
|
|
69
|
+
# simplecov:disable
|
|
69
70
|
raise ArgumentError, "Expected a class that inherits from Authenticator"
|
|
70
|
-
# :
|
|
71
|
+
# simplecov:enable
|
|
71
72
|
end
|
|
72
73
|
when Authenticator, nil
|
|
73
74
|
object
|
|
74
75
|
when ::String
|
|
75
76
|
if symbol
|
|
76
|
-
# :
|
|
77
|
+
# simplecov:disable
|
|
77
78
|
raise ArgumentError, "Was not expecting a symbol and a string"
|
|
78
|
-
# :
|
|
79
|
+
# simplecov:enable
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
to_authenticator(object.to_sym)
|
|
@@ -83,9 +84,9 @@ module Foobara
|
|
|
83
84
|
authenticator = authenticator_registry[object]
|
|
84
85
|
|
|
85
86
|
unless authenticator
|
|
86
|
-
# :
|
|
87
|
+
# simplecov:disable
|
|
87
88
|
raise "No authenticator found for #{object}"
|
|
88
|
-
# :
|
|
89
|
+
# simplecov:enable
|
|
89
90
|
end
|
|
90
91
|
|
|
91
92
|
authenticator
|
|
@@ -93,11 +94,11 @@ module Foobara
|
|
|
93
94
|
case object.size
|
|
94
95
|
when 0
|
|
95
96
|
# TODO: test this
|
|
96
|
-
# :
|
|
97
|
+
# simplecov:disable
|
|
97
98
|
nil
|
|
98
|
-
# :
|
|
99
|
+
# simplecov:enable
|
|
99
100
|
when 1
|
|
100
|
-
to_authenticator(object
|
|
101
|
+
to_authenticator(object[0])
|
|
101
102
|
else
|
|
102
103
|
authenticators = object.map { |authenticatorish| to_authenticator(authenticatorish) }
|
|
103
104
|
AuthenticatorSelector.new(authenticators:, symbol:)
|
|
@@ -106,9 +107,9 @@ module Foobara
|
|
|
106
107
|
if object.respond_to?(:call)
|
|
107
108
|
Authenticator.new(symbol:, &object)
|
|
108
109
|
else
|
|
109
|
-
# :
|
|
110
|
+
# simplecov:disable
|
|
110
111
|
raise "Not sure how to convert #{object} into an AllowedRule object"
|
|
111
|
-
# :
|
|
112
|
+
# simplecov:enable
|
|
112
113
|
end
|
|
113
114
|
end.tap do |resolved_authenticator|
|
|
114
115
|
if resolved_authenticator
|
|
@@ -133,33 +134,33 @@ module Foobara
|
|
|
133
134
|
size = element_types.size
|
|
134
135
|
|
|
135
136
|
first_required_input = if size == 1
|
|
136
|
-
element_types.keys
|
|
137
|
+
element_types.keys[0]
|
|
137
138
|
elsif size > 1
|
|
138
139
|
declaration = inputs_type&.declaration_data
|
|
139
140
|
required_attribute_names = declaration&.[](:required) || EMPTY_ARRAY
|
|
140
141
|
|
|
141
142
|
if required_attribute_names.size == 1
|
|
142
|
-
required_attribute_names
|
|
143
|
+
required_attribute_names[0]
|
|
143
144
|
else
|
|
144
|
-
# :
|
|
145
|
+
# simplecov:disable
|
|
145
146
|
raise ArgumentError,
|
|
146
147
|
"Ambiguous inputs when trying to use #{object} as a mapper. " \
|
|
147
148
|
"Should have either only 1 input or only 1 required input."
|
|
148
|
-
# :
|
|
149
|
+
# simplecov:enable
|
|
149
150
|
end
|
|
150
151
|
else
|
|
151
|
-
# :
|
|
152
|
+
# simplecov:disable
|
|
152
153
|
raise ArgumentError, "To use a command as a mapper it must take an input to map"
|
|
153
|
-
# :
|
|
154
|
+
# simplecov:enable
|
|
154
155
|
end
|
|
155
156
|
|
|
156
157
|
build_auth_mapper(object.result_type) do |authenticated_user|
|
|
157
158
|
object.run!(first_required_input => authenticated_user)
|
|
158
159
|
end
|
|
159
160
|
else
|
|
160
|
-
# :
|
|
161
|
+
# simplecov:disable
|
|
161
162
|
raise ArgumentError, "not sure how to convert a #{object} to an auth mapper"
|
|
162
|
-
# :
|
|
163
|
+
# simplecov:enable
|
|
163
164
|
end
|
|
164
165
|
when ::Hash
|
|
165
166
|
object => { to:, map: }
|
|
@@ -168,9 +169,9 @@ module Foobara
|
|
|
168
169
|
object => [to, map]
|
|
169
170
|
build_auth_mapper(to, &map)
|
|
170
171
|
else
|
|
171
|
-
# :
|
|
172
|
+
# simplecov:disable
|
|
172
173
|
raise ArgumentError, "Not sure how to convert #{object} to an auth mapper"
|
|
173
|
-
# :
|
|
174
|
+
# simplecov:enable
|
|
174
175
|
end
|
|
175
176
|
end
|
|
176
177
|
|
|
@@ -262,7 +263,7 @@ module Foobara
|
|
|
262
263
|
def connect(*args, **opts)
|
|
263
264
|
args, opts = desugarize_connect_args(args, opts)
|
|
264
265
|
|
|
265
|
-
registerable = args
|
|
266
|
+
registerable = args[0]
|
|
266
267
|
|
|
267
268
|
if opts.key?(:authenticator)
|
|
268
269
|
authenticator = opts[:authenticator]
|
|
@@ -273,9 +274,9 @@ module Foobara
|
|
|
273
274
|
case registerable
|
|
274
275
|
when Class
|
|
275
276
|
unless registerable < Command
|
|
276
|
-
# :
|
|
277
|
+
# simplecov:disable
|
|
277
278
|
raise "Don't know how to register #{registerable} (#{registerable.class})"
|
|
278
|
-
# :
|
|
279
|
+
# simplecov:enable
|
|
279
280
|
end
|
|
280
281
|
|
|
281
282
|
command_registry.register(*args, **opts)
|
|
@@ -299,16 +300,16 @@ module Foobara
|
|
|
299
300
|
|
|
300
301
|
connected.flatten
|
|
301
302
|
else
|
|
302
|
-
# :
|
|
303
|
+
# simplecov:disable
|
|
303
304
|
raise "Don't know how to register #{registerable} (#{registerable.class})"
|
|
304
|
-
# :
|
|
305
|
+
# simplecov:enable
|
|
305
306
|
end
|
|
306
307
|
when Symbol, String
|
|
307
308
|
connect_delayed(*args, **opts)
|
|
308
309
|
else
|
|
309
|
-
# :
|
|
310
|
+
# simplecov:disable
|
|
310
311
|
raise "Don't know how to register #{registerable} (#{registerable.class})"
|
|
311
|
-
# :
|
|
312
|
+
# simplecov:enable
|
|
312
313
|
end
|
|
313
314
|
end
|
|
314
315
|
|
|
@@ -346,15 +347,15 @@ module Foobara
|
|
|
346
347
|
end
|
|
347
348
|
|
|
348
349
|
def add_default_response_mutator(mutator)
|
|
349
|
-
# :
|
|
350
|
+
# simplecov:disable
|
|
350
351
|
command_registry.add_default_response_mutator(mutator)
|
|
351
|
-
# :
|
|
352
|
+
# simplecov:enable
|
|
352
353
|
end
|
|
353
354
|
|
|
354
355
|
def allowed_rule(*)
|
|
355
|
-
# :
|
|
356
|
+
# simplecov:disable
|
|
356
357
|
command_registry.allowed_rule(*)
|
|
357
|
-
# :
|
|
358
|
+
# simplecov:enable
|
|
358
359
|
end
|
|
359
360
|
|
|
360
361
|
def allowed_rules(*)
|
|
@@ -366,9 +367,9 @@ module Foobara
|
|
|
366
367
|
end
|
|
367
368
|
|
|
368
369
|
def each_transformed_command_class(&)
|
|
369
|
-
# :
|
|
370
|
+
# simplecov:disable
|
|
370
371
|
command_registry.each_transformed_command_class(&)
|
|
371
|
-
# :
|
|
372
|
+
# simplecov:enable
|
|
372
373
|
end
|
|
373
374
|
|
|
374
375
|
def all_transformed_command_classes
|
|
@@ -409,9 +410,9 @@ module Foobara
|
|
|
409
410
|
transformed_command_class = transformed_command_from_name(full_command_name)
|
|
410
411
|
|
|
411
412
|
unless transformed_command_class
|
|
412
|
-
# :
|
|
413
|
+
# simplecov:disable
|
|
413
414
|
raise NoCommandFoundError.new(message: "Could not find command registered for #{full_command_name}")
|
|
414
|
-
# :
|
|
415
|
+
# simplecov:enable
|
|
415
416
|
end
|
|
416
417
|
else
|
|
417
418
|
action = case action
|
|
@@ -422,9 +423,9 @@ module Foobara
|
|
|
422
423
|
when "list"
|
|
423
424
|
"list_commands"
|
|
424
425
|
else
|
|
425
|
-
# :
|
|
426
|
+
# simplecov:disable
|
|
426
427
|
raise InvalidContextError.new(message: "Not sure what to do with #{action}")
|
|
427
|
-
# :
|
|
428
|
+
# simplecov:enable
|
|
428
429
|
end
|
|
429
430
|
|
|
430
431
|
command_name = Util.classify(action)
|
|
@@ -456,11 +457,11 @@ module Foobara
|
|
|
456
457
|
end
|
|
457
458
|
|
|
458
459
|
unless manifestable
|
|
459
|
-
# :
|
|
460
|
+
# simplecov:disable
|
|
460
461
|
raise NoCommandOrTypeFoundError.new(
|
|
461
462
|
message: "Could not find command or type registered for #{manifestable_name}"
|
|
462
463
|
)
|
|
463
|
-
# :
|
|
464
|
+
# simplecov:enable
|
|
464
465
|
end
|
|
465
466
|
|
|
466
467
|
request.inputs.merge(manifestable:, request:)
|
|
@@ -468,9 +469,9 @@ module Foobara
|
|
|
468
469
|
transformed_command_class = transformed_command_from_name(full_command_name)
|
|
469
470
|
|
|
470
471
|
unless transformed_command_class
|
|
471
|
-
# :
|
|
472
|
+
# simplecov:disable
|
|
472
473
|
raise NoCommandFoundError.new(message: "Could not find command registered for #{full_command_name}")
|
|
473
|
-
# :
|
|
474
|
+
# simplecov:enable
|
|
474
475
|
end
|
|
475
476
|
|
|
476
477
|
request.inputs.merge(manifestable: transformed_command_class, request:)
|
|
@@ -478,9 +479,9 @@ module Foobara
|
|
|
478
479
|
type = type_from_name(full_command_name)
|
|
479
480
|
|
|
480
481
|
unless type
|
|
481
|
-
# :
|
|
482
|
+
# simplecov:disable
|
|
482
483
|
raise NoTypeFoundError.new(message: "Could not find type registered for #{full_command_name}")
|
|
483
|
-
# :
|
|
484
|
+
# simplecov:enable
|
|
484
485
|
end
|
|
485
486
|
|
|
486
487
|
request.inputs.merge(manifestable: type, request:)
|
|
@@ -493,9 +494,9 @@ module Foobara
|
|
|
493
494
|
when "list"
|
|
494
495
|
request.inputs.merge(request:)
|
|
495
496
|
else
|
|
496
|
-
# :
|
|
497
|
+
# simplecov:disable
|
|
497
498
|
raise InvalidContextError.new(message: "Not sure what to do with #{action}")
|
|
498
|
-
# :
|
|
499
|
+
# simplecov:enable
|
|
499
500
|
end
|
|
500
501
|
end
|
|
501
502
|
|
|
@@ -552,9 +553,9 @@ module Foobara
|
|
|
552
553
|
key = registerable_name.to_s
|
|
553
554
|
|
|
554
555
|
if delayed_connections.key?(key)
|
|
555
|
-
# :
|
|
556
|
+
# simplecov:disable
|
|
556
557
|
raise AlreadyConnectedError, "Already connected #{key}"
|
|
557
|
-
# :
|
|
558
|
+
# simplecov:enable
|
|
558
559
|
else
|
|
559
560
|
delayed_connections[key] = { args:, opts: }
|
|
560
561
|
end
|
|
@@ -583,9 +584,9 @@ module Foobara
|
|
|
583
584
|
self.class.desugarizer.process_value!([args, opts])
|
|
584
585
|
else
|
|
585
586
|
# TODO: test this code path by removing all desugarizers in a spec.
|
|
586
|
-
# :
|
|
587
|
+
# simplecov:disable
|
|
587
588
|
[args, opts]
|
|
588
|
-
# :
|
|
589
|
+
# simplecov:enable
|
|
589
590
|
end
|
|
590
591
|
end
|
|
591
592
|
|
|
@@ -601,7 +602,10 @@ module Foobara
|
|
|
601
602
|
command_class = determine_command_class(request)
|
|
602
603
|
request.command_class = command_class
|
|
603
604
|
|
|
604
|
-
|
|
605
|
+
requires_auth = command_class.respond_to?(:requires_authentication) && command_class.requires_authentication
|
|
606
|
+
optional_auth = command_class.respond_to?(:authentication_optional) && command_class.authentication_optional
|
|
607
|
+
|
|
608
|
+
if requires_auth || optional_auth
|
|
605
609
|
request.authenticator ||= command_class.authenticator || authenticator
|
|
606
610
|
|
|
607
611
|
if auth_map
|
|
@@ -625,10 +629,10 @@ module Foobara
|
|
|
625
629
|
unless request.error
|
|
626
630
|
if command
|
|
627
631
|
run_command(request)
|
|
628
|
-
# :
|
|
632
|
+
# simplecov:disable
|
|
629
633
|
else
|
|
630
634
|
raise "No command returned from #request_to_command"
|
|
631
|
-
# :
|
|
635
|
+
# simplecov:enable
|
|
632
636
|
end
|
|
633
637
|
end
|
|
634
638
|
end
|
|
@@ -16,6 +16,7 @@ module Foobara
|
|
|
16
16
|
:response_mutators,
|
|
17
17
|
:allowed_rule,
|
|
18
18
|
:requires_authentication,
|
|
19
|
+
:authentication_optional,
|
|
19
20
|
:authenticator,
|
|
20
21
|
:scoped_path
|
|
21
22
|
|
|
@@ -33,6 +34,7 @@ module Foobara
|
|
|
33
34
|
serializers: nil,
|
|
34
35
|
allowed_rule: nil,
|
|
35
36
|
requires_authentication: nil,
|
|
37
|
+
authentication_optional: nil,
|
|
36
38
|
authenticator: nil,
|
|
37
39
|
aggregate_entities: nil,
|
|
38
40
|
atomic_entities: nil
|
|
@@ -103,6 +105,7 @@ module Foobara
|
|
|
103
105
|
self.serializers = serializers
|
|
104
106
|
self.allowed_rule = allowed_rule
|
|
105
107
|
self.requires_authentication = requires_authentication
|
|
108
|
+
self.authentication_optional = authentication_optional
|
|
106
109
|
self.authenticator = authenticator
|
|
107
110
|
|
|
108
111
|
# A bit hacky... we should check if we need to shim in a LoadDelegatedAttributesEntitiesPreCommitTransformer
|
|
@@ -161,6 +164,7 @@ module Foobara
|
|
|
161
164
|
serializers,
|
|
162
165
|
allowed_rule,
|
|
163
166
|
requires_authentication,
|
|
167
|
+
authentication_optional,
|
|
164
168
|
authenticator,
|
|
165
169
|
result_has_sensitive_types?
|
|
166
170
|
]
|
|
@@ -182,6 +186,7 @@ module Foobara
|
|
|
182
186
|
serializers:,
|
|
183
187
|
allowed_rule:,
|
|
184
188
|
requires_authentication:,
|
|
189
|
+
authentication_optional:,
|
|
185
190
|
authenticator:
|
|
186
191
|
)
|
|
187
192
|
end
|
|
@@ -196,10 +201,10 @@ module Foobara
|
|
|
196
201
|
if result_type.nil?
|
|
197
202
|
false
|
|
198
203
|
elsif result_type.sensitive?
|
|
199
|
-
# :
|
|
204
|
+
# simplecov:disable
|
|
200
205
|
# TODO: we should convert it to nil I suppose
|
|
201
206
|
raise "Not sure yet how to handle a sensitive result type hmmmm..."
|
|
202
|
-
# :
|
|
207
|
+
# simplecov:enable
|
|
203
208
|
else
|
|
204
209
|
command_class.result_type.has_sensitive_types?
|
|
205
210
|
end
|