graphiti-activegraph 0.1.22 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/specs.yml +16 -10
- data/CHANGELOG.md +6 -0
- data/Gemfile +0 -10
- data/graphiti-activegraph.gemspec +3 -1
- data/lib/graphiti/active_graph/adapters/active_graph/has_many_sideload.rb +0 -8
- data/lib/graphiti/active_graph/adapters/active_graph/has_one_sideload.rb +0 -8
- data/lib/graphiti/active_graph/adapters/active_graph/polymorphic_belongs_to.rb +4 -8
- data/lib/graphiti/active_graph/adapters/active_graph/sideload.rb +9 -51
- data/lib/graphiti/active_graph/deserializer.rb +4 -4
- data/lib/graphiti/active_graph/version.rb +1 -1
- data/lib/graphiti-activegraph.rb +2 -1
- metadata +41 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d88ca37172c5b507a37ae3744f0a2ac86485b47f5494f0e080f6dbe7e7137738
|
4
|
+
data.tar.gz: b78b22b43bc9913ded8262a5d5d16fa2a6d6d5dbc0d8f4b0cfa094231289f858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 663ff44a72d8f833f5156e3dd0d3a960c3c77220a0b9191b20afc15104013d267f92c9ff1ed22927f405199c3bc074fa92bbed4d5f57063150a778f7efe5dcc9
|
7
|
+
data.tar.gz: 9f19e81f5b2c7fd70585a3ef493a83c06080df69593ae23bd56fd723950ef87a2ecd4c05a6c475c87e1efc627a256aad4597a0c8b77fc731ad7a04b380030892
|
data/.github/workflows/specs.yml
CHANGED
@@ -18,14 +18,20 @@ jobs:
|
|
18
18
|
strategy:
|
19
19
|
fail-fast: false
|
20
20
|
matrix:
|
21
|
-
ruby-version: [ jruby
|
22
|
-
|
21
|
+
ruby-version: [ jruby ]
|
22
|
+
env:
|
23
|
+
JRUBY_OPTS: --debug -J-Xmx1280m -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF
|
23
24
|
steps:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
- uses: actions/checkout@v3
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true
|
31
|
+
- name: Set up Java
|
32
|
+
uses: actions/setup-java@v3
|
33
|
+
with:
|
34
|
+
distribution: 'temurin'
|
35
|
+
java-version: 17
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -44,6 +44,12 @@ Fixes:
|
|
44
44
|
|
45
45
|
- when rendering preloaded resources, we were not applying scoping. Now we are skipping around_scoping callback too.
|
46
46
|
|
47
|
+
## 0.1.22 (29-04-2024)
|
48
|
+
|
49
|
+
Features:
|
50
|
+
|
51
|
+
- Added support for UUID
|
52
|
+
|
47
53
|
<!-- ### [version (DD-MM-YYYY)] -->
|
48
54
|
<!-- Breaking changes:-->
|
49
55
|
<!-- Features:-->
|
data/Gemfile
CHANGED
@@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "graphiti", ">= 1.2.0"
|
21
|
-
spec.add_dependency "activegraph", "
|
21
|
+
spec.add_dependency "activegraph", "~> 12.0.0.beta.4"
|
22
|
+
spec.add_dependency "activesupport", ">= 6.0"
|
22
23
|
spec.add_dependency "zeitwerk"
|
23
24
|
|
24
25
|
spec.add_development_dependency "faraday", "~> 0.15"
|
@@ -27,5 +28,6 @@ Gem::Specification.new do |spec|
|
|
27
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
29
|
spec.add_development_dependency "graphiti_spec_helpers", "1.0.beta.4"
|
29
30
|
spec.add_development_dependency "standard"
|
31
|
+
spec.add_development_dependency "pry"
|
30
32
|
spec.add_development_dependency "rspec", "~> 3.9.0"
|
31
33
|
end
|
@@ -1,14 +1,6 @@
|
|
1
1
|
class Graphiti::ActiveGraph::Adapters::ActiveGraph::HasManySideload < Graphiti::Sideload::HasMany
|
2
2
|
include Graphiti::ActiveGraph::Adapters::ActiveGraph::Sideload
|
3
3
|
|
4
|
-
def default_base_scope
|
5
|
-
resource_class.model.all
|
6
|
-
end
|
7
|
-
|
8
|
-
def infer_foreign_key
|
9
|
-
association_name.to_sym
|
10
|
-
end
|
11
|
-
|
12
4
|
def default_value_when_empty
|
13
5
|
[]
|
14
6
|
end
|
@@ -1,14 +1,6 @@
|
|
1
1
|
class Graphiti::ActiveGraph::Adapters::ActiveGraph::HasOneSideload < Graphiti::Sideload::HasOne
|
2
2
|
include Graphiti::ActiveGraph::Adapters::ActiveGraph::Sideload
|
3
3
|
|
4
|
-
def default_base_scope
|
5
|
-
resource_class.model.all
|
6
|
-
end
|
7
|
-
|
8
|
-
def infer_foreign_key
|
9
|
-
association_name.to_sym
|
10
|
-
end
|
11
|
-
|
12
4
|
def default_value_when_empty
|
13
5
|
nil
|
14
6
|
end
|
@@ -1,15 +1,11 @@
|
|
1
1
|
class Graphiti::ActiveGraph::Adapters::ActiveGraph::PolymorphicBelongsTo < Graphiti::Sideload::PolymorphicBelongsTo
|
2
2
|
include Graphiti::ActiveGraph::Adapters::ActiveGraph::Sideload
|
3
3
|
|
4
|
-
def default_base_scope
|
5
|
-
resource_class.model.all
|
6
|
-
end
|
7
|
-
|
8
|
-
def infer_foreign_key
|
9
|
-
association_name.to_sym
|
10
|
-
end
|
11
|
-
|
12
4
|
def default_value_when_empty
|
13
5
|
nil
|
14
6
|
end
|
7
|
+
|
8
|
+
def polymorphic?
|
9
|
+
true
|
10
|
+
end
|
15
11
|
end
|
@@ -12,57 +12,15 @@ module Graphiti::ActiveGraph::Adapters::ActiveGraph::Sideload
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# else
|
19
|
-
# resource.base_scope
|
20
|
-
# end
|
21
|
-
# end
|
22
|
-
|
23
|
-
# def load(parents, query, graph_parent)
|
24
|
-
# params, opts, proxy = nil, nil, nil
|
25
|
-
|
26
|
-
# with_error_handling Errors::SideloadParamsError do
|
27
|
-
# params = load_params(parents, query)
|
28
|
-
# params_proc&.call(params, parents, context)
|
29
|
-
# return [] if blank_query?(params)
|
30
|
-
# opts = load_options(parents, query)
|
31
|
-
# opts[:sideload] = self
|
32
|
-
# opts[:parent] = graph_parent
|
33
|
-
# end
|
34
|
-
|
35
|
-
# with_error_handling(Errors::SideloadQueryBuildingError) do
|
36
|
-
# proxy = resource.class._all(params, opts, base_scope)
|
37
|
-
# pre_load_proc&.call(proxy, parents)
|
38
|
-
# end
|
39
|
-
|
40
|
-
# proxy.to_a
|
41
|
-
# end
|
42
|
-
|
43
|
-
# def load(parents, _, _)
|
44
|
-
# child_arr = []
|
45
|
-
# @child_map = resource_with_parent_assoc(parents).each_with_object({}) do |arr, hash|
|
46
|
-
# child_obj = arr.first
|
47
|
-
# parent_uuid = arr.last
|
48
|
-
# hash[parent_uuid] ||= []
|
49
|
-
# hash[parent_uuid] << child_obj
|
50
|
-
# child_arr << child_obj
|
51
|
-
# end
|
52
|
-
|
53
|
-
# fire_assign(parents, child_arr)
|
54
|
-
# child_arr
|
55
|
-
# end
|
15
|
+
def default_base_scope
|
16
|
+
resource_class.model.all
|
17
|
+
end
|
56
18
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
# scope = self.class.sideload_scope
|
19
|
+
def infer_foreign_key
|
20
|
+
association_name.to_sym
|
21
|
+
end
|
61
22
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# proxy.send(association_name, :children)
|
66
|
-
# end.query.pluck(:children, p: :neo_id)
|
67
|
-
# end
|
23
|
+
def polymorphic?
|
24
|
+
false
|
25
|
+
end
|
68
26
|
end
|
@@ -64,11 +64,11 @@ module Graphiti::ActiveGraph
|
|
64
64
|
|
65
65
|
def add_path_id_to_relationships!(params)
|
66
66
|
return params if path_relationships_updated?
|
67
|
-
detect_conflict(:id, @params[:id], attributes[:id])
|
67
|
+
detect_conflict(:id, @params[:id]&.to_s, attributes[:id]&.to_s)
|
68
68
|
path_map.each do |rel_name, path_value|
|
69
69
|
body_value = relationships.dig(rel_name, :attributes, :id)
|
70
70
|
if body_value
|
71
|
-
detect_conflict(rel_name, path_value
|
71
|
+
detect_conflict(rel_name, path_value&.to_s, body_value&.to_s)
|
72
72
|
else
|
73
73
|
update_params(params, rel_name, path_value)
|
74
74
|
update_realationships(rel_name, path_value)
|
@@ -92,13 +92,13 @@ module Graphiti::ActiveGraph
|
|
92
92
|
params[:data][:relationships][rel_name] = {
|
93
93
|
data: {
|
94
94
|
type: derive_resource_type(rel_name),
|
95
|
-
id: path_value
|
95
|
+
id: path_value
|
96
96
|
}
|
97
97
|
}
|
98
98
|
end
|
99
99
|
|
100
100
|
def update_realationships(rel_name, path_value)
|
101
|
-
relationships[rel_name] = { meta: {}, attributes: { id: path_value
|
101
|
+
relationships[rel_name] = { meta: {}, attributes: { id: path_value } }
|
102
102
|
end
|
103
103
|
|
104
104
|
def path_map
|
data/lib/graphiti-activegraph.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_support'
|
2
2
|
require 'active_graph'
|
3
3
|
|
4
4
|
# Workaround for jruby prepend issue https://github.com/jruby/jruby/issues/6971
|
@@ -13,6 +13,7 @@ require 'graphiti/resource/persistence'
|
|
13
13
|
require 'graphiti/resource/interface'
|
14
14
|
# End workaround for jruby prepend issue
|
15
15
|
|
16
|
+
require 'zeitwerk'
|
16
17
|
loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
17
18
|
loader.inflector.inflect 'version' => 'VERSION'
|
18
19
|
loader.ignore(File.expand_path('graphiti-activegraph.rb', __dir__))
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti-activegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hardik Joshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: graphiti
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: 1.2.0
|
19
|
+
name: graphiti
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -25,26 +25,40 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 12.0.0.beta.4
|
28
33
|
name: activegraph
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 12.0.0.beta.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
30
43
|
requirements:
|
31
44
|
- - ">="
|
32
45
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
46
|
+
version: '6.0'
|
47
|
+
name: activesupport
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: '6.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: zeitwerk
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
44
57
|
requirements:
|
45
58
|
- - ">="
|
46
59
|
- !ruby/object:Gem::Version
|
47
60
|
version: '0'
|
61
|
+
name: zeitwerk
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -53,12 +67,12 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: faraday
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
58
71
|
requirements:
|
59
72
|
- - "~>"
|
60
73
|
- !ruby/object:Gem::Version
|
61
74
|
version: '0.15'
|
75
|
+
name: faraday
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -67,12 +81,12 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0.15'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: kaminari
|
71
84
|
requirement: !ruby/object:Gem::Requirement
|
72
85
|
requirements:
|
73
86
|
- - "~>"
|
74
87
|
- !ruby/object:Gem::Version
|
75
88
|
version: '0.17'
|
89
|
+
name: kaminari
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -81,12 +95,12 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0.17'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: bundler
|
85
98
|
requirement: !ruby/object:Gem::Requirement
|
86
99
|
requirements:
|
87
100
|
- - ">="
|
88
101
|
- !ruby/object:Gem::Version
|
89
102
|
version: '0'
|
103
|
+
name: bundler
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -95,12 +109,12 @@ dependencies:
|
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rake
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
100
113
|
requirements:
|
101
114
|
- - "~>"
|
102
115
|
- !ruby/object:Gem::Version
|
103
116
|
version: '10.0'
|
117
|
+
name: rake
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -109,12 +123,12 @@ dependencies:
|
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '10.0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: graphiti_spec_helpers
|
113
126
|
requirement: !ruby/object:Gem::Requirement
|
114
127
|
requirements:
|
115
128
|
- - '='
|
116
129
|
- !ruby/object:Gem::Version
|
117
130
|
version: 1.0.beta.4
|
131
|
+
name: graphiti_spec_helpers
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -123,12 +137,26 @@ dependencies:
|
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: 1.0.beta.4
|
125
139
|
- !ruby/object:Gem::Dependency
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
126
145
|
name: standard
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
127
154
|
requirement: !ruby/object:Gem::Requirement
|
128
155
|
requirements:
|
129
156
|
- - ">="
|
130
157
|
- !ruby/object:Gem::Version
|
131
158
|
version: '0'
|
159
|
+
name: pry
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -137,12 +165,12 @@ dependencies:
|
|
137
165
|
- !ruby/object:Gem::Version
|
138
166
|
version: '0'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: rspec
|
141
168
|
requirement: !ruby/object:Gem::Requirement
|
142
169
|
requirements:
|
143
170
|
- - "~>"
|
144
171
|
- !ruby/object:Gem::Version
|
145
172
|
version: 3.9.0
|
173
|
+
name: rspec
|
146
174
|
type: :development
|
147
175
|
prerelease: false
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -205,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
233
|
- !ruby/object:Gem::Version
|
206
234
|
version: '0'
|
207
235
|
requirements: []
|
208
|
-
rubygems_version: 3.3.
|
236
|
+
rubygems_version: 3.3.26
|
209
237
|
signing_key:
|
210
238
|
specification_version: 4
|
211
239
|
summary: Easily build jsonapi.org-compatible APIs for GraphDB
|