graphiti-activegraph 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79f25c472d8becc7f194ffe8a43395e95c3419d9aa545d5cb6f6fc0f0266e1a2
|
4
|
+
data.tar.gz: 9e39773e46342901adb5b47426ebfc7f28af3e50ef25966df09531a934e2dabb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b67f798771e0908d933b9dcd90ef68842e0447b16ac085e1e612b8f0b139b63b43554e73e4e5a943dcdde17aa5f23d77ebc33de6a08f75a715b426abf7eb847c
|
7
|
+
data.tar.gz: a96c79383cd517a5012fcb5a4b91dce14f5555cfbcc6fcf7ff5f77ba2c390482185852b2270aab4a8ada23b73ce88583209da8594c7e0d86df506556d63b9dd2
|
data/.github/workflows/specs.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -26,6 +26,12 @@ Features:
|
|
26
26
|
|
27
27
|
- Relationships mentioned in sparse field param (and not in include), will now be returned in relationship block of response
|
28
28
|
|
29
|
+
## 0.1.20
|
30
|
+
|
31
|
+
Features:
|
32
|
+
|
33
|
+
- With graphiti config variable "allow_sidepost" you can allow/disallow sideposting, by default it is allowed.
|
34
|
+
|
29
35
|
<!-- ### [version (DD-MM-YYYY)] -->
|
30
36
|
<!-- Breaking changes:-->
|
31
37
|
<!-- Features:-->
|
@@ -147,9 +147,7 @@ module Graphiti::ActiveGraph
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def process_relationship_attrs(x, rel_attrs, assign_multiple)
|
150
|
-
x[:object] = x
|
151
|
-
.persist_with_relationships(x[:meta], x[:attributes], x[:relationships], self, x[:foreign_key])
|
152
|
-
|
150
|
+
x[:object] = find_record(x)
|
153
151
|
resource = @persistence.instance_variable_get(:@resource)
|
154
152
|
meta = @persistence.instance_variable_get(:@meta)
|
155
153
|
# Relationship start/end nodes cannot be changed once persisted
|
@@ -170,6 +168,16 @@ module Graphiti::ActiveGraph
|
|
170
168
|
rel_map[:object]
|
171
169
|
end
|
172
170
|
end
|
171
|
+
|
172
|
+
def find_record(x)
|
173
|
+
if Graphiti.config.allow_sidepost
|
174
|
+
x[:object] = x[:resource]
|
175
|
+
.persist_with_relationships(x[:meta], x[:attributes], x[:relationships], self, x[:foreign_key])
|
176
|
+
else
|
177
|
+
id = x.dig(:attributes, :id)
|
178
|
+
x[:resource].model.find(id) if id
|
179
|
+
end
|
180
|
+
end
|
173
181
|
end
|
174
182
|
end
|
175
183
|
end
|
data/lib/graphiti-activegraph.rb
CHANGED
@@ -33,6 +33,7 @@ Graphiti::Resource.extend Graphiti::ActiveGraph::Resource
|
|
33
33
|
Graphiti::ResourceProxy.prepend Graphiti::ActiveGraph::ResourceProxy
|
34
34
|
Graphiti::Runner.prepend Graphiti::ActiveGraph::Runner
|
35
35
|
Graphiti::Scope.prepend Graphiti::ActiveGraph::SideloadResolve
|
36
|
+
Graphiti::Configuration.include Graphiti::SidepostConfiguration
|
36
37
|
|
37
38
|
# JSONAPI extensions
|
38
39
|
JSONAPI::Serializable::Resource.prepend Graphiti::ActiveGraph::JsonapiExt::Serializable::ResourceExt
|
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.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hardik Joshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphiti
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/graphiti/active_graph/util/serializer_attribute.rb
|
186
186
|
- lib/graphiti/active_graph/util/serializer_relationship.rb
|
187
187
|
- lib/graphiti/active_graph/version.rb
|
188
|
+
- lib/graphiti/sidepost_configuration.rb
|
188
189
|
homepage: https://github.com/mrhardikjoshi/graphiti-activegraph
|
189
190
|
licenses:
|
190
191
|
- MIT
|