graphql-anycable 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +15 -3
- data/CHANGELOG.md +13 -0
- data/Gemfile +1 -4
- data/README.md +8 -0
- data/graphql-anycable.gemspec +0 -1
- data/lib/graphql/anycable/railtie.rb +0 -8
- data/lib/graphql/anycable/version.rb +1 -1
- data/lib/graphql/subscriptions/anycable_subscriptions.rb +3 -3
- data/lib/graphql-anycable.rb +6 -0
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c3d8264a1ad4045379531d78a2b2d80507c1b37c2e98ca78370182258c20a79
|
4
|
+
data.tar.gz: 237d5b34c060675f21b97f0a08a12c70bb94795f08796dfdedc2e01971471ceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4352ab99658356eb39f60048dff9a9a8c7b4968d4b5f50122f6e56534ebbec3f5d1fbd2b320f73b83e5001e0eb1d73904690a03831a8d7a54ef5b38231365fe1
|
7
|
+
data.tar.gz: b0fa928b0d187607d25bb6fedf4511bff6288fa6f82a88182bb892ad936922fe569da681ffff227ba88443b43f625e8d8ed007f300a891f39392a747948dd600
|
data/.github/workflows/test.yml
CHANGED
@@ -10,7 +10,7 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
test:
|
13
|
-
name: "GraphQL-Ruby ${{ matrix.graphql }} on Ruby ${{ matrix.ruby }} (use_client_id: ${{ matrix.client_id }})"
|
13
|
+
name: "GraphQL-Ruby ${{ matrix.graphql }} on Ruby ${{ matrix.ruby }} (use_client_id: ${{ matrix.client_id }}) Redis v${{ matrix.redis_version }}"
|
14
14
|
runs-on: ubuntu-latest
|
15
15
|
strategy:
|
16
16
|
fail-fast: false
|
@@ -20,14 +20,17 @@ jobs:
|
|
20
20
|
graphql: '~> 2.0.0'
|
21
21
|
client_id: 'false'
|
22
22
|
anycable_rails: '~> 1.3'
|
23
|
+
redis_version: latest
|
23
24
|
- ruby: "3.0"
|
24
25
|
graphql: '~> 1.13.0'
|
25
26
|
client_id: 'false'
|
26
27
|
anycable_rails: '~> 1.2.0'
|
28
|
+
redis_version: 5.0.4
|
27
29
|
- ruby: 2.7
|
28
30
|
graphql: '~> 1.12.0'
|
29
31
|
client_id: 'true'
|
30
32
|
anycable_rails: '~> 1.1.0'
|
33
|
+
redis_version: 4.0.14
|
31
34
|
container:
|
32
35
|
image: ruby:${{ matrix.ruby }}
|
33
36
|
env:
|
@@ -35,9 +38,18 @@ jobs:
|
|
35
38
|
GRAPHQL_RUBY_VERSION: ${{ matrix.graphql }}
|
36
39
|
ANYCABLE_RAILS_VERSION: ${{ matrix.anycable_rails }}
|
37
40
|
GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID: ${{ matrix.client_id }}
|
41
|
+
REDIS_URL: redis://redis:6379
|
42
|
+
services:
|
43
|
+
redis:
|
44
|
+
image: redis:${{ matrix.redis_version }}
|
45
|
+
options: >-
|
46
|
+
--health-cmd "redis-cli ping"
|
47
|
+
--health-interval 10s
|
48
|
+
--health-timeout 5s
|
49
|
+
--health-retries 5
|
38
50
|
steps:
|
39
|
-
- uses: actions/checkout@
|
40
|
-
- uses: actions/cache@
|
51
|
+
- uses: actions/checkout@v3
|
52
|
+
- uses: actions/cache@v3
|
41
53
|
with:
|
42
54
|
path: vendor/bundle
|
43
55
|
key: bundle-${{ matrix.ruby }}-${{ matrix.graphql }}-${{ matrix.anycable }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## 1.1.6 - 2023-08-03
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Fix empty operation name handling when using redis-client or redis.rb v5. [@ilyasgaraev] ([#34](https://github.com/anycable/graphql-anycable/pull/34))
|
15
|
+
- Fix deprecation warnings for redis.rb v4.8+ and support for redis.rb v5. [@smasry] ([#29](https://github.com/anycable/graphql-anycable/pull/29))
|
16
|
+
|
17
|
+
## 1.1.5 - 2022-10-26
|
18
|
+
|
19
|
+
- Fix that deprecation warning about `config.use_client_provided_uniq_id` again, so it can be issued outside of Rails. [@gsamokovarov] ([#27](https://github.com/anycable/graphql-anycable/pull/27))
|
20
|
+
|
10
21
|
## 1.1.4 - 2022-07-28
|
11
22
|
|
12
23
|
- Fix deprecation warning about using client-side channel ids shown even if deprecated functionality was disabled in application code (not via config file or environment variable). [@gsamokovarov] ([#26](https://github.com/anycable/graphql-anycable/pull/26))
|
@@ -164,6 +175,8 @@ Technical release to test publishing via GitHub Actions.
|
|
164
175
|
|
165
176
|
Initial version: store subscriptions on redis, re-execute queries in sync. [@Envek]
|
166
177
|
|
178
|
+
[@ilyasgaraev]: https://github.com/ilyasgaraev "Ilyas Garaev"
|
179
|
+
[@smasry]: https://github.com/smasry "Samer Masry"
|
167
180
|
[@gsamokovarov]: https://github.com/gsamokovarov "Genadi Samokovarov"
|
168
181
|
[@bibendi]: https://github.com/bibendi "Misha Merkushin"
|
169
182
|
[@FX-HAO]: https://github.com/FX-HAO "Fuxin Hao"
|
data/Gemfile
CHANGED
@@ -9,7 +9,7 @@ gemspec
|
|
9
9
|
|
10
10
|
gem "graphql", ENV.fetch("GRAPHQL_RUBY_VERSION", "~> 1.12")
|
11
11
|
gem "anycable", ENV.fetch("ANYCABLE_VERSION", "~> 1.0")
|
12
|
-
gem "anycable-rails", ENV.fetch("ANYCABLE_RAILS_VERSION", "~> 1.
|
12
|
+
gem "anycable-rails", ENV.fetch("ANYCABLE_RAILS_VERSION", "~> 1.3")
|
13
13
|
|
14
14
|
group :development, :test do
|
15
15
|
gem "pry"
|
@@ -17,7 +17,4 @@ group :development, :test do
|
|
17
17
|
|
18
18
|
gem "rubocop"
|
19
19
|
gem "rubocop-rspec"
|
20
|
-
|
21
|
-
# See https://github.com/guilleiguaran/fakeredis/pull/247
|
22
|
-
gem "fakeredis", github: 'guilleiguaran/fakeredis'
|
23
20
|
end
|
data/README.md
CHANGED
@@ -209,6 +209,14 @@ As in AnyCable there is no place to store subscription data in-memory, it should
|
|
209
209
|
=> 52ee8d65-275e-4d22-94af-313129116388
|
210
210
|
```
|
211
211
|
|
212
|
+
## Testing applications which use `graphql-anycable`
|
213
|
+
|
214
|
+
You can pass custom redis-server URL to AnyCable using ENV variable.
|
215
|
+
|
216
|
+
```bash
|
217
|
+
REDIS_URL=redis://localhost:6379/5 bundle exec rspec
|
218
|
+
```
|
219
|
+
|
212
220
|
## Development
|
213
221
|
|
214
222
|
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.
|
data/graphql-anycable.gemspec
CHANGED
@@ -33,7 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_development_dependency "anycable-rails"
|
35
35
|
spec.add_development_dependency "bundler", "~> 2.0"
|
36
|
-
spec.add_development_dependency "fakeredis"
|
37
36
|
spec.add_development_dependency "rack"
|
38
37
|
spec.add_development_dependency "railties"
|
39
38
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
@@ -9,14 +9,6 @@ module GraphQL
|
|
9
9
|
path = File.expand_path(__dir__)
|
10
10
|
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
|
11
11
|
end
|
12
|
-
|
13
|
-
config.after_initialize do
|
14
|
-
if GraphQL::AnyCable.config.use_client_provided_uniq_id?
|
15
|
-
warn "[Deprecated] Using client provided channel uniq IDs could lead to unexpected behaviour, " \
|
16
|
-
"please, set GraphQL::AnyCable.config.use_client_provided_uniq_id = false or GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false, " \
|
17
|
-
"and update the `#unsubscribed` callback code according to the latest docs."
|
18
|
-
end
|
19
|
-
end
|
20
12
|
end
|
21
13
|
end
|
22
14
|
end
|
@@ -156,16 +156,16 @@ module GraphQL
|
|
156
156
|
query_string: query.query_string,
|
157
157
|
variables: query.provided_variables.to_json,
|
158
158
|
context: @serializer.dump(context.to_h),
|
159
|
-
operation_name: query.operation_name,
|
159
|
+
operation_name: query.operation_name.to_s,
|
160
160
|
events: events.map { |e| [e.topic, e.fingerprint] }.to_h.to_json,
|
161
161
|
}
|
162
162
|
|
163
163
|
redis.multi do |pipeline|
|
164
|
-
pipeline.sadd(CHANNEL_PREFIX + channel_uniq_id, subscription_id)
|
164
|
+
pipeline.sadd(CHANNEL_PREFIX + channel_uniq_id, [subscription_id])
|
165
165
|
pipeline.mapped_hmset(SUBSCRIPTION_PREFIX + subscription_id, data)
|
166
166
|
events.each do |event|
|
167
167
|
pipeline.zincrby(FINGERPRINTS_PREFIX + event.topic, 1, event.fingerprint)
|
168
|
-
pipeline.sadd(SUBSCRIPTIONS_PREFIX + event.fingerprint, subscription_id)
|
168
|
+
pipeline.sadd(SUBSCRIPTIONS_PREFIX + event.fingerprint, [subscription_id])
|
169
169
|
end
|
170
170
|
next unless config.subscription_expiration_seconds
|
171
171
|
pipeline.expire(CHANNEL_PREFIX + channel_uniq_id, config.subscription_expiration_seconds)
|
data/lib/graphql-anycable.rb
CHANGED
@@ -11,6 +11,12 @@ require_relative "graphql/subscriptions/anycable_subscriptions"
|
|
11
11
|
module GraphQL
|
12
12
|
module AnyCable
|
13
13
|
def self.use(schema, **options)
|
14
|
+
if config.use_client_provided_uniq_id?
|
15
|
+
warn "[Deprecated] Using client provided channel uniq IDs could lead to unexpected behaviour, " \
|
16
|
+
"please, set GraphQL::AnyCable.config.use_client_provided_uniq_id = false or GRAPHQL_ANYCABLE_USE_CLIENT_PROVIDED_UNIQ_ID=false, " \
|
17
|
+
"and update the `#unsubscribed` callback code according to the latest docs."
|
18
|
+
end
|
19
|
+
|
14
20
|
schema.use GraphQL::Subscriptions::AnyCableSubscriptions, **options
|
15
21
|
end
|
16
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-anycable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable
|
@@ -106,20 +106,6 @@ dependencies:
|
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '2.0'
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: fakeredis
|
111
|
-
requirement: !ruby/object:Gem::Requirement
|
112
|
-
requirements:
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: '0'
|
116
|
-
type: :development
|
117
|
-
prerelease: false
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '0'
|
123
109
|
- !ruby/object:Gem::Dependency
|
124
110
|
name: rack
|
125
111
|
requirement: !ruby/object:Gem::Requirement
|