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

feat: codegen supergraph #2544

Merged
merged 7 commits into from
Aug 16, 2023
Merged

feat: codegen supergraph #2544

merged 7 commits into from
Aug 16, 2023

Conversation

ntheile
Copy link
Contributor

@ntheile ntheile commented Aug 8, 2023

This PR adds the codegen config for the supergraph so the mobile app can query my welcome profile.

The query will look like this:

query myWelcomeProfile {
    me {
      defaultAccount {
        ... on ConsumerAccount {
            welcomeProfile {
              leaderboardName
              allTimePoints
              allTimeRank
              innerCircleAllTimeCount
              innerCircleThisMonthCount
              outerCircleAllTimeCount
              outerCircleThisMonthCount
              thisMonthPoints
              thisMonthRank
            }
        }
      }
    }
  }

The hook should look something like this:

useMyWelcomeProfileQuery({
  fetchPolicy: "no-cache",
  skip: !isAuthed
})

TODO

"@graphql-codegen/client-preset": "^3.0.1",
"@graphql-codegen/typescript": "^3.0.0",
"@graphql-codegen/typescript-operations": "^3.0.0",
"@graphql-codegen/cli": "^5.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was upgrading all the codegen tools required to get it to work with the super graph?

Copy link
Contributor Author

@ntheile ntheile Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was originally getting alot of errors when running codegen, so the first task did was update all the packages. but the main package to make federation work is @graphql-codegen/typescript-resolvers. So not sure if all the others need to be updated, but it seems to work

Comment on lines -77 to -84
query supportedCountries {
globals {
supportedCountries {
id
supportedAuthChannels
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was duplicated in the codebase

walletId: $walletId
address: $address
amount: $amount
targetConfirmations: $targetConfirmations
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targetConfirmations is a depreciated field that is not used in the mobile app

@ntheile ntheile marked this pull request as ready for review August 14, 2023 21:24
@@ -1,6 +1,6 @@
overwrite: true
schema: "https://raw.githubusercontent.com/GaloyMoney/galoy/main/src/graphql/public/schema.graphql"
# schema: "../galoy/src/graphql/public/schema.graphql"
schema: "https://api.staging.galoy.io/graphql"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will always have to target a live environment from now on? couldn't we write the graphql somewhere?

Copy link
Contributor Author

@ntheile ntheile Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the introspection endpoint. i am not sure how to easily get the raw supergraph graphql otherwise because its in the private circles repo (i.e the https://raw.githubusercontent.com/GaloyMoney/blink-circles/main/dev/apollo-federation/supergraph.graphql?token=TOKEN_HERE url probably won't work because it has a ?token secret appended to the end).

@krtk6160 do you have any ideas on how to write the supergraph.graphql somewhere public during the CI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bodymindarts Any thoughts on where we can keep the generated supergraph?
Should we sync it to the mobile repo like we sync the proto files?

@ntheile ntheile merged commit 2b8cb5d into main Aug 16, 2023
7 checks passed
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