graphiti 1.7.0 → 1.7.1

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: 48e9df9f78bfe2d9b9303f304541894222fa4eb3d925f2ac68a01e3b0567fbb4
4
- data.tar.gz: d8d010bca5894bc11cc0bfb76f9d88deaf6d95d7b413d937765b58d87fefe1cc
3
+ metadata.gz: fb08a2d097076d868284efb475a82bfb9f44b697bc322dda5a654a6d259384cf
4
+ data.tar.gz: ef60e4a509d87c76973a15a59105a50d9de7635d3084afe2621f23008ff46580
5
5
  SHA512:
6
- metadata.gz: 56ec9608ea8de6b8a8be491e27a8dc0ef83b297a3178e617495d8a63098d8df2d408b944e4f314eacd98e8e87e278e01fa287b68e07961228086ffb21259d509
7
- data.tar.gz: f2077122a2b0a4996a0326f21fcae529724dd6438303f42822eb73605b58801c1c8466d012d8f3edf5899cb82ed234373fcc989f4630b012d7e045c32e40894d
6
+ metadata.gz: bd5489249c9c768f83e05bfcd6be59bacfef2a50826c9eb547ae6a9b12cdfc25fbd54e36d54e0a37264e77458cfdc4415e707aacdeb6377179cf44a7480850a3
7
+ data.tar.gz: 7be1d2008f1f74b3a5203053eb4dc91efe013a33e5c2cada66f409f9de1a515f720e357ef619b8459f1451d90f9fb39c3a130502304f7ce2eb408a421d29f511
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  graphiti changelog
2
2
 
3
+ ## [1.7.1](https://github.com/graphiti-api/graphiti/compare/v1.7.0...v1.7.1) (2024-04-18)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * properly display .find vs .all in debugger statements ([d2a7a03](https://github.com/graphiti-api/graphiti/commit/d2a7a038a649818979d52ccd898e68dba78b051f))
9
+ * rescue error from sideloads updated_at calculation, defaulting to the current time ([661e3b5](https://github.com/graphiti-api/graphiti/commit/661e3b5212e2649870a200067d0d5d52fa962637))
10
+
3
11
  # [1.7.0](https://github.com/graphiti-api/graphiti/compare/v1.6.4...v1.7.0) (2024-03-27)
4
12
 
5
13
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- ![Build Status](https://travis-ci.org/graphiti-api/graphiti.svg?branch=master)
1
+ [![CI](https://github.com/graphiti-api/graphiti/actions/workflows/ci.yml/badge.svg)](https://github.com/graphiti-api/graphiti/actions/workflows/ci.yml)
2
2
  [![Gem Version](https://badge.fury.io/rb/graphiti.svg)](https://badge.fury.io/rb/graphiti)
3
3
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
4
+ [![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
4
5
 
5
6
  <p align="center">
6
7
  <a href="https://www.graphiti.dev/guides">
@@ -36,7 +36,7 @@ module Graphiti
36
36
  json[:sideload] = sideload.name
37
37
  end
38
38
  if params
39
- query = "#{payload[:resource].class.name}.all(#{JSON.pretty_generate(params)}).data"
39
+ query = "#{payload[:resource].class.name}.#{payload[:action]}(#{JSON.pretty_generate(params)}).data"
40
40
  logs << [query, :cyan, true]
41
41
  logs << ["The error occurred when running the above query. Copy/paste it into a rake task or Rails console session to reproduce. Keep in mind you may have to set context.", :yellow, true]
42
42
  else
@@ -64,7 +64,7 @@ module Graphiti
64
64
  query = if sideload.class.scope_proc
65
65
  "#{payload[:resource].class.name}: Manual sideload via .scope"
66
66
  else
67
- "#{payload[:resource].class.name}.all(#{params.inspect})"
67
+ "#{payload[:resource].class.name}.#{payload[:action]}(#{params.inspect})"
68
68
  end
69
69
  logs << [" #{query}", :cyan, true]
70
70
  json[:query] = query
@@ -82,7 +82,7 @@ module Graphiti
82
82
  title = "Top Level Data Retrieval (+ sideloads):"
83
83
  logs << [title, :green, true]
84
84
  json[:title] = title
85
- query = "#{payload[:resource].class.name}.all(#{params.inspect})"
85
+ query = "#{payload[:resource].class.name}.#{payload[:action]}(#{params.inspect})"
86
86
  logs << [query, :cyan, true]
87
87
  json[:query] = query
88
88
  logs << ["Returned Models: #{results}"] if debug_models
@@ -92,16 +92,17 @@ module Graphiti
92
92
  end
93
93
 
94
94
  def updated_at
95
- updated_ats = sideload_resource_proxies.map(&:updated_at)
96
-
95
+ updated_time = nil
97
96
  begin
97
+ updated_ats = sideload_resource_proxies.map(&:updated_at)
98
98
  updated_ats << @object.maximum(:updated_at)
99
+ updated_time = updated_ats.compact.max
99
100
  rescue => e
100
- Graphiti.log("error calculating last_modified_at for #{@resource.class}")
101
+ Graphiti.log(["error calculating last_modified_at for #{@resource.class}", :red])
101
102
  Graphiti.log(e)
102
103
  end
103
104
 
104
- updated_ats.compact.max
105
+ return updated_time || Time.now
105
106
  end
106
107
  alias_method :last_modified_at, :updated_at
107
108
 
@@ -128,9 +129,10 @@ module Graphiti
128
129
  def broadcast_data
129
130
  opts = {
130
131
  resource: @resource,
131
- params: @opts[:params],
132
+ params: @opts[:params] || @query.params,
132
133
  sideload: @opts[:sideload],
133
- parent: @opts[:parent]
134
+ parent: @opts[:parent],
135
+ action: @query.action
134
136
  # Set once data is resolved within block
135
137
  # results: ...
136
138
  }
@@ -12,7 +12,7 @@ module Graphiti
12
12
  end
13
13
 
14
14
  def name
15
- "#{Graphiti.context[:object].request.method} #{Graphiti.context[:object].request.url}"
15
+ "#{Graphiti.context[:object]&.request&.method} #{Graphiti.context[:object]&.request&.url}"
16
16
  end
17
17
 
18
18
  def key
@@ -1,3 +1,3 @@
1
1
  module Graphiti
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
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.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-27 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-serializable