-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #768 from near/main
Bug Fixes: Socket Hangup error now contains proper stack trace Errors which terminate indexer execution are properly displayed in logs rather than as [Object object] Fixed any broken links due to the migration to dev.near.org Changes: Indexer forks are now stored and added to contract Indexer Management server endpoint opened and improvements to indexer state made Utility classes for handling graphQL calls and Bitmap operations added to Block Streamer Feature Releases: New Logs Page! Leverages new logs tables leading to more enriched filtering and searching as well as faster response times Table formatting improved to reduce clutter and group relevant text Search bar now searches all logs rather than just logs on same page New toolbar added to provide filtering on logs Status and latest block height now refresh as well as logs More improvements to come! New Indexer Editor Page! Editor page UI overhauled to improve visibility of all the different buttons that can be used on the page Color theme and styling unified across banners Code editor no longer clips bottom of page
- Loading branch information
Showing
92 changed files
with
11,909 additions
and
3,212 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// TODO: Improve README further | ||
|
||
## GraphQL Code Generation | ||
Querying a GraphQL requires informing Rust of the correct types to deserialize the response data into. In order to do this, the schema of the GraphQL data needs to be introspected. Following that, the query intended to be called needs to be fully defined. With this information, code can be automatically generated using the macro provided in graphql-client. Below are the instructions on how to do so. | ||
|
||
### Generating schema.graphql | ||
Follow the instructions in the [Hasura Documentation](https://hasura.io/docs/latest/schema/common-patterns/export-graphql-schema/) to introspect the schema and generate the graphql file. Keep in mind that a header for the role needs to be provided. Otherwise, the schemas remain hidden from the public/default user. | ||
|
||
For example: `gq https://my-graphql-engine.com/v1/graphql -H 'X-Hasura-Role: someaccount_near' --introspect > schema.graphql` | ||
|
||
### Generating Rust types from query | ||
After acquiring the graphql file for the schema, write the queries that need to be called in individual graphql files. Once written, add the following code template to a Rust file and the code will be auto generated using the macro. Assuming there are no problems generating the code, the code will be immediately usable. | ||
|
||
``` | ||
#[derive(GraphQLQuery)] | ||
#[graphql( | ||
schema_path = "PATH/TO/schema.graphql", | ||
query_path = "PATH/TO/query.graphql", | ||
response_derives = "Debug", | ||
normalization = "rust" | ||
)] | ||
struct QueryNameInPascalCase; | ||
``` |
6 changes: 6 additions & 0 deletions
6
block-streamer/graphql/darunrs_near/get_bitmaps_exact.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
query GetBitmapsExact($block_date: date, $receiver_ids: [String!], $limit: Int, $offset: Int) { | ||
darunrs_near_bitmap_v5_actions_index(limit: $limit, offset: $offset, where: {block_date: {_eq: $block_date}, receiver: {receiver: {_in: $receiver_ids}}}) { | ||
bitmap | ||
first_block_height | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
block-streamer/graphql/darunrs_near/get_bitmaps_wildcard.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
query GetBitmapsWildcard($block_date: date, $receiver_ids: String, $limit: Int, $offset: Int) { | ||
darunrs_near_bitmap_v5_actions_index(limit: $limit, offset: $offset, where: {block_date: {_eq: $block_date}, receiver: {receiver: {_regex: $receiver_ids}}}) { | ||
bitmap | ||
first_block_height | ||
} | ||
} |
Oops, something went wrong.