All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Added
- Ruby 3 compatibility (still compatible with ruby 2.5)
Changed
Extensions::Repositories::Postgres::Delete
returns boolean- DataMapper became more safe: it will raise
MoreThanOneRecord
if#read_one
received array with multiple items, so it will show you your critical logic mistake Extensions::Repositories::Postgres::Delete#delete
can receive entity, Hash, and can not accept nil pk
Added
DataMapper.mapper
now can receive block instead of class, to describe anonymous mapper; default parent can be customized by definingbase_anonymous_mapper
methodDataMapper.entity
now have second argument to customizecoercion
- you can use your own Entity class (even Dry Struct)- DataMapper became more safe: it will not try to transform hash of attributes to array of pairs
- Postgres extension
Create
now will setupdated_at
andcreated_at
if exists - Postgres extension
Update
now will setupdated_at
if exists - Postgres extension
Read
now have default#scope
abstract method to handle scoping options - Postgres extension
Read
now have#transaction
method - Postgres extension
Read
now have#lock(pk, &block)
method and#lock!(pk, &block)
- each Repository NotFound exception now have its own exception class, inherited from common NotFound exception
LunaPark::Mappers::Codirectional
now available as default mapperLunaPark::Mapper
LunaPark::Mappers::Codirectional
now can have nested mappers, and can be configured for arrays
Fixed
- DataMapper configuration (entity, mapper) now can be inherited. NotFound error also will be inherited.
Added
- Added
TaggedLog
Changed
- Added
formatter
toNotifiers::Log
. Usage offormat
in initializer is now deprecated.
Changed
- in
UseCases::Scenario
now abstract method is#perform
- notcall!
. It is backward-compatible change:call!
still works as abstract, and public interface was not changed.
Added
- returned old aliases fail falure to scenarios
- add short alias for exceptions (
i18n:
instead ofi18n_key:
)
Added
- Added
.custom_error
method toExtensions::HasError
to define errors with a custom superclass - Added
#inject
method toExtensions::Injector
- dependencies setter that allows you to create method chains
Changed
- allow require Notifiers::Sentry when sentry-ruby version >= 4
Added
- new mapper
Mappers::Codirectionsl
with DSL
Added
- Github CI
Added
- Inheritance of
Extensions::Injector
- Guard and meaningfull exceptions for
Extensions::Injector
- nil dependencies caching for
Extensions::Injector
Http::Client
can accept no-response ChangedForms::Simple
now has default behavior of#perform
, that returns valid params
Changed
- Rename Interactors to UseCases
- Rename Errors::Adaptive to Errors:Base
- Rename Errors::Processing to Errors::Business Added
- Add class Errors::System
- Add class UseCase::Service
- Add class Extensions::HasError Removed
on_error action:
instead of use Errors::Business and Errors::System directly
Added
- Add sentry notifier
Fixed
- Errors::Processing now has right default
notify
andon_error
Added
- Errors::Adaptive configurations like .message, .on_error will work with inheritance now
Added
- default message in Errors::Adaptive now can be generated with details usage, when message defined with block
class WrongAnswerError < LunaPark::Errors::Adaptive
message { |d| "Answer is `#{d[:correct]}` - not `#{d[:wrong]}`" }
end
- i18n messages in Errors::Adaptive now can use i18n interpolation
de:
errors:
wrong_answer: Die richtige Antwort ist %{correct}, nicht %{wrong}
Added
- Add injector method
Added
- Add adaptive errors
- Add new http client
- Add new type of interactor - Scenario
- Add new pattern Notifier, with logger & bugsnag implementation
- Add new extensions of repositories: CRUD
- Add
rake console
command Fixed - Codependent gems can be requested if they are installed with the correct version number
Was experimental and didn't make it to the master branch
Added
- Extensions::Attributable and Extensions::Serializable now can not duplicate attribute names
Added
- Extensions::Exceptions::Substitutive, that allows you to substitute origin exception with custom exception and save backtrace of origin. In other case information of origin exception will be losed, that can be very painfull when something goes wrong.
Added
- method Interactors::Sequence#failure that returns catched Processing exception object
Added
- Extensions::DataMapper for implement Repository for concrete Entity
- Repositories::Sequel that uses Extensions::DataMapper
Update dry validations 0.13 to 1.1
Simplify interactors
- UseCases::Service - removed, instead of this methods use
extend Extensions::Callable
orLunaPark::Callable
# Deprecated
class YourService < LunaPark::UseCases::Service
private
def execute
# your logic there
end
end
# Use
class YourService
extend Extensions::Callable
def call
# your logic there
end
end
# Or
class YourService < LunaPark::Callable
def call
# your logic there
end
end
- UseCases::Command - removed, instead of this methods use
extend Extensions::Callable
orLunaPark::Callable
# Deprecated
class YourCommand < LunaPark::UseCases::Command
private
def execute
# your logic there
end
end
# Use
class YourCommand
extend Extensions::Callable
def call
# your logic there
true
end
end
# Or
class YourCommand < LunaPark::Callable
def call
# your logic there
true
end
end
-
method
execute
atInteractors::Sequnce
is removed, instead of this methods usecall!
-
method
returned_data
is removed, instead of this methods return data atcall!
# Deprecated
class YourSequence < LunaPark::Intractors::Sequence
private
def execute
# your logic there
end
def returned_data
{ foo: :bar }
end
end
# Use
class YourSequence < LunaPark::Intractors::Sequence
def call!
# your logic there
{ foo: :bar }
end
end
- callback method
on_fail
atInteractors::Sequence
class YourSequence < LunaPark::Intractors::Sequence
def call!
raise Errors::Processing
end
private
def on_fail
puts 'foobar'
end
end
i = YourSequence.call
#=> foobar
- Extensions::Attributable now uses
#each_pair
instead of#each
- DSL
.fk
,.foreign_key
method now can be reloaded with usagesuper
(before thesuper
was not available)
Moved to modules:
- Extensions::Wrappable adds
.wrap
- Extensions::Serializable adds
#to_h
and#serialize
as alias - Extensions::Comparable adds
#==
and#eql?
- Extensions::Dsl::Attributes adds
.attr .attrs .attr? .attrs?
DSL methods- optionaly works in synergy with Extensions::Serializable and Extensions::Comparable
- YARDoc
- Extensions::Dsl::ForeignKey adds
.foreign_key
for create foreign key accessor with ergonomically-related object acessor. Has.fk
as shorter variant (not alias) - Entities::Attributable (Entities::Simple with included Extensions::Comparable, Extensions::Serializable, Extensions::Dsl::Attributes)
- Values::Attributable (Values::Simple with included Extensions::Comparable, Extensions::Serializable, Extensions::Dsl::Attributes)
- DSL
.attr
can create typed arrays by optionarray: true
- Some meaningfull exceptions when library used wrong
- Extensions::ComparableDebug#detailed_differences method that returns only differences (#differences_structure renamed to #detailed_comparsion with alias #detailed_cmp)
- Extensions::Comparable adds
#enable_debug
and.enable_debug
that just includesExtensions::ComparableDebug
to current class has aliases#debug
,.debug
- Extensions::PredicateAttribute adds
#predicate_attr_reader
,#predicate_attr_accessor
and aliased#attr_reader?
,#artr_accessor?
- Extensions::TypedAttribute adds
#typed_attr_writer
,#typed_attr_accessor
- DSL
.namespace
method now can be reloaded with usingsuper
(before thesuper
was not available) #to_h
,#==
from Extensions::Serializable and Extensions::Comparable now works fine in inverited classes- Values::Single now will be serialized too when you will try send #to_h to aggregate, included Values::Single instance
- ComparableDebug#detailed_comparsion renamed from #differences_structure. (Now available: #detailed_differences and #detailed_comparsion with aliases: #detailed_diff and #detailed_cmp)
Extensions::Validateable::Dry
- same as normalValidateable
, but method.validator
can receive block to create anonymous validatorValidator::Dry
(block will be passed to .validation_schema of new validator)Extensions::Validateable.validator
now can be setter (when arguments given) and getter (without args)
- Validateable renamed to Validatable (without backward compatibility)
- Validator
#valid?
DEPRECATED, use#success?
instead - Validator
#validation_errors?
DEPRECATED, use#errors
instead
- Extensions::Validatable
#valid?
#validation_errors
#valid_params
now can work without defined.validator
Forms::Simple
- Form example comment
Form#complete!
renamed to#submit
(#complete! removed)Validatable#validate!
removed
- LunaPark::Mappers::Simple
- LunaPark::Extensions::Attributable#set_attributes now returns
self
- not given Hash
- Change error message for
.wrap
fromCan't wrap OtherClass
toMyClass can't wrap OtherClass
- This CHANGELOG
- Renamed ValueObject::Simple -> ValueObject::Single
- RUS Guideline: Entity - improve orthography and punctuation
- RUS Guideline: Value - improve orthography and punctuation
- RUS Guideline: Way - improve orthography and punctuation
- Nested Entity
- Simple Entity
- Single item Form
- Simple Handler
- Sequence Interactor
- Simple Serializer
- Service Use Case
- Command Use Case
- Dry Validator
- Compound Value
- Single Value
- RUS Guideline: Implementation area
- RUS Guideline: Methodology
- RUS Guideline: Architecture
- RUS Guideline: The Way
- RUS Guideline: ValueObject
- RUS Guideline: Entity
- RUS Guideline: Sequence
- RUS Guideline: Services
- RUS Guideline: Value