graphiti_gql 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/graphiti_gql/graphiti_hax.rb +1 -0
- data/lib/graphiti_gql/schema/fields/to_many.rb +15 -21
- data/lib/graphiti_gql/schema/list_arguments.rb +4 -1
- data/lib/graphiti_gql/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8711fac905c21ac485bec3ead197d2c5a8e2135eb5fcf1ff4156fec2a34d3ec
|
4
|
+
data.tar.gz: 82a643591b6f630d78d67e480cf915b8dbf1c0531fa0c817f204a9ae405d237c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a6935dda01d0d68bacfc8c49252469322e93c96613a852f092dc76aa80cc44545b7e3c3d478fd5da28d6039c1a33940c9164f8bb1aad0b8018b1d2a5c92de72
|
7
|
+
data.tar.gz: fd9004e64db1c3dc39321e4eb2df56e5a7bf37a221c5323b062ddce182446ea1a4285649f61fdbb8508ac0b1a654c3311a7429bdc535f2589866b053c9d0617e
|
data/Gemfile.lock
CHANGED
@@ -162,6 +162,7 @@ module GraphitiGql
|
|
162
162
|
|
163
163
|
def apply_belongs_to_many_filter
|
164
164
|
super
|
165
|
+
return unless respond_to?(:belongs_to_many_filter) # activerecord
|
165
166
|
self_ref = self
|
166
167
|
fk_type = parent_resource_class.attributes[:id][:type]
|
167
168
|
fk_type = :hash if polymorphic?
|
@@ -4,11 +4,8 @@ module GraphitiGql
|
|
4
4
|
class ToMany
|
5
5
|
def initialize(sideload, sideload_type)
|
6
6
|
@sideload = sideload
|
7
|
-
@sideload_type =
|
8
|
-
|
9
|
-
else
|
10
|
-
sideload_type
|
11
|
-
end
|
7
|
+
@sideload_type = sideload_type
|
8
|
+
@connection_type = find_or_build_connection
|
12
9
|
end
|
13
10
|
|
14
11
|
def apply(type)
|
@@ -18,7 +15,7 @@ module GraphitiGql
|
|
18
15
|
extras: [:lookahead]
|
19
16
|
}
|
20
17
|
opts[:extensions] = [RelayConnectionExtension] unless has_one?
|
21
|
-
field_type = has_one? ? @sideload_type : @
|
18
|
+
field_type = has_one? ? @sideload_type : @connection_type
|
22
19
|
field = type.field @sideload.name,
|
23
20
|
field_type,
|
24
21
|
**opts
|
@@ -41,23 +38,20 @@ module GraphitiGql
|
|
41
38
|
@sideload.type == :many_to_many && @sideload.class.edge_resource
|
42
39
|
end
|
43
40
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
klass.
|
55
|
-
klass.edge_type_class(edge_type_class)
|
41
|
+
def find_or_build_connection
|
42
|
+
if customized_edge?
|
43
|
+
prior = @sideload_type.connection_type
|
44
|
+
klass = Class.new(prior)
|
45
|
+
registered_parent = Schema.registry.get(@sideload.parent_resource.class)
|
46
|
+
parent_name = registered_parent[:type].graphql_name
|
47
|
+
name = "#{parent_name}To#{@sideload_type.graphql_name}Connection"
|
48
|
+
klass.graphql_name(name)
|
49
|
+
edge_type_class = build_edge_type_class(@sideload_type)
|
50
|
+
edge_type_class.node_type(prior.node_type)
|
51
|
+
klass.edge_type(edge_type_class)
|
56
52
|
klass
|
57
53
|
else
|
58
|
-
|
59
|
-
klass.edge_type_class(edge_class)
|
60
|
-
klass
|
54
|
+
@sideload_type.connection_type
|
61
55
|
end
|
62
56
|
end
|
63
57
|
|
@@ -23,12 +23,15 @@ module GraphitiGql
|
|
23
23
|
Registry.instance
|
24
24
|
end
|
25
25
|
|
26
|
+
# TODO - when no sorts schema error, when no filters schema error
|
26
27
|
def define_filters(field)
|
27
28
|
filter_type = generate_filter_type(field)
|
28
29
|
required = @resource.filters.any? { |name, config|
|
29
30
|
value = !!config[:required]
|
30
31
|
if @sideload
|
31
|
-
|
32
|
+
fk = @sideload.foreign_key
|
33
|
+
fk = fk.values.first if fk.is_a?(Hash)
|
34
|
+
value && fk != name
|
32
35
|
else
|
33
36
|
value
|
34
37
|
end
|
data/lib/graphiti_gql/version.rb
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti_gql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-07-11 00:00:00.000000000 Z
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '7.0'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
113
|
- richmolj@gmail.com
|
114
114
|
executables: []
|
@@ -170,7 +170,7 @@ licenses:
|
|
170
170
|
- MIT
|
171
171
|
metadata:
|
172
172
|
homepage_uri: https://www.graphiti.dev
|
173
|
-
post_install_message:
|
173
|
+
post_install_message:
|
174
174
|
rdoc_options: []
|
175
175
|
require_paths:
|
176
176
|
- lib
|
@@ -185,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
189
|
-
signing_key:
|
188
|
+
rubygems_version: 3.3.7
|
189
|
+
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: GraphQL support for Graphiti
|
192
192
|
test_files: []
|