graphql-searchkick 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 235a0119fe2602c6aeb34499722732867652dbb2b87dda7a47b50057aa448c7e
4
+ data.tar.gz: cabaf6e7cfdd93d7975bcad1cc17bbc9f432f050a02a552ca049170cbe52bb63
5
+ SHA512:
6
+ metadata.gz: 9bb1e7558b2c6fb51043dfee2feac38fa38e1713dc5b262aadba75b036cee0ad0a69c23b655d5d0966214c91e0b43d62e6d75362b80c843d9c6d05b608bfe9a8
7
+ data.tar.gz: 6f26cead074d9fb63578a02f01fa00d2159b8c2118c64e477dd68505ce9c2e358eb7ded075d1272d1575928e4a799592eeb2d1a1ab6a82763955a5de6054dfbb
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.5.7
6
+ before_install: gem install bundler -v 2.1.4
data/Appraisals ADDED
@@ -0,0 +1,20 @@
1
+ appraise "graphql-1.8" do
2
+ gem 'graphql', '~> 1.8'
3
+ end
4
+
5
+ appraise "graphql-1.9" do
6
+ gem 'graphql', '~> 1.9'
7
+ end
8
+
9
+ appraise "graphql-1.10" do
10
+ gem 'graphql', '~> 1.10'
11
+ end
12
+
13
+ appraise "searchkick-3.0" do
14
+ gem 'elasticsearch', '< 6.0'
15
+ gem 'searchkick', '~> 3.0'
16
+ end
17
+
18
+ appraise "searchkick-4.0" do
19
+ gem 'searchkick', '~> 4.0'
20
+ end
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in graphql-searchkick.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Chad Wilken
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Graphql::Searchkick
2
+
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/1102df197f6f271b9885/maintainability)](https://codeclimate.com/github/CompanyCam/graphql-searchkick/maintainability)
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/graphql/searchkick`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'graphql-searchkick'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle install
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install graphql-searchkick
24
+
25
+ ## Usage
26
+
27
+ TODO: Write usage instructions here
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/graphql-searchkick.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "graphql/searchkick"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ version: "3"
2
+ services:
3
+ elasticsearch:
4
+ image: docker.elastic.co/elasticsearch/elasticsearch:6.8.7
5
+ ports:
6
+ - "9200:9200"
7
+ - "9300:9300"
8
+ networks:
9
+ - esnet
10
+ volumes:
11
+ - ./tmp/esdata:/usr/share/elasticsearch/data
12
+ environment:
13
+ - xpack.security.enabled=false
14
+ - discovery.type=single-node
15
+ - cluster.name=docker-cluster
16
+ - bootstrap.memory_lock=true
17
+ - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
18
+ ulimits:
19
+ memlock:
20
+ soft: -1
21
+ hard: -1
22
+
23
+ networks:
24
+ esnet:
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "graphql", "~> 1.10"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ graphql-searchkick (0.1.0)
5
+ graphql (> 1.8)
6
+ searchkick (> 3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (6.0.2.1)
12
+ activesupport (= 6.0.2.1)
13
+ activerecord (6.0.2.1)
14
+ activemodel (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ activesupport (6.0.2.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2)
22
+ appraisal (2.2.0)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ codeclimate-test-reporter (1.0.9)
27
+ simplecov (<= 0.13)
28
+ concurrent-ruby (1.1.6)
29
+ diff-lcs (1.3)
30
+ docile (1.1.5)
31
+ elasticsearch (7.5.0)
32
+ elasticsearch-api (= 7.5.0)
33
+ elasticsearch-transport (= 7.5.0)
34
+ elasticsearch-api (7.5.0)
35
+ multi_json
36
+ elasticsearch-transport (7.5.0)
37
+ faraday (>= 0.14, < 1)
38
+ multi_json
39
+ faraday (0.17.3)
40
+ multipart-post (>= 1.2, < 3)
41
+ graphql (1.10.5)
42
+ hashie (3.6.0)
43
+ i18n (1.8.2)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.3.0)
46
+ minitest (5.14.0)
47
+ multi_json (1.14.1)
48
+ multipart-post (2.1.1)
49
+ rake (12.3.3)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.3)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ searchkick (4.3.0)
64
+ activemodel (>= 5)
65
+ elasticsearch (>= 6)
66
+ hashie
67
+ simplecov (0.13.0)
68
+ docile (~> 1.1.0)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
+ sqlite3 (1.4.2)
73
+ thor (1.0.1)
74
+ thread_safe (0.3.6)
75
+ tzinfo (1.2.6)
76
+ thread_safe (~> 0.1)
77
+ zeitwerk (2.3.0)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ activerecord (~> 6.0)
84
+ appraisal
85
+ codeclimate-test-reporter
86
+ graphql (~> 1.10)
87
+ graphql-searchkick!
88
+ rake (~> 12.0)
89
+ rspec (~> 3.0)
90
+ sqlite3
91
+
92
+ BUNDLED WITH
93
+ 2.1.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "graphql", "~> 1.8"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ graphql-searchkick (0.1.0)
5
+ graphql (> 1.8)
6
+ searchkick (> 3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (6.0.2.1)
12
+ activesupport (= 6.0.2.1)
13
+ activerecord (6.0.2.1)
14
+ activemodel (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ activesupport (6.0.2.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2)
22
+ appraisal (2.2.0)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ codeclimate-test-reporter (1.0.9)
27
+ simplecov (<= 0.13)
28
+ concurrent-ruby (1.1.6)
29
+ diff-lcs (1.3)
30
+ docile (1.1.5)
31
+ elasticsearch (7.5.0)
32
+ elasticsearch-api (= 7.5.0)
33
+ elasticsearch-transport (= 7.5.0)
34
+ elasticsearch-api (7.5.0)
35
+ multi_json
36
+ elasticsearch-transport (7.5.0)
37
+ faraday (>= 0.14, < 1)
38
+ multi_json
39
+ faraday (0.17.3)
40
+ multipart-post (>= 1.2, < 3)
41
+ graphql (1.10.5)
42
+ hashie (3.6.0)
43
+ i18n (1.8.2)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.3.0)
46
+ minitest (5.14.0)
47
+ multi_json (1.14.1)
48
+ multipart-post (2.1.1)
49
+ rake (12.3.3)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.3)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ searchkick (4.3.0)
64
+ activemodel (>= 5)
65
+ elasticsearch (>= 6)
66
+ hashie
67
+ simplecov (0.13.0)
68
+ docile (~> 1.1.0)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
+ sqlite3 (1.4.2)
73
+ thor (1.0.1)
74
+ thread_safe (0.3.6)
75
+ tzinfo (1.2.6)
76
+ thread_safe (~> 0.1)
77
+ zeitwerk (2.3.0)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ activerecord (~> 6.0)
84
+ appraisal
85
+ codeclimate-test-reporter
86
+ graphql (~> 1.8)
87
+ graphql-searchkick!
88
+ rake (~> 12.0)
89
+ rspec (~> 3.0)
90
+ sqlite3
91
+
92
+ BUNDLED WITH
93
+ 2.1.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "graphql", "~> 1.9"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ graphql-searchkick (0.1.0)
5
+ graphql (> 1.8)
6
+ searchkick (> 3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (6.0.2.1)
12
+ activesupport (= 6.0.2.1)
13
+ activerecord (6.0.2.1)
14
+ activemodel (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ activesupport (6.0.2.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2)
22
+ appraisal (2.2.0)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ codeclimate-test-reporter (1.0.9)
27
+ simplecov (<= 0.13)
28
+ concurrent-ruby (1.1.6)
29
+ diff-lcs (1.3)
30
+ docile (1.1.5)
31
+ elasticsearch (7.5.0)
32
+ elasticsearch-api (= 7.5.0)
33
+ elasticsearch-transport (= 7.5.0)
34
+ elasticsearch-api (7.5.0)
35
+ multi_json
36
+ elasticsearch-transport (7.5.0)
37
+ faraday (>= 0.14, < 1)
38
+ multi_json
39
+ faraday (0.17.3)
40
+ multipart-post (>= 1.2, < 3)
41
+ graphql (1.10.5)
42
+ hashie (3.6.0)
43
+ i18n (1.8.2)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.3.0)
46
+ minitest (5.14.0)
47
+ multi_json (1.14.1)
48
+ multipart-post (2.1.1)
49
+ rake (12.3.3)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.3)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ searchkick (4.3.0)
64
+ activemodel (>= 5)
65
+ elasticsearch (>= 6)
66
+ hashie
67
+ simplecov (0.13.0)
68
+ docile (~> 1.1.0)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
+ sqlite3 (1.4.2)
73
+ thor (1.0.1)
74
+ thread_safe (0.3.6)
75
+ tzinfo (1.2.6)
76
+ thread_safe (~> 0.1)
77
+ zeitwerk (2.3.0)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ activerecord (~> 6.0)
84
+ appraisal
85
+ codeclimate-test-reporter
86
+ graphql (~> 1.9)
87
+ graphql-searchkick!
88
+ rake (~> 12.0)
89
+ rspec (~> 3.0)
90
+ sqlite3
91
+
92
+ BUNDLED WITH
93
+ 2.1.4
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "elasticsearch", "< 6.0"
6
+ gem "searchkick", "~> 3.0"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ graphql-searchkick (0.1.0)
5
+ graphql (> 1.8)
6
+ searchkick (> 3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (6.0.2.1)
12
+ activesupport (= 6.0.2.1)
13
+ activerecord (6.0.2.1)
14
+ activemodel (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ activesupport (6.0.2.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2)
22
+ appraisal (2.2.0)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ codeclimate-test-reporter (1.0.9)
27
+ simplecov (<= 0.13)
28
+ concurrent-ruby (1.1.6)
29
+ diff-lcs (1.3)
30
+ docile (1.1.5)
31
+ elasticsearch (5.0.5)
32
+ elasticsearch-api (= 5.0.5)
33
+ elasticsearch-transport (= 5.0.5)
34
+ elasticsearch-api (5.0.5)
35
+ multi_json
36
+ elasticsearch-transport (5.0.5)
37
+ faraday
38
+ multi_json
39
+ faraday (1.0.0)
40
+ multipart-post (>= 1.2, < 3)
41
+ graphql (1.10.5)
42
+ hashie (3.6.0)
43
+ i18n (1.8.2)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.3.0)
46
+ minitest (5.14.0)
47
+ multi_json (1.14.1)
48
+ multipart-post (2.1.1)
49
+ rake (12.3.3)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.3)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ searchkick (3.0.3)
64
+ activemodel (>= 4.2)
65
+ elasticsearch (>= 5)
66
+ hashie
67
+ simplecov (0.13.0)
68
+ docile (~> 1.1.0)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
+ sqlite3 (1.4.2)
73
+ thor (1.0.1)
74
+ thread_safe (0.3.6)
75
+ tzinfo (1.2.6)
76
+ thread_safe (~> 0.1)
77
+ zeitwerk (2.3.0)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ activerecord (~> 6.0)
84
+ appraisal
85
+ codeclimate-test-reporter
86
+ elasticsearch (< 6.0)
87
+ graphql-searchkick!
88
+ rake (~> 12.0)
89
+ rspec (~> 3.0)
90
+ searchkick (~> 3.0)
91
+ sqlite3
92
+
93
+ BUNDLED WITH
94
+ 2.1.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "searchkick", "~> 4.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,93 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ graphql-searchkick (0.1.0)
5
+ graphql (> 1.8)
6
+ searchkick (> 3.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activemodel (6.0.2.1)
12
+ activesupport (= 6.0.2.1)
13
+ activerecord (6.0.2.1)
14
+ activemodel (= 6.0.2.1)
15
+ activesupport (= 6.0.2.1)
16
+ activesupport (6.0.2.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ zeitwerk (~> 2.2)
22
+ appraisal (2.2.0)
23
+ bundler
24
+ rake
25
+ thor (>= 0.14.0)
26
+ codeclimate-test-reporter (1.0.9)
27
+ simplecov (<= 0.13)
28
+ concurrent-ruby (1.1.6)
29
+ diff-lcs (1.3)
30
+ docile (1.1.5)
31
+ elasticsearch (7.5.0)
32
+ elasticsearch-api (= 7.5.0)
33
+ elasticsearch-transport (= 7.5.0)
34
+ elasticsearch-api (7.5.0)
35
+ multi_json
36
+ elasticsearch-transport (7.5.0)
37
+ faraday (>= 0.14, < 1)
38
+ multi_json
39
+ faraday (0.17.3)
40
+ multipart-post (>= 1.2, < 3)
41
+ graphql (1.10.5)
42
+ hashie (3.6.0)
43
+ i18n (1.8.2)
44
+ concurrent-ruby (~> 1.0)
45
+ json (2.3.0)
46
+ minitest (5.14.0)
47
+ multi_json (1.14.1)
48
+ multipart-post (2.1.1)
49
+ rake (12.3.3)
50
+ rspec (3.8.0)
51
+ rspec-core (~> 3.8.0)
52
+ rspec-expectations (~> 3.8.0)
53
+ rspec-mocks (~> 3.8.0)
54
+ rspec-core (3.8.0)
55
+ rspec-support (~> 3.8.0)
56
+ rspec-expectations (3.8.3)
57
+ diff-lcs (>= 1.2.0, < 2.0)
58
+ rspec-support (~> 3.8.0)
59
+ rspec-mocks (3.8.0)
60
+ diff-lcs (>= 1.2.0, < 2.0)
61
+ rspec-support (~> 3.8.0)
62
+ rspec-support (3.8.0)
63
+ searchkick (4.3.0)
64
+ activemodel (>= 5)
65
+ elasticsearch (>= 6)
66
+ hashie
67
+ simplecov (0.13.0)
68
+ docile (~> 1.1.0)
69
+ json (>= 1.8, < 3)
70
+ simplecov-html (~> 0.10.0)
71
+ simplecov-html (0.10.2)
72
+ sqlite3 (1.4.2)
73
+ thor (1.0.1)
74
+ thread_safe (0.3.6)
75
+ tzinfo (1.2.6)
76
+ thread_safe (~> 0.1)
77
+ zeitwerk (2.3.0)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ activerecord (~> 6.0)
84
+ appraisal
85
+ codeclimate-test-reporter
86
+ graphql-searchkick!
87
+ rake (~> 12.0)
88
+ rspec (~> 3.0)
89
+ searchkick (~> 4.0)
90
+ sqlite3
91
+
92
+ BUNDLED WITH
93
+ 2.1.4
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/graphql/searchkick/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'graphql-searchkick'
5
+ spec.version = Graphql::Searchkick::VERSION
6
+ spec.authors = ['Chad Wilken']
7
+ spec.email = ['chad.wilken@gmail.com']
8
+
9
+ spec.summary = "A Searchkick plugin for graphql-ruby"
10
+ spec.description = "A Searchkick plugin for graphql-ruby allowing you to use searchkick with the connection type"
11
+ spec.homepage = "https://github.com/CompanyCam/graphql-searchkick"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'appraisal'
26
+ spec.add_development_dependency 'codeclimate-test-reporter'
27
+ spec.add_development_dependency 'rake', '~> 12.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'activerecord', '~> 6.0'
30
+ spec.add_development_dependency 'sqlite3'
31
+ spec.add_dependency 'graphql', '> 1.8'
32
+ spec.add_dependency 'searchkick', '> 3.0'
33
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql/searchkick/version'
4
+ require 'graphql/searchkick/searchable_extension'
5
+ require 'graphql/searchkick/field_integration'
6
+ require 'graphql/searchkick/lazy_search'
7
+ require 'graphql/searchkick/result_connection'
8
+
9
+
10
+ module Graphql
11
+ module Searchkick
12
+ class Error < StandardError; end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GraphQL
4
+ module Searchkick
5
+ module FieldIntegration
6
+
7
+ module HasSearchkickField
8
+ def initialize(*args, search: nil, **kwargs, &block)
9
+ super(*args, **kwargs, &block)
10
+ if search
11
+ extension(GraphQL::Searchkick::SearchableExtension, model_class: search)
12
+ end
13
+ end
14
+ end
15
+
16
+ def self.included(field_class)
17
+ field_class.include(HasSearchkickField)
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module GraphQL
6
+ module Searchkick
7
+ class LazySearch
8
+ include Enumerable
9
+ extend Forwardable
10
+
11
+ SEARCH_ALL = '*'.freeze
12
+
13
+ attr_reader :query, :model_class, :options, :limit_value, :offset_value
14
+
15
+ def_delegators :load, :results, :hits, :took, :error
16
+ def_delegators :load, :total_count, :current_page, :total_pages
17
+ def_delegators :results, :first, :last, :each, :index
18
+ def_delegators :results, :any?, :empty?, :size, :length, :slice, :[], :to_ary
19
+
20
+ def initialize(options, query:, model_class:)
21
+ @query =
22
+ if query.nil? || query.empty?
23
+ SEARCH_ALL
24
+ else
25
+ query
26
+ end
27
+ @model_class = model_class
28
+ @options = options || {}
29
+
30
+ if @options.key?(:limit)
31
+ @limit_value = @options[:limit]
32
+ end
33
+ end
34
+
35
+ def load
36
+ return @result if defined? @result
37
+
38
+ @result = model_class.search(query, options.merge(limit: limit_value, offset: offset_value))
39
+
40
+ @result
41
+ end
42
+
43
+ def limit=(val)
44
+ @limit_value = val
45
+ end
46
+
47
+ def offset=(val)
48
+ @offset_value = val
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,154 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+
5
+ module GraphQL
6
+ module Searchkick
7
+ class ResultConnection < GraphQL::Relay::BaseConnection
8
+
9
+ def search_results
10
+ return @results if defined? @results
11
+
12
+ apply_pagination
13
+ execute_search
14
+
15
+ @results = nodes
16
+ end
17
+
18
+ def execute_search
19
+ nodes.load
20
+ end
21
+
22
+ # must return a cursor for this object/connection pair
23
+ def cursor_from_node(item)
24
+ item_index = paged_nodes.index(item)
25
+
26
+ if item_index.nil?
27
+ raise("Can't generate cursor, item not found in connection: #{item}")
28
+ else
29
+ offset = item_index + 1
30
+
31
+ if after
32
+ offset += offset_from_cursor(after)
33
+ elsif before
34
+ offset += offset_from_cursor(before) - 1 - search_results.size
35
+ end
36
+
37
+ if first && last && first >= last
38
+ offset += first - last
39
+ end
40
+
41
+ encode(offset.to_s)
42
+ end
43
+ end
44
+
45
+ def page_info
46
+ self
47
+ end
48
+
49
+ def has_next_page
50
+ if first
51
+ initial_offset = after ? offset_from_cursor(after) : 0
52
+ return search_results.total_count > initial_offset + first
53
+ end
54
+
55
+ if GraphQL::Relay::ConnectionType.bidirectional_pagination && last
56
+ return search_results.length >= last
57
+ end
58
+ false
59
+ end
60
+
61
+ def has_previous_page
62
+ if last
63
+ search_results.total_count >= last && search_results.size > last
64
+ elsif GraphQL::Relay::ConnectionType.bidirectional_pagination && after
65
+ offset_from_cursor(after) > 0
66
+ else
67
+ false
68
+ end
69
+ end
70
+
71
+ private
72
+
73
+ def apply_pagination
74
+ if after
75
+ offset = (search_offset(nodes) || 0) + offset_from_cursor(after)
76
+ set_offset(nodes, offset)
77
+ end
78
+
79
+ if before && after
80
+ if offset_from_cursor(after) < offset_from_cursor(before)
81
+ limit = offset_from_cursor(before) - offset_from_cursor(after) - 1
82
+ set_limit(nodes, limit)
83
+ else
84
+ set_limit(nodes, 0)
85
+ end
86
+ elsif before
87
+ set_limit(nodes, offset_from_cursor(before) - 1)
88
+ end
89
+
90
+ if first
91
+ if search_limit(nodes).nil? || search_limit(nodes) > first
92
+ set_limit(nodes, first)
93
+ end
94
+ end
95
+
96
+ if last
97
+ if search_limit(nodes)
98
+ if last <= search_limit(nodes)
99
+ offset = (search_offset(nodes) || 0) + (search_limit(nodes) - last)
100
+ set_offset(nodes, offset)
101
+ set_limit(nodes, last)
102
+ end
103
+ end
104
+ end
105
+
106
+ if max_page_size && !first && !last
107
+ if search_limit(nodes).nil? || search_limit(nodes) > max_page_size
108
+ set_limit(nodes, max_page_size)
109
+ end
110
+ end
111
+ end
112
+
113
+ # must return nodes for this connection after paging
114
+ def paged_nodes
115
+ sliced_nodes
116
+ end
117
+
118
+ # must return all nodes for this connection after chopping off first and last
119
+ def sliced_nodes
120
+ search_results
121
+ end
122
+
123
+ def search_limit(lazy_search)
124
+ lazy_search.limit_value
125
+ end
126
+
127
+ def search_offset(lazy_search)
128
+ lazy_search.offset_value
129
+ end
130
+
131
+ def set_offset(relation, offset)
132
+ if offset >= 0
133
+ relation.offset = offset
134
+ else
135
+ relation.offset = 0
136
+ end
137
+ end
138
+
139
+ def set_limit(relation, limit)
140
+ if limit >= 0
141
+ relation.limit = limit
142
+ else
143
+ relation.limit = 0
144
+ end
145
+ end
146
+
147
+ def offset_from_cursor(cursor)
148
+ decode(cursor).to_i
149
+ end
150
+ end
151
+
152
+ GraphQL::Relay::BaseConnection.register_connection_implementation(LazySearch, ResultConnection)
153
+ end
154
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'graphql'
4
+
5
+ module GraphQL
6
+ module Searchkick
7
+ class SearchableExtension < GraphQL::Schema::FieldExtension
8
+ def apply
9
+ field.argument(:query, String, required: false, description: 'A search query')
10
+ end
11
+
12
+ def resolve(object:, arguments:, context:)
13
+ next_args = arguments.dup
14
+ query = next_args.delete(:query)
15
+ result = yield(object, next_args)
16
+
17
+ model = options[:model_class]
18
+ LazySearch.new(result, query: query, model_class: model)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ module Graphql
2
+ module Searchkick
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: graphql-searchkick
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chad Wilken
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: appraisal
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: codeclimate-test-reporter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activerecord
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '6.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '6.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sqlite3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: graphql
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.8'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: searchkick
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.0'
125
+ description: A Searchkick plugin for graphql-ruby allowing you to use searchkick with
126
+ the connection type
127
+ email:
128
+ - chad.wilken@gmail.com
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".rspec"
135
+ - ".travis.yml"
136
+ - Appraisals
137
+ - Gemfile
138
+ - LICENSE.txt
139
+ - README.md
140
+ - Rakefile
141
+ - bin/console
142
+ - bin/setup
143
+ - docker-compose.yml
144
+ - gemfiles/.bundle/config
145
+ - gemfiles/graphql_1.10.gemfile
146
+ - gemfiles/graphql_1.10.gemfile.lock
147
+ - gemfiles/graphql_1.8.gemfile
148
+ - gemfiles/graphql_1.8.gemfile.lock
149
+ - gemfiles/graphql_1.9.gemfile
150
+ - gemfiles/graphql_1.9.gemfile.lock
151
+ - gemfiles/searchkick_3.0.gemfile
152
+ - gemfiles/searchkick_3.0.gemfile.lock
153
+ - gemfiles/searchkick_4.0.gemfile
154
+ - gemfiles/searchkick_4.0.gemfile.lock
155
+ - graphql-searchkick.gemspec
156
+ - lib/graphql/searchkick.rb
157
+ - lib/graphql/searchkick/field_integration.rb
158
+ - lib/graphql/searchkick/lazy_search.rb
159
+ - lib/graphql/searchkick/result_connection.rb
160
+ - lib/graphql/searchkick/searchable_extension.rb
161
+ - lib/graphql/searchkick/version.rb
162
+ homepage: https://github.com/CompanyCam/graphql-searchkick
163
+ licenses:
164
+ - MIT
165
+ metadata:
166
+ homepage_uri: https://github.com/CompanyCam/graphql-searchkick
167
+ changelog_uri: https://github.com/CompanyCam/graphql-searchkick/blob/master/CHANGELOG.md
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 2.3.0
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubyforge_project:
184
+ rubygems_version: 2.7.6.2
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: A Searchkick plugin for graphql-ruby
188
+ test_files: []