graphiti 1.2.6 → 1.2.7

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: f71f80174c5c0982ea1f0d3c63ebcbccb76a9f6bac5b632e6a7a8b39460b2b8a
4
- data.tar.gz: 48d23a31698373be0953c8a77e24e2f6cf4f0711e0bdee25ddcf4c74125f04cf
3
+ metadata.gz: 1d04305bd43a58f1a835af8e80a03f599430303cc967a99f4f662679eb5c0968
4
+ data.tar.gz: 869acd442f3b00895c72023a20ed9080f06559e0ba619b05bc2366169b776b72
5
5
  SHA512:
6
- metadata.gz: 02ae503dfeedd57ccd8a25e8f14432003dd11c2e20591fc21b26f1e8ea0afdd75c8be551ea6520e2da29f95a0d589b70fdad2d37b9be45c10ff813004fa1b417
7
- data.tar.gz: 3f5e8ed4262a7e16b45068102ace2afadc43e5e8863f91d87db93573bc66e3cf85cce1889d4afd2fdabc691f2301e3b9499a4c4264bbe6cf7801ba333d932caa
6
+ metadata.gz: 82c3cc4fe7cfcc01deca4594460894c00c367f267a6d080bdc98b104e5d29b247ca858a80afc513faeeafc6e5d9fc12fb28dc36765a25d2dc2eab453bb2d5a08
7
+ data.tar.gz: 5351083894448c44d55cc88de12c2ad81c6319c8e2e7c7afc1a3a3db40b4abff30b51d90ed210cc2c940c013bf367d4f9f06c66b93954836febe2ba316ba6643
@@ -114,8 +114,8 @@ class Graphiti::Sideload::PolymorphicBelongsTo < Graphiti::Sideload::BelongsTo
114
114
 
115
115
  match = ->(c) { c.group_name == group_name.to_sym }
116
116
  if (sideload = children.values.find(&match))
117
- query = remove_invalid_sideloads(sideload.resource, query)
118
- sideload.resolve(group, query, graph_parent)
117
+ duped = remove_invalid_sideloads(sideload.resource, query)
118
+ sideload.resolve(group, duped, graph_parent)
119
119
  else
120
120
  err = ::Graphiti::Errors::PolymorphicSideloadChildNotFound
121
121
  raise err.new(self, group_name)
@@ -127,14 +127,16 @@ class Graphiti::Sideload::PolymorphicBelongsTo < Graphiti::Sideload::BelongsTo
127
127
 
128
128
  # We may be requesting a relationship that some subclasses support,
129
129
  # but not others. Remove anything we don't support.
130
+ # TODO: spec to ensure this dupe logic doesn't mutate the original
130
131
  def remove_invalid_sideloads(resource, query)
131
- query = query.dup
132
- query.instance_variable_set(:@hash, nil)
133
- query.sideloads.each_pair do |key, value|
132
+ duped = query.dup
133
+ duped.instance_variable_set(:@hash, nil)
134
+ duped.instance_variable_set(:@sideloads, ::Graphiti::Util::Hash.deep_dup(query.sideloads))
135
+ duped.sideloads.each_pair do |key, value|
134
136
  unless resource.class.sideload(key)
135
- query.sideloads.delete(key)
137
+ duped.sideloads.delete(key)
136
138
  end
137
139
  end
138
- query
140
+ duped
139
141
  end
140
142
  end
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.2.6"
2
+ VERSION = "1.2.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable
@@ -344,8 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  - !ruby/object:Gem::Version
345
345
  version: '0'
346
346
  requirements: []
347
- rubyforge_project:
348
- rubygems_version: 2.7.6
347
+ rubygems_version: 3.0.6
349
348
  signing_key:
350
349
  specification_version: 4
351
350
  summary: Easily build jsonapi.org-compatible APIs