fast_cqrs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +90 -0
- data/LICENSE.txt +21 -0
- data/README.md +105 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fast_cqrs.gemspec +35 -0
- data/lib/fast_cqrs.rb +8 -0
- data/lib/fast_cqrs/authorizer.rb +32 -0
- data/lib/fast_cqrs/deserializer/json_api.rb +31 -0
- data/lib/fast_cqrs/request.rb +47 -0
- data/lib/fast_cqrs/transaction.rb +22 -0
- data/lib/fast_cqrs/version.rb +3 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: abcc5e4f059bd1cc20c9692b81f7233ce609e56e624aed25b0b1ba691dee2a75
|
4
|
+
data.tar.gz: 1b981fb18472571726acb45024ba2f465394b2a2c37441ebd56cf7d16c0fa0be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22e4c73a14ad9a843a87767bf898b0a001fd7179c9ffa61208724d22df8602ea2562554b65975e42e44a71cbd90e5435044053dbedde752d680c4bfbd7511362
|
7
|
+
data.tar.gz: 01f9aa053090e0fe01d7b063f74a7248cb2a4d4975819c413a037606df27a383b4ec31a065ca60584d5fe4e5f996af6cdbb8f9c6d3a9f009f1032db0ec886117
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fast_cqrs
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.7.1
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at sebastian@driggl.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fast_cqrs (0.1.0)
|
5
|
+
dry-matcher
|
6
|
+
dry-monads
|
7
|
+
dry-struct
|
8
|
+
dry-types
|
9
|
+
dry-validation
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
concurrent-ruby (1.1.6)
|
15
|
+
diff-lcs (1.3)
|
16
|
+
dry-configurable (0.11.5)
|
17
|
+
concurrent-ruby (~> 1.0)
|
18
|
+
dry-core (~> 0.4, >= 0.4.7)
|
19
|
+
dry-equalizer (~> 0.2)
|
20
|
+
dry-container (0.7.2)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
23
|
+
dry-core (0.4.9)
|
24
|
+
concurrent-ruby (~> 1.0)
|
25
|
+
dry-equalizer (0.3.0)
|
26
|
+
dry-inflector (0.2.0)
|
27
|
+
dry-initializer (3.0.3)
|
28
|
+
dry-logic (1.0.6)
|
29
|
+
concurrent-ruby (~> 1.0)
|
30
|
+
dry-core (~> 0.2)
|
31
|
+
dry-equalizer (~> 0.2)
|
32
|
+
dry-matcher (0.8.3)
|
33
|
+
dry-core (>= 0.4.8)
|
34
|
+
dry-monads (1.3.5)
|
35
|
+
concurrent-ruby (~> 1.0)
|
36
|
+
dry-core (~> 0.4, >= 0.4.4)
|
37
|
+
dry-equalizer
|
38
|
+
dry-schema (1.5.1)
|
39
|
+
concurrent-ruby (~> 1.0)
|
40
|
+
dry-configurable (~> 0.8, >= 0.8.3)
|
41
|
+
dry-core (~> 0.4)
|
42
|
+
dry-equalizer (~> 0.2)
|
43
|
+
dry-initializer (~> 3.0)
|
44
|
+
dry-logic (~> 1.0)
|
45
|
+
dry-types (~> 1.4)
|
46
|
+
dry-struct (1.3.0)
|
47
|
+
dry-core (~> 0.4, >= 0.4.4)
|
48
|
+
dry-equalizer (~> 0.3)
|
49
|
+
dry-types (~> 1.3)
|
50
|
+
ice_nine (~> 0.11)
|
51
|
+
dry-types (1.4.0)
|
52
|
+
concurrent-ruby (~> 1.0)
|
53
|
+
dry-container (~> 0.3)
|
54
|
+
dry-core (~> 0.4, >= 0.4.4)
|
55
|
+
dry-equalizer (~> 0.3)
|
56
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
57
|
+
dry-logic (~> 1.0, >= 1.0.2)
|
58
|
+
dry-validation (1.5.0)
|
59
|
+
concurrent-ruby (~> 1.0)
|
60
|
+
dry-container (~> 0.7, >= 0.7.1)
|
61
|
+
dry-core (~> 0.4)
|
62
|
+
dry-equalizer (~> 0.2)
|
63
|
+
dry-initializer (~> 3.0)
|
64
|
+
dry-schema (~> 1.5)
|
65
|
+
ice_nine (0.11.2)
|
66
|
+
rake (12.3.3)
|
67
|
+
rspec (3.9.0)
|
68
|
+
rspec-core (~> 3.9.0)
|
69
|
+
rspec-expectations (~> 3.9.0)
|
70
|
+
rspec-mocks (~> 3.9.0)
|
71
|
+
rspec-core (3.9.2)
|
72
|
+
rspec-support (~> 3.9.3)
|
73
|
+
rspec-expectations (3.9.2)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.9.0)
|
76
|
+
rspec-mocks (3.9.1)
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
78
|
+
rspec-support (~> 3.9.0)
|
79
|
+
rspec-support (3.9.3)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
ruby
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
fast_cqrs!
|
86
|
+
rake (~> 12.0)
|
87
|
+
rspec (~> 3.0)
|
88
|
+
|
89
|
+
BUNDLED WITH
|
90
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Sebastian Wilgosz
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# FastCqrs
|
2
|
+
|
3
|
+
A collection of small classes allowing to implement CQRS API in ruby applications without too much of an effort.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'fast_cqrs'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install fast_cqrs
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Transactions
|
24
|
+
|
25
|
+
`FastCqrs` delivers transactions as the main piece of the request processing. A whole request processing is
|
26
|
+
encapsulated within the transaction object, so it's easy to write unit tests for your endpoints without loading
|
27
|
+
the whole framework while testing.
|
28
|
+
|
29
|
+
Also, it's super easy to inject dependencies when needed.
|
30
|
+
|
31
|
+
Basic transaction could look like this.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
# transactions/create_article.rb
|
35
|
+
|
36
|
+
class CreateArticle < FastCqrs::Transaction
|
37
|
+
def call(params, **)
|
38
|
+
model = yield deserialize(params)
|
39
|
+
yield authorize(model)
|
40
|
+
yield create_article(model)
|
41
|
+
Success()
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def deserialize(params)
|
47
|
+
request.call(params)
|
48
|
+
end
|
49
|
+
|
50
|
+
def authorize(model)
|
51
|
+
authorizer.call(params)
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_article(model)
|
55
|
+
Try { Article.create!(model) }
|
56
|
+
end
|
57
|
+
|
58
|
+
def initialize
|
59
|
+
@authorizer = Authorizer.new
|
60
|
+
@request = Request.new
|
61
|
+
end
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
# articles_controller
|
67
|
+
|
68
|
+
def create
|
69
|
+
Transactions::CreateArticle.new.call(params)
|
70
|
+
end
|
71
|
+
|
72
|
+
def create
|
73
|
+
Transactions::UpdateArticle.new.call(params)
|
74
|
+
end
|
75
|
+
|
76
|
+
```
|
77
|
+
|
78
|
+
### Transaction blocks
|
79
|
+
|
80
|
+
Typical transaction consists of:
|
81
|
+
|
82
|
+
- request - This parses the request body and modifies the input for an easy to use output.
|
83
|
+
- authorizer - authorizes the parsed input against the given auth object
|
84
|
+
- validator - validates the request
|
85
|
+
- actions - methods making changes in the system.
|
86
|
+
|
87
|
+
|
88
|
+
## Development
|
89
|
+
|
90
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
91
|
+
|
92
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
93
|
+
|
94
|
+
## Contributing
|
95
|
+
|
96
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/driggl/fast_cqrs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/driggl/fast_cqrs/blob/master/CODE_OF_CONDUCT.md).
|
97
|
+
|
98
|
+
|
99
|
+
## License
|
100
|
+
|
101
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
102
|
+
|
103
|
+
## Code of Conduct
|
104
|
+
|
105
|
+
Everyone interacting in the FastCqrs project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/driggl/fast_cqrs/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fast_cqrs"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/fast_cqrs.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'lib/fast_cqrs/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "fast_cqrs"
|
5
|
+
spec.version = FastCqrs::VERSION
|
6
|
+
spec.authors = ["Sebastian Wilgosz"]
|
7
|
+
spec.email = ["sebastian@driggl.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{A lightweight CQRS scaffold for ruby-based web applications.}
|
10
|
+
spec.description = %q{Write CQRS applications easily using functional endpoints without a hassle.}
|
11
|
+
spec.homepage = "https://github.com/driggl/fast_cqrs"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/driggl/fast_cqrs"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/driggl/fast_cqrs/releases"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency 'dry-matcher'
|
31
|
+
spec.add_dependency 'dry-monads'
|
32
|
+
spec.add_dependency 'dry-struct'
|
33
|
+
spec.add_dependency 'dry-types'
|
34
|
+
spec.add_dependency 'dry-validation'
|
35
|
+
end
|
data/lib/fast_cqrs.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/monads'
|
4
|
+
|
5
|
+
module FastCqrs
|
6
|
+
class Authorizer
|
7
|
+
def self.inherited(klass)
|
8
|
+
super
|
9
|
+
klass.class_eval do
|
10
|
+
include Dry::Monads[:result, :do]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(**)
|
15
|
+
return Success() if authorize
|
16
|
+
fail!
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
# Override this in the inherited class
|
22
|
+
def authorize
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def fail!
|
29
|
+
Failure(:authorize)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ostruct'
|
4
|
+
|
5
|
+
module FastCqrs
|
6
|
+
module Deserializer
|
7
|
+
class JsonApi
|
8
|
+
IncorrectFormat = Class.new(StandardError)
|
9
|
+
HashInputRequired = Class.new(StandardError)
|
10
|
+
|
11
|
+
# Converts the json_api (https://jsonapi.org) hash resource into a flat hash
|
12
|
+
# (defaults to `{ data: {} }`)
|
13
|
+
#
|
14
|
+
# == Parameters:
|
15
|
+
# params::
|
16
|
+
# A request body in form of JSON API hash with symbolized keys.
|
17
|
+
#
|
18
|
+
# == Returns:
|
19
|
+
# A hash with ID and all attributes flat
|
20
|
+
#
|
21
|
+
def call(params = { data: {} })
|
22
|
+
raise HashInputRequired unless params.is_a?(Hash)
|
23
|
+
raise IncorrectFormat if (data = params[:data]).blank?
|
24
|
+
|
25
|
+
attrs = data[:attributes] || {}
|
26
|
+
|
27
|
+
attrs.merge(id: data[:id], resource_type: data[:type])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/monads'
|
4
|
+
|
5
|
+
module FastCqrs
|
6
|
+
class Request
|
7
|
+
include Dry::Monads[:result, :try]
|
8
|
+
|
9
|
+
def self.inherited(klass)
|
10
|
+
super
|
11
|
+
klass.class_eval do
|
12
|
+
include Dry::Monads[:result, :try]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(input)
|
17
|
+
return fail! unless (deserialized = model(input))
|
18
|
+
|
19
|
+
Success(deserialized)
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# overwrite this to prepare valid request object
|
25
|
+
def model(input)
|
26
|
+
return if (deserialized = deserialize(input)).error?
|
27
|
+
|
28
|
+
deserialized.value!
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
attr_reader :deserializer
|
34
|
+
|
35
|
+
def initialize(deserializer:)
|
36
|
+
@deserializer = deserializer
|
37
|
+
end
|
38
|
+
|
39
|
+
def deserialize(input)
|
40
|
+
Try { deserializer.call(input) }
|
41
|
+
end
|
42
|
+
|
43
|
+
def fail!
|
44
|
+
Failure(:deserialize)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/matcher/result_matcher'
|
4
|
+
require 'dry/monads'
|
5
|
+
require 'dry/validation'
|
6
|
+
|
7
|
+
module FastCqrs
|
8
|
+
class Transaction
|
9
|
+
Dry::Validation.load_extensions(:monads)
|
10
|
+
def self.inherited(klass)
|
11
|
+
super
|
12
|
+
klass.class_eval do
|
13
|
+
include Dry::Monads[:do, :result, :try]
|
14
|
+
include Dry::Matcher.for(:call, with: Dry::Matcher::ResultMatcher)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(input, **)
|
19
|
+
Success()
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fast_cqrs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sebastian Wilgosz
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-matcher
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-monads
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dry-struct
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dry-types
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dry-validation
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Write CQRS applications easily using functional endpoints without a hassle.
|
84
|
+
email:
|
85
|
+
- sebastian@driggl.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".ruby-gemset"
|
93
|
+
- ".ruby-version"
|
94
|
+
- ".travis.yml"
|
95
|
+
- CODE_OF_CONDUCT.md
|
96
|
+
- Gemfile
|
97
|
+
- Gemfile.lock
|
98
|
+
- LICENSE.txt
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- bin/console
|
102
|
+
- bin/setup
|
103
|
+
- fast_cqrs.gemspec
|
104
|
+
- lib/fast_cqrs.rb
|
105
|
+
- lib/fast_cqrs/authorizer.rb
|
106
|
+
- lib/fast_cqrs/deserializer/json_api.rb
|
107
|
+
- lib/fast_cqrs/request.rb
|
108
|
+
- lib/fast_cqrs/transaction.rb
|
109
|
+
- lib/fast_cqrs/version.rb
|
110
|
+
homepage: https://github.com/driggl/fast_cqrs
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata:
|
114
|
+
allowed_push_host: https://rubygems.org
|
115
|
+
homepage_uri: https://github.com/driggl/fast_cqrs
|
116
|
+
source_code_uri: https://github.com/driggl/fast_cqrs
|
117
|
+
changelog_uri: https://github.com/driggl/fast_cqrs/releases
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.3.0
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubygems_version: 3.1.2
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: A lightweight CQRS scaffold for ruby-based web applications.
|
137
|
+
test_files: []
|