typesense 0.14.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +27 -0
- data/.rubocop.yml +12 -0
- data/Gemfile +16 -0
- data/README.md +7 -2
- data/examples/aliases.rb +21 -21
- data/examples/collections_and_documents.rb +1 -2
- data/examples/keys.rb +9 -9
- data/examples/overrides.rb +9 -9
- data/examples/search.rb +1 -1
- data/examples/synonyms.rb +1 -1
- data/lib/typesense/analytics.rb +15 -0
- data/lib/typesense/analytics_rule.rb +24 -0
- data/lib/typesense/analytics_rules.rb +30 -0
- data/lib/typesense/api_call.rb +1 -1
- data/lib/typesense/client.rb +3 -1
- data/lib/typesense/configuration.rb +1 -1
- data/lib/typesense/documents.rb +5 -1
- data/lib/typesense/preset.rb +24 -0
- data/lib/typesense/presets.rb +30 -0
- data/lib/typesense/version.rb +1 -1
- data/lib/typesense.rb +5 -0
- data/typesense.gemspec +5 -18
- metadata +14 -218
- data/.circleci/config.yml +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '06109ee5575c2188f478655bff4795ecc880618c304b3f1c0e50211287f8f9d7'
|
4
|
+
data.tar.gz: 7771a1fa516b731a95554de2f5e9bfb168bc1eb62fb516f7475ba707a88e3826
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaab9b60b14196dcd217222f5e506ccec30758814e224e209c4d9df945cf8aecc94e16c1102fabd736850a714803539d294b940c0bd020ce51bf940a5ac1a95c
|
7
|
+
data.tar.gz: cf592673f925704675d79e163acd7e6ddc8319ef0a46ed2a2c9a1781da93d538e29c76432a7dd32dc1a93783b7e511bdc87ce063e77f40705346bd5d524114c4
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
permissions:
|
6
|
+
contents: read
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build_and_test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: ['2.7', '3.0', '3.2']
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
21
|
+
- run: bundle exec rubocop
|
22
|
+
- run: bundle exec rspec --format documentation
|
23
|
+
- uses: actions/upload-artifact@v3
|
24
|
+
with:
|
25
|
+
name: coverage
|
26
|
+
path: coverage/
|
27
|
+
retention-days: 1
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
1
3
|
AllCops:
|
2
4
|
NewCops: enable
|
5
|
+
TargetRubyVersion: 2.7
|
3
6
|
|
4
7
|
Style/Documentation:
|
5
8
|
Enabled: false
|
@@ -37,3 +40,12 @@ Layout/LineLength:
|
|
37
40
|
Lint/SuppressedException:
|
38
41
|
Exclude:
|
39
42
|
- examples/**
|
43
|
+
|
44
|
+
RSpec/ExampleLength:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
RSpec/MultipleExpectations:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/HashSyntax:
|
51
|
+
Enabled: false # We still want to support older versions of Ruby
|
data/Gemfile
CHANGED
@@ -4,5 +4,21 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
6
|
|
7
|
+
# Dev dependencies
|
8
|
+
gem 'awesome_print', '~> 1.8'
|
9
|
+
gem 'bundler', '~> 2.0'
|
10
|
+
gem 'codecov', '~> 0.1'
|
11
|
+
gem 'guard', '~> 2.16'
|
12
|
+
gem 'guard-rubocop', '~> 1.3'
|
13
|
+
gem 'rake', '~> 13.0'
|
14
|
+
gem 'rspec', '~> 3.9'
|
15
|
+
gem 'rspec_junit_formatter', '~> 0.4'
|
16
|
+
gem 'rspec-legacy_formatters', '~> 1.0' # For codecov formatter
|
17
|
+
gem 'rubocop', '~> 1.12'
|
18
|
+
gem 'rubocop-rspec', '~> 2.4', require: false
|
19
|
+
gem 'simplecov', '~> 0.18'
|
20
|
+
gem 'timecop', '~> 0.9'
|
21
|
+
gem 'webmock', '~> 3.8'
|
22
|
+
|
7
23
|
# Specify your gem's dependencies in typesense.gemspec
|
8
24
|
gemspec
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Typesense Ruby Library [![Gem Version](https://badge.fury.io/rb/typesense.svg)](https://badge.fury.io/rb/typesense)
|
1
|
+
# Typesense Ruby Library [![Gem Version](https://badge.fury.io/rb/typesense.svg)](https://badge.fury.io/rb/typesense)
|
2
2
|
|
3
3
|
|
4
4
|
Ruby client library for accessing the [Typesense HTTP API](https://github.com/typesense/typesense).
|
@@ -33,6 +33,7 @@ Tests are also a good place to know how the the library works internally: [spec]
|
|
33
33
|
|
34
34
|
| Typesense Server | typesense-ruby |
|
35
35
|
|------------------|----------------|
|
36
|
+
| \>= v0.25.0 | \>= v1.0.0 |
|
36
37
|
| \>= v0.23.0 | \>= v0.14.0 |
|
37
38
|
| \>= v0.21.0 | \>= v0.13.0 |
|
38
39
|
| \>= v0.20.0 | \>= v0.12.0 |
|
@@ -49,7 +50,11 @@ Tests are also a good place to know how the the library works internally: [spec]
|
|
49
50
|
|
50
51
|
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.
|
51
52
|
|
52
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
53
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
54
|
+
|
55
|
+
### Releasing
|
56
|
+
|
57
|
+
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).
|
53
58
|
|
54
59
|
## Contributing
|
55
60
|
|
data/examples/aliases.rb
CHANGED
@@ -3,47 +3,47 @@
|
|
3
3
|
##
|
4
4
|
# These examples walk you through operations specifically related to aliases
|
5
5
|
|
6
|
-
require_relative '
|
6
|
+
require_relative 'client_initialization'
|
7
7
|
|
8
8
|
# Create a collection
|
9
9
|
create_response = @typesense.collections.create(
|
10
|
-
|
11
|
-
|
12
|
-
{
|
13
|
-
{
|
14
|
-
{
|
15
|
-
{
|
16
|
-
{
|
17
|
-
{
|
18
|
-
{
|
19
|
-
{
|
10
|
+
name: 'books_january',
|
11
|
+
fields: [
|
12
|
+
{ name: 'title', type: 'string' },
|
13
|
+
{ name: 'authors', type: 'string[]' },
|
14
|
+
{ name: 'authors_facet', type: 'string[]', facet: true },
|
15
|
+
{ name: 'publication_year', type: 'int32' },
|
16
|
+
{ name: 'publication_year_facet', type: 'string', facet: true },
|
17
|
+
{ name: 'ratings_count', type: 'int32' },
|
18
|
+
{ name: 'average_rating', type: 'float' },
|
19
|
+
{ name: 'image_url', type: 'string' }
|
20
20
|
],
|
21
|
-
|
21
|
+
default_sorting_field: 'ratings_count'
|
22
22
|
)
|
23
23
|
|
24
24
|
ap create_response
|
25
25
|
|
26
26
|
# Create or update an existing alias
|
27
27
|
create_alias_response = @typesense.aliases.upsert('books',
|
28
|
-
|
28
|
+
collection_name: 'books_january')
|
29
29
|
ap create_alias_response
|
30
30
|
|
31
31
|
# Add a book using the alias name `books`
|
32
32
|
hunger_games_book = {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
id: '1', original_publication_year: 2008, authors: ['Suzanne Collins'], average_rating: 4.34,
|
34
|
+
publication_year: 2008, publication_year_facet: '2008', authors_facet: ['Suzanne Collins'],
|
35
|
+
title: 'The Hunger Games',
|
36
|
+
image_url: 'https://images.gr-assets.com/books/1447303603m/2767052.jpg',
|
37
|
+
ratings_count: 4_780_653
|
38
38
|
}
|
39
39
|
|
40
40
|
@typesense.collections['books'].documents.create(hunger_games_book)
|
41
41
|
|
42
42
|
# Search using the alias
|
43
43
|
ap @typesense.collections['books'].documents.search(
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
q: 'hunger',
|
45
|
+
query_by: 'title',
|
46
|
+
sort_by: 'ratings_count:desc'
|
47
47
|
)
|
48
48
|
|
49
49
|
# List all aliases
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# These examples walk you through all the operations you can do on a collection and a document
|
5
5
|
# Search is specifically covered in another file in the examples folder
|
6
6
|
|
7
|
-
require_relative '
|
7
|
+
require_relative 'client_initialization'
|
8
8
|
|
9
9
|
##
|
10
10
|
# Create a collection
|
@@ -187,7 +187,6 @@ ap document
|
|
187
187
|
##
|
188
188
|
# Update a document. Unlike upsert, update will error out if the doc doesn't already exist.
|
189
189
|
document = @typesense.collections['companies'].documents['124'].update(
|
190
|
-
'id' => 1,
|
191
190
|
'num_employees' => 5500
|
192
191
|
)
|
193
192
|
ap document
|
data/examples/keys.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
# These examples walk you through operations to manage API Keys
|
5
5
|
|
6
|
-
require_relative '
|
6
|
+
require_relative 'client_initialization'
|
7
7
|
|
8
8
|
# Let's setup some test data for this example
|
9
9
|
schema = {
|
@@ -95,18 +95,18 @@ ap unscoped_search_only_api_key_response
|
|
95
95
|
# This is useful when you store multi-tenant data in a single Typesense server, but you only want
|
96
96
|
# a particular tenant to access their own data. You'd generate one scoped search key per tenant.
|
97
97
|
# IMPORTANT: scoped search keys should only be generated *server-side*, so as to not leak the unscoped main search key to clients
|
98
|
-
scoped_search_only_api_key = @typesense.keys.generate_scoped_search_key(unscoped_search_only_api_key, {
|
98
|
+
scoped_search_only_api_key = @typesense.keys.generate_scoped_search_key(unscoped_search_only_api_key, { filter_by: 'company_id:124' })
|
99
99
|
ap "scoped_search_only_api_key: #{scoped_search_only_api_key}"
|
100
100
|
|
101
101
|
# Now let's search the data using the scoped API Key for company_id:124
|
102
102
|
# You can do searches with this scoped_search_only_api_key from the server-side or client-side
|
103
103
|
scoped_typesense_client = Typesense::Client.new({
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
nodes: [{
|
105
|
+
host: 'localhost',
|
106
|
+
port: '8108',
|
107
|
+
protocol: 'http'
|
108
108
|
}],
|
109
|
-
|
109
|
+
api_key: scoped_search_only_api_key
|
110
110
|
})
|
111
111
|
|
112
112
|
search_results = scoped_typesense_client.collections['users'].documents.search({
|
@@ -117,8 +117,8 @@ ap search_results
|
|
117
117
|
|
118
118
|
# Search for a user that exists, but is outside the current key's scope
|
119
119
|
search_results = scoped_typesense_client.collections['users'].documents.search({
|
120
|
-
|
121
|
-
|
120
|
+
q: 'Maxwell',
|
121
|
+
query_by: 'user_name'
|
122
122
|
})
|
123
123
|
ap search_results # Will return empty result set
|
124
124
|
|
data/examples/overrides.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
##
|
4
4
|
# These examples walk you through operations specifically related to result overrides / curation
|
5
5
|
|
6
|
-
require_relative '
|
6
|
+
require_relative 'client_initialization'
|
7
7
|
|
8
8
|
# Delete the collection if it already exists
|
9
9
|
begin
|
@@ -69,19 +69,19 @@ schema = {
|
|
69
69
|
|
70
70
|
@typesense.collections['companies'].overrides.upsert(
|
71
71
|
'promote-doofenshmirtz',
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
rule: {
|
73
|
+
query: 'doofen',
|
74
|
+
match: 'exact'
|
75
75
|
},
|
76
|
-
|
76
|
+
includes: [{ 'id' => '126', 'position' => 1 }]
|
77
77
|
)
|
78
78
|
@typesense.collections['companies'].overrides.upsert(
|
79
79
|
'promote-acme',
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
rule: {
|
81
|
+
query: 'stark',
|
82
|
+
match: 'exact'
|
83
83
|
},
|
84
|
-
|
84
|
+
includes: [{ 'id' => '125', 'position' => 1 }]
|
85
85
|
)
|
86
86
|
|
87
87
|
##
|
data/examples/search.rb
CHANGED
data/examples/synonyms.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class AnalyticsRule
|
5
|
+
def initialize(rule_name, api_call)
|
6
|
+
@rule_name = rule_name
|
7
|
+
@api_call = api_call
|
8
|
+
end
|
9
|
+
|
10
|
+
def retrieve
|
11
|
+
@api_call.get(endpoint_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete
|
15
|
+
@api_call.delete(endpoint_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def endpoint_path
|
21
|
+
"#{AnalyticsRules::RESOURCE_PATH}/#{@rule_name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class AnalyticsRules
|
5
|
+
RESOURCE_PATH = '/analytics/rules'
|
6
|
+
|
7
|
+
def initialize(api_call)
|
8
|
+
@api_call = api_call
|
9
|
+
@analytics_rules = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def upsert(rule_name, params)
|
13
|
+
@api_call.put(endpoint_path(rule_name), params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def retrieve
|
17
|
+
@api_call.get(endpoint_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](rule_name)
|
21
|
+
@analytics_rules[rule_name] ||= AnalyticsRule.new(rule_name, @api_call)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def endpoint_path(operation = nil)
|
27
|
+
"#{AnalyticsRules::RESOURCE_PATH}#{operation.nil? ? '' : "/#{operation}"}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/typesense/api_call.rb
CHANGED
@@ -88,7 +88,7 @@ module Typesense
|
|
88
88
|
@logger.debug "Request #{method}:#{uri_for(endpoint, node)} to Node #{node[:index]} was successfully made (at the network layer). Response Code was #{response.code}."
|
89
89
|
|
90
90
|
parsed_response = if response.headers && (response.headers['content-type'] || '').include?('application/json')
|
91
|
-
Oj.load(response.body)
|
91
|
+
Oj.load(response.body, mode: :compat)
|
92
92
|
else
|
93
93
|
response.body
|
94
94
|
end
|
data/lib/typesense/client.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Typesense
|
4
4
|
class Client
|
5
5
|
attr_reader :configuration, :collections, :aliases, :keys, :debug, :health, :metrics, :operations,
|
6
|
-
:multi_search
|
6
|
+
:multi_search, :analytics, :presets
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@configuration = Configuration.new(options)
|
@@ -16,6 +16,8 @@ module Typesense
|
|
16
16
|
@health = Health.new(@api_call)
|
17
17
|
@metrics = Metrics.new(@api_call)
|
18
18
|
@operations = Operations.new(@api_call)
|
19
|
+
@analytics = Analytics.new(@api_call)
|
20
|
+
@presets = Presets.new(@api_call)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -11,7 +11,7 @@ module Typesense
|
|
11
11
|
@nearest_node = options[:nearest_node]
|
12
12
|
@connection_timeout_seconds = options[:connection_timeout_seconds] || options[:timeout_seconds] || 10
|
13
13
|
@healthcheck_interval_seconds = options[:healthcheck_interval_seconds] || 15
|
14
|
-
@num_retries = options[:num_retries] || @nodes.length + (@nearest_node.nil? ? 0 : 1) || 3
|
14
|
+
@num_retries = options[:num_retries] || (@nodes.length + (@nearest_node.nil? ? 0 : 1)) || 3
|
15
15
|
@retry_interval_seconds = options[:retry_interval_seconds] || 0.1
|
16
16
|
@api_key = options[:api_key]
|
17
17
|
|
data/lib/typesense/documents.rb
CHANGED
@@ -21,7 +21,11 @@ module Typesense
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def update(document, options = {})
|
24
|
-
|
24
|
+
if options['filter_by'] || options[:filter_by]
|
25
|
+
@api_call.patch(endpoint_path, document, options)
|
26
|
+
else
|
27
|
+
@api_call.post(endpoint_path, document, options.merge(action: :update))
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
def create_many(documents, options = {})
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Preset
|
5
|
+
def initialize(preset_name, api_call)
|
6
|
+
@preset_name = preset_name
|
7
|
+
@api_call = api_call
|
8
|
+
end
|
9
|
+
|
10
|
+
def retrieve
|
11
|
+
@api_call.get(endpoint_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete
|
15
|
+
@api_call.delete(endpoint_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def endpoint_path
|
21
|
+
"#{Presets::RESOURCE_PATH}/#{@preset_name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Typesense
|
4
|
+
class Presets
|
5
|
+
RESOURCE_PATH = '/presets'
|
6
|
+
|
7
|
+
def initialize(api_call)
|
8
|
+
@api_call = api_call
|
9
|
+
@presets = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def upsert(preset_name, params)
|
13
|
+
@api_call.put(endpoint_path(preset_name), params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def retrieve
|
17
|
+
@api_call.get(endpoint_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](preset_name)
|
21
|
+
@presets[preset_name] ||= Preset.new(preset_name, @api_call)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def endpoint_path(operation = nil)
|
27
|
+
"#{Presets::RESOURCE_PATH}#{operation.nil? ? '' : "/#{operation}"}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/typesense/version.rb
CHANGED
data/lib/typesense.rb
CHANGED
@@ -20,6 +20,11 @@ require_relative 'typesense/alias'
|
|
20
20
|
require_relative 'typesense/keys'
|
21
21
|
require_relative 'typesense/key'
|
22
22
|
require_relative 'typesense/multi_search'
|
23
|
+
require_relative 'typesense/analytics'
|
24
|
+
require_relative 'typesense/analytics_rules'
|
25
|
+
require_relative 'typesense/analytics_rule'
|
26
|
+
require_relative 'typesense/presets'
|
27
|
+
require_relative 'typesense/preset'
|
23
28
|
require_relative 'typesense/debug'
|
24
29
|
require_relative 'typesense/health'
|
25
30
|
require_relative 'typesense/metrics'
|
data/typesense.gemspec
CHANGED
@@ -15,7 +15,9 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.homepage = 'https://typesense.org'
|
16
16
|
spec.license = 'Apache-2.0'
|
17
17
|
|
18
|
-
|
18
|
+
# rubocop:disable Gemspec/RequiredRubyVersion, Lint/RedundantCopDisableDirective
|
19
|
+
spec.required_ruby_version = '>= 2.7'
|
20
|
+
# rubocop:enable Gemspec/RequiredRubyVersion, Lint/RedundantCopDisableDirective
|
19
21
|
|
20
22
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
23
|
f.match(%r{^(test|spec|features)/})
|
@@ -24,22 +26,7 @@ Gem::Specification.new do |spec|
|
|
24
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
27
|
spec.require_paths = ['lib']
|
26
28
|
|
27
|
-
spec.
|
28
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
29
|
-
spec.add_development_dependency 'codecov', '~> 0.1'
|
30
|
-
spec.add_development_dependency 'guard', '~> 2.16'
|
31
|
-
spec.add_development_dependency 'guard-rubocop', '~> 1.3'
|
32
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.9'
|
33
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
34
|
-
spec.add_development_dependency 'rspec', '~> 3.9'
|
35
|
-
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
|
36
|
-
spec.add_development_dependency 'rspec-legacy_formatters', '~> 1.0' # For codecov formatter
|
37
|
-
spec.add_development_dependency 'rubocop', '~> 0.88'
|
38
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.39'
|
39
|
-
spec.add_development_dependency 'simplecov', '~> 0.18'
|
40
|
-
spec.add_development_dependency 'timecop', '~> 0.9'
|
41
|
-
spec.add_development_dependency 'webmock', '~> 3.8'
|
42
|
-
|
43
|
-
spec.add_dependency 'oj', '~> 3.11'
|
29
|
+
spec.add_dependency 'oj', '~> 3.16'
|
44
30
|
spec.add_dependency 'typhoeus', '~> 1.4'
|
31
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
45
32
|
end
|
metadata
CHANGED
@@ -1,239 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typesense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Typesense, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: awesome_print
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.8'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.8'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: codecov
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.1'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: guard
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.16'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.16'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: guard-rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.3'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.3'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: pry-byebug
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.9'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.9'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rake
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '13.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '13.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '3.9'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.9'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rspec_junit_formatter
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0.4'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0.4'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rspec-legacy_formatters
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '1.0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '1.0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rubocop
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0.88'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0.88'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rubocop-rspec
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '1.39'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '1.39'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: simplecov
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - "~>"
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0.18'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - "~>"
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0.18'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: timecop
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - "~>"
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0.9'
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - "~>"
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0.9'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: webmock
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - "~>"
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '3.8'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - "~>"
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '3.8'
|
223
13
|
- !ruby/object:Gem::Dependency
|
224
14
|
name: oj
|
225
15
|
requirement: !ruby/object:Gem::Requirement
|
226
16
|
requirements:
|
227
17
|
- - "~>"
|
228
18
|
- !ruby/object:Gem::Version
|
229
|
-
version: '3.
|
19
|
+
version: '3.16'
|
230
20
|
type: :runtime
|
231
21
|
prerelease: false
|
232
22
|
version_requirements: !ruby/object:Gem::Requirement
|
233
23
|
requirements:
|
234
24
|
- - "~>"
|
235
25
|
- !ruby/object:Gem::Version
|
236
|
-
version: '3.
|
26
|
+
version: '3.16'
|
237
27
|
- !ruby/object:Gem::Dependency
|
238
28
|
name: typhoeus
|
239
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,7 +46,7 @@ executables: []
|
|
256
46
|
extensions: []
|
257
47
|
extra_rdoc_files: []
|
258
48
|
files:
|
259
|
-
- ".
|
49
|
+
- ".github/workflows/tests.yml"
|
260
50
|
- ".gitignore"
|
261
51
|
- ".rspec"
|
262
52
|
- ".rubocop.yml"
|
@@ -278,6 +68,9 @@ files:
|
|
278
68
|
- lib/typesense.rb
|
279
69
|
- lib/typesense/alias.rb
|
280
70
|
- lib/typesense/aliases.rb
|
71
|
+
- lib/typesense/analytics.rb
|
72
|
+
- lib/typesense/analytics_rule.rb
|
73
|
+
- lib/typesense/analytics_rules.rb
|
281
74
|
- lib/typesense/api_call.rb
|
282
75
|
- lib/typesense/client.rb
|
283
76
|
- lib/typesense/collection.rb
|
@@ -295,6 +88,8 @@ files:
|
|
295
88
|
- lib/typesense/operations.rb
|
296
89
|
- lib/typesense/override.rb
|
297
90
|
- lib/typesense/overrides.rb
|
91
|
+
- lib/typesense/preset.rb
|
92
|
+
- lib/typesense/presets.rb
|
298
93
|
- lib/typesense/synonym.rb
|
299
94
|
- lib/typesense/synonyms.rb
|
300
95
|
- lib/typesense/version.rb
|
@@ -302,7 +97,8 @@ files:
|
|
302
97
|
homepage: https://typesense.org
|
303
98
|
licenses:
|
304
99
|
- Apache-2.0
|
305
|
-
metadata:
|
100
|
+
metadata:
|
101
|
+
rubygems_mfa_required: 'true'
|
306
102
|
post_install_message:
|
307
103
|
rdoc_options: []
|
308
104
|
require_paths:
|
@@ -311,14 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
311
107
|
requirements:
|
312
108
|
- - ">="
|
313
109
|
- !ruby/object:Gem::Version
|
314
|
-
version: '2.
|
110
|
+
version: '2.7'
|
315
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
316
112
|
requirements:
|
317
113
|
- - ">="
|
318
114
|
- !ruby/object:Gem::Version
|
319
115
|
version: '0'
|
320
116
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
117
|
+
rubygems_version: 3.4.10
|
322
118
|
signing_key:
|
323
119
|
specification_version: 4
|
324
120
|
summary: Ruby Library for Typesense
|
data/.circleci/config.yml
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
build:
|
8
|
-
docker:
|
9
|
-
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.4.1-node-browsers
|
11
|
-
|
12
|
-
# Specify service dependencies here if necessary
|
13
|
-
# CircleCI maintains a library of pre-built images
|
14
|
-
# documented at https://circleci.com/docs/2.0/circleci-images/
|
15
|
-
# - image: circleci/postgres:9.4
|
16
|
-
|
17
|
-
working_directory: ~/repo
|
18
|
-
|
19
|
-
steps:
|
20
|
-
- checkout
|
21
|
-
|
22
|
-
# # Download and cache dependencies
|
23
|
-
# - restore_cache:
|
24
|
-
# keys:
|
25
|
-
# - v1-dependencies-{{ checksum "Gemfile.lock" }}
|
26
|
-
# # fallback to using the latest cache if no exact match is found
|
27
|
-
# - v1-dependencies-
|
28
|
-
|
29
|
-
- run:
|
30
|
-
name: install bundler
|
31
|
-
command: |
|
32
|
-
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
|
33
|
-
source $BASH_ENV
|
34
|
-
gem install bundler
|
35
|
-
|
36
|
-
- run:
|
37
|
-
name: install dependencies
|
38
|
-
command: |
|
39
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
40
|
-
|
41
|
-
# - save_cache:
|
42
|
-
# paths:
|
43
|
-
# - ./vendor/bundle
|
44
|
-
# key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
45
|
-
|
46
|
-
- run:
|
47
|
-
name: lint
|
48
|
-
command: |
|
49
|
-
bundle exec rubocop
|
50
|
-
|
51
|
-
# run tests!
|
52
|
-
- run:
|
53
|
-
name: run tests
|
54
|
-
command: |
|
55
|
-
mkdir /tmp/test-results
|
56
|
-
|
57
|
-
bundle exec rspec --format documentation \
|
58
|
-
--format RspecJunitFormatter \
|
59
|
-
--out /tmp/test-results/rspec.xml
|
60
|
-
|
61
|
-
# collect reports
|
62
|
-
- store_test_results:
|
63
|
-
path: /tmp/test-results
|
64
|
-
- store_artifacts:
|
65
|
-
path: /tmp/test-results
|
66
|
-
destination: test-results
|
67
|
-
- store_artifacts:
|
68
|
-
path: coverage
|
69
|
-
destination: coverage
|