graphiti-activegraph 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/CHANGELOG.md +0 -0
- data/LICENSE.txt +21 -0
- data/lib/graphiti/active_graph/sideload_resolve.rb +0 -17
- data/lib/graphiti/active_graph/util/serializer_relationship.rb +3 -4
- data/lib/graphiti/active_graph/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ce7eee981fcd7439be5bba5208039c3c64503edcaaca9ef767cba7b27b5fd22
|
4
|
+
data.tar.gz: d591ab8b478dafe188a47a16044e998115afc9643e75e67e89036dd97891e092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2934711d909710ba68d3c4a86a4c09354190099a775fdb89258daeefa2d185d637b86bc1a635608a14e384c34b18526d7c293ea33db51e47dd5aa9195f29d6e8
|
7
|
+
data.tar.gz: 7baf44eebc6191ac5cb1ce3e6ed7482ac95c495706c67c0bb7f0c090e58d423568bd3f35af914c95b21107322d88691a1a0975c70111c83fa763f695e7dd8477
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
File without changes
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Hardik Joshi
|
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.
|
@@ -1,23 +1,6 @@
|
|
1
1
|
module Graphiti::ActiveGraph
|
2
2
|
module SideloadResolve
|
3
3
|
def resolve_sideloads(parents)
|
4
|
-
@query.sideloads.each_pair do |name, q|
|
5
|
-
sideload = @resource.class.sideload(name)
|
6
|
-
next if sideload.nil? || sideload.shared_remote?
|
7
|
-
|
8
|
-
if sideload.assign_each_proc
|
9
|
-
Array.wrap(parents).each do |parent|
|
10
|
-
children = sideload.assign_each_proc.call(parent) || sideload.default_value_when_empty
|
11
|
-
|
12
|
-
# currently there is no possible way to assign association on activegraph without triggering save
|
13
|
-
# https://github.com/neo4jrb/activegraph/issues/1445
|
14
|
-
# as a workaround we are using instance variable here to store and retrive associations
|
15
|
-
# once above issue is fixed use that fix to assign the association here
|
16
|
-
# and also remove 1) this code and 2) SerializerRelationship#data_proc
|
17
|
-
parent.instance_variable_set("@graphiti_render_#{name}", { data: children })
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
4
|
end
|
22
5
|
end
|
23
6
|
end
|
@@ -6,11 +6,10 @@ module Graphiti::ActiveGraph
|
|
6
6
|
->(_) {
|
7
7
|
# use custom assigned sideload if it is specified via "assign_each_proc"
|
8
8
|
# otherwise retrieve sideload using normal getter on parent object
|
9
|
-
|
10
|
-
|
11
|
-
@object.public_send(sideload_ref.association_name)
|
9
|
+
records = if custom_proc = sideload_ref.assign_each_proc
|
10
|
+
custom_proc.call(@object)
|
12
11
|
else
|
13
|
-
|
12
|
+
@object.public_send(sideload_ref.association_name)
|
14
13
|
end
|
15
14
|
|
16
15
|
if records
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hardik Joshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphiti
|
@@ -187,7 +187,10 @@ extra_rdoc_files: []
|
|
187
187
|
files:
|
188
188
|
- ".gitignore"
|
189
189
|
- ".rspec"
|
190
|
+
- ".travis.yml"
|
191
|
+
- CHANGELOG.md
|
190
192
|
- Gemfile
|
193
|
+
- LICENSE.txt
|
191
194
|
- graphiti-activegraph.gemspec
|
192
195
|
- lib/graphiti-activegraph.rb
|
193
196
|
- lib/graphiti/active_graph/adapters/active_graph.rb
|
@@ -226,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
229
|
- !ruby/object:Gem::Version
|
227
230
|
version: '0'
|
228
231
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
232
|
+
rubygems_version: 3.1.2
|
230
233
|
signing_key:
|
231
234
|
specification_version: 4
|
232
235
|
summary: Easily build jsonapi.org-compatible APIs for GraphDB
|