graphql-hive 0.6.3 → 0.6.5
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/CODEOWNERS +1 -0
- data/.github/dependabot.yml +0 -21
- data/.github/workflows/ci.yml +16 -8
- data/.github/workflows/codeql.yml +23 -0
- data/.github/workflows/lint-pr-title.yml +14 -0
- data/.github/workflows/release.yml +54 -0
- data/.gitignore +2 -7
- data/.release-please-manifest.json +3 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +16 -0
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +13 -9
- data/LICENSE +2 -1
- data/NOTICE +6 -0
- data/README.md +12 -2
- data/graphql-hive.gemspec +9 -4
- data/lib/graphql-hive/analyzer.rb +62 -10
- data/lib/graphql-hive/usage_reporter.rb +10 -2
- data/lib/graphql-hive/version.rb +1 -1
- data/lib/graphql-hive.rb +2 -1
- data/release-please-config.json +13 -0
- metadata +19 -11
- data/.github/workflows/guardrails.yml +0 -15
- data/RELEASING.md +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fa33a96e20e7429e87a7a1a3d7dea4d42a826c7aa58275234f1765bb2d990dc
|
|
4
|
+
data.tar.gz: a6366ab15aa1b76609406a01430eb71877d8f634a3e587a6a75bf5416c21fccb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d798387a6a48648f5ef8a07c30e27aeb645327f5c334ff85684f3268cb12e99ab53131c6c8f72d9f24e0a62800271984c80006813a185de7a570411c3988b881
|
|
7
|
+
data.tar.gz: 262294726fdc7e9e22ab7079c04e143b34ab9334b47fc80797828b3aff9c5dab45b848c39c5e29122f40801cdc9b9310e00e554ce1eb3e1da9f38e3422a63254
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @wealthsimple-community/oss-maintainers-graphql-ruby-hive @wealthsimple-community/oss-admins
|
data/.github/dependabot.yml
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
3
|
- package-ecosystem: bundler
|
|
4
|
-
registries:
|
|
5
|
-
- rubygems-public-reposerver
|
|
6
|
-
- rubygems-internal-reposerver
|
|
7
|
-
- rubygems-sidekiq-reposerver
|
|
8
4
|
directories:
|
|
9
5
|
- /
|
|
10
6
|
schedule:
|
|
@@ -18,7 +14,6 @@ updates:
|
|
|
18
14
|
separator: '-'
|
|
19
15
|
open-pull-requests-limit: 10
|
|
20
16
|
rebase-strategy: disabled
|
|
21
|
-
insecure-external-code-execution: allow
|
|
22
17
|
groups:
|
|
23
18
|
development-dependencies:
|
|
24
19
|
dependency-type: 'development'
|
|
@@ -30,19 +25,3 @@ updates:
|
|
|
30
25
|
update-types:
|
|
31
26
|
- 'patch'
|
|
32
27
|
- 'minor'
|
|
33
|
-
registries:
|
|
34
|
-
rubygems-public-reposerver:
|
|
35
|
-
type: rubygems-server
|
|
36
|
-
url: https://reposerver.w10external.com/repository/gems
|
|
37
|
-
username: ${{ secrets.REPOSERVER_CI_READ_USERNAME }}
|
|
38
|
-
password: ${{ secrets.REPOSERVER_CI_READ_PASSWORD }}
|
|
39
|
-
rubygems-internal-reposerver:
|
|
40
|
-
type: rubygems-server
|
|
41
|
-
url: https://reposerver.w10external.com/repository/gems-internal
|
|
42
|
-
username: ${{ secrets.REPOSERVER_CI_READ_USERNAME }}
|
|
43
|
-
password: ${{ secrets.REPOSERVER_CI_READ_PASSWORD }}
|
|
44
|
-
rubygems-sidekiq-reposerver:
|
|
45
|
-
type: rubygems-server
|
|
46
|
-
url: https://reposerver.w10external.com/repository/gems-sidekiq
|
|
47
|
-
username: ${{ secrets.REPOSERVER_CI_READ_USERNAME }}
|
|
48
|
-
password: ${{ secrets.REPOSERVER_CI_READ_PASSWORD }}
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
name: CI
|
|
2
|
+
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
4
5
|
branches:
|
|
5
|
-
-
|
|
6
|
+
- main
|
|
6
7
|
pull_request:
|
|
7
8
|
branches:
|
|
8
|
-
-
|
|
9
|
+
- main
|
|
9
10
|
|
|
10
11
|
jobs:
|
|
11
|
-
|
|
12
|
+
lint:
|
|
12
13
|
runs-on: ubuntu-latest
|
|
13
14
|
steps:
|
|
15
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
16
|
+
|
|
17
|
+
- uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0
|
|
18
|
+
with:
|
|
19
|
+
bundler-cache: true
|
|
20
|
+
|
|
14
21
|
- name: Standard Ruby
|
|
15
|
-
|
|
22
|
+
run: bundle exec standardrb --format github
|
|
23
|
+
|
|
16
24
|
test:
|
|
17
25
|
strategy:
|
|
18
26
|
fail-fast: false
|
|
19
27
|
matrix:
|
|
20
28
|
ruby-version:
|
|
21
|
-
- "3.1"
|
|
22
|
-
- "3.2"
|
|
23
29
|
- "3.3"
|
|
30
|
+
- "3.4"
|
|
31
|
+
- "4.0"
|
|
24
32
|
runs-on: ubuntu-latest
|
|
25
33
|
steps:
|
|
26
|
-
- uses: actions/checkout@
|
|
34
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
27
35
|
|
|
28
|
-
- uses: ruby/setup-ruby@
|
|
36
|
+
- uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0
|
|
29
37
|
with:
|
|
30
38
|
ruby-version: ${{ matrix.ruby-version }}
|
|
31
39
|
bundler-cache: true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
schedule:
|
|
9
|
+
- cron: '30 4 * * 1' # weekly, Monday 04:30 UTC
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
security-events: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
codeql:
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
security-events: write
|
|
20
|
+
actions: read
|
|
21
|
+
uses: wealthsimple-community/.github/.github/workflows/codeql.yml@main
|
|
22
|
+
with:
|
|
23
|
+
languages: '["ruby"]'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: Lint PR Title
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, edited, reopened, synchronize]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
pull-requests: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint-pr-title:
|
|
12
|
+
permissions:
|
|
13
|
+
pull-requests: read
|
|
14
|
+
uses: wealthsimple-community/.github/.github/workflows/lint-pr-title.yml@main
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
pull-requests: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: release-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
release-please:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
outputs:
|
|
21
|
+
releases_created: ${{ steps.release.outputs.releases_created }}
|
|
22
|
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
23
|
+
steps:
|
|
24
|
+
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
|
|
25
|
+
id: release
|
|
26
|
+
|
|
27
|
+
publish:
|
|
28
|
+
needs: release-please
|
|
29
|
+
if: needs.release-please.outputs.releases_created == 'true'
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
environment: release
|
|
32
|
+
permissions:
|
|
33
|
+
contents: read
|
|
34
|
+
id-token: write
|
|
35
|
+
attestations: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
38
|
+
with:
|
|
39
|
+
ref: ${{ needs.release-please.outputs.tag_name }}
|
|
40
|
+
persist-credentials: false
|
|
41
|
+
|
|
42
|
+
- uses: ruby/setup-ruby@89f90524b88a01fe6e0b732220432cc6142926af # v1.313.0
|
|
43
|
+
with:
|
|
44
|
+
bundler-cache: true
|
|
45
|
+
|
|
46
|
+
- name: Build gem
|
|
47
|
+
run: gem build graphql-hive.gemspec
|
|
48
|
+
|
|
49
|
+
- name: Generate GitHub build provenance attestation
|
|
50
|
+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
|
|
51
|
+
with:
|
|
52
|
+
subject-path: "*.gem"
|
|
53
|
+
|
|
54
|
+
- uses: rubygems/release-gem@052cc82692552de3ef2b81fd670e41d13cba8092 # v1.4.0
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.4.9
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.6.5](https://github.com/wealthsimple-community/graphql-ruby-hive/compare/v0.6.4...v0.6.5) (2026-09-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* support processVariables ([#14](https://github.com/wealthsimple-community/graphql-ruby-hive/issues/14)) ([94cc38f](https://github.com/wealthsimple-community/graphql-ruby-hive/commit/94cc38f9e379c5aa7dd85e40d46f8add17a9fb57))
|
|
9
|
+
|
|
10
|
+
## [0.6.4](https://github.com/wealthsimple-community/graphql-ruby-hive/compare/v0.6.3...v0.6.4) (2026-08-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **gemspec:** raise required_ruby_version to 2.7.0 ([#4](https://github.com/wealthsimple-community/graphql-ruby-hive/issues/4)) ([e85343b](https://github.com/wealthsimple-community/graphql-ruby-hive/commit/e85343b8870fcdde4fcdc1f5594c9ac209916641))
|
|
16
|
+
* **release:** stop expecting component-prefixed release tags ([#3](https://github.com/wealthsimple-community/graphql-ruby-hive/issues/3)) ([bd8d30f](https://github.com/wealthsimple-community/graphql-ruby-hive/commit/bd8d30f703f6fe67bb67349871a8f10f1bec59e7))
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
bundle install
|
|
7
|
+
bundle exec rake spec
|
|
8
|
+
bundle exec rubocop
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commit messages
|
|
12
|
+
|
|
13
|
+
This repo uses [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`,
|
|
14
|
+
`chore:`, etc.) for PR titles. [release-please](https://github.com/googleapis/release-please)
|
|
15
|
+
parses these to determine the next version and generate `CHANGELOG.md`, so PR titles matter more
|
|
16
|
+
than individual commit messages on branches merged via squash.
|
|
17
|
+
|
|
18
|
+
## Releasing
|
|
19
|
+
|
|
20
|
+
Releases are automated:
|
|
21
|
+
|
|
22
|
+
1. Merging a PR to `main` triggers [release-please](https://github.com/googleapis/release-please),
|
|
23
|
+
which opens or updates a "release PR" bumping `lib/graphql-hive/version.rb` and `CHANGELOG.md`
|
|
24
|
+
based on Conventional Commits merged since the last release.
|
|
25
|
+
2. Merging that release PR creates a git tag and GitHub Release, which triggers the `publish` job
|
|
26
|
+
in [`.github/workflows/release.yml`](.github/workflows/release.yml) to build and push the gem to
|
|
27
|
+
[RubyGems.org](https://rubygems.org/gems/graphql-hive) via OIDC trusted publishing.
|
|
28
|
+
|
|
29
|
+
No manual `gem push` or version bump is needed — don't edit `version.rb` by hand.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
graphql-hive (0.6.
|
|
4
|
+
graphql-hive (0.6.5)
|
|
5
5
|
graphql (>= 2.4.12, < 3)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
addressable (2.
|
|
11
|
-
public_suffix (>= 2.0.2, <
|
|
10
|
+
addressable (2.9.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
12
|
ast (2.4.2)
|
|
13
|
-
base64 (0.
|
|
13
|
+
base64 (0.3.0)
|
|
14
14
|
bigdecimal (3.1.8)
|
|
15
|
+
cgi (0.5.2)
|
|
15
16
|
crack (1.0.0)
|
|
16
17
|
bigdecimal
|
|
17
18
|
rexml
|
|
@@ -20,7 +21,7 @@ GEM
|
|
|
20
21
|
reline (>= 0.3.8)
|
|
21
22
|
diff-lcs (1.5.1)
|
|
22
23
|
fiber-storage (1.0.0)
|
|
23
|
-
graphql (2.4.
|
|
24
|
+
graphql (2.4.18)
|
|
24
25
|
base64
|
|
25
26
|
fiber-storage
|
|
26
27
|
logger
|
|
@@ -32,18 +33,19 @@ GEM
|
|
|
32
33
|
json (2.7.2)
|
|
33
34
|
language_server-protocol (3.17.0.3)
|
|
34
35
|
lint_roller (1.1.0)
|
|
35
|
-
logger (1.
|
|
36
|
+
logger (1.7.0)
|
|
36
37
|
mustermann (2.0.2)
|
|
37
38
|
ruby2_keywords (~> 0.0.1)
|
|
39
|
+
ostruct (0.6.3)
|
|
38
40
|
parallel (1.26.3)
|
|
39
41
|
parser (3.3.5.0)
|
|
40
42
|
ast (~> 2.4.1)
|
|
41
43
|
racc
|
|
42
44
|
psych (5.1.2)
|
|
43
45
|
stringio
|
|
44
|
-
public_suffix (
|
|
46
|
+
public_suffix (5.1.1)
|
|
45
47
|
racc (1.8.1)
|
|
46
|
-
rack (2.2.
|
|
48
|
+
rack (2.2.23)
|
|
47
49
|
rack-protection (2.2.4)
|
|
48
50
|
rack
|
|
49
51
|
rack-test (2.1.0)
|
|
@@ -55,7 +57,7 @@ GEM
|
|
|
55
57
|
regexp_parser (2.9.2)
|
|
56
58
|
reline (0.5.10)
|
|
57
59
|
io-console (~> 0.5)
|
|
58
|
-
rexml (3.
|
|
60
|
+
rexml (3.4.2)
|
|
59
61
|
rspec (3.13.0)
|
|
60
62
|
rspec-core (~> 3.13.0)
|
|
61
63
|
rspec-expectations (~> 3.13.0)
|
|
@@ -122,8 +124,10 @@ PLATFORMS
|
|
|
122
124
|
|
|
123
125
|
DEPENDENCIES
|
|
124
126
|
bundler (~> 2)
|
|
127
|
+
cgi
|
|
125
128
|
debug (>= 1.0.0)
|
|
126
129
|
graphql-hive!
|
|
130
|
+
ostruct
|
|
127
131
|
rack-test (~> 2)
|
|
128
132
|
rake (~> 13)
|
|
129
133
|
rspec (~> 3)
|
data/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022 Charly
|
|
3
|
+
Copyright (c) 2022 Charly Poly
|
|
4
|
+
Copyright (c) 2022-2026 Wealthsimple Technologies Inc.
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/NOTICE
ADDED
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# GraphQL Hive: `graphql-ruby` integration
|
|
2
|
-
[](https://github.com/wealthsimple-community/graphql-ruby-hive/actions)
|
|
3
3
|
[](https://rubygems.org/gems/graphql-hive)
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
@@ -179,6 +179,10 @@ class MySchema < GraphQL::Schema
|
|
|
179
179
|
queue_size: 1000,
|
|
180
180
|
# Report usage to Hive.
|
|
181
181
|
collect_usage: true,
|
|
182
|
+
# Inspect actual variable payloads to report only the input fields and enum values
|
|
183
|
+
# a client actually provided, rather than every field that could theoretically be
|
|
184
|
+
# used. See the `process_variables` section below for details and trade-offs.
|
|
185
|
+
process_variables: false,
|
|
182
186
|
# Usage sampling configurations.
|
|
183
187
|
collect_usage_sampling: {
|
|
184
188
|
# % of operations recorded.
|
|
@@ -214,7 +218,7 @@ class MySchema < GraphQL::Schema
|
|
|
214
218
|
end
|
|
215
219
|
```
|
|
216
220
|
|
|
217
|
-
See default options for the optional parameters [here](https://github.com/
|
|
221
|
+
See default options for the optional parameters [here](https://github.com/wealthsimple-community/graphql-ruby-hive/blob/master/lib/graphql-hive.rb#L32-L46).
|
|
218
222
|
|
|
219
223
|
<br/>
|
|
220
224
|
|
|
@@ -225,3 +229,9 @@ See default options for the optional parameters [here](https://github.com/rperry
|
|
|
225
229
|
> `queue_size` is the size of the queue used to send operations to the buffer before sampling.
|
|
226
230
|
> Adjust these values according to your application's memory constraints and throughput.
|
|
227
231
|
> High throughput applications will need a larger `queue_size`.
|
|
232
|
+
|
|
233
|
+
## `process_variables`
|
|
234
|
+
|
|
235
|
+
By default, when an input object or enum is passed through a `$variable`, every field of that input type (or every value of that enum) is reported as used — the conservative assumption. Setting `process_variables: true` reports only the coordinates a client actually populated, using both the plain form (`InputType.field`) and a `!`-suffixed form (`InputType.field!`). Hive uses the `!` form to power granular, per-input-field [conditional breaking-change](https://the-guild.dev/graphql/hive/docs/management/targets#conditional-breaking-changes) decisions.
|
|
236
|
+
|
|
237
|
+
Only schema coordinates derived from the payload structure are sent — never the variable values themselves.
|
data/graphql-hive.gemspec
CHANGED
|
@@ -7,17 +7,22 @@ require "graphql-hive/version"
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "graphql-hive"
|
|
9
9
|
spec.version = Graphql::Hive::VERSION
|
|
10
|
-
spec.authors = ["Charly
|
|
11
|
-
spec.email = ["
|
|
10
|
+
spec.authors = ["Charly Poly", "Wealthsimple"]
|
|
11
|
+
spec.email = ["foss@wealthsimple.com"]
|
|
12
12
|
|
|
13
13
|
spec.summary = '"GraphQL Hive integration for `graphql-ruby`"'
|
|
14
14
|
spec.description = '"Monitor operations, inspect your queries and publish your GraphQL schema with GraphQL Hive"'
|
|
15
15
|
spec.homepage = "https://docs.graphql-hive.com/specs/integrations"
|
|
16
16
|
spec.license = "MIT"
|
|
17
17
|
|
|
18
|
-
spec.metadata = {
|
|
18
|
+
spec.metadata = {
|
|
19
|
+
"rubygems_mfa_required" => "true",
|
|
20
|
+
"source_code_uri" => "https://github.com/wealthsimple-community/graphql-ruby-hive",
|
|
21
|
+
"changelog_uri" => "https://github.com/wealthsimple-community/graphql-ruby-hive/blob/master/CHANGELOG.md",
|
|
22
|
+
"bug_tracker_uri" => "https://github.com/wealthsimple-community/graphql-ruby-hive/issues"
|
|
23
|
+
}
|
|
19
24
|
|
|
20
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
25
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
21
26
|
|
|
22
27
|
spec.require_paths = ["lib"]
|
|
23
28
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
@@ -4,9 +4,11 @@ module GraphQL
|
|
|
4
4
|
class Hive < GraphQL::Tracing::PlatformTracing
|
|
5
5
|
# Fetch all users fields, input objects and enums
|
|
6
6
|
class Analyzer < GraphQL::Analysis::AST::Analyzer
|
|
7
|
-
def initialize(query_or_multiplex)
|
|
8
|
-
super
|
|
7
|
+
def initialize(query_or_multiplex, options = {})
|
|
8
|
+
super(query_or_multiplex)
|
|
9
9
|
@used_fields = Set.new
|
|
10
|
+
@process_variables = options.fetch(:process_variables, false)
|
|
11
|
+
@provided_variables = (@process_variables && query_or_multiplex.respond_to?(:provided_variables)) ? (query_or_multiplex.provided_variables || {}) : {}
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def on_enter_field(node, _parent, visitor)
|
|
@@ -29,9 +31,9 @@ module GraphQL
|
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
if arg_type.kind.input_object?
|
|
32
|
-
collect_input_object_fields(node, arg_type)
|
|
34
|
+
collect_input_object_fields(node, arg_type, visitor.argument_definition.type)
|
|
33
35
|
elsif arg_type.kind.enum?
|
|
34
|
-
collect_enum_values(node, arg_type)
|
|
36
|
+
collect_enum_values(node, arg_type, visitor.argument_definition.type)
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
|
|
@@ -43,11 +45,15 @@ module GraphQL
|
|
|
43
45
|
|
|
44
46
|
private
|
|
45
47
|
|
|
46
|
-
def collect_input_object_fields(node, input_type)
|
|
48
|
+
def collect_input_object_fields(node, input_type, full_type)
|
|
47
49
|
case node.value
|
|
48
50
|
when GraphQL::Language::Nodes::VariableIdentifier
|
|
49
|
-
|
|
50
|
-
@
|
|
51
|
+
if @process_variables
|
|
52
|
+
walk_variable_value(full_type, @provided_variables[node.value.name])
|
|
53
|
+
else
|
|
54
|
+
input_type.all_argument_definitions.map(&:graphql_name).each do |n|
|
|
55
|
+
@used_fields.add(make_id(input_type.graphql_name, n))
|
|
56
|
+
end
|
|
51
57
|
end
|
|
52
58
|
when Array
|
|
53
59
|
node.value.flat_map(&:arguments).map(&:name).each do |n|
|
|
@@ -60,11 +66,15 @@ module GraphQL
|
|
|
60
66
|
end
|
|
61
67
|
end
|
|
62
68
|
|
|
63
|
-
def collect_enum_values(node, enum_type)
|
|
69
|
+
def collect_enum_values(node, enum_type, full_type)
|
|
64
70
|
case node.value
|
|
65
71
|
when GraphQL::Language::Nodes::VariableIdentifier
|
|
66
|
-
|
|
67
|
-
@
|
|
72
|
+
if @process_variables
|
|
73
|
+
walk_variable_value(full_type, @provided_variables[node.value.name])
|
|
74
|
+
else
|
|
75
|
+
enum_type.values.values.map(&:graphql_name).each do |n|
|
|
76
|
+
@used_fields.add(make_id(enum_type.graphql_name, n))
|
|
77
|
+
end
|
|
68
78
|
end
|
|
69
79
|
when Array
|
|
70
80
|
node.value.map(&:name).each do |n|
|
|
@@ -75,6 +85,48 @@ module GraphQL
|
|
|
75
85
|
end
|
|
76
86
|
end
|
|
77
87
|
|
|
88
|
+
# Recursively walk a variable's runtime value, marking only the schema
|
|
89
|
+
# coordinates that were actually provided. Mirrors the JS client's
|
|
90
|
+
# processVariables behavior, including the `!` suffix for input object
|
|
91
|
+
# fields that received a non-null value.
|
|
92
|
+
def walk_variable_value(type, value)
|
|
93
|
+
return if value.nil?
|
|
94
|
+
|
|
95
|
+
t = type
|
|
96
|
+
t = t.of_type while t.non_null?
|
|
97
|
+
|
|
98
|
+
if t.list?
|
|
99
|
+
return unless value.is_a?(Array)
|
|
100
|
+
inner = t.of_type
|
|
101
|
+
value.each { |item| walk_variable_value(inner, item) }
|
|
102
|
+
return
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if t.kind.input_object?
|
|
106
|
+
walk_input_object(t, value)
|
|
107
|
+
elsif t.kind.enum?
|
|
108
|
+
@used_fields.add(make_id(t.graphql_name, value.to_s))
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def walk_input_object(input_type, value)
|
|
113
|
+
return unless value.is_a?(Hash)
|
|
114
|
+
|
|
115
|
+
arg_defs = input_type.all_argument_definitions.each_with_object({}) { |a, h| h[a.graphql_name] = a }
|
|
116
|
+
|
|
117
|
+
value.each do |field_name, field_value|
|
|
118
|
+
key = field_name.to_s
|
|
119
|
+
arg = arg_defs[key]
|
|
120
|
+
next unless arg
|
|
121
|
+
|
|
122
|
+
coord = make_id(input_type.graphql_name, key)
|
|
123
|
+
@used_fields.add(coord)
|
|
124
|
+
@used_fields.add("#{coord}!") unless field_value.nil?
|
|
125
|
+
|
|
126
|
+
walk_variable_value(arg.type, field_value)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
78
130
|
def make_id(*tokens)
|
|
79
131
|
tokens.join(".")
|
|
80
132
|
end
|
|
@@ -105,7 +105,7 @@ module GraphQL
|
|
|
105
105
|
fields = Set.new
|
|
106
106
|
|
|
107
107
|
queries.each do |query|
|
|
108
|
-
analyzer = GraphQL::Hive::Analyzer.new(query)
|
|
108
|
+
analyzer = GraphQL::Hive::Analyzer.new(query, process_variables: @options[:process_variables])
|
|
109
109
|
visitor = GraphQL::Analysis::AST::Visitor.new(
|
|
110
110
|
query: query,
|
|
111
111
|
analyzers: [analyzer],
|
|
@@ -139,8 +139,16 @@ module GraphQL
|
|
|
139
139
|
operation_record[:metadata] = {client: @options[:client_info].call(context)} if @options[:client_info]
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
+
# Union with any existing fields for this key. Operations that share a document
|
|
143
|
+
# but differ in variables produce the same operation_map_key (MD5 of the printed
|
|
144
|
+
# operation body, which does not include variable values) but can produce
|
|
145
|
+
# different coord sets under process_variables. Overwriting would drop the
|
|
146
|
+
# earlier op's coord evidence for this batch.
|
|
147
|
+
existing_fields = report[:map][operation_map_key]&.fetch(:fields, nil)
|
|
148
|
+
merged_fields = existing_fields ? (Set.new(existing_fields) | fields) : fields
|
|
149
|
+
|
|
142
150
|
report[:map][operation_map_key] = {
|
|
143
|
-
fields:
|
|
151
|
+
fields: merged_fields.to_a,
|
|
144
152
|
operationName: operation_name,
|
|
145
153
|
operation: operation
|
|
146
154
|
}
|
data/lib/graphql-hive/version.rb
CHANGED
data/lib/graphql-hive.rb
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bootstrap-sha": "d0fcb04b04e867ec57a2d5328a7b3b141e014ce5",
|
|
3
|
+
"include-component-in-tag": false,
|
|
4
|
+
"packages": {
|
|
5
|
+
".": {
|
|
6
|
+
"release-type": "ruby",
|
|
7
|
+
"package-name": "graphql-hive",
|
|
8
|
+
"version-file": "lib/graphql-hive/version.rb",
|
|
9
|
+
"bump-minor-pre-major": true,
|
|
10
|
+
"bump-patch-for-minor-pre-major": true
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql-hive
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- Charly
|
|
8
|
-
|
|
7
|
+
- Charly Poly
|
|
8
|
+
- Wealthsimple
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: graphql
|
|
@@ -33,23 +33,29 @@ dependencies:
|
|
|
33
33
|
description: '"Monitor operations, inspect your queries and publish your GraphQL schema
|
|
34
34
|
with GraphQL Hive"'
|
|
35
35
|
email:
|
|
36
|
-
-
|
|
36
|
+
- foss@wealthsimple.com
|
|
37
37
|
executables: []
|
|
38
38
|
extensions: []
|
|
39
39
|
extra_rdoc_files: []
|
|
40
40
|
files:
|
|
41
|
+
- ".github/CODEOWNERS"
|
|
41
42
|
- ".github/dependabot.yml"
|
|
42
43
|
- ".github/workflows/ci.yml"
|
|
43
|
-
- ".github/workflows/
|
|
44
|
+
- ".github/workflows/codeql.yml"
|
|
45
|
+
- ".github/workflows/lint-pr-title.yml"
|
|
46
|
+
- ".github/workflows/release.yml"
|
|
44
47
|
- ".gitignore"
|
|
48
|
+
- ".release-please-manifest.json"
|
|
45
49
|
- ".rspec"
|
|
46
50
|
- ".rubocop.yml"
|
|
47
51
|
- ".ruby-version"
|
|
52
|
+
- CHANGELOG.md
|
|
53
|
+
- CONTRIBUTING.md
|
|
48
54
|
- Gemfile
|
|
49
55
|
- Gemfile.lock
|
|
50
56
|
- LICENSE
|
|
57
|
+
- NOTICE
|
|
51
58
|
- README.md
|
|
52
|
-
- RELEASING.md
|
|
53
59
|
- Rakefile
|
|
54
60
|
- cover.png
|
|
55
61
|
- graphql-hive.gemspec
|
|
@@ -64,12 +70,15 @@ files:
|
|
|
64
70
|
- lib/graphql-hive/usage_reporter.rb
|
|
65
71
|
- lib/graphql-hive/version.rb
|
|
66
72
|
- operations-dashboard.png
|
|
73
|
+
- release-please-config.json
|
|
67
74
|
homepage: https://docs.graphql-hive.com/specs/integrations
|
|
68
75
|
licenses:
|
|
69
76
|
- MIT
|
|
70
77
|
metadata:
|
|
71
78
|
rubygems_mfa_required: 'true'
|
|
72
|
-
|
|
79
|
+
source_code_uri: https://github.com/wealthsimple-community/graphql-ruby-hive
|
|
80
|
+
changelog_uri: https://github.com/wealthsimple-community/graphql-ruby-hive/blob/master/CHANGELOG.md
|
|
81
|
+
bug_tracker_uri: https://github.com/wealthsimple-community/graphql-ruby-hive/issues
|
|
73
82
|
rdoc_options: []
|
|
74
83
|
require_paths:
|
|
75
84
|
- lib
|
|
@@ -77,15 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
77
86
|
requirements:
|
|
78
87
|
- - ">="
|
|
79
88
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: 2.
|
|
89
|
+
version: 2.7.0
|
|
81
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
91
|
requirements:
|
|
83
92
|
- - ">="
|
|
84
93
|
- !ruby/object:Gem::Version
|
|
85
94
|
version: '0'
|
|
86
95
|
requirements: []
|
|
87
|
-
rubygems_version: 3.
|
|
88
|
-
signing_key:
|
|
96
|
+
rubygems_version: 3.6.9
|
|
89
97
|
specification_version: 4
|
|
90
98
|
summary: '"GraphQL Hive integration for `graphql-ruby`"'
|
|
91
99
|
test_files: []
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
name: Guardrails
|
|
2
|
-
on:
|
|
3
|
-
workflow_dispatch:
|
|
4
|
-
merge_group:
|
|
5
|
-
pull_request:
|
|
6
|
-
types:
|
|
7
|
-
- edited
|
|
8
|
-
- synchronize
|
|
9
|
-
- opened
|
|
10
|
-
- reopened
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
run_guardrails:
|
|
14
|
-
uses: wealthsimple/github-workflows/.github/workflows/guardrails.yml@v1
|
|
15
|
-
secrets: inherit
|
data/RELEASING.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
## Releasing `graphql-hive` on RubyGems
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
1. Ensure dependencies are properly installed: `bundle`
|
|
5
|
-
1. Ensure the is working as expected: `bundle exec rspec`
|
|
6
|
-
1. **Make sure to manually bump the version in `lib/graphql-hive/version.rb`**
|
|
7
|
-
1. Build the gem: `gem build graphql-hive`
|
|
8
|
-
1. A new file should have been created, ex: `graphql-hive-0.3.0.gem`
|
|
9
|
-
1. Then, login to RubyGems: `gem login`
|
|
10
|
-
1. And publish the new version: `gem push <path_to_gem_file>` (ex: `gem push graphql-hive-0.3.0.gem`)
|