rom-repository 2.0.2 → 5.0.0
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 +5 -5
- data/CHANGELOG.md +6 -0
- data/README.md +0 -2
- data/lib/rom-repository.rb +2 -0
- data/lib/rom/repository.rb +5 -6
- data/lib/rom/repository/class_interface.rb +23 -7
- data/lib/rom/repository/relation_reader.rb +2 -0
- data/lib/rom/repository/root.rb +3 -39
- data/lib/rom/repository/session.rb +2 -0
- data/lib/rom/repository/version.rb +3 -1
- metadata +15 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c3728521e0647f8bf92fcb9955dc6826687d8375f661161ad1152463311627a0
|
4
|
+
data.tar.gz: 73414da332fbe36d1ac31c578ac356572139d12755054d006af4a2210e228486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baac348e130e1c915a54c8b08281ac3b86bf2bd770419439a4bfcf81498c3a10ab6bfebbca1ad187937dd4807e3a61d4e8c82f283198909a10d70b1241753506
|
7
|
+
data.tar.gz: 0efa23fa59c61f98e7b9a3e93d4ab205ba6809b6f0d51e8afe2b2b59cf82d15b1819bb9e8beb8d278f31b70ded6fa387e5b93d8ace709516f6369afa89864423
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
[gem]: https://rubygems.org/gems/rom-repository
|
2
|
-
[gemnasium]: https://gemnasium.com/rom-rb/rom-repository
|
3
2
|
|
4
3
|
# rom-repository
|
5
4
|
|
6
5
|
[][gem]
|
7
|
-
[][gemnasium]
|
8
6
|
|
9
7
|
Repositories for [rom-rb](https://github.com/rom-rb/rom) with auto-mapping, changesets and commands.
|
10
8
|
|
data/lib/rom-repository.rb
CHANGED
data/lib/rom/repository.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dry/core/cache'
|
2
4
|
require 'dry/core/class_attributes'
|
3
5
|
|
@@ -86,7 +88,7 @@ module ROM
|
|
86
88
|
|
87
89
|
# @!attribute [r] container
|
88
90
|
# @return [ROM::Container] The container used to set up a repo
|
89
|
-
|
91
|
+
option :container, allow: ROM::Container
|
90
92
|
|
91
93
|
# @!attribute [r] struct_namespace
|
92
94
|
# @return [Module,Class] The namespace for auto-generated structs
|
@@ -100,13 +102,10 @@ module ROM
|
|
100
102
|
# @return [RelationRegistry] The relation proxy registry used by a repo
|
101
103
|
attr_reader :relations
|
102
104
|
|
103
|
-
# Initializes a new
|
104
|
-
# the passed container
|
105
|
-
#
|
106
|
-
# @param container [ROM::Container] The rom container with relations and optional commands
|
105
|
+
# Initializes a new repository object
|
107
106
|
#
|
108
107
|
# @api private
|
109
|
-
def initialize(
|
108
|
+
def initialize(*)
|
110
109
|
super
|
111
110
|
@relations = {}
|
112
111
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dry/core/cache'
|
2
4
|
|
3
5
|
require 'rom/repository/relation_reader'
|
@@ -28,22 +30,36 @@ module ROM
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
# Initialize a new repository object
|
33
|
+
# Initialize a new repository object, establishing configured relation proxies from
|
34
|
+
# the passed container
|
35
|
+
#
|
36
|
+
# @overload new(container, **options)
|
37
|
+
# Initialize with container as leading parameter
|
38
|
+
#
|
39
|
+
# @param [ROM::Container] container Finalized rom container
|
32
40
|
#
|
33
|
-
#
|
41
|
+
# @param [Hash] options Repository options
|
42
|
+
# @option options [Module] :struct_namespace Custom struct namespace
|
43
|
+
# @option options [Boolean] :auto_struct Enable/Disable auto-struct mapping
|
34
44
|
#
|
35
|
-
# @
|
36
|
-
#
|
37
|
-
#
|
45
|
+
# @overload new(**options)
|
46
|
+
# Inititalize with container as option
|
47
|
+
#
|
48
|
+
# @param [Hash] options Repository options
|
49
|
+
# @option options [ROM::Container] :container Finalized rom container
|
50
|
+
# @option options [Module] :struct_namespace Custom struct namespace
|
51
|
+
# @option options [Boolean] :auto_struct Enable/Disable auto-struct mapping
|
38
52
|
#
|
39
53
|
# @api public
|
40
|
-
def new(container, options
|
54
|
+
def new(container = nil, **options)
|
55
|
+
container ||= options.fetch(:container)
|
56
|
+
|
41
57
|
unless relation_reader
|
42
58
|
relation_reader(RelationReader.new(self, container.relations.elements.keys))
|
43
59
|
include(relation_reader)
|
44
60
|
end
|
45
61
|
|
46
|
-
super
|
62
|
+
super(options.merge(container: container))
|
47
63
|
end
|
48
64
|
|
49
65
|
# Inherits configured relations and commands
|
data/lib/rom/repository/root.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'dry/core/class_attributes'
|
2
4
|
|
3
5
|
module ROM
|
@@ -56,48 +58,10 @@ module ROM
|
|
56
58
|
end
|
57
59
|
|
58
60
|
# @see Repository#initialize
|
59
|
-
def initialize(
|
61
|
+
def initialize(*)
|
60
62
|
super
|
61
63
|
@root = set_relation(self.class.root)
|
62
64
|
end
|
63
|
-
|
64
|
-
# Compose a relation aggregate from the root relation
|
65
|
-
#
|
66
|
-
# @overload aggregate(*associations)
|
67
|
-
# Composes an aggregate from configured associations on the root relation
|
68
|
-
#
|
69
|
-
# @example
|
70
|
-
# user_repo.aggregate(:tasks, :posts)
|
71
|
-
#
|
72
|
-
# @param *associations [Array<Symbol>] A list of association names
|
73
|
-
#
|
74
|
-
# @overload aggregate(*associations, *assoc_opts)
|
75
|
-
# Composes an aggregate from configured associations and assoc opts
|
76
|
-
# on the root relation
|
77
|
-
#
|
78
|
-
# @example
|
79
|
-
# user_repo.aggregate(:tasks, posts: :tags)
|
80
|
-
#
|
81
|
-
# @param *associations [Array<Symbol>] A list of association names
|
82
|
-
# @param [Hash] Association options for nested aggregates
|
83
|
-
#
|
84
|
-
# @overload aggregate(options)
|
85
|
-
# Composes an aggregate by delegating to combine method.
|
86
|
-
#
|
87
|
-
# @example
|
88
|
-
# user_repo.aggregate(tasks: :labels)
|
89
|
-
# user_repo.aggregate(posts: [:tags, :comments])
|
90
|
-
#
|
91
|
-
# @param options [Hash] An option hash
|
92
|
-
#
|
93
|
-
# @see Relation::Combine#combine_children
|
94
|
-
#
|
95
|
-
# @return [Relation]
|
96
|
-
#
|
97
|
-
# @api public
|
98
|
-
def aggregate(*args)
|
99
|
-
root.combine(*args)
|
100
|
-
end
|
101
65
|
end
|
102
66
|
end
|
103
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-repository
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-initializer
|
@@ -16,42 +16,48 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.0.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '3.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: dry-core
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
39
|
+
version: '0.4'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
46
|
+
version: '0.4'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rom-core
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '5.0'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '5.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rake
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,8 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
121
|
- !ruby/object:Gem::Version
|
116
122
|
version: '0'
|
117
123
|
requirements: []
|
118
|
-
|
119
|
-
rubygems_version: 2.6.11
|
124
|
+
rubygems_version: 3.0.3
|
120
125
|
signing_key:
|
121
126
|
specification_version: 4
|
122
127
|
summary: Repository abstraction for rom-rb
|