Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli][1/2] unify channel graphql query types #1949

Merged
merged 2 commits into from
Jul 25, 2023
Merged

Conversation

quinlanj
Copy link
Member

@quinlanj quinlanj commented Jul 25, 2023

Why

For graphql queries that have the same fields, unify them with fragments if possible. There is one exception, where plan to parameterize instead of keeping constant:

  query FooQuery($appId: String!, $offset: Int!, $limit: Int!) {
    app {
      byId(appId: $appId) {
        id
        updateChannels(offset: $offset, limit: $limit) {
          updateBranches(offset: 0, limit: 5) { <---- We plan to parameterize these arguments instead of keeping it constant
            id
          }
        }
      }
    }
  }

Unfortunately, graphql does not allow for parameterized fragments so I create an intersection type to unify the channel fields: UpdateChannelObject = ViewUpdateChannelsOnAppObject & UpdateChannelByNameObject;

How

Create fragments and intersection types

Test Plan

  • current tests pass

@quinlanj quinlanj requested a review from wschurman July 25, 2023 03:24
@quinlanj
Copy link
Member Author

/changelog-entry chore unify channel graphql query types

@quinlanj quinlanj marked this pull request as ready for review July 25, 2023 03:28
@github-actions
Copy link

✅ Thank you for adding the changelog entry!

@github-actions
Copy link

github-actions bot commented Jul 25, 2023

Size Change: +7.11 kB (0%)

Total Size: 42.1 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 42.1 MB +7.11 kB (0%)

compressed-size-action

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #1949 (2af0117) into main (51d0555) will increase coverage by 0.02%.
The diff coverage is 65.00%.

@@            Coverage Diff             @@
##             main    #1949      +/-   ##
==========================================
+ Coverage   52.71%   52.72%   +0.02%     
==========================================
  Files         481      483       +2     
  Lines       17439    17456      +17     
  Branches     3492     3493       +1     
==========================================
+ Hits         9191     9202      +11     
- Misses       8231     8237       +6     
  Partials       17       17              
Files Changed Coverage Δ
packages/eas-cli/src/graphql/generated.ts 100.00% <ø> (ø)
...ckages/eas-cli/src/graphql/queries/ChannelQuery.ts 28.00% <25.00%> (-5.33%) ⬇️
packages/eas-cli/src/commands/channel/rollout.ts 14.60% <50.00%> (ø)
packages/eas-cli/src/channel/queries.ts 20.46% <100.00%> (+1.85%) ⬆️
packages/eas-cli/src/commands/channel/edit.ts 42.56% <100.00%> (+2.56%) ⬆️
...src/graphql/types/UpdateBranchWithCurrentUpdate.ts 100.00% <100.00%> (ø)
...as-cli/src/graphql/types/UpdateChannelBasicInfo.ts 100.00% <100.00%> (ø)

@quinlanj quinlanj merged commit 1f5533e into main Jul 25, 2023
9 checks passed
@quinlanj quinlanj deleted the @quin/unifyGqlTypes-0 branch July 25, 2023 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants