graphql-rb 0.0.5 → 0.0.6
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/lib/graphql/execution/pool.rb +2 -2
- data/lib/graphql/language/field.rb +2 -1
- data/lib/graphql/language/selection_set.rb +22 -20
- data/lib/graphql/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 937f24e359a15a25d629f4b31ce3bece3339e88f
|
4
|
+
data.tar.gz: 15030d0283c03ba88bad726e1592e688eafe92c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c9f986ef04796ae4a4385d8c051064c1184803b92d30a3ee91b973e67b31d8ae18de18f53defab7ec0ea391e19a110f9a5fe3434adeba72015ac4846d90152
|
7
|
+
data.tar.gz: 7f5136940b38fab58a8f9db8c4d64d26edfd2861f0f6b0eadda57c67237a004b5de58e32fde49d9ff7ecd78decf2e7878c7e7bad27d72a817f66f71704c48a7f
|
@@ -23,7 +23,7 @@ module GraphQL
|
|
23
23
|
arguments = [
|
24
24
|
object,
|
25
25
|
materialize_arguments(object_type, context[:variables]),
|
26
|
-
context
|
26
|
+
context.merge(parent_type: object_type)
|
27
27
|
]
|
28
28
|
|
29
29
|
resolve = schema_field(object_type).resolve
|
@@ -41,6 +41,7 @@ module GraphQL
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
|
44
45
|
def schema_field(object_type)
|
45
46
|
case
|
46
47
|
when GraphQL::Introspection.meta_field?(name)
|
@@ -14,30 +14,34 @@ module GraphQL
|
|
14
14
|
#
|
15
15
|
#
|
16
16
|
def evaluate(context, object_type, object)
|
17
|
-
|
17
|
+
collect_fields(context, object_type).reduce({}) do |memo, (key, fields)|
|
18
|
+
field = fields.first
|
19
|
+
field_definition = case
|
20
|
+
|
21
|
+
when GraphQL::Introspection.meta_field?(field.name)
|
22
|
+
GraphQL::Introspection.meta_field(field.name)
|
23
|
+
else
|
24
|
+
object_type.field(field.name)
|
25
|
+
end
|
26
|
+
|
18
27
|
|
19
|
-
|
20
|
-
|
21
|
-
field_definition = case
|
28
|
+
memo[key.to_sym] = begin
|
29
|
+
resolved_object = field.resolve(context, object_type, object)
|
22
30
|
|
23
|
-
|
24
|
-
|
31
|
+
if resolved_object.is_a?(Celluloid::Future)
|
32
|
+
Execution::Pool.future do
|
33
|
+
complete_value(context, field_definition.type, resolved_object.value, merge_selection_sets(fields))
|
34
|
+
end
|
25
35
|
else
|
26
|
-
|
36
|
+
complete_value(context, field_definition.type, resolved_object, merge_selection_sets(fields))
|
27
37
|
end
|
28
38
|
|
39
|
+
rescue Celluloid::TaskTerminated => e
|
40
|
+
context[:errors] << "Field '#{field.name}' of '#{object_type}' error: #{e}"
|
41
|
+
nil
|
42
|
+
end unless field_definition.nil?
|
29
43
|
|
30
|
-
|
31
|
-
resolution_context = context.merge({ parent_type: object_type })
|
32
|
-
resolved_object = field.resolve(resolution_context, object_type, object)
|
33
|
-
complete_value(context, field_definition.type, resolved_object, merge_selection_sets(fields))
|
34
|
-
rescue Celluloid::TaskTerminated => e
|
35
|
-
context[:errors] << "Field '#{field.name}' of '#{object_type}' error: #{e}"
|
36
|
-
nil
|
37
|
-
end unless field_definition.nil?
|
38
|
-
|
39
|
-
memo
|
40
|
-
end
|
44
|
+
memo
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
@@ -105,8 +109,6 @@ module GraphQL
|
|
105
109
|
def complete_value(context, field_type, resolved_object, selection_set)
|
106
110
|
return nil if resolved_object.nil?
|
107
111
|
|
108
|
-
resolved_object = resolved_object.value if resolved_object.is_a?(Celluloid::Future)
|
109
|
-
|
110
112
|
case field_type
|
111
113
|
when GraphQLNonNull
|
112
114
|
completed_object = complete_value(context, field_type.of_type, resolved_object, selection_set)
|
data/lib/graphql/version.rb
CHANGED