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
|
@@ -59,13 +59,13 @@ module Foobara
|
|
|
59
59
|
values
|
|
60
60
|
else
|
|
61
61
|
if values.size > 1
|
|
62
|
-
# :
|
|
62
|
+
# simplecov:disable
|
|
63
63
|
raise "Multiple records found for #{name} association but only expected 0 or 1."
|
|
64
|
-
# :
|
|
64
|
+
# simplecov:enable
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
unless values.empty?
|
|
68
|
-
values
|
|
68
|
+
values[0]
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
end
|
|
@@ -73,7 +73,7 @@ module Foobara
|
|
|
73
73
|
|
|
74
74
|
def association_for(association_filters)
|
|
75
75
|
if association_filters.size == 1
|
|
76
|
-
data_path = association_filters.
|
|
76
|
+
data_path = association_filters[0].to_s
|
|
77
77
|
|
|
78
78
|
if deep_associations.key?(data_path)
|
|
79
79
|
return data_path
|
|
@@ -85,15 +85,15 @@ module Foobara
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
if result.empty?
|
|
88
|
-
# :
|
|
88
|
+
# simplecov:disable
|
|
89
89
|
raise "Could not find association matching #{association_filters}"
|
|
90
|
-
# :
|
|
90
|
+
# simplecov:enable
|
|
91
91
|
elsif result.size > 1
|
|
92
|
-
# :
|
|
92
|
+
# simplecov:disable
|
|
93
93
|
raise "Multiple associations matched by #{association_filters}"
|
|
94
|
-
# :
|
|
94
|
+
# simplecov:enable
|
|
95
95
|
else
|
|
96
|
-
result
|
|
96
|
+
result[0]
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
@@ -121,9 +121,9 @@ module Foobara
|
|
|
121
121
|
entity_class == filter || entity_class < filter
|
|
122
122
|
end
|
|
123
123
|
else
|
|
124
|
-
# :
|
|
124
|
+
# simplecov:disable
|
|
125
125
|
raise "Not sure how to apply filter #{filter}"
|
|
126
|
-
# :
|
|
126
|
+
# simplecov:enable
|
|
127
127
|
end
|
|
128
128
|
end
|
|
129
129
|
|
|
@@ -168,9 +168,9 @@ module Foobara
|
|
|
168
168
|
|
|
169
169
|
if remove_sensitive
|
|
170
170
|
# TODO: test this code path
|
|
171
|
-
# :
|
|
171
|
+
# simplecov:disable
|
|
172
172
|
element_types = element_types&.reject(&:sensitive?)
|
|
173
|
-
# :
|
|
173
|
+
# simplecov:enable
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
element_types&.each&.with_index do |element_type, index|
|
|
@@ -196,19 +196,19 @@ module Foobara
|
|
|
196
196
|
target_class = type.target_class
|
|
197
197
|
|
|
198
198
|
method = target_class.respond_to?(:foobara_attributes_type) ? :foobara_attributes_type : :attributes_type
|
|
199
|
-
attributes_type = target_class.
|
|
199
|
+
attributes_type = target_class.__send__(method)
|
|
200
200
|
|
|
201
201
|
if !remove_sensitive || !attributes_type.sensitive?
|
|
202
202
|
construct_associations(attributes_type, path, result, initial: false)
|
|
203
203
|
end
|
|
204
204
|
elsif type.extends?(BuiltinTypes[:associative_array])
|
|
205
205
|
# not going to bother testing this for now
|
|
206
|
-
# :
|
|
206
|
+
# simplecov:disable
|
|
207
207
|
if contains_associations?(type)
|
|
208
208
|
raise "Associative array types with associations in them are not currently supported. " \
|
|
209
209
|
"Use attributes type if you can or set the key_type and/or value_type to duck type"
|
|
210
210
|
end
|
|
211
|
-
# :
|
|
211
|
+
# simplecov:enable
|
|
212
212
|
end
|
|
213
213
|
|
|
214
214
|
result
|
|
@@ -228,9 +228,9 @@ module Foobara
|
|
|
228
228
|
|
|
229
229
|
if remove_sensitive
|
|
230
230
|
# TODO: test this code path
|
|
231
|
-
# :
|
|
231
|
+
# simplecov:disable
|
|
232
232
|
element_types = element_types&.reject(&:sensitive?)
|
|
233
|
-
# :
|
|
233
|
+
# simplecov:enable
|
|
234
234
|
end
|
|
235
235
|
|
|
236
236
|
contains_associations?(element_types, false)
|
|
@@ -20,9 +20,9 @@ module Foobara
|
|
|
20
20
|
invalid_options = options.keys - ALLOWED_OPTIONS
|
|
21
21
|
|
|
22
22
|
unless invalid_options.empty?
|
|
23
|
-
# :
|
|
23
|
+
# simplecov:disable
|
|
24
24
|
raise ArgumentError, "Invalid options #{invalid_options} expected only #{ALLOWED_OPTIONS}"
|
|
25
|
-
# :
|
|
25
|
+
# simplecov:enable
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
if options[:unloaded]
|
|
@@ -11,15 +11,15 @@ module Foobara
|
|
|
11
11
|
module ClassMethods
|
|
12
12
|
def primary_key(attribute_name)
|
|
13
13
|
if primary_key_attribute
|
|
14
|
-
# :
|
|
14
|
+
# simplecov:disable
|
|
15
15
|
raise "Primary key already set to #{primary_key_attribute}"
|
|
16
|
-
# :
|
|
16
|
+
# simplecov:enable
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
if attribute_name.nil? || attribute_name.empty?
|
|
20
|
-
# :
|
|
20
|
+
# simplecov:disable
|
|
21
21
|
raise ArgumentError, "Primary key can't be blank"
|
|
22
|
-
# :
|
|
22
|
+
# simplecov:enable
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
@foobara_primary_key_attribute = attribute_name.to_sym
|
|
@@ -28,18 +28,18 @@ module Foobara
|
|
|
28
28
|
# TODO: No longer is hit in this test suite but ActiveRecordType needs this class
|
|
29
29
|
# and potentially this snippet of code in order to do the right thing.
|
|
30
30
|
# TODO: test that out and delete this method if possible.
|
|
31
|
-
# :
|
|
31
|
+
# simplecov:disable
|
|
32
32
|
declaration_data = declaration_data.merge(type: :detached_entity)
|
|
33
|
-
# :
|
|
33
|
+
# simplecov:enable
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
if self.class.model_base_class_requires_conversion?(declaration_data[:model_base_class])
|
|
37
37
|
# TODO: No longer is hit in this test suite but ActiveRecordType needs this class
|
|
38
38
|
# and potentially this snippet of code in order to do the right thing.
|
|
39
39
|
# TODO: test that out and delete this method if possible.
|
|
40
|
-
# :
|
|
40
|
+
# simplecov:disable
|
|
41
41
|
declaration_data = declaration_data.merge(model_base_class: "Foobara::DetachedEntity")
|
|
42
|
-
# :
|
|
42
|
+
# simplecov:enable
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# TODO: remove private attributes, add delegated attributes
|
|
@@ -26,9 +26,9 @@ module Foobara
|
|
|
26
26
|
model_type = type_for_declaration(parent_declaration_data[:type])
|
|
27
27
|
model_type.target_class
|
|
28
28
|
else
|
|
29
|
-
# :
|
|
29
|
+
# simplecov:disable
|
|
30
30
|
raise "Missing :model_class in parent_declaration_data for #{parent_declaration_data}"
|
|
31
|
-
# :
|
|
31
|
+
# simplecov:enable
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Foobara
|
|
2
|
+
module TypeDeclarations
|
|
3
|
+
module Handlers
|
|
4
|
+
class RegisteredTypeDeclaration < TypeDeclarationHandler
|
|
5
|
+
class ValidatePrimaryKeyPresent < TypeDeclarations::TypeDeclarationValidator
|
|
6
|
+
# TODO: seems like maybe we could actually check against types now...
|
|
7
|
+
# like make a type for primary_key: :symbol ??
|
|
8
|
+
class MissingPrimaryKeyError < TypeDeclarationError; end
|
|
9
|
+
|
|
10
|
+
def validation_errors(type_declaration)
|
|
11
|
+
if type_declaration.claimed_but_error?
|
|
12
|
+
klass = type_declaration.declaration_data
|
|
13
|
+
|
|
14
|
+
if klass.is_a?(::Class) && klass < ::Foobara::DetachedEntity
|
|
15
|
+
if klass.model_type.nil? && klass.primary_key_attribute.nil?
|
|
16
|
+
build_error(
|
|
17
|
+
message: "#{klass} doesn't have a primary key attribute set yet. " \
|
|
18
|
+
"Did you forget something like `primary_key :id` in #{klass}?"
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def error_context(_value) ={}
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -26,21 +26,21 @@ module Foobara
|
|
|
26
26
|
|
|
27
27
|
if attribute_name == primary_key_attribute
|
|
28
28
|
if value.nil?
|
|
29
|
-
# :
|
|
29
|
+
# simplecov:disable
|
|
30
30
|
raise "Primary key cannot be set to a blank value"
|
|
31
|
-
# :
|
|
31
|
+
# simplecov:enable
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
if value.is_a?(::String) && value.empty?
|
|
35
|
-
# :
|
|
35
|
+
# simplecov:disable
|
|
36
36
|
raise "Primary key cannot be set to a blank value"
|
|
37
|
-
# :
|
|
37
|
+
# simplecov:enable
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
if value.is_a?(::Symbol) && value.to_s.empty?
|
|
41
|
-
# :
|
|
41
|
+
# simplecov:disable
|
|
42
42
|
raise "Primary key cannot be set to a blank value"
|
|
43
|
-
# :
|
|
43
|
+
# simplecov:enable
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
write_attribute!(attribute_name, value)
|
|
@@ -29,9 +29,9 @@ module Foobara
|
|
|
29
29
|
|
|
30
30
|
# TODO: is this possible?
|
|
31
31
|
if record_id.nil?
|
|
32
|
-
# :
|
|
32
|
+
# simplecov:disable
|
|
33
33
|
raise ArgumentError, "Primary key cannot be blank"
|
|
34
|
-
# :
|
|
34
|
+
# simplecov:enable
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# check if tracked already...
|
|
@@ -58,9 +58,9 @@ module Foobara
|
|
|
58
58
|
record = current_transaction_table.find_tracked(record_id)
|
|
59
59
|
|
|
60
60
|
if record&.loaded?
|
|
61
|
-
# :
|
|
61
|
+
# simplecov:disable
|
|
62
62
|
raise "Already loaded for #{attributes}. Bug maybe?"
|
|
63
|
-
# :
|
|
63
|
+
# simplecov:enable
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
record = __private_new__
|
|
@@ -68,9 +68,9 @@ module Foobara
|
|
|
68
68
|
record.successfully_loaded(attributes)
|
|
69
69
|
|
|
70
70
|
unless record.primary_key
|
|
71
|
-
# :
|
|
71
|
+
# simplecov:disable
|
|
72
72
|
raise "Expected primary key #{primary_key_attribute} to be present!"
|
|
73
|
-
# :
|
|
73
|
+
# simplecov:enable
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
record.fire(:initialized)
|
|
@@ -104,9 +104,9 @@ module Foobara
|
|
|
104
104
|
|
|
105
105
|
def successfully_loaded(attributes)
|
|
106
106
|
if hard_deleted?
|
|
107
|
-
# :
|
|
107
|
+
# simplecov:disable
|
|
108
108
|
raise "Not expecting to load a hard deleted record"
|
|
109
|
-
# :
|
|
109
|
+
# simplecov:enable
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
# TODO: why would we proceed if this is the case? Maybe raise?
|
|
@@ -50,13 +50,13 @@ module Foobara
|
|
|
50
50
|
|
|
51
51
|
object
|
|
52
52
|
elsif type.extends?(BuiltinTypes[:tuple])
|
|
53
|
-
# :
|
|
53
|
+
# simplecov:disable
|
|
54
54
|
raise "Tuple not yet supported"
|
|
55
|
-
# :
|
|
55
|
+
# simplecov:enable
|
|
56
56
|
elsif type.extends?(BuiltinTypes[:associative_array])
|
|
57
|
-
# :
|
|
57
|
+
# simplecov:disable
|
|
58
58
|
raise "Associated array not yet supported"
|
|
59
|
-
# :
|
|
59
|
+
# simplecov:enable
|
|
60
60
|
elsif type.extends?(BuiltinTypes[:array])
|
|
61
61
|
element_type = type.element_type
|
|
62
62
|
|
|
@@ -62,7 +62,7 @@ module Foobara
|
|
|
62
62
|
|
|
63
63
|
attribute_name = if attribute_name_or_attributes.is_a?(::Hash)
|
|
64
64
|
if attribute_name_or_attributes.keys.size == 1
|
|
65
|
-
attribute_name_or_attributes.keys.
|
|
65
|
+
attribute_name_or_attributes.keys[0].to_sym
|
|
66
66
|
end
|
|
67
67
|
elsif attribute_name_or_attributes
|
|
68
68
|
attribute_name_or_attributes.to_sym
|
|
@@ -75,9 +75,9 @@ module Foobara
|
|
|
75
75
|
transaction = Foobara::Persistence::EntityBase::Transaction.open_transaction_for(self)
|
|
76
76
|
|
|
77
77
|
unless transaction
|
|
78
|
-
# :
|
|
78
|
+
# simplecov:disable
|
|
79
79
|
raise NoCurrentTransactionError, "Trying to load a #{entity_name} outside of a transaction."
|
|
80
|
-
# :
|
|
80
|
+
# simplecov:enable
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
unless transaction.loading?(self)
|
|
@@ -57,7 +57,7 @@ module Foobara
|
|
|
57
57
|
|
|
58
58
|
if load_paths
|
|
59
59
|
if load_paths.is_a?(::Array)
|
|
60
|
-
first = load_paths
|
|
60
|
+
first = load_paths[0]
|
|
61
61
|
|
|
62
62
|
if first.is_a?(::Symbol) || (first.is_a?(::String) && !first.include?("."))
|
|
63
63
|
load_paths = [load_paths]
|
|
@@ -99,8 +99,8 @@ module Foobara
|
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
def load_many(*record_ids)
|
|
102
|
-
if record_ids.size == 1 && record_ids.
|
|
103
|
-
record_ids = record_ids
|
|
102
|
+
if record_ids.size == 1 && record_ids[0].is_a?(::Array)
|
|
103
|
+
record_ids = record_ids[0]
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
current_transaction_table.load_many(record_ids)
|
|
@@ -125,11 +125,11 @@ module Foobara
|
|
|
125
125
|
|
|
126
126
|
unless containing_records.empty?
|
|
127
127
|
if containing_records.size == 1
|
|
128
|
-
containing_records
|
|
128
|
+
containing_records[0]
|
|
129
129
|
else
|
|
130
|
-
# :
|
|
130
|
+
# simplecov:disable
|
|
131
131
|
raise "Expected only one record to own #{record} but found #{containing_records.size}"
|
|
132
|
-
# :
|
|
132
|
+
# simplecov:enable
|
|
133
133
|
end
|
|
134
134
|
end
|
|
135
135
|
end
|
|
@@ -155,7 +155,7 @@ module Foobara
|
|
|
155
155
|
end until owning_entity_class
|
|
156
156
|
|
|
157
157
|
if attribute_path.size == 1
|
|
158
|
-
attribute_path = attribute_path
|
|
158
|
+
attribute_path = attribute_path[0]
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
if owning_entity_class == self
|
|
@@ -34,15 +34,15 @@ module Foobara
|
|
|
34
34
|
when 1, 2
|
|
35
35
|
arg, other = args
|
|
36
36
|
|
|
37
|
-
if args.
|
|
37
|
+
if args[0].is_a?(::String)
|
|
38
38
|
[other, arg]
|
|
39
39
|
else
|
|
40
40
|
args
|
|
41
41
|
end
|
|
42
42
|
else
|
|
43
|
-
# :
|
|
43
|
+
# simplecov:disable
|
|
44
44
|
raise ArgumentError, "Too many arguments"
|
|
45
|
-
# :
|
|
45
|
+
# simplecov:enable
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
if model_base_class
|
|
@@ -59,7 +59,7 @@ module Foobara
|
|
|
59
59
|
attributes_type = handler.type_for_declaration(attributes_type_declaration)
|
|
60
60
|
|
|
61
61
|
# TODO: reuse the model_base_class primary key if it has one...
|
|
62
|
-
primary_key = attributes_type.element_types.keys
|
|
62
|
+
primary_key = attributes_type.element_types.keys[0]
|
|
63
63
|
|
|
64
64
|
model_module = unless scoped_full_path.empty?
|
|
65
65
|
scoped_full_name
|
|
@@ -11,9 +11,9 @@ module Foobara
|
|
|
11
11
|
|
|
12
12
|
# rubocop:disable Lint/DuplicateMethods
|
|
13
13
|
def new(...)
|
|
14
|
-
# :
|
|
14
|
+
# simplecov:disable
|
|
15
15
|
raise "Cannot initialize a #{name}. Use .create, .thunk, .loaded, or .build instead."
|
|
16
|
-
# :
|
|
16
|
+
# simplecov:enable
|
|
17
17
|
end
|
|
18
18
|
# rubocop:enable Lint/DuplicateMethods
|
|
19
19
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Foobara
|
|
2
2
|
class Entity < DetachedEntity
|
|
3
|
-
class NotFoundError < Foobara::
|
|
3
|
+
class NotFoundError < Foobara::DataError
|
|
4
4
|
class << self
|
|
5
5
|
def not_found_error_class_name(data_path)
|
|
6
6
|
error_class_name = data_path.path.map { |part| part == :"#" ? "Collection" : Util.classify(part) }.join
|
|
@@ -13,8 +13,8 @@ module Foobara
|
|
|
13
13
|
# TODO: how would we avoid name collisions here??
|
|
14
14
|
Util.make_class("#{mod.name}::#{error_class_name}", self) do
|
|
15
15
|
# TODO: use Concern to change these into attr_accessor instead
|
|
16
|
-
singleton_class.define_method :
|
|
17
|
-
|
|
16
|
+
singleton_class.define_method :symbol do
|
|
17
|
+
:not_found
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
singleton_class.define_method :entity_class do
|
|
@@ -39,7 +39,7 @@ module Foobara
|
|
|
39
39
|
data_path: data_path.to_s
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
new(context:, message:)
|
|
42
|
+
new(context:, message:, path: data_path)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def data_path
|
|
@@ -54,15 +54,15 @@ module Foobara
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def primary_key_attribute
|
|
57
|
-
# :
|
|
57
|
+
# simplecov:disable
|
|
58
58
|
entity_class.primary_key_attribute
|
|
59
|
-
# :
|
|
59
|
+
# simplecov:enable
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def full_entity_name
|
|
63
|
-
# :
|
|
63
|
+
# simplecov:disable
|
|
64
64
|
entity_class.full_entity_name
|
|
65
|
-
# :
|
|
65
|
+
# simplecov:enable
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def criteria
|
|
@@ -8,23 +8,26 @@ module Foobara
|
|
|
8
8
|
elsif record.persisted?
|
|
9
9
|
# We will assume that we do not need to clean up the primary key itself as
|
|
10
10
|
# we will assume we don't allow sensitive primary keys for now.
|
|
11
|
-
thunkish = to_type.target_class.
|
|
11
|
+
thunkish = to_type.target_class.__send__(
|
|
12
|
+
build_method,
|
|
13
|
+
record.class.primary_key_attribute => record.primary_key
|
|
14
|
+
)
|
|
12
15
|
thunkish.skip_validations = true
|
|
13
16
|
thunkish.mutable = false
|
|
14
17
|
thunkish
|
|
15
18
|
else
|
|
16
|
-
# :
|
|
19
|
+
# simplecov:disable
|
|
17
20
|
raise "Not sure what to do with a record that isn't loaded, created, or persisted"
|
|
18
|
-
# :
|
|
21
|
+
# simplecov:enable
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
def build_method
|
|
23
26
|
if to_type.extends?(BuiltinTypes[:entity])
|
|
24
27
|
# TODO: figure out a way to test this path
|
|
25
|
-
# :
|
|
28
|
+
# simplecov:disable
|
|
26
29
|
:build
|
|
27
|
-
# :
|
|
30
|
+
# simplecov:enable
|
|
28
31
|
else
|
|
29
32
|
:new
|
|
30
33
|
end
|
|
@@ -50,9 +50,9 @@ module Foobara
|
|
|
50
50
|
record_id = record_id_for(attributes)
|
|
51
51
|
|
|
52
52
|
unless exists?(record_id)
|
|
53
|
-
# :
|
|
53
|
+
# simplecov:disable
|
|
54
54
|
raise CannotUpdateError.new(record_id, "does not exist")
|
|
55
|
-
# :
|
|
55
|
+
# simplecov:enable
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
records[record_id] = Util.deep_dup(attributes)
|
|
@@ -61,9 +61,9 @@ module Foobara
|
|
|
61
61
|
|
|
62
62
|
def hard_delete(record_id)
|
|
63
63
|
unless exists?(record_id)
|
|
64
|
-
# :
|
|
64
|
+
# simplecov:disable
|
|
65
65
|
raise CannotUpdateError.new(record_id, "does not exist")
|
|
66
|
-
# :
|
|
66
|
+
# simplecov:enable
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
records.delete(record_id)
|
|
@@ -20,7 +20,7 @@ module Foobara
|
|
|
20
20
|
:type_declaration_value_at
|
|
21
21
|
].each do |method_name|
|
|
22
22
|
define_method method_name do |*args, **opts, &block|
|
|
23
|
-
|
|
23
|
+
__send__("foobara_#{method_name}", *args, **opts, &block)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
end
|
data/projects/entities/projects/nested_transactionable/lib/foobara/nested_transactionable.rb
CHANGED
|
@@ -34,9 +34,9 @@ module Foobara
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def relevant_entity_classes
|
|
37
|
-
# :
|
|
38
|
-
raise
|
|
39
|
-
# :
|
|
37
|
+
# simplecov:disable
|
|
38
|
+
raise NotImplementedError
|
|
39
|
+
# simplecov:enable
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def transactions
|
|
@@ -118,9 +118,9 @@ module Foobara
|
|
|
118
118
|
if transaction.currently_open?
|
|
119
119
|
# Hard to test this because halting and other exceptions rollback the transactions via
|
|
120
120
|
# block form but to be safe keeping this
|
|
121
|
-
# :
|
|
121
|
+
# simplecov:disable
|
|
122
122
|
transaction.rollback!
|
|
123
|
-
# :
|
|
123
|
+
# simplecov:enable
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
end
|
|
@@ -4,7 +4,7 @@ module Foobara
|
|
|
4
4
|
module Persistence
|
|
5
5
|
class << self
|
|
6
6
|
def reset_all
|
|
7
|
-
Foobara.raise_if_production!
|
|
7
|
+
Foobara.raise_if_production!
|
|
8
8
|
@tables_for_entity_class_name = @bases = @default_crud_driver = @default_base = nil
|
|
9
9
|
EntityBase::Transaction::Concerns::EntityCallbackHandling.reset_all
|
|
10
10
|
EntityBase::Transaction.reset_all
|