graphiti_gql 0.2.8 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8711fac905c21ac485bec3ead197d2c5a8e2135eb5fcf1ff4156fec2a34d3ec
4
- data.tar.gz: 82a643591b6f630d78d67e480cf915b8dbf1c0531fa0c817f204a9ae405d237c
3
+ metadata.gz: 71fdec4bf251efc22810991433ff68f9797cd347537e01a9cd309557c68567ea
4
+ data.tar.gz: 9b65200d9eb293333b3cb4727389bc4c51ebc46da014d12f478f95c75fc48b0b
5
5
  SHA512:
6
- metadata.gz: 6a6935dda01d0d68bacfc8c49252469322e93c96613a852f092dc76aa80cc44545b7e3c3d478fd5da28d6039c1a33940c9164f8bb1aad0b8018b1d2a5c92de72
7
- data.tar.gz: fd9004e64db1c3dc39321e4eb2df56e5a7bf37a221c5323b062ddce182446ea1a4285649f61fdbb8508ac0b1a654c3311a7429bdc535f2589866b053c9d0617e
6
+ metadata.gz: f6e7ad07688af72a5850d5a93338ebce34c224e54259fce30a32b51a5deb842a8e9b1f3f2779bcf21ca841bfc7e7a88206c63e5bd3cb56644c92612c626762ec
7
+ data.tar.gz: a18337b399b74f1389e43becffddff4119a0c07b6c53ddfc84a0e2d925d7b5339206823d6f366adf24484838b79dda45298b11cee785d258455cebd802c46c1a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphiti_gql (0.2.7)
4
+ graphiti_gql (0.2.9)
5
5
  graphiti (~> 1.3.9)
6
6
  graphql (~> 2.0)
7
7
  graphql-batch (~> 0.5)
@@ -118,7 +118,7 @@ module GraphitiGql
118
118
 
119
119
  name = Schema.registry.key_for(@resource)
120
120
  sortvar = "$sort: [#{name}Sort!]," if @resource.sorts.any?
121
- filter_bang = "!" if @resource.filters.values.any? { |f| f[:required] }
121
+ filter_bang = "!" if @resource.grouped_filters.any? || @resource.filters.values.any? { |f| f[:required] }
122
122
  filtervar = "$filter: #{name}Filter#{filter_bang}," if @resource.filters.any?
123
123
 
124
124
  if !(fields = @params[:fields])
@@ -39,16 +39,19 @@ module GraphitiGql
39
39
  end
40
40
 
41
41
  def find_or_build_connection
42
+ registered_parent = Schema.registry.get(@sideload.parent_resource.class)
43
+ parent_name = registered_parent[:type].graphql_name
44
+ name = "#{parent_name}To#{@sideload_type.graphql_name}Connection"
45
+ return Schema.registry[name][:type] if Schema.registry[name]
46
+
42
47
  if customized_edge?
43
48
  prior = @sideload_type.connection_type
44
49
  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
50
  klass.graphql_name(name)
49
51
  edge_type_class = build_edge_type_class(@sideload_type)
50
52
  edge_type_class.node_type(prior.node_type)
51
53
  klass.edge_type(edge_type_class)
54
+ Schema.registry[name] = { type: klass }
52
55
  klass
53
56
  else
54
57
  @sideload_type.connection_type
@@ -36,6 +36,7 @@ module GraphitiGql
36
36
  value
37
37
  end
38
38
  }
39
+ required = true if @resource.grouped_filters.any? && !@sideload
39
40
  field.argument :filter, filter_type, required: required
40
41
  end
41
42
 
@@ -46,11 +47,18 @@ module GraphitiGql
46
47
  end
47
48
  klass = Class.new(GraphQL::Schema::InputObject)
48
49
  klass.graphql_name type_name
50
+ required_via_group = []
51
+ if (group = @resource.grouped_filters).present?
52
+ if group[:required] == :all
53
+ required_via_group = group[:names].map(&:to_sym)
54
+ end
55
+ end
49
56
  @resource.filters.each_pair do |name, config|
50
57
  attr_type = generate_filter_attribute_type(type_name, name, config)
58
+ required = !!config[:required] || required_via_group.include?(name)
51
59
  klass.argument name.to_s.camelize(:lower),
52
60
  attr_type,
53
- required: !!config[:required]
61
+ required: required
54
62
  end
55
63
  registry[type_name] = { type: klass }
56
64
  klass
@@ -72,10 +72,12 @@ module GraphitiGql
72
72
  resource.gql(params.merge(fields: fields), ctx, q)
73
73
  end
74
74
 
75
+
75
76
  def run
76
77
  lambda do
77
- proxy.to_h
78
- proxy
78
+ instance = proxy
79
+ instance.to_h
80
+ instance
79
81
  end
80
82
  end
81
83
 
@@ -1,3 +1,3 @@
1
1
  module GraphitiGql
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti_gql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-11 00:00:00.000000000 Z
11
+ date: 2022-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -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.3.7
189
- signing_key:
188
+ rubygems_version: 3.0.3.1
189
+ signing_key:
190
190
  specification_version: 4
191
191
  summary: GraphQL support for Graphiti
192
192
  test_files: []