inigorb 0.29.6 → 0.29.10

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: 23f7811b236370b83dfe61104e7c5b99fa5e9db71ea2bf53e6a4bafe24b06673
4
- data.tar.gz: b43b92c3ab9be91a920d54301fa38e7d95d40364b5cd88d0b29902d873d48a5f
3
+ metadata.gz: ac59b20430dc6ed967b30be6bebb06dd814c3e94a4258125830086d726356651
4
+ data.tar.gz: c7bdd06a8adf2308333aa3c5c54650411c66380215d8b46c43b648f750504c18
5
5
  SHA512:
6
- metadata.gz: 357fd133159b8a6e59d859dd1226aad2eb4a63a0e9c3b9cb1398301433f39f246db80e947479db54c5789a36d73050b4ce4416cb591c3b8d1d7d5cbcd1a37139
7
- data.tar.gz: 3e648a21cfe7c88ecb61ab5d8b4beaef43fcff0329abb0455f4bee1cf92c9a4655a355db7fbbcfd4915e3a21d2f160280b6223d0623784167a9bd134d306bcb7
6
+ metadata.gz: 45ec5af53b9270d6f0846da8e757a9d5a22046e3513861edc7b1dadde0090753d864a96a82fa93a334f0cce854eaa209e3ba3b02ae5cdad437d17e15b066da5e
7
+ data.tar.gz: 7a7bbf69f2fe4ff8e8f5c3cbd77a6126fb587ff98f7959c1c6caef8de01ba5926674fe34a42ddf09d509bc37fdf62c5660a08117382a4fdc70b579eea846b597
data/README.md CHANGED
@@ -4,27 +4,31 @@
4
4
  <img height="25" src="/assets/ruby.svg">
5
5
 
6
6
  <p align="center">
7
- GraphQL Middleware
7
+ GraphQL for Platform Teams
8
8
  <br />
9
- <a href="https://docs.inigo.io"><strong>Explore the docs »</strong></a>
10
- <br /> <br />
11
- <a href="https://inigo.io">Homepage</a>
9
+ <a href="https://inigo.io">Home</a>
12
10
  ·
13
- <a href="https://github.com/inigolabs/inigo-ruby/tree/master/example-rails">View an example</a>
11
+ <a href="https://docs.inigo.io/">Docs</a>
14
12
  ·
15
- <a href="https://github.com/inigolabs/inigo-ruby/issues">Report Bug</a>
13
+ <a href="https://github.com/inigolabs/inigo-rb/issues">Issues</a>
14
+ ·
15
+ <a href="https://slack.inigo.io/">Slack</a>
16
16
  </p>
17
17
  </div>
18
18
 
19
- ### Documentation
19
+ ### Overview
20
+ Gain instant monitoring and protection into GraphQL APIs. Unblock platform teams and accelerate GraphQL adoption.
21
+ Inigo's platform integration offers GraphQL Security, Analytics, Rate-limiting, Access Control and more.
20
22
 
21
23
  This package is the Inigo plugin for Ruby servers.
22
24
 
