skylight-core 4.2.3 → 4.3.0

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: 98240d4732a290ffb184fdc3b682f74fd167eb6061558febaef8139ac6aa4fd3
4
- data.tar.gz: 81099a9f8a59907ebf44024645f537fca06b2e758ec65ca68253046b1d4a90e5
3
+ metadata.gz: b967f11a876f41f4337a88fce73301993cf3160f862186b64a7d03a931b5ccb6
4
+ data.tar.gz: b33c7c1ecbfab7545ea7efdbb691371bc35a0f90ef786c8fb8a60e3db9f7a8a8
5
5
  SHA512:
6
- metadata.gz: 82b46e299d48abd8d2cb5ff4a543d324145cd55a8c2b9d9fd8413a0738aedc111bb0979f1b989aabbae2b9b894cf0b98c1f1b701390146519674165bedbe7736
7
- data.tar.gz: 7ff7cc95fef0289039a7b2df226d0bfafcb0c9cbca53d2cbd89099c19b9a735806e2701747f002252ad387e666029718639d9001c8be3cf13abd8816ab1450cd
6
+ metadata.gz: '0285603cf5bdd82f8cfa8c9e0f3c54569b8e46051ccd16926e14498e024e5b92c9432b150422285625eee6b359aa46c036e483bda9a0cd7cf1dfd94edcc0d530'
7
+ data.tar.gz: 27fdc7636b44ddaece0b205e425a6546b5ef39ad0671a1719983b8133825940bded7c711abf5631eab83326c79fbd20adb0925c41aa934155670487cc5c4bb7a
@@ -25,7 +25,8 @@ module Skylight::Core
25
25
  end
26
26
 
27
27
  def get_namespace(endpoint)
28
- ::Grape::Namespace.joined_space(endpoint.namespace_stackable(:namespace))
28
+ # slice off preceding slash for data continuity
29
+ ::Grape::Namespace.joined_space_path(endpoint.namespace_stackable(:namespace)).to_s[1..-1]
29
30
  end
30
31
  end
31
32
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/inflector"
4
+
3
5
  module Skylight::Core::Normalizers::GraphQL
4
6
  # Some AS::N events in GraphQL are not super useful.
5
7
  # We are purposefully ignoring the following keys (and you probably shouldn't add them):
@@ -22,7 +24,12 @@ module Skylight::Core::Normalizers::GraphQL
22
24
  end
23
25
 
24
26
  def self.inherited(klass)
25
- klass.const_set(:KEY, klass.name.demodulize.underscore.freeze)
27
+ klass.const_set(
28
+ :KEY,
29
+ ActiveSupport::Inflector.underscore(
30
+ ActiveSupport::Inflector.demodulize(klass.name)
31
+ ).freeze
32
+ )
26
33
  end
27
34
 
28
35
  def self.key
@@ -38,6 +45,12 @@ module Skylight::Core::Normalizers::GraphQL
38
45
  def key
39
46
  self.class.key
40
47
  end
48
+
49
+ def extract_query_name(query)
50
+ query&.context&.[](:skylight_endpoint) ||
51
+ query&.operation_name ||
52
+ ANONYMOUS
53
+ end
41
54
  end
42
55
 
43
56
  class Lex < Base
@@ -69,7 +82,7 @@ module Skylight::Core::Normalizers::GraphQL
69
82
  # has not been done yet at the point where execute_multiplex starts.
70
83
  # [1] https://graphql.org/learn/serving-over-http/#post-request
71
84
  queries, has_errors = payload[:multiplex].queries.each_with_object([Set.new, Set.new]) do |query, (names, errors)|
72
- names << (query.operation_name || ANONYMOUS)
85
+ names << extract_query_name(query)
73
86
  errors << query.static_errors.any?
74
87
  end
75
88
 
@@ -90,7 +103,7 @@ module Skylight::Core::Normalizers::GraphQL
90
103
  register_graphql
91
104
 
92
105
  def normalize(trace, _name, payload)
93
- query_name = payload[:query]&.operation_name || ANONYMOUS
106
+ query_name = extract_query_name(payload[:query])
94
107
 
95
108
  if query_name == ANONYMOUS
96
109
  meta = { mute_children: true }
@@ -1,5 +1,5 @@
1
1
  module Skylight
2
2
  module Core
3
- VERSION = "4.2.3".freeze
3
+ VERSION = "4.3.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-10 00:00:00.000000000 Z
11
+ date: 2020-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport