graphql-anycable 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build-release.yml +64 -0
- data/.github/workflows/test.yml +69 -0
- data/Gemfile +4 -1
- data/README.md +37 -0
- data/graphql-anycable.gemspec +0 -1
- data/lib/graphql/anycable/version.rb +1 -1
- metadata +4 -24
- data/.travis.yml +0 -34
- data/Appraisals +0 -19
- data/gemfiles/.bundle/config +0 -2
- data/gemfiles/anycable_0.6.gemfile +0 -14
- data/gemfiles/anycable_1.0.gemfile +0 -14
- data/gemfiles/graphql_1.10.gemfile +0 -14
- data/gemfiles/graphql_1.11.gemfile +0 -14
- data/gemfiles/graphql_1.9.gemfile +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f464f4d333c2d59173af97549967def49f8843ae53882c4ab455fa48e1b62ab
|
4
|
+
data.tar.gz: f19ba6bfd926d4038ce6c11bc40c499f60f5d426daeec59f9b2f28304d08d0bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b35ce8815a7ffebed1162b35d21cf3addb5f6677df3dd00311827cdac7d371277703c271447631a143d9b6e3e4865ea17a141ce2664ea7948fe9c52ac6bc6f5
|
7
|
+
data.tar.gz: 7696f55e6a71cc8e1c14d08473a86da9b950317d88224afb8beaa2f0484d96886bf1d0d5a51cc53d3026a8598f4f4f7ecc57db9106b4aec80bcd81a0670b07e1
|
@@ -0,0 +1,64 @@
|
|
1
|
+
name: Build and release gem to RubyGems
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
with:
|
14
|
+
fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7
|
18
|
+
- name: "Extract data from tag: version, message, body"
|
19
|
+
id: tag
|
20
|
+
run: |
|
21
|
+
git fetch --tags --force # Really fetch annotated tag. See https://github.com/actions/checkout/issues/290#issuecomment-680260080
|
22
|
+
echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
|
23
|
+
echo ::set-output name=subject::$(git for-each-ref $GITHUB_REF --format='%(contents:subject)')
|
24
|
+
# Multiline body for release. See https://github.community/t/set-output-truncates-multiline-strings/16852/5
|
25
|
+
BODY="$(git for-each-ref $GITHUB_REF --format='%(contents:body)')"
|
26
|
+
BODY="${BODY//'%'/'%25'}"
|
27
|
+
BODY="${BODY//$'\n'/'%0A'}"
|
28
|
+
BODY="${BODY//$'\r'/'%0D'}"
|
29
|
+
echo "::set-output name=body::$BODY"
|
30
|
+
- name: Build gem
|
31
|
+
run: gem build
|
32
|
+
- name: Check version
|
33
|
+
run: ls graphql-anycable-${{ steps.tag.outputs.version }}.gem
|
34
|
+
- name: Create Release
|
35
|
+
id: create_release
|
36
|
+
uses: actions/create-release@v1
|
37
|
+
env:
|
38
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
39
|
+
with:
|
40
|
+
tag_name: ${{ github.ref }}
|
41
|
+
release_name: ${{ steps.tag.outputs.subject }}
|
42
|
+
body: ${{ steps.tag.outputs.body }}
|
43
|
+
draft: false
|
44
|
+
prerelease: false
|
45
|
+
- name: Upload Release Asset
|
46
|
+
id: upload-release-asset
|
47
|
+
uses: actions/upload-release-asset@v1
|
48
|
+
env:
|
49
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
50
|
+
with:
|
51
|
+
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
52
|
+
asset_path: graphql-anycable-${{ steps.tag.outputs.version }}.gem
|
53
|
+
asset_name: graphql-anycable-${{ steps.tag.outputs.version }}.gem
|
54
|
+
asset_content_type: application/x-tar
|
55
|
+
- name: Install publish prerequisites
|
56
|
+
run: |
|
57
|
+
sudo apt-get update
|
58
|
+
sudo apt-get install oathtool
|
59
|
+
- name: Publish to RubyGems
|
60
|
+
env:
|
61
|
+
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_KEY }}"
|
62
|
+
RUBYGEMS_OTP_KEY: "${{ secrets.RUBYGEMS_OTP_KEY }}"
|
63
|
+
run: |
|
64
|
+
gem push graphql-anycable-${{ steps.tag.outputs.version }}.gem --otp=$(oathtool --totp --base32 $RUBYGEMS_OTP_KEY)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
name: Run tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- '**'
|
8
|
+
tags-ignore:
|
9
|
+
- 'v*'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
name: "Run tests"
|
14
|
+
if: "! contains(toJSON(github.event.commits.latest.message), '[ci skip]')"
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
include:
|
20
|
+
- ruby: 2.7
|
21
|
+
graphql: '~> 1.11.0'
|
22
|
+
anycable: '~> 1.0.0'
|
23
|
+
interpreter: yes
|
24
|
+
- ruby: 2.7
|
25
|
+
graphql: '~> 1.11.0'
|
26
|
+
anycable: '~> 1.0.0'
|
27
|
+
interpreter: no
|
28
|
+
- ruby: 2.6
|
29
|
+
graphql: '~> 1.10.0'
|
30
|
+
anycable: '~> 1.0.0'
|
31
|
+
interpreter: yes
|
32
|
+
- ruby: 2.6
|
33
|
+
graphql: '~> 1.10.0'
|
34
|
+
anycable: '~> 1.0.0'
|
35
|
+
interpreter: no
|
36
|
+
- ruby: 2.5
|
37
|
+
graphql: '~> 1.9.0'
|
38
|
+
anycable: '~> 0.6.0'
|
39
|
+
interpreter: yes
|
40
|
+
- ruby: 2.5
|
41
|
+
graphql: '~> 1.9.0'
|
42
|
+
anycable: '~> 0.6.0'
|
43
|
+
interpreter: no
|
44
|
+
container:
|
45
|
+
image: ruby:${{ matrix.ruby }}
|
46
|
+
env:
|
47
|
+
CI: true
|
48
|
+
GRAPHQL_RUBY_VERSION: ${{ matrix.graphql }}
|
49
|
+
ANYCABLE_VERSION: ${{ matrix.anycable }}
|
50
|
+
steps:
|
51
|
+
- uses: actions/checkout@v2
|
52
|
+
- uses: actions/cache@v2
|
53
|
+
with:
|
54
|
+
path: vendor/bundle
|
55
|
+
key: bundle-${{ matrix.ruby }}-${{ matrix.graphql }}-${{ matrix.anycable }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
|
56
|
+
restore-keys: |
|
57
|
+
bundle-${{ matrix.ruby }}-${{ matrix.graphql }}-${{ matrix.anycable }}-
|
58
|
+
bundle-${{ matrix.ruby }}-
|
59
|
+
- name: Upgrade Bundler to 2.0 (for older Rubies)
|
60
|
+
run: gem install bundler -v '~> 2.0'
|
61
|
+
- name: Bundle install
|
62
|
+
run: |
|
63
|
+
bundle config path vendor/bundle
|
64
|
+
bundle install
|
65
|
+
bundle update
|
66
|
+
- name: Run RSpec
|
67
|
+
env:
|
68
|
+
GRAPHQL_RUBY_INTERPRETER: ${{ matrix.interpreter }}
|
69
|
+
run: bundle exec rspec
|
data/Gemfile
CHANGED
@@ -7,6 +7,9 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
7
7
|
# Specify your gem's dependencies in graphql-anycable.gemspec
|
8
8
|
gemspec
|
9
9
|
|
10
|
+
gem "graphql", ENV.fetch("GRAPHQL_RUBY_VERSION", "~> 1.11")
|
11
|
+
gem "anycable", ENV.fetch("ANYCABLE_VERSION", "~> 1.0")
|
12
|
+
|
10
13
|
group :development, :test do
|
11
14
|
gem "pry"
|
12
15
|
gem "pry-byebug", platform: :mri
|
@@ -15,5 +18,5 @@ group :development, :test do
|
|
15
18
|
gem "rubocop-rspec"
|
16
19
|
|
17
20
|
# See https://github.com/guilleiguaran/fakeredis/pull/247
|
18
|
-
gem "fakeredis", github: '
|
21
|
+
gem "fakeredis", github: 'guilleiguaran/fakeredis'
|
19
22
|
end
|
data/README.md
CHANGED
@@ -139,6 +139,43 @@ GraphQL-Anycable uses [anyway_config] to configure itself. There are several pos
|
|
139
139
|
|
140
140
|
And any other way provided by [anyway_config]. Check its documentation!
|
141
141
|
|
142
|
+
## Data model
|
143
|
+
|
144
|
+
As in AnyCable there is no place to store subscription data in-memory, it should be persisted somewhere to be retrieved on `GraphQLSchema.subscriptions.trigger` and sent to subscribed clients. `graphql-anycable` uses the same Redis database as AnyCable itself.
|
145
|
+
|
146
|
+
1. Event subscriptions: `graphql-event:#{event.topic}` set containing identifiers for all subscriptions for given operation with certain context and arguments (serialized in _topic_). Used to find all subscriptions on `GraphQLSchema.subscriptions.trigger`.
|
147
|
+
|
148
|
+
```
|
149
|
+
SMEMBERS graphql-event:1:myStats:
|
150
|
+
=> 52ee8d65-275e-4d22-94af-313129116388
|
151
|
+
```
|
152
|
+
|
153
|
+
2. Subscription data: `graphql-subscription:#{subscription_id}` hash contains everything required to evaluate subscription on trigger and create data for client.
|
154
|
+
|
155
|
+
```
|
156
|
+
HGETALL graphql-subscription:52ee8d65-275e-4d22-94af-313129116388
|
157
|
+
=> {
|
158
|
+
context: '{"user_id":1,"user":{"__gid__":"Z2lkOi8vZWJheS1tYWcyL1VzZXIvMQ"},"subscription_id":"52ee8d65-275e-4d22-94af-313129116388\","action_cable_stream":"graphql-subscription:52ee8d65-275e-4d22-94af-313129116388",}',
|
159
|
+
variables: '{}',
|
160
|
+
operation_name: 'MyStats'
|
161
|
+
query_string: 'subscription MyStats { myStatsUpdated { completed total processed __typename } }',
|
162
|
+
}
|
163
|
+
```
|
164
|
+
|
165
|
+
3. Channel subscriptions: `graphql-channel:#{channel_id}` set containing identifiers for subscriptions created in ActionCable channel to delete them on client disconnect.
|
166
|
+
|
167
|
+
```
|
168
|
+
SMEMBERS graphql-channel:17420c6ed9e
|
169
|
+
=> 52ee8d65-275e-4d22-94af-313129116388
|
170
|
+
```
|
171
|
+
|
172
|
+
4. Subscription events: `graphql-subscription-events:#{subscription_id}` set containing event topics to delete subscription identifier from event subscriptions set on unsubscribe (or client disconnect).
|
173
|
+
|
174
|
+
```
|
175
|
+
SMEMBERS graphql-subscription-events:52ee8d65-275e-4d22-94af-313129116388
|
176
|
+
=> 1:myStats:
|
177
|
+
```
|
178
|
+
|
142
179
|
## Development
|
143
180
|
|
144
181
|
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
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: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable
|
@@ -134,20 +134,6 @@ dependencies:
|
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '3.0'
|
137
|
-
- !ruby/object:Gem::Dependency
|
138
|
-
name: appraisal
|
139
|
-
requirement: !ruby/object:Gem::Requirement
|
140
|
-
requirements:
|
141
|
-
- - ">="
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version: '0'
|
144
|
-
type: :development
|
145
|
-
prerelease: false
|
146
|
-
version_requirements: !ruby/object:Gem::Requirement
|
147
|
-
requirements:
|
148
|
-
- - ">="
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: '0'
|
151
137
|
description:
|
152
138
|
email:
|
153
139
|
- envek@envek.name
|
@@ -157,11 +143,11 @@ extra_rdoc_files: []
|
|
157
143
|
files:
|
158
144
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
159
145
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
146
|
+
- ".github/workflows/build-release.yml"
|
147
|
+
- ".github/workflows/test.yml"
|
160
148
|
- ".gitignore"
|
161
149
|
- ".rspec"
|
162
150
|
- ".rubocop.yml"
|
163
|
-
- ".travis.yml"
|
164
|
-
- Appraisals
|
165
151
|
- CHANGELOG.md
|
166
152
|
- Gemfile
|
167
153
|
- LICENSE.txt
|
@@ -169,12 +155,6 @@ files:
|
|
169
155
|
- Rakefile
|
170
156
|
- bin/console
|
171
157
|
- bin/setup
|
172
|
-
- gemfiles/.bundle/config
|
173
|
-
- gemfiles/anycable_0.6.gemfile
|
174
|
-
- gemfiles/anycable_1.0.gemfile
|
175
|
-
- gemfiles/graphql_1.10.gemfile
|
176
|
-
- gemfiles/graphql_1.11.gemfile
|
177
|
-
- gemfiles/graphql_1.9.gemfile
|
178
158
|
- graphql-anycable.gemspec
|
179
159
|
- lib/Rakefile
|
180
160
|
- lib/graphql-anycable.rb
|
data/.travis.yml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.7.1
|
6
|
-
- 2.6.6
|
7
|
-
- 2.5.8
|
8
|
-
gemfile:
|
9
|
-
- gemfiles/graphql_1.9.gemfile
|
10
|
-
- gemfiles/graphql_1.10.gemfile
|
11
|
-
- gemfiles/graphql_1.11.gemfile
|
12
|
-
- gemfiles/anycable_0.6.gemfile
|
13
|
-
- gemfiles/anycable_1.0.gemfile
|
14
|
-
env:
|
15
|
-
- GRAPHQL_RUBY_INTERPRETER=yes
|
16
|
-
- GRAPHQL_RUBY_INTERPRETER=no
|
17
|
-
before_install: gem install bundler -v "~> 2.0"
|
18
|
-
|
19
|
-
jobs:
|
20
|
-
exclude:
|
21
|
-
# Exclude new dependencies on old rubies to run less jobs
|
22
|
-
- rvm: 2.5.8
|
23
|
-
gemfile: gemfiles/anycable_1.0.gemfile
|
24
|
-
- rvm: 2.5.8
|
25
|
-
gemfile: gemfiles/graphql_1.10.gemfile
|
26
|
-
- rvm: 2.5.8
|
27
|
-
gemfile: gemfiles/graphql_1.11.gemfile
|
28
|
-
# Exclude old dependencies on new rubies to run less jobs
|
29
|
-
- rvm: 2.6.5
|
30
|
-
gemfile: gemfiles/anycable_0.6.gemfile
|
31
|
-
- rvm: 2.6.5
|
32
|
-
gemfile: gemfiles/graphql_1.9.gemfile
|
33
|
-
- rvm: 2.6.5
|
34
|
-
gemfile: gemfiles/graphql_1.10.gemfile
|
data/Appraisals
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
appraise "graphql-1.9" do
|
2
|
-
gem "graphql", "~> 1.9.0"
|
3
|
-
end
|
4
|
-
|
5
|
-
appraise "graphql-1.10" do
|
6
|
-
gem "graphql", "~> 1.10.0"
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise "graphql-1.11" do
|
10
|
-
gem "graphql", "~> 1.11.0"
|
11
|
-
end
|
12
|
-
|
13
|
-
appraise "anycable-0.6" do
|
14
|
-
gem "anycable", "~> 0.6.0"
|
15
|
-
end
|
16
|
-
|
17
|
-
appraise "anycable-1.0" do
|
18
|
-
gem "anycable", "~> 1.0.0.preview1"
|
19
|
-
end
|
data/gemfiles/.bundle/config
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "anycable", "~> 0.6.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "pry"
|
9
|
-
gem "pry-byebug", platform: :mri
|
10
|
-
gem "rubocop"
|
11
|
-
gem "rubocop-rspec"
|
12
|
-
end
|
13
|
-
|
14
|
-
gemspec path: "../"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "anycable", "~> 1.0.0.preview1"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "pry"
|
9
|
-
gem "pry-byebug", platform: :mri
|
10
|
-
gem "rubocop"
|
11
|
-
gem "rubocop-rspec"
|
12
|
-
end
|
13
|
-
|
14
|
-
gemspec path: "../"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "graphql", "~> 1.10.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "pry"
|
9
|
-
gem "pry-byebug", platform: :mri
|
10
|
-
gem "rubocop"
|
11
|
-
gem "rubocop-rspec"
|
12
|
-
end
|
13
|
-
|
14
|
-
gemspec path: "../"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "graphql", "~> 1.11.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "pry"
|
9
|
-
gem "pry-byebug", platform: :mri
|
10
|
-
gem "rubocop"
|
11
|
-
gem "rubocop-rspec"
|
12
|
-
end
|
13
|
-
|
14
|
-
gemspec path: "../"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "graphql", "~> 1.9.0"
|
6
|
-
|
7
|
-
group :development, :test do
|
8
|
-
gem "pry"
|
9
|
-
gem "pry-byebug", platform: :mri
|
10
|
-
gem "rubocop"
|
11
|
-
gem "rubocop-rspec"
|
12
|
-
end
|
13
|
-
|
14
|
-
gemspec path: "../"
|