solis 0.119.0 → 0.120.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c797f44180ed02342106236cb97af580057251b70187f0f73bd764f95ca93a0
4
- data.tar.gz: 1fa0e2d26beafa4a52427c7ee004a37887ee436cdc647b65b16a552684c7e6b9
3
+ metadata.gz: 663d9c6ac4bec283d623346be498856494152c103c1f347a48a79cac7bc19662
4
+ data.tar.gz: 65e2d8370f3e4ff4638e00293b522b6c4d927b91fcb95259dcb3e21e11c5ae39
5
5
  SHA512:
6
- metadata.gz: 4f69ffa1250bf724a7edcce1137d95987c9004d2001edf3c2416106369f673899e549741550f5b4c5567a1ea78be3947f7ce712282a12ac27c181d73824b7ef5
7
- data.tar.gz: 76fa9c6e7d062e7d769aefa33447ec054ccbe503aac2113c0033f2911457d70ddb488d270f77ec834a13ec3af03ad1ff754d6e0a2a943fda8b5dbbdedb4e3ec9
6
+ metadata.gz: b28a6189d553f6e444ebb33760ae7b29abe6ffc084995ba13c69b482a9fc9d562294f293671955e94111e915472aef7a419a2d4b5a9eb1b623dc15f149f9c9df
7
+ data.tar.gz: 24c7b79c0f720b349ecf85c1832ee4e43f3a63d59ba208ce588faa6bf09ed68c09907f57a118832a8a9441e78fb318d7fd50d329d93956ec47b4be4862380a2c
data/lib/solis/model.rb CHANGED
@@ -669,6 +669,15 @@ values ?s {<#{self.graph_id}>}
669
669
  obj.class.ancestors.include?(Solis::Model)
670
670
  end
671
671
 
672
+ # True when only the entity's id is populated — an id-only stub, e.g. an embedded
673
+ # relation materialised by Query#graph_to_object as Model.new(id:).
674
+ def shallow_stub?(entity)
675
+ return false unless solis_model?(entity)
676
+ entity.class.metadata[:attributes].each_key.none? do |attr|
677
+ attr.to_s != 'id' && !entity.instance_variable_get("@#{attr}").nil?
678
+ end
679
+ end
680
+
672
681
  # Helper method to check if an entity is readonly (code table)
673
682
  def readonly_entity?(entity, readonly_list = nil)
674
683
  readonly_list ||= (Solis::Options.instance.get[:embedded_readonly] || []).map(&:to_s)
@@ -821,6 +830,18 @@ values ?s {<#{self.graph_id}>}
821
830
  end
822
831
 
823
832
  def make_graph(graph, hierarchy, id, klass, klass_metadata, resolve_all, known_entities = {}, skip_store_fetch: false)
833
+ # klass may arrive as an id-only stub (embedded relation from Query#graph_to_object,
834
+ # or passed via prefetched_original). Resolve it to the full stored entity once so
835
+ # every attribute is emitted into the graph.
836
+ if !skip_store_fetch && shallow_stub?(klass)
837
+ uuid = id.value.split('/').last
838
+ fetched = klass.query.filter({ filters: { id: [uuid] } }).find_all { |f| f.id == uuid }.first
839
+ unless fetched.nil?
840
+ klass = fetched
841
+ known_entities[uuid] = fetched
842
+ end
843
+ end
844
+
824
845
  klass_metadata[:attributes].each do |attribute, metadata|
825
846
  data = klass.instance_variable_get("@#{attribute}")
826
847
 
data/lib/solis/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Solis
2
- VERSION = "0.119.0"
2
+ VERSION = "0.120.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.119.0
4
+ version: 0.120.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mehmet Celik