23
- Documentation is available here: [docs.inigo.io](https://docs.inigo.io/docs/deployment)
25
+ ### Documentation
26
+ * [Docs](https://docs.inigo.io/)
27
+ * [Integration](https://docs.inigo.io/product/agent_installation/ruby_on_rails)
28
+ * [Example](https://github.com/inigolabs/inigo-rb/tree/master/example-rails)
24
29
 
25
30
  ### Contributing
26
-
27
31
  Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
28
32
 
29
33
  ### License
30
- Distributed under the MIT License.
34
+ Distributed under the MIT License.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -6,49 +6,20 @@ require 'inigorb/ffimod'
6
6
  require 'inigorb/query'
7
7
 
8
8
  module Inigo
9
- class Tracer < GraphQL::Tracing::PlatformTracing
9
+ module Tracer
10
10
  @@instance = nil
11
11
 
12
- def self.instance
13
- @@instance
14
- end
15
-
16
- def self.instance=(value)
17
- @@instance = value
18
- end
19
-
20
12
  def initialize(options = {})
21
- super(options)
22
13
  # add options like logger logic
23
14
  end
24
15
 
25
- def self.use(schema, **kwargs)
26
- @@schema = schema
27
- super
28
- end
29
-
30
- self.platform_keys = {
31
- 'lex' => 'lex',
32
- 'parse' => 'parse',
33
- 'validate' => 'validate',
34
- 'analyze_query' => 'analyze_query',
35
- 'analyze_multiplex' => 'analyze_multiplex',
36
- 'execute_multiplex' => 'execute_multiplex',
37
- 'execute_query' => 'execute_query',
38
- 'execute_query_lazy' => 'execute_query_lazy'
39
- }
40
-
41
- def platform_trace(platform_key, key, data)
16
+ def execute_multiplex(multiplex:)
42
17
  # Ignore execution if Inigo is not initialized
43
- if self.class.instance == 0
44
- return yield
45
- end
46
-
47
- if platform_key != "execute_multiplex"
18
+ if @@instance == 0
48
19
  return yield
49
20
  end
50
21
 
51
- if !data[:multiplex] || !data[:multiplex].queries || data[:multiplex].queries.length == 0
22
+ if !multiplex || !multiplex.queries || multiplex.queries.length == 0
52
23
  return yield
53
24
  end
54
25
 
@@ -58,7 +29,7 @@ module Inigo
58
29
  modified_responses = {}
59
30
  cached_queries = {}
60
31
 
61
- data[:multiplex].queries.each_with_index do |query, index|
32
+ multiplex.queries.each_with_index do |query, index|
62
33
  is_subscription = query.context[:channel] != nil
63
34
  is_init_subscription = is_subscription && !query.context[:subscription_id]
64
35
 
@@ -83,7 +54,7 @@ module Inigo
83
54
  gReq['variables'] = query.provided_variables if query.query_string.nil? || query.query_string.empty?
84
55
  gReq['extensions'] = query.context[:extensions] if query.context[:extensions]
85
56
 
86
- q = Query.new(self.class.instance, JSON.dump(gReq))
57
+ q = Query.new(@@instance, JSON.dump(gReq))
87
58
 
88
59
  headers_obj = query.context[:headers] if query.context[:headers]
89
60
  headers_obj = query.context['request'].headers if headers_obj == nil && query.context['request']
@@ -103,7 +74,7 @@ module Inigo
103
74
  modified_query = GraphQL::Query.new(query.schema, 'query IntrospectionQuery { __schema { queryType { name } } }', context: query.context, operation_name: 'IntrospectionQuery')
104
75
  modified_query.multiplex = query.multiplex
105
76
  # TODO - verify works in all the cases. During the testing it works, simulate multiple queries at the same time to verify.
106
- data[:multiplex].queries[index] = modified_query
77
+ multiplex.queries[index] = modified_query
107
78
 
108
79
  queries.append(q)
109
80
  next
@@ -114,7 +85,7 @@ module Inigo
114
85
  modified_query = GraphQL::Query.new(query.schema, req['query'], context: query.context, operation_name: req['operationName'], variables: req['variables'])
115
86
  modified_query.multiplex = query.multiplex
116
87
  # TODO - verify works in all the cases. During the testing it works, simulate multiple queries at the same time to verify.
117
- data[:multiplex].queries[index] = modified_query
88
+ multiplex.queries[index] = modified_query
118
89
  end
119
90
 
120
91
  if is_subscription
@@ -143,27 +114,12 @@ module Inigo
143
114
  'response_body_counts' => count_response_fields(response.to_h)
144
115
  }
145
116
  processed_response = queries[index].process_response(JSON.dump(resp), is_initial_subscription: is_initial_subscription, copy: needs_copy)
146
- responses[index] = GraphQL::Query::Result.new(query: data[:multiplex].queries[index], values: mod_response(response.to_h, JSON.parse(processed_response)))
117
+ responses[index] = GraphQL::Query::Result.new(query: multiplex.queries[index], values: mod_response(response.to_h, JSON.parse(processed_response)))
147
118
  end
148
119
 
149
120
  responses
150
121
  end
151
122
 
152
- # compat
153
- def platform_authorized_key(type)
154
- "#{type.graphql_name}.authorized.graphql"
155
- end
156
-
157
- # compat
158
- def platform_resolve_type_key(type)
159
- "#{type.graphql_name}.resolve_type.graphql"
160
- end
161
-
162
- # compat
163
- def platform_field_key(type, field)
164
- "graphql.#{type.name}.#{field.name}"
165
- end
166
-
167
123
  def count_response_fields(resp)
168
124
  counts = {}
169
125
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inigorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.6
4
+ version: 0.29.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inigo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt