graphql-filters 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -2
- data/README.md +6 -6
- data/lib/graphql/filters/dsl/graphql/schema/field.rb +6 -9
- data/lib/graphql/filters/input_types/base_scalar_comparison_input_type.rb +1 -1
- data/lib/graphql/filters/input_types/fields_comparison_input_type.rb +1 -1
- data/lib/graphql/filters/input_types/list_object_comparison_input_type.rb +1 -1
- data/lib/graphql/filters/input_types/object_comparison_input_type.rb +1 -1
- data/lib/graphql/filters/version.rb +1 -1
- metadata +4 -5
- data/Gemfile.lock +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9344189bc4ae82f67f66db0a205d932500cdf8f318588e6129a64bd2374fbbac
|
4
|
+
data.tar.gz: d9e10df965526be218a0459234e7f79bb7626859d5f29af61ed1502559444ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f51fe336718070181df965eaab2c072cba21bd596d50c3faff28c342fdfe193996f8f3599d7a53c9940bedd8e327f5098d3abccc28b19c5e2ac8376b4d0aebca
|
7
|
+
data.tar.gz: 987109d5d12d53ebce9d9811f6d392a23bd23104443098ac56e9a19e428c2e725110845b120bd6d81e65a0b3cff104cbf7c25648af63a211fe4704beb7f0b573
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
[//]: # (
|
3
|
+
<!--[//]: # (
|
4
4
|
## <Release number> <Date YYYY-MM-DD>
|
5
5
|
### Breaking changes
|
6
6
|
### Deprecations
|
7
7
|
### New features
|
8
8
|
### Bug fixes
|
9
|
-
)
|
9
|
+
)-->
|
10
|
+
|
11
|
+
## 1.0.2 2023-07-24
|
12
|
+
|
13
|
+
### Bug fixes
|
14
|
+
|
15
|
+
- Fixed constant false conditions
|
16
|
+
|
17
|
+
## 1.0.1 2023-03-15
|
18
|
+
|
19
|
+
### Bug fixes
|
20
|
+
|
21
|
+
- Fixed the priority of options declarations for fields
|
22
|
+
- Fixed the override of `method_name` for the column name to use in the Active Record query
|
10
23
|
|
11
24
|
## 1.0.0 2023-03-06
|
12
25
|
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ This gem provides a module to include (or prepend, see below) in your resolvers
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'graphql-filters', '~>
|
12
|
+
gem 'graphql-filters', '~> 1.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -24,7 +24,7 @@ The easiest way to use GraphQL Filters is on top of [SearchObject](https://githu
|
|
24
24
|
```ruby
|
25
25
|
class RoutesResolver < BaseResolver
|
26
26
|
include SearchObject.module(:graphql)
|
27
|
-
|
27
|
+
|
28
28
|
scope { Route.all }
|
29
29
|
|
30
30
|
type [RouteType], null: false
|
@@ -33,12 +33,12 @@ class RoutesResolver < BaseResolver
|
|
33
33
|
end
|
34
34
|
```
|
35
35
|
|
36
|
-
Otherwise, you have to explicitly define a `resolve` method and have it return an `ActiveRecord::Relation`; in this case
|
36
|
+
Otherwise, you have to explicitly define a `resolve` method and have it return an `ActiveRecord::Relation`; in this case you need to prepend `GraphQL::Filters::Filterable` in the resolver, otherwise it won't have access to the starting scope:
|
37
37
|
|
38
38
|
```ruby
|
39
39
|
class RoutesResolver < BaseResolver
|
40
40
|
type [RouteType], null: false
|
41
|
-
|
41
|
+
|
42
42
|
def resolve
|
43
43
|
Route.all
|
44
44
|
end
|
@@ -217,7 +217,7 @@ end
|
|
217
217
|
Can be `true` or `false` (default: `true`). Controls whether or not the client can use this field in the filters. Passing `true` or `false` directly to `filter` is a shortcut:
|
218
218
|
|
219
219
|
```ruby
|
220
|
-
field :name, String, null: false, filter: false
|
220
|
+
field :name, String, null: false, filter: false
|
221
221
|
|
222
222
|
# is equivalent to
|
223
223
|
|
@@ -229,7 +229,7 @@ field :name, String, null: false, filter: {enabled: false}
|
|
229
229
|
The name of the attribute that the field is tied to in the model. Defaults to the name of the resolver method for the field (which by default is the same as the name of the field itself).
|
230
230
|
|
231
231
|
- `association_name`
|
232
|
-
|
232
|
+
|
233
233
|
The name of the Active Record association that the field is tied to in the model. Equivalent to `attribute_name`, has the same default.
|
234
234
|
|
235
235
|
## Plans for future development
|
@@ -43,21 +43,18 @@ monkey_patch = Module.new do
|
|
43
43
|
options
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
filter_options.merge! options
|
47
|
+
filter_options.merge! kwargs
|
48
|
+
end
|
49
|
+
|
50
|
+
def filter_options
|
51
|
+
@filter_options ||= filter_options_defaults.transform_values do |value|
|
47
52
|
if value.is_a? Proc
|
48
53
|
value.call self
|
49
54
|
else
|
50
55
|
value
|
51
56
|
end
|
52
57
|
end
|
53
|
-
|
54
|
-
filter_options.reverse_merge! applied_filter_options_defaults
|
55
|
-
filter_options.reverse_merge! options
|
56
|
-
filter_options.reverse_merge! kwargs
|
57
|
-
end
|
58
|
-
|
59
|
-
def filter_options
|
60
|
-
@filter_options ||= {}
|
61
58
|
end
|
62
59
|
end
|
63
60
|
|
@@ -21,7 +21,7 @@ module GraphQL
|
|
21
21
|
required: false,
|
22
22
|
prepare: lambda { |field_comparator, _context|
|
23
23
|
lambda { |scope|
|
24
|
-
if scope.klass.attribute_names.include? filter_options[:attribute_name]
|
24
|
+
if scope.klass.attribute_names.include? filter_options[:attribute_name].to_s
|
25
25
|
field_comparator.call scope, filter_options[:attribute_name]
|
26
26
|
else
|
27
27
|
field_comparator.call scope, filter_options[:association_name]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-filters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moku S.r.l.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- ".rubocop.yml"
|
65
65
|
- CHANGELOG.md
|
66
66
|
- Gemfile
|
67
|
-
- Gemfile.lock
|
68
67
|
- LICENSE
|
69
68
|
- README.md
|
70
69
|
- Rakefile
|
@@ -103,7 +102,7 @@ licenses:
|
|
103
102
|
metadata:
|
104
103
|
homepage_uri: https://github.com/moku-io/graphql-filters
|
105
104
|
source_code_uri: https://github.com/moku-io/graphql-filters
|
106
|
-
changelog_uri: https://github.com/moku-io/graphql-filters
|
105
|
+
changelog_uri: https://github.com/moku-io/graphql-filters/blob/master/CHANGELOG.md
|
107
106
|
post_install_message:
|
108
107
|
rdoc_options: []
|
109
108
|
require_paths:
|
@@ -119,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
118
|
- !ruby/object:Gem::Version
|
120
119
|
version: '0'
|
121
120
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.4.6
|
123
122
|
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: Provide a fully typed interface to filter lists in a GraphQL API.
|
data/Gemfile.lock
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
graphql-filters (1.0.0)
|
5
|
-
activerecord (~> 7.0.0)
|
6
|
-
activesupport (~> 7.0.0)
|
7
|
-
graphql (~> 2.0.0)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
activemodel (7.0.4.2)
|
13
|
-
activesupport (= 7.0.4.2)
|
14
|
-
activerecord (7.0.4.2)
|
15
|
-
activemodel (= 7.0.4.2)
|
16
|
-
activesupport (= 7.0.4.2)
|
17
|
-
activesupport (7.0.4.2)
|
18
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
-
i18n (>= 1.6, < 2)
|
20
|
-
minitest (>= 5.1)
|
21
|
-
tzinfo (~> 2.0)
|
22
|
-
ast (2.4.2)
|
23
|
-
concurrent-ruby (1.2.2)
|
24
|
-
diff-lcs (1.5.0)
|
25
|
-
graphql (2.0.17)
|
26
|
-
i18n (1.12.0)
|
27
|
-
concurrent-ruby (~> 1.0)
|
28
|
-
json (2.6.3)
|
29
|
-
minitest (5.18.0)
|
30
|
-
parallel (1.22.1)
|
31
|
-
parser (3.2.0.0)
|
32
|
-
ast (~> 2.4.1)
|
33
|
-
rainbow (3.1.1)
|
34
|
-
rake (13.0.6)
|
35
|
-
regexp_parser (2.6.2)
|
36
|
-
rexml (3.2.5)
|
37
|
-
rspec (3.12.0)
|
38
|
-
rspec-core (~> 3.12.0)
|
39
|
-
rspec-expectations (~> 3.12.0)
|
40
|
-
rspec-mocks (~> 3.12.0)
|
41
|
-
rspec-core (3.12.0)
|
42
|
-
rspec-support (~> 3.12.0)
|
43
|
-
rspec-expectations (3.12.2)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.12.0)
|
46
|
-
rspec-mocks (3.12.3)
|
47
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.12.0)
|
49
|
-
rspec-support (3.12.0)
|
50
|
-
rubocop (1.44.1)
|
51
|
-
json (~> 2.3)
|
52
|
-
parallel (~> 1.10)
|
53
|
-
parser (>= 3.2.0.0)
|
54
|
-
rainbow (>= 2.2.2, < 4.0)
|
55
|
-
regexp_parser (>= 1.8, < 3.0)
|
56
|
-
rexml (>= 3.2.5, < 4.0)
|
57
|
-
rubocop-ast (>= 1.24.1, < 2.0)
|
58
|
-
ruby-progressbar (~> 1.7)
|
59
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
60
|
-
rubocop-ast (1.24.1)
|
61
|
-
parser (>= 3.1.1.0)
|
62
|
-
ruby-progressbar (1.11.0)
|
63
|
-
tzinfo (2.0.6)
|
64
|
-
concurrent-ruby (~> 1.0)
|
65
|
-
unicode-display_width (2.4.2)
|
66
|
-
|
67
|
-
PLATFORMS
|
68
|
-
arm64-darwin-22
|
69
|
-
|
70
|
-
DEPENDENCIES
|
71
|
-
graphql-filters!
|
72
|
-
rake (~> 13.0)
|
73
|
-
rspec (~> 3.0)
|
74
|
-
rubocop (~> 1.21)
|
75
|
-
|
76
|
-
BUNDLED WITH
|
77
|
-
2.3.9
|