graphiform 0.2.2 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/graphiform.rb +1 -0
- data/lib/graphiform/core.rb +3 -3
- data/lib/graphiform/fields.rb +8 -4
- data/lib/graphiform/skeleton.rb +0 -7
- data/lib/graphiform/sort_enum.rb +8 -0
- data/lib/graphiform/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b651a58e445f5b88cfe6f183d6a53b2527106b463e078888b414c4bba7ea92a
|
4
|
+
data.tar.gz: c200079ab7fcb8524cc229125612cf2e998dbfc442f193c94b7fd335a1bde72f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f70e1f4986cf0a525922df8d868e11439b4f41857d96c4cbc9a8cbf8df6da80304428258845e7fd35ebf2b743c4b9cf893fa41cbaa7480a5f475fbc75e04cd
|
7
|
+
data.tar.gz: 66b9f9fff6a8866250530a76db140bfe438d81037c5f3d26667035e920d374cd7c9d0a468ed1d93b39ca0e8f083a159e7bf708beeb35f8743a5989a2f73e5d5e
|
data/lib/graphiform.rb
CHANGED
data/lib/graphiform/core.rb
CHANGED
@@ -136,7 +136,7 @@ module Graphiform
|
|
136
136
|
Helpers.get_const_or_create(demodulized_name, ::Resolvers::Queries) do
|
137
137
|
local_graphql_type = graphql_type
|
138
138
|
Class.new(graphql_base_resolver) do
|
139
|
-
type local_graphql_type, null:
|
139
|
+
type local_graphql_type, null: true
|
140
140
|
|
141
141
|
def base_resolve(**args)
|
142
142
|
@value = model.all
|
@@ -161,9 +161,9 @@ module Graphiform
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
def graphql_create_resolver(method_name, resolver_type = graphql_type, read_prepare: nil, read_resolve: nil, **)
|
164
|
+
def graphql_create_resolver(method_name, resolver_type = graphql_type, read_prepare: nil, read_resolve: nil, null: true, **)
|
165
165
|
Class.new(graphql_base_resolver) do
|
166
|
-
type resolver_type, null:
|
166
|
+
type resolver_type, null: null
|
167
167
|
|
168
168
|
define_method :base_resolve do |**args|
|
169
169
|
@value = object
|
data/lib/graphiform/fields.rb
CHANGED
@@ -157,7 +157,7 @@ module Graphiform
|
|
157
157
|
column_def = column(as || name)
|
158
158
|
association_def = association(as || name)
|
159
159
|
|
160
|
-
type = ::
|
160
|
+
type = ::Graphiform::SortEnum if column_def.present?
|
161
161
|
type = association_def.klass.graphql_sort if Helpers.association_arguments_valid?(association_def, :graphql_sort)
|
162
162
|
|
163
163
|
return if type.blank?
|
@@ -212,7 +212,9 @@ module Graphiform
|
|
212
212
|
added_field.method_sym,
|
213
213
|
lambda do
|
214
214
|
value = read_resolve ? instance_exec(object, context, &read_resolve) : object.public_send(added_field.method_sym)
|
215
|
-
instance_exec(value, context, &read_prepare) if read_prepare
|
215
|
+
value = instance_exec(value, context, &read_prepare) if read_prepare
|
216
|
+
|
217
|
+
value
|
216
218
|
end
|
217
219
|
)
|
218
220
|
end
|
@@ -263,7 +265,8 @@ module Graphiform
|
|
263
265
|
association_def.name,
|
264
266
|
klass.graphql_connection,
|
265
267
|
read_prepare: read_prepare,
|
266
|
-
read_resolve: read_resolve
|
268
|
+
read_resolve: read_resolve,
|
269
|
+
null: false
|
267
270
|
),
|
268
271
|
false,
|
269
272
|
**options
|
@@ -277,7 +280,8 @@ module Graphiform
|
|
277
280
|
association_def.name,
|
278
281
|
[klass.graphql_type],
|
279
282
|
read_prepare: read_prepare,
|
280
|
-
read_resolve: read_resolve
|
283
|
+
read_resolve: read_resolve,
|
284
|
+
null: false
|
281
285
|
)
|
282
286
|
else
|
283
287
|
klass.graphql_type
|
data/lib/graphiform/skeleton.rb
CHANGED
@@ -80,12 +80,5 @@ module Graphiform
|
|
80
80
|
Helpers.get_const_or_create('BaseEnum', ::Enums) do
|
81
81
|
Class.new(::GraphQL::Schema::Enum)
|
82
82
|
end
|
83
|
-
|
84
|
-
Helpers.get_const_or_create('Sort', ::Enums) do
|
85
|
-
Class.new(::Enums::BaseEnum) do
|
86
|
-
value 'ASC', 'Sort results in ascending order'
|
87
|
-
value 'DESC', 'Sort results in descending order'
|
88
|
-
end
|
89
|
-
end
|
90
83
|
end
|
91
84
|
end
|
data/lib/graphiform/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jayce.pulsipher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.2.
|
47
|
+
version: 0.2.5
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.2.
|
54
|
+
version: 0.2.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: appraisal
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,6 +124,7 @@ files:
|
|
124
124
|
- lib/graphiform/fields.rb
|
125
125
|
- lib/graphiform/helpers.rb
|
126
126
|
- lib/graphiform/skeleton.rb
|
127
|
+
- lib/graphiform/sort_enum.rb
|
127
128
|
- lib/graphiform/version.rb
|
128
129
|
- lib/tasks/graphiform_tasks.rake
|
129
130
|
homepage: https://github.com/3-form/graphiform
|