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
|
@@ -32,21 +32,21 @@ module Foobara
|
|
|
32
32
|
|
|
33
33
|
def find_tracked(record_id)
|
|
34
34
|
unless record_id
|
|
35
|
-
# :
|
|
35
|
+
# simplecov:disable
|
|
36
36
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
37
|
-
# :
|
|
37
|
+
# simplecov:enable
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
if record_id.is_a?(::String) && record_id.empty?
|
|
41
|
-
# :
|
|
41
|
+
# simplecov:disable
|
|
42
42
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
43
|
-
# :
|
|
43
|
+
# simplecov:enable
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
if record_id.is_a?(::Symbol) && record_id.to_s.empty?
|
|
47
|
-
# :
|
|
47
|
+
# simplecov:disable
|
|
48
48
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
49
|
-
# :
|
|
49
|
+
# simplecov:enable
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
tracked_records.find_by_key(record_id)
|
|
@@ -66,33 +66,33 @@ module Foobara
|
|
|
66
66
|
|
|
67
67
|
def load(entity_or_record_id)
|
|
68
68
|
if entity_or_record_id.nil?
|
|
69
|
-
# :
|
|
69
|
+
# simplecov:disable
|
|
70
70
|
raise "Expected a record or record primary key but received nil"
|
|
71
|
-
# :
|
|
71
|
+
# simplecov:enable
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
if entity_or_record_id.is_a?(Entity)
|
|
75
75
|
entity = if entity_or_record_id.persisted?
|
|
76
76
|
unless entity_or_record_id.primary_key
|
|
77
|
-
# :
|
|
77
|
+
# simplecov:disable
|
|
78
78
|
raise "Did not expect a record to be persisted but have no primary key"
|
|
79
|
-
# :
|
|
79
|
+
# simplecov:enable
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
tracked_records.find_by_key(entity_or_record_id.primary_key)
|
|
83
83
|
else
|
|
84
|
-
# :
|
|
84
|
+
# simplecov:disable
|
|
85
85
|
raise "Cannot load an unpersisted record!"
|
|
86
|
-
# :
|
|
86
|
+
# simplecov:enable
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
# rubocop:disable Lint/IdentityComparison
|
|
90
90
|
if entity &&
|
|
91
91
|
(!entity.equal?(entity_or_record_id) || entity.object_id != entity_or_record_id.object_id)
|
|
92
|
-
# :
|
|
92
|
+
# simplecov:disable
|
|
93
93
|
raise "This transaction is already tracking a different entity with the same primary key." \
|
|
94
94
|
"Try passing in the primary key instead of constructing an unloaded entity to pass in."
|
|
95
|
-
# :
|
|
95
|
+
# simplecov:enable
|
|
96
96
|
end
|
|
97
97
|
# rubocop:enable Lint/IdentityComparison
|
|
98
98
|
|
|
@@ -101,27 +101,27 @@ module Foobara
|
|
|
101
101
|
record_id = entity_or_record_id
|
|
102
102
|
|
|
103
103
|
if record_id.is_a?(::Hash)
|
|
104
|
-
# :
|
|
104
|
+
# simplecov:disable
|
|
105
105
|
raise ArgumentError, "Unlikely that you meant to use a hash as a primary key"
|
|
106
|
-
# :
|
|
106
|
+
# simplecov:enable
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
unless record_id
|
|
110
|
-
# :
|
|
110
|
+
# simplecov:disable
|
|
111
111
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
112
|
-
# :
|
|
112
|
+
# simplecov:enable
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
if record_id.is_a?(::String) && record_id.empty?
|
|
116
|
-
# :
|
|
116
|
+
# simplecov:disable
|
|
117
117
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
118
|
-
# :
|
|
118
|
+
# simplecov:enable
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
if record_id.is_a?(::Symbol) && record_id.to_s.empty?
|
|
122
|
-
# :
|
|
122
|
+
# simplecov:disable
|
|
123
123
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
124
|
-
# :
|
|
124
|
+
# simplecov:enable
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
entity = tracked_records.find_by_key(record_id)
|
|
@@ -136,9 +136,9 @@ module Foobara
|
|
|
136
136
|
attributes = normalize_attributes(entity_attributes_crud_driver_table.find!(record_id))
|
|
137
137
|
|
|
138
138
|
unless attributes
|
|
139
|
-
# :
|
|
139
|
+
# simplecov:disable
|
|
140
140
|
raise NoRecordFound, "could not find record for #{entity_class.full_entity_name}:#{record_id}"
|
|
141
|
-
# :
|
|
141
|
+
# simplecov:enable
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
entity.successfully_loaded(attributes)
|
|
@@ -147,9 +147,9 @@ module Foobara
|
|
|
147
147
|
attributes = normalize_attributes(entity_attributes_crud_driver_table.find!(record_id))
|
|
148
148
|
|
|
149
149
|
unless attributes
|
|
150
|
-
# :
|
|
150
|
+
# simplecov:disable
|
|
151
151
|
raise NoRecordFound, "could not find record for #{entity_class.full_entity_name}:#{record_id}"
|
|
152
|
-
# :
|
|
152
|
+
# simplecov:enable
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
transaction.loaded(entity_class, attributes)
|
|
@@ -168,23 +168,23 @@ module Foobara
|
|
|
168
168
|
|
|
169
169
|
entity = if entity_or_record_id.persisted?
|
|
170
170
|
unless entity_or_record_id.primary_key
|
|
171
|
-
# :
|
|
171
|
+
# simplecov:disable
|
|
172
172
|
raise "Did not expect a record to be persisted but have no primary key"
|
|
173
|
-
# :
|
|
173
|
+
# simplecov:enable
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
tracked_records.find_by_key(entity_or_record_id.primary_key)
|
|
177
177
|
else
|
|
178
|
-
# :
|
|
178
|
+
# simplecov:disable
|
|
179
179
|
raise "Cannot load an unpersisted record!"
|
|
180
|
-
# :
|
|
180
|
+
# simplecov:enable
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
if entity && !entity.equal?(entity_or_record_id)
|
|
184
|
-
# :
|
|
184
|
+
# simplecov:disable
|
|
185
185
|
raise "This transaction is already tracking a different entity with the same primary key." \
|
|
186
186
|
"Try passing in the primary key instead of constructing an unloaded entity to pass in."
|
|
187
|
-
# :
|
|
187
|
+
# simplecov:enable
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
record_id = entity.primary_key
|
|
@@ -194,28 +194,28 @@ module Foobara
|
|
|
194
194
|
record_id = entity_or_record_id
|
|
195
195
|
|
|
196
196
|
if record_id.is_a?(::Hash)
|
|
197
|
-
# :
|
|
197
|
+
# simplecov:disable
|
|
198
198
|
raise ArgumentError, "Unlikely that you meant to use a hash as a primary key"
|
|
199
|
-
# :
|
|
199
|
+
# simplecov:enable
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
# TODO: encapsulate this record_id verification
|
|
203
203
|
unless record_id
|
|
204
|
-
# :
|
|
204
|
+
# simplecov:disable
|
|
205
205
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
206
|
-
# :
|
|
206
|
+
# simplecov:enable
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
if record_id.is_a?(::String) && record_id.empty?
|
|
210
|
-
# :
|
|
210
|
+
# simplecov:disable
|
|
211
211
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
212
|
-
# :
|
|
212
|
+
# simplecov:enable
|
|
213
213
|
end
|
|
214
214
|
|
|
215
215
|
if record_id.is_a?(::Symbol) && record_id.to_s.empty?
|
|
216
|
-
# :
|
|
216
|
+
# simplecov:disable
|
|
217
217
|
raise ArgumentError, "Cannot use a blank primary key value"
|
|
218
|
-
# :
|
|
218
|
+
# simplecov:enable
|
|
219
219
|
end
|
|
220
220
|
|
|
221
221
|
entity = tracked_records.find_by_key(record_id)
|
|
@@ -323,9 +323,9 @@ module Foobara
|
|
|
323
323
|
# was already considered among tracked records if loaded? is true so do not return it as
|
|
324
324
|
# it has changed and no longer matches
|
|
325
325
|
# TODO: figure out how to test this code path
|
|
326
|
-
# :
|
|
326
|
+
# simplecov:disable
|
|
327
327
|
record = nil
|
|
328
|
-
# :
|
|
328
|
+
# simplecov:enable
|
|
329
329
|
else
|
|
330
330
|
loading(record) do
|
|
331
331
|
record.successfully_loaded(found_attributes)
|
|
@@ -356,9 +356,9 @@ module Foobara
|
|
|
356
356
|
when ::Array, Value::DataPath
|
|
357
357
|
path_filters[attribute_name_or_path] = value
|
|
358
358
|
else
|
|
359
|
-
# :
|
|
359
|
+
# simplecov:disable
|
|
360
360
|
raise "Unexpected filter type: #{attribute_name_or_path.class}"
|
|
361
|
-
# :
|
|
361
|
+
# simplecov:enable
|
|
362
362
|
end
|
|
363
363
|
end
|
|
364
364
|
|
|
@@ -397,9 +397,9 @@ module Foobara
|
|
|
397
397
|
# was already considered among tracked records if loaded? is true so do not return it as
|
|
398
398
|
# it has changed and no longer matches
|
|
399
399
|
# TODO: figure out how to test this code path
|
|
400
|
-
# :
|
|
400
|
+
# simplecov:disable
|
|
401
401
|
record = nil
|
|
402
|
-
# :
|
|
402
|
+
# simplecov:enable
|
|
403
403
|
else
|
|
404
404
|
loading(record) do
|
|
405
405
|
record.successfully_loaded(found_attributes)
|
|
@@ -462,7 +462,7 @@ module Foobara
|
|
|
462
462
|
|
|
463
463
|
if record
|
|
464
464
|
# TODO: test this code path
|
|
465
|
-
# :
|
|
465
|
+
# simplecov:disable
|
|
466
466
|
if record.loaded?
|
|
467
467
|
# was already considered among tracked records if loaded? is true so do not return it as
|
|
468
468
|
# it has changed and no longer matches
|
|
@@ -472,7 +472,7 @@ module Foobara
|
|
|
472
472
|
record.successfully_loaded(found_attributes)
|
|
473
473
|
end
|
|
474
474
|
end
|
|
475
|
-
# :
|
|
475
|
+
# simplecov:enable
|
|
476
476
|
else
|
|
477
477
|
record = entity_class.loaded(found_attributes)
|
|
478
478
|
end
|
|
@@ -526,7 +526,7 @@ module Foobara
|
|
|
526
526
|
|
|
527
527
|
if record
|
|
528
528
|
# TODO: test this code path
|
|
529
|
-
# :
|
|
529
|
+
# simplecov:disable
|
|
530
530
|
if record.loaded?
|
|
531
531
|
# was already considered among tracked records if loaded? is true so do not return it as
|
|
532
532
|
# it has changed and no longer matches
|
|
@@ -536,7 +536,7 @@ module Foobara
|
|
|
536
536
|
record.successfully_loaded(found_attributes)
|
|
537
537
|
end
|
|
538
538
|
end
|
|
539
|
-
# :
|
|
539
|
+
# simplecov:enable
|
|
540
540
|
else
|
|
541
541
|
record = entity_class.loaded(found_attributes)
|
|
542
542
|
end
|
|
@@ -554,9 +554,9 @@ module Foobara
|
|
|
554
554
|
|
|
555
555
|
def track_created(entity)
|
|
556
556
|
if entity.persisted?
|
|
557
|
-
# :
|
|
557
|
+
# simplecov:disable
|
|
558
558
|
raise "Cannot insert #{entity} because it's already persisted."
|
|
559
|
-
# :
|
|
559
|
+
# simplecov:enable
|
|
560
560
|
end
|
|
561
561
|
|
|
562
562
|
created(entity)
|
|
@@ -10,7 +10,7 @@ module Foobara
|
|
|
10
10
|
if existing_transactions.empty?
|
|
11
11
|
block.call
|
|
12
12
|
elsif existing_transactions.size == 1
|
|
13
|
-
existing_transaction = existing_transactions
|
|
13
|
+
existing_transaction = existing_transactions[0]
|
|
14
14
|
|
|
15
15
|
existing_transaction.entity_base.using_transaction(existing_transaction, &block)
|
|
16
16
|
else
|
|
@@ -127,9 +127,9 @@ module Foobara
|
|
|
127
127
|
|
|
128
128
|
def transaction(mode = nil, existing_transaction: nil)
|
|
129
129
|
unless VALID_MODES.include?(mode)
|
|
130
|
-
# :
|
|
130
|
+
# simplecov:disable
|
|
131
131
|
raise ArgumentError, "Mode was #{mode} but expected one of #{VALID_MODES}"
|
|
132
|
-
# :
|
|
132
|
+
# simplecov:enable
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
old_transaction = current_transaction
|
|
@@ -151,16 +151,16 @@ module Foobara
|
|
|
151
151
|
open_nested = true
|
|
152
152
|
elsif mode == :open_new
|
|
153
153
|
if existing_transaction
|
|
154
|
-
# :
|
|
154
|
+
# simplecov:disable
|
|
155
155
|
raise ArgumentError, "Cannot use mode :open_new with existing_transaction:"
|
|
156
|
-
# :
|
|
156
|
+
# simplecov:enable
|
|
157
157
|
end
|
|
158
158
|
else
|
|
159
|
-
# :
|
|
159
|
+
# simplecov:disable
|
|
160
160
|
raise "Transaction already open. " \
|
|
161
161
|
"Use mode :use_existing if you want to make use of the existing transaction. " \
|
|
162
162
|
"Use mode :open_nested if you are actually trying to nest transactions."
|
|
163
|
-
# :
|
|
163
|
+
# simplecov:enable
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
@@ -8,9 +8,9 @@ module Foobara
|
|
|
8
8
|
|
|
9
9
|
def default_crud_driver=(crud_driver)
|
|
10
10
|
if default_crud_driver
|
|
11
|
-
# :
|
|
11
|
+
# simplecov:disable
|
|
12
12
|
raise "Default crud driver already set."
|
|
13
|
-
# :
|
|
13
|
+
# simplecov:enable
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
@default_crud_driver = crud_driver
|
|
@@ -32,13 +32,13 @@ module Foobara
|
|
|
32
32
|
bases = objects_to_bases(objects)
|
|
33
33
|
|
|
34
34
|
if bases.empty?
|
|
35
|
-
# :
|
|
35
|
+
# simplecov:disable
|
|
36
36
|
raise "No bases found for #{objects}"
|
|
37
|
-
# :
|
|
37
|
+
# simplecov:enable
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
if bases.size == 1
|
|
41
|
-
bases.
|
|
41
|
+
bases[0].transaction(mode, &)
|
|
42
42
|
else
|
|
43
43
|
Foobara::TransactionGroup.run(bases:, mode:, &)
|
|
44
44
|
end
|
|
@@ -55,9 +55,9 @@ module Foobara
|
|
|
55
55
|
tx = base.current_transaction
|
|
56
56
|
|
|
57
57
|
unless tx
|
|
58
|
-
# :
|
|
58
|
+
# simplecov:disable
|
|
59
59
|
raise NoTransactionOpenError
|
|
60
|
-
# :
|
|
60
|
+
# simplecov:enable
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
tx
|
|
@@ -75,18 +75,18 @@ module Foobara
|
|
|
75
75
|
bases = to_bases(object)
|
|
76
76
|
|
|
77
77
|
if bases.empty?
|
|
78
|
-
# :
|
|
78
|
+
# simplecov:disable
|
|
79
79
|
raise "Could not find a base for #{object}"
|
|
80
|
-
# :
|
|
80
|
+
# simplecov:enable
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
if bases.size > 1
|
|
84
|
-
# :
|
|
84
|
+
# simplecov:disable
|
|
85
85
|
raise "Expected to only find 1 base for #{object} but found #{bases.size}"
|
|
86
|
-
# :
|
|
86
|
+
# simplecov:enable
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
-
bases
|
|
89
|
+
bases[0]
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def to_bases(object)
|
|
@@ -118,9 +118,9 @@ module Foobara
|
|
|
118
118
|
when Entity
|
|
119
119
|
base_for_entity_class(object.class)
|
|
120
120
|
else
|
|
121
|
-
# :
|
|
121
|
+
# simplecov:disable
|
|
122
122
|
raise ArgumentError, "Not able to convert #{object} to an entity base"
|
|
123
|
-
# :
|
|
123
|
+
# simplecov:enable
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
|
|
@@ -147,30 +147,30 @@ module Foobara
|
|
|
147
147
|
base.register_table(table)
|
|
148
148
|
tables_for_entity_class_name[entity_class_name] = table
|
|
149
149
|
else
|
|
150
|
-
# :
|
|
150
|
+
# simplecov:disable
|
|
151
151
|
raise NoTableOrCrudDriverError,
|
|
152
152
|
"Can't find table for #{entity_class_name} and can't dynamically build one without default crud driver."
|
|
153
|
-
# :
|
|
153
|
+
# simplecov:enable
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
def register_base(*args, name: nil, table_prefix: nil)
|
|
158
158
|
base = case args
|
|
159
159
|
in [EntityBase]
|
|
160
|
-
args
|
|
160
|
+
args[0]
|
|
161
161
|
in [Class => crud_driver_class, *rest] if crud_driver_class < EntityAttributesCrudDriver
|
|
162
162
|
unless name
|
|
163
|
-
# :
|
|
163
|
+
# simplecov:disable
|
|
164
164
|
raise ArgumentError, "Must provide name: when registering a base with a crud driver class"
|
|
165
|
-
# :
|
|
165
|
+
# simplecov:enable
|
|
166
166
|
end
|
|
167
167
|
|
|
168
168
|
crud_args, opts = case rest
|
|
169
169
|
in [Hash]
|
|
170
170
|
# TODO: test this code path
|
|
171
|
-
# :
|
|
171
|
+
# simplecov:disable
|
|
172
172
|
[[], rest]
|
|
173
|
-
# :
|
|
173
|
+
# simplecov:enable
|
|
174
174
|
in [] | [Array] | [Array, Hash]
|
|
175
175
|
rest
|
|
176
176
|
in Array
|
|
@@ -197,9 +197,9 @@ module Foobara
|
|
|
197
197
|
missing = bases - sorted_bases
|
|
198
198
|
|
|
199
199
|
unless missing.empty?
|
|
200
|
-
# :
|
|
200
|
+
# simplecov:disable
|
|
201
201
|
raise ArgumentError, "Missing bases: #{missing} are the not registered or something?"
|
|
202
|
-
# :
|
|
202
|
+
# simplecov:enable
|
|
203
203
|
# sorted_bases = [*missing, *sorted_bases]
|
|
204
204
|
end
|
|
205
205
|
|
|
@@ -16,9 +16,9 @@ module Foobara
|
|
|
16
16
|
|
|
17
17
|
def cleanup_proc
|
|
18
18
|
if deactivated?
|
|
19
|
-
# :
|
|
19
|
+
# simplecov:disable
|
|
20
20
|
raise "GarbageCleaner has been deactivated"
|
|
21
|
-
# :
|
|
21
|
+
# simplecov:enable
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
@cleanup_proc ||= begin
|
|
@@ -29,9 +29,9 @@ module Foobara
|
|
|
29
29
|
begin
|
|
30
30
|
queue.push(object_id)
|
|
31
31
|
rescue ClosedQueueError
|
|
32
|
-
# :
|
|
32
|
+
# simplecov:disable
|
|
33
33
|
deactivate
|
|
34
|
-
# :
|
|
34
|
+
# simplecov:enable
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -50,9 +50,9 @@ module Foobara
|
|
|
50
50
|
self.queue = nil
|
|
51
51
|
break
|
|
52
52
|
else
|
|
53
|
-
# :
|
|
53
|
+
# simplecov:disable
|
|
54
54
|
raise "Unexpected nil value in the queue"
|
|
55
|
-
# :
|
|
55
|
+
# simplecov:enable
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -101,9 +101,9 @@ module Foobara
|
|
|
101
101
|
object = begin
|
|
102
102
|
ref&.__getobj__
|
|
103
103
|
rescue WeakRef::RefError
|
|
104
|
-
# :
|
|
104
|
+
# simplecov:disable
|
|
105
105
|
nil
|
|
106
|
-
# :
|
|
106
|
+
# simplecov:enable
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
if ref&.weakref_alive?
|
|
@@ -159,9 +159,9 @@ module Foobara
|
|
|
159
159
|
|
|
160
160
|
def <<(object)
|
|
161
161
|
if closed?
|
|
162
|
-
# :
|
|
162
|
+
# simplecov:disable
|
|
163
163
|
raise "Cannot add objects to a closed WeakObjectSet"
|
|
164
|
-
# :
|
|
164
|
+
# simplecov:enable
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
object_id = object.object_id
|
|
@@ -171,7 +171,7 @@ module Foobara
|
|
|
171
171
|
|
|
172
172
|
if existing_object
|
|
173
173
|
if key_method
|
|
174
|
-
key = object.
|
|
174
|
+
key = object.__send__(key_method)
|
|
175
175
|
old_key = object_id_to_key[object_id]
|
|
176
176
|
|
|
177
177
|
if key != old_key
|
|
@@ -189,7 +189,7 @@ module Foobara
|
|
|
189
189
|
garbage_cleaner.track(object)
|
|
190
190
|
|
|
191
191
|
if key_method
|
|
192
|
-
key = object.
|
|
192
|
+
key = object.__send__(key_method)
|
|
193
193
|
|
|
194
194
|
if key
|
|
195
195
|
existing_record_object_id = key_to_object_id[key]
|
|
@@ -197,9 +197,9 @@ module Foobara
|
|
|
197
197
|
if existing_record_object_id
|
|
198
198
|
# Sometimes this path is hit in the test suite and sometimes not, depending on
|
|
199
199
|
# non-deterministic behavior of the garbage collector
|
|
200
|
-
# :
|
|
200
|
+
# simplecov:disable
|
|
201
201
|
delete(existing_record_object_id)
|
|
202
|
-
# :
|
|
202
|
+
# simplecov:enable
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
key_to_object_id[key] = object_id
|
|
@@ -237,9 +237,9 @@ module Foobara
|
|
|
237
237
|
def find_by_key(key)
|
|
238
238
|
monitor.synchronize do
|
|
239
239
|
unless key_method
|
|
240
|
-
# :
|
|
240
|
+
# simplecov:disable
|
|
241
241
|
raise "Cannot find by key if there was no key_method given."
|
|
242
|
-
# :
|
|
242
|
+
# simplecov:enable
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
object_id = key_to_object_id[key]
|
|
@@ -2,12 +2,16 @@ module Foobara
|
|
|
2
2
|
module EntitiesPlumbing
|
|
3
3
|
class << self
|
|
4
4
|
def install!
|
|
5
|
+
CommandPatternImplementation.include CommandPatternImplementation::Concerns::Transactions
|
|
5
6
|
CommandPatternImplementation.include CommandPatternImplementation::Concerns::Entities
|
|
7
|
+
CommandPatternImplementation.include CommandPatternImplementation::Concerns::EntityInputs
|
|
8
|
+
CommandPatternImplementation.include CommandPatternImplementation::Concerns::EntityErrorsType
|
|
9
|
+
CommandPatternImplementation.include CommandPatternImplementation::Concerns::EntityReflection
|
|
6
10
|
|
|
7
11
|
if Foobara.project_installed?("command_connectors")
|
|
8
|
-
# :
|
|
12
|
+
# simplecov:disable
|
|
9
13
|
install_command_connector_extension
|
|
10
|
-
# :
|
|
14
|
+
# simplecov:enable
|
|
11
15
|
end
|
|
12
16
|
end
|
|
13
17
|
|
data/projects/entities_plumbing/src/extensions/command_pattern_implementation/concerns/entities.rb
CHANGED
|
@@ -5,6 +5,18 @@ module Foobara
|
|
|
5
5
|
include Concern
|
|
6
6
|
|
|
7
7
|
module ClassMethods
|
|
8
|
+
def inputs(...)
|
|
9
|
+
if defined?(@entity_class_paths)
|
|
10
|
+
remove_instance_variable(:@entity_class_paths)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
if defined?(@inputs_association_paths)
|
|
14
|
+
remove_instance_variable(:@inputs_association_paths)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
super
|
|
18
|
+
end
|
|
19
|
+
|
|
8
20
|
# Only needed for entities not discoverable through the inputs
|
|
9
21
|
def depends_on_entities(*entities_to_add)
|
|
10
22
|
if entities_to_add.empty?
|
|
@@ -26,8 +38,6 @@ module Foobara
|
|
|
26
38
|
).transform_values(&:target_class)
|
|
27
39
|
end
|
|
28
40
|
|
|
29
|
-
# TODO: move to better concern!
|
|
30
|
-
# TODO: make work with inheritance
|
|
31
41
|
def to_load(*paths)
|
|
32
42
|
h = @to_load_paths_and_error_classes || {}
|
|
33
43
|
|
|
@@ -36,7 +46,7 @@ module Foobara
|
|
|
36
46
|
entity_class = entity_class_paths[path.to_s]
|
|
37
47
|
error_class = Entity::NotFoundError.subclass(self, entity_class, path)
|
|
38
48
|
h[path.to_s] = error_class
|
|
39
|
-
|
|
49
|
+
possible_input_error(path, error_class)
|
|
40
50
|
end
|
|
41
51
|
|
|
42
52
|
@to_load_paths_and_error_classes = h.sort_by do |path, _error_class|
|
|
@@ -64,14 +74,20 @@ module Foobara
|
|
|
64
74
|
begin
|
|
65
75
|
# here... filter out created entities...
|
|
66
76
|
if thunks_to_load.size == 1
|
|
67
|
-
entity_class.load(thunks_to_load
|
|
77
|
+
entity_class.load(thunks_to_load[0])
|
|
68
78
|
else
|
|
69
79
|
entity_class.load_many(thunks_to_load)
|
|
70
80
|
end
|
|
71
81
|
|
|
72
82
|
thunks_to_load
|
|
73
83
|
rescue Entity::NotFoundError => e
|
|
74
|
-
|
|
84
|
+
error_data_path = DataPath.new(e.data_path)
|
|
85
|
+
error_data_path.prepend!(data_path)
|
|
86
|
+
|
|
87
|
+
error = error_class.for(e.criteria, data_path: error_data_path.to_s)
|
|
88
|
+
add_input_error(error)
|
|
89
|
+
|
|
90
|
+
halt!
|
|
75
91
|
end
|
|
76
92
|
end
|
|
77
93
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Foobara
|
|
2
|
+
module CommandPatternImplementation
|
|
3
|
+
module Concerns
|
|
4
|
+
module EntityErrorsType
|
|
5
|
+
include Concern
|
|
6
|
+
|
|
7
|
+
module ClassMethods
|
|
8
|
+
def error_context_type_map
|
|
9
|
+
return @error_context_type_map if defined?(@error_context_type_map)
|
|
10
|
+
|
|
11
|
+
super
|
|
12
|
+
|
|
13
|
+
inputs_association_paths&.each do |data_path|
|
|
14
|
+
possible_input_error(data_path.to_sym, Entity::NotFoundError)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@error_context_type_map
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Foobara
|
|
2
|
+
module CommandPatternImplementation
|
|
3
|
+
module Concerns
|
|
4
|
+
module EntityInputs
|
|
5
|
+
include Concern
|
|
6
|
+
|
|
7
|
+
module ClassMethods
|
|
8
|
+
def inputs_association_paths
|
|
9
|
+
return @inputs_association_paths if defined?(@inputs_association_paths)
|
|
10
|
+
|
|
11
|
+
@inputs_association_paths = if inputs_type.nil?
|
|
12
|
+
nil
|
|
13
|
+
else
|
|
14
|
+
keys = Entity.construct_associations(inputs_type).keys
|
|
15
|
+
|
|
16
|
+
if keys.empty?
|
|
17
|
+
nil
|
|
18
|
+
else
|
|
19
|
+
keys.map do |key|
|
|
20
|
+
DataPath.new(key)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def skip_model_to_attributes_conversion?(type)
|
|
27
|
+
super || type.extends?(BuiltinTypes[:entity])
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|