graphiti_gql 0.2.15 → 0.2.16
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/graphiti_gql/active_resource.rb +2 -0
- data/lib/graphiti_gql/engine.rb +2 -16
- data/lib/graphiti_gql/graphiti_hax.rb +8 -0
- data/lib/graphiti_gql/schema/query.rb +1 -1
- data/lib/graphiti_gql/spec_helper.rb +1 -0
- data/lib/graphiti_gql/version.rb +1 -1
- data/lib/graphiti_gql.rb +1 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 535af0267b130ee480022a9058880a17f742ec6aa2209cc2b1d9991a82f9afbc
|
|
4
|
+
data.tar.gz: 43c9d8f5c3ff6147776d71741a2a24996b300fa75c3c495f2a4cb00fb11a14ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5a0ea00caf0626444fd452c6502c07367cca9f579b561fd97ef2f615a6467fb415c82de9782f8d2640b567f9aeea90495e5cebb19533b564b2282afed25846b
|
|
7
|
+
data.tar.gz: 7cdf9e78135dd6257ec9226256d7242af74347762a4d22e4b7f1563f330fd0245b0326e164177fea524338d6c7b95f63f6c29bf13fa7e8e267aabe12affc325a
|
data/Gemfile.lock
CHANGED
data/lib/graphiti_gql/engine.rb
CHANGED
|
@@ -9,34 +9,20 @@ module GraphitiGql
|
|
|
9
9
|
GraphitiGql.schema!
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
module ControllerContext
|
|
13
|
-
def graphql_context
|
|
14
|
-
ctx = { controller: self }
|
|
15
|
-
ctx[:current_user] = current_user if respond_to?(:current_user)
|
|
16
|
-
ctx
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
12
|
initializer "graphiti_gql.define_controller" do
|
|
21
13
|
app_controller = GraphitiGql.config.application_controller || ::ApplicationController
|
|
22
|
-
app_controller.send(:include, ControllerContext)
|
|
23
14
|
|
|
24
15
|
# rubocop:disable Lint/ConstantDefinitionInBlock(Standard)
|
|
25
16
|
class GraphitiGql::ExecutionController < app_controller
|
|
26
17
|
def execute
|
|
27
18
|
params = request.params # avoid strong_parameters
|
|
28
19
|
variables = params[:variables] || {}
|
|
20
|
+
ctx = respond_to?(:graphql_context) ? graphql_context : {}
|
|
29
21
|
result = GraphitiGql.run params[:query],
|
|
30
22
|
params[:variables],
|
|
31
|
-
|
|
23
|
+
ctx
|
|
32
24
|
render json: result
|
|
33
25
|
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def default_context
|
|
38
|
-
defined?(:current_user)
|
|
39
|
-
end
|
|
40
26
|
end
|
|
41
27
|
end
|
|
42
28
|
end
|
|
@@ -68,6 +68,14 @@ module GraphitiGql
|
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
def filter(name, *args, &blk)
|
|
72
|
+
super
|
|
73
|
+
opts = args.extract_options!
|
|
74
|
+
if opts[:if]
|
|
75
|
+
attributes[name][:filterable] = opts[:if]
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
71
79
|
def filter_group(filter_names, *args)
|
|
72
80
|
if filter_names.blank?
|
|
73
81
|
config[:grouped_filters] = {}
|
|
@@ -22,7 +22,7 @@ module GraphitiGql
|
|
|
22
22
|
|
|
23
23
|
def define_entrypoints
|
|
24
24
|
registry.resource_types.each do |registered|
|
|
25
|
-
if
|
|
25
|
+
if registered[:resource].graphql_entrypoint
|
|
26
26
|
Fields::Index.new(registered).apply(@query_class)
|
|
27
27
|
Fields::Show.new(registered).apply(@query_class)
|
|
28
28
|
end
|
data/lib/graphiti_gql/version.rb
CHANGED
data/lib/graphiti_gql.rb
CHANGED
|
@@ -53,16 +53,8 @@ module GraphitiGql
|
|
|
53
53
|
yield config
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
def self.entrypoints=(val)
|
|
57
|
-
@entrypoints = val
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def self.entrypoints
|
|
61
|
-
@entrypoints
|
|
62
|
-
end
|
|
63
|
-
|
|
64
56
|
def self.entrypoint?(resource)
|
|
65
|
-
|
|
57
|
+
!!resource.graphql_entrypoint
|
|
66
58
|
end
|
|
67
59
|
|
|
68
60
|
def self.run(query_string, variables = {}, context = {})
|